Link to home
Start Free TrialLog in
Avatar of Mike
MikeFlag for United States of America

asked on

Need Help with Powershell Script

Greeting Experts,

Maybe somebody can help with script I am attempting to create…. In effort to help our network services group I have been asked to create a script that can be ran on a desktop and get the following items ( system information, list of process, list of services,  Network Utilization, trace route from  inside/outside ip address, and ping rates from inside/outside ip address). Then import that information in to .csv file and email to admin reasonable. I don’t know if this is possible but if somebody can kindly create a script that can do this I would appreciate that…….
Avatar of Qlemo
Qlemo
Flag of Germany image

It's feasible, but you'll need to have one CSV per task, as the produced data of each task is incompatible to others.
And I suppose you mean a trace route to inside/outside IP.

Best start, however, is if you tell us where the script should be started (is there a VPN?), and what you expect to see failiing. And how "the admin reasonable [sic]" should be determined (by AD? Won't work without a connection. Static?).

I'm also convinced that you can find something similar here on EE already.
Post each command line  you would like to script and the order you would like them in
1) Process list:

Using the Get-Process Cmdlet
https://technet.microsoft.com/en-us/library/ee176855.aspx

2) Service list

Using the Get-Service Cmdlet
https://technet.microsoft.com/en-us/library/ee176858.aspx

3) Using Powershell and WMI to get system information:

Collecting Information About Computers
https://technet.microsoft.com/en-us/library/dd315240.aspx
Avatar of Mike

ASKER

Some of the stuff I looking to do is some of the following.... What I am looking to do is to tie this up in to one .csv file and then have it email to the admin using the script....

# Get-Process
Get-Process

#Get-Service 
Get-Service | Where-Object {$_.status -eq "running"}

#Get system information: 
Get-WmiObject -Class Win32_operatingsystem | Select -Property *

# Tracrt

$array =  @("IPaddress", "IPaddress", "IPaddress", "IPaddress")
foreach($element in $array)
{
  tracert -d -h 10 $element 
}

Open in new window

You have different approaches that you can use:

1) Use out-file with the append parameter to write to a single file

2) Write the output for each cmdlet to a variable, and build a string that you can write with export-csv.
Avatar of Mike

ASKER

I am still a beginner when comes to powershell.... These are examples of what I am trying to accomplish..
SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike

ASKER

Thanks guys ... that works great....