Set-Msoluser : 액세스가 거부되었습니다. 이 cmdlet을 호출 할 권한이 없습니다.

Clancinio

최신 정보

Office 365 관리 서비스 및 Exchange Online Services에 성공적으로 연결했습니다. Get-MsolUser와 같은 cmdlet을 테스트했으며 제대로 작동합니다. 그러나 Set-MsolUser 명령을 실행하여 Title을 변경하려고하면 아래와 같이 Access Denied 오류가 발생합니다. 수동으로 Exchange로 이동하여 원하는 속성을 변경할 수 있지만이 명령을 실행할 수 없기 때문에 이상합니다. 이 주위에 어떤 방법이 있습니까?

Office 365 사용자 특성을 업데이트하는 스크립트

## Variables
$systemmessagecolor = "cyan"
$processmessagecolor = "green"
$savedcreds=$false                      ## false = manually enter creds, True = from file
$credpath = "c:\downloads\tenant.xml"   ## local file with credentials if required

## If you have running scripts that don't have a certificate, run this command once to disable that level of security
## set-executionpolicy -executionpolicy bypass -scope currentuser -force

Clear-Host

write-host -foregroundcolor $systemmessagecolor "Script started`n"

#install-module msonline
Import-Module -Name "C:\Temp\MsOnline" -Verbose
write-host -foregroundcolor green "MSOnline module loaded"

## Get tenant login credentials
$cred = Get-Credential


## Connect to Office 365 admin service
connect-msolservice -credential $cred
write-host -foregroundcolor $systemmessagecolor "Now connected to Office 365 Admin service"

## Start Exchange Online session
$EXOSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell -Credential $cred -Authentication Basic -AllowRedirection
import-PSSession $EXOSession -AllowClobber
write-host -foregroundcolor $processmessagecolor "Now connected to Exchange Online services`n"
write-host -foregroundcolor $systemmessagecolor "Script Completed`n"


# Load data from file.csv
$EXUsers = Import-csv file_path.csv


# Count variable for number of users update
$count = 0

# Go through each row that has user data in the CSV we just imported 
ForEach($User in $EXUsers)
{
    # Ppopulate hash table for Get-Msoluser splatting:
    $GetParams =
    @{
        UserPrincipalName     = $User.userPrincipalName
    }

    # Initialize hash table for Set-Msoluser splatting:
    $SetParams =
    @{
        UserPrincipalName     = $User.userPrincipalName
        Title                 = $User.title
    }

    # Get user and update.
    if ( Get-Msoluser @GetParams)
    {
         # Set User attributes
         Set-MsolUser @SetParams

         # Print that the user was updated 
         Write-Host -ForegroundColor Yellow "$User - User attributes have been updated." 

         # Update Count
         $count += 1    
     }
}

# Print the number of updated users
Write-Host $count "Users have been updated" -ForegroundColor Green

에러 메시지:

Set-Msoluser : Access Denied. You do not have permissions to call this cmdlet.
At line:1 char:59
+ ... ncipalName "[email protected]" | Set-Msoluser -Title "Test Title"
+                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [Set-MsolUser], MicrosoftOnlineException
    + FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.AccessDeniedException,Microsoft.Online.Administration.Automation.SetUser

Clancinio

해결

액세스 거부 문제는 Exchange 관리 셸 에서 스크립트를 실행하여 해결되었습니다.

또한 스크립트가 제대로 작동하도록 다음과 같이 변경되었습니다.

  1. principalUserName-> 신원
  2. Get-MsolUser-> Get- 사서함
  3. Set-MsolUser-> Set-User
## Variables
$systemmessagecolor = "cyan"
$processmessagecolor = "green"

# Load data from file.csv
$EXUsers = Import-csv file_path.csv

# Count variable for number of users update
$count = 0

# Go through each row that has user data in the CSV we just imported 
ForEach($User in $EXUsers)
{
    # Ppopulate hash table for Get-Msoluser splatting:
    $GetParams =
    @{
        Identity = $User.Identity
    }

    # Initialize hash table for Set-Msoluser splatting:
    $SetParams =
    @{
        Identity = $User.Identity
        Title    = $User.Title
    }

    # Get user and update.
    if ( Get-Mailbox @GetParams)
    {
         # Set User attributes
         Set-User @SetParams

         # Print that the user was updated 
         Write-Host -ForegroundColor Yellow "$User - User attributes have been updated." 

         # Update Count
         $count += 1    
     }
}

# Print the number of updated users
Write-Host $count "Users have been updated" -ForegroundColor Green

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

E00011-액세스가 거부되었습니다. Transaction Details API를 호출 할 권한이 없습니다. -Aithorize.net에서

분류에서Dev

로컬에서 원격 호스트로 파일을 scp 할 수 없음-권한이 거부되었습니다.

분류에서Dev

로컬에서 원격 호스트로 파일을 scp 할 수 없음-권한이 거부되었습니다.

분류에서Dev

ls : .gvfs에 액세스 할 수 없음 : 권한이 거부되었습니다.

분류에서Dev

ls : .gvfs에 액세스 할 수 없음 : 권한이 거부되었습니다.

분류에서Dev

postgres가 <basexxxx / xxxx> 파일을 stat 할 수 없습니다. 권한이 거부되었습니다.

분류에서Dev

Outlook 2013 : 오류 : 항목을 이동할 수 없습니다. 이미 이동 또는 삭제되었거나 액세스가 거부되었습니다.

분류에서Dev

파일에 액세스 할 수 없습니다 : 권한이 거부되었습니다.-Virtualbox

분류에서Dev

폴더 보안, 액세스 할 수 없습니다. .. 권한이 거부되었습니다.

