[OpenVPN] Get all VPN profiles

The OpenVPN client support command line and the command are located under “C:\Program Files (x86)\OpenVPN Technologies\OpenVPN Client\core”

To get all VPN profiles, run the following command:

capicli.exe enumprofiles

Loading a registry hive from command line

Loading a registry hive can come to handy when you need to explore and export another user’s HKEY_CURRENT_USER (HKCU) registry key.

You can do this easily with the Registry Editor but I would like to script this so that I could export user’s registry for migration purpose.

To load the registry hive:

reg load HKU\hivename c:\Users\username\ntuser.dat

Now to export a registry:

reg export HKU\hivename\Software\Intel c:\temp\Intel.reg

To unload the registry hive:

reg unload HKU\hivename

Add/Delete printers with Windows built-in script PRNMNGR.vbs

As mentioned earlier in previous article, there is a built-in script in Windows 7 for printer management.

To add a printer:

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs -ac -p "\\server\printer"

To set default printer:

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs -t -p "\\server\printer"

To remove a printer:

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs -d -p "\\server\printer"

To remove a printer from the printer server:

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs -d -p "printer" -s server

For more info, just type:

 cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs

Or you could read the documentation by Microsoft:


Silent install Tibco Spotfire 7.0.0 desktop client

The method described in this article does not work on version 7.0.0, with a little investigation with Orca I found out that it uses INSTALLDIRUSER instead of INSTALLDIR variable to define the install path.

Therefore, in my case, I used the following parameters to install silently:

setup-7.0.0.exe /s /v/qn /V”/l*v logfile.txt ALLUSERS=1 SERVERURL=http://spotfireserver:port/ INSTALLDIRUSER=\”C:\Program Files\Tibco\SpotFire7.0.0\””

Silent installation of Google Pinyin Chinese input

To install Google Pinyin silently, you can use the following parameter, no admin rights required:

GooglePinyinInstaller.exe -s

This is tested on version 2.7 on a Windows 7 machine, however,  it will not show in Programs and Features (Add/Remove program). To add an entry to it, you need the below registry:


Windows Registry Editor Version 5.00

“DisplayName”=”谷歌拼音输入法 2.7”
“UninstallString”=”C:\\Program Files (x86)\\Google\\Google Pinyin 2\\GooglePinyinUninstaller.exe -s”
“Publisher”=”Google Inc.”


Disable SCCM by removing registry

Below are the commands needed to remove the necessary registry to disable SCCM and enable Windows Update:

reg delete HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate /f
net stop wuauserv
timeout 10
net start wuauserv

List mapped printers for current logon user in Windows 7.

If you ever think of getting a list of mapped printers for current logon user, you might had Google for List mapped printer Windows 7.

I see some nice scripts from  Spicework and Technet, the Technet one will list mapped drives as well. The script is kind of lengthy and I do not bother to read and understand what it is doing, so I start to think of another simplier approach.

In Windows XP, we have some built-in scripts for printer management. For more information about this, you may want to visit Techrepublic.  Those scripts is still here with Windows 7, but at a different path, Techrepublic had another article about this.

To list printers of the current logon user, run the following in the command prompt:

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs -l

The result from the command will list out the mapped printers with some extra info, if all you need is the printer names, you may want to run the following instead:

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs -l|find /I "printer name"

If you want to list out the default printer only, run the following:

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs -g|find /I "default"

Some may want to redirect the output of the command to a text file like with username and computername as below:

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs -l|find /I "printer name" > c:\temp\%USERNAME%-%COMPUTERNAME%-Mapped_Printer.txt

Many would ask, how to run that script on a remote computer to get the list of mapped printers for the current logon user on that remote host. My approach is to run it with owexec from Office Warfare. To be able to use owexec to run a command as the current logon user, you will need to have local admin right for that remote host.

First, modify the script to redirect to an UNC path as it would be pointless to drop the result on that local machine.

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\PRNMNGR.vbs -l|find /I "printer name" > \\server\public$\printer\%USERNAME%-%COMPUTERNAME%-Mapped_Printer.txt

Next, put the script into a batch file (getmapprinter.bat) and run the following comand:

owexec.exe -c computername -k getmapprinter.bat -copy

You should be able to find the result at the path above.