troubleshooting Question

PowerShell Get-EventLog error "network path not found"

Avatar of EntAppDevTeam
EntAppDevTeamFlag for United States of America asked on
PowershellWindows Server 2008
5 Comments2 Solutions4867 ViewsLast Modified:
$SvrList = get-content “c:\scripts\servers.txt”

Write-host “Print Event Compiler”

$UsrStartDate = Read-Host “Enter the beginning date in MM/DD/YYYY format please:”
$UsrEndDate = Read-Host “Enter the ending date in MM/DD/YYYY format please:”
$begindate = get-date ($UsrStartDate)
$enddate = get-date ($UsrEndDate)


foreach ($server in $SvrList)
{
$savePath = "C:\Scripts\" + ($server) + "-printjobs.csv"
get-eventlog system -computer $server -before $enddate -after $begindate | where-Object {$_.EventID -eq 10} | export-csv -path ($savePath)
}

The above code executes flawlessly on most of our servers, but for some reason I get the network path not found eror with a few of them. I am running this script as a domain admin, remote registry is enabled and automatic, firewall is more or less disabled. Any ideas?
ASKER CERTIFIED SOLUTION
EntAppDevTeam

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros