Yeah,
You have to pardon my lack of ps experience:)

I really don't know what happens to that var if the expression bails, so 
"whatever" the contents of the var after failure are, I didn't want to push 
that into the backup function.

Thanks Rubens and Michael!
jlc

-----Original Message-----
From: Michael B. Smith [mailto:mich...@smithcons.com] 
Sent: Tuesday, September 07, 2010 1:46 PM
To: NT System Admin Issues
Subject: RE: Powershell Question

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:jcas...@activenetwerx.com] 
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:rubensalme...@gmail.com]
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 <jcas...@activenetwerx.com> 
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 listmana...@lyris.sunbeltsoftware.com
> 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 listmana...@lyris.sunbeltsoftware.com
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 listmana...@lyris.sunbeltsoftware.com
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 listmana...@lyris.sunbeltsoftware.com
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 listmana...@lyris.sunbeltsoftware.com
with the body: unsubscribe ntsysadmin

Reply via email to