I wrote a powershell script using the following command to gather information about our servers
$os = Get-Ciminstance Win32_OperatingSystem -ComputerName $server
When I run this command as my admin account everything works and I get the information for all of our servers. I wanted this to run on a schedule so I created a task and set it to run using a service account on our network. When I run it this way it fails for most of the servers.
I tried logging on to the server with the service account and manually running the script with the same results. I checked the permissions on one of the remote servers and as far as I can tell the service account has more privileges than my admin account. It is in every group that my admin account is plus the backup operators group and a couple more I added when trying to get this to work.
The server running the script runs Windows 2008r2 and Windows PowerShell ISE Host Version : 5.1.14409.1005.
The servers I am trying to pull the information from run a mix of Windows 2008, 2008r2 and 2012r2.
Is there an additional permission or setting I need on the service account? It works for some of the 2008r2 and 2012r2 servers but not all of them and I don't see why.
I know I can get the information I am looking for using Get-WmiObject instead. I just want to know why the above doesn't work.