psexec not recognized - powershell

I am working on a Microsoft Server 2008 machine. For some reason, the command "psexec" is not working from powershell on this 1 machine.
When I try to run it I get this:
PS C:\> psexec
The term 'psexec' 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:7
+ psexec <<<<
+ CategoryInfo : ObjectNotFound: (psexec:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\>
It is running powershell 2.0. I found this out by doing:
PS C:\> $Host.Version
Major Minor Build Revision
----- ----- ----- --------
2 0 -1 -1
PS C:\>
Any thoughts? I need this command and I'd really prefer not to use a "work around".

Completing the Answer:
You must need to download PSEXEC from the link below and keep in path the launch from Powershell or any Command prompt:
http://technet.microsoft.com/en-us/sysinternals/bb897553

Related

Cloudberry powershell snapin no longer working

After the recent Windows 10 update my powershell scripts that use the cloudberry snapin are no longer working. I've re-installed cloudberry already with no success.
Even though the snapin is showing as registered:
PS C:\> Get-PSsnapin -Registered
Name : CloudBerryLab.Explorer.PSSnapIn
PSVersion : 2.0
Description : CloudBerry Explorer snap-in for PowerShell
Powershell can't recognize the command:
PS C:\> $destination = Get-CloudFilesystemConnection | Select-CloudFolder
"\\diskstation\drive1\backups\ow-data\"
Get-CloudFilesystemConnection : The term 'Get-CloudFilesystemConnection' 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:16
+ $destination = Get-CloudFilesystemConnection | Select-CloudFolder "\\ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-
CloudFilesystemConnection:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The snapin is also being added to the current session but still doesn't show:
PS C:\> Add-PSSnapin CloudBerryLab.Explorer.PSSnapIn
PS C:\> Get-PSsnapin
Name : Microsoft.PowerShell.Core
PSVersion : 5.1.17134.81
Description : This Windows PowerShell snap-in contains cmdlets used to
manage components of Windows PowerShell.
Ended up doing a re-pave (via "reset") to Win10 and spent the day reinstalling apps. The first app to install after the reset was Cloudberry and the plugin worked fine. The O/S was admittedly a bit old in the teeth having been upgraded from 7 a couple years ago. Thanks for your help attempts.

'New-SelfSignedCertificate' is not recognised as the name of a cmdlet [duplicate]

On a Windows 7 Professional system, it seems not possible to run New-SelfSignedCertificate. I could on a Windows 10 system.
Yes, the shell was started with "Run As Administrator."
PS C:\> new-selfsignedcertificate
new-selfsignedcertificate : The term 'new-selfsignedcertificate' 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
+ new-selfsignedcertificate
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (new-selfsignedcertificate:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 0 10586 117
As stated in the comments above, this isn't available in Windows 7.
However, if you're looking for something with a similar API and capability, then I have used & can recommend this from Microsoft Script Centre:
https://gallery.technet.microsoft.com/scriptcenter/self-signed-certificate-5920a7c6
Have to install AzureRM module to use azure commands through powershell. You can use below command to do it.
Install-Module -Name AzureRM -AllowClobber

Powershell: can't access MSMQ Cmdlets

I'd like to use the Message Queueing (MSMQ) Cmdlets Message Queueing (MSMQ) Cmdlets but they all show as unavailable:
PS C:\users\admin\Desktop> Get-MsmqQueue
Get-MsmqQueue : The term 'Get-MsmqQueue' 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-MsmqQueue
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-MsmqQueue:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I have Windows 8.1 and PowerShell 4 running as administrator
PS C:\users\admin\Desktop> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
4 0 -1 -1
According to OP's comment, MSMQ features were not installed :
I just assumed the machine I was on had MSMQ already but it turned out it didn't.
See this question for instructions on how to install them with PowerShell

Powershell and path environment variable

I would like powershell to use the environment variable "PATH" to resolve executables. I'm sure it should be able to do this, but here is what I get.
PS C:\> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
4 0 -1 -1
PS C:\> ${ENV:PATH} = "C:\WINDOWS\System32\"
PS C:\> ls ${ENV:PATH}\cmd.exe
Directory: C:\WINDOWS\System32
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 22/08/2013 8:03 PM 355840 cmd.exe
PS C:\> & cmd.exe
& : The term 'cmd.exe' 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:3
+ & cmd.exe
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (cmd.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Run Get-Command -Type Application to see what PowerShell is seeing as valid executables.
You may find a clue as to what's going on, such as all of the listed applications have (or don't have) a certain extension, which could indicate a problem with the PATHEXT environment variable.

How to alias an executable using Powershell permanently?

Creating and running an alias in a current Powershell session works,
Windows PowerShell
Copyright (C) 2013 Microsoft Corporation. All rights reserved.
PS C:\Windows\system32> new-item alias:eadt -value "C:\adt-bundle-windows-x86_64-20140702\eclipse\eclipse.exe"
CommandType Name ModuleName
----------- ---- ----------
Alias eadt -> eclipse.exe
PS C:\Windows\system32> eadt
but fails in a new session:
PS C:\Windows\system32> eadt
eadt : The term 'eadt' 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
+ eadt
+ ~~~~
+ CategoryInfo : ObjectNotFound: (eadt:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS C:\Windows\system32>
You should save your alias in your profile (like in .bashrc in Linux). Hava a look to About_profile to choose your one.
$Profile var gives you the path to your profile file.
It exists 4 different profil files given by :
$profile.AllUsersAllHosts
C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1
$profile.AllUsersCurrentHost
C:\Windows\System32\WindowsPowerShell\v1.0\Microsoft.PowerShellISE_profile.ps1
$profile.CurrentUserAllHosts
C:\Users\JPB\Documents\WindowsPowerShell\profile.ps1
$profile.CurrentUserCurrentHost
C:\Users\JPB\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1