header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

How do I prevent cmdlets asking for confirmation
Last Post 15 Feb 2008 04:12 AM by Box293. 2 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Box293User is Offline
New Member
New Member
Posts:8
Avatar

--
11 Feb 2008 05:38 AM  

I am writing a large script to automate adding a customer to our hosting active directory (something we do on a regular basis).

There are various cmdlets I use through the script that will prompt me for confirmation before performing the action; for example "Remove-ADPermission".

How do I tell these cmdlets to not prompt me for confirmation and just do it?

 

Thanks

Troy

marco.shawUser is Offline
Co-Community Director
Basic Member
Basic Member
Posts:189
Avatar

--
11 Feb 2008 02:01 PM  
http://blogs.msdn.com/powershell/archive/2006/12/15/confirmpreference.aspx
Marco

*Microsoft MVP - Windows PowerShell: http://www.microsoft.com/mvp
*PowerGadgets MVP: http://www.powergadgets.com/mvp
*Blog: http://marcoshaw.blogspot.com
Box293User is Offline
New Member
New Member
Posts:8
Avatar

--
15 Feb 2008 04:12 AM  
Excellent, thanks very much. Sorry for not getting back to you sooner but I've only just had the chance to do this now.

I found it easiest to add the following line to the top of the script:

$ConfirmPreference = "None"

After doing that all went OK. Thanks once again.
You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer