No PowerShell help in Docker using WindowServerCore - powershell

I'm using Docker and WindowsServerCore base image to serve different PowerShell modules to some Ops. If I start the container and try to use the Get-Help cmdlet I get the following error:
PS C:\Users\ContainerAdministrator> help *service*
more.com : The term 'more.com' 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:9 char:19
+ } else { $input | more.com }
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (more.com:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Any hints?
Thx

From these two questions 1 and 2 state that help doesn't run as Get-Help as many commands do when run without Get- but is a function that pipes to more.com. Likely the executable more.com isn't included in the WindowsServerCore base image.

Related

node doesnt run in intergreted terminal in vs code

I installed node js . it works in Powershell , cmd but not in vs code .
node : The term 'node' 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
+ node -v
+ ~~~~
+ CategoryInfo : ObjectNotFound: (node:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I had a similar issue when I installed node while vscode was already running.
Try reloading vscode. This issue on github gave me more clarity:
https://github.com/Microsoft/vscode/issues/13671#issuecomment-255778379

Solve "CommandNotFoundException" error in powershell , the script is deleted from that location?

: The term
'C:\Users\rapula\lib\oracle-cli\Lib\site-packages\oci_cli\bin\OciTabExpansion.ps1'
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 C:\Users\rapula\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:1
char:3
+ . C:\Users\rapula\lib\oracle-cli\Lib\site-packages\oci_cli\bin\OciTab
...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\Users\rapula...abExpansion.ps1:String) [],
CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The script is manually removed from system , but error persists. Please suggest how to remove this default message error.
Remove the file path from the system profile file of windows powershell.ps1.and the error is removed upon start of powershell.

PowerShell The term 'which' is not recognized as cmdlet function script file or operable program

I am using PowerShell and want to do a which command, however I am seeing this error:
which : The term 'which' 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
+ which xxxxxx
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (which:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I have done a search on Google and there is no specific answer to my question. Has anyone encountered the same error before and how can I fix it?
Putting an answer together from the comments:
which is a standard command of Linux, but is not normally present on Windows.
The equivalent command is Get-Command, or if you have it, you can run where.exe.

ObjectNotFound Error while using cmdlet to access AWS IAM

I am trying to generate AWS API gateway access key through powershell. However, everytime I try to use any cmdlet it throws an error:
For example:
Get-AWSCredential -ListProfileDetail
will result in an error like this:
Get-AWSCredential : The term 'Get-AWSCredential' 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
+ Get-AWSCredential -ListProfileDetail
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-AWSCredential:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
When I display the list of commands through Get-Command the AWS cmdlets do not pop up.
Any idea what could be the problem?
Long story short, run this: Install-Package -Name AWSPowerShell
You may need to run PS as an Administrator for the Install-Package command to work. Additionally, you may be prompted to install 'nuget', answer yes. If you receive the security warning about PSGallery, answer yes.
Here is Amazon's docs on PS cmdlets: http://docs.aws.amazon.com/powershell/latest/userguide/pstools-getting-set-up.html

Open program files directory using powershell and env variable

My goal is to create a PowerShell script, which would open specific directories in Windows Explorer.
Some of the directories could be referenced through the environment-variables.
However I got a problem with the following command
ii %programfiles(x86)%
Execution returns the following error:
The term 'x86\' 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:23
+ ii %programfiles\(x86\ <<<< )%
+ CategoryInfo : ObjectNotFound: (x86\:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Can you kindly explain to me, what I'm doing incorrectly here?
%variable% is batch notation. In PowerShell you have to use $env: to access environment variables.
Invoke-Item ${env:ProgramFiles(x86)}
The curly brackets are required, because without them the parentheses wouldn't be recognized as part of the variable name.