I am new at this so please be gentle. This is a revised version. Sorry for the delay in responding.. Things got crazy at my job. This is what is happening. Nothing is being logged even though it should be. I run a debug on the code and don't get any error's back. It must be a logic problem. All the drives map sucessfully and if the file it is writing to does not exist it will create the file but not write lines to it.

Thanks in advance..

Matt
Code:
 Break On
Dim $vDiscard
$vDiscard=SetOption('Explicit','On')
$vDiscard=SetOption('NoVarsInStrings','On')
$vDiscard=SetOption('NoMacrosInStrings','On')

;$vDiscard=SetConsole("HIDE") ;User Cannot See Script Running


Dim $LFile, $SFile, $LVersion, $SVersion, $Msg, $FFile
Dim $LPNAFile, $SPNAFile, $LPNAVersion, $SPNAVersion
Dim $IcaClientName
Dim $DefaultFiles

Dim $sKey $sKey=@MONTH+@MDAYNO+@YEAR
; SKip this script for service accounts

If InGroup ("No Login Scripts") Exit 0 EndIf

;Don't run on CTX Servers

If @WKSTA = "VPOINT6CTX1" or @WKSTA = "VPOINT6CTX2" Exit 0 EndIf

; Check for ODBC
Shell "%logonserver%\netlogon\netlogonODBC.bat"

; Check Citrix client versions where installed
If KeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\CITRIX")

$LFile = "C:\Program Files\Citrix\Ica Client\pn.exe" ;Client Citrix Client Location
$LVersion = GetFileVersion($LFile,'BinFileVersion') ;Client Citrix Client Version
$SFile = "\\tctunicenter\ctx$\pn.exe" ;Compare Client Citrix Version to this file
$SVersion = GetFileVersion($SFile,'BinFileVersion')

If @ERROR popMessage('Error getting pn.exe file information: ' + @ERROR + ' - ' + @SERROR) EndIf

If $SVersion <> $LVersion
$vDiscard=Log("\\tctunicenter\ctx$\citrix\"+$sKey+"_ICACLIENTVERSION.TXT"," has old ica client version "+$LVersion)
EndIf

$LPNAFile = "C:\Program Files\Citrix\Ica Client\pnagent.exe" ;Client Citrix PNA Location
$LPNAVersion = GetFileVersion($LPNAFile,'BinFileVersion') ;Client Citrix CLient PNA Version
$SPNAFile = "\\tctunicenter\ctx$\pnagent.exe" ;Compare Client Citrix PNA Version to this file
$SPNAVersion = GetFileVersion($SPNAFile,'BinFileVersion')

If @ERROR popMessage('Error getting pnagent.exe file information: ' + @ERROR + ' - ' + @SERROR) EndIf

If $SPNAVersion == $LPNAVersion
$vDiscard=Log("\\tctunicenter\ctx$\citrix\"+$sKey+"_PNA.TXT"," has PNA Installed and it is version " + $LPNAVersion)
EndIf


$IcaClientName = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\ICA Client", "ClientName")
If @ERROR = 0
$vDiscard=Log("\\tctunicenter\ctx$\citrix\"+$sKey+"_ICACLIENTNAME.TXT"," has a static client name and it is "+$IcaClientName)
Endif
EndIf

If Not Exist("C:\Program Files\CA\Unicenter Software Delivery\BIN\sdconf.exe")
$vDiscard=Log("\\tctunicenter\ctx$\CA\"+$sKey+"unisoftdelivery.txt"," does not have CA Software Delivery Installed")
EndIf
If Not Exist("C:\Program Files\CA\Unicenter Asset Management\Agents\UMCLIWNT.EXE")
$vDiscard=Log("\\tctunicenter\ctx$\CA\"+$sKey+"uniassman.TXT" , " does not have CA Asset Management Installed")
EndIf

If @Producttype = "Windows XP Professional" or @Producttype = "Windows 2000 Professional"
$DefaultFiles=ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "Personal")
If @ERROR = 0
If $DefaultFiles <> "U:\"
Log("\\tctunicenter\ctx$\office\"+@MONTH+@MDAYNO+@YEAR+"_DefaultFiles.TXT"," has a defined file location other than U:\ and it is "+$DefaultFiles)
Endif

EndIf

; Skipping drives for Domain Admins group
; If InGroup ("Domain Admins") Exit 0 EndIf

If InGroup("Metafile") OR InGroup("Metafile Users")
Use O: /Delete /Persistent
Use Z: /Delete /Persistent
Use o: "\\tctmetafile\e"
Use z: "\\tctmetafile\z"

EndIf

If InGroup ("CT Credit")
Use J: /Delete /Persistent
Use j: "\\bituminous\credit"
EndIf

If InGroup ("Heavy & Highway")
Use L: /Delete /Persistent
Use l: "\\tcthcss\data"
EndIf

If InGroup ("Concrete Plants")
Use X: /Delete /Persistent
Use x: "\\tctcdi1\e"
EndIf
If InGroup ("Infohub Users")
Use g: /Delete /Persistent
Use g: "\\tctinfohub\BmgSeltec"
Use i: /Delete /Persistent
Use i: "\\tctinfohub\DataXfer"
EndIf
If InGroup ("Niche Bid2Win")
Use y: /Delete /Persistent
Use y: "\\ct_bid2win\bid2win"
EndIf
If InGroup ("Tilcon CT - Safety")
Use s: /Delete /Persistent
Use s: "\\tctcorp01\safety"
EndIf
Exit 0

; ----------------------------------------------------------------------
; Logical end of script
; ----------------------------------------------------------------------

; Log status messages to file
Function Log($sPath,$sMessage)
Dim $fh
$Log=0
$fh=FreeFileHandle()
If @ERROR
$Log=@ERROR
popMessage("Cannot allocate file handle for file open")
Else
If Open($fh,$sPath,1+4)
$Log=@ERROR
popMessage("Failed to open file '"+$sPath+@CRLF+"Error code : [" + @ERROR + "] "+@SERROR)
$vDiscard=WriteLine($fh,@TIME+" "+@DATE+" "+@WKSTA+$sMessage+@CRLF)
$vDiscard=Close($fh)
EndIf
EndIf
Exit $Log
EndFunction

; Display pop-up message
Function popMessage($sMessage)
$popMessage=MessageBox($sMessage,@SCRIPTNAME+" Warning",0+64+4096,10)
EndFunction

Exit



Edited by Mstudinski (2006-07-10 09:14 PM)