PowerShell for Windows Admins:

PowerShell


July 11, 2014  12:39 PM

CIM or WMI – - accessing remote machines

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, PowerShell, WMI

I much prefer the CIM cmdlets for accessing remote machines. The WMI cmdlets use DCOM which is firewall unfriendly and can often be unavailable of a server – cue the dreaded RPC server is unavailable error messages. By contrast the CIM cmdlets use WSMAN. For one off access to a remote...

July 9, 2014  1:29 PM

PowerShell Summit Europe 2014 – - update 4

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
PowerShell

Registration will open next Tuesday (15th July) – that’s less than 1 week


July 7, 2014  12:45 PM

Finding a CIM class

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, PowerShell, WMI

I was investigating something on my disks and started to look at the partitions: £> Get-CimInstance -ClassName Win32_Partition Get-CimInstance : Invalid class At line:1 char:1 + Get-CimInstance -ClassName Win32_Partition + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +...


July 6, 2014  3:22 PM

CIM or WMI – - using methods

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
CIM, PowerShell, WMI

The CIM and WMI cmdlets both provide a way to use the methods on CIM classes namely Invoke-CimMethod and Invoke-WmiMethod. The cmdlets are very similar in operation. $vol = Get-WmiObject -Class Win32_Volume -Filter "DriveLetter = 'D:'" Invoke-WmiMethod -InputObject $vol -Name Chkdsk...


July 6, 2014  8:50 AM

Workflows 7: checkpointing workflows

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
PowerShell, Workflow

Consider this workflow workflow chkpt1 { Get-Process foreach ($x in 1..20){ $x } }   It will dump out the process information then output the numbers 1 to 20.  Not a particularly enlightening workflow but it forms  a nice basis for demonstrating checkpoints. A...


July 3, 2014  2:58 PM

and finally

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
PowerShell

If you’re old enough and seen UK TV you’ll recognise the title but this post is about using try – catch blocks. Using try-catch this is a fairly normal construction try { Get-CimInstance -ClassName Win32_LogicalDisk  -ErrorAction Stop } catch { Throw "something went...


July 2, 2014  1:20 PM

CIM or WMI?

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
PowerShell, WMI

Working with WMI became a whole easier when PowerShell came on the scene. If you ever spent hours typing all of the Echo commands that were required with VBScript to produce output you’ll be aware of what I mean.  There are still a few awkward areas in the WMI cmdlets. One of the most awkward is...


July 1, 2014  2:32 PM

PowerShell Summit Europe 2014 – - update 3

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
PowerShell

Registration for the Summit opens in 14 days – 15th July If you need some help selling the idea of attending to your boss cheeck out this post Bookmark and Share     0 Comments     RSS Feed     Email a friend


June 30, 2014  12:55 PM

Workflows 6: suspending jobs

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
PowerShell, Workflow

One of the great things about work flows is that you can stop and start them. A workflow can be stopped, on a temporary basis, by using the Suspend-Workflow activity. workflow suspend1 { Get-Service Suspend-Workflow Get-Process } suspend1   This will run the Get-Service...


June 27, 2014  2:02 PM

Expanding server names

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
PowerShell

I had a comment left on my recent post – “Bad practices – making scripts needlessly interactive” asking how to deal with the situation of N servers consecutively numbered e.g. server01 to server05. Taking the script from that post as an example:   [CmdletBinding()] param...


Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: