Monthly Archive

Categories

WMFv5

Module Name change NetworkSwitch to NetworkSwitchManager

Just been caught out by a module name change in WMF 5.0

The NetworkSwitch module has been renamed to NetworkSwitchManager.  Still has the same functionality

Disable-NetworkSwitchEthernetPort       
Disable-NetworkSwitchFeature            
Disable-NetworkSwitchVlan               
Enable-NetworkSwitchEthernetPort        
Enable-NetworkSwitchFeature             
Enable-NetworkSwitchVlan                
Get-NetworkSwitchEthernetPort           
Get-NetworkSwitchFeature                
Get-NetworkSwitchGlobalData             
Get-NetworkSwitchVlan                   
New-NetworkSwitchVlan                   
Remove-NetworkSwitchEthernetPortIPAddress
Remove-NetworkSwitchVlan                
Restore-NetworkSwitchConfiguration      
Save-NetworkSwitchConfiguration         
Set-NetworkSwitchEthernetPortIPAddress  
Set-NetworkSwitchPortMode               
Set-NetworkSwitchPortProperty           
Set-NetworkSwitchVlanProperty

One of these days I should read the realease notes Smile

WMF 5.0 RTM has been republished

A post on the PowerShell Team blog - https://blogs.msdn.microsoft.com/powershell/2016/02/24/windows-management-framework-wmf-5-0-rtm-packages-has-been-republished/ – reports that WMF 5.0 RTM has been republished.

You’ll have to uninstall the original RTM package before installing the new one.

WMF 5.0 download latest news

According to the PowerShell Team blog - https://blogs.msdn.microsoft.com/powershell/2015/12/23/windows-management-framework-wmf-5-0-currently-removed-from-download-center/ 

 

The issue has been resolved and a WMF 5.0 RTM build should be available around the end of February

WMF 5.0

If you follow the PowerShell Team blog - http://blogs.msdn.com/b/powershell/ (and if you don’t you should) you’ll know that the WMF 5.0 RTM downloads were pulled just before Christmas. This was due to a bug that reset the module environment.

 

A comment on the blog - http://blogs.msdn.com/b/powershell/archive/2015/12/23/windows-management-framework-wmf-5-0-currently-removed-from-download-center.aspx – from the team indicates that it’s likely to be a few weeks before the bug is resolved and WMF 5.0 is available again for download.

WMF 5 roadmap

With the recent release of Windows 10 a lot of confusion has arisen regarding the position of PowerShell 5.0.

 

That confusion has been cleared up with a post from the PowerShell team - http://blogs.msdn.com/b/powershell/archive/2015/08/06/windows-management-framework-wmf-5-0-roadmap.aspx

WMF 5.0 COM applications

One change in WMF 5.0 that I hadn’t got round to testing was the speed up in COM based operations.

 

COM – Component Object Model – was the Microsoft programming model before .NET.  Its old but still around – the interfaces for Internet Explorer and Office are all COM based for instance.

 

WMF 5.0 promises faster running for COM based applications.  To test it I tried an old script that opens an Excel spread sheet and populates some columns.

$xl = New-Object -comobject 'Excel.Application'
$xl.visible = $true
$xlbooks =$xl.workbooks
$wkbk = $xlbooks.Add()
$sheet = $wkbk.WorkSheets.Item(1)

## create headers
$sheet.Cells.Item(1,1).FormulaLocal = 'Value'
$sheet.Cells.Item(1,2).FormulaLocal = 'Square'
$sheet.Cells.Item(1,3).FormulaLocal = 'Cube'
$sheet.Cells.Item(1,4).FormulaLocal = 'Delta'

$row = 2

for ($i=1;$i -lt 25; $i++){

$f = $i*$i

$sheet.Cells.Item($row,1).FormulaLocal = $i
$sheet.Cells.Item($row,2).FormulaLocal = $f
$sheet.Cells.Item($row,3).FormulaLocal = $f*$i
$sheet.Cells.Item($row,4).FormulaR1C1Local = '=RC[-1]-RC[-2]'

$row++
}

 

In the past working with Excel has been glacially slow. So slow that you could watch each individual change.

 

In WMF 5.0 its much, much faster.

 

