View Scheduled Tasks via VNC

adamdaviddoyle

New member
Local time
9:33 AM
Messages
11
I am running windows 7 RC in our corporate environment. We hope to start deploying in october. One issue I have is the ability to view the Scheduled Tasks for an XP machine via UNC path seems to be gone, I can't find any information about re-enabling this. Anyone have any insight?
 

My Computer My Computer

OS
Windows 7
I am running windows 7 RC in our corporate environment. We hope to start deploying in october. One issue I have is the ability to view the Scheduled Tasks for an XP machine via UNC path seems to be gone, I can't find any information about re-enabling this. Anyone have any insight?

Hi Adam,

What method are you currently using to view the Scheduled Tasks on remote machines using a UNC path? :huh: Is it something like WMI or an application?

You can use this WMI script to view all Scheduled Tasks on remote machines, if there connected to a domain network you just need to replace "." after strComputer with the UNC path of the remote machine ;)

WMI Tasks: Scheduled Tasks (Windows)

Code:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\"_
    & strComputer & "\root\cimv2")
Set colScheduledJobs = objWMIService.ExecQuery _
    ("Select * from Win32_ScheduledJob")
For Each objJob in colScheduledJobs
    Wscript.Echo "Command: " & objJob.Command & VBNewLine _
    & "Days Of Month: " & objJob.DaysOfMonth & VBNewLine _
    & "Days Of Week: " & objJob.DaysOfWeek & VBNewLine _
    & "Description: " & objJob.Description & VBNewLine _
    & "Elapsed Time: " & objJob.ElapsedTime & VBNewLine _
    & "Install Date: " & objJob.InstallDate & VBNewLine _
    & "Interact with Desktop: " _
        & objJob.InteractWithDesktop & VBNewLine _
    & "Job ID: " & objJob.JobId & VBNewLine _
    & "Job Status: " & objJob.JobStatus & VBNewLine _
    & "Name: " & objJob.Name & VBNewLine _
    & "Notify: " & objJob.Notify & VBNewLine _
    & "Owner: " & objJob.Owner & VBNewLine _
    & "Priority: " & objJob.Priority & VBNewLine _
    & "Run Repeatedly: " & objJob.RunRepeatedly & VBNewLine _
    & "Start Time: " & objJob.StartTime & VBNewLine _
    & "Status: " & objJob.Status & VBNewLine _
    & "Time Submitted: " & objJob.TimeSubmitted & VBNewLine _
    & "Until Time: " & objJob.UntilTime
Next

There are a few other methods of extracting the information you require, it just depends how you doing it now? :confused:

Steven
 
Well,

Currently we are running Windows XP everywhere and with Windows XP when you hit

\\pcname unc path, the scheduled tasks are just there.

With windows 7 it seems they've removed that functionality. I was hoping it was just a security setting we can toggle off.
 

My Computer My Computer

OS
Windows 7
Can you pass like a %1 variable for the PC name so that you don't have to modify the script file every time and just launch it from the run prompt?
 

My Computer My Computer

OS
Windows 7
I saved that script as a .vbs and run it from the command prompt and it returns no value

C:\>cscript sched_tasks.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

C:\>
 

My Computer My Computer

OS
Windows 7
Well,

Currently we are running Windows XP everywhere and with Windows XP when you hit

\\pcname unc path, the scheduled tasks are just there.

With windows 7 it seems they've removed that functionality. I was hoping it was just a security setting we can toggle off.


Edit: It appears WMI aka vbscript is useless for tasks created using Task Scheduler unless they where created using WMI in the first place.. wtf :shock:

I cant believe this still hasn't been fixed, wtf 2x :shock:

However, suppose you say to yourself, “Hey, as long as I have the Task Scheduler open I might as well schedule a second task.” Let’s say you do so. That task, created by the Task Scheduler, will not be visible to your WMI scripts. The Task Scheduler can deal with tasks created by WMI, but WMI cannot deal with tasks created by the Task Scheduler.
Even worse, suppose you use Task Scheduler to modify the task you originally created with WMI. That task will be successfully modified, but you’ll no longer be able to access it using WMI, even though WMI created the thing in the first place. Yes, we know. And, hopefully, this problem will be corrected in future versions of Windows. And, yes, we know: that doesn’t really help you much right now, does it? Sorry.
You can try these other solutions...

Windows 7 includes PowerShell with much more powerfull scripting and output, you can output to multiple formats (doc, pdf, html...) and present the information in multiple ways...

For example you can output a list of scheduled tasks into CSV format about 2x faster than using the vbscript/WMI above and it aparently works where WMI/vbscript fails :shock:

geekpoet: Powershell script to report on all scheduled tasks in our domain

There are many others but you should be able to give this one a try...

As a last resort you can try re-adding the folder into the Network Shares view.

   Warning
I have no idea if this will work and incorrect security settings set for this key will allow anyone to view/edit remote tasks on that machine, You have been warned!


(I figure you might be able to re-add the folder by doing the reverse of removing it for XP :confused:
Hide the Scheduled Tasks and Printers folder in the network share view )

Goto:

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Explorer \RemoteComputer \ NameSpace
Add the following key:
{D6277990-4C6A-11CF-8D87-00AA0060F5BF}

Like I said I have no idea if its even possible or the repercussions of doing that, I think powershell is the best bet since its fully scripable and seems to work...

If you need some help getting the Powershell script running or modifying it for remote machines let me know and ill see what I can do ;)
 
(I figure you might be able to re-add the folder by doing the reverse of removing it for XP :confused:
Hide the Scheduled Tasks and Printers folder in the network share view )

Goto:

HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Explorer \RemoteComputer \ NameSpace
Add the following key:

