Posts RSS Comments RSS 249 Posts and 391 Comments till now

Archive for November, 2008

Latest cmdlet of the week post updated!

This one had some cool tricks with New-QADUser so I thought I would cross-post the use cases here as well.


Scenario 1
One day your boss comes up to you and says “Hey, we need to do some performance testing against our AD so can you create 20,000 users?” Because you have Powershell and New-QADUser you say “no problem” and quickly pound out this:

$parent = "CN=Users,{0}" -f (([ADSI]"").distinguishedName[0])
foreach($user in 1..20000)
{
   $UserName = "PerfTestUser$User"
   $UserPassword = "P@ssw0rd123!"
   $ExpiresOn = $((Get-Date).AddMonths(1))
   $userDescription = "User added for Performance Testing on $(Get-date)`
   and Expires on $ExpiresOn"

   $user = New-QADUser -name $UserName `
               -SamAccountName $UserName  `
               -Description $UserDescription `
               -ParentContainer $parent`
               -UserPassword $UserPassword
   $user | Set-QADUser -AccountExpires ((Get-Date).AddMonths(1))
}

NOTE: Notice the back tick “`” at the end of each line of the New-QADuser command. This allows you to escape the line break and span multiple lines with single command.

Scenario 2
So, your boss was so impress that you were able to create the 20,000 users so quickly he decides to task you will importing a csv file with 3000 real users with real data. Again… no problem

$parent = "OU=MyUsers,{0}" -f (([ADSI]"").distinguishedName[0])
$upwd = "P@ssw0rd123!"
$users = import-csv UserList.csv | New-QADUser -ParentContainer $parent `
                                               -UserPassword $uPwd
$users | Enable-QADuser

Find the post Here: Active Directory cmdlet of the week “New-QADuser”

Citrix Webinar (call for content)

I have been approached by Citrix to do another webinar about using Powershell to manage XenApp (aka Presenation Server.) As before this session will start by covering some Powershell concepts and then move on to using those concepts to manage XenApp.

The content is not set in stone yet so if you have any thoughts on what concepts you would like covered please share.

I will post again as soon at the webinar has been scheduled.

The path to fixing Windows Update Service

I often need to trouble shoot Windows Update issues. I have found that some of the following things are useful to know in regards to trouble shooting:

- Review this KB How to troubleshoot common Windows Update, Microsoft Update, and Windows Server Update Services installation issues

- Try looking at WindowsUpdate.log (click for more info)

- Use wuauclt.exe tool to force the update detection
MS Page for wuauclt utility
Yet another incomplete document

- RegKeys
Create the required DWORD values from table below:
Value: NoAutoUpdate

  • 0 – Enable Automatic Updates (Default)
  • 1 – Disable Automatic Updates

Value: AUOptions

  • 2 – Notify for download and notify for install
  • 3 – Auto download and notify for install
  • 4 – Auto download and schedule the install

Value: ScheduledInstallDay

  • 0 – Install every day
  • 1 to 7 – Install on specific day of the week from Sunday (1) to Saturday (7).

Value: ScheduledInstallTime

  • 0 to 23 – Install time of day in 24-hour format

 

Note: I finally decided to run strings.exe (click for more info) against the exe and here is the list of the flags I found (you can guess what they are for:)

/DetectNow
/ReportNow
/RunHandlerComServer
/RunStoreAsComServer
/ShowSettingsDialog
/ResetAuthorization
/ResetEulas
/ShowWU
/ShowWindowsUpdate
/CloseWindowsUpdate
/SelfUpdateManaged
/SelfUpdateUnmanaged
/UpdateNow
/DemoUI