Wednesday, December 18, 2013

How to test login access on multiple windows servers - Powershell script


1. Login any windows server with the login you need to test

2. Copy below script and save it as .ps1
gc serverlist.txt |% {
$admin_share = '\\' + $_ + '\c$'
if (test-path $admin_share){write-host "Access test passed on $($_)"}
else {Write-host "Access test failed on $($_)"}
}

3. Populate the server names in a test file named 'serverlist.txt'

4. Execute it.