Solved

remote registry and insert analysis services dumps on sql table

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to shrink a transaction log file down to a reasonable size.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now