在 Windows XP 上 - 如何使用需要 Windows 身份验证的 PowerShell 后台作业
我正在尝试在 PoSh 脚本的后台运行一些函数。这项工作永远不会完成,但在正常情况下工作正常。我已将问题缩小到以下行:
此行工作正常:
$ws = New-WebServiceProxy "http://host/Service?wsdl" -UseDefaultCredential
但此行永远阻塞
start-job { New-WebServiceProxy "same url" -UseDefaultCredential } `
| wait-job | Receive-Job
一些细节:该服务是本地的,并且需要 Windows 身份验证。客户端是XP &服务器2003。
为什么?我怎样才能让它发挥作用?
I'm trying to run some functions in the background of a PoSh script. The job never completes, but works fine when called normal. I've narrowed the problem down to the following line:
This line works fine:
$ws = New-WebServiceProxy "http://host/Service?wsdl" -UseDefaultCredential
but this line blocks forever
start-job { New-WebServiceProxy "same url" -UseDefaultCredential } `
| wait-job | Receive-Job
Some details: the service is local, and requires windows authentication. Client is XP & server 2003.
Why? How do I get it to work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用 ConvertFrom-SecureString 和 ConvertTo-SecureString cmdlet
一旦运行,
它将在磁盘上创建一个安全文件
之后你可以使用
和
You can use ConvertFrom-SecureString and ConvertTo-SecureString cmdlets
Once run
it will create a secured file on disk
after that you can use
and
得到这个工作。您运行什么操作系统? XP或2003可能有问题。
Got this to work. What OS are you running? XP or 2003 may be a problem.
我没有任何 ASMX Web 服务来对此进行测试,但如果您查看 Start-Job 的帮助,您将看到“-Authentication-”和“-Credential”。第一个指定 Default、Basic、Credssp、Digest、Kerberos、Negotiate 和 NegotiateWithImplicitCredential。第二个可用于提供运行作业的实际凭据。
希望有帮助。
I don't have any ASMX web services to test this against, but if you look at the help of Start-Job you'll see '-Authentication- and '-Credential'. The first specifies Default, Basic, Credssp, Digest, Kerberos, Negotiate, and NegotiateWithImplicitCredential. The second could be used to provide actual credentials to run the job.
Hope that helps.