In the past my advice has been to create a CSV file and then import the data from that into Excel. With the much better speed offered by WMF 5.0 I may have to reconsider that and think that working directly with Excel is now a viable proposition.

POwerShell Gallery taking registrations

The PowerShell team have just announced that the PowerShell gallery is now open for YOU to post your module. You need to register to be able to post code to the gallery.

 

http://blogs.msdn.com/b/powershell/archive/2015/07/07/powershell-gallery-registration-is-now-unrestricted.aspx

 

This is a significant step forward in making PowerShell code available to others – if you have a cool module please share

DSC validation

The PowerShell team are asking for validation and feedback on the DSC features in WMF 5.0 - http://blogs.msdn.com/b/powershell/archive/2015/07/06/validate-features-of-powershell-dsc.aspx

 

First up is the PowerShell DSC RunAsCredential - http://blogs.msdn.com/b/powershell/archive/2015/07/06/validate-powershell-dsc-runascredential.aspx

 

Other features will be explained and your validation solicited over the course of this week

WMF 5.0 April 2015 preview – – software inventory logging

A software inventory module is now included with the April 2015 WMF 5.0 preview

£> Get-Command -Module SoftwareInventoryLogging | select Name

Name
----
Get-SilComputer
Get-SilComputerIdentity
Get-SilData
Get-SilLogging
Get-SilSoftware
Get-SilUalAccess
Get-SilWindowsUpdate
Publish-SilData
Set-SilLogging
Start-SilLogging
Stop-SilLogging

 

Windows updates are always a good place to start poking into your systems

£> Get-Command Get-SilWindowsUpdate -Syntax

Get-SilWindowsUpdate [[-ID] <string[]>] [-CimSession <CimSession[]>]
[-ThrottleLimit <int>] [-AsJob] [<CommonParameters>]

£> Get-SilWindowsUpdate

ID          : KB3055381
InstallDate : 4/30/2015

etc

 

The parameters for Get-SilWindowsUpdate look like those I’d expect from a CDXML module. Inspection of C:\Windows\System32\WindowsPowerShell\v1.0\modules\SoftwareInventoryLogging\

shows  a number of cdxml files

MsftSil_Computer.cdxml
MsftSil_ComputerIdentity.cdxml
MsftSil_Data.cdxml
MsftSil_ManagementTasks.psm1
MsftSil_Software.cdxml
MsftSil_UalAccess.cdxml
MsftSil_WindowsUpdate.cdxml
Msft_MiStreamTasks.cdxml

 

The WMF 5,0 release notes supply a link to further data of software inventory logging – interestingly its flagged as a Windows Server 2012 R2 page.

Trying the cmdlet against a Windows Server 2012 R2 system running WMF 4.0 (with the November 2014 roll up)

$cs = New-CimSession -ComputerName W12R2SUS
Get-SilWindowsUpdate -CimSession $cs

£> Get-SilWindowsUpdate -CimSession $cs

ID             : KB3006193
InstallDate    : 1/5/2015
PSComputerName : W12R2SUS

etc

 

This means the class is on our Windows Server 2012 R2 box so we could use it directly

£> Get-CimInstance -Namespace root/InventoryLogging -ClassName  MsftSil_WindowsUpdate | Format-Table -a

ID                  InstallDate                                PSComputerName
--                   -----------                                 --------------
KB3006193 1/5/2015 12:00:00 AM
KB2894856 9/14/2014 12:00:00 AM

etc

 

This module supplies a useful way to find out the software installed on our systems – I’ll be digging into this over a few more posts

WMF 5.0 April 2015 preview – – creating guid

Creating a GUID has always been possible with PowerShell – you just had to drop into .NET

 

£> [System.Guid]::NewGuid()

Guid
----
46c130ca-39ff-463c-b7fb-ed728a1c134f

 

With the latest WMF 5.0 preview life gets easier:

£> Get-Command New-Guid -Syntax

New-Guid [<CommonParameters>]

 

£> New-Guid

Guid
----
112866a5-1662-4265-b851-f9086607bcb2

 

The New-Guid cmdlet happily creates a GUID for you – and you don’t have to remember the >NET syntax.

 

If you want the GUID in a variable as a string

£> $guid = New-Guid | select -ExpandProperty Guid
£> $guid
5c832d40-0ea4-4b42-b0bd-b228da008c9d