Question: Removing laptop system password via script
I am trying to create a VBScript that when it runs would remove the system (Power-on) password on our companies laptops without any interaction from the user.
CCTK (Dell Configuration Tool Kit) has been installed on each of the laptops and I have created the below code so far.
------------------------------------------------------------------------------
DIM WshShell
Set WshShell = CreateObject("Wscript.Shell")
Set WshNetwork = CreateObject("Wscript.Network")
strComputer = WshNetwork.ComputerName
password=strComputer
password=Replace(password,"Value1","Value2")
DIM aParm(2)
sCmd="C:\Program Files\Dell\CCTK\X86\cctk.exe"
aParm(1)="--syspwd= --valsyspws="
aParm(2)=password
wscript.echo sCmd & Join(aParm)
------------------------------------------------------------------------------
I am needing it to run the following command 'C:\Program Files\Dell\CCTK\X86\cctk.exe --syspwd= --valsyspws=<PASSWORD>
The script above, when I output to messagebox has a space before the <PASSWORD> value so the whole aParm section might not be any use.
Can anyone recommend the line, or two, needed to get this VBScript working?
Cheers
Answers (1)
I had to copy the 'cctk.exe' file and 'mxml1.dll' to the System32 folder but I managed to get it working with the code below: ------------------------------------------------------------------ DIM WshShell Set WshShell = CreateObject("Wscript.Shell") Set WshNetwork = CreateObject("Wscript.Network") strComputer = WshNetwork.ComputerName password=strComputer password=Replace(password,"Value1","Value2") Set oShell = WScript.CreateObject( "Wscript.Shell" ) sSystemRoot = oshell.expandenvironmentStrings("%SYSTEMROOT%") SVar = "--syspwd= --valsyspwd=" sPermissionCommand = sSystemRoot & "\System32\cctk.exe " & svar & password wscript.echo sPermissionCommand oShell.Run sPermissionCommand ------------------------------------------------------------------
Okay I have managed to resolve this eventually. I had to copy the 'cctk.exe' file and 'mxml1.dll' to the System32 folder but I managed to get it working with the code below:
------------------------------------------------------------------
DIM WshShell
Set WshShell = CreateObject("Wscript.Shell")
Set WshNetwork = CreateObject("Wscript.Network")
strComputer = WshNetwork.ComputerName
password=strComputer
password=Replace(password,"Value1","Value2")
Set oShell = WScript.CreateObject( "Wscript.Shell" )
sSystemRoot = oshell.expandenvironmentStrings("%SYSTEMROOT%")
SVar = "--syspwd= --valsyspwd="
sPermissionCommand = sSystemRoot & "\System32\cctk.exe " & svar & password
wscript.echo sPermissionCommand
oShell.Run sPermissionCommand
------------------------------------------------------------------
Im sure someone with more knowledge of VBScript than me (can't be hard) will have a look at this butchers script and want to make it look prettier but if it helps someone else then thats cool with me.