Skip to content

vbscript assistance.

Featured Replies

Hi All,

 

I am trying to build an enviornemnt an dusing Hyrdation scripts from deploymentresearch.com ( thanks to Johan Arwidmark and team). The below mentioned script works fine with local SQL server deployment but i want it to work with my remote SQL server instance. Can any please advice as to what all changes I have to do to make this script work.

 

 

<job id="Install-SystemCenter2012R2OperationsManager">
<script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
<script language="VBScript">

'//----------------------------------------------------------------------------
'// Solution: Hydration
'// Purpose: Used to Install Install - System Center 2012 R2 Operations Manager
'// Version: 1.0 - July 12, 2012 - Mikael Nystrom
'// Version: 1.1 - January 10, 2014 - Johan Arwidmark
'//
'// This script is provided "AS IS" with no warranties, confers no rights and
'// is not supported by the authors or Deployment Artist.
'//
'//----------------------------------------------------------------------------

'//----------------------------------------------------------------------------
'// Global constant and variable declaration
'//----------------------------------------------------------------------------

Option Explicit

Dim iRetVal

'//----------------------------------------------------------------------------
'// End declarations
'//----------------------------------------------------------------------------

'//----------------------------------------------------------------------------
'// Main routine
'//----------------------------------------------------------------------------

'On Error Resume Next
iRetVal = ZTIProcess
ProcessResults iRetVal
On Error Goto 0

'//---------------------------------------------------------------------------
'//
'// Function: ZTIProcess()
'//
'// Input: None
'//
'// Return: Success - 0
'// Failure - non-zero
'//
'// Purpose: Perform main ZTI processing
'//
'//---------------------------------------------------------------------------
Function ZTIProcess()

Dim sFile
Dim sCmd
Dim sApp
Dim sSCOMActionAccount
Dim sSCOMActionAccountPW
Dim sSCOMDASAccount
Dim sSCOMDASAccountPW
Dim sSCOMSrv
Dim sSCOMDBSrv
Dim sSCOMManagementGroup

sSCOMActionAccount = oEnvironment.item("HydrationSCOMActionAccount")
sSCOMActionAccountPW = oEnvironment.item("HydrationSCOMActionAccountPassword")
sSCOMDASAccount = oEnvironment.item("HydrationSCOMDASAccount")
sSCOMDASAccountPW = oEnvironment.item("HydrationSCOMDASAccountPassword")
sSCOMSrv = oEnvironment.item("HostName")
sSCOMDBSrv = oEnvironment.item("HostName")
sSCOMManagementGroup = oEnvironment.item("OrgName")

sApp = "System Center 2012 R2 Operations Manager"

oLogging.ReportProgress "Installing " & sApp & "", 20


sFile = oUtility.ScriptDir & "\Source\setup.exe"

If not oFSO.FileExists(sFile) then
oLogging.CreateEntry "Install " & sApp & ": " & sFile & " was not found, unable to install " & sApp & "", LogTypeError
ZTIProcess = Failure
Exit Function
End if

oLogging.CreateEntry "Installing " & sApp & ": Server", LogTypeInfo
oLogging.CreateEntry "The Setup log file for " & sApp & " is OpsMgrSetupWizard.log", LogTypeInfo

sCmd = """" & oUtility.ScriptDir & "\Source\setup.exe"" /silent /install /components:OMServer /ManagementGroupName:" & sSCOMManagementGroup & " /SqlServerInstance:" & sSCOMSrv & " /DatabaseName:OperationsManager /DWSqlServerInstance:" & sSCOMSrv & " /DWDatabaseName:OperationsManagerDW /UseLocalSystemDASAccount /DatareaderUser:" & sSCOMDASAccount & " /DatareaderPassword:" & sSCOMDASAccountPW & " /DataWriterUser:" & sSCOMDASAccount & " /DataWriterPassword:" & sSCOMDASAccountPW & " /EnableErrorReporting:Never /SendCEIPReports:0 /UseMicrosoftUpdate:0 /AcceptEndUserLicenseAgreement:1 /ActionAccountUser:" & sSCOMActionAccount & " /ActionAccountPassword:" & sSCOMActionAccountPW & ""
wscript.echo sCmd

iRetVal = oUtility.RunWithHeartbeat(sCmd)

if iRetVal <> 0 then
oLogging.CreateEntry "Install " & sApp & ": Error installing " & sApp & ", Server was not installed.", LogTypeWarning
End If

oLogging.CreateEntry "Installing " & sApp & ": Console", LogTypeInfo

sCmd = """" & oUtility.ScriptDir & "\Source\setup.exe"" /silent /install /components:OMConsole /EnableErrorReporting:Never /SendCEIPReports:0 /UseMicrosoftUpdate:0"
wscript.echo sCmd
iRetVal = oUtility.RunWithHeartbeat(sCmd)

if iRetVal <> 0 then
oLogging.CreateEntry "Install " & sApp & ": Error installing " & sApp & ", Console was not installed.", LogTypeWarning
End If

oLogging.CreateEntry "Installing " & sApp & ": Reporting", LogTypeInfo

