问题
I am trying to generate a machine key to place in my web configs, but its saying it is not recognized. I have already read the following question and use the same commands without success Generate Machine Key. Please check what am i doing:
I took the Powershell Script from microsoft site, then executed the commands below:
PS C:\> C:\Users\myuser\Desktop\Docs\KeyGeneration\machinekey.ps1
Then
PS C:\> Generate-MachineKey -validationAlgorithm SHA1
It says that:
The term 'Generate-MachineKey' is not recognized as the name of a cmdlet, function, script file
回答1:
Try "dot sourcing" the running of the script, by placing a period and then a space before the script
PS C:> . C:\Users\myuser\Desktop\Docs\KeyGeneration\machinekey.ps1
来源:https://stackoverflow.com/questions/39576902/generate-machine-key-using-power-shell-unrecognized-command