View Full Version : How to check if install is running on a Windows server (vs. workstation)?
elriba
04-02-2012, 09:59 AM
Hi,
I need to add entries to the task scheduler, but I only want to do it if I'm installing on a server machine.
I already know how to add to the task scheduler. What I need to know is how to check if I'm running on one of the windows servers...
Thanks,
Edgard
linder
04-02-2012, 10:12 AM
Edgard,
What you can try is the "Get System Information (Windows Product Type)" script function. This lets you retrieve additional information about the Windows system. It can be one of the following values:
$VER_NT_WORKSTATION$—The system is running Windows Workstation.
$VER_NT_DOMAIN_CONTROLLER$—The system is a domain controller.
$VER_NT_SERVER$—The system is a server.
Does this help?
Friedrich
elriba
04-02-2012, 11:11 AM
Hi,
Thanks for the reply. It works fine in that the dialog only displays when running on a server.
However the problem is that the task is not added on the server :-) I re-read the documentation for "Add Scheduled Task" and surely enought it doesn't mention servers.....
Is it possible to add scheduled tasks to a server?
Thanks again,
Edgard
linder
04-02-2012, 11:34 AM
Edgard,
Yes, should work fine on Windows Server <g>
http://msdn.microsoft.com/en-us/library/windows/desktop/aa446802(v=vs.85).aspx
Just tested it on Server 2008 R2 and it created the "My Taskname" without any problem.
HTH,
Friedrich
elriba
04-02-2012, 12:14 PM
Hi again,
Ok. It is working now partially.
I have a couple of requirements which might not be that easy to achieve....
1) I need to fill the "Location" field (which sets the working folder). The "Add Scheduled Task" function doesn't have an entry for this.
In my case this is important because the executable I want to run gathers information from other files on the startup folder (i.e. the folder where the executable is located at). If there is no startup folder, it looks for files on a windows folder.
2) The other problem I have is that I need to run the task at 10,12,2PM,4PM,6PM,8PM,9PM,10PM,11PM,12AM,1AM. Can this be done?
I tried adding the task repeatedly, each time with the next hour, but after the first task is added, all the next fail.
Sorry for all the trouble,
Edgard
linder
04-03-2012, 02:42 AM
Edgard,
1) In the upcoming V7.7, you can set the "Working Directory" (see attached screenshot).
I don't have a good answer to 2). In V7.7 there is a "Repeat Task (Minutes)" option but as I understand it, your "repeat task" is not constant.
BTW, the task name has to be unique! If you add the task repeatedly and it fails then you tried to add the same task (name) twice. Windows does not allow this.
HTH,
Friedrich
elriba
04-03-2012, 08:12 AM
1) In the upcoming V7.7, you can set the "Working Directory" (see attached screenshot).
That is great! Hopefully V7.7 will come out soon :)
I don't have a good answer to 2). In V7.7 there is a "Repeat Task (Minutes)" option but as I understand it, your "repeat task" is not constant.
Yes, I need to repeat in a non-constant manner. Manually you can set it up (see attachment), but it is not as essential. Maybe in a future version you can add this.
Thanks!
Edgard
linder
04-04-2012, 07:44 AM
That is great! Hopefully V7.7 will come out soon :)
It's available now ;)
Friedrich
elriba
04-04-2012, 03:48 PM
Hi Friedrich,
Great news! I already downloaded it, and tested it. I added my task to the Task Scheduler, and compromised by setting the "Repeat Task" to 90 minutes, and the proper startup folder.
When the task is added, the setting "For a duration of" gets a 1 day only setting. I went ahead and changed it manually to "Indefinitely".
I guess this is something you might want to look at...
Thanks,
Edgard
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.