Windows

Disk usage in Windows

Windows does not have any in-built command(Like the Linux command du) which show the disk usage statistics for a directory. However, there’s a downloadable tools from SysInternals(now part of Microsoft) which can show us the disk usage numbers.

Du.exe version 1.4 can be downloaded from the below link.

http://technet.microsoft.com/en-us/sysinternals/bb896651

Find the disk usage of a directory

Command for finding the size of a directory is:

Example:

To find the size of the folder C:Windows, the command would be:

 Find the disk usage of a drive

Using du command we can find the current disk usage of a disk drive also.
Example:

Windows Sysinternals – Auto system reboot

The application is called PsShutdown, and is downloadable for free:

http://technet.microsoft.com/en-us/sysinternals/

PsShutdown is quite similar to “regular” shutdown – the former accepts the same parameters as the latter, but has various additional features, such as logging off users, locking the work station, and foremost: shutdown of the system when nobody’s logged in, or when the console is locked.

Usage sample

Suppose you need to reboot your system once a week. You would then create a Scheduled task (using the built-in Windows task scheduler), set to be executed once a week, using a privileged account (i.e. an account which is capable of doing the system reboot), and run this command:

psshutdown -f -r -m “automated planned reboot” -e p:0:0

Remove Windows Service

By executing the following command you can remove a windows service:

C:> sc delete [service name]

TIP:  If you don’t know the service name you’re trying to delete, you can find it by going to Start>Run>services.msc and locate the service name in the service’s property page.

 

Attn:  No screenshots were harmed in forming this post.

How to Setup a Windows 2008 R2 SNTP/NTP Server

 

  1. Click Start, click Run, type regedit, and then click OK.
  2. Locate and then click the following registry entry:HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW32TimeConfig
  3. In the right pane, right-click AnnounceFlags, and then click Modify.
  4. In the Edit DWORD Value dialog box, under Value data, type 5, and then click OK.
  5. Enable NTPServer.
    1. Locate and then click the following registry subkey:

      HKEY_LOCAL_MACHINESYSTEMCurrentControlSet
      ServicesW32TimeTimeProvidersNtpServer

    2. In the right pane, right-click Enabled, and then click Modify.
    3. In the Edit DWORD Value dialog box, type 1 under Value data, and then click OK.
  6. Exit Registry Editor.
  7. At the command prompt, type the following command to restart the Windows Time service, and then press ENTER:net stop w32time && net start w32time

This should get you setup with minimal registry hack impact.

Tips

  • Make sure W32Time is set to Automatic startup mode.
  • Make sure UDP 123 is allowed through your firewall.

How to Use the Traceroute Command (windows)

Traceroute is a command which can show you the path a packet of information takes from your computer to one you specify. It will list all the routers it passes through until it reaches its destination, or fails to and is discarded. In addition to this, it will tell you how long each ‘hop’ from router to router takes.

In Windows, select Start > Programs > Accessories > Command Prompt. This will give you a window like the one below.

Enter the word tracert, followed by a space, then the domain name.

As you can see I am tracing the route to goolge.com, it shows the IP Address of google.com

Next it gives info about each router it passes through on the way to the destination.

1 is the internet gateway on the network (yours)
2 is the ISP (my ISP)
3-10 are routers on the web
11 is the server (gateway) that the google.com is hosted from.

 

 

 

The Case of the Mysterious Reboots

Mark Russinovich over on technet.com posted a new article on killing malware using Sysinternal Suite Tools.

I felt it was necessary to share.
The Case of the Mysterious Reboots – Mark’s Blog – Site Home – TechNet Blogs

Disable Error Reporting in Server 2003

This is not something I recommend you do, as this limits the ability to properly obtain details about errors in applications which reside on your server.  However there are times where the application developers and support staff are reluctant to resolve the issue so you take steps to prevent these error log messages from running your system out of space.   – I choose to kill them all (not the dev’s just the messages)

Go to Control Panel.
Click System.
Go to the Advanced tab.
Click Error Reporting.
Click the “Disable Error Reporting” radio box, but select the “But notify me when Critical Errors Occur”.

VHD! Booting Windows 8

Why wipe your system clean to preview Windows 8 developer preview when you can simply use the good old VHD to boot it up on your system.

Here is the quickest method to do this.  <Warning — This is GEEK / not GREEK >

  • Boot from the Win8dev DVD or USB
  • When in setup the disk selection appears where to install to you press SHIFT-F10
  • A cmd window appears.
  • Now your drive letters may have shifted so do some DIR commands where you want the put the VHD file also choose a volume that has enough free space.
  • Then run diskpart:
    • create vdisk file=d:win8dev.vhd type=expandable maximum=50000 (for better performance do not use expandable, but creating the VHD may take some time.
      I choose about 50 GB in size
    • select vdisk file=d:win8dev.vhd
    • attach vdisk
  • Now alt-tab back to the disk selection window and click refresh, the VHD volume should appear, select it to install Windows in it.
  • Click next, Windows will install and reboot into next phase of Windows 8 setup
  • After another reboot the new Metro style boot menu appears where you can choose to boot from Windows 8 or Windows 7. Advanced options lets you set the default and change timeout. Also troubleshooting options are here.
  • The default is Windows 8 and it will run direct on your hardware

Windows 8

The folks at Microsoft made available a developer preview edition of Windows 8, which permits us to get a good hands on the new windows to operating system.    After some testing and attempts to get this to install on VMware products such as ESX and VMware Workstation 7 / Player I was able to test on VMware Workstation 8 and my Lenovo T61.  So far so good!  I am just wondering now, how to I add new titles?

Install Updates on an EWF-Protected Image | Windows Thin PC

To update a run-time image that is protected by EWF RAM mode


  1. Use EWF Manager to disable the overlay by typing the following command:ewfmgr c: -disable
  2. Restart the system.
  3. Install the application or update.
  4. Wait for the install to complete and restart the computer if required.
  5. Re-enable the EWF overlay by using the following command:ewfmgr c: -enable
  6. Restart the system to re-enable the EWF overlay.

To update a run-time image that is protected by EWF RAM Reg mode


  1. Restart the device to clear the RAM overlay.
  2. Commit the overlay to the protected volume and disable the EWF overlay by typing the following command:ewfmgr c: -commitanddisable

    Because RAM Reg modes store EWF configuration data in the registry, you must commit the disable change to the protected run-time image. For more information, see Configure EWF RAM Reg Mode.

  3. Restart the system to disable the overlay.
  4. Install the application or update.
  5. Wait for the install to complete and restart the computer if required.
  6. Enable the EWF overlay by typing the following command:ewfmgr c: -enable
  7. Restart the system to re-enable the EWF overlay.