Solved

I need a process/script for deleting multiple manditory profiles.

Posted on 2011-03-24
16
419 Views
Last Modified: 2012-08-14
I work at a college where I am the PC technician.  We have implemented mandatory profiles for all the students on lab computers which are running Windows 7.  I need to find a way to either implement a script that will delete the mandatory profile at log off (on client machine) or run a script that will delete all mandatory profiles on the client machine at once.  My problem is obvious, there are several profiles being saved on each machine.  Also, for some reason when the user logs in more than once he/she is not able to access any secure web site such as their school email.  The only way I can get them to be able to access those web sites is to delete their profile and have them login again creating a new profile.
I have asked networking regarding a Group Policy on this, but it is not a option.
Any, help on this is greatly appreciated.
0
Comment
Question by:RMG1
  • 5
  • 5
  • 2
  • +2
16 Comments
 
LVL 8

Expert Comment

by:spinzr0
ID: 35212660
You're looking to delete all profiles under c:\users?  Additionally, is UAC enabled?
0
 
LVL 6

Expert Comment

by:mkuehngoe
ID: 35214299
your mandatory profile is on th client machines? Usually it is placed on a share on a server. After logoff you can delete the profile on the client by GPO using this one:
MACHINE      Administrative Templates\System\User Profiles      Delete cached copies of roaming profiles
0
 

Author Comment

by:RMG1
ID: 35215180
Thank you both for commenting.

Spinzr0: There is a local admin account that I use to get into the machine as a back door.  I want to keep that but get rid of the student’s profiles.  Also, UAC is turned off.

Mkuehngoe: What I am trying to get rid of is the roaming profile that is created on the local machine at first login.  There are so many now it is becoming a problem.  I am aware of GPO, but also wanted to know if there was a way to do it at a local level.  Some type of script or something.
0
 
LVL 8

Expert Comment

by:spinzr0
ID: 35218543
This should actually do it for you.  If you want it re-worked to delete everything but a few specific profiles its fairly easy. Let me know if you nee dhelp with it.

http://boeprox.wordpress.com/2011/01/27/use-powershell-to-remove-local-profiles/
0
 

Author Comment

by:RMG1
ID: 35218799
spinzr0: Thank you, I will try it on Monday and let you know how it works out.
Have a good w/e.
0
 
LVL 8

Accepted Solution

by:
spinzr0 earned 500 total points
ID: 35218921
you too.
0
 
LVL 6

Expert Comment

by:mkuehngoe
ID: 35221589
For XP or w2k you can use this VBS:

Const LocalDocumentsFolder = "C:\Dokumente und Einstellungen\"

set objFSO = createobject("Scripting.FileSystemObject")
set objFolder = objFSO.GetFolder(localdocumentsfolder)

on error resume next

for each fldr in objFolder.SubFolders
      if not isexception(fldr.name) then
            objFSO.DeleteFolder fldr.path, True
      end if
next


Function isException(byval foldername)
      select case foldername
            case "All Users"
                  isException = True
            case "Default User"
                  isException = True
            case "LocalService"
                  isException = True
            case "NetworkService"
                  isException = True
            case "Administrator"
                  isException = True
            case Else
                  isException = False
      End Select

End Function

Subsitue the constant with your local language folder. Be aware this only works for XP. Under vista or win7 the entries in the registry have also to be deleted or you are running in trouble. We deployed the script by GPO for machines in a school where hundreds of local profiles existed. You can set more exceptions if you like.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:RMG1
ID: 35234188
Mkuehngoe: Thank you for taking the time to answer my question on this.  We do have some XP machines and even though we are not having the same problem with them as with the Windows 7, it will be nice to have for anything not Windows 7.

Spinzr0:
The script you provided worked well.  I need to tweak it though so that it will delete only mandatory profiles and not local profiles off the client machine and delete them in mass quantities, Is this possible?  
If that is not possible, maybe giving it a range when it asks what profile such as 1-50 and the end result being number 1 through 50 deleted.  At least I could see what I was deleted and avoid deleting the local admin account.
I plan on having the script on a thumb drive that I can carry with me.
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 35934472
I've requested that this question be closed as follows:

Accepted answer: 250 points for mkuehngoe's comment http:/Q_26910337.html#35221589
Assisted answer: 250 points for spinzr0's comment http:/Q_26910337.html#35218543

for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
 
LVL 8

Expert Comment

by:spinzr0
ID: 35934473
He said my solution worked, he wa just going to tweak it for his needs.  I had the correct answer.
0
 
LVL 8

Expert Comment

by:spinzr0
ID: 35938181
I would have to again object. The other answer is for the wrong OS. I have the same code for XP but the question was for Win 7. Its not relevant.
0
 

Expert Comment

by:South Mod
ID: 35938182
I've requested that this question be closed as follows:

Accepted answer: 250 points for spinzr0's comment http:/Q_26910337.html#35218543
Assisted answer: 250 points for mkuehngoe's comment http:/Q_26910337.html#35221589

for the following reason:

All,<br />&nbsp; <br />Following an 'Objection' by spinzr0 (at <a href="http://www.experts-exchange.com/Q_27087735.html">http://www.experts-exchang<wbr />e.com/Q_27<wbr />087735.htm<wbr />l</a>) to the intended closure of this question, it has been reviewed by at least one Moderator and is being closed as recommended by the Expert.<br />&nbsp;<br />At this point I am going to re-start the auto-close procedure.<br />&nbsp;<br />Thank you,<br />&nbsp;<br />SouthMod<br />Community Support Moderator
0
 

Author Closing Comment

by:RMG1
ID: 35939022
spinzr0  should get full points, it was Windows 7 that I was looking to get an answer for in  regards to my qustion.
0
 

Author Comment

by:RMG1
ID: 35939048
Also, the reason this was not closed and point given was that my 17yr daughter had tried to take her own life twice so it has been very crazy here, sorry guys.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Ever notice how you can't use a new drive in Windows without having Windows assigning a Disk Signature?  Ever have a signature collision problem (especially with Virtual Machines?)  This article is intended to help you understand what's going on and…
A Bare Metal Image backup allows for the restore of an entire system to a similar or dissimilar hardware. They are highly useful for migrations and disaster recovery. Bare Metal Image backups support Full and Incremental backups. Differential backup…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now