首页 > 解决方案 > 从远程系统运行 Get-PSDrive 时的 AUDIT_FAILURE

问题描述

我们运行一个脚本来通过 VPN 连接到远程服务器并复制一个文件。

首先我们创建了一个密码文件:

$credential = Get-Credential
$credential.Password | ConvertFrom-SecureString | Set-Content C:\Scripts\password.txt

然后我们使用该密码文件映射驱动器Get-PSDrive并复制文件:

Get-PSDrive Q | Remove-PSDrive
$password = Get-Content C:\Scripts\password.txt | ConvertTo-SecureString 
$credential = New-Object System.Management.Automation.PsCredential("DOM\user", $password)
New-PSDrive -name "Q" -PSProvider FileSystem -Root \\192.168.1.100\Test -Credential $credential -Persist
Copy Q:\*.* C:\Scripts

这可行,但是我们在事件日志中看到了我们的监控系统正在标记的 AUDIT_FAILUREs。它尝试使用脚本运行的本地凭据,这些凭据无效,因此会导致 AUDIT_FAILURE。

看不出我们为什么会遇到这个问题。

标签: powershell

解决方案


推荐阅读