Thanks first of all for this.
I basically got third-party agent software that allows me to run PowerShell as LocalSystem. This allows me to easily run remote PowerShell commands without WinRM, etc.
The problem I am facing is that on some servers I cannot get-WindowsFeature or Add-WindowsFeature.
An example of how I am trying to achieve this is given below:
Import-Module ServerManager; Get-WindowsFeature;
The output is the same:
The term 'Get-WindowsFeature' 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.
If I enter the same commands into the PowerShell window or call PowerShell.exe directly, it will return. I'm trying to understand what we are not doing within the application, but I'm the most familiar person with PowerShell here.
Is there anything special that needs to be done to load these cmdlets? Get-Module shows nothing, strange.
Thanks!
In response to JBSmith:
Yessir - Looks like 2.0. Below are the results of the commands you mentioned.
>Name Value >---- ----- >CLRVersion 2.0.50727.6407 >BuildVersion 6.1.7600.16385 >PSVersion 2.0 >WSManStackVersion 2.0 >PSCompatibleVersions {1.0, 2.0} >SerializationVersion 1.1.0.1 >PSRemotingProtocolVersion 2.1 > >Name : AppLocker >Name : Appx >Name : BestPractices >Name : BitsTransfer >Name : BranchCache >Name : CimCmdlets >Name : DirectAccessClientComponents >Name : Dism >Name : DnsClient >Name : International >Name : iSCSI >Name : IscsiTarget >Name : ISE >Name : Kds >Name : Microsoft.PowerShell.Diagnostics >Name : Microsoft.PowerShell.Host >Name : Microsoft.PowerShell.Management >Name : Microsoft.PowerShell.Security >Name : Microsoft.PowerShell.Utility >Name : Microsoft.WSMan.Management >Name : MMAgent >Name : MsDtc >Name : NetAdapter >Name : NetConnection >Name : NetLbfo >Name : NetQos >Name : NetSecurity >Name : NetSwitchTeam >Name : NetTCPIP >Name : NetworkConnectivityStatus >Name : NetworkTransition >Name : MSFT_NfsMappedIdentity >Name : NFS >Name : PKI >Name : PrintManagement >Name : PSDiagnostics >Name : PSScheduledJob >Name : PSWorkflow >Name : PSWorkflowUtility >Name : RemoteDesktop >Name : ScheduledTasks >Name : SecureBoot >Name : ServerCore >Name : ServerManager >Name : ServerManagerTasks >Name : SmbShare >Name : SmbWitness >Name : Storage >Name : TroubleshootingPack >Name : TrustedPlatformModule >Name : UserAccessLogging >Name : VpnClient >Name : Wdac >Name : Whea >Name : WindowsDeveloperLicense >Name : WindowsErrorReporting >Name : AWSPowerShell
I also noticed that GCM |? {$ _. ModuleName -eq 'ServerManager'} returns nothing when I run it there, but through a regular PS window it returns a list of commands as expected.
Beastiansti
source share