Posted On August 28, 2020

PowerShell: Quick Exercise On Disks Operations

kimconnect 0 comments
blog.KimConnect.com >> Windows >> PowerShell: Quick Exercise On Disks Operations
# View disks on the system
get-disk

Number Friendly Name Serial Number                    HealthStatus         OperationalStatus      Total Size Partition
                                                                                                             Style
------ ------------- -------------                    ------------         -----------------      ---------- ----------
0      VMware Vir... 00000000000000000001             Healthy              Online                     200 GB MBR
1      VMware Vir... 00000000000000000002             Healthy              Online                     500 GB MBR

# Set variables
$diskNumber=1
$driveLetter='D'

# Wipe entire disk and recreate it
# WARNING: the following lines will destroy all data on the selected disk index number set above!
Clear-Disk -Number $diskNumber -RemoveData -RemoveOEM
Initialize-Disk -Number $diskNumber
New-Partition -DiskNumber $diskNumber -UseMaximumSize -IsActive -DriveLetter $driveLetter
format-volume -driveletter $driveLetter

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Projects for Mystery Client in 2005

Mystery Client Technology Overview Last year Mystery Client upgraded to Microsoft Exchange 2003. This had…

Reset password for Active Directory Windows Recovery Administrator Account

Method 1 This procedure is useful to recover the original Administrator password that emulates TrustedInstaller…

PowerShell: Command to Retrieve Windows Applications List

The following the the PoSH equivalent of appwiz.cpl in Windows: PS> invoke-command TestWindows {Get-Package -Provider…