To Read/Write/Rename/Copy/Delete a file configured across ‘N’ of servers in the same path, this script is going to be very handy. One example – Citrix Migration – IMA data store
Input – ServerName and Input folder path.
$server =”Server01“
$InputPath=”C:\Program Files\Citrix\Independent Management Architecture”
Execute the below Powershell script
FUNCTION getUNCPath($infile)
{
$qualifier = Split-Path $infile -qualifier
$drive = $qualifier.substring(0,1)
$noqualifier = Split-Path $infile -noQualifier
“$drive`$$noqualifier”
}
$server =”Server01″
$InputPath=”C:\Program Files\Citrix\Independent Management Architecture”
$UNC=getUNCPath($infile)
$Path=”\\$Server\$UNC”
write-host $Path
Output - \\Server01\C$\Program Files\Citrix\Independent Management Architecture