| | | | |
| Option Explicit |
| |
| DIM Fso, TempFolder, WshObj, ObjNet |
| DIM FileName, WriteFile, SqlCmd, ChangePassword |
| DIM Regions, Remote_Password, Local_Password, Command, Answer, Return, Region |
| DIM ParadigmPath, Repl_Installed |
| |
| Set Fso = CreateObject("Scripting.FileSystemObject") |
| Set TempFolder = FSO.GetSpecialFolder(2) |
| Set WshObj=Wscript.CreateObject("Wscript.Shell") |
| Set ObjNet = WScript.CreateObject("WScript.Network") |
| |
| ON ERROR Resume Next |
| ParadigmPath = WSHObj.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\ComputerAssociates\CA Service Desk\4.0\Install Path") |
| |
| Initialize |
| |
| MsgBox("Paradigm Replication is " & Repl_Installed & ".") |
| |
| If Not IsEmpty(Command) Then |
| | Answer = MsgBox("Do you want to " & Command & " Paradigm Replication?",vbYesNoCancel,"Paradigm Replication") |
| | If Answer = vbYes |
| | | Main |
| | End If |
| | If Answer = vbNo and Command = "drop" Then |
| | | Answer = MsgBox("Do you want to change the password for the Subscriber?", vbYesNoCancel, "Change Password") |
| | | If Answer = vbYes Then |
| | | | ChangeSubscriberPassword |
| | | End If |
| | End If |
| End If |
| |
| Sub Main |
| | Local_Password = InputBox("Please enter the sa password for " & ObjNet.ComputerName, "SA Password") |
| | WshObj.Run "cmd /c osql -U sa -P " & Local_Password & " -i " & ParadigmPath & "\Site\Mods\Data\" & FileName , 7, TRUE |
| | If Command = "install" Then |
| | | Answer = MsgBox("Do you want to change the password for the Subscriber?", vbYesNoCancel, "Change Password") |
| | | If Answer = vbYes Then |
| | | | ChangeSubscriberPassword |
| | | End If |
| | End If |
| End Sub |
| |
| Sub ChangeSubscriberPassword |
| | If IsEmpty(Local_Password) Then |
| | | Local_Password = InputBox("Please enter the sa password for " & ObjNet.ComputerName, "SA Password") |
| | End If |
| |
| | If Not (ObjNet.ComputerName = "NOIDAAHD") Then |
| | | msgbox "Installing Replication for Noida" |
| | | Remote_Password = InputBox("Please enter the sa password for NoidaAHD", "SA Password") |
| | | SqlCmd = "sp_changesubscriber @subscriber = N'NOIDAAHD', @login = N'sa', @password = N'" & Remote_Password & "'" |
| | | WshObj.Run "CMD /c osql -U sa -P " & Local_Password & " -Q " & CHR(34) & SqlCmd & CHR(34) , 7, TRUE |
| | End If |
| | If (ObjNet.ComputerName = "NOIDAAHD") Then |
| | | msgbox "Installing Replication for region" |
| | | FOR Each Region in Regions |
| | | | Remote_Password = InputBox("Please enter the sa password for " & Region, "SA Password") |
| | | | SqlCmd = "sp_changesubscriber @subscriber = N'" & Region & "', @login = N'sa', @password = N'" & Remote_Password & "'" |
| | | | WshObj.Run "CMD /c osql -U sa -P " & Local_Password & " -Q " & CHR(34) & SqlCmd & CHR(34) , 7, TRUE |
| | | Next |
| | End If |
| End Sub |
| |
| Sub Initialize |
| | Regions = Array("BANGALOREAHD", "CALCUTTAAHD", "CHENNAIAHD", "DELHIAHD", "MUMBAIAHD") |
| |
| | ON ERROR Resume Next |
| | Repl_Installed = WSHObj.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\ComputerAssociates\CA Service Desk\4.0\Replication") |
| |
| | If Repl_Installed = "installed" Then |
| | | Command = "drop" : FileName = "rpl_drop.sql" |
| | End If |
| |
| | If (Repl_Installed = "not installed" OR Repl_Installed = "") Then |
| | | Repl_Installed = "not installed" |
| | | Command = "install" : FileName = "rpl_inst.sql" |
| | End If |
| End Sub |