Monthly Archives: September 2012

Jobs, WMI, CIM and more jobs

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. … Continue reading

Posted in PowerShell and WMI, PowerShell V3 | Leave a comment

WMI over WSMAN

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 … Continue reading

Posted in PowerShell and WMI, PowerShell V3 | Leave a comment

PowerShell remoting and upgrading to Windows 2012

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 … Continue reading

Posted in PowerShell V3, Windows Server 2008 R2, Windows Server 2012 | 1 Comment

Scripting Games 2013

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

Posted in Powershell, Scripting Games | Leave a comment

Using –showwindow

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 … Continue reading

Posted in PowerShell V3 | Leave a comment

Change user attribute based on group membership

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 … Continue reading

Posted in PowerShell and Active Directory | Leave a comment

Decoding the mounted device information

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 … Continue reading

Posted in Powershell, Registry | Leave a comment

Reading mounted device information from the 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, … Continue reading

Posted in Powershell, Registry | Leave a comment

Random confusion

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 – … Continue reading

Posted in Powershell Basics | Leave a comment

PowerShell Summit 2013 dates

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.

Posted in Powershell, Summit | Leave a comment