Files
demo/jenkins/getmailbox.ps1
Pavel Guzaev 431b4f5cfd all demo
2024-03-09 17:36:50 +05:00

9 lines
618 B
PowerShell

$username='adm_exch@domain'
$pwsd='superpass'
$password = ConvertTo-SecureString $pwsd -AsPlainText -Force
$Cred = New-Object System.Management.Automation.PSCredential ($username, $password)
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://win2016-dc-exch.domain/powershell/ -Authentication Basic -AllowRedirection -Credential $Cred
Invoke-Command -Session $Session -ScriptBlock { Get-Mailbox -OrganizationalUnit domain/NSD -ResultSize Unlimited } | Format-List DisplayName, WindowsEmailAddress, CustomAttribute1 | Out-File -Encoding UTF8 mailbox.nausd
Remove-PSSession $Session