Generate Machine Key using power Shell - Unrecognized Command

2.5k Views Asked by At

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

There are 1 best solutions below

1
BenH On BEST ANSWER

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