Powershell 在Windows Server 2008 R2中使用新的WebVirtualDirectory
我需要使用powershell脚本在多台计算机中创建一些虚拟目录,但这些计算机具有不同的Windows Server版本Powershell 在Windows Server 2008 R2中使用新的WebVirtualDirectory,powershell,windows-server-2008,Powershell,Windows Server 2008,我需要使用powershell脚本在多台计算机中创建一些虚拟目录,但这些计算机具有不同的Windows Server版本 PS> Import-Module webadministration PS> New-Item 'IIS:\Sites\Default Web Site\my_app\dir_name' -physicalPath "D:\pyhiscal_dir" -type VirtualDirectory 最旧的是Windows Server 2008 R2,我认为cm
PS> Import-Module webadministration
PS> New-Item 'IIS:\Sites\Default Web Site\my_app\dir_name' -physicalPath "D:\pyhiscal_dir" -type VirtualDirectory
最旧的是Windows Server 2008 R2,我认为cmdlet新WebVirtualDirectory仅在Windows Server 2012之后才可用
要使Windows 2008-R2与2019兼容,我可以做些什么?我无法升级这些旧服务器,也无法升级它们的powershell版本
我需要与此等效的:
New-WebVirtualDirectory -Site "Default Web Site" -Application my_app -Name dir_name -PhysicalPath "D:\pyhiscal_dir"
感谢Jawad,我发现了与每个powershell版本兼容的完美替代方案
PS> Import-Module webadministration
PS> New-Item 'IIS:\Sites\Default Web Site\my_app\dir_name' -physicalPath "D:\pyhiscal_dir" -type VirtualDirectory
我在这个网站上几乎找到了一些例子。这给了我线索。谢谢@Jawad,我将发布一个答案来解释真正的替代方案。