Answer the question
In order to leave comments, you need to log in
Adding users by script to a group in Exchange Online?
Good afternoon!
I'm trying to add a script to office365, to certain groups of new users, but for some reason it returns an error -
The name "Get-DistributionGroupMember" is not recognized as the name of a cmdlet, function, script file or executable program.
The script itself:
$PlainPassword = "********"
$SecurePassword = $PlainPassword | ConvertTo-SecureString -AsPlainText -Force
$UserName = "[email protected]"
$Credentials = New-Object System.Management.Automation.PSCredential `
-ArgumentList $UserName, $SecurePassword
$session = New-PSSession -ConfigurationName Microsoft.Exchange - ConnectionUri https://ps.outlook.
$alias="[email protected]"
Get-DistributionGroupMember –identity “[email protected]” | ft name, primarysmtpaddress
Add-DistributionGroupMember -Identity "[email protected]" -Member $alias
Remove-PSSession $Session
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question