$cmdlet="Disable-RemoteMailBox"
$arguments = @{Identity=$identity;DomainController=$domaincontroller;Archive=""}
$command_args=""
$arguments.keys | ForEach-Object{
$message = '-{0} {1} ' -f $_, $arguments[$_]
$command_args+= $message
}
$result=& $cmdlet @arguments 2>&1
In the end this is executed:
Disable-RemoteMailBox -Identity abc@corp.com -DomainController dc.corp.local -Archive
but i need to add a confirm:$false
Disable-RemoteMailBox -Identity abc@corp.com -DomainController dc.corp.local -Archive -Confirm:$false
How to add this $false in the Hashtable?
Change the $arguments
hashtable from:
$arguments = @{Identity=$identity;DomainController=$domaincontroller;Archive=""}
to
$arguments = @{Identity=$identity;DomainController=$domaincontroller;Archive="";Confirm=$false}