Skip to content

Posts from the ‘Tips/Tweaks/Tricks’ Category

Defrag Script for all Fixed Disks

Defragging your system is an EXTREMELY important thing to do. A slow performing disk is the number one killer of overall system performance. In my opinion a “slow” machine is due to POOR disk performance. 



‘Mark Torng DEFRAG all fixed disks with VBScript

Const LogFile = “C:\Defrag.log”

Const DriveTypeRemovable = 1
Const DriveTypeFixed = 2
Const DriveTypeNetwork = 3
Const DriveTypeCDROM = 4
Const DriveTypeRAMDisk = 5

Set FSO = CreateObject(“Scripting.FileSystemObject”)
Set Drives = FSO.Drives

For each Drive in Drives
 if Drive.DriveType = 2 then
  RunCmd Drive
 end if

Sub RunCmd(DriveString)
Set WshShell = WScript.CreateObject(“WScript.Shell”)
RunString = “%comspec% /c echo ” & WeekDayName(WeekDay(Now), True) & ” ” & Now & ” ” & DriveString
Return = WshShell.Run(RunString & ” >> ” & LogFile & ” 2>&1″, 0, TRUE)
RunString = “%comspec% /c %WINDIR%\System32\Defrag.exe ” & DriveString & ” -f”
Return = WshShell.Run(RunString & ” >> ” & LogFile & ” 2>&1″, 0, TRUE)
Set WshShell = Nothing
End Sub

As always, you must use the visual basic script extention.

Copy the above, paste into a notepad, and save the file as whateveryouwant.vbs

Adding printers with VBScript

Pretty easy stuff… if you should ever need to add a login script to map a printer, or batch out a very large printer install… even convert to an EXE and push out a printer change to hundreds of systems with System Management Server.. this is a great way to do so!

‘Start Script

Dim net
Set net = CreateObject(“WScript.Network”)
net.AddWindowsPrinterConnection “

net.AddWindowsPrinterConnection “\\Server\PrintShare1
net.AddWindowsPrinterConnection “
net.AddWindowsPrinterConnection “
net.AddWindowsPrinterConnection “
net.AddWindowsPrinterConnection “
net.SetDefaultPrinter “

‘End Script

As always, you must use the visual basic script extention.

Copy the above, paste into a notepad, and save the file as whateveryouwant.vbs

XP add-on Themes

Other than the default themes that come stock with Windows XP

  1. Windows XP (Luna) Blue, Olive and Silver
  2. Clasic Windows
  3. Royal (Windows XP Media Center 2005 Edition)

I didn’t think Microsoft had released anymore, but I found some:

  1. Zune
  2. Royal_Noir

not really important, but i like change :p

     Royal Noir                               Zune

Royal_Noir           Zune

Software based iSCSI target software for Windows

MySAN™ iSCSI Server 
Free vendor-agnostic iSCSI target software for Windows  
Turn Windows into an iSCSI Storage Appliance
With MySAN software, anyone can create an IP SAN in seconds using their existing server and storage hardware. MySAN works by turning any Windows partition (such as a hard drive, internal RAID array, external storage system, or even Fibre Channel storage) into an iSCSI target. This storage can then be assigned to any computer on an Ethernet network using iSCSI, giving users a vendor-neutral IP SAN instantly.  


MySAN allows you to build an IP SAN using the servers and storage you already have. It works in tandem with Microsoft’s free iSCSI initiator in a traditional client/server fashion, as shown above. 


I’ll be installing it in the next week or so and i’ll post some more info. There is also another solution that I have tried named StarWind.

StarWind is an advanced, full-featured software-only iSCSI Target for Windows that enables anyone to quickly install and configure an IP SAN solution with immediate benefits allowing storage to be virtualized consolidated and centrally managed.



Scriptless approach to getting information on nested group memberships.

One of the biggest challenges it seems many administrators have is keeping tabs on group membership. This is even more of a problem now that we can nest groups. A popular script is one that queries group memberships recursively. But you don’t need a single line of VBScript. You can get all the information you need with the DSQuery and DSGet commands.
There are two parts to the ultimate solution but I want you to understand how they work. At the command prompt, type:
Dsquery user -samid yourlogonname
You should get the distinguished name of your user object. The beauty of the DS commands is that the output of one command can serve as the input for another. Try this:
Dsquery user -samid yourlogonname | dsget user
You’ll end up with a little more information about your user account. You can use DSGet to return other information, but for our purposes we want to get at group membership. Run this command:
Dsquery user -samid yourlogonname | dsget user -memberof
You should be rewarded with the distinguished names of all the groups the user account belongs to. If you want to check for nested group membership, use a command like this:
Dsquery user -samid yourlogonname | dsget user -memberof -expand
Now you have a longer list of group names. You can’t tell where a group is necessarily nested, but you’ll at least know which group membership is affecting the user. You can also search for more than one user this way:
Dsquery user -limit 0 | dsget user -memberof -expand
This expands the group membership for all user accounts in the domain.
You can also come at this from the group angle:
dsquery group -samid “Sales Staff” | dsget group -members
If you want to expand nested group membership you can use -expand as I did earlier:
dsquery group -samid “Sales Staff” | dsget group -members -expand
By the way, if you don’t know the complete group name, wild cards are allowed:
dsquery group -samid “Sales*” | dsget group -members -expand
Finally, want to build a membership report for all users? Try these commands:
dsquery group –limit 0 >groups.txt for /f “tokens=*” %g in (groups.txt) do @echo %g

>>membership.txt & echo Members: >>membership.txt & dsget group % -members >>membership.txt & echo

**************************************** >>membership.txt

Enable Remote Desktop Remotely with Remote Registry

