powershell - 从远程系统运行 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。
看不出我们为什么会遇到这个问题。
解决方案
推荐阅读
- vhdl - 组件与实体默认通用值
- html - Semantically, can I put
inside - jasmine - TypeError:无法在角度范围内设置未定义的属性
- jmeter - How to write regular expression from the Request tab> Cookie Data section to pull CSRF-TOKEN value
- scala - 从 Spark 中的多个 S3 存储桶中读取
- office-ui-fabric - Loading Office UI Fabric fonts and icons with Content Security Policy
- python - How do I select only some values in the column using pandas pivot table
- javascript - How to use string 'show' to trigger jquery show function?
- javascript - 热到 getByteTimeDomainData() 的结果提前几秒钟?
- c# - 为什么我看不到“查找和替换”窗口