Hello,I hope someone can offer some guidance. I have written a function to set some SSRS settings. It all worked well until I added a couple more SSRS instances. Now, even though I specify the instance name when I call it, the script tries to do all the SSRS instances it finds. I just want it to do the one I specify when I call it. From what I understand I need to apply a filter, but I am not sure where or how, and whether I could apply the filter at the global variable level, rather than on each of the functions that contains the variable. The variable is "SQLInstanceName".Here is my code...function fn-Set-SSRS-ReportServer-VirtualDirectory ([String]$SQLInstanceName, [String]$SSRSDatabaseServerName, [String]$SSRSDatabaseServerTcpPort, [String]$InstID){ Try { $SSRSConMgr = Get-WmiObject -Namespace "root\Microsoft\SqlServer\ReportServer\RS_$SQLInstanceName\v11\Admin" -Class MSReportServer_ConfigurationSetting -ComputerName $ManagedComputer $SSRSConMgr.SetDatabaseConnection("$SSRSDatabaseServerName,$SSRSDatabaseServerTcpPort","ReportServer", 2, "", "") $SSRSConMgr.SetVirtualDirectory("ReportServerWebService", "ReportServer", "3081") $SSRSConMgr.ReserveURL("ReportServerWebService","http://+:80","3081") $SSRSConMgr.ReserveURL("ReportServerWebService","http://+:443","3081") $SSRSConMgr.SetVirtualDirectory("ReportManager", "Reports", "3081") $SSRSConMgr.ReserveURL("ReportManager","http://+:80","3081") $SSRSConMgr.ReserveURL("ReportManager","https://+:443","3081") $XML=[XML](Get-Content "E:\Program Files\Microsoft SQL Server\MSRS11.$SQLInstanceName\Reporting Services\ReportServer\rsreportserver.config") $InstID = $XML.DocumentElement.InstallationID.Trim("{","}") $SSRSConMgr.DeleteEncryptedInformation() $SSRSConMgr.InitializeReportServer($InstID) $Result = $SSRSConMgr.Isinitialized if ($Result -ne 'True') { Throw "$Result and $Error[0]" } } Catch { Write-Error $Result } }Thank you for reading.Kind regards,D.
↧