Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


check local provider group membership issue

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> check local provider group membership issue
  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 >>
 check local provider group membership issue - 11/1/2005 9:21:08 AM   
  faulkkev

 

Posts: 151
Score: 0
Joined: 11/1/2005
Status: offline
It doesn't want to bind and I'm playing with inputboxes.  Here is the code for review if anyone can catch the error.

strFilePath = "c:\test.txt"
errorlog = "c:\error.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objtextFile = objFSO.OpenTextFile (strFilePath)
Set objFile = objFSO.CreateTextFile(errorlog, True)
' On Error Resume Next
objgroup = inputbox("Type group here")
objuser = inputbox("type local user here")
Do Until objtextFile.AtEndOfStream
set grp = GetObject("WinNT://" & strcomputer & "/" & objgroup & ",group")
set usr = GetObject("WinNT://" & strcomputer & "/" & objuser & ",user")
strComputer = Trim(objtextFile.ReadLine)
      if len(strComputer) <> 0 then
If grp.IsMember(usr.name) Then
      objFile.Writeline now & " user " & objuser & " is member of " & objgroup & " on " & strComputer
    Else
     objFile.Writeline now & " user " & objuser & " isn't member of " & objgroup & " on " & strComputer               
End If
      
     
err.clear

      end if
 
loop


objFile.Close
objTextFile.close
result = objfso.OpenTextFile(errorlog, 1).ReadAll
wscript.echo result

< Message edited by faulkkev -- 11/1/2005 9:26:37 AM >
 
 
Post #: 1
 
 RE: check local provider group membership issue - 11/2/2005 4:17:55 AM   
  marcusrp

 

Posts: 145
Score: 0
Joined: 4/19/2005
From:
Status: offline
youre trying to pass a variable to the opentextfile method, which can only parse literal strings. the error message you get is telling you it cant find a file of pathname "strFilePath" to use your first file as an example. get rid of the variables you are using to represent your pathnames, and just type the path/filename directly.

(in reply to faulkkev)
 
 
Post #: 2
 
 RE: check local provider group membership issue - 11/2/2005 4:27:21 AM   
  marcusrp

 

Posts: 145
Score: 0
Joined: 4/19/2005
From:
Status: offline
my apologies, I may have spoke too soon...I would try what I suggested, but that may not be your problem...why dont you respond with what error message you get, so we know if were on the same page...

(in reply to faulkkev)
 
 
Post #: 3
 
 RE: check local provider group membership issue - 11/2/2005 4:41:57 AM   
  Snipah


Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
quote:

Do Until objtextFile.AtEndOfStream
set grp = GetObject("WinNT://" & strcomputer & "/" & objgroup & ",group")
set usr = GetObject("WinNT://" & strcomputer & "/" & objuser & ",user")
strComputer = Trim(objtextFile.ReadLine)
if len(strComputer) <> 0 then


instead of the above, try:

strComputer = Trim(objtextFile.ReadLine)
     if len(strComputer) <> 0 then

Do Until objtextFile.AtEndOfStream
set grp = GetObject("WinNT://" & strcomputer & "/" & objgroup & ",group")
set usr = GetObject("WinNT://" & strcomputer & "/" & objuser & ",user")

_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to faulkkev)
 
 
Post #: 4
 
 RE: check local provider group membership issue - 11/2/2005 7:56:33 AM   
  faulkkev

 

Posts: 151
Score: 0
Joined: 11/1/2005
Status: offline
The error I get with the code as it stands is line 15 char1 error 0x80005000 source null.  I don't understand what it is doing.  I tried it with the modifications suggested as well and get a line 29 char 3 error expected statement code 800a400.  Very weird I have scratched my head on this for awhile.

(in reply to faulkkev)
 
 
Post #: 5
 
 RE: check local provider group membership issue - 11/3/2005 6:56:34 AM   
  marcusrp

 

Posts: 145
Score: 0
Joined: 4/19/2005
From:
Status: offline
yeouch. I need more coffee before I try to help people...If this is your complete script, I would have to ask, what value is being assigned to 'strcomputer'? to see what I'm talking about insert 'wscript.echo strcomputer' before your 'getobject' line...if you run it and the popup is blank, that means strcomputer is a 'null' value and thus the error...you would need to retrieve the computer name and assign it to 'strcomputer'. If its just a snippet, you need to post your full script.

(in reply to faulkkev)
 
 
Post #: 6
 
 
 
  

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 >> check local provider group membership issue 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