Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Powershell automation

$
0
0

Hi,

I have several tasks that I'd like to automate - flushing the DNS on multiple servers (for example).

I've found a powershell script for this purpose (from http://community.spiceworks.com/scripts/show/803-powershell-function-run-remotecmd).

The script above uses a .txt file that contains the IP addresses of each server.

At the end of the script, I added "get-content C:\PSScripts\mypc.txt | Run-RemoteCMD", then when I run it, it asks what command I would like to send to the remote PC/Servers.  Is there a way that I could modify the script to always run 'ipconfig /flushdns' for example, so that no input is needed from me whatsoever, other than to run the script initially?

I could then create slightly different scripts for different tasks - gpupdate, net start/stop etc....

If anyone has any better ideas, I'd love to hear those too.

 

I am due to go on a Powershell course at some point, but at the moment, this is all new to me.

 

Thanks.


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>