Sei sulla pagina 1di 3

Module 4: PS Remoting

WinRM and WSMAN:


• WSMan is an industry standard communication protocol
• WSMan provides secure communication over a defined set of ports
• WSMan can be further protected with SSL
• WinRM is the Microsoft service that
• implements and manages the WSMan protocol

PS Remoting Requirements :
• WSMan Introduced With PowerShell 2.0
• Windows Management Framework 3.0 installs a new version of WSMan
• Requires non-public client network*
• Need domain environment to use Kerberos Or install certificates and use SSL
• Port 5985 (Client to Server)
• Port 5986 (Server to Client)
Enable and Configure Remoting:
• Enable and Configure Remoting
Must run elevated
Run once per machine
• Enable-PSRemoting cmdlet
Runs Set-WSManQuickConfig
Configures WinRM to AutoStart
Configures firewall settings
Registers session configurations and listeners
• Use Group Policy
• Remoting turned off by default in 2.0
• Remoting turned on by default in Windows Server 2012 and Windows 8

Apple Software Solutions Page 1


Disable PS Remoting:

• Use Disable-PSRemoting cmdlet


• Use Group Policy
• Manually undo remoting settings
• Disable with caution – much of PowerShell 3.0 and Windows Server 2012 uses remoting

PS Session:
• Created for remote machines
• Can specify alternate credentials
• Can specify authentication
• Can specify SSL
• PSSessions do not use PowerShell profile scripts

Working with PS Session:


• Enter-PSSession
Use interactively in the console or PowerShell ISE
Like SSH
Use Exit-PSSession to quit
• New-PSSession
Create persistent PSSessions to one or more remote computers
Can be used interactively
Can be used to run remote commands
• Sessions closes when PowerShell ends
Or use Remove-PSSession
Invoke-Command
• Run commands on remote machines via PSSessions
• Sessions can be re-used
• Session state is maintained
• Improves performance

Apple Software Solutions Page 2


Powershell Jobs:
• PowerShell only lets you run one command at a time
• Long running commands will “tie-up” your prompt
• Send long running commands and scripts to the background
• Retrieve results when you want
Working with Jobs:
• Use Start-Job cmdlet
Access local resources
Run a PowerShell scriptblock
Run a PowerShell script
Name your job
Pass argument list
Initialize environment (e.g. import a module)
• Use –AsJob Parameter
Typically accesses remote resources
Invoke-Command
Get-WMIObject
Invoke-WMIMethod
Restart-Computer
Can’t specify a job name
• Get-job - // To display all jobs
• Get-job –id Jobid- // To get a specific Job
• Receive-job //To get the job result

Apple Software Solutions Page 3

Potrebbero piacerti anche