Jump to content
Sign in to follow this  
MPHillier

Win 7 Profile - Sounding Board.

Recommended Posts

MPHillier

$iComputer = "ComputerName"
For $i = 1 To 100
Local $var = RegEnumKey("" & $iComputer & "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionProfileList", $i)
If @error <> 0 Then ExitLoop
Local $var2 = RegRead("" & $iComputer & "HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionProfileList" & $var, "ProfileImagePath")
ConsoleWrite(" SubKey #" & $i & " under ProfileList: " &  $var & "  " & $var2 & @CRLF)
Next

ConsoleWrite($iComputer & " Complete" & @CRLF)

#include <file.au3>
#include <Security.au3>
$iComputer = "ComputerName"
;func DelProfmulti ()
   $FolderRoot = "" & $iComputer & "c$Users"
   $Folder1 = "ADMINISTRATOR"
   $Folder2 = "ALL USERS"
   $Folder3 = "DEFAULT"
       ConsoleWrite(" Delelet Profile Sent To" & $iComputer & @CRLF)
   $AllFolders = _FileListToArray($FolderRoot, "*", 2)
   If Not @error Then
    For $i = 1 To $AllFolders[0]
     If $AllFolders[$i] <> $Folder1 _
       And $AllFolders[$i] <> $Folder2 _
       And $AllFolders[$i] <> $Folder3 Then
;   ConsoleWrite($sStringSID)
;RegDelete("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionProfileList", $sStringSID)
;DirRemove($FolderRoot & $AllFolders[$i], 1)
       ConsoleWrite($FolderRoot & $AllFolders[$i] & @CRLF )
     EndIf
    Next
   EndIf
       ConsoleWrite($iComputer & " Complete" & @CRLF)

I looked up delprof2 but see its limitations... I created a script that worked with 2003 and below but now that we're migrating to 7 its back to the drawing board...

I just need confirmation that I'm heading in the right direction - any input that would help me get to my intended outcome would greatly be appreciated...

Much Thanks...

Edited by MPHillier

I Break and Fix things... If the surf is up I'm outta here.....

Share this post


Link to post
Share on other sites
MPHillier

Just read that the author of Delprof2 is currently working on adding the exclusion option - Cool. I need the option to keep specific user profiles on each machine and delete the rest which has started me on this task yet I'm still moving forward on an Autoit version. I've also come across "WINAPI DeleteProfile", "WMI Win32_UserProfile", and also powershell version to delete profiles. I've confirmed a few things in my study on the subject and am close to completing my script. Testing looks promising I'll start testing on live images soon.

Edited by MPHillier

I Break and Fix things... If the surf is up I'm outta here.....

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×