Board index » Visual Studio » enumerate local computer profiles and delete

enumerate local computer profiles and delete

Visual Studio257
Is it possible to scan a range of machines and delete the profiles of

userids that fit specific userid criteria?



Thanks



Carl


-
 

Re:enumerate local computer profiles and delete

I will assume there is a share c$ on the remote computer and that you have

access to it. I'll also assume the profiles are stored in the "documents and

settings" folder on the c drive. You could do something like this:



set objfso = createobject("scripting.filesystemobject")

computername = inputbox("what computer do you want to delete the profiles

on?")

if (insert code here to match what criteria you want to match)

objfso.deletefile("\\" & computername & "\c$\documents and

settings\profiles\xxxxxx")



wscript.echo "done"

end if



replace xxxxx with the particular profile you are wanting to delete and

create your code for the matching criteria and you'd be good to go.



If you give more specifics regarding what criteria you're wanting to match

and what profiles you want deleted, we could probably be more specific.





"Carl Hilton" wrote:



Quote
Is it possible to scan a range of machines and delete the profiles of

userids that fit specific userid criteria?



Thanks



Carl







-

Re:enumerate local computer profiles and delete

how to make this process generic ... for example, the idea is to either

delete previously created user local profiles on logon or to delete the

current user local profile on logoff.



BTW, that script was very helpfull.



Khaled



"mdiddy" wrote:



Quote
I will assume there is a share c$ on the remote computer and that you have

access to it. I'll also assume the profiles are stored in the "documents and

settings" folder on the c drive. You could do something like this:



set objfso = createobject("scripting.filesystemobject")

computername = inputbox("what computer do you want to delete the profiles

on?")

if (insert code here to match what criteria you want to match)

objfso.deletefile("\\" & computername & "\c$\documents and

settings\profiles\xxxxxx")



wscript.echo "done"

end if



replace xxxxx with the particular profile you are wanting to delete and

create your code for the matching criteria and you'd be good to go.



If you give more specifics regarding what criteria you're wanting to match

and what profiles you want deleted, we could probably be more specific.





"Carl Hilton" wrote:



>Is it possible to scan a range of machines and delete the profiles of

>userids that fit specific userid criteria?

>

>Thanks

>

>Carl

>

>

>

-

Re:enumerate local computer profiles and delete



"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial>wrote in

message news:uzYcNLB%23EHA.2552@TK2MSFTNGP09.phx.gbl...



Delprof is a useful tool, however it is quite limited. You can only specify

to delete all profiles older than a certain age, and/or be prompted for each

one to delete. Too bad there is no option to specify either a specific name

or a wildcard.



/Al



Quote
--



Ray at work

Microsoft ASP/ASP.NET MVP





"Carl Hilton" <someone@microsoft.com>wrote in message

news:%23DlqwEB%23EHA.3472@TK2MSFTNGP14.phx.gbl...

>Is it possible to scan a range of machines and delete the profiles of

>userids that fit specific userid criteria?

>

>Thanks

>

>Carl

>

>









-

Re:enumerate local computer profiles and delete



"Khaled Jaber" <Khaled Jaber@discussions.microsoft.com>wrote in message

Quote
how to make this process generic ... for example, the idea is to either

delete previously created user local profiles on logon or to delete the

current user local profile on logoff.



BTW, that script was very helpfull.



That may, indeed, be all you need. Unfortunately, certain aspects of the

profiles exist in the registry. I would be concerned that, over time,

deleting only the file folder part might leave references in the registry

that could cause problems later on.



/Al



Quote
Khaled



"mdiddy" wrote:



>I will assume there is a share c$ on the remote computer and that you

have

>access to it. I'll also assume the profiles are stored in the

"documents and

>settings" folder on the c drive. You could do something like this:

>

>set objfso = createobject("scripting.filesystemobject")

>computername = inputbox("what computer do you want to delete the

profiles

>on?")

>if (insert code here to match what criteria you want to match)

>objfso.deletefile("\\" & computername & "\c$\documents and

>settings\profiles\xxxxxx")

>

>wscript.echo "done"

>end if

>

>replace xxxxx with the particular profile you are wanting to delete and

>create your code for the matching criteria and you'd be good to go.

>

>If you give more specifics regarding what criteria you're wanting to

match

>and what profiles you want deleted, we could probably be more specific.

>

>

>"Carl Hilton" wrote:

>

>>Is it possible to scan a range of machines and delete the profiles of

>>userids that fit specific userid criteria?

>>

>>Thanks

>>

>>Carl

>>

>>

>>





-

Re:enumerate local computer profiles and delete

Now, this script does NOT delete the HKU entries for the user... does

DELPROF?



Carl





"Khaled Jaber" <Khaled Jaber@discussions.microsoft.com>wrote in message

Quote
how to make this process generic ... for example, the idea is to either

delete previously created user local profiles on logon or to delete the

current user local profile on logoff.



BTW, that script was very helpfull.



Khaled



"mdiddy" wrote:



>I will assume there is a share c$ on the remote computer and that you

have

>access to it. I'll also assume the profiles are stored in the

"documents and

>settings" folder on the c drive. You could do something like this:

>

>set objfso = createobject("scripting.filesystemobject")

>computername = inputbox("what computer do you want to delete the

profiles

>on?")

>if (insert code here to match what criteria you want to match)

>objfso.deletefile("\\" & computername & "\c$\documents and

>settings\profiles\xxxxxx")

>

>wscript.echo "done"

>end if

>

>replace xxxxx with the particular profile you are wanting to delete and

>create your code for the matching criteria and you'd be good to go.

>

>If you give more specifics regarding what criteria you're wanting to

match

>and what profiles you want deleted, we could probably be more specific.

>

>

>"Carl Hilton" wrote:

>

>>Is it possible to scan a range of machines and delete the profiles of

>>userids that fit specific userid criteria?

>>

>>Thanks

>>

>>Carl

>>

>>

>>





-

Re:enumerate local computer profiles and delete

"Al Dunbar [MS-MVP]" <alan-no-drub-spam@hotmail.com>wrote in message



Quote
Delprof is a useful tool, however it is quite limited. You can only

specify

to delete all profiles older than a certain age, and/or be prompted for

each

one to delete. Too bad there is no option to specify either a specific

name

or a wildcard.



Yeah, it'd be nice with some other options, but the tool is meant more for

just deleting than handling that side of things. The criteria that people

use could vary greatly, so I think it's fine to have to handle selecting

which profiles to delete in other ways, i.e. with some vbs code.



Ray at work





-

Re:enumerate local computer profiles and delete



"Carl Hilton" <someone@microsoft.com>wrote in message

Quote
Now, this script does NOT delete the HKU entries for the user... does

DELPROF?



Yes.



/Al



Quote
Carl





"Khaled Jaber" <Khaled Jaber@discussions.microsoft.com>wrote in message

news:F0D0A027-5773-4A3B-9393-72883BAFFE7D@microsoft.com...

>how to make this process generic ... for example, the idea is to either

>delete previously created user local profiles on logon or to delete the

>current user local profile on logoff.

>

>BTW, that script was very helpfull.

>

>Khaled

>

>"mdiddy" wrote:

>

>>I will assume there is a share c$ on the remote computer and that you

have

>>access to it. I'll also assume the profiles are stored in the

"documents and

>>settings" folder on the c drive. You could do something like this:

>>

>>set objfso = createobject("scripting.filesystemobject")

>>computername = inputbox("what computer do you want to delete the

profiles

>>on?")

>>if (insert code here to match what criteria you want to match)

>>objfso.deletefile("\\" & computername & "\c$\documents and

>>settings\profiles\xxxxxx")

>>

>>wscript.echo "done"

>>end if

>>

>>replace xxxxx with the particular profile you are wanting to delete

and

>>create your code for the matching criteria and you'd be good to go.

>>

>>If you give more specifics regarding what criteria you're wanting to

match

>>and what profiles you want deleted, we could probably be more

specific.

>>

>>

>>"Carl Hilton" wrote:

>>

>>>Is it possible to scan a range of machines and delete the profiles

of

>>>userids that fit specific userid criteria?

>>>

>>>Thanks

>>>

>>>Carl

>>>

>>>

>>>









-