#Connect to WSUS Server named wsus
[void][reflection.assembly]::LoadWithPartialName(“Microsoft.UpdateServices.Administration”)
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer("wsus”,$False)
I know this doesn’t work and I know why - the field names are different (FullDomainName and DNSHostName). Is there a way I can ‘alias’ DNSHostName to FullDomainName (similar to the SQL keyword ‘AS’)?
Thanks Dave. This is working better but has thrown up a different problem. It’s now showing a number of computers that are in both variables (the obvious difference is in the capitalisation). I’ve tried using the CaseSensitive switch to no avail. Is there a way to make the contents of both objects lowercase?
What parameters are you passing to Compare-Object? Here’s what worked for me, in a quick test (but I’m not actually getting any data from WSUS for this, just AD):
Compare-Object $a $b -Property FullDomainName
Edit: This test was done with the same data, but different case. Unless I added the -CaseSensitive switch, PowerShell treated the two collections as identical.
Thanks Dave, that worked a treat. I’m just getting started with powershell - know what I want to do and a rough idea how it’ll work, but just need to get to grips with some of the finer details.
If you’re just starting you may want to read Learn PowerShell in a Month of Lunches by Don Jones and if you’re doing a lot with AD you should read Learn AD Management in a Month of Lunches by me (it covers a lot on using PowerShell with AD)
Thanks for all your help Richard, I’ve just ordered both books from Amazon and am looking forward to getting started. I now seem to remember PowerShell in a Month of Lunches being mentioned in the PowerShell VA Jumpstart with Jason Helmick and Jeffrey Snover.