Problems creating group for Group member in VBscript

Author Message
spectrum1

  • Total Posts : 7
  • Scores: 0
  • Reward points : 0
  • Joined: 12/5/2011
  • Status: offline
Problems creating group for Group member in VBscript Tuesday, December 06, 2011 10:13 AM (permalink)
0
Thanks to all for your help so far. I'm still having issues, I can't copy files to this path "%appdata%\Hewlett-Packard\HP\C1\Configuration\" because the location doesn't exist on client machines. Using filesys.CopyFile it doesn't create the directory on each client. What would I need to do to create this path for filesys.CopyFile to work for users who are members of "MANAGERS" or have C:\Program Files\Hewlett-Packard\HP\network.exe exist. Here's the script:
 
dim filesys
Set WSHNetwork = CreateObject("WScript.Network")
Set WshShell = WScript.CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")
strfolderpath = objShell.ExpandEnvironmentStrings("%appdata%\Hewlett-Packard\HP\C1\Configuration\")
Set UserObj = GetObject("WinNT://" & WSHNetwork.UserDomain & "/" & WSHNetwork.UserName)
isManager = False
For Each GroupObj In UserObj.Groups
 If UCase(GroupObj.Name) = "MANAGERS" Then isManager = True
Next
If isManager Then
 set filesys=CreateObject("Scripting.FileSystemObject")
 If filesys.FileExists("C:\Program Files\Hewlett-Packard\HP\network.exe") Then
 filesys.CopyFile "V:\C1\Configuration\*", strfolderpath
 WshShell.Run "regedit /S X:\update.reg", 0, True
 End If
Else
 WshShell.Run "regedit /S X:\remove.reg", 0, True
End If
 
 
 
#1
    59cobalt

    • Total Posts : 979
    • Scores: 91
    • Reward points : 0
    • Joined: 7/17/2011
    • Status: offline
    Re:Problems creating group for Group member in VBscript Tuesday, December 06, 2011 11:22 AM (permalink)
    0
    I just recently posted an example for a function to create a folder including missing parent folders.
     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • 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
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9