PowerShell

Powershell V4.0 updates to the Dism module

Windows Server 2012 R2 and Windows 8.1 is RTM and that means PowerShell 4 is as well! PowerShell 4.0 brings a whole bunch of new treats to the table, one of the most notable being Desired State Configuration which I will come back to in a later post, but there is also a bunch of other news, one of them being a few new cmdlets in the Dism module. The following commandlets are new in the Dism module and worth noting are the three parameters -LogPath -LogLevel and -ScratchDirectory which is available for all cmdlets below.

Powershell tip: Wait for a certain time

Sometimes I write a script where I need To wait until a certain time or for a certain event, like after business hours or when a service is in a running state. To achieve this I use a do…until loop simply repeating a short wait time until my requirement returns true. The following snippet will pause until a given time: do {<br /> Start-Sleep 1<br /> }<br /> until ((get-date) -ge (get-date "6:00 PM"))

Powershell: Generating random password for Active Directory

UPDATE 2015-01-04: I’ve updated the script on Technet Gallery: https://gallery.technet.microsoft.com/Generate-a-random-and-5c879ed5 Drastically improved performance and randomization logic. When provisioning new users to Active Directory we need to provide a new password and of course we want to generate a random password. This is my thoughts and three methods for generating passwords, the first two quite simple and straightforward and the third method a little bit more complex and definitely the one I recommend.

Scripting Games 2013 Event 1

The scripting games finally kicked of last thursday and I sat down an hour on sunday to make my contribution to the advanced track. This event was about helping Dr.Scripto archive log-files older than 90 days from one directory on the server to an UNC path which seemed quite straight forward at first but now when I’ve seen all the other answers and voted on as many as I had time for, I realized a few things and most of all I realized that the community is quite critical and I need to step it up a notch if I want any of the community votes.