Ever forget to enable remote desktop on a server, or client machine and think you have to get up and go physically visit the machine in order to enable remote desktop so you can connect remotely and use that machine? well no more! (Unless the firewall is enabled… then your just S.O.L)

You can enable Remote Desktop from the registry of any windows XP/2003 machine your currently sitting at!

Just open run and enter “regedit”

Then go File, and click “Connect Network Registry…”
enter the IP, NetBIOS name or FQDN and click OK
Now you will notice a new node in the registry editor of the remote machine.

Navigate to the registy key “HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server”
Change the Dword “fDenyTSConnection” from 1 to 0

0 = remote desktop is enabled
1 = remote desktop is disabled

Hope this helps!

Windows Power Toys for Windows Vista

Ever since I switched to Vista x64, I’ve really missed some of the XP power toys, like “Open command window here” and another utility I used named Path Copy to give you a right click option to “Copy as path”… Tonight I discovered Vista has these built in.. you just have to hold SHIFT before you right click on the file or folder…

so for “Open command window here” you have to hold SHIFT when you right click and you’ll also get the “Copy as path” command.

There are a lot more power toys I used that were great, like TweakUI (to remove those nasty shortcut arrows), RAW Image Thumbnailer and Viewer, Image Resizer and Virtual Desktop Manager to name a few.

I will add more to this post as I discover replacements for all the Windows XP Power Toys we so love.

An update to this post!

Windows Media Center Power Toys are available!

Tweak MCE for Media Center Edition 2005

Tweak MCE gives you access to systems settings and options not normally exposed in the Media Center user interface, including remote control settings, Skip and Replay time customizations, user interface options, and more. It also helps you to optimize Media Center Extender for plasma and non-CRT displays

Alarm Clock

The Alarm Clock PowerToy works like an old-fashioned clock radio, via the Media Center remote control. The “sleep” function plays music or another media selection for a certain duration. “Wakeup” begins playing music or other programming at a time you specify.

Playlist Editor

The Media Center Playlist Editor allows you to create and edit playlists anywhere in the room using your remote control. Add songs by album, artist, title, or genre. Rearrange the songs in your existing playlists, or remove them entirely, all without ever touching a mouse or keyboard.


This PowerToy enables you to play Solitaire on your Media Center PC from anywhere in the room using your remote.

You can download them here

Media Center 2005 Joining a Domain

IMPORTANT NOTE: you will *not* be able to use extender devices (I.E Xbox, Xbox360) due to the Fast User Switching dependency (who uses extenders anyway? they don’t support DivX)

Exception to first rule: The Linksys MCE Extender device works fine when joined in a domain.Insert Windows Media Center CD1.
Run > D:\i386\winnt32.exe /cmdcons
Acknowledge prompt by clicking ‘Yes’.
Skip updating process click ‘Cancel’ or press ‘Esc’
After installation click ‘Ok’
Start > Shutdown > Restart
At boot menu, select ‘Microsoft Windows Recovery Console’
Log onto (default: 1) and press ‘Enter’
Type: ‘cd system32\config’
Type: ‘copy SYSTEM C:\’
Type: exit
At boot menu, select ‘Windows XP Media Center Edition’
Start > Run > Type: ‘regedit’ and press enter
File > Load Hive…
Browse and select C:\SYSTEM
Specify key name ‘BANANA’ and click OK
On the right-hand side, double-click IsLegacyMCE value
Change selected value to 1 and click Ok.
Click on BANANA subkey (under HKEY_LOCAL_MACHINE).
File > Unload Hive. Confirm.
Start > Shutdown > Restart

At boot menu, select ‘Microsoft Windows Recovery Console’
Select proper installation to log onto (default: 1) and press ‘Enter’
(If prompted, enter Administrator password and press ‘Enter’)
Type: ‘cd \’
(Type: ‘del SYSTEM’
Type: ‘exit’
At boot menu, select ‘Windows XP Media Center Edition’

PC de-crapifier?? Is that even a word??

Alright, this is a pet peeve of mine!
You know when you buy a new computer, (laptop or desktop) from HP.. Dell.. or any other computer vendor, the computer is riddled with useless software eating away at your precious memory and CPU cycles, and it feels like you got absolutely nowhere by updating your machine because you probably have 9000+ spywares, tracking cookies, mal/greyware already.. and it feels like your running a Pentium 3 500Mhz?
Well those vendors have sold whatever little soul they have for a few bucks, so other software venders (if you could even call them that) can install all that nasty ass shit on your nice new shiny PC. So you get your new system home, and it runs like absolute poo because you have web search, my buddy, and 1001 other useless apps on your machine…
 Annoying.. YES! Especially more so when you have removed these shit apps from more than 10,000 machines in your life time!
Well now you can get rid of it all, without calling me!, or some other friend that’s losing his hair and knows how to use add/remove programs and flush that spyware out of your system. Say it with me.. DECRAPIFIER! download it here! and rid your new box of all that ass!

A must have for dual monitors! (Different wallpapers on each monitor!)

Are you using multiple monitors? I think most people are these days… and if you are, Ultramon is a MUST HAVE for you!

Not only can you have different resolutions for each wallpaper on each screen (in case each of your monitors is a different resolution and Eva Longoria’s bust looks shushed, or stretched 😀 ) or you just simply want a different picture on each display! 

You can also have your taskbar extend to the second monitor, and place what you have on your second display ON IT’S OWN TASKBAR!… it’s quite nifty for knowing which window is on what screen. It also helps keep the taskbar clutter free. It’s much much easier to sort and manage while working with many windows opened at once!

Anyway.. I could rant about this all night long.. here’s the link  go try it out for yourself! 😛