Skip to content

Script to delete files and SCCM's help

Featured Replies

Hi,

 

What is the best way to make sure files from a folder is regularly deleted ? A script that would do that which can be deployed using SCCM or a script that would be deployed by SCCM that will make use of Task Scheduler ?

Depends on the requirements... When all the machines are connected to the network all the time, then I would use SCCM with a rerunning advertisement. Otherwise I would use SCCM once to create a scheduled task, so it will always run even if the machine is not connected to the network..

  • Author

Hi Peter,

 

I need to run a script on hundreds of machines.This script would delete the files from a particular folder on a weekly basis and on a particular time.Is my follwing steps right ?

 

1) Create a scheduled task using vbscript or powershell.This would also take care that it runs when the user is logged on

 

2) Deploy the script using SCCM

 

 

Or

 

2) Deploy the script using Group policy

 

 

All the workstattions are connected to the network all the time.

Hi,

 

If you know that your computers are on all the time then you can have the script on an admin computer or server and make only one schedule.

As long as your computers firewalls or policys in any way doesent probit that you access your computers from another computer like \\computer\c$\pathtofiletodelete.

 

If you don't like to create schedule tasks for every computers you can make a script that you run with a group policy when your computers starts and If it's the right day of the month the file is deleted.

 

If you want to use schedule tasks then I think you should deploy them with group policy.

 

Best Regard,

Fredrik Wall

If you need any help with the script just post a question here and I try to help you.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.