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小時。大!請添加此作爲解決方案,我會接受:) –