Here I had has already shown a tool with which the server name in the Outlook profile can be changed. For example, from a single server to a CAS array. The tool can be easily executed via a login script, for example. However, the question then arises as to whether all clients have been "caught" and whether the server name has been changed correctly. For this purpose, I have built a small Powershell script that searches the registry of the clients for the new server name. The script only needs to be fed with a CSV file containing the user names and computer names. Something like this:
Prerequisite for the script is a user who has access to the registry of the PCs, i.e. a domain admin and this Powershell module:
http://archive.msdn.microsoft.com/PSRemoteRegistry
Here is the script:
$logfilepath = "D:\user.csv"
$casarray = "cas.frankysweb.local"
$domain = "frankysweb.local"#————————————————————————————-
$logfile = import-csv $logfilepath -Delimiter ";"
foreach ($line in $logfile)
{$user = $line.Username
$computername = $line.hostname#Check if Host alive
if (test-connection -computername $computername -count 1 -quiet)
{#Username to SID
$objUser = New-Object System.Security.Principal.NTAccount("$domain", "$user")
$strSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier])
$SID = $strSID.Value#search remote registry
$regkey = "$SID\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
if (get-regkey -ComputerName $computername -hive "Users" -key $sid -name Software -ErrorAction SilentlyContinue)
{if (get-regkey -ComputerName $computername -hive "Users" -key "$sid\Software\Microsoft\Windows NT\CurrentVersion" -name "Windows Messaging Subsystem" -ErrorAction SilentlyContinue)
{
$outlookprofile = get-regkey -ComputerName $computername -hive "Users" -key $regkey -name * -ErrorAction SilentlyContinue | get-regvalue -type String -recurse
if ($outlookprofile -match "$casarray")
{
write-host "User:`t$user`tComputer:`t$computername`tStatus:`tCAS Array found" -foregroundcolor "green"
}
else
{
write-host "User:`t$user`tComputer:`t$computername`tStatus:`tCAS Array not found" -foregroundcolor "red"
}
}
else
{
write-host "User:`t$user`tComputer:`t$computername`tStatus:`tOutlook not found" -foregroundcolor "yellow"
}
}
else
{
write-host "User:`t$user`tComputer:`t$computername`tStatus:`tSID not found" -foregroundcolor "yellow"
}
}
else
{
write-host "User:`t$user`tComputer:`t$computername`tStatus:`tPC off" -foregroundcolor "gray"
}
}
Good luck.