Powershell cd站点代码不起作用
问题描述:
我试图在导入模块ConfigurationManager.psd1作为非管理员用户在远程计算机上运行CD到SCCM站点文件夹。不过我流汗以下错误:Powershell cd站点代码不起作用
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
我可以通过以下链接给出的文档解决这个问题: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"
运行上面的命令创建,您可以随后使用该驱动器。
答
我不认为文件夹的名称中可以包含“:”。它确实看起来像该文件夹不存在。
对不起,我已经贴了错误的命令是CD撒上:,撒上是在SCCM站点代码。 – Prabhat
那么你试图将光盘放入C:\ Users \ u6 \ Documents \ 1SA的路径是什么? C:\ Users \ u6 \ Documents \ 1SA:? 它存在吗? –
好的,得到了解决方案,我发布了答案。实际上1SA:是在与创建的CMSite对应的电源外壳中驱动的。这是不可用的使用回答中给出的命令可以创建,现在可以访问。 – Prabhat