Solved

remote registry and insert analysis services dumps on sql table

Posted on 2012-04-10
1
247 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 40

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Synchronize a new Active Directory domain with an existing Office 365 tenant
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

830 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