try { # Import admin credentials $serverAddress = Get-Content -Path ".\DefaultServer.txt" $credential = Import-Clixml -Path ".\AdminCredential.xml" # Establish session with Exchange Server $session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://$serverAddress/PowerShell/ -Authentication Kerberos -Credential $credential Import-PSSession $session # Parameter from batch script $identity = $args[0] # Set unlimited mailbox size Set-Mailbox -Identity $identity -IssueWarningQuota Unlimited -ProhibitSendQuota Unlimited -ProhibitSendReceiveQuota Unlimited Write-Host "Mailbox size set to unlimited successfully for $identity!" -ForegroundColor Green Remove-PSSession $session } catch { Write-Host "Failed to set unlimited mailbox size. Error:" -ForegroundColor Red Write-Host $_ }