# Securing PowerShell On Your Domain

**URL:** <https://forums.powershell.org/t/securing-powershell-on-your-domain/10931>\
**Category:** PowerShell Help\
**Created:** [July 5, 2018, 9:54am UTC](https://forums.powershell.org/t/securing-powershell-on-your-domain/10931 "2018-07-05T09:54:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![alanbwilliams](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/alanbwilliams/32/140_2.png) [@alanbwilliams](https://forums.powershell.org/u/alanbwilliams)\
**Post date:** [July 5, 2018, 9:54am UTC](https://forums.powershell.org/t/securing-powershell-on-your-domain/10931/1 "2018-07-05T09:54:20Z")

</div>

I realize this question isn’t just about PowerShell, but moreso about securing/deploying PowerShell on a domain, but it’s purpose is to get information from experienced PowerShell users who may have experience in this piece of IT/Domain management.

So, I have been looking for some quality references on securing PowerShell in your domain. I have found a pretty mixed bag on it… \>:\ Just some pre-qualifiers, I help manage a edu(K-12) domain. All of our Techs have regular account as well as privileged accounts, primarily for local PC admin stuff. I have the same as well as a domain admin account. My goal is to make it so admin accounts have the ability for execute remote scripts and sessions on staff and student PC’s, however I’m not sure of the security risks involved and the recommended way to do such a thing.

I would like to consider enabling WinRM on all of our staff and student PC’s so I can to remote script execution and installs via PowerShell. Some of the naysayers suggest it’s a huge security vulnerability. Once I started researching more on this I found an overwhelming amount of information that was very “general” and on both sides of the fence…

Does anyone have any quality references I can review for such a thing.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![ta11ow](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/ta11ow/32/131_2.png) [@ta11ow](https://forums.powershell.org/u/ta11ow)\
**Post date:** [July 5, 2018, 11:03am UTC](https://forums.powershell.org/t/securing-powershell-on-your-domain/10931/2 "2018-07-05T11:03:54Z")

</div>

> **[PowerShell Conference EU](https://www.youtube.com/channel/UCxgrI58XiKnDDByjhRJs5fg)**
>
> PowerShell Conference Europe (PSConfEU) is one of the largest PowerShell conference world-wide. We are targeting Administrators, DevOps, Consultants, and technical decision makers. In this channel we share our Conference recordings with the...

and

> **[PowerShell.org](https://www.youtube.com/user/powershellorg)**
>
> You'll find recorded TechSession webinars, PowerShell Summit session recordings, and other recordings right here. Learn more about us at http://PowerShell.org.

Both these YT channels contain several talks from the recent PS conferences in the US and EU that deal with security with PS. 🙂

---

<div class="post-metadata">

**Author:** ![postanote](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@postanote](https://forums.powershell.org/u/postanote)\
**Post date:** [July 5, 2018, 2:19pm UTC](https://forums.powershell.org/t/securing-powershell-on-your-domain/10931/3 "2018-07-05T14:19:24Z")

</div>

Have you looked at what other orgs are documeting / defining / recommending. For example, the DoD, specifically DISA, has docs called STIGs. They are the mandated guidance for the DoD on net worthiness (ATO - Authority to operate), security and accredatation. Many commercial enterprises I work in have taken all or parts of these docs for their needs.

‘iase.disa.mil/stigs/Pages/index.aspx’  
‘[PowerShell script block logging must be enabled.](http://stigviewer.com/stig/windows_10/2017-02-21/finding/V-68819)’

Every vendor trying to work with the FedGov/Dod/Intel sectors have to deal with these or somehting like them.

There have been public courseware on the topic for few years now. For example:

Securing Windows with PowerShell and the Critical Security Controls  
‘[sans.org/simulcast/details/sec505-mar-2016-jason-fossen/course/securing-windows-with-powershell](http://sans.org/simulcast/details/sec505-mar-2016-jason-fossen/course/securing-windows-with-powershell)’

SEC505: Securing Windows and PowerShell Automation  
‘[Securing Windows with PowerShell Training | SANS SEC505](http://sans.org/course/securing-windows-with-powershell)’

SANS Pen Test Cheat Sheet: PowerShell  
‘[Offensive Operations Training & Certifications | SANS Institute](http://pen-testing.sans.org/blog/2016/05/25/sans-powershell-cheat-sheet)’

Securing Windows and PowerShell Automation  
‘[niccs.us-cert.gov/training/search/sans-institute/securing-windows-powershell-and-critical-security-controls](http://niccs.us-cert.gov/training/search/sans-institute/securing-windows-powershell-and-critical-security-controls)’

Are you saying, that the below is far to general for you to consume and leverage, or are you loking for some industry SOP (standard operating proceedure) doc or template. Just like other GRC (Governance, Risk and Compliance) industry policies (GDPR, PCIDSS, etc…) this can a will vary per org / industry. YOu need to assess your org risk manamgent policies, stance before looking into wha tyiou can really do. Ohterwise, anything you review is just knowledge transfer / thought provoking stuff.

PowerShell Security at Enterprise Customers  
‘[PowerShell Security at Enterprise Customers | Microsoft Docs](http://blogs.msdn.microsoft.com/daviddasneves/2017/05/25/powershell-security-at-enterprise-customers)’

Who’s afraid of PowerShell security?  
‘[blogs.technet.microsoft.com/ashleymcglone/2016/06/29/whos-afraid-of-powershell-security](http://blogs.technet.microsoft.com/ashleymcglone/2016/06/29/whos-afraid-of-powershell-security)’

PowerShell Remoting Security Considerations  
‘[docs.microsoft.com/en-us/powershell/scripting/setup/winrmsecurity?view=powershell-6](http://docs.microsoft.com/en-us/powershell/scripting/setup/winrmsecurity?view=powershell-6)’  
‘[PowerShell Remoting and Kerberos Double Hop: Old Problem - New Secure Solution | Microsoft Docs](http://blogs.technet.microsoft.com/ashleymcglone/2017/04/12/powershell-remoting-and-kerberos-double-hop-old-problem-new-secure-solution)’  
‘[blogs.technet.microsoft.com/ashleymcglone/2016/08/30/powershell-remoting-kerberos-double-hop-solved-securely](http://blogs.technet.microsoft.com/ashleymcglone/2016/08/30/powershell-remoting-kerberos-double-hop-solved-securely)’

Practical PowerShell Security: Enable Auditing and Logging with DSC  
‘[Practical PowerShell Security: Enable Auditing and Logging with DSC | Microsoft Docs](http://blogs.technet.microsoft.com/ashleymcglone/2017/03/29/practical-powershell-security-enable-auditing-and-logging-with-dsc)’

Script Tracing and Logging  
‘[docs.microsoft.com/en-us/powershell/wmf/5.0/audit\_script](http://docs.microsoft.com/en-us/powershell/wmf/5.0/audit_script)’

Greater Visibility Through PowerShell Logging  
‘[Greater Visibility Through PowerShell Logging | Mandiant](http://fireeye.com/blog/threat-research/2016/02/greater_visibilityt.html)’

Windows PowerShell Securing the Shell  
‘[technet.microsoft.com/en-us/library/2007.09.powershell.aspx](http://technet.microsoft.com/en-us/library/2007.09.powershell.aspx)’

PowerShell Security Best Practices  
‘[PowerShell Security Best Practices - PowerShell Team](http://blogs.msdn.microsoft.com/powershell/2013/12/16/powershell-security-best-practices)’

Just Enough Administration: Windows PowerShell security controls help protect enterprise data  
‘[Just Enough Administration: Windows PowerShell security controls help protect enterprise data | Microsoft Docs](http://msdn.microsoft.com/en-us/library/dn896648.aspx)’

---

<div class="post-metadata">

**Author:** ![alanbwilliams](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/alanbwilliams/32/140_2.png) [@alanbwilliams](https://forums.powershell.org/u/alanbwilliams)\
**Post date:** [July 5, 2018, 2:50pm UTC](https://forums.powershell.org/t/securing-powershell-on-your-domain/10931/4 "2018-07-05T14:50:55Z")

</div>

I never thought about the DoD/FedGov/DISA guidelines. This is good stuff! Thank you for the reference.

---

<div class="post-metadata">

**Author:** ![postanote](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@postanote](https://forums.powershell.org/u/postanote)\
**Post date:** [July 5, 2018, 5:30pm UTC](https://forums.powershell.org/t/securing-powershell-on-your-domain/10931/5 "2018-07-05T17:30:15Z")

</div>

No worries, glad it gave you another option.  
You could also look the other industry orgs (CERT, ISSA, ISC2, etc…) even some of the college.edu write ups.

---

<div class="post-metadata">

**Author:** ![alanbwilliams](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/alanbwilliams/32/140_2.png) [@alanbwilliams](https://forums.powershell.org/u/alanbwilliams)\
**Post date:** [August 29, 2018, 12:36pm UTC](https://forums.powershell.org/t/securing-powershell-on-your-domain/10931/6 "2018-08-29T12:36:25Z")

</div>

I have created a GPO to enable powershell on our domain PC’s. I’m trying to make it more secure and I’m running into an issue with the following settings:  
**Browse to Policies \> Administrative Templates \> Windows Components \> Windows Remote Management (WinRM) \> WinRM Service**  
**Set the IPv4 and IPv6 filters to \* unless you need something specific there (check out the help on the right).**  
When I use \* in the IPv4 section, my policy works as expected. When I put in a specific IP address(i.e. my workstation IP address) in cannot connect to a New-PSSession on the target PC.  
I have verified the connecting PC when using the \* is my ip address by using the netstat -n command.  
Any thoughts?

---

<div class="post-metadata">

**Author:** ![kvprasoon](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/kvprasoon/32/4449_2.png) [@kvprasoon](https://forums.powershell.org/u/kvprasoon)\
**Post date:** [August 29, 2018, 12:50pm UTC](https://forums.powershell.org/t/securing-powershell-on-your-domain/10931/7 "2018-08-29T12:50:28Z")

</div>

What is the error you are getting, the policy you have enabled is to add the destination node(s) to the trusted host list of the local machine.

---

<div class="post-metadata">

**Author:** ![alanbwilliams](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/alanbwilliams/32/140_2.png) [@alanbwilliams](https://forums.powershell.org/u/alanbwilliams)\
**Post date:** [August 29, 2018, 1:34pm UTC](https://forums.powershell.org/t/securing-powershell-on-your-domain/10931/8 "2018-08-29T13:34:08Z")

</div>

Once I remove the specific IP address or address range and replace it all with the \* it works like a charm.

PS C:\Windows\system32\> New-PSSession -ComputerName Y35614

New-PSSession : [Y35614] Connecting to remote server Y35614 failed with the following error message : WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet. For more information, see the about\_Remote\_Troubleshooting Help topic.  
At line:1 char:1

- New-PSSession -ComputerName Y35614

- 

```auto

```

- CategoryInfo : OpenError: (System.Manageme…RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotin

gTransportException

- FullyQualifiedErrorId : WinRMOperationTimeout,PSSessionOpenFailed

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![kvprasoon](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/kvprasoon/32/4449_2.png) [@kvprasoon](https://forums.powershell.org/u/kvprasoon)\
**Post date:** [August 30, 2018, 12:17am UTC](https://forums.powershell.org/t/securing-powershell-on-your-domain/10931/9 "2018-08-30T00:17:23Z")

</div>

Add hostname in the list or use the IP address to Invoke you have added in the policy.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:34pm UTC](https://forums.powershell.org/t/securing-powershell-on-your-domain/10931/10 "2024-05-16T20:34:28Z")

</div>

Closed on May 16, 2024, 8:34pm UTC


