Joe
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.
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
AWESOME!! How would I export that into a log file?
You can try this
$OutputObj | Out-File -filepath C:\process.log
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.
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
if you are creating a newNew-EventLog –LogName Application –Source “My Script”
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.
ASKER
Nevermind I figured it out. Thank you, you have been a huge help!
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