Remote PowerShell is now available

Started by Andrew

SoftPerfect Support forum - Andrew avatar image

Remote PowerShell is now available   18 September 2015, 18:20

Remote PowerShell support has been implemented for the brave to test it wink

Download here and see under Options - Remote PowerShell.

Re: Remote PowerShell is now available   18 September 2015, 23:40

Super Andrew. Will give this a whirl. ok, yes, thumb up

Re: Remote PowerShell is now available   19 September 2015, 00:05

Tried the Running Services option. Tried it with current account and with specified domain account; Get this error:

Error: [10.46.3.40] Connecting to remote server 10.46.3.40 failed with the following error message : The WinRM client cannotprocess the request. Default authentication may be used with an IP address under the following conditions: the, transport is HTTPS or the destination is in the TrustedHosts list, and explicit credentials are provided. Use, winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. For more, information on how to set TrustedHosts run the following command: winrm help config. For more information, see the, about_Remote_Troubleshooting Help topic., + CategoryInfo : OpenError: (10.46.3.40:String) [], PSRemotingTransportException, + FullyQualifiedErrorId : CannotUseIPAddress,PSSessionStateBroken
SoftPerfect Support forum - Andrew avatar image

Re: Remote PowerShell is now available   21 September 2015, 11:41

This appears to be because PowerShell imposes higher security requirements when connecting by IP address, not a computer name.

I have now changed the behaviour that a host name is used first if available. If it's not available, then an IP address is used. I also added an SSL connection option, though that requires additional steps in setting up PowerShell.

The updated build can be downloaded here.

Re: Remote PowerShell is now available   21 September 2015, 21:01

Thanks Andrew. Tried the new build and now get a new error. It mentions WS-Management service should be running (WinRM) It wasnt running ont he remote device, however I manually started it, and still got this error:

Error: [lds-edit-382.eng.jpress.co.uk] Connecting to remote server lds-edit-382.eng.jpress.co.uk failed with the followingerror message : The connection to the specified remote host was refused. Verify that the WS-Management service is, running on the remote host and configured to listen for requests on the correct port and HTTP URL. For more, information, see the about_Remote_Troubleshooting Help topic., + CategoryInfo : OpenError: (lds-edit-382.eng.jpress.co.uk:String) [], PSRemotingTransportException, + FullyQualifiedErrorId : CannotConnectWinRMService,PSSessionStateBroken
SoftPerfect Support forum - Andrew avatar image

Re: Remote PowerShell is now available   21 September 2015, 21:58

Then perhaps a firewall is blocking the connection? You can test it by running the following command in a PS console:
Invoke-Command -ComputerName lds-edit-382.eng.jpress.co.uk
or
Test-WSMan -ComputerName lds-edit-382.eng.jpress.co.uk

Re: Remote PowerShell is now available   22 September 2015, 00:47

Got to the bottom of it. I ran your tests and got the same errors. No firewalls were running. It turn's out the WinRM on the remote pc is not configured by default. You first need to run this command on the remote PC:
WinRM QuickConfig -quiet
After that, the Netscan PowerShell commands work fine.
I guess the client WinRM configuration would have to be set using Group policy? In the short-term I'll add a psexec command to Netscan to active on remote clients. (Is there any way it can be forced by the powershell command?)

Rgds
John
SoftPerfect Support forum - Andrew avatar image

Re: Remote PowerShell is now available   22 September 2015, 09:08

I suppose it's a network admin's decision how enable WinRM, though both a group policy and activating it with psexec should work wink
rmpf2

Re: Remote PowerShell is now available   25 September 2015, 00:08

Hi everyone, just to let you know that in my case the following statement did the trick:
%PsExec_VAR \\%0 -u %USER -p %PWD -s powershell -command "Enable-PSRemoting -Force"
%PsExec_VAR = variable defined on NS (Thanks Andrew!!!) for the psexec executable and its path.
%USER = variable defined on NS for the user with admin privileges to run scripts on target machine.
%PWD = variable defined on NS for the user password with admin privileges to run scripts on target machine.

Now I can see the results of the Remote PowerShell NS new support feature (Thanks Andrew!!!).

The statement assigns the proper rights. Change the default state of WinRM service to auto and running. Write an exception into the firewall policy. Etc...
Scott

Re: Remote PowerShell is now available   30 September 2015, 04:32

