Check server accounts in Active Directory.

I made a simple powershell to list server accounts in AD, list versions and service pack level. It will also do a simple test-connection to see if it is alive (remember 2008 firewall will block icmp by default.

Import-Module activedirectory
$htmlheader = “<html><head></head><body><table>”
$trtdstart =”<tr><td>”
$trtdstart3 =”<tr bgcolor=#80ff80><td>”
$trtdstart1 =”<tr bgcolor=#40FF00><td>”
$trtdstart2 =”<tr bgcolor=#FF8080><td>”
$tdstart =”<td>”
$tdstartstop=”</td><td>”
$tdend=”</td>”
$trtdend =”</td></tr>”
$htmlfoot= “</table></body></html>”
$counter = 1
$servere = get-adcomputer -filter {(Operatingsystem -like “*server*”)} -properties Name,OperatingSystem,OperatingSystemVersion,OperatingSystemServicePack -ResultSetSize 4000 -SearchScope subtree | Sort-Object -Property Name
$htmlheader | Out-File  -FilePath C:\Powershell\servers.htm
$servere | ForEach-Object -process {
   $gruppe= $null
   $pingtest = Test-Connection -ComputerName $_.Name -WarningAction silentlycontinue -Count 1 -ErrorAction silentlycontinue
   if ($_.OperatingSystemVersion -like “*6.1*”){
        $trtdstart1 | Out-File  -FilePath C:\Powershell\servers.htm -Append
    } elseif ($_.OperatingSystemVersion -like “*6.0*”){
        $trtdstart1 | Out-File  -FilePath C:\Powershell\servers.htm -Append
    } elseif ($_.OperatingSystemVersion -like “*5.2*”){
        $trtdstart3 | Out-File  -FilePath C:\Powershell\servers.htm -Append
    } else
    {
        $trtdstart2 | Out-File  -FilePath C:\Powershell\servers.htm -Append
    }
    $Counter| out-file -FilePath C:\Powershell\servers.htm -Append
    $Counter=$Counter+1
$tdstartstop | Out-File  -FilePath C:\Powershell\servers.htm -Append
    $_.Name| out-file -FilePath C:\Powershell\servers.htm -Append
$tdstartstop | Out-File  -FilePath C:\Powershell\servers.htm -Append
    $_.OperatingSystem| out-file -FilePath C:\Powershell\servers.htm -Append
$tdstartstop | Out-File  -FilePath C:\Powershell\servers.htm -Append
    $_.OperatingSystemVersion| out-file -FilePath C:\Powershell\servers.htm -Append
$tdstartstop | Out-File  -FilePath C:\Powershell\servers.htm -Append
    $_.OperatingSystemServicePack | out-file -FilePath C:\Powershell\servers.htm -Append
    $tdstartstop | Out-File  -FilePath C:\Powershell\servers.htm -Append
    $pingtest.IPV4Address.IPaddresstostring  | Out-File  -FilePath C:\Powershell\servers.htm -Append
    $tdstartstop | Out-File  -FilePath C:\Powershell\servers.htm -Append
    if ($pingtest) { “Echo reply” |Out-File  -FilePath C:\Powershell\servers.htm -Append } else { “No reply” |Out-File  -FilePath C:\Powershell\servers.htm -Append }
    $tdstartstop | Out-File  -FilePath C:\Powershell\servers.htm -Append
     $trtdend | Out-File  -FilePath C:\Powershell\servers.htm -Append
}
$htmlfooter | out-file -FilePath C:\Powershell\servers.htm -Append

 

Error 1603 installing Exchange 2010 RollUp’s

Getting error installing Rollup 5 for Exchange 2010 Sp1. Error 1603. According to msi log file it is ServiceControl.ps1 that is causing the error. Solution was to set execution policy to RemoteSigned and also run the “ServiceControl.ps1 AfterPatch” script from the Exchange 2010 Bin folder . Also remember to start Powershell as administrator.

set-executionpolicy -executionpolicy RemoteSigned

.\servicecontrol.ps1 AfterPatch

After this the install turned out OK.