2019-11-19 16:06:10 +00:00
|
|
|
<powershell>
|
|
|
|
|
|
|
|
# Bring ebs volume online with read-write access
|
|
|
|
Get-Disk | Where-Object IsOffline -Eq $True | Set-Disk -IsOffline $False
|
|
|
|
Get-Disk | Where-Object isReadOnly -Eq $True | Set-Disk -IsReadOnly $False
|
|
|
|
|
|
|
|
md "C:\Users\Administrator\.ssh\"
|
|
|
|
|
|
|
|
$myKey = "C:\Users\Administrator\.ssh\authorized_keys"
|
|
|
|
$adminKey = "C:\ProgramData\ssh\administrators_authorized_keys"
|
|
|
|
|
|
|
|
Invoke-RestMethod `
|
|
|
|
-Uri "http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key" `
|
|
|
|
-Outfile $myKey
|
|
|
|
|
|
|
|
cp $myKey $adminKey
|
|
|
|
|
|
|
|
icacls $adminKey /reset
|
|
|
|
icacls $adminKey /inheritance:r
|
|
|
|
icacls $adminKey /grant BUILTIN\Administrators:`(F`)
|
|
|
|
icacls $adminKey /grant SYSTEM:`(F`)
|
|
|
|
|
2020-09-17 13:20:18 +00:00
|
|
|
# for host volume testing
|
|
|
|
New-Item -ItemType Directory -Force -Path C:\tmp\data
|
|
|
|
|
2019-11-19 16:06:10 +00:00
|
|
|
</powershell>
|