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. 

DON’T LET THIS HAPPEN TO YOU!!!

Defrag

‘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
Next

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 “
\\Server\PrintShare0

net.AddWindowsPrinterConnection “\\Server\PrintShare1
net.AddWindowsPrinterConnection “
\\Server\PrintShare2
net.AddWindowsPrinterConnection “
\\Server\PrintShare3
net.AddWindowsPrinterConnection “
\\Server\PrintShare4
net.AddWindowsPrinterConnection “
\\Server\PrintShare5
net.SetDefaultPrinter “
\\Server\PrintShare3

‘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.  

iSCSI

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. 

Download… 

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.

Download… 

 

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.

Solitaire

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 http://www.microsoft.com/windowsxp/downloads/powertoys/mcepowertoys.mspx