Vol. 20, #44 - November 2, 2015 - Issue #1054

Image

PowerShell automation

  1. Editor's Corner
    • PowerShell automation
    • Send us your feedback
    • Recommended for Learning
    • Microsoft Virtual Academy
    • Free White Paper
    • Registration is Open for Cloud Admin CON 2015
    • Quote of the Week
  2. Admin Toolbox
    • Admin Tools We Think You Shouldn't Be Without
  3. This Week's Tips
    • Sysadmin - When you need to step in for someone
    • Windows 10 - Deferring updates
    • ConfigMgr - Loading the ConfigMgr PowerShell module
  4. Events Calendar
    • North America
    • Europe
  5. Tech Briefing
    • PowerShell automation
  6. Recommended TechGenix Articles
    • Recommended articles from websites in TechGenix Network
  7. Other Articles of Interest
    • Getting started with container orchestration
    • Using containers: Do the pros outweigh the cons?
    • What's the difference between a VM clone and a template?
    • Configure Start screen layout, search and indexing with Windows 8
  8. WServerNews FAVE Links
    • Amazing Invisible Card Deck Magic Trick by Rose McIver At 'Jimmy Kimmel Live'
    • International Champion of Magic Mike Chao
    • America's Got Talent Winner Mat Franco Returns With New Magic Trick
    • I Didn't Know Pope Francis Was Also a Magician
  9. WServerNews - Product of the Week
    • Get Free Backup for Hyper-V & VMware from Altaro. New v6!

 

 

Editor's Corner

This week's newsletter is all about how Windows PowerShell can help the Windows system administrator save time and increase productivity through automation. We welcome Adam Bertram, independent consultant, a technical writer, trainer and presenter specializing in all things IT automation, who has contributed the guest editorial for this issue. Adam has also graciously provided us with a list of some of his most popular blog posts on PowerShell automation which we've included in the Tech Briefing section of this issue of WServerNews.

Are you exhausted from the daily grind of your job? Wouldn't it be nice if you could automate your work to make it easier? Think of all the time you'd be able to spend by the water cooler if you could do this. Here are a couple of Dilbert comic strips on this subject that can help you find automation nirvana within your own workplace:

http://www.wservernews.com/go/hbd6yx7z/

http://www.wservernews.com/go/g6y7ycaq/

Ask Our Readers: WServerNews has almost 100,000 subscribers worldwide. That's a lot of expertise to tap into. Do you need help with some issue or need advice on something IT-related? Got a question you'd like us to toss out to our readers to try and answer? Email us at [email protected]

And now on to our guest editorial by Adam Bertram...

PowerShell automation

Organizations love getting more done with less people. This is why they love automation. By using automation, they can forego the expense of hiring warm bodies and, at the same time, get a predictable outcome that's easy to troubleshoot and eliminates us imperfect humans. If you're lucky enough to be one of the automators then you've got the ultimate in job security. Organizations love those that can stay productive and efficient. This is why you're using PowerShell, right? If you're a Windows sys admin you'd be hard-pressed not to trip over some kind of PowerShell automation in your job these days. In this guest editorial I'm going to show you a simple way PowerShell can help a Windows system administrator save time and increase productivity.

Automating Software Installs

I used to be a Microsoft System Center Configuration Manager (SCCM) administrator and had to do lots of software deployments. Using SCCM was fun but man was it complicated sometimes. On occasion, I didn't care about all the fancy stuff. I just wanted to push a simple MSI to a few machines so I created a PowerShell module to do so:

http://www.wservernews.com/go/6ndqj2hv/

However, you don't need an entire module to push a MSI. You just need a way to copy a MSI to a machine and then run a silent installation on the remote machine. This is a piece of cake with PowerShell!

Before starting any script let's break down the workflow. We're essentially only to be doing two things here; copying a file to a remote computer and then executing that file on that computer. First, we'll need to have a MSI file on the machine we're working on. Let's say it's called install.msi and this MSI's silent switches are the standard /qn combination to the msiexec.exe process.

Knowing this we need to run the command line msiexec.exe install.msi /qn on the remote computer once the MSI exists there.

Let's first assume we have a folder called C:\Installs on our local machine with a file called install.msi in it. We'd like to install this software on a couple computers; COMPUTERA and COMPUTERB. We open up the PowerShell ISE and start creating a script to make this happen.

First, we'll need to copy the file to each of the computers. To do this, it's a good idea to put all of the computer names into an array. This then allows us to read each of the computer names when we need to copy and run the installer on each computer.

$Computers = 'COMPUTERA',COMPUTERB'

Next, since we need to do something for each computer we'll use a foreach loop to read each one of them and copy the MSI file to each of their c$ shares.

foreach ($Computer in $Computers) {

Copy-Item -Path C:\Install.msi -Destination "\\$Computer\c$"  

}

