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.
Thanks for your reply Daniel.
What does that Add-Type row actually do?
The “code” in my first post works if I run it locally, I just wanted to be able to run it against multiple machines at the same time.
I realized how stupid I was though, all I needed to do was to put the “code” inside invoke-command, like this:
Invoke-Command -ComputerName XYZ {
$logName = ‘Microsoft-Windows-PrintService/Operational’
$log = New-Object System.Diagnostics.Eventing.Reader.EventLogConfiguration $logName
$log.IsEnabled=$true
$log.SaveChanges()
}
If I’m not mistaken I could just enter some more computer names in that command and problem would be solved.
Easy enough IF PS-remoting is enabled on all servers.
Is it possible to do this without invoke-command or more specifically without PS-remoting enabled?
“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.