?
Solved

set FQDN for SQL server on vCenter server

Posted on 2010-09-10
8
Medium Priority
?
1,455 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 2000 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
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
Let's recap what we learned from yesterday's Skyport Systems webinar.
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

850 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