header image

Archive for November, 2014

Transcripts

Posted by: | November 11, 2014 Comments Off on Transcripts |

The ability to create transcripts of your PowerShell activity is great for keeping track of what you’ve done. They are also very useful when testing as you can keep a record of your results.    There’s one problem though – transcripts don’t work in the ISE.  Try this in PowerShell 4.0 or earlier: Start-Transcript -Path […]

under: PowerShell v5

PowerShell classes – – static classes

Posted by: | November 9, 2014 Comments Off on PowerShell classes – – static classes |

A static class is one that you don’t need to create  an instance of the object to use – the [math] class provides many examples e.g. £> [math]::pi 3.14159265358979   You can create a class with static methods using PowerShell classes: class stest { static [int] doubleup ([int] $in){ return $in * 2 } } […]

under: PowerShell v5

WMI integer properties – alternative decoding options

Posted by: | November 4, 2014 Comments Off on WMI integer properties – alternative decoding options |

  WMI has many properties where the the value is an integer: £> Get-CimInstance -ClassName Win32_LogicalDisk | Format-Table DeviceId, DriveType, Size, FreeSpace -a DeviceId DriveType         Size    FreeSpace ——– ———         —-    ——— C:               3 135810510848 120492625920 D:               5   In the example drive type 3 is a standard hard disk and drive type 5 is defined […]

under: PowerShell and WMI, PowerShell v5

« Newer Posts

Categories