-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
azure dev jumpbox
committed
May 11, 2017
1 parent
b9fe3cb
commit 7e174e8
Showing
1 changed file
with
85 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
######################################################################################### | ||
########## Initialize, Format Azure Data Disks | ||
######################################################################################### | ||
|
||
|
||
# https://docs.microsoft.com/en-us/azure/virtual-machines/windows/attach-disk-ps#add-an-empty-data-disk-to-a-virtual-machine | ||
|
||
# 1. | ||
# see uninit disks | ||
|
||
Write-Host "--------------------------------------------`n$comp`n--------------------------------------------`n" | ||
|
||
|
||
$cmd = {Get-PSDrive -PSProvider "FileSystem" | Format-Table } | ||
Invoke-Command -ComputerName $comp -ScriptBlock $cmd -Credential $cred | ||
|
||
$cmd = {Get-Disk |Sort-Object Number | Format-Table } | ||
Invoke-Command -ComputerName $comp -ScriptBlock $cmd -Credential $cred | ||
|
||
Write-Host "--------------------------------------------`n$comp`n--------------------------------------------`n" | ||
|
||
|
||
|
||
2. | ||
setup up config dict: {lun,{letter, label}} | ||
|
||
for spVm0, spVm1, spVm2 | ||
$lun2drive = @{ | ||
2 = @{"letter" = "E"; | ||
"label" = "" | ||
} | ||
} | ||
|
||
$drive_json = ' | ||
{ | ||
"root": | ||
{ | ||
"2": { | ||
"letter":"E", | ||
"label":"New Volume onprem D" | ||
}, | ||
"3": { | ||
"letter":"H", | ||
"label":"Data onprem H" | ||
}, | ||
"4": { | ||
"letter":"I", | ||
"label":"SQL_Temp" | ||
}, | ||
"5": { | ||
"letter":"J", | ||
"label":"SQL_Temp" | ||
}, | ||
"6": { | ||
"letter":"K", | ||
"label":"Backup" | ||
} | ||
} | ||
} | ||
' | ||
$lun2drive = ConvertFrom-Json $drive_json | ||
$lun2drive | ||
|
||
# Read-Host "confirm..." | ||
|
||
foreach ($lun in ($lun2drive.root | Get-Member * -MemberType NoteProperty).Name) { | ||
Write-Output "$lun = $($lun2drive.root.$lun)" | ||
Write-Host $($lun2drive.root.$lun) | ||
$drive_letter = $lun2drive.root.$lun.letter | ||
$drive_label = $lun2drive.root.$lun.label | ||
Write-Host "mapping ${drive_letter}" | ||
Write-Host "mapping ${drive_label}" | ||
|
||
$disk = Get-Disk -Number $lun | ||
$disk | ||
$disk | | ||
Initialize-Disk -PartitionStyle MBR -PassThru | | ||
New-Partition -UseMaximumSize -DriveLetter $drive_letter | | ||
Format-Volume -FileSystem NTFS -NewFileSystemLabel $drive_label -Confirm:$false -Force | ||
# New-Partition -UseMaximumSize -DriveLetter $drive_letter -DiskNumber $lun | | ||
# Format-Volume -FileSystem NTFS -NewFileSystemLabel $drive_label -Confirm:$false -Force | ||
# Format-Volume -DriveLetter $drive_letter -Force | ||
} | ||
|
||
Get-PSDrive -PSProvider "FileSystem" |