Powershell cd 站点代码不起作用
Powershell cd sitecode not working
我正尝试以非管理员用户身份在远程计算机上 运行 导入模块 ConfigurationManager.psd1 后 CD 到 SCCM 站点文件夹。但是我收到以下错误:
PS C:\windows\system32> Enter-PSSession -ComputerName somecomputer -Credential Sccm\u6
[somecomputer]: PS C:\Users\u6\Documents> Import-Module ConfigurationManager.psd1
[somecomputer]: PS C:\Users\u6\Documents> cd 1SA:
cd : Cannot find drive. A drive with the name '1SA' does not exist.
+ CategoryInfo : ObjectNotFound: (1SA:String) [Set-Location], DriveNotFoundException
+ FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
我可以按照有关此 link 的文档解决此问题:http://benef-it.blogspot.in/2013/04/solve-ps-drive-problem-with-sccm2012.html
但是我如何从 powershell 中以编程方式执行此操作?
我认为文件夹的名称中不能包含“:”。看起来真的是文件夹不存在
好的,找到了解决这个问题的方法
New-PSDrive -Name $sitecode -PSProvider "AdminUI.PS.Provider\CMSite" -Root "$ENV:ComputerName" -Description "SCCM Site"
运行 上面的命令创建了您可以随后使用的驱动器。
我正尝试以非管理员用户身份在远程计算机上 运行 导入模块 ConfigurationManager.psd1 后 CD 到 SCCM 站点文件夹。但是我收到以下错误:
PS C:\windows\system32> Enter-PSSession -ComputerName somecomputer -Credential Sccm\u6
[somecomputer]: PS C:\Users\u6\Documents> Import-Module ConfigurationManager.psd1
[somecomputer]: PS C:\Users\u6\Documents> cd 1SA:
cd : Cannot find drive. A drive with the name '1SA' does not exist.
+ CategoryInfo : ObjectNotFound: (1SA:String) [Set-Location], DriveNotFoundException
+ FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
我可以按照有关此 link 的文档解决此问题:http://benef-it.blogspot.in/2013/04/solve-ps-drive-problem-with-sccm2012.html
但是我如何从 powershell 中以编程方式执行此操作?
我认为文件夹的名称中不能包含“:”。看起来真的是文件夹不存在
好的,找到了解决这个问题的方法
New-PSDrive -Name $sitecode -PSProvider "AdminUI.PS.Provider\CMSite" -Root "$ENV:ComputerName" -Description "SCCM Site"
运行 上面的命令创建了您可以随后使用的驱动器。