I installed PowerShell 7.0 and started some testing. The following script works with no errors in PowerShell 5.1.
Import-Module WebAdministration
Set-ItemProperty "IIS:\Sites\TestSite" -Name physicalPath -Value "D:\Dev\Test\Website\WebSiteDown"
In PowerShell 7.0 I tried to change the import to use the updated "IISAdministration" module instead of the older "WebAdministration". I get the same error with both modules.
Set-ItemProperty: D:\Dev\OProTrunk\Website\WebSiteDown\OctopusCommand\Test.ps1:3
Line |
3 | Set-ItemProperty "IIS:\Sites\TestSite" -Name physicalPath -Value …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot find drive. A drive with the name 'IIS' does not exist.
Both were running as administrator to be able to update the web site physical path. Do I need to format the property different with PowerShell 7.0?