문제

괜찮아요. 나는 잠 들어 있습니다. 내 Powershell 스크립트로 무엇을 잘못 했는가 (나는 방금 A 팀을 염두에두고 수정 함)

function update-fields () {
#Set up default variables

#My Site URL
$mySiteUrl = "http://cia-central"

#Get site objects and connect to User Profile Manager service
$site = Get-SPSite $mySiteUrl
$context = Get-SPServiceContext $site
$profileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context) 
$profiles = $profileManager.GetEnumerator()

    foreach ($up in $profiles) {
        Write-Host $up["UserName"].Value
        $firstname = $up["UserName"].Value
        $up["FirstName"].Value = $firstname
        $up["LastName"].Value = "Lynch"
        $up["Role"].Value = "Operative"
        $up["Entity"].Value = "CIA"
        $up["WorkPhone"].Value = "01234 568 901"
        $up["EMail"].Value = $firstname + ".lynch@cia.com"
        $up.Commit()
    }
}
.

[편집] 유감스럽게도 tantos 나는 그것을 포함했다고 생각했습니다. 무슨 일이 일어 났는지 모르겠습니다.

프로파일 변수는 profileManager에서 null를 되돌립니다.그러나 졸음에서 나는 오류를 읽고 단서가 있었다. 나는 계정 권한이 없었다.

"요청을 처리 할 수있는 사용자 프로파일 응용 프로그램 없음"이 오류가 처음 50 번 스크립트를 실행하는이 오류를 보지 못했습니다.

완료되었습니다.

도움이 되었습니까?

해결책

The profiles variable is coming back NULL from the profilemanager. But in my sleepyness I re read the error and the clue was there, I didn't have the account permissions.

"No user profile application available to service the request" I just didn't see this error the first 50 times running the script.

Done.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top