Note: For brevity, I haven't included any error handling in the above script so I encourage you to account for situations like when the computer is offline or when the C$ share might not be available. A talk for the TechMentor conference I did awhile back has some great examples of that:

https://github.com/adbertram/Session-Content/tree/master/Live%20Talks/TechMentor%202015%20-%20Automating%20Software%20Install%20with%20Powershell

Anyways, the above script will get the install.msi file on each of the computers. Now all we need to do is to execute it remotely. If you haven't been using PowerShell that much you may want to go directly to something like psexec but you don't have to now. Using PowerShell remoting allows me now to run remote commands without the need for any third party utilities.

$Computers = 'COMPUTERA',COMPUTERB'

foreach ($Computer in $Computers) {

Copy-Item -Path C:\Install.msi -Destination "\\$Computer\c$"

Invoke-Command -ComputerName $Computer -ScriptBlock { msiexec.exe /i /qn C:\Install.msi }

}

Notice how I'm using the Invoke-Command cmdlet here. This is a built-in cmdlet that allows me to run commands just like I would locally only on remote computers.

You have now executed the Install.msi installer on each computer and, if all went well, your software should be installed on each one!

Conclusion

This is only one example of what's possible with PowerShell. I encourage you to see where you can take these two examples I went over today.  You can visit my blog to get lots more examples:

http://www.wservernews.com/go/6ojspbaq/

And visit my Github repositories where I share everything I do:

http://www.wservernews.com/go/n63cz8nz/

My resources along with the hundreds of other blogs and forums out there will help you really build some time-saving PowerShell scripts.

EDITOR'S NOTE: Another example by Adam demonstrating how to automate administrative tasks using PowerShell will be published soon as part of one of the articles in my series of articles titled "Active Directory Insights" which you can find in my section on WindowsNetworking.com:

http://www.wservernews.com/go/6slng7ql/

Be sure also to check out the Tech Briefing section of this issue of WServerNews where we list some of Adam's top blog posts on the topic of PowerShell automation.

About Adam Bertram

Adam Bertram is an independent consultant, technical writer, trainer and presenter. Adam specializes in consulting and evangelizing all things IT automation mainly focused around Windows PowerShell. Adam is a Microsoft Windows PowerShell MVP, 2015 powershell.org PowerShell hero and has numerous Microsoft IT pro certifications. He is a writer, trainer and presenter and authors IT pro course content for Pluralsight. He is also a regular contributor to numerous print and online publications and presents at various user groups and conferences.  You can find Adam at adamtheautomator.com:

http://www.wservernews.com/go/a2ywdc0o/

and on Twitter at @adbertram:

http://www.wservernews.com/go/f1jhu2hh/

Send us your feedback

Got feedback about anything in this issue of WServerNews? Email us at [email protected]

Recommended for Learning

Announcing the Microsoft Cloud Roadshow

This is a free, two day technical training event for IT Professionals and Developers that provides best practices and insight from those who run cloud services across Office 365, Micros oft Azure, and Windows 10.

http://www.wservernews.com/go/k2zjq2q6/

Microsoft Virtual Academy

Automating the Cloud with Azure Automation

Check out this course to explore the process of automating the cloud with Azure Automation. Find out how to get started and how to connect to Microsoft Azure. Learn how to import and publish a Connect-Azure runbook, and create and publish your first runbook. Finally, invoke Azure Automation runbooks, and discover next steps:

http://www.wservernews.com/go/c777whdl/

Automation and Self-Service with System Center 2012 R2

If you'd like to learn how to use System Center 2012 R2 - Orchestrator runbooks to automate the process of creating a Service Request in System Center 2012 R2 - Service Manager, join expert Andrew McMurray for this course. Get an overview of System Center 2012 R2 IT Service Management, and explore a real-world automation scenario. Find out how to create a request template and how to add an approval step in the Service Request process, along with how to set up a connection to the AD to query users and groups:

http://www.wservernews.com/go/hbrspogp/

Getting Started with PowerShell Desired State Configuration (DSC)

Are you keeping up with PowerShell Desired State Configuration (DSC)? It's one of the fastest-moving technologies today. But more than that, it literally transforms how IT Implementers deploy and manage on-premises resources and those extended to hybrid and other cloud environments for both Windows and Linux. Get a solid foundation with this course:

http://www.wservernews.com/go/0jiybljr/

Free White Paper: Understanding SSL Certificates

A guide to understanding SSL certificates, how they operate and their application. By making use of an SSL certificate on your web server, you can securely collect sensitive information online, and increase business by giving your customers confidence that their transactions are safe. This white paper is hosted on our sister site WindowSecurity.com.

Sign up to read this white paper today.

Registration is Open for Cloud Admin CON 2015

