Author Archives: richardsiddaway

Selecting AD properties

Saw a question on the forums about selecting name properties using the Microsoft AD cmdlets.  By default Get-AdUser returns a limited subset of properties: £> Get-ADUser -identity richard DistinguishedName : CN=Richard,CN=Users,DC=Manticore,DC=orgEnabled           : TrueGivenName         :Name              : RichardObjectClass       : userObjectGUID        : 7c42be70-c6b2-401f-8296-46de9ee7446cSamAccountName    … Continue reading

Posted in PowerShell and Active Directory | Leave a comment

WMI — identifying writable properties

One common mistake I see is people trying to set the value of a read only property on a WMI class.  There isn’t a quick way to see if a property is writable. Get-CimClass can be used but you have … Continue reading

Posted in CIM, PowerShell and WMI | Leave a comment

Delivering PowerShell code

Do you have a need to deliver PowerShell code to multiple machines. I do. I have a dev environment plus test and production environments. I need to move code from dev through test and production. One way to do this … Continue reading

Posted in PowerShell v5 | Leave a comment

Learning PowerShell

I’ve been thinking about how people learn PowerShell through watching some people at work who are learning it and watching the questions on the forums – many of which start off “I’m new to PowerShell and…” There seems to be … Continue reading

Posted in Learning Powershell | Leave a comment

What Formatting cmdlets do to your data

I have seen an increasing number of questions recently where the answer has been to remove Format-Table from the pipeline. As an example consider the names of the processes running on your machine Get-Process -Name calc | Stop-Process works because … Continue reading

Posted in Powershell Basics | Leave a comment

Add a drop down to a Word document

  Its surprisingly easy to programatically add a drop down list to Word document   $Word = New-Object -Com Word.Application$word.visible = $true$template = “c:\test\template.docx”   $Doc = $Word.Documents.Open($template)$Doc.Activate()    $cntrl = [Enum]::Parse([Microsoft.Office.Interop.Word.WdContentControlType], “wdContentControlDropdownList”) $objCC = $doc.ContentControls.Add($cntrl) $objCC.DropdownListEntries.Add(“PowerShell”)$objCC.DropdownListEntries.Add(“Ruby”)$objCC.DropdownListEntries.Add(“Perl”)   Create the COM object … Continue reading

Posted in Office 2013, Powershell | Leave a comment

The little changes that make a difference

Each version of PowerShell introduces a new headline feature – remoting, workflows, DSC, OneGet in version 2,3,4 and 5 respectively. While this can change the way we work there are also a host of little changes that come along that … Continue reading

Posted in Powershell Basics | Leave a comment