Home > Articles > Operating Systems, Server > Microsoft Servers

  • Print
  • + Share This
Like this article? We recommend

As you probably noticed, in the preceding section you were typing references to Visual Basic scripts on drive C:. Before anything will work, you need to add these scripts to the C: drive of every domain controller from which you want to add or modify the new employee attributes.

Start by placing the ssn.vbs, employee-number.vbs, and employee-ID.vbs scripts on your C: drive. (The scripts are shown in Listings 1–3, but you may prefer to download them with this source file.)

Listing 1 ssn.vbs

Dim oSSN
Dim oUser1
Dim temp1
Set oSSN = Wscript.Arguments
Set oUser1 = GetObject(oSSN(0))
temp1 = InputBox("Social Security Number: " & oUser1.SSN & vbCRLF
    & vbCRLF & "If you would like enter a new number or
    modify the existing number, enter the new number in
    the textbox below")
if temp1 <> "" then oUser1.Put "SSN",temp1
oUser1.SetInfo
Set oUser1 = Nothing
Set oSSN = Nothing
Set temp1 = Nothing
WScript.Quit

Listing 2 employee-ID.vbs

Dim oemployeeID
Dim oUser3
Dim temp3
Set oemployeeID = Wscript.Arguments
Set oUser3 = GetObject(oemployeeID(0))
temp3 = InputBox("Employee-ID: " & oUser3.employeeID & vbCRLF
    & vbCRLF & "If you would like enter a new number
    or modify the existing number, enter the new number
    in the textbox below")
if temp3 <> "" then oUser3.Put "employeeID",temp3
oUser3.SetInfo
Set oUser3 = Nothing
Set oemployeeID = Nothing
Set temp3 = Nothing
WScript.Quit

Listing 3 employee-Number.vbs

Dim oemployeeNumber
Dim oUser2
Dim temp2
Set oemployeeNumber = Wscript.Arguments
Set oUser2 = GetObject(oemployeeNumber(0))
temp2 = InputBox("Employee-Number: " & oUser2.employeeNumber
    & vbCRLF & vbCRLF & "If you would like enter a
    new number or modify the existing number, enter
    the new number in the textbox below")
if temp2 <> "" then oUser2.Put "employeeNumber",temp2
oUser2.SetInfo
Set oUser2 = Nothing
Set oemployeeNumber = Nothing
Set temp2 = Nothing
WScript.Quit
  • + Share This
  • 🔖 Save To Your Account