Powershell 将结果写入文件,而不是写入Active Directory live环境
在生产环境中实际运行该脚本之前,我需要输出该脚本将执行的操作。有人能帮忙吗 它所做的只是更新用户对象中的属性EmployeeID。我的经理想从所有3500名员工在广告中获得的价值中得到一个信息,而不必实际写信给它。我希望这是有道理的 我的CSV文件:Powershell 将结果写入文件,而不是写入Active Directory live环境,powershell,logging,export-to-csv,Powershell,Logging,Export To Csv,在生产环境中实际运行该脚本之前,我需要输出该脚本将执行的操作。有人能帮忙吗 它所做的只是更新用户对象中的属性EmployeeID。我的经理想从所有3500名员工在广告中获得的价值中得到一个信息,而不必实际写信给它。我希望这是有道理的 我的CSV文件: employeeid,Name 9089809890,ktest 脚本: $stuff = Import-Csv c:\temp\finalexport_test.txt $stuff $empid = $stuff.employeeid $u
employeeid,Name
9089809890,ktest
脚本:
$stuff = Import-Csv c:\temp\finalexport_test.txt
$stuff
$empid = $stuff.employeeid
$userid = $stuff.name
foreach ($user in $userid) {
Set-ADUser -Identity $user -EmployeeID $empid
}
您可以将
Set-AdUser
cmdlet上的-whatif
标志与转录本一起使用:
$stuff = Import-Csv c:\temp\finalexport_test.txt
$stuff
$empid = $stuff.employeeid
$userid = $stuff.name
foreach ($user in $userid) {
Start-Transcript 'yourFile'
Set-ADUser -Identity $user -EmployeeID $empid -whatif
Stop-Transcript
}