batch-scripting

Parse GUID on BCDEdit command line when creating new entry

Creating an entry and setting parameters with BCDEdit on command line in a batch process can be difficult because of the random GUID generated that must be specified when changing parameters to the new entry.

With a CMD file like this:
for /f "tokens=2 delims={}" %%g in ('bcdedit.exe -store c:\boot\bcd /create /d "New Entry" /application osloader') do (set guid={%%g})
echo %guid%

The generated GUID is stored as variable and can be used, within the same batch file with variable %guid%.

Attached to the post is an example of CMD Batch file that creates and entry and sets a few parameters.

Auto Rename computer with Serial Number on boot

Script File

When managing a large clients computers sometimes the best name convention for every client computer is a unique number so it is easy to locate and manage. One unique number available in most, if not every computer, is its serial number, with DELL computers it is known as Service Tag.

When needed it is easy to change one single computer name, but when doing a big deployment, like new computers, new operating system revision, and more it can be complicated.

With this script, in that case 2 files, the computer will be renamed with its own serial number (Service Tag) on next reboot, the purpose of the 2 files are:

* RunOnce.reg: Registry file to add the path to the script (note the double bar for the path to work), it uses the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce. When the script is run the entry on the regsitry gets deleted.

* ChangeName.vbs: The script itself, needs to be adjusted with a valid local administrator account, with username and password on line 22 and 23. In case of storing the file in a different path than C:\Windows the script have to be adjusted on line 44.

After running the script the file gets deleted, so not to worry, so much, with security regarding local administrator username and password in plain text.

Enable Wake On Lan (WOL) on Windows

green_switch-128.png

When deploying, with SCCM or any other software, one of the most important thing is to not disturb users on their job, so the best way to do it is out of work time, like nights, when there is no users working, at least not the majority, counterside the computers are offline so no way to install anything.

The solution is to enable and use the network standard Wake On Lan (known as WOL), but it is not a common configuration so you have to enable in every computer.

The solution is to use a script that enables it on Windows, take into consideration that must be enabled at BIOS level (covered in a next article), this script enables it silently the Wake On Lan. It can be deployed through SCCM when the computers are awake because it’s only an script with no other consequences.

Disable event logging with DELL OMCI

DELL

Dell OpenManage Client Instrumentation, known as DELL OMCI, enables remote management application programs to access information about the client system, monitor status of clients and even change BIOS settings, latest version available is 7.6.

When installed at all kind of alerts, like chassis intrussion, low hard disk space and more start bugging the client computers and the Windows Event Log gets flooded with alerts.

DELL supplies a few vbs scripts to disable some of the alerts, like chassis intrussion, but there is no script to complete disable the alerts and events.

Steve Lancaster helped with a script that sets the alert value to 7 (Fatal_Nonrecoverable), it means the PC will not start so it is impossible for this alert ever to be generated as the PC is total crashed.

After running the vbs script on the target computer no more alerts nor events are generated, so you can have a clean event log and no alerts bugging the users without loosing the capacity of change settings or monitor client status from a centralized server. Of course, all the installation and running the script process can be automated in a single deploy through SCCM 2007, but it will be covered in another post.