Solved

remote registry and insert analysis services dumps on sql table

Posted on 2012-04-10
1
245 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
1 Comment
 
LVL 39

Accepted Solution

by:
lcohan earned 500 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how the fundamental information of how to create a table.

810 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