All,

Can someone help setting up the following:

1. Exclude running this on servers
2. Greetings not working properly
3. Need to change local Admin password
4. Check for TrendMicro if not exist install
5. If Trend does exist update to latest definition


; ========================================================================
; Setting Variables
;
$ServerName = "\\chifs1001" ;File Server
$AVServer = "\\chiau1001" ;Trend Micro
;***********************************************************

;delete any old drive shares
;***********************************************************
Use * /delete
;***********************************************************
; Displaying Logon Info Screen
;***********************************************************
; Determine password expiration DATE
$PWDEXPIRE = @MAXPWAGE - @PWAGE
$PWDEXPIRE=IIF($PWDEXPIRE <=0,"Your password has no expiration date.","Your current password will expire in "+$PWDEXPIRE+" day(s).")

; Determine time of day
$TIME = @TIME
Select
CASE $TIME > "00:000:01" AND $TIME < "12:00:00"
$TOD = "Good morning"
CASE $TIME > "11:59:59" AND $TIME < "18:00:00"
$TOD = "Good afternoon"
CASE $TIME > "17:59:59" AND $TIME < "24:00:00"
$TOD = "Good evening"
CASE 1
$TOD = "Welcome"
EndSelect

Cls

Color B+/N
Box ( 0, 0, 24, 79, GRID ) ; Background grid

; Information Box
Color B/N
Box ( 4, 8, 23, 69, Å ) ; shadow
Color B+/N
Box ( 3, 7, 22, 68, FULL ) ; Box

;Display Banner
Color r+/n
At (1,2) $title
At (2,10)$TOD + @USERID + " to " + @DOMAIN + " Domain."
;At (2,10)$TOD + ", " + @FULLNAME + " to " + $Domain + " Domain."
Color w/n
At (6,10) "* Date:"
At (7,10) "* Time:"
At (8,10) "* user:"
At (9,10) "* workstation:"
At (10,10)"* logon server:"
At (11,10)"* domain:"
At (12,10)"* IP Address:"
At (13,10) "* OS:"
At (14,10) "* Service Pack:"
At (15,10) "* Setting Workstation time:"

Color w+/n
At (6,39) @DAY + " " + @MDAYNO + " " + @MONTH + " " + @YEAR
At (7,39) @TIME
At (8,39) @USERID + " (" + @FULLNAME + ")"
At (9,39) @WKSTA
At (10,39) @LSERVER
At (11,39) @DOMAIN
At (12,39) @IPADDRESS0
At (13,39) @PRODUCTTYPE
At (14,39) @CSD
Color g+/n
At (15,39) "done"
SetTime "\\CHIDC1001"
Color r+/n
At (19,15) $PWDEXPIRE

Sleep 2
Cls

$Caption = "Connecting shares"
$Comment = "Connecting Drive Mappings to the server"
;__________________________________________________________________________
; All domain users get the following directories mapped - P: is the Company
; Public directoy and H: is the Users personal directory.
;__________________________________________________________________________
If InGroup("Domain Users")
Use P: "$ServerName\public"
Use H: @HOMESHR "\" @HOMEDIR
EndIf

If InGroup("Domain_Admins")
Use I: "\\chifs1001\tech-ops"
Else Goto "Administration_Mappings"
EndIf

;Administration_Mappings
:Administration_Mappings
If InGroup("Administrations")
Use T: "$ServerName\public"
Else Goto "Business_Mappings"
EndIf

;Business
:Business_Mappings
If InGroup("Marketing")
Use T: "$ServerName\Business"
Else Goto "Executive_Mappings"
EndIf

;Executives
:Executive_Mappings
If InGroup("Executives")
Use T: "$ServerName\CEO"
Else Goto "Facilities_Mappings"
EndIf

;Customer Service
;:Customer Service_Mappings
;If InGroup("Customer Service")
;Use T: \\chifs1001\CustomerSupport
;Use S: \\chifs1001\business
;Else Goto "Facilities_Mappings"
;EndIf

;Facilities
:Facilities_Mappings
If InGroup("Facilities")
Use T: \\chifs1001\Facilities
Use S: \\chifs1001\Administration
Else Goto "Finance_Mappings"
EndIf

;Finance
:Finance_Mappings
If InGroup("Finance")
Use T: \\chifs1001\Finance
Use S: \\chifs1001\Finance_temp
Else Goto "HR_Mappings"
EndIf

;Human Resources
:HR_Mappings
If InGroup("HR")
use T: \\chifs1001\HR
use R: \\chifs1001\Facilities
Use S: \\chifs1001\Administration
Else Goto "Latin_America"
EndIf

