'###############################################################################' '# '# Dell Inc. PROPRIETARY INFORMATION '# This software is supplied under the terms of a license agreement or '# nondisclosure agreement with Dell Inc. and may not '# be copied or disclosed except in accordance with the terms of that '# agreement. '# '# Copyright (c) 2000-2006 Dell Inc. All Rights Reserved. '# '# Module Name: '# '# winrmconfig.vbs '# '# '# Abstract/Purpose: '# '# Non Interactive Custom Install Script to cutomize '# Systems Management Managed Node WINRM configuration. '# This non interactive script will configure winrm for default values '# needed for managed node to be accessible to central web server. '# '# '# Environment: '# '# Windows '# '############################################################################### ConfigureWInRMDefaults() Function ConfigureWInRMDefaults winrm_ver = 1 set oShell = createobject("wscript.shell") on error resume next 'FINDING OUT WINRM VERSION args = "winrm id -format:xml >%temp%\winrmidlog1" errTrap = oShell.run (args, 7, True) 'WScript.Echo "errTrap = "& errTrap Set fso = CreateObject("Scripting.FileSystemObject") Set tfolder = fso.GetSpecialFolder(2) Set xmlDoc = CreateObject("MSXml2.DOMDocument.3.0") 'WScript.Echo tfolder&"\winrmidlog1" xmlDoc.load tfolder&"\winrmidlog1" Set ret = xmlDoc.getElementsByTagName("wsmid:ProductVersion").item(0) 'WScript.Echo ret.text If 0 <> InStr(1, ret.text, "Stack: 2.0",VBTextCompare) Then winrm_ver = 2 End If If 0 <> InStr(1, ret.text, "Stack: 3.0",VBTextCompare) Then winrm_ver = 3 End If args = "winrm g winrm/config -format:xml >%temp%\winrmidlog2" 'WScript.Echo args errTrap = oShell.run (args, 7, True) 'WScript.Echo "errTrap = "& errTrap xmlDoc.load tfolder&"\winrmidlog2" Set envSize = xmlDoc.getElementsByTagName("cfg:MaxEnvelopeSizekb").item(0) Set timeOut = xmlDoc.getElementsByTagName("cfg:MaxTimeoutms").item(0) 'WScript.Echo envSize.text 'WScript.Echo timeOut.text 'CREATING LISTENER args = "winrm quickconfig -transport:https -q" 'WScript.Echo args errTrap = oShell.run (args, 7, True) 'WScript.Echo "errTrap = "& errTrap If errTrap = 0 Then 'SETTING MAX ENVELOP SIZE If cint(envSize.text) < 5120 Then args = "winrm s winrm/config @{MaxEnvelopeSizekb = ""5120 ""}" 'WScript.Echo args errTrap = oShell.run (args, 7, True) 'WScript.Echo "errTrap = "& errTrap End If 'SETTING MAX TIMEOUT If cint(timeOut.text) < 180000 then args = "winrm s winrm/config @{MaxTimeoutms = ""180000""}" 'WScript.Echo args errTrap = oShell.run (args, 7, True) 'WScript.Echo "errTrap = "& errTrap End If 'ADDING FIREWALL EXCEPTION & BACKWARD COMPATIBILITY args = "netsh firewall add portopening TCP 443 ""Port 443""" 'WScript.Echo args errTrap = oShell.run (args, 7, True) 'WScript.Echo "errTrap = "& errTrap If winrm_ver = 2 or winrm_ver = 3 Then args = "netsh firewall add portopening TCP 5986 ""Port 5986""" 'WScript.Echo args errTrap = oShell.run (args, 7, True) 'WScript.Echo "errTrap = "& errTrap args = "winrm s winrm/config/Service @{EnableCompatibilityHttpsListener = ""true""}" 'WScript.Echo args errTrap = oShell.run (args, 7, True) 'WScript.Echo "errTrap = "& errTrap End If End If End Function