Test-path is probably what you want. I'm not sure what you mean by "enumerate correctly".
Regards, Michael B. Smith Consultant and Exchange MVP http://TheEssentialExchange.com -----Original Message----- From: Joseph L. Casale [mailto:[email protected]] Sent: Tuesday, September 07, 2010 2:50 PM To: NT System Admin Issues Subject: RE: Powershell Question Hey Rubens, I am not too concerned with how I get the value, but more on how to trap if it doesn't enumerate correctly. Once I start looping through all the special folders of interest, I don't want to send something wrong into the routine that follows. Thanks! jlc -----Original Message----- From: Rubens Almeida [mailto:[email protected]] Sent: Tuesday, September 07, 2010 12:46 PM To: NT System Admin Issues Subject: Re: Powershell Question I'd try something like this: $sfDesktop = $env:USERPROFILE + "\desktop" On Tue, Sep 7, 2010 at 3:36 PM, Joseph L. Casale <[email protected]> wrote: > Hey Guys, > > What's the most simple and elegant way to trap for the following > variable > assignment: > > Eg. $sfDesktop = [Environment]::GetFolderPath("Desktop") > > > > Should I assign it like this, and test for a proper value when using > (skip otherwise while I cycle through all the ones I need to)? If so, > how do you test the value for it having been properly assigned? > > > > Sorry, ps noob here. > > 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] > 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 ~ 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
