# Enter the script below in PowerShell ISE, or save it in a ps
file and execute it from the right location
$a=("localhost","Xu-Acer-PC")
$a | % {
<#
Option 1:
$Server=$_
CD
sqlserver:\sql\$Server;
"`r`nThe root directory for
$Server is: `r `n"
$b=dir;
$b.RootDirectory
}#>
#
Option 2
$Server=$_
CD
sqlserver:\sql\$Server;
$b=dir;
"$Server : $($b.RootDirectory)"
#>
}
Trap {
$err=$_.Exception
$err.message
while
($err.InnerException)
{
$err=$err.InnerException
write-output
$err.message
}
Continue
}