Unfortunately, not all cmdlets work as expected with ea. Some ignore the stop 
or inquire params.
I simply rethought how the should be done and the script works as expected.
Thanks,
jlc

-----Original Message-----
From: Webster [mailto:[email protected]] 
Sent: Saturday, September 03, 2011 8:17 PM
To: NT System Admin Issues
Subject: RE: Powershell help

Try adding -ea 0  to the end of your stmt.  ea means ErrorAction.  Google that.

Carl Webster

Consultant and Citrix Technology Professional

http://www.CarlWebster.com

________________________________________
From: Joseph L. Casale [[email protected]]
Sent: Saturday, September 03, 2011 8:45 PM
To: NT System Admin Issues
Subject: Powershell help

Guys,
I am sure the answer here is simple, but what's an elegant way to handle the 
case where I need to test if an OU exists:
Get-ADOrganizationalUnit -Identity "ou=$someOU,$root"
and mask the error and simply bail or proceed on with my script.

Using try/catch and if/! I am not crafting an elegant way to simply halt 
without producing error...

Thanks!
jlc

~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ 
<http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to 
[email protected]<mailto:[email protected]>
with the body: unsubscribe ntsysadmin



~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ 
<http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin


~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin

Reply via email to