Backing up the Encryption Key with Powershell
Hi, I need to automate the backup of the encryption key of SSRS with Powershell. I tried wrapping the application rskymgmt with no success. Then I found out that you could do it with the WMI class as mention here: http://msdn.microsoft.com/en-us/library/ms155048(v=SQL.100).aspx#CommunityContent. How would I do that in Powershell, all my attempts have failed! thx in advance.
November 17th, 2010 1:12pm

Hi Eric, We can use the following PowerShell script to backup the encryption key: Write-Output "Backup encryption key file" $serverClass = get-wmiobject -namespace "root\microsoft\sqlserver\reportserver\rs_mssqlserver\v10\admin" -class "MSReportServer_ConfigurationSetting" if ($serverClass -eq $null) { throw "Cannot find wmi class" } $password = "Password01!" $keyFile = $null $length = 0 $HRESULT = 0 $extendedErrors = $null $result = $serverClass.BackupEncryptionKey("Password01!") $stream = [System.IO.File]::Create("c:\\ssrs.snk", $result.KeyFile.Length); $stream.Write($result.KeyFile, 0, $result.KeyFile.Length); $stream.Close(); If you have any more questions, please feel free to ask. Thanks, Jin Chen Jin Chen - MSFT
Free Windows Admin Tool Kit Click here and download it now
November 22nd, 2010 4:36am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics