Windows/Powershell

From r00tedvw.com wiki
(Difference between revisions)
Jump to: navigation, search
(Allow Remote Powershell)
Line 1: Line 1:
 
=Allow Remote Powershell=
 
=Allow Remote Powershell=
 +
==Server==
 +
===Enable PSRemoting===
 
On the server you'll be accessing
 
On the server you'll be accessing
 
  <nowiki>PS> Enable-PSRemoting -Force      #suppresses user prompts and enables.
 
  <nowiki>PS> Enable-PSRemoting -Force      #suppresses user prompts and enables.
 
PS> Enable-PSRemoting -SkipNetworkProfileCheck -Force      #enables even on public networks.</nowiki>
 
PS> Enable-PSRemoting -SkipNetworkProfileCheck -Force      #enables even on public networks.</nowiki>
 +
===Enable Windows Remote Management (WinRM)===
 
You will also probably have to enable WinRM (windows remote management)
 
You will also probably have to enable WinRM (windows remote management)
 
  <nowiki># Set start mode to automatic
 
  <nowiki># Set start mode to automatic
Line 14: Line 17:
 
PS> Stop-Service -Name "WinRM"</nowiki>
 
PS> Stop-Service -Name "WinRM"</nowiki>
  
 +
===Trusted Hosts List===
 
You may also need to add the client that will be connecting to the trusted hosts list.
 
You may also need to add the client that will be connecting to the trusted hosts list.
 
  <nowiki>PS> Set-Item WSMan:\localhost\Client\TrustedHosts -Value "FQDN" -Force    #Adds an individual host.  Overwrites previous entry.
 
  <nowiki>PS> Set-Item WSMan:\localhost\Client\TrustedHosts -Value "FQDN" -Force    #Adds an individual host.  Overwrites previous entry.
Line 26: Line 30:
 
----            ----                          -------------  -----                                                   
 
----            ----                          -------------  -----                                                   
 
System.String  TrustedHosts                                  *  </nowiki>
 
System.String  TrustedHosts                                  *  </nowiki>
 +
 +
===Test Connectivity===
 +
<nowiki>PS> Test-WSMan -ComputerName {ServerFQDN} -Credential {ServerFQDN/Domain}\{User} -Authentication Default
 +
ie. PS> Test-WSMan -ComputerName win-45mo0eqvg4g -Credential win-45mo0eqvg4g\Administrator -Authentication Default</nowiki>

Revision as of 10:34, 18 January 2019

Contents

Allow Remote Powershell

Server

Enable PSRemoting

On the server you'll be accessing

PS> Enable-PSRemoting -Force      #suppresses user prompts and enables.
PS> Enable-PSRemoting -SkipNetworkProfileCheck -Force      #enables even on public networks.

Enable Windows Remote Management (WinRM)

You will also probably have to enable WinRM (windows remote management)

# Set start mode to automatic
PS> Set-Service WinRM -StartMode Automatic

# Verify start mode and state - it should be running
PS> Get-WmiObject -Class win32_service | Where-Object {$_.name -like "WinRM"}

# Start/Stop service
PS> Start-Service -Name "WinRM"
PS> Stop-Service -Name "WinRM"

Trusted Hosts List

You may also need to add the client that will be connecting to the trusted hosts list.

PS> Set-Item WSMan:\localhost\Client\TrustedHosts -Value "FQDN" -Force    #Adds an individual host.  Overwrites previous entry.
PS> Set-Item WSMan:\localhost\Client\TrustedHosts -Value "*" -Force      #Adds everything to the trusted host list.

PS> Get-Item WSMan:\localhost\Client\TrustedHosts


   WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Client

Type            Name                           SourceOfValue   Value                                                  
----            ----                           -------------   -----                                                  
System.String   TrustedHosts                                   *  

Test Connectivity

PS> Test-WSMan -ComputerName {ServerFQDN} -Credential {ServerFQDN/Domain}\{User} -Authentication Default
ie. PS> Test-WSMan -ComputerName win-45mo0eqvg4g -Credential win-45mo0eqvg4g\Administrator -Authentication Default
Personal tools
Namespaces

Variants
Actions
Navigation
Mediawiki
Confluence
DevOps Tools
Ubuntu
Ubuntu 22
Mac OSX
Oracle Linux
AWS
Windows
OpenVPN
Grafana
InfluxDB2
TrueNas
OwnCloud
Pivotal
osTicket
OTRS
phpBB
WordPress
VmWare ESXI 5.1
Crypto currencies
HTML
CSS
Python
Java Script
PHP
Raspberry Pi
Canvas LMS
Kaltura Media Server
Plex Media Server
MetaSploit
Zoneminder
ShinobiCE
Photoshop CS2
Fortinet
Uploaded
Certifications
General Info
Games
Meal Plans
NC Statutes
2020 Election
Volkswagen
Covid
NCDMV
Toolbox