Skip to content
Archive of posts filed under the Scripting category.

Retrieve Windows Boot Time Script

Here’s a small batch script to get the Windows 7 Boot time shown in milliseconds. @echo off FOR /F "Tokens=4" %%a IN (‘%windir%\system32\wevtutil.exe qe Microsoft-Windows-Diagnostics-Performance/Operational /rd:true /f:Text /c:1 /q:"*[System[(EventID = 100)]]"  /e:Events ^| FIND "Duration"’) DO SET BTIME=%%a ECHO Boot Time is : %BTIME% Inspiration for this script came from the article Monitor System Startup [...]

Running a Custom Scan with Microsoft Security Essentials using a Batch Script

Here’s a small script I just wrote to perform an antivirus scan against a specified file. @Echo off FOR /F "Tokens=4" %%a IN (‘"C:\Program Files\Microsoft Security Client\AntiMalWare\mpcmdrun.exe" -Scan -ScanType 3 -File C:\TEMP\test1.wim -DisableRemediation’) DO SET THREAT=%%a Echo. if "%THREAT%"=="no" (     color 2F     Echo No Threats Found – All clean     ) ELSE ( [...]

Extract Path with spaces from Registry value

I’ve been browsing through the Microsoft TechNet Forums to see whether I can learn something new or maybe give someone a helping hand. Now before I am going to show the solution I gave someone, let me first tell you this. It was just before having diner that I read the question and already thought [...]

BITSAdmin is deprecated in Windows 7 and 2008 R2

Just recently when I created a script using BITSAdmin, I noticed the following text when running the BITSAdmin executable: BITSADMIN is deprecated and is not guaranteed to be available in future versions of Windows. Administrative tools for the BITS service are now provided by BITS PowerShell cmdlets. So BITS with PowerShell landed on my to-look-at [...]

Mute Windows System Volume

I came across a forum post where someone asked how to programmatically mute the Windows System volume. So this is what I have found: NirCmd NirCmd from NirSoft is a small command-line utility that contains many smart functions like muting and unmuting the system volume. To mute the system volume, simply run the following command [...]

Automated Microsoft Security Essentials Installation

For all those that frequently setup test machines and get tired of manually installing the Microsoft Security Essentials 2.0, here’s a straight forward batch file (even a regular user could use) that does the following: Downloads the Microsoft Security Essential 2.0 (x86) installation source file Installs Microsoft Security Essentials 2.0 Downloads and updates the virus [...]

Extracting CAB files from Microsoft Update Standalone Package (MSU)

When manually downloading a Microsoft Security Update or hotfix for Windows 7 (Vista) you typically get a file with an MSU file extension. A file with an MSU extension is a Microsoft Update Standalone package. Microsoft Update Standalone Packages are installed through the Windows Update Standalone Installer WUSA.EXE which is located in the  C:\Windows\system32 folder. [...]

ToolTip: Application Paths Editor

The Application Paths Editor allows you to add, edit and remove Application Paths. Setting an application path for your favorite application or script allows you to run the application directly from the “Run” dialog at the Start Menu. So assume you have a script called “HelloApp.vbs” which is stored under C:\Program Files\HelloApp without having set [...]

Scripting HP Wireless Device State

An old colleague called me up this week (well in fact it was my old boss who has left our company), and told me about an issue they had when deploying an ISP specific Software Package that interacts with the Wireless Devices on their HP notebooks. The problem was that if the WWAN device has [...]

Leftover files after .NET Framework 3.5 Service Pack 1 installation

Some of you might have noticed that after installing the .NET Framework 3.5 Service Pack 1, there can be a leftover folder in the root of the system as shown in the picture below. We identified this issue right after .NET 3.5 SP1 was installed,  and found out soon that we were not the only [...]