Wednesday, December 11, 2013

Report on Groupwise Archive Location

One of the Main Issues with Dealing with a Groupwise migration is finding the locations of the Archive files. This is not a huge issue if your Users only have a single Archive file, however some users like to split off archives every year, and file them in places. The following scripts will report back the location of a groupwise log. these scripts were deployed to run on the desktop aproximatley 5 minutes after logon. If groupwise was running, they work silently, Otherwise they prompt. First for X86
 On Error resume next  
 'HKEY_LOCAL_MACHINE\Software\Microsoft\PCHealth\ErrorReporting\DW  
 'DWORD DWReportee 0 (Default) 1 Disable  
 Const HKEY_LOCAL_MACHINE = &H80000002  
 strComputer = "."  
 Set StdOut = WScript.StdOut  
 Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_   
 strComputer & "\root\default:StdRegProv")  
 strKeyPath = "SOFTWARE\Microsoft\PCHealth\ErrorReporting\DW"  
 strValueName = "DWReportee"  
 dwValue = 1  
 oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue  
 strKeyPath = "SOFTWARE\Microsoft\PCHealth\ErrorReporting\ExclusionList"  
 strValueName = "cscript.exe"  
 dwValue = 1  
 oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue  
 strKeyPath = "SOFTWARE\Microsoft\PCHealth\ErrorReporting"  
 strValueName = "ShowUI"  
 dwValue = 0  
 oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue  
 strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug"  
 strValueName = "Auto"  
 strValue = "1"  
 oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue  
 strValueName = "Debugger"  
 strValue = "drwtsn32 -p %ld -e %ld -g"  
 oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue  
 Set oFSO = CreateObject("Scripting.FileSystemObject")  
 Set oSH = CreateObject("wScript.Shell")  
 'intJnk = oSH.Run("drwtsn32.exe -i",8,True)  
 strComputerName = OSH.ExpandEnvironmentStrings( "%COMPUTERNAME%" )  
 strudomain = OSH.ExpandEnvironmentStrings( "%userdomain%" )  
 struName = OSH.ExpandEnvironmentStrings( "%username%" )  
 struprofile = OSH.ExpandEnvironmentStrings( "%userprofile%" )  
 strLogFldr = "\\FS10C1\Logs$\ArchiveLogs\"  
 strLogPath = strLogFldr & struName & ".txt"  
 strLogLocPath = "C:\Windows\CCM\Logs\GWArchivePath.log"  
 dim GWApp   
 Set GWApp = CreateObject("NovellGroupWareSession")   
 dim GWAccount   
 Set GWAccount = GWApp.login()  
 Set oFolder = oFSO.GetFolder(GWAccount.PathToArchive)  
 ifolder=oFolder&"\"&"of"& GWAccount.AccountProperty(9) &"arc\"  
 archivesize=oFolder.Size  
 archivesize=archivesize\1024  
 if oFSO.folderexists(strLogFldr) Then   
   Set usrLog = oFSO.OpenTextFile(strLogPath, 8, True)  
   'usrLog.WriteLine ("UID: " & GWAccount.AccountUID &", ArchivePath: " & ifolder &", SIZE (KB): " & archivesize &", ")  
   usrLog.WriteLine ("UID: " & GWAccount.AccountUID &", ArchivePath: " & ifolder &", SIZE (KB): " & archivesize &", " & "Computer: " & strComputerName )  
   Set usrLocLog = oFSO.OpenTextFile(strLogLocPath, 8, True)  
   'usrLocLog.WriteLine ("UID: " & GWAccount.AccountUID &", ArchivePath: " & ifolder &", SIZE (KB): " & archivesize &", ")  
   usrLocLog.WriteLine ("UID: " & GWAccount.AccountUID &", ArchivePath: " & ifolder &", SIZE (KB): " & archivesize &", " & "Computer: " & strComputerName )  
 End if  
 'GWApp.quit()  
 'Cleanup  
 Set StdOut = Nothing  
 Set oReg = Nothing  
 Set oFSO = Nothing  
 Set oSH = Nothing  
 Set GWApp = Nothing  
 Set GWAccount = Nothing  
 Set oFolder = Nothing  
 Set theFolder = Nothing  
 Set usrLog = Nothing  
 Set usrLocLog = Nothing  
 WScript.Quit  
