| |

VerySource

 Forgot password?
 Register
Search
View: 1836|Reply: 6

Is there any difference between a scheduled task run by the system account and a scheduled task run by your own account?

[Copy link]

1

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-12-7 18:00:01
| Show all posts |Read mode
I have a script whose role is to create a new folder with today's date, and then delete the folder more than 4 days apart from the current date. The specific content of the script is as follows:
On Error Resume Next
a = Date
b = Replace(a, "-", "_")
delDate=4

Set oShell = WScript.CreateObject("WScript.Shell")
Set fs = CreateObject("Scripting.FileSystemObject")

If Not fs.FolderExists ("D:\backup\"&b) Then
fs.CreateFolder("D:\backup\"&b)
End If

Set fd = fs.getfolder("D:\backup")
for each sbfd in fd.subfolders
     if (date-CDate(replace(sbfd.name,"_","-")))> delDate then
         fs.DeleteFolder(sbfd.name)
     end if
next

Set oshell = nothing
Set fd = nothing
Set fs = nothing

Execute this script directly under the command line and it can succeed. Then I directly created a task to execute the script in the "Control Panel" -> "Scheduled Tasks" (this task is run by my own account), and executed the task successfully. Then I used the at command to create a new scheduled task (at 15:00 d:\backup\backup.vbs, the task is run by the system account by default), but when the task is executed, only a new folder can be created, and the file cannot be deleted Folder, I double-checked and found that the "fs.DeleteFolder(sbfd.name)" statement could not be executed smoothly. The security permissions of my folders are set to full control by everyone. The operating system is windows server. Why can't the scheduled task run with the system account execute this statement? What is the difference between running a scheduled task with the system account and running a scheduled task with a normal account? Can the scheduled tasks executed by the system account fail to execute certain tasks?
Reply

Use magic Report

0

Threads

21

Posts

19.00

Credits

Newbie

Rank: 1

Credits
19.00

 Australia

Post time: 2020-12-7 23:00:01
| Show all posts
The security permissions of my folders are set to full control by everyone
----------------
You can add the system account to the folder permissions first. It is possible that the system account does not exist in the everyone group.

Local System account
A predefined local account used to start the service and provide the security context of the service. The account name is NT AUTHORITY\System. This account has no password, and any password information you provide is ignored. The local system account has full access to the system (including the directory service on the domain controller). Since the local system account is used as a network computer, it has access to network resources.
Reply

Use magic Report

1

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-12-7 23:30:01
| Show all posts
I tried this, but it still doesn't work
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-12-7 23:45:01
| Show all posts
The original poster is really good-_-!!! The idea of ​​opening a SYSTEM account is coming.

I would like to ask you what was filled in the password when you specified the SYSTEM account to run the scheduled task? Haha, in fact, you can create a new account to replace it, isn't it all right?
Reply

Use magic Report

1

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-12-8 00:45:01
| Show all posts
When using the at command to create a scheduled task, you do not need to provide a password. The generated scheduled task is run by the system account by default. The key is I want to know what are the limitations of scheduled tasks performed by system users?
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-12-8 01:00:01
| Show all posts
The administrator has a subordinate relationship with the user created by himself. Under normal circumstances, you can see your user and guest from the administrator, and you can change the attributes inside, but you can't change the administrator.
Reply

Use magic Report

0

Threads

9

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-12-8 15:00:01
| Show all posts
When you use the SYSTEM user in the scheduled task, how much do you fill in the password? Don't say it is blank. In that way, you actually become the guest executing
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list