1
我正尝试使用kb2915218中的PowerShell脚本为我的应用程序生成一个MachineKey。运行PowerShell脚本.PS1
我已将该功能复制到记事本并保存为.PS1文件。现在,如果我通过资源管理器查看此文件,它将被识别为PowerShell文件。
然后我运行PowerShell和CD
到我的.PS1文件的目录。
我然后跑以下命令:
Set-ExecutionPolicy Unrestricted
依次为:
.\Powershell-Generate-MachineKey.ps1
(我的剧本的名字)。最后我再尝试运行命令
Generate-MachineKey
但是我得到的消息:
Generate-MachineKey : The term 'Generate-MachineKey' 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 + Generate-MachineKey + ~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Generate-MachineKey:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
是否有人可以告诉我在哪里,我错了吗?
'。 。\ Powershell-Generate-MachineKey.ps1'(注意前导点)。 –
我是一个什么样的人,我一直在看这个约1小时。大!请添加此作为解决方案,我会接受:) –