Monthly Archives: November 2012

Code samples from my DuPSUG presentation

Last Friday we had a great day in Eindhoven, the first Dutch PowerShell User Group meeting. It was a day packed with presentations and a lot of talk about PowerShell. I would like to thank everyone involved for making this into a great day! It was great to see the enthusiasm of everyone there.

I have joined the DuPSUG team and I am excited to be involved with the planning and setting up of future events. If you have any suggestions in regards to future events, be sure to contact me or anyone of the team as we are currently gathering feedback for our next event. For more information about the Dutch PowerShell User Group have a look at our website: http://www.dupsug.com/

The topic of my session was Splatting and [Adsisearcher], I have attached the code samples I used during the presentation to this post, this includes the samples I did not get around to showing:

And for those of you who just could not get enough of Splatting, I will be posting an article on splatting on my blog this week.

Update: Have a look at the Scripting Guy blog post, some photos of the event have been posted: Hey, Scripting Guy! Blog: The First-Ever Dutch PowerShell User Group

Share

New article on PowerShell Magazine: Using UNC paths when working with PowerShell providers

The article explains two solutions to errors that you might run in to when utilizing UNC paths when working PowerShell providers. For example the execution of the following command will fail:

Set-Location HKLM:
Get-ChildItem | Export-Csv -Path \\localhost\c$\registry.csv

This can be solved by adding the specific provider, in this case the FileSystem PowerShell provider:

Get-ChildItem | Export-Csv -Path Microsoft.PowerShell.Core\FileSystem::\\localhost\c$\registry.csv

For more information on this topic head on over to PowerShell Magazine to have a look at the article:
http://www.powershellmagazine.com/2012/11/05/pstip-using-unc-paths-when-working-with-powershell-providers/

Share

New script: Set AD User/Group on as Local Administrator

I was recently asked to add a certain Active Directory group to a few dozen computers. Using Group Policy and Restricted Groups was not an option here, since there were already other users and groups in the Administrators group. That triggered me to write up a script in PowerShell which could do this for me.

The script is available here: Technet Gallery: Set-ADAccountasLocalAdministrator.ps1

To set an AD Group as a Local Administrator the script can be executed as follows:

.\Set-ADAccountasLocalAdministrator.ps1 -Computer 'Server01,Server02' -Trustee HRManagers

It is also possible to run this script with a plain text file containing a list of computer names:

.\Set-ADAccountasLocalAdministrator.ps1 -InputFile C:\ListofComputers.txt -Trustee User01
Share