使用 Power shell 生成机器密钥 [英] Generate Machine Key using Power shell
问题描述
我正在尝试生成机器密钥以在几台机器之间共享,经过快速谷歌搜索后,我发现了这个 文章 KB 2915218,附录 A .
- 我复制了代码并另存为 .ps1 扩展名,我认为这是 Power Shell 扩展名.
- 打开电源外壳
- 移动到文件所在的位置
- 运行脚本.
<块引用>
PS E: ./Generate-MachineKey -validation sha1
它运行良好,但不输出密钥.有什么理由吗?我在 Powershell 中做错了什么吗?
谢谢,
该脚本包含一个函数,因此您必须先加载该脚本,然后运行该函数才能使其工作.
首先我们必须加载文件,我将我的 ps1 命名为MachineKey",所以这就是我加载它的方式
PS E:\>..\机器密钥.ps1
一旦我加载了文件,如果我想运行名为Generate-MachineKey"的函数,我必须在之后输入这个
PS E:\>Generate-MachineKey -validationAlgorithm SHA1
I am trying to generate machine key to share between a few machine, after a quick google search i found this article KB 2915218, Appendix A .
- I copied the code and save as .ps1 extension which i believe is power shell extension.
- Open power shell
- Move to the location of the file
- run the script.
PS E: ./Generate-MachineKey -validation sha1
It runs fine but it doesn't output the keys. Any reason why? Am i doing something wrong in Powershell?
Thanks,
The script contains a function so you'll have to first load the script and then run the function for it to work.
First we'll have to load the file, i called my ps1 "MachineKey" so this is how i load it
PS E:\> . .\MachineKey.ps1
Once i've loaded the file if i want to run the function called "Generate-MachineKey" i have to type this in afterwards
PS E:\> Generate-MachineKey -validationAlgorithm SHA1
这篇关于使用 Power shell 生成机器密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!