Solved

set FQDN for SQL server on vCenter server

Posted on 2010-09-10
8
1,431 Views
Last Modified: 2012-05-10
I have installed W2K8 R2 x64 Server + SQL 2008 x64
vCenter server 4.1 needs to be installed on this server.

To Automate vCenter 4.1 64-bit DSN Creation I am using the following script:
## Creates a 32-bit System DSN on 64-bit OS.

$DSNName = "vCenter Server Update Manager"
$DBName = "vCenter Update Manager"

If($args[0] -eq $NULL) { echo "Must specify FQDN or IP of SQL server."; Exit}

$HKLMPath1 = "HKLM:\SOFTWARE\Wow6432Node\ODBC\ODBC.INI\" + $DSNName

$HKLMPath2 = "HKLM:\SOFTWARE\Wow6432Node\ODBC\ODBC.INI\ODBC Data Sources"

md $HKLMPath1 -ErrorAction silentlycontinue

set-itemproperty -path $HKLMPath1 -name Driver -value "C:\WINDOWS\SysWOW64\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 ""
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" 

Open in new window


This server cannnot be added to a domain. For this to work I need to set FQDN for the SQL server.

I have changed the workgroup name to name.nl & have changed the DNS suffix on my TCP connection.


When I run the script it still gives me the following massage:
MYST SPECIFY FQDN OF SQL SERVER
0
Comment
Question by:sayadi
  • 3
  • 3
  • 2
8 Comments
 
LVL 9

Expert Comment

by:Gianpiero Rossi
ID: 33647761
ho do you run this script?
it want an input  parameter: the fqdn of the sql server

"If($args[0] -eq $NULL) { echo "Must specify FQDN or IP of SQL server."; Exit}"

as you can see, as line 6, if it doesn't have any paramente it exit giving you the message that you are reporting
0
 
LVL 2

Author Comment

by:sayadi
ID: 33647778
Powershell
0
 
LVL 9

Accepted Solution

by:
Gianpiero Rossi earned 500 total points
ID: 33647800
.... ok... i meant, i would like to see what are you writing at the prompt,

you must type something like

script [FQDNDBSERVER]
0
 
LVL 28

Expert Comment

by:bgoering
ID: 33648039
You willl need to create an entry in your hosts file specifying the fqdn you are setting up for the SQL server in order for it to properly resolve to the IP address. Alternatively, it appears that the script will live with directly passing an IP address for the server.

Either way you need to pass either the fqdn or ip address to the script as qpiero74 noted above.

Good Luck
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 2

Author Comment

by:sayadi
ID: 33648041
Oh! I had the wrong script under copy paste ( sorry )

[code]
## 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"
[/code]
0
 
LVL 9

Expert Comment

by:Gianpiero Rossi
ID: 33648061
also for this you have to pass an input parameter when you call the script.
0
 
LVL 2

Author Closing Comment

by:sayadi
ID: 33648110
Thank you
0
 
LVL 28

Expert Comment

by:bgoering
ID: 33648140
if all this is running on the same local machine, you could modify your script something like below.. Note that this mod to the script will no longer you to specify a remote SQL server for creating the DSN.



## Creates a 64-bit System DSN for vCenter Server.

## Version 1.0, 21 August 2010



$DSNName = "vCenter Server"

$DBName = "vCenter Server"



$hname = $env:computername



$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 $hname

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"

Open in new window

0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Suggested Solutions

It Is not possible to enable LLDP in vSwitch(at least is not supported by VMware), so in this article we will enable this, and also go trough how to enabled CDP and how to get this information in vSwitches and also in vDS.
In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
Teach the user how to join ESXi hosts to Active Directory domains Open vSphere Client: Join ESXi host to AD domain: Verify ESXi computer account in AD: Configure permissions for domain user in ESXi: Test domain user login to ESXi host:
Teach the user how to use vSphere Update Manager to update the VMware Tools and virtual machine hardware version Open vSphere Client: Review manual processes for updating VMware Tools and virtual hardware versions: Create a new baseline group in vSp…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now