Guest User

Untitled

a guest
Jan 22nd, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. $secpasswd = ConvertTo-SecureString $env:SP_PASSWORD -AsPlainText -Force;
  2. $mycreds = New-Object System.Management.Automation.PSCredential ($env:SP_USERNAME, $secpasswd)
  3. Add-AzureRmAccount -ServicePrincipal -Tenant $env:TENANTID -Credential $mycreds;
  4. $context = Get-AzureRmContext;
  5. Set-AzureRmContext -Context $context;
  6. # Start VM
  7. Start-AzureRmVM -ResourceGroupName myResourceGroup -Name myDevice | Out-String
  8.  
  9. $password = ConvertTo-SecureString "myPassword" -AsPlainText -Force
  10. $cred= New-Object System.Management.Automation.PSCredential ("myUsername", $password )
  11.  
  12. #Enter-PSSession -ConnectionUri https://<public_ip> -Credential $cred -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck) -Authentication Negotiate
  13.  
  14. $Server="<public_ip>"
  15. $User="myUsername"
  16. $Password="myPassword"
  17. cmdkey /generic:TERMSRV/$Server /user:$User /pass:$Password
  18. mstsc /v:$Server
Add Comment
Please, Sign In to add comment