【发布时间】:2019-06-07 12:33:25
【问题描述】:
升级到 powershell 3.0 后,现有脚本因错误而停止工作
ConvertTo-SecureString : The term 'ConvertTo-SecureString' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At line:1 char:1
+ ConvertTo-SecureString
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (ConvertTo-SecureString:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我发现在 PS 3.0 上 ConvertTo-SecureString 是 supported。我需要以某种方式包含它吗?
【问题讨论】:
-
all 脚本是否停止工作?还是只包含
ContertTo-SecureString的脚本? -
在我的 3.0 上,相应的 DLL 位于此处
C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.PowerShell.Security\v4.0_3.0.0.0__31bf3856ad364e35\Microsoft.PowerShell.Security.dll。您可能会检查该 dll 是否在该路径中。你还应该有这个目录:C:\Windows\System32\WindowsPowerShell\v1.0\modules\Microsoft.PowerShell.Security -
顺便说一句,您使用的是哪个操作系统?您是否安装了任何服务器产品,例如 Exchange、SharePoint Server、SCCM 等?
标签: windows powershell powershell-3.0