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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBS version of delprof? 1

Status
Not open for further replies.

58sniper

MIS
Apr 25, 2004
9,152
US
Has anyone done a vbs version of the delprof utility from the resource kit?

delprof will delete Windows profiles that meet a certain criteria, such as time since it was last used (ie 180 days).

The problem is that it runs in a login script, which runs under the user context. Delprof requires local admin rights to delete profiles, which I'd rather not grant.

So, if someone has an idea how I could do this via vbs, I could tie it to a machine OU and run it in the machines logon script.

Ideas?

Pat Richard, MCSE MCSA:Messaging CNA
Microsoft Exchange MVP
Want to know how email works? Read for yourself -
 
Have you tried to run delprof in a startup script ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I did a script like this that reads the user directories then tries to bind to that user in AD and if they are not found then deletes the profile.

Only problem of course is that this method does not clean up the registry.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
I can't run it in a user login script because the users aren't local admins. I was thinking about putting it in a machine script, but wanted to see if there was a vbs solution first.

Pat Richard, MCSE MCSA:Messaging CNA
Microsoft Exchange MVP
Want to know how email works? Read for yourself -
 
I used this script a while back. Not sure if it will help you.

Set objOU = GetObject ("LDAP:// OU=<OU>,OU=<OU>,DC=<DC>")
objOU.Filter = Array ("Computer")
For Each ObjComputer In objOU
strName = objComputer.Name


strlen = len(strName)
size = strlen -3
strComputerName = Mid(strName, 4, size)
WScript.Echo strComputerName
Set objShell = CreateObject("Wscript.Shell")
cmdString = "delprof /p /c:\\" &strComputerName
objShell.Run cmdString

Next


The /p actually prompts for deletion. You can use any of the following switches to modify this script to your needs.

Key
/Q Quiet, no confirmation.

/I Ignore errors and continue deleting.

/P Prompts for confirmation before deleting each profile.

/C:\\computer_name
Delete profiles on a remote computer.

/D:Number_of_days
Only delete profiles that have been inactive for
'X' Number of days (or greater)

/R Delete roaming profile cache only ##

 
A star for you, Rambeaux007, but a question as well.

If I wanted to run that in a machine script, and not from a server, how could I do that, passing along the /q /i /d:180 parameters?

Pat Richard, MCSE MCSA:Messaging CNA
Microsoft Exchange MVP
Want to know how email works? Read for yourself -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top