bowlen 1 Report post Posted January 12, 2016 Hi All, I have a client who has just emailed me a VBS and asked me to convert it into a GPO. My experience with VB is pretty much 0, so this looks chinese to me. Could someone give me a hand as to what would be required to translate this into a GPO? Option Explicit on error resume next dim strEnviroNew, strEnviroOld Dim WshShell, OsType, objReg dim registry, strServer dim result Dim strComputer, OsResult dim strKeyPath, strValueName, strValue Const HKEY_LOCAL_MACHINE = &H80000002 const REG_KEY_PATH = "HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\ODBC\ODBC.INI\ODBC Data Sources" strServer = "canauth\authority" Set WshShell = CreateObject("WScript.Shell") strServer = "adm-auth-test\authtest" CreateOdbc("authcantest") CreateOdbc("authcandev") CreateOdbc("authcantrain") CreateOdbc("authcanconv") CreateOdbc("authngtest") strServer = "canauth\authority" CreateOdbc("authcanlive") CreateOdbc("authnglive") wscript.quit Function CreateOdbc(strEnviroNew) Dim objReg Dim strComputer dim strKeyPath, strValueName, strValue strComputer = "." Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") Set WshShell = CreateObject("WScript.Shell") OsType = WshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE") If OsType = "x86" then strKeyPath = "SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources" else strKeyPath = "SOFTWARE\Wow6432Node\ODBC\ODBC.INI\ODBC Data Sources" end if strValueName = strEnviroNew strValue = "SQL Server" objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue If OsType = "x86" then strKeyPath = "SOFTWARE\ODBC\ODBC.INI\" & strEnviroNew else strKeyPath = "SOFTWARE\Wow6432Node\ODBC\ODBC.INI\" & strEnviroNew end if objReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath strValueName = "Database" strValue = strEnviroNew objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue strValueName = "Description" strValue = strEnviroNew objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue strValueName = "Driver" strValue = "C:\WINDOWS\System32\SQLSRV32.dll" objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue strValueName = "QuotedId" strValue = "No" objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue strValueName = "Server" strValue = strServer objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue strValueName = "Trusted_Connection" strValue = "Yes" objReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue End Function Quote Share this post Link to post Share on other sites
Peter van der Woude 143 Report post Posted January 12, 2016 If you try, even a little bit, you can see that it's all about registry keys and values. Quote Share this post Link to post Share on other sites
bowlen 1 Report post Posted January 13, 2016 If you try, even a little bit, you can see that it's all about registry keys and values. Yeah I can see the registry changes that it's making. But it's also making ODBCs as well, which is above my head. Quote Share this post Link to post Share on other sites