This topic contains 2 replies, has 2 voices, and was last updated by
March 5, 2014 at 11:53 am #13592ParticipantPoints: 0Rank: Member
I'm pretty new to PowerShell. I have about 200 hyper-v servers running 2008, 2008R2 and 2012 server. I need a list of scheduled tasks for each server, but I'm only interested in the non-microsoft tasks. I believe I have figured out how to do that by using -taskpath "\", however, my script is only working against the 2012 servers in my domain. The errors on the other servers seem to indicate that I need to run "WinRM quickconfig" in order to be able to remotely manage the machines. Also, after running "WinRM quickconfig" on a few to test my theory, I was able to connect to them with my PowerShell script, but they don't recognize the Get-ScheduledTask cmdlet. If I'm understanding this all correctly, I could install the PowerShellPack.msi onto each of the 2008/2008R2 servers, run "WinRM quickconfig" on each server, then my script would work for all of those the same way it's working for the 2012 servers. This seems like an incredible amount of work to run a script that's supposed to save me from having to log into each of these machines in the first place. I guess what I'm asking is this: Is there a better way to do this than what I've described? Is there some easier way to go about this in my situation?
March 5, 2014 at 12:13 pm #13593KeymasterPoints: 1Rank: Member
Get-ScheduledTask is a feature of specific versions of Windows, not a version of PowerShell. Ergo, it doesn't exist on some of your computers.
"WinRM quickconfig" isn't the best way to enable Remoting. Enable-PSRemoting is the correct way to do so. However, simply enabling Remoting doesn't make cmdlets available on computers – Remoting is just a communications protocol.
PowerShellPack.msi isn't a Microsoft thing – I'm not familiar with it.
So, short answer to your question, you seem to have thrown a bunch of spaghetti at the wall, and only some of it stuck :). I think before you do anything else you might want to fall back and read up a bit on PowerShell, because you're definitely overkilling it.
Have you considered just using WMI? It exists on every Windows computer. You can run Get-WmiObject to retrieve scheduled task information from remote computers. See http://msdn.microsoft.com/en-us/library/aa394399(v=vs.85).aspx for the Win32_ScheduledJob WMI class.
March 5, 2014 at 12:17 pm #13594KeymasterPoints: 1Rank: Member
Oh, correction – I see PowerShellPack.msi. Sorry, I saw that and thought of PowerGUI for some reason, since it uses PowerPacks.
Anyway, yes, PowerShellPack.msi is the installer that brings some of the up-level command modules to down-level versions of Windows. But I might still tackle this with WMI. I'm not sure the PowerShellPack works on Win2008 (which is Vista-quivalent), for example.
The topic ‘Newb question about Get-scheduledtask’ is closed to new replies.