TechOnTip Weblog

Run book for Technocrats

Archive for September, 2011

Windows Bootable USB Drive

Posted by Brajesh Panda on September 26, 2011

Creating a Windows Bootable USB drive

You can use the ISO file of Windows Server 2008 R2 to create a bootable USB drive too.
For this scenario you need to create a bootable DVD first or mount the ISO file. After you have gained access to the files on the DVD or in the ISO file, simply type the following commands on a system with the image mounted or physical DVD copy in the drive and the USB device plugged in:

diskpart.exe

DISKPART> list disk

Select the USB device from the list and substitute the disk number below
when necessary

DISKPART> select disk 1
DISKPART> clean
DISKPART> create partition primary
DISKPART> select partition 1
DISKPART> active
DISKPART> format fs=fat32
DISKPART> assign
DISKPART> exit
X:
cd boot
bootsect /nt60
Y:

xcopy X:\*.* /s/e/f Y:\

where X:\ is your mounted image or physical DVD and Y:\ is your USB
device

Advertisements

Posted in WindowsStorageServer2008 | Tagged: | Leave a Comment »

Get Disk Size Using Powershell

Posted by Brajesh Panda on September 12, 2011

  • Win32_LogicalDisk only reports about Drive Letter based Disks. So you will not able to get details about Mounted Disks/Volumes!!

Get-WMIObject Win32_LogicalDisk -filter “DriveType=3″ -computer <computer name>| Select SystemName,DeviceID,VolumeName,@{Name=”size(GB)”;Expression={[decimal](“{0:N1}” -f($_.size/1gb))}},@{Name=”freespace(GB)”;Expression={[decimal](“{0:N1}” -f($_.freespace/1gb))}},@{Name=”FreeSpace(%)”;Expression={“{0:P2}” -f(($_.freespace/1gb)/($_.size/1gb))}}

  • Use Win32_Volume to get size of all Drive Letter based Disks & Mounted Disks/Volumes. And Use Caption instead of DeviceID & Label instead of Volumename

Get-WMIObject Win32_Volume -filter “DriveType=3” -computer <computer name> | Select SystemName,Caption,Label,@{Name=”DiskSize(GB)”;Expression={[decimal](“{0:N1}” -f($_.capacity/1gb))}},@{Name=”freespace(GB)”;Expression={[decimal](“{0:N1}” -f($_.freespace/1gb))}},@{Name=”PercentFree(%)”;Expression={“{0:P2}” -f(($_.freespace/1gb)/($_.capacity/1gb))}}

  • Formal the output to Tabular format

Get-WMIObject Win32_Volume -filter “DriveType=3″ -computer (Get-Content c:\computers.txt) | Select SystemName,Caption,Label,@{Name=”DiskSize(GB)”;Expression={[decimal](“{0:N1}” -f($_.capacity/1gb))}},@{Name=”freespace(GB)”;Expression={[decimal](“{0:N1}” -f($_.freespace/1gb))}},@{Name=”PercentFree(%)”;Expression={“{0:P2}” -f(($_.freespace/1gb)/($_.capacity/1gb))}} | ft -autosize

  • Use Input files

Get-WMIObject Win32_Volume -filter “DriveType=3” -computer (Get-Content c:\computers.txt) | Select SystemName,Caption,Label,@{Name=”DiskSize(GB)”;Expression={[decimal](“{0:N1}” -f($_.capacity/1gb))}},@{Name=”freespace(GB)”;Expression={[decimal](“{0:N1}” -f($_.freespace/1gb))}},@{Name=”PercentFree(%)”;Expression={“{0:P2}” -f(($_.freespace/1gb)/($_.capacity/1gb))}} | ft -autosize

  • Sort Output using a Property Colum

Get-WMIObject Win32_Volume -filter “DriveType=3″ -computer (Get-Content c:\computers.txt) | Select SystemName,Caption,Label,@{Name=”DiskSize(GB)”;Expression={[decimal](“{0:N1}” -f($_.capacity/1gb))}},@{Name=”freespace(GB)”;Expression={[decimal](“{0:N1}” -f($_.freespace/1gb))}},@{Name=”PercentFree(%)”;Expression={“{0:P2}” -f(($_.freespace/1gb)/($_.capacity/1gb))}} | sort-object -Property PercentFree | ft -autosize

  • If you want to compare data; Exclude some disk/volumes like Page Drive Partitions i.e. P:\ for me it is meant as Page drive

Get-WMIObject Win32_Volume -filter “DriveType=3″ -computer (Get-Content c:\computers.txt) | Select SystemName,Caption,Label,@{Name=”DiskSize(GB)”;Expression={[decimal](“{0:N1}” -f($_.capacity/1gb))}},@{Name=”freespace(GB)”;Expression={[decimal](“{0:N1}” -f($_.freespace/1gb))}},@{Name=”PercentFree(%)”;Expression={“{0:P2}” -f(($_.freespace/1gb)/($_.capacity/1gb))}} | Where {$_.Caption -ne
“P:\”}
| sort-object -Property PercentFree | ft -autosize

  • If you want to compare data; like show me all disks where PercentFree is more than 50.00 %

Get-WMIObject Win32_Volume -filter “DriveType=3” -computer (Get-Content c:\computers.txt) | Select SystemName,Caption,Label,@{Name=”DiskSize(GB)”;Expression={[decimal](“{0:N1}” -f($_.capacity/1gb))}},@{Name=”freespace(GB)”;Expression={[decimal](“{0:N1}” -f($_.freespace/1gb))}},@{Name=”PercentFree”;Expression={“{0:P2}” -f(($_.freespace/1gb)/($_.capacity/1gb))}} | Where {$_.PercentFree -gt
“50.00 %”}
| sort-object -Property PercentFree | ft -autosize

Posted in Uncategorized | Tagged: , | Leave a Comment »

 
%d bloggers like this: