?
Solved

remote registry and insert analysis services dumps on sql table

Posted on 2012-04-10
1
Medium Priority
?
257 Views
Last Modified: 2012-04-11
Hello,

I try to access on a remote server registry for executing this function :
function imp-dumps {
	$inst_list=(&$OSQL_CMD -E -S $R -d Monitor -h -1 -b -Q "set nocount on; select RTRIM( +'''' + instancename + '''')  FROM [Monitor].[dbo].[INSTANCE_NAME]  where InstanceName = '$I' ")
	if ($CO -eq "Dumps" -or $CO -eq "ALL") {
		ForEach($inst in $inst_list)  {
		$comp_name1=(get-itemproperty -path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\OLAP").$inst_name
		$key_name="HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\"+$comp_name1+"\CPE"
		$serverLogFolder=$(Get-ItemProperty $key_name).ErrorDumpDir
 		$DateToCompare = (Get-date).AddDays(-1)
 		$dumps = dir $serverLogFolder | ?{$_.name -match “^*.mdmp$”} | sort name | where-object {$_.lastwritetime –gt $DateToCompare}
		$dumps | SELECT LastWriteTime,Name, Length
		$coll_dumps=(&$OSQL_CMD -E -S $R -d Monitor -h -1 -b -Q "set nocount on;
		INSERT INTO DUMP
		SELECT  '$I', getdate(), $dumps)')")
		echo $coll_dumps | out-file $log_file
}
}
}

Open in new window


This error is returned : Get-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\OLAP'.

How can I resolve this problem?

Thanks

bibi
0
Comment
Question by:bibi92
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 40

Accepted Solution

by:
lcohan earned 2000 total points
ID: 37833076
Can you RDP to that remote server to check and make sure that you have the path from error above in the registry?

If you can't RDP then try code below that should list all path under: 'SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\' - obviously you run this in a SSMS query against that SQL Server:


EXEC master.dbo.xp_regread N'HKEY_LOCAL_MACHINE', N'SOFTWARE\Microsoft\Microsoft SQL Server', N'InstalledInstances'
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Suggested Courses

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