# Configure Remote Machine for PowerShell Access

## Remote PowerShell Machine

The machine in which the required PowerShell modules needs to be installed must be accessible to the VConnect resource provider VM.&#x20;

{% hint style="info" %}
The VM can be created within the Azure Stack tenant subscription or it can be provisioned outside Azure Stack. Choose a Window Server Data Center 2016 with at least 8 GB RAM and 4 vCPUs.
{% endhint %}

#### Install PowerShell modules

Open a new elevated (administrative) PowerShell console and follow below instructions.

* Follow instructions to [Install PowerShell Az preview module for Azure Stack Hub](https://docs.microsoft.com/en-us/azure-stack/operator/powershell-install-az-module?view=azs-2002). Refer [this](https://docs.microsoft.com/en-us/azure-stack/operator/azure-stack-powershell-install?view=azs-2002#2-validate-the-powershell-gallery-accessibility) documentation in case there are issues while registering PowerShell Gallery.
* Download the Azs.Syndication.Admin Module from the PowerShell Gallery using the command below.

```
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13
Install-Module -Name Azs.Syndication.Admin -RequiredVersion 0.1.152-preview -AllowPrerelease
```

#### Allow Remote PowerShell execution

Run the following PowerShell cmdlets in the elevated PowerShell window.

* Configure PS Remote access, WinRM using following script

```
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls -bor [Net.SecurityProtocolType]::Tls11 -bor [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13
Enable-PSRemoting -Force
WinRM quickconfig
WinRM set winrm/config/winrs '@{MaxShellsPerUser="500"}' 
Set-Item -Path WSMan:\localhost\Plugin\microsoft.powershell\Quotas\MaxShells -Value 500
Set-Item -Path WSMan:\localhost\Plugin\microsoft.powershell\Quotas\MaxShellsPerUser -Value 500
Set-Item -Path WSMan:\localhost\Plugin\microsoft.powershell32\Quotas\MaxShells -Value 500
Set-Item -Path WSMan:\localhost\Plugin\microsoft.powershell32\Quotas\MaxShellsPerUser -Value 500
Restart-Service winrm
```

## VConnect Resource Provider Machine

To execute PowerShell cmdlets from VConnect Resource Provider VM to Remote PowerShell machine, the remote machine IP must be trusted in WinRM inside the VConnect Resource Provider VM.

* Execute the following PowerShell cmdlets in the VConnect Resource Provider VM.

```
WinRM quickconfig
winrm set winrm/config/client '@{AllowUnencrypted="true"}'
winrm set winrm/config/winrs '@{MaxShellsPerUser="500"}'
winrm set winrm/config/client '@{TrustedHosts ="REPLACE POWERSHELL CONFIGURED MACHINE IP HERE"}'
Restart-Service winrm
```

{% hint style="info" %}
Set `AllowUnencrypted="true"` as needed.

Replace `TrustedHosts ="`REPLACE POWERSHELL CONFIGURED MACHINE IP HERE`"` with IP of the machine used in 'Configure Remote PowerShell Machine' step
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cloudassert.com/azure-stack-hub-multi-stamp-management/2012.3/installation/configuration/configure-powershell-machine.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
