Solved

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

Posted on 2011-03-24
16
422 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
Will my email signature work in Office 365?

You've built an email signature using raw HTML code in Office 365, but you can't review how it looks with Transport Rules. So you have to test it over and over again before it can be used. Isn't this a bit of a waste of your time? Wouldn't a WYSIWYG editor make it a lot easier?

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Our Group Policy work started with Small Business Server in 2000. Microsoft gave us an excellent OU and GPO model in subsequent SBS editions that utilized WMI filters, OU linking, and VBS scripts. These are some of experiences plus our spending a lo…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

910 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

21 Experts available now in Live!

Get 1:1 Help Now