Last active
August 12, 2016 17:25
-
-
Save janezdu/79e5b4f0d21d11cd80c0ec55c97a2320 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (-not ($test-path "C:\Setup\GitDrive.txt")){ | |
$drives = get-psdrive -psprovider filesystem | foreach-object -process { $_.Name + ":"} # find available drives, including empty DVD drives. | |
$changeddrive = (ls function:[d-z]: -n | ?{!($drives -contains $_)}| select -First 1)[0] # Get letter of first available drive letter | |
$devPath = "$changeddrive:\Development" | |
$newsize = (Get-WmiObject Win32_logicaldisk | ForEach-Object -Process { $_.Size })[0] | |
$newsize = $newsize - 10*1gb | |
Resize-Partition -DiskNumber 0 -DriveLetter C -size $newsize | |
New-Partition -DiskNumber 0 -DriveLetter $changeddrive -UseMaximumSize | |
format-volume -driveletter $changeddrive -Confirm:$false | |
$devPath > "C:\Setup\GitDrive.txt" | |
} else { | |
$devPath = (Get-Content "C:\Setup\GitDrive.txt")[0] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment