[英]Can't invoke setspn from PowerShell
I need to call Setspn.exe from PowerShell. 我需要从PowerShell调用Setspn.exe。 but any tries are fail:
但是任何尝试都是失败的:
setspn;
Setspn;
invoke-expression "setspn";
start-process setspn;
But i can launch cmd, and i can call setspn from command line. 但是我可以启动cmd,并且可以从命令行调用setspn。
If you're having trouble with PowerShell open it up in CMD. 如果您在使用PowerShell时遇到问题,请在CMD中打开它。
PS C:\> cmd /c 'setspn'
Remember CMD only returns text not objects. 请记住,CMD仅返回文本,而不返回对象。
You can use the invoke operator &
您可以使用invoke运算符
&
& 'C:\Windows\System32\setspn.exe'
If you want to add parameters to the setspn call, you can put them in an array and add it to the invocation 如果要将参数添加到setspn调用中,可以将它们放在数组中并将其添加到调用中
$param = ('-L','SANDY.sqladmin.lan')
& 'C:\Windows\System32\setspn.exe' $param
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.