Solved

set FQDN for SQL server on vCenter server

Posted on 2010-09-10
8
1,435 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
This article explains the steps required to use the default Photos screensaver to display branding/corporate images
Teach the user how to install log collectors and how to configure ESXi 5.5 for remote logging Open console session and mount vCenter Server installer: Install vSphere Core Dump Collector: Install vSphere Syslog Collector: Open vSphere Client: Config…
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 …

828 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