Executing Powershell Script(located in MID Server Script Files) on a remote desktop machine in the network

Dhanajayan S
Tera Contributor

Hi,

I need to execute a powershell script which is uploaded to MID Server Script Files in my servicenow instance. This has to executed on a remote desktop computer(which is a non-mid server). How would I do that ? Is there any way to do this without MID Server ? Do I really need the credentials of the remote desktop or is it possible to do without the credentials (like a general service account) ?

 

Thanks in Advance

5 REPLIES 5

Appli
Mega Sage
Mega Sage

Hi, running specified executable on the remote system is not considered as a best security practice (as it can be used to expose a form of vulnerability); may be instead you can involve your workstation team asking them to add the script to GPO from your AD. 

Hope it helps

Hope it helps

Hi, thank you for your response. I understand what you are saying. My scenario is a bit different. The script is actually a solution for a certain problem. And anyone facing that problem will raise a ticket in SNOW, and this PS script will get executed on the respective machine(machine details like hostname will be mentioned in the ticket). If this script is imposed as a GPO then logging can only be done locally right ? That will not work in my case.

Hi, thank you for the clarification. As far as I know it should be possibly to configure  the log collector in Windows Server and redirect log entries (in scope of GPO) from local WIN machines to these server. But indeed, you then need some logic to pull logs from the collector, parse them (mapping to impacted workstations), deal with errors/exceptions, etc ...

I would suggest providing a detailed guidance (with embedded link where to download the script) back to the user, as a response to the incident raised, and, after executing, ask the user to collect output files (=evidences) and attach it back to the incident. šŸ™‚

Hope it helps

Hope it helps

cem_karatas
Tera Contributor

Hello Dhanajayan,

 

I am currently working in a similar project in which a PowerShell script will be executed on a remote computer via Invoke-Command cmdlet via MID Server. For this:
The service account should be in the local admin groups of the remote computer. Best practice would be adding service account user to local admins group via GPO. However, the service account then should be a domain user instead of local user in the MID Server. 

Have you found a solution for this? If yes, I would really appreciate if you could share your insights.

Thanks,

 

Cem