Re: PSEXEC and %homedrive%

2010-11-09 Thread Ben Scott
On Mon, Nov 8, 2010 at 9:51 PM, Ben Scott  wrote:
> On Mon, Nov 8, 20d10 at 9:36 PM, Michael B. Smith  
> wrote:
>> Anecdote: believe it or not, MSFT really wanted to clean it up and make a
>> modern shell ... but doing so broke too many things.
>
>  I'd buy that if Rex Conn hadn't already done it 20+ years ago in 4DOS.

  Just to clarify, I don't doubt that you were told that, or even that
some within Microsoft might have wanted to clean up the command
interpreter.  Maybe they even put some resources towards it.  I also
don't doubt that without careful attention, many things would break.

  But if one guy, without access to the original sources, working for
shareware pay, was able to come up with a "90% solution", I have a
very hard time believing that Microsoft, with all their billions,
couldn't have done at least that much if they really wanted to.  Hell,
they probably could have just bought out Rex for less money then MSFT
spends on paperclips in a year.

-- Ben

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~   ~

---
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



RE: PSEXEC and %homedrive%

2010-11-09 Thread Christopher Bodnar
Thanks to everyone for all the help, that was just what I needed.


Chris Bodnar, MCSE
Systems Engineer
Distributed Systems Service Delivery - Intel Services
Guardian Life Insurance Company of America
Email: christopher_bod...@glic.com
Phone: 610-807-6459
Fax: 610-807-6003



From:   "Crawford, Scott" 
To: "NT System Admin Issues" 
Date:   11/08/2010 06:36 PM
Subject:    RE: PSEXEC and %homedrive%



…and by %computername%, I of course mean whatever variable you’d like to 
expand.
 
From: Crawford, Scott [mailto:crawfo...@evangel.edu] 
Sent: Monday, November 08, 2010 5:34 PM
To: NT System Admin Issues
Subject: RE: PSEXEC and %homedrive%
 
Your entire command line gets parsed on your computer first and then it 
performs the operation.
 
Assume you’re running from a PC named Workstation against a server named 
Server.
 
Psexec \\server cmd /c echo %computername%
 
Gets parsed to
 
Psexec \\server cmd /c echo Workstation
 
Which is exactly what the server does.
 
What you want is
 
Psexec \\server cmd /c echo ^%computername^%
 
The carets escape the percents to pass the command echo %computername% to 
the server.
 
From: Christopher Bodnar [mailto:christopher_bod...@glic.com] 
Sent: Monday, November 08, 2010 5:26 PM
To: NT System Admin Issues
Subject: RE: PSEXEC and %homedrive%
 
Thanks Carl, 

I see what you are saying now. I just don't understand the behavior. I 
would think anything after the "SERVERNAME" would be evaluated on the 
remote machine, but that doesn't' seem to be the case when specifying a 
variable. 

thanks 


Chris Bodnar, MCSE
Systems Engineer
Distributed Systems Service Delivery - Intel Services
Guardian Life Insurance Company of America
Email: christopher_bod...@glic.com
Phone: 610-807-6459
Fax: 610-807-6003 



From:"Carl Houseman"  
To:"NT System Admin Issues" 
 
Date:    11/08/2010 06:10 PM 
Subject:RE: PSEXEC and %homedrive% 




Do this 
  
psexec \\SERVERNAME cmd /c set 
  
So what's the difference.  Look again at this very carefully... 
  
psexec \\SERVERNAME cmd.exe /c echo %homedrive% 
  
Hint:  On what computer is %homedrive% expanded ? 
  
Carl 
  
From: Christopher Bodnar [mailto:christopher_bod...@glic.com] 
Sent: Monday, November 08, 2010 5:16 PM
To: NT System Admin Issues
Subject: Re: PSEXEC and %homedrive% 
  
I would agree with this, except that when I enumerate that using PSEXEC, I 
get the correct value,  so it does seem to be setting it: 

***
 

H:\Utilities>psexec \\SERVERNAME cmd.exe /c echo %homedrive% 

PsExec v1.94 - Execute processes remotely 
Copyright (C) 2001-2008 Mark Russinovich 
Sysinternals - www.sysinternals.com 


C: 
cmd.exe exited on gbtinvsql2x with error code 0. 
***
 



Chris Bodnar, MCSE
Systems Engineer
Distributed Systems Service Delivery - Intel Services
Guardian Life Insurance Company of America
Email: christopher_bod...@glic.com
Phone: 610-807-6459
Fax: 610-807-6003 



From:Ben Scott  
To:"NT System Admin Issues" 
 
Date:11/08/2010 04:15 PM 
Subject:Re: PSEXEC and %homedrive% 
 





On Mon, Nov 8, 2010 at 1:45 PM, Christopher Bodnar
 wrote:
> I've got a VBS script that we use pretty frequently, and I was trying to 
run
> it remotely using PSEXEC against a bunch of systems. Finally narrowed 
the
> problem down to the fact that for some reason, the %HOMEDRIVE% variable 
and
> PSEXEC didn't mix well on some systems.

%HOMEDRIVE% is set as part of the user logon process, which, in my
experience, generally doesn't happen for anything except a typical GUI
logon.

(%HOMEDRIVE% and %HOMEPATH% both come from the setting on the
"Profile" tab of an account's properties.)

-- Ben 
 
~ 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 securit

Re: PSEXEC and %homedrive%

2010-11-08 Thread Andrew S. Baker
*>>(CMD's quoting and escaping is incredibly idiosyncratic, so I'm
not really sure.)*

Man, you're not joking.   Just try to pass quotation marks to SCHTASKS.EXE

Scott does have it right, though...   That's the method I use.


*ASB *(My XeeSM Profile) 
*Exploiting Technology for Business Advantage...*
* *



On Mon, Nov 8, 2010 at 9:01 PM, Ben Scott  wrote:

> On Mon, Nov 8, 2010 at 7:23 PM, Carl Houseman 
> wrote:
> > psexec \\SERVERNAME cmd /v:on /c echo !computername!
>
>   FYI, if "delayed expansion" is enabled on the local host,
> I think you'll still get the unwanted behavior, i.e., expands locally,
> not remotely.  I think Scott Crawford's method, using the caret to
> escape the percent, is slightly better.
>
>  (CMD's quoting and escaping is incredibly idiosyncratic, so I'm not
> really sure.)
>
> -- Ben
>
>
>

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~   ~

---
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

Re: PSEXEC and %homedrive%

2010-11-08 Thread Ben Scott
On Mon, Nov 8, 20d10 at 9:36 PM, Michael B. Smith  wrote:
> Anecdote: believe it or not, MSFT really wanted to clean it up and make a
> modern shell ... but doing so broke too many things.

  I'd buy that if Rex Conn hadn't already done it 20+ years ago in 4DOS.

-- Ben

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~   ~

---
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


Re: PSEXEC and %homedrive%

2010-11-08 Thread Micheal Espinola Jr
+1.  Using carets to escape the characters works.

--
ME2





On Mon, Nov 8, 2010 at 3:34 PM, Crawford, Scott wrote:

>  Your entire command line gets parsed on your computer first and then it
> performs the operation.
>
>
>
> Assume you’re running from a PC named Workstation against a server named
> Server.
>
>
>
> Psexec \\server cmd /c echo %computername%
>
>
>
> Gets parsed to
>
>
>
> Psexec \\server cmd /c echo Workstation
>
>
>
> Which is exactly what the server does.
>
>
>
> What you want is
>
>
>
> Psexec \\server cmd /c echo ^%computername^%
>
>
>
> The carets escape the percents to pass the command echo %computername% to
> the server.
>
>
>
> *From:* Christopher Bodnar [mailto:christopher_bod...@glic.com]
> *Sent:* Monday, November 08, 2010 5:26 PM
>
> *To:* NT System Admin Issues
> *Subject:* RE: PSEXEC and %homedrive%
>
>
>
> Thanks Carl,
>
> I see what you are saying now. I just don't understand the behavior. I
> would think anything after the "SERVERNAME" would be evaluated on the remote
> machine, but that doesn't' seem to be the case when specifying a variable.
>
> thanks
>
>
> Chris Bodnar, MCSE
> Systems Engineer
> Distributed Systems Service Delivery - Intel Services
> Guardian Life Insurance Company of America
> Email: christopher_bod...@glic.com
> Phone: 610-807-6459
> Fax: 610-807-6003
>
>
>
> From:"Carl Houseman" 
> To:"NT System Admin Issues"  >
> Date:11/08/2010 06:10 PM
> Subject:RE: PSEXEC and %homedrive%
>  --
>
>
>
>
> Do this
>
> psexec \\SERVERNAME cmd /c set
>
> So what's the difference.  Look again at this very carefully...
>
> psexec \\SERVERNAME cmd.exe /c echo %homedrive%
>
> Hint:  On what computer is %homedrive% expanded ?
>
> Carl
>
> *From:* Christopher Bodnar 
> [mailto:christopher_bod...@glic.com]
> *
> Sent:* Monday, November 08, 2010 5:16 PM*
> To:* NT System Admin Issues*
> Subject:* Re: PSEXEC and %homedrive%
>
> I would agree with this, except that when I enumerate that using PSEXEC, I
> get the correct value,  so it does seem to be setting it:
>
>
> ***
> H:\Utilities>psexec \\SERVERNAME cmd.exe /c echo %homedrive%
>
> PsExec v1.94 - Execute processes remotely
> Copyright (C) 2001-2008 Mark Russinovich
> Sysinternals - www.sysinternals.com
>
>
> C:
> cmd.exe exited on gbtinvsql2x with error code 0.
>
> ***************
>
>
> Chris Bodnar, MCSE
> Systems Engineer
> Distributed Systems Service Delivery - Intel Services
> Guardian Life Insurance Company of America
> Email: christopher_bod...@glic.com
> Phone: 610-807-6459
> Fax: 610-807-6003
>
>
>
> From:Ben Scott 
> To:"NT System Admin Issues"  >
> Date:11/08/2010 04:15 PM
> Subject:Re: PSEXEC and %homedrive%
>
>
>  --
>
>
>
>
>
> On Mon, Nov 8, 2010 at 1:45 PM, Christopher Bodnar
>  wrote:
> > I've got a VBS script that we use pretty frequently, and I was trying to
> run
> > it remotely using PSEXEC against a bunch of systems. Finally narrowed the
> > problem down to the fact that for some reason, the %HOMEDRIVE% variable
> and
> > PSEXEC didn't mix well on some systems.
>
> %HOMEDRIVE% is set as part of the user logon process, which, in my
> experience, generally doesn't happen for anything except a typical GUI
> logon.
>
> (%HOMEDRIVE% and %HOMEPATH% both come from the setting on the
> "Profile" tab of an account's properties.)
>
> -- Ben
>
>
>
> ~ 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

RE: PSEXEC and %homedrive%

2010-11-08 Thread Michael B. Smith
Anecdote: believe it or not, MSFT really wanted to clean it up and make a 
modern shell (the standard PowerShell host is still based on cmd.exe, in case 
you hadn't noticed) - but doing so broke too many things.

Sodeal with the behavior that's 25 years old, install a ported UNIX shell, 
or use PowerShell where quoting and escaping is very well defined in 99.5% of 
the cases.

Regards,

Michael B. Smith
Consultant and Exchange MVP
http://TheEssentialExchange.com


-Original Message-
From: Ben Scott [mailto:mailvor...@gmail.com] 
Sent: Monday, November 08, 2010 9:02 PM
To: NT System Admin Issues
Subject: Re: PSEXEC and %homedrive%

On Mon, Nov 8, 2010 at 7:23 PM, Carl Houseman  wrote:
> psexec \\SERVERNAME cmd /v:on /c echo !computername!

  FYI, if "delayed expansion" is enabled on the local host, I think you'll 
still get the unwanted behavior, i.e., expands locally, not remotely.  I think 
Scott Crawford's method, using the caret to escape the percent, is slightly 
better.

  (CMD's quoting and escaping is incredibly idiosyncratic, so I'm not really 
sure.)

-- Ben

~ 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



Re: PSEXEC and %homedrive%

2010-11-08 Thread Ben Scott
On Mon, Nov 8, 2010 at 7:23 PM, Carl Houseman  wrote:
> psexec \\SERVERNAME cmd /v:on /c echo !computername!

  FYI, if "delayed expansion" is enabled on the local host,
I think you'll still get the unwanted behavior, i.e., expands locally,
not remotely.  I think Scott Crawford's method, using the caret to
escape the percent, is slightly better.

  (CMD's quoting and escaping is incredibly idiosyncratic, so I'm not
really sure.)

-- Ben

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~   ~

---
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


RE: PSEXEC and %homedrive%

2010-11-08 Thread Carl Houseman
Just to underline Scott's point, the entire line is evaluated for the
existence of environment variables which are expanded locally, then the
result is passed to the remote system for execution.

 

How to do what you were attempting to do - specify the variable so it isn't
expanded locally but on the remote system instead.

 

psexec \\SERVERNAME cmd /v:on /c echo !computername!

 

Carl

 

From: Christopher Bodnar [mailto:christopher_bod...@glic.com] 
Sent: Monday, November 08, 2010 6:26 PM
To: NT System Admin Issues
Subject: RE: PSEXEC and %homedrive%

 

Thanks Carl, 

I see what you are saying now. I just don't understand the behavior. I would
think anything after the "SERVERNAME" would be evaluated on the remote
machine, but that doesn't' seem to be the case when specifying a variable. 

thanks 


Chris Bodnar, MCSE
Systems Engineer
Distributed Systems Service Delivery - Intel Services
Guardian Life Insurance Company of America
Email: christopher_bod...@glic.com
Phone: 610-807-6459
Fax: 610-807-6003 



From:"Carl Houseman"  
To:"NT System Admin Issues"  
Date:        11/08/2010 06:10 PM 
Subject:RE: PSEXEC and %homedrive% 

  _  




Do this 
  
psexec   \\SERVERNAME cmd /c set 
  
So what's the difference.  Look again at this very carefully... 
  
psexec \\SERVERNAME cmd.exe /c echo %homedrive% 
  
Hint:  On what computer is %homedrive% expanded ? 
  
Carl 
  
From: Christopher Bodnar [ <mailto:christopher_bod...@glic.com>
mailto:christopher_bod...@glic.com] 
Sent: Monday, November 08, 2010 5:16 PM
To: NT System Admin Issues
Subject: Re: PSEXEC and %homedrive% 
  
I would agree with this, except that when I enumerate that using PSEXEC, I
get the correct value,  so it does seem to be setting it: 

*
** 
H:\Utilities>psexec \\SERVERNAME cmd.exe /c echo %homedrive% 

PsExec v1.94 - Execute processes remotely 
Copyright (C) 2001-2008 Mark Russinovich 
Sysinternals - www.sysinternals.com 


C: 
cmd.exe exited on gbtinvsql2x with error code 0. 
*
** 


Chris Bodnar, MCSE
Systems Engineer
Distributed Systems Service Delivery - Intel Services
Guardian Life Insurance Company of America
Email: christopher_bod...@glic.com
Phone: 610-807-6459
Fax: 610-807-6003 



From:Ben Scott  
To:"NT System Admin Issues"  
Date:11/08/2010 04:15 PM 
Subject:Re: PSEXEC and %homedrive% 

 

  _  





On Mon, Nov 8, 2010 at 1:45 PM, Christopher Bodnar
 wrote:
> I've got a VBS script that we use pretty frequently, and I was trying to
run
> it remotely using PSEXEC against a bunch of systems. Finally narrowed the
> problem down to the fact that for some reason, the %HOMEDRIVE% variable and
> PSEXEC didn't mix well on some systems.

%HOMEDRIVE% is set as part of the user logon process, which, in my
experience, generally doesn't happen for anything except a typical GUI
logon.

(%HOMEDRIVE% and %HOMEPATH% both come from the setting on the
"Profile" tab of an account's properties.)

-- Ben 

 


~ 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

RE: PSEXEC and %homedrive%

2010-11-08 Thread Crawford, Scott
...and by %computername%, I of course mean whatever variable you'd like to 
expand.

From: Crawford, Scott [mailto:crawfo...@evangel.edu]
Sent: Monday, November 08, 2010 5:34 PM
To: NT System Admin Issues
Subject: RE: PSEXEC and %homedrive%

Your entire command line gets parsed on your computer first and then it 
performs the operation.

Assume you're running from a PC named Workstation against a server named Server.

Psexec \\server cmd /c echo %computername%

Gets parsed to

Psexec \\server cmd /c echo Workstation

Which is exactly what the server does.

What you want is

Psexec \\server cmd /c echo ^%computername^%

The carets escape the percents to pass the command echo %computername% to the 
server.

From: Christopher Bodnar [mailto:christopher_bod...@glic.com]
Sent: Monday, November 08, 2010 5:26 PM
To: NT System Admin Issues
Subject: RE: PSEXEC and %homedrive%

Thanks Carl,

I see what you are saying now. I just don't understand the behavior. I would 
think anything after the "SERVERNAME" would be evaluated on the remote machine, 
but that doesn't' seem to be the case when specifying a variable.

thanks


Chris Bodnar, MCSE
Systems Engineer
Distributed Systems Service Delivery - Intel Services
Guardian Life Insurance Company of America
Email: christopher_bod...@glic.com
Phone: 610-807-6459
Fax: 610-807-6003



From:"Carl Houseman" 
To:"NT System Admin Issues" 
Date:        11/08/2010 06:10 PM
Subject:RE: PSEXEC and %homedrive%




Do this

psexec \\SERVERNAME cmd /c set

So what's the difference.  Look again at this very carefully...

psexec \\SERVERNAME cmd.exe /c echo %homedrive%

Hint:  On what computer is %homedrive% expanded ?

Carl

From: Christopher Bodnar [mailto:christopher_bod...@glic.com]
Sent: Monday, November 08, 2010 5:16 PM
To: NT System Admin Issues
Subject: Re: PSEXEC and %homedrive%

I would agree with this, except that when I enumerate that using PSEXEC, I get 
the correct value,  so it does seem to be setting it:

***
H:\Utilities>psexec \\SERVERNAME cmd.exe /c echo %homedrive%

PsExec v1.94 - Execute processes remotely
Copyright (C) 2001-2008 Mark Russinovich
Sysinternals - www.sysinternals.com


C:
cmd.exe exited on gbtinvsql2x with error code 0.
***


Chris Bodnar, MCSE
Systems Engineer
Distributed Systems Service Delivery - Intel Services
Guardian Life Insurance Company of America
Email: christopher_bod...@glic.com
Phone: 610-807-6459
Fax: 610-807-6003



From:Ben Scott 
To:"NT System Admin Issues" 
Date:11/08/2010 04:15 PM
Subject:Re: PSEXEC and %homedrive%






On Mon, Nov 8, 2010 at 1:45 PM, Christopher Bodnar
 wrote:
> I've got a VBS script that we use pretty frequently, and I was trying to run
> it remotely using PSEXEC against a bunch of systems. Finally narrowed the
> problem down to the fact that for some reason, the %HOMEDRIVE% variable and
> PSEXEC didn't mix well on some systems.

%HOMEDRIVE% is set as part of the user logon process, which, in my
experience, generally doesn't happen for anything except a typical GUI
logon.

(%HOMEDRIVE% and %HOMEPATH% both come from the setting on the
"Profile" tab of an account's properties.)

-- Ben



~ 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<mailto: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<mailto: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<mailto: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

RE: PSEXEC and %homedrive%

2010-11-08 Thread Crawford, Scott
Your entire command line gets parsed on your computer first and then it 
performs the operation.

Assume you're running from a PC named Workstation against a server named Server.

Psexec \\server cmd /c echo %computername%

Gets parsed to

Psexec \\server cmd /c echo Workstation

Which is exactly what the server does.

What you want is

Psexec \\server cmd /c echo ^%computername^%

The carets escape the percents to pass the command echo %computername% to the 
server.

From: Christopher Bodnar [mailto:christopher_bod...@glic.com]
Sent: Monday, November 08, 2010 5:26 PM
To: NT System Admin Issues
Subject: RE: PSEXEC and %homedrive%

Thanks Carl,

I see what you are saying now. I just don't understand the behavior. I would 
think anything after the "SERVERNAME" would be evaluated on the remote machine, 
but that doesn't' seem to be the case when specifying a variable.

thanks


Chris Bodnar, MCSE
Systems Engineer
Distributed Systems Service Delivery - Intel Services
Guardian Life Insurance Company of America
Email: christopher_bod...@glic.com
Phone: 610-807-6459
Fax: 610-807-6003



From:"Carl Houseman" 
To:"NT System Admin Issues" 
Date:    11/08/2010 06:10 PM
Subject:RE: PSEXEC and %homedrive%




Do this

psexec \\SERVERNAME cmd /c set

So what's the difference.  Look again at this very carefully...

psexec \\SERVERNAME cmd.exe /c echo %homedrive%

Hint:  On what computer is %homedrive% expanded ?

Carl

From: Christopher Bodnar [mailto:christopher_bod...@glic.com]
Sent: Monday, November 08, 2010 5:16 PM
To: NT System Admin Issues
Subject: Re: PSEXEC and %homedrive%

I would agree with this, except that when I enumerate that using PSEXEC, I get 
the correct value,  so it does seem to be setting it:

***
H:\Utilities>psexec \\SERVERNAME cmd.exe /c echo %homedrive%

PsExec v1.94 - Execute processes remotely
Copyright (C) 2001-2008 Mark Russinovich
Sysinternals - www.sysinternals.com


C:
cmd.exe exited on gbtinvsql2x with error code 0.
***


Chris Bodnar, MCSE
Systems Engineer
Distributed Systems Service Delivery - Intel Services
Guardian Life Insurance Company of America
Email: christopher_bod...@glic.com
Phone: 610-807-6459
Fax: 610-807-6003



From:Ben Scott 
To:"NT System Admin Issues" 
Date:    11/08/2010 04:15 PM
Subject:Re: PSEXEC and %homedrive%






On Mon, Nov 8, 2010 at 1:45 PM, Christopher Bodnar
 wrote:
> I've got a VBS script that we use pretty frequently, and I was trying to run
> it remotely using PSEXEC against a bunch of systems. Finally narrowed the
> problem down to the fact that for some reason, the %HOMEDRIVE% variable and
> PSEXEC didn't mix well on some systems.

%HOMEDRIVE% is set as part of the user logon process, which, in my
experience, generally doesn't happen for anything except a typical GUI
logon.

(%HOMEDRIVE% and %HOMEPATH% both come from the setting on the
"Profile" tab of an account's properties.)

-- Ben



~ 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<mailto: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<mailto: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

RE: PSEXEC and %homedrive%

2010-11-08 Thread Christopher Bodnar
Thanks Carl,

I see what you are saying now. I just don't understand the behavior. I 
would think anything after the "SERVERNAME" would be evaluated on the 
remote machine, but that doesn't' seem to be the case when specifying a 
variable. 

thanks


Chris Bodnar, MCSE
Systems Engineer
Distributed Systems Service Delivery - Intel Services
Guardian Life Insurance Company of America
Email: christopher_bod...@glic.com
Phone: 610-807-6459
Fax: 610-807-6003



From:   "Carl Houseman" 
To: "NT System Admin Issues" 
Date:   11/08/2010 06:10 PM
Subject:RE: PSEXEC and %homedrive%



Do this
 
psexec \\SERVERNAME cmd /c set
 
So what's the difference.  Look again at this very carefully...
 
psexec \\SERVERNAME cmd.exe /c echo %homedrive%
 
Hint:  On what computer is %homedrive% expanded ?
 
Carl
 
From: Christopher Bodnar [mailto:christopher_bod...@glic.com] 
Sent: Monday, November 08, 2010 5:16 PM
To: NT System Admin Issues
Subject: Re: PSEXEC and %homedrive%
 
I would agree with this, except that when I enumerate that using PSEXEC, I 
get the correct value,  so it does seem to be setting it: 

***
 

H:\Utilities>psexec \\SERVERNAME cmd.exe /c echo %homedrive% 

PsExec v1.94 - Execute processes remotely 
Copyright (C) 2001-2008 Mark Russinovich 
Sysinternals - www.sysinternals.com 


C: 
cmd.exe exited on gbtinvsql2x with error code 0. 
***
 



Chris Bodnar, MCSE
Systems Engineer
Distributed Systems Service Delivery - Intel Services
Guardian Life Insurance Company of America
Email: christopher_bod...@glic.com
Phone: 610-807-6459
Fax: 610-807-6003 



From:Ben Scott  
To:"NT System Admin Issues" 
 
Date:    11/08/2010 04:15 PM 
Subject:Re: PSEXEC and %homedrive% 




On Mon, Nov 8, 2010 at 1:45 PM, Christopher Bodnar
 wrote:
> I've got a VBS script that we use pretty frequently, and I was trying to 
run
> it remotely using PSEXEC against a bunch of systems. Finally narrowed 
the
> problem down to the fact that for some reason, the %HOMEDRIVE% variable 
and
> PSEXEC didn't mix well on some systems.

 %HOMEDRIVE% is set as part of the user logon process, which, in my
experience, generally doesn't happen for anything except a typical GUI
logon.

 (%HOMEDRIVE% and %HOMEPATH% both come from the setting on the
"Profile" tab of an account's properties.)

-- Ben
 
~ 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


-
This message, and any attachments to it, may contain information
that is privileged, confidential, and exempt from disclosure under
applicable law.  If the reader of this message is not the intended
recipient, you are notified that any use, dissemination,
distribution, copying, or communication of this message is strictly
prohibited.  If you have received this message in error, please
notify the sender immediately by return e-mail and delete the
message and any attachments.  Thank you.
~ 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

RE: PSEXEC and %homedrive%

2010-11-08 Thread Carl Houseman
Do this

 

psexec \\SERVERNAME   cmd /c set

 

So what's the difference.  Look again at this very carefully...

 

psexec \\SERVERNAME cmd.exe /c echo %homedrive%

 

Hint:  On what computer is %homedrive% expanded ?

 

Carl

 

From: Christopher Bodnar [mailto:christopher_bod...@glic.com] 
Sent: Monday, November 08, 2010 5:16 PM
To: NT System Admin Issues
Subject: Re: PSEXEC and %homedrive%

 

I would agree with this, except that when I enumerate that using PSEXEC, I
get the correct value,  so it does seem to be setting it: 

*
** 
H:\Utilities>psexec \\SERVERNAME cmd.exe /c echo %homedrive% 

PsExec v1.94 - Execute processes remotely 
Copyright (C) 2001-2008 Mark Russinovich 
Sysinternals - www.sysinternals.com 


C: 
cmd.exe exited on gbtinvsql2x with error code 0. 
*
** 


Chris Bodnar, MCSE
Systems Engineer
Distributed Systems Service Delivery - Intel Services
Guardian Life Insurance Company of America
Email: christopher_bod...@glic.com
Phone: 610-807-6459
Fax: 610-807-6003 



From:Ben Scott  
To:"NT System Admin Issues"  
Date:11/08/2010 04:15 PM 
Subject:        Re: PSEXEC and %homedrive% 

  _  




On Mon, Nov 8, 2010 at 1:45 PM, Christopher Bodnar
 wrote:
> I've got a VBS script that we use pretty frequently, and I was trying to
run
> it remotely using PSEXEC against a bunch of systems. Finally narrowed the
> problem down to the fact that for some reason, the %HOMEDRIVE% variable and
> PSEXEC didn't mix well on some systems.

 %HOMEDRIVE% is set as part of the user logon process, which, in my
experience, generally doesn't happen for anything except a typical GUI
logon.

 (%HOMEDRIVE% and %HOMEPATH% both come from the setting on the
"Profile" tab of an account's properties.)

-- Ben

 


~ 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

Re: PSEXEC and %homedrive%

2010-11-08 Thread Christopher Bodnar
I would agree with this, except that when I enumerate that using PSEXEC, I 
get the correct value,  so it does seem to be setting it:

***
H:\Utilities>psexec \\SERVERNAME cmd.exe /c echo %homedrive%

PsExec v1.94 - Execute processes remotely
Copyright (C) 2001-2008 Mark Russinovich
Sysinternals - www.sysinternals.com


C:
cmd.exe exited on gbtinvsql2x with error code 0.
***


Chris Bodnar, MCSE
Systems Engineer
Distributed Systems Service Delivery - Intel Services
Guardian Life Insurance Company of America
Email: christopher_bod...@glic.com
Phone: 610-807-6459
Fax: 610-807-6003



From:   Ben Scott 
To: "NT System Admin Issues" 
Date:   11/08/2010 04:15 PM
Subject:    Re: PSEXEC and %homedrive%



On Mon, Nov 8, 2010 at 1:45 PM, Christopher Bodnar
 wrote:
> I've got a VBS script that we use pretty frequently, and I was trying to 
run
> it remotely using PSEXEC against a bunch of systems. Finally narrowed 
the
> problem down to the fact that for some reason, the %HOMEDRIVE% variable 
and
> PSEXEC didn't mix well on some systems.

  %HOMEDRIVE% is set as part of the user logon process, which, in my
experience, generally doesn't happen for anything except a typical GUI
logon.

  (%HOMEDRIVE% and %HOMEPATH% both come from the setting on the
"Profile" tab of an account's properties.)

-- Ben

~ 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



-
This message, and any attachments to it, may contain information
that is privileged, confidential, and exempt from disclosure under
applicable law.  If the reader of this message is not the intended
recipient, you are notified that any use, dissemination,
distribution, copying, or communication of this message is strictly
prohibited.  If you have received this message in error, please
notify the sender immediately by return e-mail and delete the
message and any attachments.  Thank you.
~ 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

Re: PSEXEC and %homedrive%

2010-11-08 Thread Ben Scott
On Mon, Nov 8, 2010 at 1:45 PM, Christopher Bodnar
 wrote:
> I've got a VBS script that we use pretty frequently, and I was trying to run
> it remotely using PSEXEC against a bunch of systems. Finally narrowed the
> problem down to the fact that for some reason, the %HOMEDRIVE% variable and
> PSEXEC didn't mix well on some systems.

  %HOMEDRIVE% is set as part of the user logon process, which, in my
experience, generally doesn't happen for anything except a typical GUI
logon.

  (%HOMEDRIVE% and %HOMEPATH% both come from the setting on the
"Profile" tab of an account's properties.)

-- Ben

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~   ~

---
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


Re: PSEXEC and %homedrive%

2010-11-08 Thread Andrew S. Baker
If you are using PSEXEC remotely, then it is running on the remote system in
a local system context, unless you specified the credentials it was to use.

That can be a problem if you're not limiting your actions on the remote end
to generic system activities.


*ASB *(My XeeSM Profile) 
*Exploiting Technology for Business Advantage...*
* *



On Mon, Nov 8, 2010 at 1:45 PM, Christopher Bodnar <
christopher_bod...@glic.com> wrote:

> Wondering if anyone else has run into this before.
>
> I've got a VBS script that we use pretty frequently, and I was trying to
> run it remotely using PSEXEC against a bunch of systems. Finally narrowed
> the problem down to the fact that for some reason, the %HOMEDRIVE% variable
> and PSEXEC didn't mix well on some systems. Not all. And if run locally, it
> worked perfectly. I also enumerated the variable through PSEXEC remotely
> without any issues, which surprised me.  I was able to change the variable
> to %SYSTEMROOT%. which solved the issue, but was wondering what the
> underlying problem was.
>
> Very odd.
>
>
> Thanks
>
>
> Chris Bodnar, MCSE
> Systems Engineer
>

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~   ~

---
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