Awesome, I can already think of more than one use for this. Still the best freeware tool I've ever used by leaps and bounds...

Thanks!
rmpf2

Re: Remote PowerShell is now available   06 October 2015, 06:31

Hi Andrew

1) Any idea on the following statement:
gwmi win32_useraccount | where {$_.caption -match $env:USERNAME} | select fullname | ft -HideTableHeaders
It works just over my own machine scan on the rest of the lan host the results appear blank.

2) I believe for this one Powershell AD module should be imported. Any idea on how to do it for NS powershell feature.
Get-ADUser $User.Users -Properties MemberOf | Select -ExpandProperty memberof
SoftPerfect Support forum - Andrew avatar image

Re: Remote PowerShell is now available   06 October 2015, 10:35

Sorry I am not so familiar with PowerShell, but I recommend to try these statements in a PowerShell console and see if they return any additional info or hints:
Invoke-Command -ComputerName computer-name -ScriptBlock { command-text; }
rmpf2

Re: Remote PowerShell is now available   08 October 2015, 01:57

Hi Andrew,

Based on your last comment (Invoke-Command -ComputerName computer-name -ScriptBlock { command-text; })

I would like to know if support for NS defined variables are already included?

For example to include [logged user] as a parameter inside "-ScriptBlock { command-text; }" instead of username system/enviroment variable.

Another idea....

Following your advice i did some test over a ps console and get some results querying the domain controller instead of the scanned host. Of course using the logged user of the machine being scanned but this can not be done inside NS as it is right now cause in its design is asumming -ComputerName to be always the scanned machine. Any idea on how to bypass default value for -ComputerName to establish a new one.

Example:
Invoke-Command -ComputerName 'DCServerName' -ScriptBlock { Get-ADUser -identity '[Logged User]'}


Thanks!!!
SoftPerfect Support forum - Andrew avatar image

Re: Remote PowerShell is now available   08 October 2015, 10:41

The variables like [logged user] are only available when launching third-party applications, not during a scan itself. This is because it might otherwise create complex interdependencies where column A needs a value from column B, at the same time column C needs both A and B, while in NS scan operations are executed in a fixed order.

Regarding using DC instead of a target computer, I guess it makes sense for few scan types. This would require passing column variables though, which isn't currently available.
APunjwani

Re: Remote PowerShell is now available   23 September 2016, 04:55

Hi Andrew.

1st of all, many thanks for this amazing free tool you guys have put together.

I would like to use some of my Powershell CMDLets to return value from its session into the Netscan. Is that possible?

For example, I have "HP Lights-Out Powershell CMDLets" installed on my computer. I can send commands using "Program Options > Applications" to iLOs for upgrades. I would like to leverage those same CMDlets to report/Configure SNMP string.

$SNMPROString = $(Get-HPiLOSNMPIMSetting -server 192.168.2.25 -username admin -password Password -DisableCertificateAuthentication).SNMP_ADDRESS_1_ROCOMMUNITY

I would like the $SNMPROString value to be listed. Is that possible?

Thanks again.
-A
SoftPerfect Support forum - Andrew avatar image

Re: Remote PowerShell is now available   23 September 2016, 09:11

I am not sure here, as NetScan merely launches powershell.exe -NonInteractive Invoke-Command -ComputerName <name> -ScriptBlock { <script> } and captures its output.

Perhaps something like echo $(Get-HPiLOSNMPIMSetting -server 192.168.2.25 -username admin -password Password -DisableCertificateAuthentication).SNMP_ADDRESS_1_ROCOMMUNITY might work.

Reply to this topic

Sometimes you can find a solution faster if you try the forum search, have a look at the knowledge base, or check the software user manual to see if your question has already been answered.

Our forum rules are simple:

  • Be polite.
  • Do not spam.
  • Write in English. If possible, check your spelling and grammar.

Author:

Email:

Subject

A brief and informative title for your message, approximately 4–8 words:

     

Spam prevention: please enter the following code in the input field below.

 **     **   ******   ********  **    **   ******  
 **     **  **    **     **     **   **   **    ** 
 **     **  **           **     **  **    **       
 *********  **           **     *****     **       
 **     **  **           **     **  **    **       
 **     **  **    **     **     **   **   **    ** 
 **     **   ******      **     **    **   ******  

Message: