header image

Archive for September, 2012

Jobs, WMI, CIM and more jobs

Posted by: | September 27, 2012 | No Comment |

Background jobs were one of the most undervalued aspects of PowerShell v2. With the introduction of PowerShell v3 we get ways to schedule those jobs. In this post though I want to look at the new CIM cmdlets and jobs. Using the WMI cmdlets most PowerShell users have done something like this: PS> Get-WmiObject -Class […]

under: PowerShell and WMI, PowerShell V3

WMI over WSMAN

Posted by: | September 24, 2012 | No Comment |

Every time I look at PowerShell v3 I seem to find a new way to access WMI! I’ve covered the –ComputerName and –CimSession parameters before but to recap We duplicate the way Get-WmiObject works: $computer = $env:COMPUTERNAME Get-CimInstance -ClassName Win32_OperatingSystem -ComputerName $computer   We can use CIM sessions $cs = New-CimSession -ComputerName $computer Get-CimInstance -ClassName […]

under: PowerShell and WMI, PowerShell V3

I have a number of  virtual machines running Windows 2008 R2 and I upgraded one of them to Windows 2012 – an over the top upgrade rather than a format and clean install I found that Get-PSSession –Computername didn’t work against that machine. This parameter now looks at the remote machine endpoint and gets all […]

under: PowerShell V3, Windows Server 2008 R2, Windows Server 2012

Scripting Games 2013

Posted by: | September 21, 2012 | No Comment |

Advanced notice that there will be a Games next year – its changing a bit though.  See http://powershell.org/games/

under: PowerShell original, Scripting Games

Using –showwindow

Posted by: | September 21, 2012 | No Comment |

The new –showwindow parameter in Get-Help pops up a little window containing the FULL help file.  Much better than having to rememebr to use –full.  PowerShell immediately returns the prompt so you can continue working – means you can have a number of help files open simultaneously. Get-Help -Name Get-Process –ShowWindow This gets to be […]

under: PowerShell V3

Want to change an attribute on all members of an Active Directory group.  Then try this Get-ADGroupMember -Identity Legal | where {$_.objectclass -eq "user"} | foreach { Set-ADUser -Identity $($_.distinguishedName) -Department "Student" } Get the group members – filter out nested groups by checking the objectclass of the object. For each user set the attribute. […]

under: PowerShell and Active Directory

In the previous post we looked at how to read the mounted device information. The data is in binary though – if you want it readable and not all of it is readable – try this $data = @() Get-Item -Path HKLM:\SYSTEM\MountedDevices | select -ExpandProperty Property | where {$_ -like "\Dos*"} | foreach { $name […]

under: PowerShell original, Registry

Interesting question about reading the registry.  How do you read HKLM:\SYSTEM\MountedDevices and pull out the name of the device and the associated data. Get-Item -Path HKLM:\SYSTEM\MountedDevices returns data of this form Name                           Property —-                           ——– MountedDevices                 \DosDevices\C: : {218, 187, 32, 142…}                                \DosDevices\G: : {92, 0, 63, 0…}                                \DosDevices\E: : {95, 0, 63, […]

under: PowerShell original, Registry

Random confusion

Posted by: | September 16, 2012 | No Comment |

There seems to be a bit of cofusion about how Get-Random works. Try this 1..10 | foreach {Get-Random} you’ll get  randomly selected 32-bit unsigned integer between 0 (zero) and Int32.MaxValue (0x7FFFFFFF, 2,147,483,647). The –Minimum parameter sets a minimum value – you will not get any values BELOW this try this 1..10 | foreach {Get-Random -Minimum […]

under: PowerShell Basics

PowerShell Summit 2013 dates

Posted by: | September 12, 2012 | No Comment |

The dates for the summit have been announced – 22-24 April 2013 @ Microsoft campus Redmond You can register at http://powershell.org/summit 1/7 th of the tickets have already gone – don’t miss out.

under: PowerShell original, PowerShell Summit

Older Posts »

Categories