Author Posts

April 28, 2014 at 8:36 am

Hello,

I'm trying to make restricted user to be able to login via remoting to machine but getting some strange errors after connection is already established and modules are imported. It complaints about Get-Command as not being recognized and valid cmdlet which is true since language is set to NoLanguage but I never issued this command in a first place.

Session configuration,command I run and errors are below.

Copyright : (c) 2014 admin. All rights reserved.
ModulesToImport : WebAdministration
CompanyName : Unknown
GUID : ec41ebed-851a-4aa6-9141-30063032fb71
Author : admin
VisibleCmdlets : {ARP-*, Out-*}
SessionType : Default
ExecutionPolicy : Restricted
SchemaVersion : 1.0.0.0
LanguageMode : NoLanguage
Architecture : 64
Filename : %windir%\system32\pwrshplugin.dll
ResourceUri : http://schemas.microsoft.com/powershell/ARP
MaxConcurrentCommandsPerShell : 1000
Capability : {Shell}
xmlns : http://schemas.microsoft.com/wbem/wsman/1/config/PluginConfiguration
MaxConcurrentUsers : 5
Name : ARP
SupportsOptions : true
ProcessIdleTimeoutSec : 0
ExactMatch : false
ConfigFilePath : C:\Windows\System32\WindowsPowerShell\v1.0\SessionConfig\McafeeGOC_ec41ebed-851a-4aa6-9
141-30063032fb71.pssc
RunAsUser : Domain\admin
IdleTimeoutms : 7200000
OutputBufferingMode : Block
PSVersion : 4.0
SecurityDescriptorSddl : O:NSG:BAD:P(A;;GXGR;;;WD)(A;;GA;;;BA)(A;;GAGR;;;S-1-5-21-2042242563-1563313142-38678607
94-1002)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
MaxShellsPerUser : 25
AutoRestart : false
MaxShells : 25
MaxIdleTimeoutms : 43200000
Uri : http://schemas.microsoft.com/powershell/McafeeGOC
SDKVersion : 2
XmlRenderingType : text
RunAsPassword : System.Security.SecureString
MaxProcessesPerShell : 15
ParentResourceUri : http://schemas.microsoft.com/powershell/McafeeGOC
Enabled : True
UseSharedProcess : false
MaxMemoryPerShellMB : 1024
lang : en-US
Permission : Everyone AccessAllowed, NT AUTHORITY\INTERACTIVE AccessAllowed, BUILTIN\Administrators
AccessAllowed, DNVIISADMIN2\goc AccessAllowed

Command I enter remotely
PS C:\Windows\system32> Enter-PSSession -ComputerName DNVIISADMIn2 -ConfigurationName ARP -Credential (Get-Credential)

Result I'm seeing

WARNING: The names of some imported commands from the module 'WebAdministration' include unapproved verbs that
might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with
the Verbose parameter. For a list of approved verbs, type Get-Verb.
Enter-PSSession : The term 'Get-Command' 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 DNVIISADMIn2 -ConfigurationName Mc ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-Command:String) [Enter-PSSession], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

April 28, 2014 at 8:38 am

In many cases, PowerShell needs to run Get-Command internally so it can build a list of available commands. You've prevented it from doing so.

April 28, 2014 at 8:58 am

How then "NoLanguage" is supposed to work in a first place?

April 28, 2014 at 9:15 am

Found an answer on forum post. You have to enable following to allow remoting with "NoLanguage" setting and restricted commands.

"Enter-PSSession requires the Get-Command, Out-Default and Exit-PSSession cmdlets. If these cmdlets are not included in the session configuration on the remote computer, the Enter-PSSession commands fails."