Cloud Admin CON is a cost-effective, convenient opportunity for busy System Administrators and IT Managers to stay up to date on the most recent industry trends and vendor solutions and build their network of IT experts and vendors. Individual focus sessions are scheduled to run consecutively, allowing you to attend all sessions, or selectively choose only those you wish to attend. A sample of what you can expect to learn includes:

Date and Time: Thursday, November 19, 2015 11am EST | 8am PST | 4pm BST

Participation is limited to the first 500 registrants, so sign up here today!

Quote of the Week

"As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programmes." -- Maurice Wilkes discovers debugging, 1949.

Until next week,
Mitch Tulloch

Note to subscribers: If for some reason you don't receive your weekly issue of this newsletter, please notify us at [email protected] and we'll try to troubleshoot things from our end.

Admin Toolbox

Admin Tools We Think You Shouldn't Be Without

Protect your Hyper-V & VMware Virtual Machines for Free with Altaro VM Backup. Start backing up your VMs in a matter of minutes. Plus, it’s free for 2 VMs, forever.
http://www.wservernews.com/go/svecge30/

Are you on a budget or still experimenting with VM backup? Veeam Backup Free Edition v8 is the perfect solution because it’s: powerful, easy-to-use and free forever. Download now!
http://www.wservernews.com/go/o3h6momo/

Hosts Editor is small application for editing windows Hosts file.
http://www.wservernews.com/go/forcdgmu/

Ammyy Admin is a fast and easy way to gain remote sharing and remote desktop control.
http://www.wservernews.com/go/bg6gw8ql/

Uptime.exe makes it very easy to display the uptime of your PC since last boot.
http://www.wservernews.com/go/p0yfcol7/

GOT ADMIN TOOLS or other software/hardware you'd like to recommend? Email us at [email protected] 

This Week's Tips

GOT TIPS you'd like to share with other readers? Email us at [email protected]

Sysadmin - When you need to step in for someone

Vinc and David who manage Free Range Geeks, an IT solution provider in Boulder, Colorado USA, sent us the following tip based on their own experiences stepping in to fill the shoes of a company's sysadmin:

Occasionally, we're asked to step in for a sysadmin who's been fired, just left on walkabout, or has a health issue that prevents them from maintaining or repairing a network or server for which they're responsible. This is always a fun technical challenge. We find most folks keep insufficient documentation. What they keep in their heads is incomplete and if they're laid up in a hospital it can be impossible to remember passwords, obscure ports for port knocking, and what color cable they switched to when they ran out of color coded cables for different physical subnets. We've run across installations of mind boggling complexity that challenged our white-hat hacker skills. I think every legitimate sysadmin has these.

It might not be obvious but a lot of sensitivity is required in these situations. Keeping things professional helps keep employees and business owners calm when you're looking for passwords on post-it notes and going through file cabinets. It's best not to complain about lack of documentation. If you want to make a point of how you're different from the old admin just provide the owner with a printed file full of logins, ports, etc. when you're done. Sysadmins always have to explain why things are complicated, why things are expensive, and why security is important. It's harder when the old admin is a friend or relative of the owner and you need to explain the choices another admin made.

You can find Free Range Geeks online at:

http://www.wservernews.com/go/h5uqjqku/

Windows 10 - Deferring updates

Anthony Bartolo has a must-read post on the Canadian IT Pro Connection blog titled "Windows 10 Tips: How to Delay or Defer Windows Updates" that explains the Microsoft Windows Update for Business offering introduced in Windows 10:

http://www.wservernews.com/go/o42qois8/

ConfigMgr - Loading the ConfigMgr PowerShell module

Here's a tip from Matt Tinney on how you can load the ConfigMgr PowerShell module.

Load the ConfigMgr PowerShell module in PowerShell script:

Import-Module "C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1"

cd <site code>

This must be run from a machine with the SCCM console installed and configured to connect to your environment.

Matt Tinney is CEO and founder of Windows Management Experts (WME) a leader in Microsoft System Center technologies that helps customers reduce IT operations cost through services and solutions:

http://www.wservernews.com/go/m0qzkhe3/

Events Calendar

North America

Convergence on April 4-7, 2016 in New Orleans USA
http://www.wservernews.com/go/bonhsrlr/

2016 Microsoft Worldwide Partner Conference on July 10-14, 2016 in Toronto Canada
http://www.wservernews.com/go/9zjznjuy/

Ignite on September 26-30, 2016 in Atlanta USA
http://www.wservernews.com/go/cf03wqxm/

Europe

Convergence 2015 EMEA on Nov 30 - Dec 2, 2015 in Barcelona Spain
http://www.wservernews.com/go/uoce0ixl/

Add Your Event

PLANNING A CONFERENCE OR OTHER EVENT you'd like to tell our 100,000 subscribers about? Contact [email protected]

Tech Briefing

PowerShell automation

Adam Bertram has graciously provided us with links to the following posts on his blog that we feel many our readers will find useful:

Build Scripts as Bricks Not as Entire Buildings
http://www.wservernews.com/go/26pqhvfe/

WOL via PowerShell Without Bothering the Network Guys
http://www.wservernews.com/go/dstvvaf5/

Aid Troubleshooting by Finding All Changes Within a Timeframe
http://www.wservernews.com/go/9ns4g1ow/

Tracking When a User Log on and off From a Computer
http://www.wservernews.com/go/k3svmaq8/

Automatic SCCM to WSUS Software Update Sync
http://www.wservernews.com/go/py4tyt6q/

Get-LocalPort: netstat Powershellified and Text Parsing Shenanigans
http://www.wservernews.com/go/11qtrq3n/

Recommended TechGenix Articles

Herding cats in the cloud (Part 1)
http://www.wservernews.com/go/cjvsf5vi/

Creating an ISMS that incorporates AWS (2015)
http://www.wservernews.com/go/bidkeckk/

Hybrid Network Infrastructure in Microsoft Azure (Part 8)
http://www.wservernews.com/go/lz7ldi6k/

Free Fault Tolerant Load Balancing using Citrix NetScaler Express (Part 3) - Microsoft RD Web Access and RD Connection Broker
http://www.wservernews.com/go/nrn0srra/

Microsoft Ignites a new Focus on Security (Part 6)
http://www.wservernews.com/go/3zfgr92k/

Other Articles of Interest

Getting started with container orchestration

Orchestration tools such as Docker Swarm are skyrocketing in popularity and are playing a key role as more and more IT pros are starting to adopt container technology. Learn more about the evolution of these container orchestration tools and get expert strategies for success.
http://www.wservernews.com/go/ucxr9g5b/

Using containers: Do the pros outweigh the cons?

There are many advantages to using containers, but you shouldn't immediately start using them without first considering the potential challenges they can introduce.  Decide if application containers are right for your enterprise by weighing the pros and cons.
http://www.wservernews.com/go/08oe1k44/

What's the difference between a VM clone and a template?

Creating virtual machine templates and VM clones are similar processes that allow you to quickly and easily deploy multiple VMs, but each serves a different purpose when it comes to virtual desktop infrastructure.  In order for your VDI environment to thrive, you should know the best use cases for each method. Learn about the differences between VM templates and VM clones today.
http://www.wservernews.com/go/a0up659k/

Configure Start screen layout, search and indexing with Windows 8

Windows 8 and 8.1 Group Policy Objects can help with many tasks, including creating Start screen layouts that adhere to corporate policies, as well as configuring search and indexing settings at a significantly higher level than when they were first introduced with Windows XP.  Learn more about how Windows 8 GPO settings can help to configure search and indexing options.
http://www.wservernews.com/go/oonluxij/


WServerNews FAVE Links

This Week's Links We Like. Tips, Hints And Fun Stuff

GOT FUN VIDEOS or other fun links to suggest you'd like to recommend? Email us at [email protected]

Image

This week from Flixxy it's all about magic.

Amazing Invisible Card Deck Magic Trick by Rose McIver At 'Jimmy Kimmel Live'

New Zealand actress Rose McIver does an amazing magic trick using an invisible deck of cards at Jimmy Kimmel's Live TV show:

http://www.wservernews.com/go/nhsx7eng/

International Champion of Magic Mike Chao

International Champion of Magic Mike Chao performs his famous 'GREEN manipulation' at the French television show 'The World's Greatest Cabaret.'

http://www.wservernews.com/go/v3jojeqo/

America's Got Talent Winner Mat Franco Returns With New Magic Trick

The winner of the ninth season of America's Got Talent returns for a magical performance at Radio City Music Hall and receives a standing ovation:

http://www.wservernews.com/go/tfimsxx3/

I Didn't Know Pope Francis Was Also A Magician

Francis met with U.S. Catholic Bishops at the Cathedral of St. Matthew in Washington DC on Sept. 23, 2015.  He is amazing!

http://www.wservernews.com/go/14eky4bv/


WServerNews - Product of the Week

 

WServerNews - Editors

Mitch Tulloch is Senior Editor of WServerNews and is a widely recognized expert on Windows administration, deployment and virtualization. Mitch was lead author of the bestselling Windows 7 Resource Kit and has been author or series editor for almost fifty books mostly published by Microsoft Press. Mitch is also a ten-time recipient of Microsoft's Most Valuable Professional (MVP) award for his outstanding contributions in support of the global IT pro community. Mitch owns and runs an information technology content development business based in Winnipeg, Canada. For more information see www.mtit.com.

Ingrid Tulloch is Associate Editor of WServerNews and was co-author of the Microsoft Encyclopedia of Networking from Microsoft Press. Ingrid is also manages research and marketing for our content development business and has co-developed university-level courses in Information Security Management for a Masters of Business Administration program.