Remote execution for setting physicalPath
is erroring with the following message:
Cannot find drive. A drive with the name 'IIS' does not exist.
What is wrong with the following?
$site = Read-Host "What is the name of the virtual?"
$newpath = Read-Host "What is the NEW PATH of the new site?"
$ScriptBlockContent = {
$site = $args[0],
$newpath = $args[0]
(Set-ItemProperty -Path IIS:\\Sites\ABC_LIVE\$site -Name "physicalPath" -Value "$newpath")
}
# Add the IIS PowerShell Module
Import-Module WebAdministration
Invoke-Command -ComputerName DEVSERVERNAME -ScriptBlock $ScriptBlockContent -ArgumentList $site,$newpath