Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


objFSO with Alternate Credentials ?

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,38300
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> objFSO with Alternate Credentials ?
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 objFSO with Alternate Credentials ? - 10/2/2006 9:59:43 PM   
  takeda kozo

 

Posts: 83
Score: 0
Joined: 11/9/2005
Status: offline
Hi Guys, the following script working fine on remote PC's .....If I run the script within a CMD window that was opened using RUN AS (domain admin account)

If I just run the script from a normal CMD window, then it won't read the remote file versions

Does anyone know how to run the FSO (FileSystemObject) with alternate credentials ? (I know how to run WMI and check a remote registry with alternate credentials, but this has me stumped) :(

'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Machine = "REMOTEPC"
Set oFSO = CreateObject("Scripting.FileSystemObject")
FileVer = oFSO.GetFileVersion("\\" & Machine & "\c$\Program Files\Microsoft Office\Office10\Excel.exe")
Wscript.Echo FileVer

'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
 
Post #: 1
 
 RE: objFSO with Alternate Credentials ? - 10/2/2006 11:10:39 PM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
I don't believe that you can instantiate a FileSystemObject with alternate credentials. You can however use WMI with alternate credentials to get file versions.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to takeda kozo)
 
 
Post #: 2
 
 RE: objFSO with Alternate Credentials ? - 10/3/2006 12:01:30 AM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
how about this (oops: note the change to office 11 as I was testing this against  office2003)

Machine = "remotePC"
Set oFSO = CreateObject("Scripting.FileSystemObject")
FileVer = oFSO.GetFileVersion("\\" & Machine & "\\c$\\Program Files\\Microsoft Office\\Office11\\Excel.exe")
Wscript.Echo FileVer

< Message edited by gdewrance -- 10/3/2006 12:10:12 AM >

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: objFSO with Alternate Credentials ? - 10/3/2006 11:21:55 PM   
  mbouchard


Posts: 1924
Score: 16
Joined: 5/15/2003
From: USA
Status: offline
You can always use Psexec from Sysinternals (now Microsoft)
Something like this
WshShell.Run "Psexec wscript c:\path\to\script.vbs domain/user password"

Just read the help file and you will get the exact syntax.

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.

(in reply to gdewrance)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> objFSO with Alternate Credentials ? Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts