Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Remote script

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Remote script
  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 >>
 Remote script - 5/3/2005 8:30:51 AM   
  robszar


Posts: 182
Score: 0
Joined: 2/27/2005
From:
Status: offline
I am having a problem running a script on a remote computer, I keep getting access denied on the line in red.

      
 
 
Post #: 1
 
 Re: Remote script - 5/3/2005 8:44:16 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
"I am having a problem running a script on a remote computer..." May I assume that the script you posted are executed using the wshController object to execute a script remotely on another machine than the local machine ? Also, what is the exact error message and what value does the varible named "strComputer" contain ?

(in reply to robszar)
 
 
Post #: 2
 
 Re: Remote script - 5/3/2005 8:50:45 AM   
  robszar


Posts: 182
Score: 0
Joined: 2/27/2005
From:
Status: offline
here is the complete script, sorry bout that.


      
it is a WSH error, access denied

(in reply to robszar)
 
 
Post #: 3
 
 Re: Remote script - 5/3/2005 8:54:26 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
I can only assume that the userID and password isn't correct for the remote machine. Did you test this script against your local machine ? If so, enter a remote computername as WEBMLocator object doesn't allow you to connect to local machine using alternate credential.

(in reply to robszar)
 
 
Post #: 4
 
 Re: Remote script - 5/3/2005 9:51:31 AM   
  robszar


Posts: 182
Score: 0
Joined: 2/27/2005
From:
Status: offline
here is a script from scriptOmatic, I keep getting permission denied when trying to run it on remote computers?? my domain account has local admin rights on all boxes, I even logged in as the local admin??

      

(in reply to robszar)
 
 
Post #: 5
 
 Re: Remote script - 5/3/2005 11:55:59 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
WMI has its own ACL, though by default it allows Everyone:R and local admin:F/C. What happens if you run the following code with an account that has admin rights on the local machine ?

Set wmi = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = wmi.ExecQuery("SELECT * FROM Win32_USBControllerDevice")

For Each objItem In colItems
WScript.Echo "AccessState: " & objItem.AccessState
WScript.Echo "Antecedent: " & objItem.Antecedent
WScript.Echo "Dependent: " & objItem.Dependent
WScript.Echo "NegotiatedDataWidth: " & objItem.NegotiatedDataWidth
Next

(in reply to robszar)
 
 
Post #: 6
 
 Re: Remote script - 5/3/2005 11:16:44 PM   
  drbelden

 

Posts: 109
Score: 0
Joined: 12/21/2004
From: USA
Status: offline
It looks like you are getting input to a variable called "computer" and trying to pass one called "strComputer". In the code you posted "strComputer" wouldn't have a value.

(in reply to robszar)
 
 
Post #: 7
 
 Re: Remote script - 5/4/2005 1:55:59 AM   
  robszar


Posts: 182
Score: 0
Joined: 2/27/2005
From:
Status: offline
Token,

That runs fine, I don't know why I can't run anything on remote computers?

(in reply to robszar)
 
 
Post #: 8
 
 Re: Remote script - 5/4/2005 1:57:51 AM   
  crazymatt

 

Posts: 296
Score: 0
Joined: 3/4/2005
From:
Status: offline
As drbelden said, did u try changing the strComputer string?

shouldnt it look like this?
------------------------------
strComputer= InputBox("Enter the Computer Name" &_
VbCrLf & VbCrLf &_
"Please be sure to enter the Computer name accurately," &_
" or an error will occur.", strComputer)
------------------------------

(in reply to robszar)
 
 
Post #: 9
 
 Re: Remote script - 5/4/2005 2:05:44 AM   
  crazymatt

 

Posts: 296
Score: 0
Joined: 3/4/2005
From:
Status: offline
Try if this might work better...

Edit: hmm, well after thinking a lil more i doubt my changes will work either.. hope some of the others have some better ideas!
Sorry if i confused you

-----------------------------------------
Const WbemAuthenticationLevelPktPrivacy = 6

strComputer= InputBox("Enter the Computer Name" &_
VbCrLf & VbCrLf &_
"Please be sure to enter the Computer name accurately," &_
" or an error will occur.", strComputer)
strUser = "user"
strPassword = "password"
Set WshShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objwbemLocator.ConnectServer _
(strComputer, "root\cimv2", strUser, strPassword)
objWMIService.Security_.authenticationLevel = WbemAuthenticationLevelPktPrivacy


Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem")

For Each objItem In colItems
compName = objItem.Name
UserName = objItem.UserName
logline("Computer Name: " & compName)
logline("User Name: " & UserName)
Next

Set colItems = objWMIService.ExecQuery ("Select * from Win32_PhysicalMemoryArray")

For Each objItem in colItems
logline("Maximum Capacity: " & objItem.MaxCapacity)
Next

Function LogLine(strLogString)

Set FnObjFSO = CreateObject("Scripting.FileSystemObject")
Set FnObjLogFile = FnobjFSO.OpenTextFile("c:\memory.log",8,True)

FnObjLogFile.WriteLine(Date & vbTab & Time & vbTab & strLogString)
FnObjLogFile.Close

End Function
--------------

Hope it works, but im just a newbee myself ;)

/CM

(in reply to robszar)
 
 
Post #: 10
 
 Re: Remote script - 5/4/2005 2:31:48 AM   
  robszar


Posts: 182
Score: 0
Joined: 2/27/2005
From:
Status: offline
That is just the name of the input box, but thanks anyway

(in reply to robszar)
 
 
Post #: 11
 
 Re: Remote script - 5/4/2005 8:16:57 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
quote:
Originally posted by robszar

Token,

That runs fine, I don't know why I can't run anything on remote computers?



and what happens when you run the following script and replace host with a REMOTE computer that you SURE you have admin rights on it.

host = "computer"

Set wmi = GetObject("winmgmts:\\" & host & "\root\cimv2")
Set colItems = wmi.ExecQuery("SELECT * FROM Win32_USBControllerDevice")

For Each objItem In colItems
WScript.Echo "AccessState: " & objItem.AccessState
WScript.Echo "Antecedent: " & objItem.Antecedent
WScript.Echo "Dependent: " & objItem.Dependent
WScript.Echo "NegotiatedDataWidth: " & objItem.NegotiatedDataWidth
Next

(in reply to robszar)
 
 
Post #: 12
 
 Re: Remote script - 5/6/2005 5:13:33 AM   
  robszar


Posts: 182
Score: 0
Joined: 2/27/2005
From:
Status: offline
permission denied "getobject"

my domain account has admin rights on all machines. I can be connected to a users c$ and still, permission denied?

(in reply to robszar)
 
 
Post #: 13
 
 Re: Remote script - 5/6/2005 7:17:26 AM   
  bradu

 

Posts: 10
Score: 0
Joined: 4/30/2005
From:
Status: offline
Is the Remote Registry Service started? As far as I recall I had a similar problem with some machines since a Remote X service was stopped so I couldn't connect to them. You may want to check that by using 'Connect to another computer' option from Computer Management. Also if you use a windows domain try using admin@domain instead of just admin. If it's Windows XP SP2 have a workaround with the firewall

(in reply to robszar)
 
 
Post #: 14
 
 Re: Remote script - 5/6/2005 1:51:18 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
WMI has its own ACL, though by default it allows Everyone:R and local admin:F/C. Perhaps you can use a domain admin account to test the script.

(in reply to robszar)
 
 
Post #: 15
 
 Re: Remote script - 5/9/2005 3:06:29 AM   
  robszar


Posts: 182
Score: 0
Joined: 2/27/2005
From:
Status: offline
I figured it out! our security group disables DCOM. can't run RPC, I enabled it on 1 computer and I was able to run the script.
anyway, thanks for the help.

(in reply to robszar)
 
 
Post #: 16
 
 Re: Remote script - 5/9/2005 4:16:33 AM   
  kirrilian


Posts: 628
Score: 3
Joined: 3/15/2005
From:
Status: offline
quote:
Originally posted by robszar

I figured it out! our security group disables DCOM. can't run RPC, I enabled it on 1 computer and I was able to run the script.
anyway, thanks for the help.



i wouldnt have thought of that one, good show!

(in reply to robszar)
 
 
Post #: 17
 
 Re: Remote script - 5/9/2005 12:47:35 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
heh.. so much for debugging the scripts eh ? :P

(in reply to robszar)
 
 
Post #: 18
 
 
 
  

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