Tag: Cmdlet

OneGet PowerShell

Windows Management Framework V5 Preview

I know there is a lot of cool stuff going on right now and Microsoft announced a lot of new things. Like Windows Phone 8.1, Cortana, Windows 8.1 Update, Visual Studio 2013 Update 2, Windows Universal Apps, the Nokia Lumia 630, 635 and 930 and much much more. But there just was another announcement from Jeffrey Snover which is really interesting for us automation and management guys. Today Microsoft announced the Windows Management Framework 5.0 Preview, which brings some new stuff to PowerShell and PowerShell Desired State Configuration (DSC).

In the release 5.0 of the Windows Management Framework Microsoft did some work on DSC to make it more stable and reliable by addressing bug fixes, performance improvements and general optimizations. But there are coming the new feature to Windows PowerShell.

Windows PowerShell OneGet

OneGet is a new way to discover and install software packages from around the web. With OneGet, you can:
  • Manage a list of software repositories in which packages can be searched, acquired, and installed
  • Search and filter your repositories to find the packages you need
  • Seamlessly install and uninstall packages from one or more repositories with a single PowerShell command

Network Switches

Microsoft will offere a new PowerShell module which brings the possibility to manage Network Switches. In this release Microsoft added a set of L2 Layer NetworkSwitch management PowerShell cmdlets to manage Certified for Windows network switches. This effort was part of the Data Center Abstraction (DAL) vision which was led by Microsoft working closely with industry leaders in this space such as: Arista, Cisco and Huawei. Using Windows Server 2012 R2, network switches that pass the Certified for Windows program can now be managed natively by System Center Virtual Machine Manager 2012 R2 (SCVMM) without the need to write custom plugins.

I think this is not just a small announcement, this is a pretty big one to me.

Get more Information on the Windows Server Blog about the Windows Management Framework V5 Preview.



Cisco UCS PowerTools

Cisco UCS PowerShell: ConvertTo-UCSCmdlet

This week I had a chance to be part of a Cisco UCS course and the trainer Walter Dey (ex Cisco Distinguished Engineer) showed me a great feature in the Cisco UCS PowerShell Module called Cisco UCS PowerTools. The Convertto-UCSCmdlet allows you to record the things you do in the UCS Manager (GUI) and converts this into Windows PowerShell cmdlets.

Thomas Maurer Walter Dey

To use this, this is pretty simple first install the UCS PowerTools and Connect to your UCS with the same user you connect to the UCS Manager. Checkout my blog post about the Cisco UCS PowerTools.

After that run the cmdlet:

Convertto-UCSCmdlet

After that open the UCS Manager session and do the steps you want to recored.

Cisco UCS PowerTools

I have to say, this is just great feature included in the Cisco UCS PowerTools.



Windows Server 2012 Hyper-V: Configure VM Processor Compatibility for Legacy Operating Systems

Windows Server 2012 Logo

In Windows Server 2008 R2 you had a setting in the Hyper-V Manager GUI to enable Processor Compatibility for legacy operating systems such as Windows NT 4.0 Server or Windows Server 2000. In Windows Server 2012 Hyper-V this setting is gone from the GUI, but you can still change it via Windows PowerShell.

By using the Get-VMProcessor cmdlet you can list the virtual CPU information of your Hyper-V virtual machines.

Hyper-V Get-VMProcessor

As you can see you can find a property called CompatibilityForOlderOperatingSystemsEnabled which is set to “False” by default and this is okay in 99% of all cases. But even if Windows NT 4.0 Server or Windows Server 2000 is not officially supported by Microsoft anymore there are some customers which have to run some VMs with legacy operating systems and by changing this setting via Windows PowerShell and the Set-VMProcessor cmdlet you can allow VMs to run old operating systems.

 
Set-VMProcessor NT4VM -CompatibilityForOlderOperatingSystemsEnabled 1

And of course you can also change it back

 
Set-VMProcessor NT4VM -CompatibilityForOlderOperatingSystemsEnabled 0


Powershell: Invoke-Expression

Powershell Header

Using the Invoke-Expression Cmdlet:

The Invoke-Expression cmdlet provides one way to run a script from within Windows PowerShell.

Invoke-Expression c:\scripts\test.ps1

or

& c:\scripts\test.ps1

And you also can run a function in your Powershell Script by a variable. This is something really important when you work with dynamic scripts:

Invoke-Expression -command ($Function_Name)

you even can send dynamic parameters to this function:

Invoke-Expression -command ($Function_Name + ' $Function_Parameters')