cloud-init_win.tpl.yaml 664 B

12345678910111213141516
  1. #ps1
  2. net user Administrator "${ pass }"
  3. Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
  4. Add-Content -Path 'C:\public.pub' -Value "${ ssh_key }"
  5. Add-Content -Path 'C:\private.pem' -Value "${ ssh_pri }"
  6. $NewAcl = Get-Acl -Path "C:\private.pem"
  7. $identity = "BUILTIN\Administrators"
  8. $fileSystemRights = "FullControl"
  9. $type = "Allow"
  10. $fileSystemAccessRuleArgumentList = $identity, $fileSystemRights, $type
  11. $fileSystemAccessRule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule -ArgumentList $fileSystemAccessRuleArgumentList
  12. $NewAcl.SetAccessRule($fileSystemAccessRule)
  13. Set-Acl -Path "C:\private.pem" -AclObject $NewAcl