Jump to content

ajaymjoshi

Member
  • Posts

    1
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United States

About ajaymjoshi

ajaymjoshi's Achievements

0

Reputation

  1. I would like to only add the user who is currently logging on, to the local administrators group. The user is only identified during the user logon phase of startup scripts not during the computer startup phase. Multiple users logon to the same PC at all times. e.g. in a Firestation. Only that particular user should be in the local administrators group.(in addition to Domain Admins) My biggest problem is not knowing the username if you use what Cluberti is recommending. ' // Configure to add a domain user to the Local Administrators Group strUser = "useraccounthere" The following script running during the user logon fails as the user does not have the permission to add him/herself to the local admin group. ========================= blnUserinAdmGroup = False Set objNetwork = CreateObject("Wscript.Network") strComputer = objNetwork.ComputerName strUser = objNetwork.UserName Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators") For Each objUser in objGroup.Members If objUser.Name = "Domain Users" Then objGroup.Remove "WinNT://LAB/Domain Users" If objUser.Name = strUser Then blnUserinAdmGroup = True Next If NOT (blnUserinAdmGroup) Then objGroup.Add "WinNT://LAB/" & strUser
×
×
  • Create New...