Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Confirm-promt in PS-script

Reply
 
Old 11-10-2007   #1 (permalink)
jer


 
 

Confirm-promt in PS-script

I wrote a script to assign a mailbox policy to users created in the last 24
hours:

$today=get-date
$yesterday=$today.AddDays(-1d)
get-mailbox -resultsize unlimited | Where-Object {$_.WhenCreated -gt
"$yesterday"} | Set-Mailbox -ManagedFolderMailboxPolicy "Empty deleted items
folder once a week"

However, there is a problem. I get this promt when running the script:

Confirm
When assigning a managed folder mailbox policy with managed custom folders
to
the mailbox "adm.no/Users/Test Policy", Outlook clients older than Outlook
2007
do not have all available client features and clients older than 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 tried to add -confirm:$false, but it didn`t help.


Any suggestions?


My System SpecsSystem Spec
Old 11-10-2007   #2 (permalink)
Marco Shaw [MVP]


 
 

Re: Confirm-promt in PS-script

jer wrote:
Quote:

> I wrote a script to assign a mailbox policy to users created in the last
> 24 hours:
>
> $today=get-date
> $yesterday=$today.AddDays(-1d)
> get-mailbox -resultsize unlimited | Where-Object {$_.WhenCreated -gt
> "$yesterday"} | Set-Mailbox -ManagedFolderMailboxPolicy "Empty deleted
> items folder once a week"

Hopefully this links works properly if you click it:
http://groups.google.com/group/micro...=gst&q=autoit#

If not, look for this thread from August 24th: "suppressing confirmation
prompt".

Basically, there's a "-ManagedFolderMailboxPolicyAllowed" parameter
available.

Marco

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 11-10-2007   #3 (permalink)
Shay Levi


 
 

Re: Confirm-promt in PS-script

I'm not sure if this is the case, try -Force and if it doesn't help try to
add -ForceUpgrade to the set command.
In the where-object I suggest to remove the double quotes on "$yesterday":

Where-Object {$_.WhenCreated -gt $yesterday} ...

You don't want to compare against a string instead of a datetime object though
PowerShell may do the convertion for you.


-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com


Quote:

> I wrote a script to assign a mailbox policy to users created in the
> last 24 hours:
>
> $today=get-date
> $yesterday=$today.AddDays(-1d)
> get-mailbox -resultsize unlimited | Where-Object {$_.WhenCreated -gt
> "$yesterday"} | Set-Mailbox -ManagedFolderMailboxPolicy "Empty deleted
> items
> folder once a week"
> However, there is a problem. I get this promt when running the script:
>
> Confirm
> When assigning a managed folder mailbox policy with managed custom
> folders
> to
> the mailbox "adm.no/Users/Test Policy", Outlook clients older than
> Outlook
> 2007
> do not have all available client features and clients older than
> 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 tried to add -confirm:$false, but it didn`t help.
>
> Any suggestions?
>

My System SpecsSystem Spec
Old 11-10-2007   #4 (permalink)
jer


 
 

Re: Confirm-promt in PS-script

Thank you, the "ManagedFolderMailboxPolicyAllowed" did it.
Also, the AutoIt was nice to know.


Jan Egil


"jer" <jer@xxxxxx> skrev i melding
news:347910E0-8C58-44C4-90FF-64053BDF6BD7@xxxxxx
Quote:

>I wrote a script to assign a mailbox policy to users created in the last 24
>hours:
>
> $today=get-date
> $yesterday=$today.AddDays(-1d)
> get-mailbox -resultsize unlimited | Where-Object {$_.WhenCreated -gt
> "$yesterday"} | Set-Mailbox -ManagedFolderMailboxPolicy "Empty deleted
> items folder once a week"
>
> However, there is a problem. I get this promt when running the script:
>
> Confirm
> When assigning a managed folder mailbox policy with managed custom folders
> to
> the mailbox "adm.no/Users/Test Policy", Outlook clients older than Outlook
> 2007
> do not have all available client features and clients older than 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 tried to add -confirm:$false, but it didn`t help.
>
>
> Any suggestions?
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
moving files to external HD using command promt Vista General
Solved Task manager, registry edit and command promt disabled General Discussion
Re: My command promt deosnt work Vista General
Command Promt Vista networking & sharing
Please confirm: using an XP USB printer over LAN Vista networking & sharing


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46