Author Posts

February 7, 2018 at 6:38 pm

Hello there everyone,

I have a test computer that I've been using to test powershell on for a while now. No configurations have been made to any of the powershell files. Just now for some reason I have found myself unable to enter a pssession into it or invoke commands. I have been able to do this just fine but now I am unable to do so. When I try to invoke this is what is returned.

PS C:\WINDOWS\system32> Invoke-Command -ComputerName ws1095 -ScriptBlock {Get-Service}
The term 'Get-Service' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
+ CategoryInfo : ObjectNotFound: (Get-Service:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
+ PSComputerName : ws1095

writeErrorStream : True
PSMessageDetails :
OriginInfo : ws1095
Exception : System.Management.Automation.RemoteException: The term 'Get-Service' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
TargetObject : Get-Service
CategoryInfo : ObjectNotFound: (Get-Service:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException

When I try to enter a pssession this is what is returned:

PS C:\WINDOWS\system32> Enter-PSSession -ComputerName ws1095
Enter-PSSession : The term 'Measure-Object' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At line:1 char:1
+ Enter-PSSession -ComputerName ws1095
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Measure-Object:String) [Enter-PSSession], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Any suggestions? I am able to do this fine to other client on the network except now for this one.
My env:psmodule path is still set to default.

Thank you in advance for the help!

February 7, 2018 at 6:55 pm

It's likely that machine's default Remoting endpoint has been locked down. A "constrained endpoint" can contain as few cmdlets as its creator desires. See "Secrets of PowerShell Remoting" for a discussion of constrained endpoints.

February 7, 2018 at 7:36 pm

Not certain how this client became a constrained endpoint since these configurations were not changed. The when I ran get-PSSessionConfiguration, the permissions on target client were only allowing built in admin to do any remote management. Due to time constraint, I am unable to read a book just to figure out how to set these to default. And looking this up was only providing with links on how to set up constrained endpoint, not how to undo them if they randomly became constrained. Was left with reimaging the computer and setting it up from scratch.
Thanks for the help Don.