Then For X64
 On Error resume next  
 'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Windows Error Reporting  
 'DWORD Disabled 0 - Enabled (default) 1 - Disabled  
 'DWORD DontShowUI 0 - UI (default) 1 - No UI  
 const HKEY_LOCAL_MACHINE = &H80000002  
 strComputer = "."  
 Set StdOut = WScript.StdOut  
 Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_   
 strComputer & "\root\default:StdRegProv")  
 strKeyPath = "SOFTWARE\Microsoft\Windows\Windows Error Reporting"  
 'strValueName = "Disabled"  
 'dwValue = 1  
 'oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue  
 strValueName = "DontShowUI"  
 dwValue = 1  
 oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue  
 Set oFSO = CreateObject("Scripting.FileSystemObject")  
 Set oSH = CreateObject("wScript.Shell")  
 Set oFS = CreateObject("Scripting.FileSystemObject")  
 strOldWSH = oSH.ExpandEnvironmentStrings("%SYSTEMROOT%\SysWOW64\wscript.exe")  
 If oFS.FileExists(strOldWSH) Then  
   If Not UCase(WScript.FullName) = UCase(strOldWSH) Then  
     oSH.Run """" & strOldWSH & """ """ & WScript.ScriptFullName & """", 1, False  
     WScript.Quit  
   End If  
 End If  
 strComputerName = OSH.ExpandEnvironmentStrings( "%COMPUTERNAME%" )  
 struDomain = OSH.ExpandEnvironmentStrings( "%userdomain%" )  
 struName = OSH.ExpandEnvironmentStrings( "%username%" )  
 struprofile = OSH.ExpandEnvironmentStrings( "%userprofile%" )  
 strLogFldr = "\\FS10C1\Logs$\ArchiveLogs\"  
 strLogPath = strLogFldr & struName & ".txt"  
 strLogLocPath = "C:\Windows\CCM\Logs\GWArchivePath.log"  
 dim GWApp   
 Set GWApp = CreateObject("NovellGroupWareSession")   
 dim GWAccount   
 Set GWAccount = GWApp.login()  
 Set oFolder = oFSO.GetFolder(GWAccount.PathToArchive)  
 ifolder=oFolder&"\"&"of"& GWAccount.AccountProperty(9) &"arc\"  
 'gwapp.quit()  
 archivesize=oFolder.Size  
 archivesize=archivesize\1024  
 if oFSO.folderexists(strLogFldr) Then   
   Set usrLog = oFSO.OpenTextFile(strLogPath, 8, True)  
   usrLog.WriteLine ("UID: " & GWAccount.AccountUID &", ArchivePath: " & ifolder &", SIZE (KB): " & archivesize &", " & "Computer: " & strComputerName )  
   Set usrLocLog = oFSO.OpenTextFile(strLogLocPath, 8, True)  
   usrLocLog.WriteLine ("UID: " & GWAccount.AccountUID &", ArchivePath: " & ifolder &", SIZE (KB): " & archivesize &", " & "Computer: " & strComputerName)  
 End If  
 'Cleanup  
 WERR_Normal  
 Set StdOut = Nothing  
 Set oReg = Nothing  
 Set oFSO = Nothing  
 Set oSH = Nothing  
 Set oFS = Nothing  
 Set GWApp = Nothing  
 Set GWAccount = Nothing  
 Set oFolder = Nothing  
 Set usrLog = Nothing  
 WScript.Quit  
 '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  
 Sub WERR_Normal  
 const HKEY_LOCAL_MACHINE = &H80000002  
 strComputer = "."  
 Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_   
 strComputer & "\root\default:StdRegProv")  
 strKeyPath = "SOFTWARE\Microsoft\Windows\Windows Error Reporting"  
 strDWORDValueName = "DontShowUI"  
 objReg.DeleteValue HKEY_LOCAL_MACHINE,strKeyPath,strDWORDValueName  
 'Cleanup  
 Set objReg = Nothing  
 End Sub  
 '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  

No comments:

Post a Comment