If you are using Windows Server 2008/R2, make sure you run the PowerShell script as Administrator or it will fail with lots of error messages. The script is compatible with both SQL 2008 and SQL 2008 R2.
--
## Creates a 64-bit System DSN for vCenter Server.
## Version 1.0, 21 August 2010
$DSNName = "vCenter Server"
$DBName = "vCenter Server"
If($args[0] -eq $NULL) { echo "Must specify FQDN of SQL server."; Exit}
$HKLMPath1 = "HKLM:\SOFTWARE\ODBC\ODBC.INI\" + $DSNName
$HKLMPath2 = "HKLM:\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources"
md $HKLMPath1 -ErrorAction silentlycontinue
set-itemproperty -path $HKLMPath1 -name Driver -value "C:\WINDOWS\system32\sqlncli10.dll"
set-itemproperty -path $HKLMPath1 -name Description -value $DSNName
set-itemproperty -path $HKLMPath1 -name Server -value $args[0]
set-itemproperty -path $HKLMPath1 -name LastUser -value "Administrator"
set-itemproperty -path $HKLMPath1 -name Trusted_Connection -value "Yes"
set-itemproperty -path $HKLMPath1 -name Database -value $DBName
## This is required to allow the ODBC connection to show up in the ODBC Administrator application.
md $HKLMPath2 -ErrorAction silentlycontinue
set-itemproperty -path $HKLMPath2 -name "$DSNName" -value "SQL Server Native Client 10.0"
--
Just save the file on your vCenter server, open an elevated PowerShell command window and execute the script with an argument of the FQDN of your SQL server. For example:
DSN-vCenter64.ps1 SQL01.contoso.net
Be sure to change the database name variable to match what you configured in SQL.
Great script, I would just add note that you also need to install driver "SQL Server Native Client 10.0"
ReplyDeletehttp://www.microsoft.com/downloads/en/details.aspx?FamilyId=228DE03F-3B5A-428A-923F-58A033D316E1&displaylang=en)
Regards,
Mladen