Local PowerShell

Started by Keith

Keith

Local PowerShell   20 May 2022, 09:53

May I suggest you add a "Local PowerShell" option, so we could run PowerShell queries again say the hostname.
Example:
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -Noexit Get-ADPrincipalGroupMembership (Get-ADComputer [Host Name]) | Select-object name
I use this to get the computer's Active Directory group membership, but of course it opens a separate window. It would be nice to have it working inside NetScanner.
SoftPerfect Support forum - Ann avatar image
Ann

Re: Local PowerShell   20 May 2022, 10:02

Could you please clarify how you'd like this to work?

At the moment, you can add this command to the list of applications (Options - Applications), and it can then be executed against any host name (via Open Device context menu), as shown below.

Did you want something different?

SoftPerfect support forum

SoftPerfect support forum
Keith

Re: Local PowerShell   20 May 2022, 10:12

Yes, that is how I am doing this exact thing right now. However I use SoftPerfect NetScanner and run reports from scanned computers across the company. If this was a built-in feature where the results showed up in a populated column like the remote PowerShell results do - that is what I am after.

I use PowerShell to grab Active Directory data like the logged-in user name and group membership, as well as membership of
computers, but having to do it manually for each PC is never going to work. But if you cannot add that as a built-in function, I understand completely.

Thanks for your time and really enjoy your product!
SoftPerfect Support forum - Ann avatar image
Ann

Re: Local PowerShell   20 May 2022, 10:49

This can be easily done with a custom VB Script that launches the command and captures its output into a column. Simply do the following:
  1. Open Remote Scripting via Options - Remote Scripting.
  2. Create a new item and load the below script.
This gives you a lot of flexibility with launching any console command and with post-processing its output as required. In the Network Scanner application you can see another example named 'Packet loss', which launches ping and uses a regex to parse the output.

Const Quote = """"

Dim cmd
cmd = "powershell.exe " & Quote & "Get-ADPrincipalGroupMembership (Get-ADComputer " & Input.Column("Host Name") & ") | Select-object name" & Quote

'Create process object and execute PowerShell
Set proc = Internal.CreateObject("process")
proc.execute(cmd)

'Check process exit code
If proc.ExitCode = 0 Then

  'Traverse output lines
  For Each line in proc.output
    Output.Write Line
  Next
Else
  Output.Write "Exit code " & proc.ExitCode
End If

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: