SlideShare a Scribd company logo
Introduction to PowerShell Remoting, Part 2Matt Johnson, GSEC, MCSEmatt@michiganpowershell.com
What are we going to cover?Remote CommandsReusable  Sessions with PS RemotingInteractive Sessions with PS RemotingTemporary Sessions with PS Remoting
Remote CommandsNew-PSSessionGet-PSSessionEnter-PSSessionExit-PSSessionRemove-PSSessionInvoke-Command
PS Remoting HelpGet-Help about_Remotingabout_PSSessionsabout_Remote_Requirementsabout_Remote_FAQabout_Remote_Troubleshooting
Reusable  Sessions with PS RemotingIt is really easy to create  a new PS Session$dc = New-PSSession –computerName DC1It is also really easy to enter that sessionEnter-PSSession –Session $dcMore about that later!
Reusable  Sessions with PS Remoting Cont..Less network / CPU cycles used when using Reusable sessions compared to running individual commands.You can run one off commands if you are using Reusable sessionsUse Reusable sessions when you need to run more than one command against a computer.
Demo
Running Commands against muliple machines$sessions = New-PSSession pc1, pc2, pc3Invoke-Command { Md HKLM:\Software\mwjcomputing  } –Session $sessions
Passing Variables to Remote HostsYou can pass variables to the Invoke-Command cmdletYour script block must use the param statementUse the –ArgumentList switch
Demo
Interactive SessionsRun at a console just like you are sitting there at the machine. Run all normal PowerShell commandsYou can restrict the commands that can be run remotely.
Demo
Code to change what is allowed to run# Disable access to all applications$ExecutionContext.SessionState.Applications.Clear()# Disable access to scripts$ExecutionContext.SessionState.Scripts.Clear()# Define a list of allowed commands$RequiredCommands = "Exit-PSSession", "Get-Command", "Get-FormatData", "Get-Help", "Measure-Object", "Out-Default", "Select-Object"$Commands = $RequiredCommands + "Get-Process", "Get-Service", "Where-Object", "ForEach-Object"# Make everything except the allowed commands private (not visible)Get-Command | Where-Object {$Commands -notcontains $_.Name} | ForEach-Object {$_.Visibility="Private"}# Restrict the language elements to a very limited set. The possible values are FullLanguage,RestrictedLanguage, and NoLanguage$ExecutionContext.SessionState.LanguageMode="RestrictedLanguage"
Code to change what is allowed to run cont.Save as:%windir%\system32\WindowsPowerShell\v1.0\restricted.ps1
Running single commandsUse Invoke-CommandResults are returned as text, not as objectsAdds some overhead by doing it this way
DEMo
Remoting ResourcesTwo very useful resources!Get-HelpPowerShell.com’s Administrators Guide to PowerShell Remoting
ContactMatt JohnsonPhone: +1 (734) 931-0323Web: http://www.mwjcomputing.com/Blog: http://www.mwjcomputing.com/blog/Twitter: http://twitter.com/mwjcomputingEmail: matt@michiganpowershell.com
Thanks!

More Related Content

PPTX
Feb 2010 Intro To Remoteing Part1
PPTX
PowerShell 2 remoting
PDF
101 run commands
DOCX
How to install squid proxy on server or how to install squid proxy on centos o
PPTX
8 power shell commands every windows administrator should know
PDF
How To Install and Configure GNome on CentOS 7
PDF
What's New in Docker 1.13?
PPTX
Windows command D -M
Feb 2010 Intro To Remoteing Part1
PowerShell 2 remoting
101 run commands
How to install squid proxy on server or how to install squid proxy on centos o
8 power shell commands every windows administrator should know
How To Install and Configure GNome on CentOS 7
What's New in Docker 1.13?
Windows command D -M

What's hot (20)

PDF
NSClient++ Workshop: 06 Scripting
PPT
Replica Sets (NYC NoSQL Meetup)
PDF
Configuration of BIND DNS Server On CentOS 8
PDF
Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...
PDF
Configuration Firewalld On CentOS 8
PPTX
Install PostgreSQL on CentOS
PDF
Plesk CLI Wrapper
PDF
How to Fix Duplicate Packages in YUM on CentOS 7
PDF
Talk about Ansible and Infrastructure as Code
ODP
Deploying systemd at scale
PDF
How To Configure Nginx Load Balancer on CentOS 7
PDF
How To Install and Configure Screen on CentOS 7
PDF
Firewalld LAB
PDF
Configuration of NTP Server on CentOS 8
PPTX
Presentation Linux Server setup Advance Networking
PDF
OSDC 2014: Jan-Piet Mens - Configuration Management with Ansible
PDF
GCP Deployment Manager Demo
PPTX
Advanced Replication
PDF
Install and Configure RSyslog – CentOS 7 / RHEL 7
PDF
How To Manage Linux User on RHEL 7
NSClient++ Workshop: 06 Scripting
Replica Sets (NYC NoSQL Meetup)
Configuration of BIND DNS Server On CentOS 8
Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...
Configuration Firewalld On CentOS 8
Install PostgreSQL on CentOS
Plesk CLI Wrapper
How to Fix Duplicate Packages in YUM on CentOS 7
Talk about Ansible and Infrastructure as Code
Deploying systemd at scale
How To Configure Nginx Load Balancer on CentOS 7
How To Install and Configure Screen on CentOS 7
Firewalld LAB
Configuration of NTP Server on CentOS 8
Presentation Linux Server setup Advance Networking
OSDC 2014: Jan-Piet Mens - Configuration Management with Ansible
GCP Deployment Manager Demo
Advanced Replication
Install and Configure RSyslog – CentOS 7 / RHEL 7
How To Manage Linux User on RHEL 7
Ad

Viewers also liked (20)

PDF
Edisi 31 Okt Aceh
PDF
Edisi 9 Medan
DOC
Bab 9 Pembangunan Sumber Manusia
PDF
Edisi 10 April Nas
PDF
Meeting with Investors - May 2015
PDF
2010 Shift Happened Vujade
PPTX
Wie snackt in foodservice meer mof v
PPT
Ch 1 mexico city
PPTX
Stand Out in a Crowd
PDF
Tata group presentation
PDF
7jun nas
PDF
14jun nas
PDF
Industrial Plan 2016 2018
PPT
What's so special about christmas
PPT
Airport Noise Presentation 2009
PPTX
WED- Gift Basket
PPTX
Park Plantings
PDF
Taqwim smk landas 2011
PPTX
MVC 3-RAZOR Validation
Edisi 31 Okt Aceh
Edisi 9 Medan
Bab 9 Pembangunan Sumber Manusia
Edisi 10 April Nas
Meeting with Investors - May 2015
2010 Shift Happened Vujade
Wie snackt in foodservice meer mof v
Ch 1 mexico city
Stand Out in a Crowd
Tata group presentation
7jun nas
14jun nas
Industrial Plan 2016 2018
What's so special about christmas
Airport Noise Presentation 2009
WED- Gift Basket
Park Plantings
Taqwim smk landas 2011
MVC 3-RAZOR Validation
Ad

Similar to April 2010-intro-to-remoting-part2 (20)

PPTX
PowerShell 2.0 remoting
PPT
PowerShell Remoting
PPTX
Managing enterprise with PowerShell remoting
PDF
Windows PowerShell Remoting Presentation.pdf
PPT
PowerShell Remoting and Jobs (TechMentor Fall 2011)
PDF
Power on, Powershell
PPTX
07 the power in the shell - remoting
PDF
The Dark Side of PowerShell by George Dobrea
PDF
Power shell examples_v4
PPTX
Introduction to powershell
PPT
PowerShell crashcourse
PPTX
Enterprise PowerShell for Remote Security Assessments
PPT
Why and How Powershell will rule the Command Line - Barcamp LA 4
PPTX
Powering up on PowerShell - BSides Greenville 2019
PPTX
Invoke-Obfuscation nullcon 2017
PPTX
Kheirkhabarov24052017_phdays7
PPTX
Горизонтальные перемещения в инфраструктуре Windows
PDF
PowerShell Defcon for Cybersecurity Topics
PPTX
Invoke-Obfuscation DerbyCon 2016
PPTX
PowerShell - Be A Cool Blue Kid
PowerShell 2.0 remoting
PowerShell Remoting
Managing enterprise with PowerShell remoting
Windows PowerShell Remoting Presentation.pdf
PowerShell Remoting and Jobs (TechMentor Fall 2011)
Power on, Powershell
07 the power in the shell - remoting
The Dark Side of PowerShell by George Dobrea
Power shell examples_v4
Introduction to powershell
PowerShell crashcourse
Enterprise PowerShell for Remote Security Assessments
Why and How Powershell will rule the Command Line - Barcamp LA 4
Powering up on PowerShell - BSides Greenville 2019
Invoke-Obfuscation nullcon 2017
Kheirkhabarov24052017_phdays7
Горизонтальные перемещения в инфраструктуре Windows
PowerShell Defcon for Cybersecurity Topics
Invoke-Obfuscation DerbyCon 2016
PowerShell - Be A Cool Blue Kid

Recently uploaded (20)

PPT
What is a Computer? Input Devices /output devices
PPTX
Chapter 5: Probability Theory and Statistics
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
project resource management chapter-09.pdf
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
1. Introduction to Computer Programming.pptx
PDF
STKI Israel Market Study 2025 version august
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
Architecture types and enterprise applications.pdf
PPTX
TLE Review Electricity (Electricity).pptx
PDF
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
What is a Computer? Input Devices /output devices
Chapter 5: Probability Theory and Statistics
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
project resource management chapter-09.pdf
NewMind AI Weekly Chronicles - August'25-Week II
A novel scalable deep ensemble learning framework for big data classification...
Developing a website for English-speaking practice to English as a foreign la...
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
DP Operators-handbook-extract for the Mautical Institute
Getting started with AI Agents and Multi-Agent Systems
A comparative study of natural language inference in Swahili using monolingua...
gpt5_lecture_notes_comprehensive_20250812015547.pdf
1. Introduction to Computer Programming.pptx
STKI Israel Market Study 2025 version august
Univ-Connecticut-ChatGPT-Presentaion.pdf
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
cloud_computing_Infrastucture_as_cloud_p
Architecture types and enterprise applications.pdf
TLE Review Electricity (Electricity).pptx
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...

April 2010-intro-to-remoting-part2

  • 1. Introduction to PowerShell Remoting, Part 2Matt Johnson, GSEC, MCSEmatt@michiganpowershell.com
  • 2. What are we going to cover?Remote CommandsReusable Sessions with PS RemotingInteractive Sessions with PS RemotingTemporary Sessions with PS Remoting
  • 4. PS Remoting HelpGet-Help about_Remotingabout_PSSessionsabout_Remote_Requirementsabout_Remote_FAQabout_Remote_Troubleshooting
  • 5. Reusable Sessions with PS RemotingIt is really easy to create a new PS Session$dc = New-PSSession –computerName DC1It is also really easy to enter that sessionEnter-PSSession –Session $dcMore about that later!
  • 6. Reusable Sessions with PS Remoting Cont..Less network / CPU cycles used when using Reusable sessions compared to running individual commands.You can run one off commands if you are using Reusable sessionsUse Reusable sessions when you need to run more than one command against a computer.
  • 8. Running Commands against muliple machines$sessions = New-PSSession pc1, pc2, pc3Invoke-Command { Md HKLM:\Software\mwjcomputing } –Session $sessions
  • 9. Passing Variables to Remote HostsYou can pass variables to the Invoke-Command cmdletYour script block must use the param statementUse the –ArgumentList switch
  • 10. Demo
  • 11. Interactive SessionsRun at a console just like you are sitting there at the machine. Run all normal PowerShell commandsYou can restrict the commands that can be run remotely.
  • 12. Demo
  • 13. Code to change what is allowed to run# Disable access to all applications$ExecutionContext.SessionState.Applications.Clear()# Disable access to scripts$ExecutionContext.SessionState.Scripts.Clear()# Define a list of allowed commands$RequiredCommands = "Exit-PSSession", "Get-Command", "Get-FormatData", "Get-Help", "Measure-Object", "Out-Default", "Select-Object"$Commands = $RequiredCommands + "Get-Process", "Get-Service", "Where-Object", "ForEach-Object"# Make everything except the allowed commands private (not visible)Get-Command | Where-Object {$Commands -notcontains $_.Name} | ForEach-Object {$_.Visibility="Private"}# Restrict the language elements to a very limited set. The possible values are FullLanguage,RestrictedLanguage, and NoLanguage$ExecutionContext.SessionState.LanguageMode="RestrictedLanguage"
  • 14. Code to change what is allowed to run cont.Save as:%windir%\system32\WindowsPowerShell\v1.0\restricted.ps1
  • 15. Running single commandsUse Invoke-CommandResults are returned as text, not as objectsAdds some overhead by doing it this way
  • 16. DEMo
  • 17. Remoting ResourcesTwo very useful resources!Get-HelpPowerShell.com’s Administrators Guide to PowerShell Remoting
  • 18. ContactMatt JohnsonPhone: +1 (734) 931-0323Web: http://www.mwjcomputing.com/Blog: http://www.mwjcomputing.com/blog/Twitter: http://twitter.com/mwjcomputingEmail: matt@michiganpowershell.com