Tech Support Guy banner
Status
Not open for further replies.
1 - 20 of 52 Posts

·
Registered
Joined
·
337 Posts
Discussion Starter · #1 ·
Before I embark on this, I am wondering if anyone here knows of any way to get the Task Scheduler in XP to not require credentials even when there is a password on the account.

I already know I can set the registry so that I can have no password on the account and then allow the credential check for the task scheduler to be blank. That I have and have working.

My hopes are that I can set the scheduler up and not have to enter a password at all and even if the client machine has a password, the scheduler will still run.

My only other option is to change their password to nothing and then prevent the client machine from changing their password so it doesn't screw up the task scheduler. I don't want to go down that path.

Any ideas?
I saw that I can use /ru SYSTEM. If I did that, would I still have to enter a password?

Thanks for any tips,

Updated:
Okay, this question has been semi-resolved.
1. I realized that I was not checking the "only run if logged in" checkbox. Now it doesn't rely on password credentials to run.

2. Next question. I am sure there is a way via the command line to check that box however I am not sure what it was. The closest thign I could find was the /NP key for no password however even then it said only local limited resources available if I do that.

I am using schtasks for this.

3. I read that schtasks is not available in Home Edition XP. I don't have a home edition here with me to test currently so I am asking here. Is that true? If so, I will need to add that to my list as well and will have to check for that file on XP systems.

Update2 08-18-09
It appears I am out of luck with utilizing the schtasks in Windows XP. I have attempted to bring the one from Vista and it of course errors out saying it is not a valid Win32 application.

I did have a thought however.

My Goal
To have an interactive exe file ran daily on a computer at a specified time without credential check.
I believe I can utilize the AT Commands for this on XP. Am I wrong?
If I utilize AT for this task, am I wasting my time or can I accomplish the above?
 

·
Registered
Joined
·
9,026 Posts
The System account does not require a password. Tasks run under the System account will not be interactive.
XP Home does not include schtasks.exe, but the one from XP Pro seems to work
I don't think you can set the Run only if logged on box from the command line. Seems like a strange oversight
Never heard of the /NP switch, and it fails on XP. Perhaps you meant /RP?
AT works for XP Home
 

·
Registered
Joined
·
337 Posts
Discussion Starter · #4 ·
Jerry,

The /NP is from Vista. I thought it was available in XP too however that was an incorrect presumption. Works the same as the System except for the user. Does not run interactively.

I am going to attempt something. If I create a batch file and have that call a separate batch file, I wonder if that second one will run interactive. Perhaps the first one will be interactive and who cares.

I will report back with what I find.

Squashman,
If I utilize the AT command, can I get around having to use a password to run the command?

Notes:
My main concern is the fact that I don't want to have to worry when someone changes their password. I don't want to have to change the password in the task.

I know that I can remove their password with net user "%username%" ""
I can then prevent the user from adding a password with net user "%username%" /passwordchg:no
Finally I can change the registry entry limitblankpassworduse to 0 and then I can enter a blank password for the schtasks and not have to worry about a password change.
I can provide a utility for changing passwords at that point in time.

I didn't want to have to go through all of that... lol
I am hoping to get around having to use credentials to run either AT or SCHTASKS.
The preferred method is to still allow user the ability to change their password.

Updated:
The AT command appears to do exactly what I need. One question however. When I create the command:
AT 00:23 /INTERACTIVE /EVERY:M,T,W,Th,F,S,Su "MyPerfectFile.exe"
It saves it as AT1.job inside the Windows/Tasks folder. I would like this to be named something else other than AT1.job such as whatever.job. I went to the command line and did a ren AT1.job whatever.job and it successfully renames however it at that time does not run at its scheduled time.

Does it have to stay named AT1? I wouldn't think the name would have anything to do with the commands. If I leave it as AT1, it works just fine. Any ideas?
 

·
Registered
Joined
·
9,026 Posts
Create a separate account for running scheduled tasks, then add it to the Special Accounts list. It won't show on the Welcome screen or the User Control Panel. It will show in the Local Users and Groups snap in and in Net User, but XP home and Vista Home/Basic don't have that snap in, so it hides it fairly well. Add a comment that the account shouldn't be deleted or have it's password changed and maybe it will be left alone.
 

·
Registered
Joined
·
337 Posts
Discussion Starter · #6 ·
I spoke too soon.

I am having a massive issue with this AT command. It will not see a mapped drive apparently.

I am using robocopy.
In order to begin the robocopy, I merely check to see if the drive is actually there.

Code
Code:
@echo off
IF NOT EXIST Z:\ GOTO _NODRIVEFOUND
IF EXIST Z:\ ECHO We Have a drive.
GOTO _PAUSE
:_NODRIVEFOUND
Echo There must be a problem with AT commands over a network.
GOTO _PAUSE
 
:_PAUSE
pause
The Z Drive is an external hard drive hooked up to another computer on a workgroup.

If I click on the bat file above directly, it works no problem. If I use the AT command, it fails every time with and without quotes around the Z:\

Any ideas?

Updated
Sorry, I am starting to pass out over here. Too tired from the main job. I forgot to give you my AT command.
Here, I have tried the following:

AT 01:07 /INTERACTIVE /EVERY:M,T,W,Th,F,S,Su "C:\Program Files\Spectacular Computer Repair\testat.bat"

AT 01:07 /INTERACTIVE /EVERY:M,T,W,Th,F,S,Su C:\Progra~1\Specta~1\testat.bat

Change the time to your liking.

Am I missing something? Why will this not work when AT handles it and it does work when I click on it or run it from the command line?
 

·
Registered
Joined
·
337 Posts
Discussion Starter · #7 ·
Jerry,

You gave me a good idea. Tell me if this is possible before I waste my time doing this.

This is for stand alone systems and not for a domain.

Step 1: I set the registry entry so that it can accept blank passwords.
Step 2: Under an administrator account, I can erase the password for the Administrator account.
Step 3: I make it so that the administrator password cannot be changed.
Step 4: I shedule the task to run with Administrator Credentials.

I could also modify that by creating a random password and changing the Administrator account to be a random password. I could place a document file on their desktop somewhere stating what the Administrator password is.

Thoughts?

Off to bed for me.
 

·
Registered
Joined
·
337 Posts
Discussion Starter · #8 ·
Okay,

I haven't gone to bed yet. I think I found something. I believe I just have to compile it and test it. On sourceforge there was some open source software for task scheduler that creates .job files and allows me to utilize run only if user is logged on. It took me forever to find that. NOBODY made one that had a command line interface. It was all GUI. Some really nice stuff, but not command line.

Link: http://sourceforge.net/projects/pyt...eduler_1.0/pytaskscheduler_22_23.zip/download

If I can utilize that, my issues will be resolved.
 

·
Registered
Joined
·
9,026 Posts
Drives are mapped on a per user basis. Anything scheduled using AT runs under the System account, so it won't see drives mapped under any other accounts. You'll have to map the drive from within the task itself.

If you use Net Use /persistent:yes, the drives will remain mapped even after a reboot, so they would only need to be mapped once for the System account.
 

·
Registered
Joined
·
337 Posts
Discussion Starter · #12 ·
hmmmmm,

Jerry, I then have another question which will actually help me out in a few ways but currently more for learning and here at home.
1. How do I map a drive from a batch file?
2. Is there a way that I can detect a shared resource.

Example:
My son's computer has an external drive attached to it.
That drive on his computer is drive f:\
That drive is shared on the network.

Is there a way to automatically
1. Detect that shared resource.
2. Be able to distinguish that it is an external drive instead of just a shared folder on the system root.
3. Map it to a drive letter that is not currently in use on my computer local computer.
 

·
Retired Trusted Advisor
Joined
·
19,786 Posts
hmmmmm,

Jerry, I then have another question which will actually help me out in a few ways but currently more for learning and here at home.
1. How do I map a drive from a batch file?
He just showed you how. net use.

You map a drive to another computer by using the computer name and share name.
\\computername\share

So there is no real reason to try and detect it remotely.
 

·
Registered
Joined
·
337 Posts
Discussion Starter · #15 ·
Can it be done however? If I wanted to automatically detect the network shares. Can it be done?

(I just got your second post on my cell. Thanks. I was just looking that up with net use /?) I didn't realize that net use was how to map it. I thought it was just talking about the persistent yes.

I am curious if it the network shares can be detected automatically, if so, how. I am also curious if from the command line it is possible to determine whether that shared resource is an external drive and finally if it is possible to automatically assign a drive letter to it that is not in use on the current user.

If that is possible, I would like to incorporate that at work when backing up peoples data over the network. That would make things so much easier. That's why I mentioned that if it is possible, that would help me out in a few different ways however I can also utilize that here at home too.
 

