Addextender("WWWNT34I.DLL") AddExtender("WWADS44I.DLL") t=timedate() #DEFINESUBROUTINE MonitorSet(Handle,DialogMessage,DialogControlID,param4,param5) MSG_Initialization=0 Butn_push=2 ListSelect=7 Radio_selct=3 switch (DialogMessage) case MSG_Initialization DialogProcOptions(Handle, Butn_push, 1); PushButton event case Butn_push switch DialogControlID case 017 title="Locate Install Files" gosub LOCATE if path!=0 DialogControlSet(handle,18,3,Path) endif return(-2) case 020 title="Location for data" gosub LOCATE if path!=0 DialogControlSet(handle,3,3,Path) endif return(-2) case 062 run("iexplore.exe","www.arconi.com") return(-2) endswitch return -1 :LOCATE types="All Files|*.*|Text Files|*.txt|" Path=AskDirectory( title, "c:\", "", "",1|2 ) return :DISK #ENDSUBROUTINE MyDialogFormat=`WWWDLGED,6.1` MyDialogCaption=`Monitor Setup` MyDialogX=760 MyDialogY=094 MyDialogWidth=258 MyDialogHeight=313 MyDialogNumControls=034 MyDialogProcedure=`MonitorSet` MyDialogFont=`DEFAULT` MyDialogTextColor=`DEFAULT` MyDialogBackground=`DEFAULT,DEFAULT` MyDialogConfig=0 MyDialog001=`167,287,036,012,PUSHBUTTON,DEFAULT,"OK",1,1,32,DEFAULT,DEFAULT,DEFAULT` MyDialog002=`211,287,036,012,PUSHBUTTON,DEFAULT,"Cancel",0,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog003=`063,041,180,012,EDITBOX,setpath,"d:\ or \\server\share",DEFAULT,5,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog004=`155,007,086,012,STATICTEXT,DEFAULT,"Network Monitor Setup",DEFAULT,7,DEFAULT,"Microsoft Sans Serif|8192|40|34","0|0|0",DEFAULT` MyDialog005=`065,053,176,014,STATICTEXT,DEFAULT,"This is where the server logs and other monitor data will be created and stored. Usually the Monitor server itself.",DEFAULT,8,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog006=`005,029,244,074,GROUPBOX,DEFAULT,"Data Locals",DEFAULT,12,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog007=`077,123,046,012,EDITBOX,domain,"domain",DEFAULT,13,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog008=`135,123,036,012,EDITBOX,class,"com",DEFAULT,14,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog009=`127,123,004,010,STATICTEXT,DEFAULT,".",DEFAULT,15,DEFAULT,"Microsoft Sans Serif|6656|70|34","0|0|0",DEFAULT` MyDialog010=`035,125,038,008,STATICTEXT,DEFAULT,"Domain Name",DEFAULT,16,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog011=`005,111,244,168,GROUPBOX,DEFAULT,"Sytem Information",DEFAULT,17,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog012=`177,125,056,008,STATICTEXT,DEFAULT,"(com, net, org, gov)",DEFAULT,18,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog013=`119,141,092,012,EDITBOX,email,DEFAULT,DEFAULT,21,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog014=`035,143,078,008,STATICTEXT,DEFAULT,"Alert Notifacation email address",DEFAULT,22,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog015=`119,159,092,012,EDITBOX,pdc,"server",DEFAULT,11,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog016=`035,161,064,008,STATICTEXT,DEFAULT,"Primary Domain Controller",DEFAULT,10,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog017=`009,075,050,012,PUSHBUTTON,DEFAULT,"Locate install files:",2,19,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog018=`063,075,180,012,EDITBOX,MyVariable3,DEFAULT,DEFAULT,20,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog019=`065,087,174,012,STATICTEXT,DEFAULT,"This is the folder that contains the install files, (The ones you unzipped)",DEFAULT,9,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog020=`009,041,050,012,PUSHBUTTON,DEFAULT,"Location for Data:",5,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog021=`035,179,104,008,STATICTEXT,DEFAULT,"Disk Minimum Space Limit (default is 1 gig)",DEFAULT,6,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog022=`145,177,066,012,EDITBOX,disk,"1000",DEFAULT,4,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog023=`035,195,094,014,STATICTEXT,DEFAULT,"Time between Scans; in seconds (default is 10 minutes)",DEFAULT,23,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog024=`145,195,066,012,EDITBOX,sec,"600",DEFAULT,24,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog025=`009,285,144,016,STATICTEXT,DEFAULT,"All of these settings can easily be changed after the install as well. So dont feel locked into what you set here.",DEFAULT,25,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog026=`009,007,036,012,STATICTEXT,DEFAULT,"ARCONI",DEFAULT,26,DEFAULT,"Microsoft Sans Serif|8192|70|34","0|0|0",DEFAULT` MyDialog027=`045,007,044,010,STATICTEXT,DEFAULT,"SoftTools",DEFAULT,27,DEFAULT,"Microsoft Sans Serif|8192|70|34","0|0|255",DEFAULT` MyDialog028=`051,243,068,008,STATICTEXT,DEFAULT,"Service Account Password",DEFAULT,28,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog029=`135,239,066,012,EDITBOX,pass1,DEFAULT,DEFAULT,29,16,DEFAULT,DEFAULT,DEFAULT` MyDialog030=`051,259,048,008,STATICTEXT,DEFAULT,"Confirm Password",DEFAULT,30,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog031=`135,257,066,012,EDITBOX,pass2,DEFAULT,DEFAULT,31,16,DEFAULT,DEFAULT,DEFAULT` MyDialog032=`041,229,168,044,GROUPBOX,DEFAULT,"Service Account",DEFAULT,32,DEFAULT,"Microsoft Sans Serif|5632|40|34","128|128|128",DEFAULT` MyDialog033=`117,213,094,012,EDITBOX,ms,"",DEFAULT,33,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog034=`011,215,102,008,STATICTEXT,DEFAULT,"Mail Server Address (mail.yourdomain.com)",DEFAULT,34,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ButtonPushed=Dialog("MyDialog") pss=strcmp(pass1,pass2) if pss==0 pass=pass1 else pssw=1 While pssw!=0 pass1=AskPassword ("Password","Passwords did not match, please re-enter") pass2=AskPassword ("Password","Confirm") pss=strcmp(pass1,pass2) if pss==0 then pssw=0 endwhile endif Boxopen("Network Monitor","Creating System Directories") st="Local System" sys_root=Environment ("ProgramFiles") data=strcat(setpath,"Network_Monitor") dirmake(data) dirmake("%data%\Systems") dirmake("%data%\DownTime") dirmake("%data%\ServerStats") dirmake("%data%\ServerLogs") log=fileopen("c:\Setup_log.txt","APPEND") boxtext("Creating System Files.") logtxt="Location->TXT" logcsv="Location->CSV" logmng="Location->Managment" Time=TimeDate() tech="%data%\SrvrMntr1.ini" alt_eml="" alt_eml2="" eml_ini="%data%\emai1.ini" fx=fileexist(tech) fw=FileOpen(tech,"WRITE") fw1=FileOpen("%data%\servers.txt","WRITE") FileClose(fw) FileClose(fw1) IniWritePvt("MNTR", "FirstRun","0", tech) IniWritePvt("MNTR", "FirstRunTime", time, tech) IniWritePvt("MNTR", "LastRunTime", "0",tech) IniWritePvt("MNTR", "DiskSizeLimit", disk, tech) IniWritePvt("MNTR", "Path", "%data%\servers\", tech) IniWritePvt("MNTR", "Data", "%data%", tech) IniWritePvt("MNTR", "Down", "%data%\DownTime\DownTime.log", tech) IniWritePvt("MNTR", "ServerLoc", "%data%\Network_Monitor\Systems", tech) IniWritePvt("MNTR", "DEBUGMODE", "off", tech) IniWritePvt("MNTR", "Domain", "%domain%.%class%", tech) IniWritePvt("LOGNAME",logmng,"%data%\DownTime\DownTime.log",tech) IniWritePvt("LOGNAME",logtxt,"%data%\ServerLogs\",tech) IniWritePvt("TIMEOUT", "Seconds",sec, tech) IniWritePvt("MAILSERVER", "MS",ms, tech) IniWritePvt("MAILSERVER", "FromAddress",ms, tech) IniWritePvt("MAILSERVER", "User","", tech) IniWritePvt("MAILSERVER", "Pass","", tech) IniWritePvt("MAILSERVER", "UNPort","25", tech) IniWritePvt("MAILLIST", "EmailAlert00",email, tech) IniWritePvt("MAILLIST", "EmailAlert01",alt_eml, tech) IniWritePvt("MAILLIST", "EmailAlert02",alt_eml, tech) IniWritePvt("HELP", "fileloc","%data%\NetworkMonitorVersion512\index.html", tech) IniWritePvt("SERVICELOOP", "","", tech) IniWritePvt("SUBNETS", "10.x.x","Located in main server room", tech) IniWritePvt("MEAN", "Number=","", tech) IniWritePvt("LOOP", "","", tech) Boxtext("Creating Service Account") FullName = "NetworkMonitor" ADSIPath = "LDAP://%pdc%/CN=Users,DC=%domain%,DC=%class%" sObjectClass = "user" UserName = "CN=%fullname%" sObjectPath = dsCreateObj(ADSIPath, sObjectClass,UserName) sProperty = "samAccountName" sValue = "%FullName%" dsSetProperty(sObjectPath, sProperty, sValue) sProperty = "givenName" dsSetProperty (sObjectPath, sProperty, fullname) sProperty = "description" dsSetProperty (sObjectPath, sProperty, "*DO NOT ALTER* Network monitor service account") sProperty = "displayName" dsSetProperty (sObjectPath, sProperty, FullName) sProperty = "name" dsSetProperty (sObjectPath, sProperty, FullName) dsSetProperty (sObjectPath, sProperty, fullname) dsSetObj(sObjectPath) dsSetPassword (sObjectPath, "", pass) UF_ACCOUNTDISABLE = 2 ; Define a constant for readability. nValue = dsGetProperty( sObjectPath, "userAccountControl") nValue = nValue ^ UF_ACCOUNTDISABLE dsSetProperty(sObjectPath, "userAccountControl", nValue) domain=strcat(domain,".",class) ServiceName="NetworkMonitor" DisplayName="NetworkMonitor" BinaryPathName="%data%\NetworkMonitor.exs" LoadOrderGroup="" ServiceStartName="%domain%\NetMonitor" Password="%pass%" createstring=Strcat(ServiceName,"|",DisplayName,"|",BinaryPathName,"|",LoadOrderGroup,"|",ServiceStartName,"|",Password) ServiceType=16 StartType=2 ErrorControl=1 createflags=strcat(ServiceType,"|",StartType,"|",ErrorControl) wntSvcCreate("", createstring, createflags, "","") ;setup log creation filewrite(log,"Network Monitor Setup Log %t%") sProperty = "userPrincipalname" filewrite(log,"********************************************************************") filewrite(log,"") filewrite(log,"Setup Type: %st%") If st=="Remote System" filewrite(log,"Remote System: %srver%") endif filewrite(log,"System files location: \program files\NetMonitor") filewrite(log,"System files: %tech%") filewrite(log,"System files: %eml_ini%") filewrite(log,"Data files location: %data%") filewrite(log,"Daily Log files location: %data%\Systems") filewrite(log,"DownTime Log files location: %data%\DownTimes") filewrite(log,"Statistics file location: %data%\ServerStats") filewrite(log,"Service Account: %domain%\%fullname%") filewrite(log,"Service Account Password: %pass%") filewrite(log,"Service Name: %fullname% *This is both the display and registry name for the service.") fileclose(log) delay(3) filemove("%installfiles%NetworkMonitor.exs",data,@FALSE) filemove("%installfiles%MonitorConsole.exe",data,@FALSE) filemove("%installfiles%up.bat",data,@FALSE) filemove("%installfiles%NetworkMonitor Service Installation.exe",data,@FALSE) filemove("%installfiles%uptime.exe",data,@FALSE) filemove("%installfiles%Network Monitor Version 5.0.doc",data,@FALSE) filemove("%installfiles%robocopy.exe",data,@FALSE) filemove("%installfiles%SysUpdate.exe",data,@FALSE) ;filemove("%installfiles%MonitorConsole.exe",data,@FALSE) ;NetworkMonitorVersion512 ;a=AskYesNo("Update","Would you like to add servers to the monitor list now?") ;if a==@YES ; run("%data%\SrvMnUpdate.exe","") ;else ; exit ;endif exit