Unsolved
This post is more than 5 years old
4 Posts
0
31315
December 4th, 2012 07:00
Removing System (Power-On) Password via VBScript
I am trying to create a VBscript that once run will go through the following process:-
- Get Computer Name
- Modify Computer Name to match unique password on laptop
- Run command using CCTK to remove password on laptop.
I have got so far as writing the script to get the value, replace the parts needed and can output the result so I know that works. The problem I am having is just getting the Script to then run the command that removes the password without user interaction.
CCTK isnt install on the laptops yet, was hoping to put it all into the one package.
Here is my 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")
I have tried several different methods on trying to run the following command:-
cctk.exe --syspwd= --valsyspws=
Which has to be launched from the following path:-
C:\Program Files\Dell\CCTK\X86\
A couple of different attempts were:-
DIM aParm(2)
sCmd="C:\Program Files\Dell\CCTK\X86\cctk.exe"
aParm(1)="--syspwd= --valsyspws="
aParm(2)=password
wscript.echo sCmd & Join(aParm)
wshShell.Run sCmd & Join(aParm)
and
Set oShell = WScript.CreateObject( "Wscript.Shell" )
sSystemRoot = oshell.expandenvironmentStrings("%SYSTEMROOT%")
sCMDLoc = "C:\Program Files\Dell\CCTK\X86\cctk.exe"
sCMD = "cctk.exe --syspwd= --valsyspwd="
SVar = "--syspwd= --valsyspwd="
sPermissionCommand = "cmd.exe /K " & chr(34) & sCMDLoc & chr(34) & " " & chr(34) & sVar & password & chr(34), 1, True
wscript.echo sPermissionCommand
oShell.Run sPermissionCommand
The last one is a bit of a mess as I have been changing bits here and there.
If anyone can assist then that would be great.
Cheers,
Kev



Dedge77
4 Posts
0
December 4th, 2012 08:00
Does that mean then that on each laptop I would have to create a seperate config file to do this job? If that is the answer then there is no point in going down that route.
I am looking to be able to automate the process for all laptops using the code I have to generate the passwords.
Shrinidhi Katte
77 Posts
0
December 4th, 2012 08:00
If passwords are different, those many SCEs can be prepared and used.
All the SCEs can set the systems such that they will have a single password.
It is not possible to remove passwords using SCE directly.
Shrinidhi Katte
77 Posts
0
December 4th, 2012 08:00
Hi Dedge,
CCTK need not be installed in order to set BIOS configuration in a system.
You can use SCE(Self Contained Executable) to achieve most of the things that you are trying to do.
It is possible to set necessary configurations in CCTK GUI and then export a SCE. The SCE could be run in the system where configuration needs to be applied.
Please refer to the below links to get documentation relating to the same.
Dedge77
4 Posts
0
December 4th, 2012 08:00
Would that still be the case if the password that needs to be removed is different on every laptop?
p.s the links don't work
Dedge77
4 Posts
0
December 4th, 2012 10:00
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.