Link to home
Start Free TrialLog in
Avatar of Joe
JoeFlag for United States of America

asked on

PowerShell Question

I am trying to get basic computer information form powershell and output to a log file. I can't get it to output properly.

I am trying to get

Computer Name
Domain
Free Space
IP Address
gateway


I want these to all be outputted to a log file in a useable list but I can't seem to get it working. Mind you i am very new tp powershell.

Any help is appreciated.
Avatar of Justin Evans
Justin Evans

Hi,  

Try this URL https://docs.microsoft.com/en-us/sysinternals/downloads/pstools

it includes a executable called Psinfo which when run will give you the information you are after.

hope this helps

Justin
Avatar of Joe

ASKER

Thanks but it needs to be done in powershell. To put psinfo on every server (2300 of them) would need some serious approval.
ASKER CERTIFIED SOLUTION
Avatar of Dorababu M
Dorababu M
Flag of India 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
Avatar of Joe

ASKER

AWESOME!! How would I export that into a log file?
You can try this
$OutputObj | Out-File -filepath C:\process.log

Open in new window

Avatar of Joe

ASKER

That worked perfectly. Last question I swear lol. I want to write that log file to the event log. Either that or just send the results to the event log.

I see the Write-Eventlog cmdlet but I can't seem to get to to pull from the file.
You have to use
New-EventLog

Open in new window

if you are creating a new
New-EventLog –LogName Application –Source “My Script”

Open in new window

Avatar of Joe

ASKER

Right it looks like that sets which logs to send it to and the source. I don't see how to add the results to the event log though.
Avatar of Joe

ASKER

Nevermind I figured it out. Thank you, you have been a huge help!