Windows continues to place more and more emphasis on the PowerShell command line, with the scripting language now forming the basis of many of the vendors' core products. While more widespread use means PowerShell is more powerful than ever, it has also led to a staggering number of cmdlets to sort through, which can make learning the syntax that much more difficult.
Even if you're
- PowerShell and XML: For PowerShell to understand XML, you must force it to parse XML, which runs it through the .NET Framework's XmlDocument class and builds a document object model from it. If the XML doesn't parse or validate, then you'll get an error.
- PowerShell remoting: Remoting is enabled by default in Windows Server 2012, but to manually enable the feature in earlier versions, consult the free e-book Secrets of PowerShell Remoting.
- PowerShell and WWF: The PowerShell code in a workflow must be translated to something WWF understands, so the switch construct can't be used in WWF, but you can use a special parallel for each construct to have PowerShell perform multi-threaded activities.
- Searching for commands: PowerShell v3 automatically includes commands from all installed modules when it searches for commands, but if you try to run a command that isn't loaded, the shell implicitly loads it in the background for you.
- PowerCLI and vCloud: The abstraction layer introduced by vCloud Director 1.5 allows you to use PowerCLI scripts to search for virtual machines (VMs) and collect granular information.
- PowerCLI and View management: Using PowerShell scripts to reset and rebuild your environment is often faster than using the Web-based administration tools. The cmdlets and scripting can also be used to build a consistent layout to your View environment.
- Migrating VMs: You can migrate any VM, regardless of what cluster it's in, with a PowerShell script. You simply need the name of the cluster alias, the exact name of the clustered VM resource and the destination node.
- XenServer PowerShell snap-in: To run the PowerShell snap-in on a 64-bit system, run the following command from an elevated command prompt to register the DLL with the 64-bit .NET Framework: C:\windows\microsoft.net\frameowkr64\v2.0.50727\installutil.exe "c:\program files (x86)\citrix\xenserverpssnapin\xenserverpssnapin.dll"
- VMware vSphere PowerShell snap-ins: VMware.ImageBuilderallows for the creation of custom ESXi images and media that you can launch with Auto Deploy, or you can also use these images as standalone installation media.
- PowerShell Web Access: Introduced with PowerShell v3, PowerShell Web Access is acomplete Web-based command-line window that supports multiple simultaneous connections and tab completion and can be secured with an HTTPS connection. Just remember Internet Information Services is a prerequisite for this feature.
- Windows Task Scheduler and PowerShell: With scheduled PowerShell scripts, you need to ensure that the proper execution policies are in place. All scripts you execute using the Task Scheduler should be signed using a code signing certificate issued by a certificate authority.
- PowerCLI and the vSphere API: The vSphere API is much more structured than an operating system. PowerCLI is built on top of the same API, which means that you can't use PowerCLI to directly perform tasks inside the console OS.
This was first published in September 2013