Hi guys,

Below I have my login script that calls the kix script and runs, the admin password change isn't working (assuming I've done something wrong) can someone point me in the right direction?

 Code:
======================
Logon Batch File
======================

@Echo Off

Cls
ECHO Verifying / Updating /  Copying Script Software Installation, Please Wait...

Del c:\windows\system32\logon.kix
Del c:\windows\system32\kix32.exe
Net use m: \\2csdc01\netlogon

xcopy m:\kix32.exe c:\windows\system32 /D /H /I /R /V
xcopy m:\logon.kix c:\windows\system32 /D /H /I /R /V

Net use m: /delete

ECHO Loading Logon Script, Please Wait...
c:\windows\SYSTEM32\KIX32.EXE c:\windows\system32\logon.KIX


 Code:
 ===================================
Kix logon script
===================================

; ===========================================================================================
;
; 	Script Information
;	
;	Title: Map Drives
;	Author: Alex Wilden					
;	Description: Map login drives depending on group membership			
;	
;
; ===========================================================================================
;=============================================
;Map Network Drives
;=============================================

If InGroup("kixtart_test")
	Use Z: "\\2CSDC01\Netlogon"
;=============================================
;Set Local Admin Password
;=============================================

$sNewPassword = "password123!"
$sAdminName = GetAdministratorName
$oUser = GetObject("WinNT://" + @WKSTA + "/" + $sAdminName + ",user")
$oUser.SetPassword($sNewPassword)
$oUser.SetInfo

Function GetAdministratorName()
	Dim $sUserSID, $oWshNetwork, $oUserAccount
	$oWshNetwork = CreateObject("WScript.Network")
	$oUserAccounts = GetObject("winmgmts://" + $oWshNetwork.ComputerName + "/root/cimv2").ExecQuery("Select Name, SID from Win32_UserAccount" + " WHERE Domain = '" + $oWshNetwork.ComputerName + "'")
	For Each $oUserAccount in $oUserAccounts
		If Left($oUserAccount.SID, 9) = "S-1-5-21-" And Right($oUserAccount.SID, 4) = "-500"
			$GetAdministratorName = $oUserAccount.Name
		EndIf
	Next
EndFunction
ption explicit
Dim objNetwork, strComputer
Dim strPassword, strAdminUserName, strNewAdminUserName

Set objNetwork = CreateObject("Wscript.Network")
strComputer = UCase(objNetwork.ComputerName)

' The old name of the administrator user account (normally administrator)
strAdminUserName = "Administrator"
' The new name of the administrator user account
strNewAdminUserName = "NormalUser"
' Password includes computername to have a unique password on all computers.
strPassword = "PrefixSTDP@$$w0rd" & strComputer

' Rename admin user account
renameUser strComputer, strAdminUserName, strNewAdminUserName
' Set password of admin user account
setPWD strComputer, strNewAdminUserName, strPassword

' Reset password for a local user account on a given computer
sub setPWD(strComputer, strUser, strPassword)

Dim objUser
' Ignore error if user account isn' t found Or error changing Password
on error resume Next 
Set objUser = GetObject("WinNT://" & strComputer & "/" & strUser & ",user")
If err.number = 0 then
	objUser.SetPassword strPassword
	objUser.SetInfo
	end If
	on error Goto 0
	
	end sub


Edited by 2Cs (2010-02-11 12:53 PM)