Blog Posts by volantedesktop

Ask a question

Copying files from SMS Distribution points using command line

When using a command line with SMS (.cmd) it will default to using the current windows path.

Using this command will insert the current path which is hany when rolling out from multiple distribution points as it is updated depending on what server share its in.

For example you would use this line:

xcopy.exe "%~dp0*.*" c:\temp /E /I /Q /H /Y

The %~dp0 is replace with the current server path.

Be the first to comment

Deploy Registry changes with SMS using a script

While trying to recently deploy a registry change with SMS I found that a script solved the problem nicely when regedit /s failed. I have added the script here which you can then edit as required.

This script was used to create a new ODBC entry:

'==========================================================================

'

' VBScript: AUTHOR: Volante Desktop , 12/5/2008

'

' NAME:

'

' COMMENT: I have commented out entries not used in this script

' I plan to use this as a template of furture registry deployments

'==========================================================================

Option Explicit

On Error Resume Next

Dim strKeyPath ' the portion of registry to read

Dim strComputer ' the target computer

Dim strValueName 'holds the string key variable

Dim strValue ' holds the key value

'Dim dwValue ' holds the dword key value

Dim oReg ' holds connection to registry provider

'Const HKCR = &H80000000 'HKEY_CLASSES_ROOT

'Const HKCU = &H80000001 'HKEY_CURRENT_USER

Const HKLM = &H80000002 'HKLM

'Const HKU = &H80000003 'HKEY_USERS

'Const HKCC = &H80000005 'HKEY_CURRENT_CONFIG

strComputer = "."

Set StdOut = WScript.StdOut

'load the registry

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_

strComputer & "\root\default:StdRegProv")

'set path for the first change

strKeyPath = "SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources"

strValueName = "ecprod"

strValue = "Oracle in 0800"

'apply the change to the registry

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

'set path for the second change to add a new key

strKeyPath = "SOFTWARE\ODBC\ODBC.INI\ecprod"

oReg.CreateKey HKLM, strKeyPath

'reset the path for the next series of changes

strKeyPath = "SOFTWARE\ODBC\ODBC.INI\ecprod"

'Set and apply the rest of the changes to the registry

strValueName = "Driver"

strValue = "k:\\ora\\r01\\Home\\0800\\BIN\\SQORA32.DLL"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "Translation DLL"

strValue = ""

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "Translation Option"

strValue = "10"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "Attributes"

strValue = "w"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "PrefetchCount"

strValue = "10"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "ForceWCHAR"

strValue = "F"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "FailoverDelay"

strValue = "10"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "FailoverRetryCount"

strValue = "10"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "MetadataIdDefault"

strValue = "F"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "Longs"

strValue = "F"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "CloseCursor"

strValue = "F"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "EXECSchemaOpt"

strValue = ""

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "EXECSyntax"

strValue = "F"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "Application Attributes"

strValue = "T"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "SQLGetData extensions"

strValue = "F"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "ResultSets"

strValue = "T"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "QueryTimeout"

strValue = "T"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "Failover"

strValue = "T"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "Lobs"

strValue = "T"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "DisableMTS"

strValue = "T"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "BatchAutocommitMode"

strValue = "IfAllSuccessful"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "Description"

strValue = "ecprod"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "ServerName"

strValue = "ecprod"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "Password"

strValue = ""

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "UserID"

strValue = ""

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

strValueName = "DSN"

strValue = "ecprod"

oReg.SetStringValue HKLM,strKeyPath,strValueName,strValue

'Not used in this instance as used to set DWord value rather than string value

'kept here for future reference

'strKeyPath = "SOFTWARE\ODBC\ODBC.INI\ecprod"

'strValueName = "DWORD Value Name"

'strValue = "value"

'dwValue = 10

'oReg.SetDWORDValue HKLM,strKeyPath,strValueName,dwValue

Be the first to comment
Showing 1 - 2 of 2 results

Top Contributors

Talk About Mac OS X