{D6277990-4C6A-11CF-8D87-00AA0060F5BF}



I was wondering the same thing, I recall seeing this as a performance tweak for XP to remove the feature. I'll give this a shot on my virtual machine and see if it works!
 

My Computer My Computer

OS
Windows 7
Just rebooted after adding the key

no good :(

I just found this: CodeProject: A New Task Scheduler Class Library for .NET. Free source code and programming help

if you have anyone about the office who knows some C# they can use this library to create a custom application for the same thing but it would need to be run on each machine :(

Give the powershell script a try, there are quite a few of them and from what Ive been reading its the only way your going to be able to retireve the scheduled tasks minus using that library above ;)

If worst comes to worst I can knock up a basic app using that library to accomplish what your after and upload the source-code here, I would prefer not to have to goto that length since powershell is more than capable ;)
 
Thanks for your help, We have a dev here that might be able to (he's pretty tied up so i might not get an answer for a while.)

I've gone to my server guys to see if they can pull reports of this data from our System Center Configuration Manager server (SMS).
 

My Computer My Computer

OS
Windows 7
This is what i'm doing now in the mean time.

I wrote a batch file that utilizes psexec.exe (pstools) and the schtasks dos command

c:\psexec.exe \\%1 schtasks /query /fo table
pause

I saved this as a .bat file and then hit "Start" - "Run" - c:\view_schedtasks.bat PCNAME

This leaves a dos window up that basically looks exactly like what i'm used to seeing through the UNC path.

EXAMPLE OUTPUT:

C:\>c:\psexec.exe \\a24462 schtasks /query /fo table
PsExec v1.85 - Execute processes remotely
Copyright (C) 2001-2007 Mark Russinovich
Sysinternals - www.sysinternals.com

TaskName Next Run Time Status
==================================== ======================== ===============
Backup 03:00:00, 7/25/2009
defrag 21:00:00, 7/27/2009
GPUPdate At logon time Could not start
uncompress 11:00:00, 7/25/2009
schtasks exited on a24462 with error code 0.
C:\>pause
Press any key to continue . . .
 

My Computer My Computer

OS
Windows 7
I am running windows 7 RC in our corporate environment. We hope to start deploying in october. One issue I have is the ability to view the Scheduled Tasks for an XP machine via UNC path seems to be gone, I can't find any information about re-enabling this. Anyone have any insight?

I think by default, all remote management connections to Vista and 7 are disabled. You can re-enabled it in the registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

On the right-hand side, add a new 32-bit DWORD value named LocalAccountTokenFilterPolicy and set the value to 1.

This will also re-enable the system shares like c$

Max
 

My Computer My Computer

OS
Windows 7 x64 RTM
CPU
Intel Core 2 Duo [email protected] Ghz
Motherboard
Asus P5Q-E
Memory
8GB DDR2 800 OCZ
Graphics Card(s)
ATI 4850 512MB
Monitor(s) Displays
HP LP2065
Screen Resolution
1600x1200
Hard Drives
WD Caviar Black 1TB
PSU
Corsair HX520
This allows for the reverse of what i'm looking to do, XP Machines can see Scheduled Tasks on my Windows 7 PC.

I want my Windows 7 PC to be able to see Windows XP Scheduled Tasks via UNC
 

My Computer My Computer

OS
Windows 7
This worked like a champ.. This appears how you need to schedule tasks from windows 7 to windows XP. Even if I ran the batch file under my domain admin account it would say access denied.

For example:
schtasks /create /s pcname /tn "update" /tr c:\update.bat /ru system /sc once /sd 12/14/2009 /st 10:30:00

Gave Access denied.

When I added psexec.exe \\pcname to the beginning of it... it was then able to schedule the task fine.

Final example of what worked for me to schedule a task from Windows 7 to a Windows XP box:

psexec.exe \\pcname schtasks /create /s pcname /tn "update" /tr c:\update.bat /ru system /sc once /sd 12/14/2009 /st 10:30:00

Thanks for pointing me in the right direction.

This is what i'm doing now in the mean time.

I wrote a batch file that utilizes psexec.exe (pstools) and the schtasks dos command

c:\psexec.exe \\%1 schtasks /query /fo table
pause

I saved this as a .bat file and then hit "Start" - "Run" - c:\view_schedtasks.bat PCNAME

This leaves a dos window up that basically looks exactly like what i'm used to seeing through the UNC path.

EXAMPLE OUTPUT:

C:\>c:\psexec.exe \\a24462 schtasks /query /fo table
PsExec v1.85 - Execute processes remotely
Copyright (C) 2001-2007 Mark Russinovich
Sysinternals - www.sysinternals.com

TaskName Next Run Time Status
==================================== ======================== ===============
Backup 03:00:00, 7/25/2009
defrag 21:00:00, 7/27/2009
GPUPdate At logon time Could not start
uncompress 11:00:00, 7/25/2009
schtasks exited on a24462 with error code 0.
C:\>pause
Press any key to continue . . .
 

My Computer My Computer

OS
win7
The Syntax is different for XP and Win7/Vista.

For Windows 7, you need to use :
schtasks /CREATE /RU username /RP password /SC Once /TN taskname /TR "commandline" /ST 08:00 /Z /V1'

The above syntax will schedule tasks to XP systems, windows 2000, etc. Note that the Win7 doesn't use the seconds in the time.

running from XP, you need to use :

schtasks /CREATE /RU username /RP password /SC Once /TN taskname /TR "commandline" /ST 08:00:00

very subtle differences, but apparently significant.

The reason psexec.exe works is that it runs the command on the endpoint, basically scheduling the task from the computer itself (so the above script could drop the /s pcname part after schtasks).
 
Last edited:

My Computer My Computer

OS
Windows 7
Back
Top