·
Retired Trusted Advisor
Joined
·
19,786 Posts
I guess I am not seeing your point this exercise. If you have a shared resource on the network why would you go searching for it and then try to map to it.

I don't think there is anyway to determine if the share is a internal or external hard drive attached to the pc.

If you want to backup to it, just call the share name BACKUP.

Yes there are ways to detect shares on remote computers but you would waste all kinds of time and resources if you had to scan the entire subnet every time to do this. And why would you want to do this just for backup. Makes no sense to me. If you want to backup to a network share then just back it up to there.

You sure like to make things harder than they have to be.
 

·
Registered
Joined
·
9,026 Posts
Check out Net View and Net Use
Net View \\pcname will show the shared resources, but there is no way to tell if it's an internal or external disk unless you include that in the share name.
The error 67 is because you forgot the colon:
net use Z: \\Matts-laptop\f /Persistent:Yes

Mapping the same share to two different drive letters can sometimes cause issues, so I use the following routine to check to see if a share is already mapped. If it is, it returns the drive letter. If not, it maps the share to the next available drive letter and returns the drive letter.
It also returns a flag to indicate whether the share was already mapped, or was just created. This flag can be used to let you delete shares you create, while leaving shares that already existed alone. Users get upset when you delete their mapped drives for some reason.:eek:

Code:
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::                    Subroutines
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:_MapChk
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Checks if a share is already mapped.
:: Arguments : "SharePath" returnvariable flagvariable [username [password]]
:: Returns   : Drive letter in returnvariable
::           : Flagvariable set to 0 if already mapped, 1 if new map
:: Usage
:: Call :_MapChk "path" rname fname [username password]
::      "path"   : Share to be mapped. Must be in quotes
::      rname    : This variable will be set to the mapped drive letter
::      fname    : Set to 0 if drive already mapped, 1 if a drive was mapped
::      username : Username to be used. Enter * if you wish to use currently logged on user
::      password : Password to use. Enter * if you wish to be prompted
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Setlocal EnableDelayedExpansion
If [%4]==[] Goto _Pchk1
Set _User=
If %4==* Goto _Pchk1
Set _User=/user:%4
:_Pchk1
Set _Pass=
If NOT [%5]==[] Set _Pass=%5
Set _t1=%~1
For /L %%I In (5,1,26) Do If NOT "!_t1:~%%I,1!"=="" Set _len=%%I
If !_len! LEQ 24 (
:: Pad with 20 trailing spaces and a period
  Set _t1=!_t1!                    .
  Set _t1=!_t1:~0,25!
  )
:: Add one trailing space and a period
Set _t1=!_t1! .
:: Trim off period
Set _t1=!_t1:~0,-1!
Set _Flag=0
:_MapChk1
For /F "Tokens=2*" %%I In ('net use ^|Find /I %1') Do (
 Set _Found=%%J
 Set _Found=!_Found:Microsoft Windows Network=!
 If /I !_Found!==!_t1! Set _PDrv=%%~dI
 )
If NOT [%_PDrv%]==[] EndLocal&Set %2=%_PDrv%&Set %3=%_Flag%&Goto :EOF
Set _Flag=1
Net Use * %_Pdrv% %1 %_User% %_Pass%
If NOT Errorlevel 1 Goto _MapChk1
EndLocal&Goto :EOF
Example of usage in my backup script:
Code:
Call :_MapChk "\\%_PCName%\AllUsers$" _Drv _DF
xcopy %_sw% %_Drv%\ "U:\Backups\%_PCName%\AllUsers" /exclude:xcldlst2.log+xcldlst3.log
If %_DF%==1 net use %_Drv% /DELETE
 

·
Registered
Joined
·
337 Posts
Discussion Starter · #19 ·
Point to the exercise is to learn. I will pick up anything I can and like to learn. I have numerous projects all the time and whatever I can learn to make things easier on me the better.

Obviously I did not know what it would take in order to accomplish that otherwise I would not have asked.

And God, oops I mean Jerry, seems to be a wealth of knowledge and always knows something that is extremely user-friendly and has never ceased to amaze me. When he does something, it just works. If I can learn from anyone willing to share, I will ask. I learn from any resource possible and as much as possible.
 
1 - 20 of 52 Posts
Status
Not open for further replies.
Top