We're doing some powershell things using run script on task server tasks. The key is to use the token replacement that's available within the task to execute commands on the task server for the client.
Here's a very simple command script task to show the capability:
1. Create a new Run Script on Task Server task
2. For this example, choose "command Script"
3. Click advanced, and check the box to save script output with task status
4. In the Script window, type Ping followed by a space
5. type "computer" inside the "insert token" text box and click the down arrow. Choose "Computer Name (COMPNAME)"
6. click "Insert Token"
Save the task and run it against a client computer. You should get back something similar to this:
<nobr>Script: </nobr> |
C:\Windows\system32>Ping <computer name redacted>
Pinging <Computername redacted> [IP Redacted] with 32 bytes of data:
Reply from <IP Redacted>: bytes=32 time=36ms TTL=117
Reply from <IP Redacted>: bytes=32 time=35ms TTL=117
Reply from <IP Redacted>: bytes=32 time=35ms TTL=117
Reply from <IP Redacted>: bytes=32 time=35ms TTL=117
Ping statistics for <IP Redacted>:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 35ms, Maximum = 36ms, Average = 35ms |
There are a bunch of tokens available; you can explore and find the tokens that best fit. Hope this helps.