Hello @Brandon Fogliano ,
It is possible to use PowerShell to configure firewall ports and registry keys on PCs that are not joined to an Active Directory domain. However, you will need to have administrator privileges on the target PCs and ensure that the PowerShell Remoting feature is enabled on those PCs.
To enable PowerShell Remoting on a target PC, you can use the Enable-PSRemoting cmdlet. This cmdlet performs the following tasks:
- Enables the Windows Remote Management (WinRM) service and sets it to start automatically.
- Configures the WinRM listener to accept remote connections.
- Creates an exception in the Windows Firewall to allow incoming connections on the WinRM port (TCP 5985).
To enable PowerShell Remoting on a target PC, you can use the following command:
Enable-PSRemoting -Force
Once PowerShell Remoting is enabled on the target PCs, you can use the Invoke-Command cmdlet to execute a script or run individual commands on those PCs. For example, you can use the following command to open firewall ports and set registry keys on a target PC:
Invoke-Command -ComputerName <target_pc> -ScriptBlock {
New-NetFirewallRule -DisplayName "Allow Port XYZ" -Protocol TCP -LocalPort XYZ -Action Allow
New-ItemProperty -Path "HKLM:\SOFTWARE\MySoftware" -Name "RegistryKey" -Value "Value" -PropertyType String
}
Keep in mind that you will need to provide the appropriate values for the <target_pc> parameter and the firewall ports and registry keys that you want to configure.
Good luck!