Solved

set FQDN for SQL server on vCenter server

Posted on 2010-09-10
8
1,433 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

This article will show you how to create an ISO CD-ROM/DVD-ROM image (*.iso), and MD5 checksum signature, for use with VMware vSphere Hypervisor 6.5 (ESXi 6.5). It's a good idea to compare checksums, because many installations fail because of a corr…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

770 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