c# - Add an Office365 user to the Role Group "View-Only Organization Management" -
c# - Add an Office365 user to the Role Group "View-Only Organization Management" -
i trying add together office365 user role-group, "view-only organization management" client side using c# , powershell. have installed azure ad on local machine. after which, able run next cmdlets both powershell console app:
connect-msolservice new-msoluser add-msolrolemembernow, add together user, role-group, "view-only organization management", tried utilize cmdlet, add-rolegroupmember in format,
add-rolegroupmember "view-only organization management" -member pk
pk display name of user. when execute cmdlet powershell or console app, getting next error:
so how can accomplish this? in advance.
i figured out none of "exchange 2013" cmdlet not nowadays on our machine default., need import powershell session before using cmdlet , remove when we're done using it. below finish set of commands needed perform task:
open windows powershell.
get credentials.
$cred = get-credential
create remote powershell session
$session = new-pssession -configurationname microsoft.exchange -connectionuri https://ps.outlook.com/powershell -credential $usercredential -authentication basic –allowredirection
plz create sure url given above exchange online only.
import cmdlets powershell
import-pssession $session
once import done, exchange 2013 cmdlets become available.
we can execute cmdlet, "add-rolegroupmember"
add-rolegroupmember -identity "view-only organization management" -member pks
finally, don't forget remove session before exiting.
remove-pssession $session
the difference before not importing pssession before executing cmdlet. plz note import valid exchange 2013 cmdlet , not only.
for farther details, can visit here.
c# powershell exchange-server office365
Comments
Post a Comment