Check if a certain UNC path exists on all active AD Servers

 

Formatting looks very bad, but this word-press doesn’t let me formatted as I like.

$pcs = get-adcomputer -filter {operatingsystem -like "*server*"} 
$result = @()
foreach ($pc in $pcs) {
    if (test-connection -cn $pc.Name -count 1 -Quiet) {
        $path1 = ("\\{0}\c$\windows\microsoft.net\framework\v3.5" -f $pc.name) 
        $result = test-path -path $path1 
        $isVirtual = ((Get-WmiObject Win32_BIOS -ComputerName $pc.name).SerialNumber -match "VMware")
        New-Object PSObject -Property @{
            Computer = $pc.name;
            Path = $path1;
            Virtual = $isVirtual;
            Result = $result
        }
    }
}
$result | export-csv c:\TemporaryFolder\results.csv

 

Gather HP Out of band management card

Few months ago I’ve been asked to document all the out of band management cards from one of the new clients.  Without knowing the full architecture it was hard to find out which server had in iLO and which one didn’t.

I’ve managed to find out which server had an iLO by using the Win32_PnPEntity WMI class. The Win32_PnPEntity WMI class represents the properties of a Plug and Play device. Plug and Play entities are shown as entries in the Device Manager located in Control Panel (https://msdn.microsoft.com/en-us/library/windows/desktop/aa394353(v=vs.85).aspx)

By Using the query gwmi Win32_PnPEntity | Select Caption | where { $_.Caption -like “*ilo*” }  you can easily find out all iLOs. Of course, you will need to query the AD for the full list of servers and use a foreach.

pic4