Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script for deleting users profile on TS 1

Status
Not open for further replies.

windowsfan

IS-IT--Management
Jan 26, 2007
237
US
I want to use a script in a schedule task and delete users profile on terminal server older than 2 weeks. how can I start?
 
terry712, delprof cannot do what I am trying to do?
Markdmac and smaple script I can use?

thanks for your help
 
Here is a sample that will enumerate the folder and show you the date last modified. You would want to add calling DateDiff to see if it has been 2 weeks and then add a line to delete the folder. Note that I am on Vista so my user profiles are under C:\Users. if you are on XP or 2000 you need to change the BaseDir to point to Documents and Settings.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Would help if I included the code huh?
Code:
Set oFSO = CreateObject("Scripting.FileSystemObject")

Set BaseDir = oFSO.GetFolder("C:\Users")

For Each oFolder in BaseDir.SubFolders
    Wscript.Echo oFolder.Name & " " & oFolder.DateLastModified
Next


I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Thanks Mark,
That should help me to move forward.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top