Monday, September 06, 2010
   
Text Size

Search

hits.

purpleender

Rep

Gamerscore33992

ZoneUnderground

Technical Log

XP - Add PC to Domain 2

 MyTest = (chr(34) & "c:\winnt\system32\netdom.exe" & chr(34) & " " & "JOIN" & " " & lcase(compn) & " " & "/d:" & chr(34) & "ah.andrew-henderson.me.uk" & chr(34) & " " & "/OU:" & chr(34) & "OU=" & lcase(varOU) & chr(34) & ",OU=" & varDirectorate & ",DC=ANDREW-HENDERSON,DC=ME,DC=UK" & " " & "/UD:AH\" & lcase(varuserid) & " " & "/PD:" & lcase(varPassword) & " " & chr(62) & " c:\build.txt")

 Set OFILES = FSO.OPENTEXTFILE ("c:\update.bat",2,True)
  OFILES.WRITE (MyTest)
 OFILES.Close

 WshShell.Run ("c:\update.bat"),, True

 On Error Resume Next
 Set OFILES = FSO.OPENTEXTFILE ("c:\build.txt", 1, True)
  ReadLineTextFile1 = OFiles.Readline
  OFILES.SkipLine
  ReadLineTextFile2 = OFiles.ReadLine

 ReadLine1 = Left(ReadLineTextFile1, 27)

 If FSO.FileExists ("c:\update.bat") Then
  WshShell.Run (kAttrib & " " & chr(34) & "C:\update.bat" & chr(34) & " " & "-r" & " " & "-a" & " " & "-s" & " " & "-h"),, True
  FSO.DeleteFolder ("C:\update.bat"), True
 Else
 End If

 If lcase(ReadLine1) = lcase("the command completed succe") Then
  MSGBOX ("The PC Has Been Successfully Added to The Domain")
  Added_Dom = "Yes"
 Else
 End If

 If lcase(ReadLine1) = lcase("the parameter is incorrect.") Then
  MSGBOX ("There was a problem, incorrect parameters have been processed.  Please re-run the script and Check you ID and Password are correct.")
  Added_Dom = "No"
 Else
 End If

 If lcase(ReadLine1) = lcase("this machine is already joi") Then
  MSGBOX ("This Machine is Already a Member of the Domain, please remove From the Domain and re-run this script")
  Added_Dom = "No"
 Else
 End If

 If lcase(ReadLine1) = lcase("the account already exists.") Then
  MSGBOX ("An Account For This Machine already exists in the Domain, Please Remove the Account and re-run this script.")
  Added_Dom = "No"
 Else
 End If

 If lcase(ReadLine1) = lcase("logon failure: unknown user") Then
  MSGBOX ("You have entered an Invalid User Name or Password")
  Added_Dom = "No"
 Else
 End If

 If Lcase(ReadLine1) = lcase("The Referenced account is c") Then
  MSGBOX ("The Referenced Account used is currently Locked Out, Please Unlock the Account.")
  Added_Dom = "No"
 Else
 End If

 

VB - Get IP Address

IP_Address = GetIP()

Function GetIP()
   Dim ws : Set ws = CreateObject("WScript.Shell")
 Dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
 Dim TmpFile : TmpFile = fso.GetSpecialFolder(2) & "/ip.txt"
   Dim ThisLine, IP
   If ws.Environment("SYSTEM")("OS") = "" Then
  ws.run "winipcfg /batch " & TmpFile, 0, True
 Else
  ws.run "%comspec% /c ipconfig > " & TmpFile, 0, True
 End If
 With fso.GetFile(TmpFile).OpenAsTextStream
 Do While NOT .AtEndOfStream
  ThisLine = .ReadLine
  If InStr(ThisLine, "Address") 0 Then IP = Mid(ThisLine, InStr(ThisLine, ":") + 2)
 Loop
 .Close
 End With
 'WinXP (NT? 2K?) leaves a carriage return at the end of line
 If IP "" Then
  If Asc(Right(IP, 1)) = 13 Then IP = Left(IP, Len(IP) - 1)
 End If
 GetIP = IP
 fso.GetFile(TmpFile).Delete 
 Set fso = Nothing
 Set ws = Nothing
End Function

 

XP - Add domain group to a local group

 WshShell.Run ("c:\winnt\system32\net.exe" & " " & "localgroup" & " " & chr(34) & "Remote Control Operators" & chr(34) & " " & "/add"),, True
 WshShell.Run ("c:\winnt\system32\net.exe" & " " & "localgroup" & " " & chr(34) & "Remote Control Operators" & chr(34) & " " & Chr(34) & "Mydomain\Domain Group" & chr(34) & " " & "/add"),, True
   

XP - Set Auto-Logon Count

 WshShell.RegWrite "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoLogonCount", 1 , "REG_DWORD"
 

XP - Add Legal Notice to login screen

WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\LegalNoticeCaption", "andrew-henderson.me.uk - Important Message" , "REG_SZ"
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\LegalNoticeText", "This is the security message" , "REG_SZ"
   

Page 5 of 12