;Latin America
:Latin_America
If InGroup("latin America")
use T: \\chifs1001\Latin America
Else Goto "Legal_Mappings"
EndIf

;Legal
:Legal_Mappings
If InGroup("Legal")
use T: \\chifs1001\legal
Else Goto "Marketing_Mappings"
EndIf

;Marketing
:Marketing_Mappings
If InGroup("Marketing")
use T: \\chifs1001\Marketing
Else Goto "Sales_Mappings"
EndIf

;Sales
:Sales_mappings
If InGroup("Sales")
use s: \\chifs1001\business
use t: \\chifs1001\sales
Else Goto "TechOps_Mappings"
EndIf


;Tech-Ops
:TechOps_Mappings
If InGroup("Domain_Admins")
use G: \\chifs1001\gxs
use I: \\chifs1001\Contractors
use P: \\chifs1001\Public
use T: \\chifs1001\tech-ops
EndIf

$Caption = "Inventorying Computer"
$Comment = "GS1US will now conduct an inventory on your machine"


;Inventory:

;_____________________________________________________________
; The first portion of the script does five things
; 1) Writes basic computer information to a text file = NetBIOS
; name.txt (overwrites)
; 2) Writes logon time to a text file = username.txt (appends)
; 3) Writes logon time to a text file = NetBIOS name.txt (appends)
; 4) Writes all logon info to a .csv file (appends)
; 5) Writes computer info to a .csv one time only for inventory
; purposes

Use z: /Delete /persistent
Use z: "\\chifs1001\inventory"

; 1) Basic computer info for reference

RedirectOutput ("z:\Inventory\@WKSTA.txt",1)

?"NetBIOS name = "@WKSTA
?"Last login by "@USERID
?"OS = "@PRODUCTTYPE" with "@CSD
?"Memory = "MemorySize(0)" MB"
?"Processor type is "@CPU
?"Processor speed is "@MHZ
?"IP address = "@IPADDRESS0
?"MAC address = "@ADDRESS
?"This information was gathered on "@DATE" at "@TIME

; 2) Tracks all logons by user

RedirectOutput ("Z:\Logins\@USERID.txt",0)

?@USERID" logged into the "@DOMAIN" on "@WKSTA" at "@TIME" on "@DATE" "

; 3) Tracks all logons by computer

RedirectOutput ("Z:\Logins\Computer\@WKSTA.txt",0)

?@USERID" logged into the "@DOMAIN" on "@WKSTA" at "@TIME" on "@DATE" "

; 4) Records all logon info to a .csv file

RedirectOutput ("Z:\Logins\CSV\logins.txt",0)

?@USERID","@WKSTA","@DATE","@TIME","@LSERVER","

; 5) Records computer info one time to a .csv file and copies a check file
; to prevent future writes of same computer

If Exist ("c:\check3.txt")

Goto "software"

EndIf

RedirectOutput ("Z:\Inventory\CSV\inventory.txt",0)

?@WKSTA","@PRODUCTTYPE","@CSD","MemorySize(0)","@CPU","@MHZ","@IPADDRESS0","@ADDRESS","

Copy "Z:\check3.txt" "c:\check3.txt"

; The second part of this script performs an inventory of installed software on a PC
; by examining the portion of the registry where uninstall information is kept.
; The information is then recorded to a text file = computer name that is overwritten
; with each successive logon.

:software

RedirectOutput ("Z:\Software\@HOSTNAME.txt", 1)
?"Software installed on @HOSTNAME as of @DATE"
?
; Scroll through each subkey

$Index = 0

:Loop1

$KeyName = EnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", $Index)
If @ERROR = 0
Goto DisplayCheck

Else
Goto End

EndIf

isplayCheck

; Check for DisplayName string, record information if it exists

$Displayname = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$Keyname", "DisplayName")

; DisplayName exists

If @ERROR = 0
?$Displayname
$Index = $Index + 1
Goto Loop1
; DisplayName does not exist
Else
$Index = $Index + 1
Goto Loop1
:End
; Finished checking all subkeys, exit program
Use Z: /Delete /persistent

EndIf

;******************************************************************************
; Antivirus update
;******************************************************************************
DisplayText(9, 11,"Updating Antivirus...","w+/r")
$cmdLine = "\\"+$AVServer+"\OfcScan\Autopccp.exe"
SHELL "%comspec% /C START %comspec% /C " + $cmdLine
;**************************************************************************