Category Archives: Windows 7

Creating a bootable USB to install Windows 7 or Windows Server 2008 R2

This will quickly run through the steps necessary to create a bootable USB to install Windows 7 or Windows 2008 R2. Most likely adaptable for Windows Vista & Windows Server 2008 as well.

Required to proceed

  • USB Flash Drive (4.5GB+).
  • Windows 7 or Windows 2008 R2 installation medium.
  • Computer already running Windows 7 or Windows 2008 R2.

Step 1 – Formatting and creating a boot partition on the USB flash drive

  • Plug in your USB Flash Drive.
  • Open a command prompt as administrator (Right click on Start > All Programs > Accessories > Command Prompt and select “Run as administrator”.
  • Find the drive number of your USB Drive by typing the following into the Command Prompt window, “diskpart”.
  • DISKPART> list disk

    The number of your USB drive will listed. You’ll need this for the next step. I’ll assume that the USB flash drive is disk 1. Format the drive by typing the next instructions into the same window. Replace the number “1” with the number of your disk below.

    DISKPART> select disk 1
    DISKPART> clean
    DISKPART> create partition primary
    DISKPART> select partition 1
    DISKPART> active
    DISKPART> format FS=NTFS QUICK
    DISKPART> assign
    DISKPART> exit
    

    Your drive is now formatted and marked bootable.

    Step 2 – Copy the files from the Windows 7/Windows 2008 R2 ISO over to the USB stick

    Start up cmd.exe again or use Windows Explorer to perform the same action. I prefer robocopy for this. Drive D is the mounted ISO image. Drive E is the bootable USB stick.

    robocopy D:\ E:\ /MIR

    Parameter reference

    /MIR :: MIRror a directory tree (equivalent to /E plus /PURGE).

    Step 3 – Make the USB flash drive bootable

    • Insert your Windows 7 or Windows 2008 R2 DVD into your drive.
    • Open a command prompt as administrator (Start > All Programs > Accessories > Command Prompt and select “Run as administrator”.
    • Change your directory to the DVD’s boot directory where bootsect.exe is located.
    E:
    cd E:\boot
    

    Use bootsect to set the USB as a bootable NTFS drive. I’m assuming that your USB flash drive has been labeled disk E:\ by your computer.

    bootsect.exe /nt60 e:

    You can now close the command prompt window.

    Step 4 – Use the USB flash drive to install your chosen operating system

    Now you can either enter the BIOS commonly by pressing “F2” on boot and choose “USB HDD” as your first boot medium. Or press “F12” and select the USB flash drive interactively.

    At this point you can run through the installation as you ordinarily would.

    // CrashMAG

Windows Server Backup Powershell Script

This is a small Powershell script that will use the command line version of Windows Server Backup (wbadmin). It has the ability to email you upon failure or success. It will also include the log as an attachment to the script.

The variables that needs to be edited should be obvious.

I’ve found parts of this script while googling, but I’ve added a small logic that will create the backup location if it does not exist already.

#—————————————–Start script—————————————————-

function SendEmail($To, $From, $Subject, $Body, $attachment, $smtpServer) 
{ 
        Send-MailMessage -To $To -Subject $Subject -From $From -Body $Body -Attachment $attachment -SmtpServer $smtpServer 
} 
$emailto=”email@address.com” 
$emailfrom=”email@address.com” 
$day=(get-date -f dd-MM-yyyy)
$hname="HOSTNAME"
$backuplocation="\\BACKUP-SERVER\SHARE\$hname\$day\" 
$backuplog="$backuplocation"+(get-date -f dd-MM-yyyy)+"-backup-$hname.log" 
$emailserver="EMAIL-SERVER" 

function Out-FileForce {
PARAM($backuplocation)
PROCESS
{
    if(Test-Path $backuplocation)
    {
        Out-File -inputObject $_ -append -filepath $backuplocation
    }
    else
    {
        new-item -force -path $backuplocation -value $_ -type file
    }
}
}

Write-Output ("———————– Backup started on – $(Get-Date –f o) ————————-") | Out-FileForce "$backuplog" 
$Error.Clear() 
wbadmin start backup -backupTarget:$backuplocation -include:c: -systemstate -allcritical -vsscopy -quiet | Out-FileForce "$backuplog" 
if(!$?) 
    { 
        Write-Output ("———————– An error has occurred! Check it please!. – $(Get-Date –f o) ————————-") | Out-File "$backuplog" -Append 
        SendEmail -To "$emailto" -From "$emailfrom" -Subject "backup failed" -Body "The backup has failed! Please check attached log." -attachment "$backuplog" -smtpServer "$emailserver" 
        break 
        
    }

Write-Output ("———————– Everything is OK! – $(Get-Date –f o) ————————-") | Out-File "$backuplog" -Append 
SendEmail -To "$emailto" -From "$emailfrom" -Subject "backup $hname ok" -Body "The backup has succeeded!" -attachment "$backuplog" -smtpServer "$emailserver" .

#——————————————–End script——————————————————

// CrashMAG

Configuring Windows 7 support for UTC BIOS time

Windows 7 does not natively support UTC time. Which makes it a problem if you’re also running either Linux or OSX on the same machine. Either way having your BIOS keep time using UTC is the proper way.

  • Universal Time can be unambiguously converted into a local time. The opposite is not true, that is a local time cannot reliably be converted back into Universal time. This is due to the Summer Time or Daylight Savings Time offset periods implemented in many countries. At the end of that offset period, local-time clocks have to be turned back by usually one hour, therefore a 60 minute period on the local-time scale is repeated.
  • Daylight Savings Time makes it necessary to readjust the RTC twice per year. However, there exists currently no convention to label in the CMOS RAM, whether that adjustment has already been performed or not. As a result, the operating systems can get confused and will apply the correction multiple times. One possible fix is to record somewhere on the hard disk, whether the DST change has already been performed this year or not. However this fails for users who have a requirement to run several operating system versions in different hard disk partitions on the same computer, where the same RTC is shared by several operating systems that can be booted alternatively but do not have access to each others configuration files. A similar problem occurs when the operating system is booted from some exchangeable storage medium or a PC-in-PC emulator is used.

To enable UTC support please do the following.

Copy the following into a text document using notepad and save it as utc.reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation] “RealTimeIsUniversal”=dword:00000001

Run it, reboot and you’re done.

Or do the following

  • Start the Registry Editor (regedit)
  • Traverse the following path, HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation
  • Create a dword named RealTimeIsUniversal and set the value to 1
  • Restart your computer

// CrashMAG