Solved

set FQDN for SQL server on vCenter server

Posted on 2010-09-10
8
1,438 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sql query help 15 50
Multiple Errors from DCDIAG 2 20
SQL Select Query help 1 34
Block Active Directory users from logging into Synology DSM? 2 26
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
Ransomware is a malware that is again in the list of security  concerns. Not only for companies, but also for Government security and  even at personal use. IT departments should be aware and have the right  knowledge to how to fight it.
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:
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

685 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