Sorry if this is a stupid question, but I've not worked much or anything at all with New-Object and things related to it.
I'm looking for a way to do what is posted here:
But if possible I would like to run it against several servers remotely, instead of running it locally as the post describes.
This would be the code:
$logName = 'Microsoft-Windows-PrintService/Operational' $log = New-Object System.Diagnostics.Eventing.Reader.EventLogConfiguration $logName $log.IsEnabled=$true $log.SaveChanges()
Most of these server still have PS V2 installed (2008 R2), and some have V4 (2012 R2)
Any assistance or help pointing me towards how I can solve this or where and what I could read to understand how to solve this would be very appreciated.
Do you have .NET 3.5 or later installed on your Win2008 R2 machines?
If yes, the following code with the additional Add-Type command should work:
Thanks for your reply Daniel.
I realized how stupid I was though, all I needed to do was to put the "code" inside invoke-command, like this:
If I'm not mistaken I could just enter some more computer names in that command and problem would be solved.
"Add-Type -AssemblyName" loads .NET assemblies into a PowerShell session. If you are running PowerShell 2.0 with .NET Framework 3.5 installed you'll need to run "Add-Type -AssemblyName System.Core" before your other code.
If you have a software deployment system (like SCCM, Altiris, Tivoli/BigFix, etc.) you can deploy the script and run it locally on the machine or use Sysinternals PSExec.
However I would try to get remoting enabled via Group Policy for all your servers.
You must be logged in to reply to this topic.