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

Wevtutil on multiple remote computers

$
0
0

Hi Scripting Masters,

I'm trying to put a PS script together that will read from a list of remote computers and enable logging on each; however, I'm running into an error while attempting to do so.  Please see below and advise:

CSV File Reads as follows:

ComputerName

Server1

Server2

Server3

$servers = Import-csv "c:\Servers.csv"

ForEach ($server in $servers){
wevtutil set-log Microsoft-Windows-PrintService/Operational /e:true /r:$server.ComputerName
}

ERROR:

wevtutil : Failed to read configuration for log Microsoft-Windows-PrintService/Operational. The RPC server is unavailable.
At line:6 char:1
+ wevtutil set-log Microsoft-Windows-PrintService/Operational /e:true /r:$_.comput ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Failed to read ...is unavailable.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I think the issue is with the string, but I'm not sure what is wrong.  When using /r:Server1, I have no issues enabling the log, but this isn't ideal when I have a giant list of servers to loop through.  Any help would be greatly appreciated.  Thanks.


Viewing all articles
Browse latest Browse all 15028

Trending Articles