0

我目前正在尝试从远程服务器中提取 msinfo 数据,然后将该输出保存到位于另一台服务器上的共享中。当我运行命令时,会出现一个进度条,然后在没有明显问题的情况下完成,但文件没有保存到 UNC 路径。我已经验证我对共享具有权限并且 nfo 生成本身可以工作。有任何想法吗?

C:\Windows\system32>msinfo32 /computer servername /nfo \\sharename\filename.nfo
4

2 回答 2

0

非常奇怪,它适用于 CMD 但不适用于 Powershell,没有时间探索它,但是如果您需要在 powershell 中运行它,您可以采用以下解决方法:

$TempFile = [System.IO.Path]::GetTempFileName()
C:\Windows\system32\msinfo32 /computer Computer /nfo $TempFile
Do
{
Sleep 5
}
Until (!(Get-Process msinfo32 -ErrorAction SilentlyContinue))
Copy-Item $TempFile \\Computer\Share\output.nfo
$TempFile | Remove-Item -Force
于 2015-07-06T21:40:16.550 回答
0

明白了 - 从服务器拉出文件后,我能够使用切换用户参数来保存文件。

谢谢!

于 2015-07-07T14:06:40.997 回答