Peter Lawton wrote:
> I'm having problems running an Exchange shell script automatically because I
> can't suppress the confirmation prompt. I've tried asking in an exchange
> group but nobody there could help.
> The command I'm trying to run is:-
> get-mailbox | set-mailbox -Confirm:$False -ManagedFolderMailboxPolicy
> "Default Policy"
> But I get the prompt:-
> When assigning a managed folder mailbox policy with managed custom folders
> the mailbox "domain/Users/username", Outlook clients older than
> Outlook 2007 do not have all available client features and clients older
> Outlook 2003 SP2 are not supported. You may use the "Set-CASMailbox" task to
> enable client version blocking. Are you sure you want to assign a managed
> folder mailbox policy to this mailbox?
> [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help
> (default is "Y"):
> I've also tried setting $ConfirmPreference="none" or
> $ConfirmPreference="high" but the prompt still appears
> Can anyone think of a way to suppress the prompt or automatically answer "A"
> so I can run this unnattended?
WScript has some funtionality to send key strokes to the screen: http://www.devguru.com/Technologies/..._SendKeys.html
Just for fun, I used AutoIt:
PSH>$autoit=new-object -comobject autoitx3.control
PSH> write-host "test"
You could likely write a dynamic script that does a repeated loop and
sends the proper key strokes to the PowerShell console.
That being said, you might want some kind of error control, but you
might just be able to do a start-transcript/stop-transcript and review
the console log to make sure all was well...
PowerGadgets MVP http://www.powergadgets.com/mvp