분류에서Dev

'방향'을 말할 수 없습니다. 권한이 설정되면 권한이 거부되었습니다.

분류에서Dev

'방향'을 말할 수 없습니다. 권한이 설정되면 권한이 거부되었습니다.

분류에서Dev

rubyzip을 사용할 때 권한이 거부되었습니다.

분류에서Dev

XUbuntu : 텍스트 파일을 편집 할 수 없음 : 권한이 거부되었습니다.

분류에서Dev

Spring Security에서 hasPermission을 사용할 때 페이지에 대한 액세스가 거부되었습니다.

분류에서Dev

파일을 복사 할 수 없습니다. 경로에 대한 액세스가 몇 번이고 거부되었습니다.

분류에서Dev

Clearcase-VOB에 액세스 할 수 없음-ls : 디렉토리 읽기-권한이 거부되었습니다.

분류에서Dev

Mac OS X 및 Linux : mount_nfs : / nfs에 액세스 할 수 없음 : 권한이 거부되었습니다.

분류에서Dev

변수를 사용하여 파일 이름으로 출력 할 때 액세스가 거부되었습니다.

분류에서Dev

녹색 파일 이름으로 파일을 복사 할 수 없습니다. 액세스가 거부되었습니다.

분류에서Dev

Awk를 변수로 출력 할 수 없습니다. 권한이 거부되었습니다.

분류에서Dev

부여 권한이 있지만 mysql 액세스가 거부되었습니다.

분류에서Dev

.out 파일을 실행할 수 없습니다. 권한이 거부되었습니다.

분류에서Dev

.out 파일을 실행할 수 없습니다. 권한이 거부되었습니다.

분류에서Dev

__init__py 파일을 생성 할 수 없습니다. 권한이 거부되었습니다.

분류에서Dev

Python 스크립트를 실행할 수 없습니다. 권한이 거부되었습니다.

분류에서Dev

권한이 거부되었습니다. Rails가 설치를 완료 할 수 없습니다.

분류에서Dev

`root`가 소유 한 파일을 복사 할 때`cp` 권한이 거부되었습니다.

분류에서Dev

Drupal을 다운로드 할 때 권한이 거부되었습니다.

분류에서Dev

터미널을 시작할 때마다 권한이 거부되었습니다.

Related 관련 기사

  1. 1

    E00011-액세스가 거부되었습니다. Transaction Details API를 호출 할 권한이 없습니다. -Aithorize.net에서

  2. 2

    로컬에서 원격 호스트로 파일을 scp 할 수 없음-권한이 거부되었습니다.

  3. 3

    로컬에서 원격 호스트로 파일을 scp 할 수 없음-권한이 거부되었습니다.

  4. 4

    ls : .gvfs에 액세스 할 수 없음 : 권한이 거부되었습니다.

  5. 5

    ls : .gvfs에 액세스 할 수 없음 : 권한이 거부되었습니다.

  6. 6

    postgres가 <basexxxx / xxxx> 파일을 stat 할 수 없습니다. 권한이 거부되었습니다.

  7. 7

    Outlook 2013 : 오류 : 항목을 이동할 수 없습니다. 이미 이동 또는 삭제되었거나 액세스가 거부되었습니다.

  8. 8

    파일에 액세스 할 수 없습니다 : 권한이 거부되었습니다.-Virtualbox

  9. 9

    폴더 보안, 액세스 할 수 없습니다. .. 권한이 거부되었습니다.

  10. 10

    '방향'을 말할 수 없습니다. 권한이 설정되면 권한이 거부되었습니다.

  11. 11

    '방향'을 말할 수 없습니다. 권한이 설정되면 권한이 거부되었습니다.

  12. 12

    rubyzip을 사용할 때 권한이 거부되었습니다.

  13. 13

    XUbuntu : 텍스트 파일을 편집 할 수 없음 : 권한이 거부되었습니다.

  14. 14

    Spring Security에서 hasPermission을 사용할 때 페이지에 대한 액세스가 거부되었습니다.

  15. 15

    파일을 복사 할 수 없습니다. 경로에 대한 액세스가 몇 번이고 거부되었습니다.

  16. 16

    Clearcase-VOB에 액세스 할 수 없음-ls : 디렉토리 읽기-권한이 거부되었습니다.

  17. 17

    Mac OS X 및 Linux : mount_nfs : / nfs에 액세스 할 수 없음 : 권한이 거부되었습니다.

  18. 18

    변수를 사용하여 파일 이름으로 출력 할 때 액세스가 거부되었습니다.

  19. 19

    녹색 파일 이름으로 파일을 복사 할 수 없습니다. 액세스가 거부되었습니다.

  20. 20

    Awk를 변수로 출력 할 수 없습니다. 권한이 거부되었습니다.

  21. 21

    부여 권한이 있지만 mysql 액세스가 거부되었습니다.

  22. 22

    .out 파일을 실행할 수 없습니다. 권한이 거부되었습니다.

  23. 23

    .out 파일을 실행할 수 없습니다. 권한이 거부되었습니다.

  24. 24

    __init__py 파일을 생성 할 수 없습니다. 권한이 거부되었습니다.

  25. 25

    Python 스크립트를 실행할 수 없습니다. 권한이 거부되었습니다.

  26. 26

    권한이 거부되었습니다. Rails가 설치를 완료 할 수 없습니다.

  27. 27

    `root`가 소유 한 파일을 복사 할 때`cp` 권한이 거부되었습니다.

  28. 28

    Drupal을 다운로드 할 때 권한이 거부되었습니다.

  29. 29

    터미널을 시작할 때마다 권한이 거부되었습니다.

뜨겁다태그

보관