Mark Russinovich’s famous “Case of the Unexplained” for 2014 from TechEd Europe 2014: http://channel9.msdn.com/Events/TechEd/Europe/2014/WIN-B410
– Soli Deo Gloria
There are 10 types of people in the world: those are understand binary and those who do not.
Mark Russinovich’s famous “Case of the Unexplained” for 2014 from TechEd Europe 2014: http://channel9.msdn.com/Events/TechEd/Europe/2014/WIN-B410
– Soli Deo Gloria
In the mist of upgrading from Windows XP to Windows 7 on all of our computers, I thought I would share some of the scripts I’m using to make life a little easier. We currently use local user profiles, printers added manually by hand through a Windows print server and sometimes statically mapped network drives for users that need to perform cross duty work in other departments.
Yes, I give you permission to laugh and yes I know there’s ways of doing these things in an automated and centralized fashion. Going into the companies we buy, however, I’m seeing even sillier things in their environments. One was a guy that was using Clonezilla, an external hard drive, a USB stick (at least it wasn’t a CD-ROM) and doing a custom image for each and every model of computer hardware he had. He had an impressive talent for scripting however and I found many clever VBScript snippets all over the network he was firing via the login script to do things automated and in the background.
The below script is quick, dirty and thrown together from many different sources. It will give you:
All the drives and UNC paths mapped under the logged in user’s profile
All of the printers networked and local under the logged in user’s profile
The default printer of the logged in user
Names of all Outlook profiles of the logged in user (this will error out if this does not exist)
List of unsorted software as given from WMI
Simply call it as the user from the login script and SCCM and dump the file to some where world writable. It will dump the contents in plain text to a file in the format of username.computer.txt.
– Soli Deo Gloria
On Error Resume Next Const HKEY_CURRENT_USER = &H80000001 Const r_ProfilesRoot = "SoftwareMicrosoftWindows NTCurrentVersionWindows Messaging SubsystemProfiles" strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\" & strComputer & "rootcimv2") Set colInstalledPrinters = objWMIService.ExecQuery _ ("Select * from Win32_Printer where Default = True") For Each objPrinter in colInstalledPrinters PrinterDefault=objPrinter.Name Next Dim objFileSystem, objOutputFile Dim strOutputFile Const OPEN_FILE_FOR_APPENDING = 8 Set objFileSystem = CreateObject("Scripting.fileSystemObject") Set Shell = CreateObject("WScript.Shell") Set WshNetwork = WScript.CreateObject("WScript.Network") Set oDrives = WshNetwork.EnumNetworkDrives Set oPrinters = WshNetwork.EnumPrinterConnections oUser = WshNetwork.UserName computername = Shell.ExpandEnvironmentStrings("%computername%") strOutputFile="\\someserver\logs" & oUser & "." & computername & ".txt" Set objOutputFile = objFileSystem.CreateTextFile(strOutputFile, TRUE) objOutputFile.WriteLine("Network drive mappings:") For i = 0 to oDrives.Count - 1 Step 2 objOutputFile.WriteLine("Drive " & oDrives.Item(i) & " = " & oDrives.Item(i+1)) Next objOutputFile.WriteLine("") objOutputFile.WriteLine("Network printer mappings:") For i = 0 to oPrinters.Count - 1 Step 2 objOutputFile.WriteLine("Port " & oPrinters.Item(i) & " = " & oPrinters.Item(i+1)) Next objOutputFile.WriteLine("Default Printer: ") & PrinterDefault Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\" & _ strComputer & "rootdefault:StdRegProv") oReg.EnumKey HKEY_CURRENT_USER,r_ProfilesRoot,subKeys objOutputFile.WriteLine(" ") objOutputFile.WriteLine("Outlook Profiles: ") For Each profileName In subKeys objOutputFile.WriteLine( profileName ) Next Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\" & strComputer & "rootcimv2") Set colSoftware = objWMIService.ExecQuery ("Select * from Win32_Product") objOutputFile.WriteLine(" ") objOutputFile.WriteLine("Installed Software: ") For Each objSoftware in colSoftware objOutputFile.WriteLine objSoftware.Caption & ", " & objSoftware.installDate & ", " & objSoftware.installDate2 Next objOutputFile.Close Set objFileSystem = Nothing