header image

Archive for September, 2013

I needed to look at my virtual machines & their disk sizes – with Windows 2012 R2 upgrade in the works I need to do a bit more tidy up I found two cmdlets in the Hyper-V module: get-vmharddiskdrive – can be related to the virtual machine but doesn’t give a size get-vhd – expects […]

under: Hyper-V, PowerShell V3, Windows Server 2012

Windows 2012 R2 on MSDN

Posted by: | September 10, 2013 | No Comment |

In case you didn’t see yesterday’s announcement – the RTM versions of  Windows 2012 R2 and Windows 8.1 are available for download. From what has been announced so far by Microsoft expect some updates before, or at, General Availability next month

under: Windows 2012 R2

SMO with SQL Server 2012

Posted by: | September 9, 2013 | No Comment |

I’ve been working quite a bit with PowerShell and SQL Server 2012 just recently. In earlier versions of SQL Server you had to load the SMO assemblies to get access to the admin functionality. In SQL Server 2012 – import-module sqlps gives you the SQL Server provider, the cmdlets and loads the SMO assemblies for […]

under: PowerShell and SQL Server

Had an interesting question today. The question concerned displaying the StreetAddress property when its multiple lines like this: PS> Get-ADUser -Identity dgreen -Properties StreetAddress | fl Name, StreetAddress Name          : GREEN Dave StreetAddress : Floor 5                 Buidling 3                 Newboro Square   If you try this with format-table instead PS> Get-ADUser -Identity dgreen -Properties […]

under: PowerShell and Active Directory

Exercise in frustration

Posted by: | September 9, 2013 | No Comment |

If you would like an exercise in frustration – try installing the RSAT tools for Windows 2012 onto Windows 8. If your PS’s language is set to en-US it should work.  If it is anything else give up now and go watch the grass grow – it will be infinitely more rewarding. Many people outside […]

under: Rant

WMI is great for pulling back data from remote machines. This type of activity is quite common: $computer = $env:COMPUTERNAME $comp = Get-WmiObject -Class Win32_ComputerSystem -ComputerName $computer $os = Get-WmiObject -Class Win32_OperatingSystem  -ComputerName $computer $disk = Get-WmiObject -Class Win32_LogicalDisk -ComputerName $computer New-Object -TypeName PSObject -Property @{ Name = $computer OS = $os.Caption LastReBoot = $os.LastBootUpTime […]

under: PowerShell and WMI, PowerShell V3

If you need to determine the RAM in a system you can use the Win32_ComputerSystem class Get-CimInstance -ClassName Win32_ComputerSystem | select Name, TotalPhysicalMemory The answer is in bytes BUT it only shows the memory available to the OS.  Many systems steal RAM for graphics cards or other devices. The true amount of physical memory is […]

under: PowerShell and WMI

Bitten by a typo

Posted by: | September 7, 2013 | No Comment |

Got caught by a silly typing mistake that caused a bit of head scratching until I tracked it down. A common scenario is adding an element $y to an array $x $x += $y I’d typed $x =+= $y The function loaded but failed at run time. Took a while to spot.

under: PowerShell Basics

Cleaning up my AD

Posted by: | September 6, 2013 | No Comment |

  I decided it was time to clean some of the rubbish out of my test AD.  I’ll be upgrading to Windows Server 2012 R2 next month so a bi tof a clean up now is a good idea. I decided to start with the computer objects.  I’ve created & deleted quite a few virtual […]

under: PowerShell and Active Directory

A potentially simpler way to solve the issue of multiple servers and multiple services is to use a hash table $data = @{ "server02" = "BITS", "NtFrs", "MSMQ",  "Kdc"; "exch10" = "MSExchangeAB", "W32Time", "W3SVC" } foreach ($server in $data.Keys){ Get-Service -ComputerName $server -Name ($data[$server]) | select @{N="Server"; E={$server}}, Status, Name, DisplayName } The data structure […]

under: PowerShell V3

« Newer Posts - Older Posts »