Execute PowerShell scripts via an ASP.NET Web API endpoint
The SpiderCrab agent installs a Windows service.
choco install spidercrab -y
A local security group
SpiderCrab Operators
is created. Grant users and groups permissions to invoke scripts by adding them here.
Modify SpiderCrab.Agent.exe.config to specify:
- the port that Web API listens on (don't forget to open the incoming port if you have a firewall enabled)
Modify the Windows service entry to configure:
- the account the service runs as (you will probably have to configure urlacl for accounts other
than
Local System
)
If you have followed the steps above, you will now have a Web API endpoint that will accept
PowerShell scripts when sent to http://{machine-name}:9990/api/agent
per the following example:
{
"correlationId": "{any string value}",
"scriptBlock": "Get-Process | Select-Object -ExpandProperty Name -Unique"
}
or, if you prefer XML:
<ExecuteScriptRequest>
<CorrelationId>{any string value}</CorrelationId>
<ScriptBlock>Get-Process | Select-Object -ExpandProperty Name -Unique</ScriptBlock>
</ExecuteScriptRequest>
- Hook into your service desk application to automate customer requests
- Automate DevOps tasks: collect script parameters and approvals in your workflow system ( SharePoint, K2, etc.) then call out to SpiderCrab to spin up environments in Azure or VMWare