您好我有以下代码,具有三个功能
function Search_User_File { foreach ($User in $FILE) { Search_User_AD} }
function Search_User_AD {
$Ad = Get-ADUser -filter * -Properties sAMAccountName,sn,givenName,department,title,telephoneNumber,employeeID,employeeNumber -SearchBase "OU=COMPANY,DC=COMPANYcolo,DC=pvt" | Select-Object sAMAccountName,sn,givenName,department,title,telephoneNumber,employeeID,employeeNumber
$Search = $Ad | ? {$_.sn -eq $User.sn}
If ($Search) {
Foreach ($AD_User in $Search) {
Write-Host "=============CSV User==============="
Write-Host ""
Write-Host "=============AD User==============="
Write-Host ""
$RightWrong = Read-Host 'Is this the RIGHT EMPLOYEE we are working (Y/N)'
If ($RightWrong -eq "Y") {
write-host ""
$Correct = Read-Host 'NOTE: Is the EMPLOYEE Information FOUND In AD CORRECT AGAINST The EMPLOYEE Information FOUND In the FILE File? (Y/N)'
If (($RightWrong -eq "Y") -and ($Correct -eq "N")){
Edit_AD_User
}
Elseif (($RightWrong -eq "Y") -and ($Correct -eq "Y")) {
clear-host
在这里,我如何在 SEARCH_USER_FILE 上 MOVE.NEXT ?如果我不这样做,那么 Search_User_File 将重新开始。
Search_User_File
}
}
}
function Edit_User_AD {
}
$File = Import-Csv "c:\scripts\ad\temp\file.csv" -header sn,givenName,department,title,telephoneNumber,employeeID,employeeNumber
Search_User_File
谢谢你的帮助,