Jump to content

ChrisMiles

Members
  • Posts

    410
  • Joined

  • Last visited

Everything posted by ChrisMiles

  1. Theres quite a lot of problems with that script, for example it re-queries wmi for a Win32_UserProfile object it already has before deleting it, also the code to iterate through registry entries looking for profile paths which shouldn't be deleted isn't needed because we already queried WMI for profile information. I've rewritten the script here which runs on my PC without error at least: On Error Resume Next Const HKEY_LOCAL_MACHINE = &H80000002 Dim objShell, objFSO, objProfilesFolder, objProfileFolder, objWMIService, objRegistry, colProfiles, objProfile, dicFoldersInUse, sProfilesFolderPath, sProfileFolderPath Set objShell = CreateObject("WScript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objWMIService = GetObject("Winmgmts:\\.\root\cimv2") Set objRegistry = GetObject("Winmgmts:\\.\root\default:StdRegProv") Set dicProfilePaths = CreateObject("Scripting.Dictionary") Set colProfiles = objWMIService.ExecQuery("Select * From Win32_UserProfile") If Err.Number <> 0 Then WScript.Exit End If If Not colProfiles Is Nothing Then For Each objProfile in colProfiles If objProfile.Special = False And objProfile.Loaded = False And Left(objProfile.SID, 8) = "S-1-5-21" And objProfile.LocalPath <> "" And InStr(1, objProfile.LocalPath, "administrator", 1) = 0 Then Err.Clear objProfile.Delete_ If Err.Number = -2147024751 Then objFSO.DeleteFolder objProfile.LocalPath, True Else MsgBox "Error" End If Else dicProfilePaths.Add LCase(objProfile.LocalPath), objProfile.SID End If Next End If objRegistry.GetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList", "ProfilesDirectory", sProfilesFolderPath sProfilesFolderPath = LCase(objShell.ExpandEnvironmentStrings(sProfilesFolderPath)) Set objProfilesFolder = objFSO.GetFolder(sProfilesFolderPath) For Each objProfileFolder in objProfilesFolder.SubFolders sProfileFolderPath = LCase(objProfileFolder.Name) If (sProfileFolderPath <> "default" And sProfileFolderPath <> "default user" And sProfileFolderPath <> "public" And sProfileFolderPath <> "all users") Then sProfileFolderPath = sProfilesFolderPath & "\" & sProfileFolderPath If Not dicProfilePaths.Exists(sProfileFolderPath) Then objProfileFolder.Delete End If End If Next
  2. I've found 0.30 to be buggy as hell with our computers, I'll have to rebuild the box with 0.29 again before the next time we re-image.
  3. Hey again GreyFox, glad you got something working. If you are having problems deploying your image to a smaller disk (and assuming that your disk is actually big enough for the data ) it sounds like you are using an image of type Single Disk (Not Resizable), is this correct? For a Windows 7 build with 2 partitions (the little one and the main one) it is safe to use Single Partition (Resizable). Assuming you set the computers OS to Windows 7 FOG will handle the extra partition automatically.
  4. Try using a linux boot disk to blat the hard disk, the disk should autoboot instead of giving the "Press a key to boot from cd...." message if no bootable partitions exist, maybe this will get round the issue?
  5. Instead of making your own shortcuts try copying the ones from the default start menu (the ones installed with the application). You may find these work better. It looks to me like some kind of security issue, maybe zone security? What happens when you double click the broken link, does it ask if you're sure you want to run it?
  6. Never done it myself, but this seems like a good place to start: Building a Custom Kernel - FOGProject Wiki
  7. The staff here complained bitterly when an update to the SMART software introduced this message so to get around it I used a logon and log off group policy script along with this Microsoft tool: The DevCon command-line utility functions as an alternative to Device Manager To disable the tablet devices and enable them on logon only when needed: logon: devcon enable 57985508-6DB9-4C9C-AFF2-3A74A53298A6 devcon enable CC45A915-1CA1-4997-817F-FFB4853FA440 logoff: devcon disable 57985508-6DB9-4C9C-AFF2-3A74A53298A6 devcon disable CC45A915-1CA1-4997-817F-FFB4853FA440
  8. ChrisMiles

    ei.cfg

    It may sound really stupid but you can get disks with only one edition, may make things easier?
  9. Yeah sorry, typo there i meant you cant do remote log offs with shutdown.
  10. Nope you cant do remove log offs using shutdown only restarts and shutdowns. Easiest way on windows 7 is to use terminal services logoff command: logoff console /server:computer
  11. Also, your hitting this 3 activation limit because your install is not activating on your kms server which prevents this issue. Windows is complaining because your circumventing the grace period by syspreping repeatedly. Add this section to you oobeSystem pass section to force windows to activate on your KMS server during sysprep. Note the key is for win 7 enterprise, if your using another version get the keys here: Access Windows 7 KMS Client Setup Keys - Softpedia 1 false cscript //b c:\windows\system32\slmgr.vbs /ipk 33PXH-7Y6KF-2VJC9-XBBR8-HVTHH 2 cscript //b c:\windows\system32\slmgr.vbs /ato false
  12. You can add a command to your xml file to enable the administrator account during sysprep. Add a synchronous command to your specialze sction using the app or paste in: 1 net user administrator /active:yes
  13. Even if you enable fast user switching you cannot unlock the user's session, the best you could do is log on with another account. There is no way to unlock the session on windows 7. Very annoying. Pretty much all you can do is shutdown/restart the machine or force a log off.
  14. Its not the fault of your image, its how kms works. Unlike mak activations, kms knows if a computer has been activated before and does not count it as an extra activation. Computers with KMS reactivate quite frequently with the server anyway. Image a different computer and the count will go up I'm sure.
  15. The Windows 7 Key in my file paste is a generic key which tells windows 7 to look for a KMS server, it is not specific to me. I suggest you include those commands to make sure that windows activates right away. Access Windows 7 KMS Client Setup Keys - Softpedia If your file looks like mine pretty much then it should work fine, just sysprep the machines by putting the unattend.xml file in c:\windows\system32\sysprep and run sysprep /generalize /oobe /shutdown /unattend:unattend.xml from a command prompt in that folder. Once the machine syspreps and shuts off queue up an upload job on fog and there you have it. To make your image work on different types of computers firstly you need to make sure the follow sections are in your xml file: true true These sections in the file instruct windows to not remove devices and device drivers during sysprep. Once you have these lines all you need to do is one by one image you different models with your base image, install drivers, re-sysprep and re-upload. Then move on to the next model. By the time you've imaged and re-uploaded your image from one of each of your different models the windows 7 will have device information and drivers for everything you need. This was not possible with windows xp because it didn't fully reinstall all the hardware and drivers during sysyprep. Hope this helps. All I can advise is to try your script out and see what happens, I didn't get mine right the first time. Maybe upload a non-syspreped image of your build before you start though because if sysprep fails for any reason it leaves windows in a completely broken state and you'll have to rebuild.
  16. Just remember, if you use MAK, once you use an activation its used forever. The activation servers don't care that a machine has activated before, if you have to reimage/reinstall a mak activated copy of windows 7 for whatever reason, activating it again will use a 2nd activation, therefore you might run out eventually (like I did ). Microsoft will normally give you more but KMS is definitely worth the time to configure.
  17. Its not really geared for a startup script, theres loads of output in there which can be stripped out. This would work better if all you want is to trash all user profiles in the machine logon script. Youll also need to ensure that this runs directly via cscript in the machine startup batch. If you let it run in wscript the computer wont wait for it to finish and users might be able to log in while its still running: Dim objFSO, objWMIService, colProfiles, objProfile Set objFSO = CreateObject("Scripting.FileSystemObject") Set objWMIService = GetObject("Winmgmts:\\.\root\cimv2") Set colProfiles = objWMIService.ExecQuery("Select * From Win32_UserProfile Where SID Like ""S-1-5-21%"" And Not LocalPath Like ""%Administrator%""") If Err.Number <> 0 Then WScript.Exit End If If Not colProfiles Is Nothing Then For Each objProfile in colProfiles Err.Clear objProfile.Delete_ If Err.Number = -2147024751 Then objFSO.DeleteFolder objProfile.LocalPath, True End If Next End If
  18. We use Fog 0.29 and now 0.30 to roll out windows 7 images to hundreds of computers and laptops in our school and it works perfectly fine. I can say 100% for sure that netdom is not needed (hostnamechanger.dll uses API calls to join the domain now), fogprep (whatever it does) is not needed because I never new it even existed until reading this thread and you can (and in fact must) sysprep a windows 7 install and upload an image from that without any problems at all. If you sysprep your windows 7 install correctly before you upload it, it will work fine even if it is on the domain (sysprep removes it from the domain, resets its name, fully re-generalises the install and puts it in a state where it will completely re-setup windows on whatever pc you write the image to). Unlike sysprep on windows xp (so I understand, never used it), the windows 7 version fully reinitialises the OS and fully redetects and installs all device drivers. Our main image has been syspreped and reuploaded multiple times on different machines (and each time it was put on the domain by the fog client hostnamechanger module) so that we could load in drivers for all the different models we have and now we have one image for all 6 or 7 makes of computer we have in the school. Things that may trip you up with fog adding your machines to the domain instead of xp sysprep: - The password on the AD settings page in fog MUST be encrypted with the fogcrypt program available in the fog download file. - If you specify an OU to put the computer in the client will fail to add the computer to the domain if a computer object for that computer exists in a different OU (its fine that one exists in the OU you specify or you don't specify one). If you dont specify one it just bungs it in the Computers OU if it doesn't exist anywhere else. As I said before, you MUST sysprep windows 7 before rolling it out else the computers wont go on the domain and will generally explode in your face You will need the Windows System Image Manager form the Windows Automatic Installation Kit to make an unattended xml file for sysprep similar to this one: true false false GMT Standard Time * 1 net user administrator /active:yes 2 reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\FirstNetwork" /v Category /t REG_DWORD /d 00000000 /f en-uk en-uk en-uk en-uk en-uk 1 false cscript //b c:\windows\system32\slmgr.vbs /ipk 33PXH-7Y6KF-2VJC9-XBBR8-HVTHH 2 cscript //b c:\windows\system32\slmgr.vbs /ato false true Work 1 #### true #### true TempAdmin Administrators TempAdmin Avonbourne School Avonbourne School true true Some other oddities with Windows 7 sysprep are that it forces you to create an administrator user during the sys prep (details in the unattend file) and there is no way to get out of this, it simply wont work unless you do it. So to get rid of this and do whatever else you need after sysprep is finished you can put a file called SetupComplete.cmd in C:\Windows\setup\scripts (create it if it doesnt exist) and put commands in there that will be executed once sysprep finished to delete the unattended file (it contains passwords) and the extraneous admin user: del /q /f c:\windows\system32\sysprep\unattend.xml net user TempAdmin /delete You obviously also need to install and configure the fog client (only the hostnamechanger module is actually needed for AD integration). All in all its a bit of a pain to set up but once its working its a breeze to work with. Hope some of this helps, feel free to email me if you need more help.
  19. I've had this problem as well, I believe its particularly bad with HP printer drivers. I tried every way possible of deploying printers including login scripts and group policy but still random printers would either not install at all or would be broken in the way you describe. In the end I had to write some software which runs while the user is logged in that removes and re adds printers each time a user logs in and then makes sure they stay correctly configured. We have replaced all our HP printers with Samsung now and it doesn't happen any more. There was a Microsoft kb article somewhere stating incompatibility with server 2008 and hp printer drivers but maybe other brands were also affected.
  20. I believe this is because it uses a completely separate process for each tab, like Chrome does, its for security. I believe I also read somewhere about IE using separate processes for flash objects and similar as well but I don't know if they ever implemented that though.
  21. I'm not sure if this would have helped you, but I thought it might be useful for future reference. On windows 7 and server 2008 if the administrator is the only user in the admin group, and it must be the only one, you can log into it in safe mode even if its disabled. Got me out of a hole after I removed one of our machines from the domain with the local admin account disabled.
  22. Hi, I'm new to this site, but I thought I could contribute to this topic, since roaming profiles at my school have caused us quite a bit of agro. I wrote this script to purge profiles from a windows 7 machine, but after reading your thread I quickly added the option to purge a single profile since you said you sometimes do that. The script is vbs and takes 0, 1 or 2 arguments, the first argument is the name of the computer to purge profiles from, the second is a full or partial username string you can use to filter which profiles are deleted. If you dont specify a filter the script will delete all normal (ie not system, just normal user) profiles. If you dont specify a computer name it uses the local machine. The script uses the Win32_UserProfile WMI class to delete user profiles and also removes the almost-empty folders that are sometimes left behind to prevent windows suffixing the domain name on a new folder and to keep things tidy. It's only been tested on windows 7 but will probably work on vista as well. Needless to say, it requires administrator privileges and does not interfere with profiles which are current in use. I eventually replaced this script with a .net application that uses information from AD to wipe specific profiles from all our machines automatically. It uses a client service and a database to delete profiles we ask even if the machines are turned off and to make sure it doesn't remove profiles created after we triggered it. This would be difficult to post though. Nevertheless I don't use this script any more else I'd rewrite it in powershell, but it works and I hope it helps you. Edit: Looks like someone beat me to it, but will leave it here anyway On Error Resume Next ' ==================================== ' Begin Force CSCRIPT Execution Engine ' ==================================== Dim objShell, strEngine, strArgs, strCmd, i Set objShell = CreateObject("WScript.Shell") strEngine = UCase(Right(WScript.FullName, 12)) If strEngine <> "\CSCRIPT.EXE" Then ' Recreate the list of command line arguments strArgs = "" If WScript.Arguments.Count > 0 Then For i = 0 To WScript.Arguments.Count strArgs = strArgs & " " & WScript.Arguments(i) Next End If ' Create the complete command line to rerun this script in CSCRIPT strCmd = "cscript.exe //nologo """ & WScript.ScriptFullName & """" & strArgs objShell.Run strCmd, 1 WScript.Quit End If ' ==================================== ' End Force CSCRIPT Execution Engine ' ==================================== WScript.Stdout.WriteLine WScript.Stdout.WriteLine "Avonbourne School Profile Deletion Script" WScript.Stdout.WriteLine "=========================================" WScript.Stdout.WriteLine Dim objFSO, objWMIService, strComputer, strFilter, colProfiles, objProfile If WScript.Arguments.Count = 0 Then strComputer = "." ElseIf WScript.Arguments.Count = 1 Then strComputer = WScript.Arguments(0) strFilter = "SID Like ""S-1-5-21%"" And Not LocalPath Like ""%Administrator%""" ElseIf WScript.Arguments.Count = 2 Then strComputer = WScript.Arguments(0) strFilter = "SID Like ""S-1-5-21%"" And LocalPath Like ""%" & WScript.Arguments(1) & "%""" Else WScript.Stdout.WriteLine "Invalid command line parameters." WScript.Quit End If WScript.Stdout.WriteLine "Deleting profiles from '" & strComputer & "'..." WScript.Stdout.WriteLine Set objFSO = CreateObject("Scripting.FileSystemObject") Set objWMIService = GetObject("Winmgmts:\\" & strComputer & "\root\cimv2") Set colProfiles = objWMIService.ExecQuery("Select * From Win32_UserProfile Where " & strFilter) If Err.Number <> 0 Then WScript.Stdout.WriteLine WScript.Stdout.WriteLine "Error: " & Err.Number & ": " & Err.Description WScript.Stdout.WriteLine WScript.Exit End If If Not colProfiles Is Nothing Then For Each objProfile in colProfiles WScript.Stdout.WriteLine "Processing profile: Path: " & objProfile.LocalPath WScript.Stdout.WriteLine " SID: {" & objProfile.SID & "}" Err.Clear objProfile.Delete_ If Err.Number = -2147024809 Then WScript.Stdout.WriteLine " Profile in use, skipping." ElseIf Err.Number = -2147024751 Then objFSO.DeleteFolder objProfile.LocalPath, True WScript.Stdout.WriteLine(" Profile Deleted.") ElseIf Err.Number <> 0 Then WScript.Stdout.WriteLine " Failed!" WScript.Stdout.WriteLine WScript.Stdout.WriteLine "Error: " & Err.Number & ": " & Err.Description WScript.Stdout.WriteLine Else WScript.Stdout.WriteLine(" Profile Deleted.") End If Next End If
×
×
  • Create New...