Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Compute Cloud
    • All guides
      • Connecting to a VM via SSH
      • Exchanging files with VMs
      • Connecting to a VM via RDP
      • Connecting to a VM via PowerShell
      • Using Yandex Cloud from within a VM
      • Installing NVIDIA drivers
      • Recovering access to a VM
    • Viewing operations with resources
  • Yandex Container Solution
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  1. Step-by-step guides
  2. Using a VM
  3. Connecting to a VM via PowerShell

Connecting to a Windows VM via PowerShell

Written by
Yandex Cloud
Updated at February 12, 2025

Images of all Windows versions and editions for Yandex Cloud deployments come with enabled PowerShell Remoting Protocol (PSRP) with HTTPS access. You will be able to connect to a VM with the RUNNING status via PSRP. It may take some time for all services to initialize after the VM starts. If you get a connection error, try again in a few minutes.

VM security groups must allow incoming TCP traffic on port 5986.

To connect via PSRP, specify the public IP address or fully qualified domain name (FQDN). You can use FQDN to access a VM from another Yandex Cloud VM if both are connected to the same network. To get the IP address and FQDN, use the management console: go to the Network section on the VM page.

To connect to a VM:

  1. Start PowerShell.

  2. Create an object named Credentials, replacing <password> with Administrator password you specified when creating the VM:

    $myUserName = "Administrator"
    $myPlainTextPassword = "<password>"
    $myPassword = $MyPlainTextPassword | ConvertTo-SecureString -AsPlainText -Force
    $credential = New-Object System.Management.Automation.PSCredential($MyUserName, $myPassword)
    
  3. Make sure the username and password entered in the object are correct:

    $networkCredential = $credential.GetNetworkCredential()
    $networkCredential | Select-Object UserName, Password
    

    Result:

    UserName      Password
    --------      --------
    Administrator <password>
    
  4. Create a variable for the VM IP address:

    $ipAddress = "<IP_address>"
    
  5. Create an object named SessionOption. In the object, specify the checks to skip:

    $sessionOption = New-PSSessionOption `
      -SkipCACheck `
      -SkipCNCheck `
      -SkipRevocationCheck
    
  6. Connect to an interactive session:

    $psSession = @{
      ComputerName = $ipAddress
      UseSSL = $true
      Credential = $credential
      SessionOption = $sessionOption
    }
    Enter-PSSession @psSession
    

    Result:

    [<IP_address>]: PS C:\Users\$myUserName\Documents>
    

    Terminate the session:

    Exit-PSSession
    
  7. Create a non-interactive session:

    $session = New-PSSession @psSession
    

    Get a list of active sessions:

    Get-PSSession
    

    Result:

    Id Name            ComputerName    ComputerType    State         ConfigurationName     Availability
    -- ----            ------------    ------------    -----         -----------------     ------------
     2 WinRM2          <IP_address>    RemoteMachine   Opened        Microsoft.PowerShell     Available
    

    Run this command on a remote VM:

    $scriptBlock = { Get-Process }
    $invokeCommand = @{
      ScriptBlock = $scriptBlock
      Session = $session
    }
    Invoke-Command @invokeCommand
    

    Result:

    Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName                    PSComputerName
    -------  ------    -----      -----     ------     --  -- -----------                    --------------
        249      13     4248      16200       0.11   4176   2 conhost                        <IP_address>
        283      12     1888       4220       0.20    420   0 csrss                          <IP_address>
    ...
    

See alsoSee also

  • PowerShell sessions (PSSessions)

What's nextWhat's next

  • Using Yandex Cloud from within a VM

Was the article helpful?

Previous
Connecting to a VM via RDP
Next
Creating a VM with OS Login support
Yandex project
© 2025 Yandex.Cloud LLC