sCmd = """" & oUtility.ScriptDir & "\Source\setup.exe"" /silent /install /components:OMReporting /SRSInstance:" & sSCOMSrv & " /DataReaderUser:" & sSCOMDASAccount & " /DataReaderPassword:" & sSCOMDASAccountPW & " /SendODRReports:0 /UseMicrosoftUpdate:0"
wscript.echo sCmd
iRetVal = oUtility.RunWithHeartbeat(sCmd)

if iRetVal <> 0 then
oLogging.CreateEntry "Install " & sApp & ": Error installing " & sApp & ", Reporting was not installed.", LogTypeWarning
End If

End Function
</script>
</job>

 

Appreciate your help in advance.

  • Author

Solved:

 

'//
'// This script is provided "AS IS" with no warranties, confers no rights and
'// is not supported by the authors or Deployment Artist.
'//
'//----------------------------------------------------------------------------

'//----------------------------------------------------------------------------
'// Global constant and variable declaration
'//----------------------------------------------------------------------------

Option Explicit

Dim iRetVal

'//----------------------------------------------------------------------------
'// End declarations
'//----------------------------------------------------------------------------

'//----------------------------------------------------------------------------
'// Main routine
'//----------------------------------------------------------------------------

'On Error Resume Next
iRetVal = ZTIProcess
ProcessResults iRetVal
On Error Goto 0

'//---------------------------------------------------------------------------
'//
'// Function: ZTIProcess()
'//
'// Input: None
'//
'// Return: Success - 0
'// Failure - non-zero
'//
'// Purpose: Perform main ZTI processing
'//
'//---------------------------------------------------------------------------
Function ZTIProcess()

Dim sFile
Dim sCmd
Dim sApp

Dim sSCOMManagementGroup

sSCOMManagementGroup = oEnvironment.item("OrgName")

sApp = "System Center 2012 R2 Operations Manager"

oLogging.ReportProgress "Installing " & sApp & "", 20


sFile = oUtility.ScriptDir & "\Source\setup.exe"

If not oFSO.FileExists(sFile) then
oLogging.CreateEntry "Install " & sApp & ": " & sFile & " was not found, unable to install " & sApp & "", LogTypeError
ZTIProcess = Failure
Exit Function
End if

oLogging.CreateEntry "Installing " & sApp & ": Server", LogTypeInfo
oLogging.CreateEntry "The Setup log file for " & sApp & " is OpsMgrSetupWizard.log", LogTypeInfo

sCmd = """" & oUtility.ScriptDir & "\Source\setup.exe"" /silent /install /components:OMServer /ManagementGroupName:" & sSCOMManagementGroup & " /SqlServerInstance:SQLSERVER01\INSTANCE /DatabaseName:OperationsManager /DWSqlServerInstance:SQLSERVER02\INSTANCE /DWDatabaseName:OperationsManagerDW /UseLocalSystemDASAccount /DatareaderUser:Domain\SCOM_DA /DatareaderPassword:********** /DataWriterUser:Domain\SCOM_DA /DataWriterPassword:******* /EnableErrorReporting:Never /SendCEIPReports:0 /UseMicrosoftUpdate:0 /AcceptEndUserLicenseAgreement:1 /ActionAccountUser:Domain\SCOM_AA /ActionAccountPassword:*******"

wscript.echo sCmd

iRetVal = oUtility.RunWithHeartbeat(sCmd)

if iRetVal <> 0 then
oLogging.CreateEntry "Install " & sApp & ": Error installing " & sApp & ", Server was not installed.", LogTypeWarning
End If

oLogging.CreateEntry "Installing " & sApp & ": Console", LogTypeInfo

sCmd = """" & oUtility.ScriptDir & "\Source\setup.exe"" /silent /install /components:OMConsole /EnableErrorReporting:Never /SendCEIPReports:0 /UseMicrosoftUpdate:0"
wscript.echo sCmd
iRetVal = oUtility.RunWithHeartbeat(sCmd)

if iRetVal <> 0 then
oLogging.CreateEntry "Install " & sApp & ": Error installing " & sApp & ", Console was not installed.", LogTypeWarning
End If

'//----------------------------------------------------------------------------
'// oLogging.CreateEntry "Installing " & sApp & ": Reporting", LogTypeInfo
'//
'// sCmd = """" & oUtility.ScriptDir & "\Source\setup.exe"" /silent /install /components:OMReporting /SRSInstance:SQLSERVER01 /DataReaderUser:" & sSCOMDASAccount & " /DataReaderPassword:" & sSCOMDASAccountPW & " /SendODRReports:0 /UseMicrosoftUpdate:0"
'// wscript.echo sCmd
'// iRetVal = oUtility.RunWithHeartbeat(sCmd)
'//
'// if iRetVal <> 0 then
'// oLogging.CreateEntry "Install " & sApp & ": Error installing " & sApp & ", Reporting was not installed.", LogTypeWarning
'// End If
'//----------------------------------------------------------------------------
End Function
</script>
</job>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.