こんにちは、次のコードがあり、3 つの関数があります。
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
ご協力いただきありがとうございます、