Created
July 28, 2016 21:52
-
-
Save crshnbrn66/be7cc86f1cbc757c60430b8cd1b21a3c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------------------------------ | |
# Source File Information (DO NOT MODIFY) | |
# Source ID: 9ad32074-7adb-4822-a049-93600f966aa9 | |
# Source File: ..\Documents\SAPIEN\Projects\Gui-SSRS-Deploy\Gui-SSRS-Deploy.psproj | |
#------------------------------------------------------------------------ | |
#region Project Recovery Data (DO NOT MODIFY) | |
<#RecoveryData: | |
CAIAAB+LCAAAAAAABACNkV1rgzAUhu8L/Q/ifepHxU6IuVhdyy72QS27Had6HBkxkUTH/PeLU4dl | |
MHb5JO95XnJCT1ioD9R9Bi2w9cpx6LNW71i032DxBbXhSrJgE1BvhunuwAXeZyyBchv6u4jsoLyQ | |
6CYMCfhRQpJt7PtVEscACfWm8DQ6tZz7BplPvSXOciVKW+d4yzYzwYTOCSvUKAt8hBpT13VuOy7K | |
1PVdlreg267ZNMaM5X+P7kEI8gBcHpSuXxtTLV3zuZVV/5YdhbqAsKpgoXL2qq5BlnefLcphl6l7 | |
1h26bEwb2xBcNYwwvvtnTyM9af7GJYghMPSyY8dJnp9ykmEjVG9djc1T71dwvaLe1c9/AWT1pX0I | |
AgAA#> | |
#endregion | |
<# | |
.NOTES | |
-------------------------------------------------------------------------------- | |
Code generated by: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.123 | |
Generated on: 7/1/2016 12:15 PM | |
Generated by: tschumacher | |
-------------------------------------------------------------------------------- | |
.DESCRIPTION | |
Script generated by PowerShell Studio 2016 | |
#> | |
#region Source: Startup.pss | |
#region File Recovery Data (DO NOT MODIFY) | |
<#RecoveryData: | |
YgMAAB+LCAAAAAAABAC9k01LA0EMhu9C/8PQ87If3a5rYXZBWnopqFhRr9lttgzOR0lmLPvvbatU | |
0YMgsuSSNyF5CEnkPbbuFalfgAdxcFg5W40n43p0IYS8JbVVFvRSabwBg/XaA/mwi3fMMvmRPdVc | |
M6NptEI+6c9IXxtuHWnVROLxgzSN06NFYh60D4SVxeAJdCTuwqFHu8L+wb2grZqyhKItLrNZPsX0 | |
aiaTc9fvlHXPHs0QjPhJ2Y3bc7x0ZHgQ4nFPw4AI9spu/8JK867oyi7LNkUKOfzOejZ6kJnmjvD/ | |
QWf5fvIy+fpT9RvJGdnIYgMAAA==#> | |
#endregion | |
#---------------------------------------------- | |
#region Import Assemblies | |
#---------------------------------------------- | |
[void][Reflection.Assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089') | |
[void][Reflection.Assembly]::Load('System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089') | |
[void][Reflection.Assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') | |
#endregion Import Assemblies | |
#Define a Param block to use custom parameters in the project | |
#Param ($CustomParameter) | |
function Main { | |
<# | |
.SYNOPSIS | |
The Main function starts the project application. | |
.PARAMETER Commandline | |
$Commandline contains the complete argument string passed to the script packager executable. | |
.NOTES | |
Use this function to initialize your script and to call GUI forms. | |
.NOTES | |
To get the console output in the Packager (Forms Engine) use: | |
$ConsoleOutput (Type: System.Collections.ArrayList) | |
#> | |
Param ([String]$Commandline) | |
#-------------------------------------------------------------------------- | |
#TODO: Add initialization script here (Load modules and check requirements) | |
#-------------------------------------------------------------------------- | |
if((Call-MainForm_psf) -eq 'OK') | |
{ | |
} | |
$global:Credentials | |
$global:ExitCode = 0 #Set the exit code for the Packager | |
} | |
#endregion Source: Startup.pss | |
#region Source: MainForm.psf | |
function Call-MainForm_psf | |
{ | |
#region File Recovery Data (DO NOT MODIFY) | |
<#RecoveryData: | |
OlwAAB+LCAAAAAAABADdXFtzok4Wf7fK72DlaffPVFpEAbdmUuUliUmMMWqMycsUSqMkCMrNS+2H | |
33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aYAJHa+wgQMcEMSxn3QSBs | |
ubwHBDuSxJ1rWmqn4igSNzk9kJ6GWnRvkvohFP3JMG3QoeEeSHn2QTQnHo9Qn3cMdArcEegMO8L9 | |
OnTG0OF0wPSF+P8B5cHX8/cGzfTxiAx/NX5ninZMsAzbxfk6OEZV4HRYBAniAXGD3CQOA/TSNA0T | |
pHVVmZonhyhFbqOAG7vrZygRrpKqUzPA7Vp616AKBUj3aFB19SuXZGmNDdvHtcfDiOr4sqd/tHJy | |
g4CkugLsZI/dTouUqSIBh0tEqD09/MuaoIFNzeCruKhO6l/npqz98+///uP9/W9B07xyCwr+Odjd | |
PfBWLe8LVjsA/mF8D4xJhWq7xt/GWEA5HmBBvGWL3375OvjjOjMYRt/1ddCezy74liEb55dXo34h | |
dHfUBrk/riT2bJ6u5DzsTH/rJAMs8iHffom8sonrvitDgzDhv/huftOAVDyeXZ/n9qhcRy2iu0HH | |
Du6CXIS1+r1WIyqIC/Wbyxp+D3pLeXyR3dQXJqgbE2o2BxTGcNN2YOJY6Z87z5zDSjeKBXRH00K1 | |
HnrMFroHgfVnwbLoEDqg1sIaQcnsYmj1DFNTu1/ghp9k2es2F9/x38Hjy8F1mCO+svQ9jExpAlHm | |
GF5pTskpgsKyci4tcdJhXp2h9i06lQyTfj2jJelD/idZ/63wi/8BjsdHzjpcAAA=#> | |
#endregion | |
#---------------------------------------------- | |
#region Import the Assemblies | |
#---------------------------------------------- | |
[void][reflection.assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089') | |
[void][reflection.assembly]::Load('System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089') | |
[void][reflection.assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') | |
#endregion Import Assemblies | |
#---------------------------------------------- | |
#region Define SAPIEN Types | |
#---------------------------------------------- | |
try{ | |
$local:type = [FolderBrowserModernDialog] | |
} | |
catch | |
{ | |
Add-Type -ReferencedAssemblies ('System.Windows.Forms') -TypeDefinition @" | |
using System; | |
using System.Windows.Forms; | |
using System.Reflection; | |
namespace SAPIENTypes | |
{ | |
public class FolderBrowserModernDialog : System.Windows.Forms.CommonDialog | |
{ | |
private System.Windows.Forms.OpenFileDialog fileDialog; | |
public FolderBrowserModernDialog() | |
{ | |
fileDialog = new System.Windows.Forms.OpenFileDialog(); | |
fileDialog.Filter = "Folders|\n"; | |
fileDialog.AddExtension = false; | |
fileDialog.CheckFileExists = false; | |
fileDialog.DereferenceLinks = true; | |
fileDialog.Multiselect = false; | |
fileDialog.Title = "Select a folder"; | |
} | |
public string Title | |
{ | |
get { return fileDialog.Title; } | |
set { fileDialog.Title = value; } | |
} | |
public string InitialDirectory | |
{ | |
get { return fileDialog.InitialDirectory; } | |
set { fileDialog.InitialDirectory = value; } | |
} | |
public string SelectedPath | |
{ | |
get { return fileDialog.FileName; } | |
set { fileDialog.FileName = value; } | |
} | |
object InvokeMethod(Type type, object obj, string method, object[] parameters) | |
{ | |
MethodInfo methInfo = type.GetMethod(method, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); | |
return methInfo.Invoke(obj, parameters); | |
} | |
bool ShowOriginalBrowserDialog(IntPtr hwndOwner) | |
{ | |
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog(); | |
folderBrowserDialog.Description = this.Title; | |
folderBrowserDialog.SelectedPath = !string.IsNullOrEmpty(this.SelectedPath) ? this.SelectedPath : this.InitialDirectory; | |
folderBrowserDialog.ShowNewFolderButton = false; | |
if (folderBrowserDialog.ShowDialog() == DialogResult.OK) | |
{ | |
fileDialog.FileName = folderBrowserDialog.SelectedPath; | |
return true; | |
} | |
return false; | |
} | |
protected override bool RunDialog(IntPtr hwndOwner) | |
{ | |
if (Environment.OSVersion.Version.Major >= 6) | |
{ | |
try | |
{ | |
bool flag = false; | |
System.Reflection.Assembly assembly = Assembly.Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); | |
Type typeIFileDialog = assembly.GetType("System.Windows.Forms.FileDialogNative").GetNestedType("IFileDialog", BindingFlags.NonPublic); | |
uint num = 0; | |
object dialog = InvokeMethod(fileDialog.GetType(), fileDialog, "CreateVistaDialog", null); | |
InvokeMethod(fileDialog.GetType(), fileDialog, "OnBeforeVistaDialog", new object[] { dialog }); | |
uint options = (uint)InvokeMethod(typeof(System.Windows.Forms.FileDialog), fileDialog, "GetOptions", null) | (uint)0x20; | |
InvokeMethod(typeIFileDialog, dialog, "SetOptions", new object[] { options }); | |
Type vistaDialogEventsType = assembly.GetType("System.Windows.Forms.FileDialog").GetNestedType("VistaDialogEvents", BindingFlags.NonPublic); | |
object pfde = Activator.CreateInstance(vistaDialogEventsType, fileDialog); | |
object[] parameters = new object[] { pfde, num }; | |
InvokeMethod(typeIFileDialog, dialog, "Advise", parameters); | |
num = (uint)parameters[1]; | |
try | |
{ | |
int num2 = (int)InvokeMethod(typeIFileDialog, dialog, "Show", new object[] { hwndOwner }); | |
flag = 0 == num2; | |
} | |
finally | |
{ | |
InvokeMethod(typeIFileDialog, dialog, "Unadvise", new object[] { num }); | |
GC.KeepAlive(pfde); | |
} | |
return flag; | |
} | |
catch | |
{ | |
return ShowOriginalBrowserDialog(hwndOwner); | |
} | |
} | |
else | |
return ShowOriginalBrowserDialog(hwndOwner); | |
} | |
public override void Reset() | |
{ | |
fileDialog.Reset(); | |
} | |
} | |
} | |
"@ | Out-Null | |
} | |
#endregion Define SAPIEN Types | |
#---------------------------------------------- | |
#region Generated Form Objects | |
#---------------------------------------------- | |
[System.Windows.Forms.Application]::EnableVisualStyles() | |
$MainForm = New-Object 'System.Windows.Forms.Form' | |
$labelLabelResourceType = New-Object 'System.Windows.Forms.Label' | |
$listboxDSN2 = New-Object 'System.Windows.Forms.ListBox' | |
$datagridviewResults = New-Object 'System.Windows.Forms.DataGridView' | |
$checkboxAdd = New-Object 'System.Windows.Forms.CheckBox' | |
$labelUserName = New-Object 'System.Windows.Forms.Label' | |
$checkboxDeploy = New-Object 'System.Windows.Forms.CheckBox' | |
$buttonBrowseSrc = New-Object 'System.Windows.Forms.Button' | |
$textboxSource = New-Object 'System.Windows.Forms.TextBox' | |
$textboxWebSVC = New-Object 'System.Windows.Forms.TextBox' | |
$labelReportWebService = New-Object 'System.Windows.Forms.Label' | |
$labelDatasourceURL = New-Object 'System.Windows.Forms.Label' | |
$textboxDSNUrl = New-Object 'System.Windows.Forms.TextBox' | |
$labelDatasourceDSN = New-Object 'System.Windows.Forms.Label' | |
$buttonCredentials = New-Object 'System.Windows.Forms.Button' | |
$labelStatus = New-Object 'System.Windows.Forms.Label' | |
$buttonExit = New-Object 'System.Windows.Forms.Button' | |
$buttonGo = New-Object 'System.Windows.Forms.Button' | |
$richtextboxStatus = New-Object 'System.Windows.Forms.RichTextBox' | |
$checkboxRecurse = New-Object 'System.Windows.Forms.CheckBox' | |
$labelDestination = New-Object 'System.Windows.Forms.Label' | |
$labelSource = New-Object 'System.Windows.Forms.Label' | |
$textboxDest = New-Object 'System.Windows.Forms.TextBox' | |
$groupAction = New-Object 'System.Windows.Forms.GroupBox' | |
$radiobuttonGetReports = New-Object 'System.Windows.Forms.RadioButton' | |
$radiobuttonRemove = New-Object 'System.Windows.Forms.RadioButton' | |
$radiobuttonAdd = New-Object 'System.Windows.Forms.RadioButton' | |
$errorprovider1 = New-Object 'System.Windows.Forms.ErrorProvider' | |
$openfiledialog1 = New-Object 'System.Windows.Forms.OpenFileDialog' | |
$checkedlistbox1 = New-Object 'System.Windows.Forms.CheckedListBox' | |
$folderbrowserdialog1 = New-Object 'System.Windows.Forms.FolderBrowserDialog' | |
$folderbrowsermoderndialog1 = New-Object 'SAPIENTypes.FolderBrowserModernDialog' | |
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState' | |
#endregion Generated Form Objects | |
#---------------------------------------------- | |
# User Generated Script | |
#---------------------------------------------- | |
$MainForm_Load={ | |
#get-DSNs | |
$labelUserName.Text = "$($Global:Credentials.UserName)" | |
[array]$files | |
#parse config file for starting point for each configurable text field | |
$currentDir = $MyInvocation.MyCommand.Path | |
$a = new-object -comobject wscript.shell | |
$b = $a.popup("current directory ", 0, "$CurrentDir", 1) | |
if (Get-Content .\SSRSDeploy.config -ErrorAction Ignore) | |
{ | |
[xml]$config = Get-Content .\SSRSDeploy.config | |
if (Test-Path ($config.configuration.sourcelocation)) | |
{ | |
$textboxSource.Text = $config.configuration.sourcelocation | |
} | |
else | |
{ | |
$richtextboxStatus.Text = "Invalid sourceLocation in the config file" | |
} | |
$textboxDest.Text = $config.configuration.Destination | |
$textboxDSNUrl.Text = $config.configuration.DatasourceUrl | |
$textboxWebSVC.Text = $config.configuration.ReportWebService | |
if ($config.configuration.ActionAdd -eq 'true') | |
{ | |
$radiobuttonAdd.Checked = $true | |
} | |
if ($config.configuration.ActionRemove -eq 'true') | |
{ | |
$radiobuttonRemove.Checked = $true | |
} | |
if ($config.configuration.ActionGet -eq 'true') | |
{ | |
$radiobuttonGetReports.Checked = $true | |
} | |
if ($config.configuration.DeployReport = 'true') | |
{ | |
$checkboxDeploy.Checked = $true | |
} | |
if ($config.configuration.recurse = 'true') | |
{$checkboxRecurse.Checked = $true} | |
} | |
else | |
{ | |
$a = new-object -comobject wscript.shell | |
$b = $a.popup("Cannot find config file .\SSRSDeploy.config ", 0, "Cannot Find Config File", 1) | |
} | |
} | |
$radiobuttonAdd_CheckedChanged={ | |
#TODO: Place custom script here | |
} | |
$buttonCredentials_Click={ | |
$Global:Credentials = Get-Credential | |
$labelUserName.Text = "$($Global:Credentials.UserName)" | |
} | |
$buttonGo_Click = { | |
if ($radiobuttonAdd.Checked) | |
{ | |
Deploy_reports -deployType Put | |
} | |
elseif ($radiobuttonGetReports.Checked) | |
{ | |
Update-Datagrid | |
} | |
elseif ($radiobuttonRemove.Checked) | |
{ | |
Deploy_Reports -deployType Delete | |
} | |
else | |
{ $richtextboxStatus.Text = "You must choose add Delete or Get Reports" } | |
} | |
$buttonBrowseSrc_Click={ | |
if ($openfiledialog1.ShowDialog() -eq 'OK') | |
{ | |
$textboxSource.Text = $openfiledialog1.FileName | |
} | |
else | |
{} | |
} | |
$textboxDest_Validated={ | |
if (Test-IsURIWeb ($textboxDest.Text)) | |
{ | |
[uri]$u = $textboxDest.Text | |
} | |
Else | |
{ | |
$richtextboxStatus.Text = "You Must enter in a Valid url for this box: \n for Exampe http:\\www.google.com or \n https:\\www.google.com" | |
$textboxDest.clear() | |
} | |
} | |
$checkboxRecurse_CheckedChanged={ | |
#TODO: Place custom script here | |
if ($checkboxRecurse.checked -and ($textboxSource.Text -ne '')) | |
{ Update-Datagrid} | |
else | |
{ | |
$datagridviewResults.DataSource = $null | |
$datagridviewResults.ResetText() | |
$MainForm.Refresh() | |
} | |
} | |
$labelDatasourceDSN_Click={ | |
#TODO: Place custom script here | |
} | |
$comboboxDSN_SelectedIndexChanged={ | |
#TODO: Place custom script here | |
} | |
$textboxWebSVC_TextChanged={ | |
if (Test-IsURIWeb ($textboxWebSVC.Text)) | |
{ | |
[uri]$u = $textboxWebSVC.Text | |
} | |
Else | |
{ | |
$richtextboxStatus.Text = "You Must enter in a Valid url for this box: \n for Exampe http:\\www.google.com or \n https:\\www.google.com" | |
$textboxWebSVC.clear() | |
} | |
} | |
$datagridviewResults_Click={ | |
#TODO: Place custom script here | |
Update-Datagrid | |
} | |
$openfiledialog1_FileOk=[System.ComponentModel.CancelEventHandler]{ | |
New-SSRSGrid | |
} | |
$listboxDSN_SelectedIndexChanged={ | |
if ($listboxDSN.Items -eq $null) | |
{ | |
get-dsns | Out-Null | |
} | |
Update-Datagrid | |
#$selectedRow.DataSourceDSN = $ | |
} | |
$textboxDest_TextChanged={ | |
#TODO: Place custom script here | |
$textboxDest.Text = Format-SharepointUrl ($texboxDest.text) | |
Update-Datagrid | |
} | |
$textboxSource_TextChanged={ | |
#TODO: Place custom script here | |
if ($_.KeyCode -eq ([System.Windows.Forms.Keys]::Enter)) | |
{ New-SSRSGrid } | |
} | |
$buttonExit_Click={ | |
#TODO: Place custom script here | |
$MainForm.close() | |
} | |
$datagridviewResults_Navigate=[System.Windows.Forms.NavigateEventHandler]{ | |
#Event Argument: $_ = [System.Windows.Forms.NavigateEventArgs] | |
#TODO: Place custom script here | |
Update-Datagrid | |
} | |
$textboxSource_KeyDown=[System.Windows.Forms.KeyEventHandler]{ | |
#Event Argument: $_ = [System.Windows.Forms.KeyEventArgs] | |
#keys enumeration [system.windows.forms.keys] | |
#TODO: Place custom script here | |
if ($_.KeyCode -eq ([System.Windows.Forms.Keys]::Enter)) | |
{ New-SSRSGrid } | |
} | |
$listboxDSN_Click={ | |
#TODO: Place custom script here | |
if ($listboxDSN.Items.Count -eq 0) | |
{ | |
get-DSNs | |
} | |
} | |
$textboxDSNUrl_TextChanged={ | |
#TODO: Place custom script here | |
$textboxDSNUrl.Text = Format-SharepointUrl ($texboxDSNUrl.text) | |
Update-Datagrid | |
} | |
$checkboxDeploy_CheckedChanged={ | |
#TODO: Place custom script here | |
Update-Datagrid | |
} | |
$richtextboxStatus_TextChanged={ | |
#TODO: Place custom script here | |
} | |
$radiobuttonGetReports_CheckedChanged={ | |
#TODO: Place custom script here | |
$datagridviewResults.DataSource = $null | |
$buttonGo.Enabled = $true | |
} | |
$radiobuttonRemove_CheckedChanged={ | |
#TODO: Place custom script here | |
} | |
$labelSource_Click={ | |
#TODO: Place custom script here | |
} | |
$listboxDSN2_Click={ | |
#TODO: Place custom script here | |
if($listboxDSN2.Items.Count -eq 0) | |
{ | |
get-DSNs | |
} | |
} | |
$folderbrowserdialog1_HelpRequest={ | |
#TODO: Place custom script here | |
} | |
$datagridviewResults_CellContentClick=[System.Windows.Forms.DataGridViewCellEventHandler]{ | |
#Event Argument: $_ = [System.Windows.Forms.DataGridViewCellEventArgs] | |
#TODO: Place custom script here | |
Update-Datagrid | |
} | |
$listboxDSN2_SelectedIndexChanged={ | |
#TODO: Place custom script here | |
if ($listboxDSN2.Items -eq $null) | |
{ | |
get-dsns | Out-Null | |
} | |
Update-Datagrid | |
} | |
$labelLabelResourceType_Click={ | |
#TODO: Place custom script here | |
} | |
# --End User Generated Script-- | |
#---------------------------------------------- | |
#region Generated Events | |
#---------------------------------------------- | |
$Form_StateCorrection_Load= | |
{ | |
#Correct the initial state of the form to prevent the .Net maximized form issue | |
$MainForm.WindowState = $InitialFormWindowState | |
} | |
$Form_StoreValues_Closing= | |
{ | |
#Store the control values | |
$script:MainForm_listboxDSN2 = $listboxDSN2.SelectedItems | |
$script:MainForm_datagridviewResults = $datagridviewResults.SelectedCells | |
$script:MainForm_checkboxAdd = $checkboxAdd.Checked | |
$script:MainForm_checkboxDeploy = $checkboxDeploy.Checked | |
$script:MainForm_textboxSource = $textboxSource.Text | |
$script:MainForm_textboxWebSVC = $textboxWebSVC.Text | |
$script:MainForm_textboxDSNUrl = $textboxDSNUrl.Text | |
$script:MainForm_richtextboxStatus = $richtextboxStatus.Text | |
$script:MainForm_checkboxRecurse = $checkboxRecurse.Checked | |
$script:MainForm_textboxDest = $textboxDest.Text | |
$script:MainForm_radiobuttonGetReports = $radiobuttonGetReports.Checked | |
$script:MainForm_radiobuttonRemove = $radiobuttonRemove.Checked | |
$script:MainForm_radiobuttonAdd = $radiobuttonAdd.Checked | |
$script:MainForm_checkedlistbox1 = $checkedlistbox1.SelectedItems | |
} | |
$Form_Cleanup_FormClosed= | |
{ | |
#Remove all event handlers from the controls | |
try | |
{ | |
$labelLabelResourceType.remove_Click($labelLabelResourceType_Click) | |
$listboxDSN2.remove_Click($listboxDSN2_Click) | |
$listboxDSN2.remove_SelectedIndexChanged($listboxDSN2_SelectedIndexChanged) | |
$datagridviewResults.remove_CellContentClick($datagridviewResults_CellContentClick) | |
$checkboxDeploy.remove_CheckedChanged($checkboxDeploy_CheckedChanged) | |
$buttonBrowseSrc.remove_Click($buttonBrowseSrc_Click) | |
$textboxSource.remove_TextChanged($textboxSource_TextChanged) | |
$textboxSource.remove_KeyDown($textboxSource_KeyDown) | |
$textboxWebSVC.remove_TextChanged($textboxWebSVC_TextChanged) | |
$textboxDSNUrl.remove_TextChanged($textboxDSNUrl_TextChanged) | |
$labelDatasourceDSN.remove_Click($labelDatasourceDSN_Click) | |
$buttonCredentials.remove_Click($buttonCredentials_Click) | |
$buttonExit.remove_Click($buttonExit_Click) | |
$buttonGo.remove_Click($buttonGo_Click) | |
$richtextboxStatus.remove_TextChanged($richtextboxStatus_TextChanged) | |
$checkboxRecurse.remove_CheckedChanged($checkboxRecurse_CheckedChanged) | |
$labelSource.remove_Click($labelSource_Click) | |
$textboxDest.remove_TextChanged($textboxDest_TextChanged) | |
$textboxDest.remove_Validated($textboxDest_Validated) | |
$radiobuttonGetReports.remove_CheckedChanged($radiobuttonGetReports_CheckedChanged) | |
$radiobuttonRemove.remove_CheckedChanged($radiobuttonRemove_CheckedChanged) | |
$radiobuttonAdd.remove_CheckedChanged($radiobuttonAdd_CheckedChanged) | |
$MainForm.remove_Load($MainForm_Load) | |
$openfiledialog1.remove_FileOk($openfiledialog1_FileOk) | |
$folderbrowserdialog1.remove_HelpRequest($folderbrowserdialog1_HelpRequest) | |
$MainForm.remove_Load($Form_StateCorrection_Load) | |
$MainForm.remove_Closing($Form_StoreValues_Closing) | |
$MainForm.remove_FormClosed($Form_Cleanup_FormClosed) | |
} | |
catch [Exception] | |
{ } | |
} | |
#endregion Generated Events | |
#---------------------------------------------- | |
#region Generated Form Code | |
#---------------------------------------------- | |
$MainForm.SuspendLayout() | |
$groupAction.SuspendLayout() | |
# | |
# MainForm | |
# | |
$MainForm.Controls.Add($labelLabelResourceType) | |
$MainForm.Controls.Add($listboxDSN2) | |
$MainForm.Controls.Add($datagridviewResults) | |
$MainForm.Controls.Add($checkboxAdd) | |
$MainForm.Controls.Add($labelUserName) | |
$MainForm.Controls.Add($checkboxDeploy) | |
$MainForm.Controls.Add($buttonBrowseSrc) | |
$MainForm.Controls.Add($textboxSource) | |
$MainForm.Controls.Add($textboxWebSVC) | |
$MainForm.Controls.Add($labelReportWebService) | |
$MainForm.Controls.Add($labelDatasourceURL) | |
$MainForm.Controls.Add($textboxDSNUrl) | |
$MainForm.Controls.Add($labelDatasourceDSN) | |
$MainForm.Controls.Add($buttonCredentials) | |
$MainForm.Controls.Add($labelStatus) | |
$MainForm.Controls.Add($buttonExit) | |
$MainForm.Controls.Add($buttonGo) | |
$MainForm.Controls.Add($richtextboxStatus) | |
$MainForm.Controls.Add($checkboxRecurse) | |
$MainForm.Controls.Add($labelDestination) | |
$MainForm.Controls.Add($labelSource) | |
$MainForm.Controls.Add($textboxDest) | |
$MainForm.Controls.Add($groupAction) | |
$MainForm.AutoScaleDimensions = '6, 13' | |
$MainForm.ClientSize = '1178, 641' | |
#region Binary Data | |
$MainForm.Icon = [System.Convert]::FromBase64String(' | |
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAABAAABILAAASCwAAAAAA | |
AAAAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | |
AAAAAAAAAAAAAAAAAAAAAAAAAP///wAAAAAAAAAAAAAAAAUAAAAPAAAAFQAAABYAAAAWAAAAFgAA | |
ABYAAAAWAAAAFgAAABYAAAAWAAAAFgAAABYAAAAWAAAAFgAAABYAAAAWAAAAFgAAABYAAAAWAAAA | |
FgAAABYAAAAWAAAAFgAAABYAAAAWAAAAEAAAAAUAAAAA////AAAAAAAAAAAAAAAADwAAAC8AAABB | |
AAAAQwAAAEMAAABDAAAAQwAAAEMAAABDAAAAQwAAAEMAAABDAAAAQwAAAEMAAABDAAAAQwAAAEMA | |
AABDAAAAQwAAAEMAAABDAAAAQwAAAEMAAABDAAAAQwAAAEIAAAAxAAAAEAAAAAD///8AAAAAAAAA | |
AAAAAAAVsoZV4rqMWf+6jFn/uoxZ/7qMWP+4iVX/tYVQ/7SDTP+0g0z/tINM/7SDTP+0g0z/tINM | |
/7SDTP+0g0z/tINM/7SDTP+0g0z/tINM/7SDTP+0g0z/tINM/7SDTP+0g0z/tYVQ/7WHVPMAAAAW | |
AAAAAP///wAAAAAAAAAAAAAAABa6i1j/vI9d/7qMWf+7jVr/uoxY/7WFUP//+e7//vLl//3x4//9 | |
8eP//fHj//3x4//98eP//fHj//3x4//98eP//fHj//3x4//98eP//fHj//3x4//98eP//fHj//7y | |
5f//+e7/tYVQ/wAAABYAAAAA////AAAAAAYAAAARAAAAJ7mKVv+9kV//uotX/7uNWf+8jVn/tINM | |
//7z5f/46dj/9+jW//fo1v/36Nb/9+jW//fo1v/36Nb/9+jW//fo1v/36Nb/9+jW//fo1v/36Nb/ | |
9+jW//fo1v/36Nb/+OnY//7z5f+0g0z/AAAAFgAAAAD///8AAAAACwAAACIAAAA3uohQ///cqv// | |
3Kn/u45a/72PW/+zgkv//fHk//fm1P/25dL/9uXS//bl0v/25dL/9uXS//bl0v/25dL/9uXS//bl | |
0v/25dL/9uXS//bl0v/25dL/9uXS//bl0v/35tT//fHk/7SDTP8AAAAWAAAAAP///wAAAAAGh4aI | |
/8LGy/+qsLj/Q0xZ/9ytdf+/klz/v5Jc/7OCS//98eT/9+XS//bk0P/25ND/9uTQ//bk0P/25ND/ | |
9uTQ//bk0P/25ND/9uTQ//bk0P/25ND/9uTQ//bk0P/25ND/9uTQ//fl0v/98eT/tINM/wAAABYA | |
AAAA////AAAAAAAAAAAAAAAAFrmTav+Ja0f/qntE/8OVYP/ClF//s4FL//3x4//25M//9ePO//Xj | |
zv/1487/9ePO//Xjzv/1487/9ePO//Xjzv/1487/9ePO//Xjzv/1487/9ePO//Xjzv/1487/9uTP | |
//3x4/+0g0z/AAAAFgAAAAD///8AAAAABgAAABEAAAAnuolS/86ndf/ClV7/wpZg/8OXX/+zgUv/ | |
/fHj//bjzf/14sz/9eLM//XizP/14sz/9eLM//XizP/14sz/9eLM//XizP/14sz/9eLM//XizP/1 | |
4sz/9eLM//XizP/2483//fHj/7SDTP8AAAAWAAAAAP///wAAAAALAAAAIgAAADe6h0///9ur///b | |
pv/Dl1//xZlg/7KBS//88eP/9eLL//Thyv/04cr/9OHK//Thyv/04cr/9OHK//Thyv/04cr/9OHK | |
//Thyv/04cr/9OHK//Thyv/04cr/9OHK//Xiy//88eP/tINM/wAAABYAAAAA////AAAAAAaHh4n/ | |
wsfO/6mwuf9DS1n/261z/8abY//Gm2P/soFL//zx5P/138j/9N/I//TfyP/038j/9N/I//TfyP/0 | |
38j/9N/I//TfyP/038j/9N/I//TfyP/038j/9N/I//TfyP/038j/9d/I//zx5f+0g0z/AAAAFgAA | |
AAD///8AAAAAAAAAAAAAAAAWvYpS/556Sv+oekL/yZ5l/8idZP+ygUv//fPl//Xexv/03sb/9N7G | |
//Texv/03sb/9N7G//Texv/03sb/9N7G//Texv/03sb/9N7G//Texv/03sb/9N7G//Texv/13sb/ | |
/vPl/7SDTP8AAAAWAAAAAP///wAAAAAGAAAAEQAAACe5iVP/2rqN/8qeZP/Kn2b/y59n/7KBS//9 | |
8+X/9N3E//PdxP/z3cT/893D//Pdw//z3MP/89zD//Pcw//z3MP/89zD//Pcw//z3MP/893D//Pd | |
w//z3cT/893E//TdxP/+8+X/tINM/wAAABYAAAAA////AAAAAAsAAAAiAAAAN7qHT//82q3//9uj | |
/8qeZv/LoGf/soBL//3z5v/03ML/89zB//Pbwf/z2r//89q9//PZvf/z2bz/89m8//LZvP/z2bz/ | |
89m8//LZvP/y2b3/89q+//Pbwf/z3MH/9NzC//7z5/+0g0z/AAAAFgAAAAD///8AAAAABoaGiv/C | |
x87/qbC5/0NKWf/ZrG//zqJp/86jaf+ygEr//fTo//LbwP/y2r//8tm9//337v////////////// | |
///////////////////////////////////89u7/8dm8//Lav//y28D//vTo/7SDTP8AAAAWAAAA | |
AP///wAAAAAAAAAAAAAAABa9ilH/l3dN/6Z6Pv/Qpmz/z6Vr/7KASv//9Oj/8tq9//LZvP/y17n/ | |
/////3+Bgf+5ubr/t7i4/7W2tv//////f4CA/7a3t///////srO0///////x17j/8tm8//Lavf// | |
9Oj/tINM/wAAABYAAAAA////AAAAAAYAAAARAAAAJ7mIU//myqL/0aZq/9CmbP/Rp2z/sX9K///1 | |
6f/y2bv/8ti6//HWtv////////////////////////////////////////////////////////// | |
//HWtv/y2Lr/8tm7///26f+0g0z/AAAAFgAAAAD///8AAAAACwAAACIAAAA3uodO//XZsP//26H/ | |
0qdt/9Opbv+xf0r//fXs//HYuP/x17j/8NW0//////+AgYH/ubm5/7a2tv//////gICA/7q6uv+4 | |
uLj/t7e3/7W2tv//////8NWz//HXuP/x2Lj//vbs/7SDTP8AAAAWAAAAAP///wAAAAAGhoaK/8LH | |
zv+psLn/Q0pY/9isbf/Vq2//1axv/7F/Sf//9+3/8de3//HWt//w1LP///////////////////// | |
///////////////////////////////////////w07L/8da3//HXt///9+3/tINM/wAAABYAAAAA | |
////AAAAAAAAAAAAAAAAFr2JUf+Qd0//pHk7/9iucv/XrnD/sX9J///47v/w1bX/8NW1/+/Tsf// | |
////fn+A/7e3uP//////f4CB/7i5uv+2trf//////35+f/+2t7j//////+/Tsf/w1bX/8NW1///5 | |
7/+0gkz/AAAAFgAAAAD///8AAAAABgAAABEAAAAnuYhS//DZtf/Yr3D/169y/9iwcv+xf0n///nx | |
//DTs//w07P/79Kx//z06v/////////////////////////////////////////////////89Or/ | |
79Kx//DTs//w07P///ry/7SCTP8AAAAWAAAAAP///wAAAAALAAAAIgAAADe6h07/79ez///anv/Y | |
sHL/2rJz/7F+Sf//+fP/8NKw//DTsv/w0rH/8NGv//DRrv/w0K3/8NCt//DQrf/w0K3/8NCt//DQ | |
rf/w0K3/8NCu//DRr//w0rH/8NOy//DSsP//+vP/tIJL/wAAABYAAAAA////AAAAAAaGhor/wsfO | |
/6qwuf9DSlj/16xr/9u0dv/btXb/sH5I///79f/v0K7/79Kw/+/Ssf/w07L/8dW0//HVtP/x1LP/ | |
8dSz//LVtP/y1bT/8dW0//HUtP/x1LP/79Kx/+/Ssf/v0rD/79Cu///79v+0gkv/AAAAFgAAAAD/ | |
//8AAAAAAAAAAAAAAAAWvYlR/4p1Uv+ieTf/3rd4/963d/+wfkj///z4/+/PrP/v0a7/79Gw//HU | |
s/+reUH/z6h7/86meP/z1rX/q3lB/8+oe//Pp3r/zqZ6/82leP/w07H/79Gv/+/Rrv/vz6z///34 | |
/7SCS/8AAAAWAAAAAP///wAAAAAGAAAAEQAAACe5h1H/+ubH/+G3df/ftnf/4Lh4/7B+SP///vv/ | |
7s6p/+7QrP/u0K3/79Kv//HTsv/x07L/8NOw//DSsP/x1LL/8dSy//DTsf/w07H/8NKw/+7Rrv/u | |
0K3/7tCs/+7Oqf////v/tIJL/wAAABYAAAAA////AAAAAAsAAAAiAAAAN7qGTv/o17X//9qa/9+3 | |
ef/hunr/sH1I/////f/uzaf/7s6q/+7Pq//uz6v/7tCs/+7QrP/uz6z/7s+r/+7QrP/u0Kz/7tCs | |
/+7PrP/uz6v/7s+r/+7Pq//uzqr/7s2n/////v+0gkv/AAAAFgAAAAD///8AAAAABoaGiv/Cx87/ | |
qrC4/0NJV//VrGj/47t7/+O8e/+vfUf//////+7LpP/uzKf/7s2o/+7NqP/uzaj/7s2o/+7NqP/u | |
zaj/7s2o/+7NqP/uzaj/7s2o/+7NqP/uzaj/7s2o/+7Mp//uy6T//////7SCS/8AAAAWAAAAAP// | |
/wAAAAAAAAAAAAAAABW9iVD/hXRW/6J4M//kvXr/5L16/698Rv//////7cmf/+zKof/tyqL/7cqi | |
/+3Kov/tyqL/7cqi/+3Kov/tyqL/7cqi/+3Kov/tyqL/7cqi/+3Kov/tyqL/7Mqh/+3Jn/////// | |
tIJL/wAAABYAAAAA////AAAAAAAAAAAAAAAADrmIU///9Nf//u/T//rt0v/879T/sn9I//////// | |
//////////////////////////////////////////////////////////////////////////// | |
//////////////////+1hE7/AAAAEAAAAAD///8AAAAAAAAAAAAAAAAEtohVxreHU/+1hVD/tYRQ | |
/7aGUf+3h1L/tYRO/7SCS/+0gkv/tIJL/7SCS/+0gkv/tIJL/7SCS/+0gkv/tIJL/7SCS/+0gkv/ | |
tIJL/7SCS/+0gkv/tIJL/7SCS/+0gkv/tYRO/7eIVfAAAAAFAAAAAP///wD///8A////AP///wD/ | |
//8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP// | |
/wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//// | |
/+AAAAHgAAAB4AAAAeAAAAGAAAABgAAAAYAAAAHgAAABgAAAAYAAAAGAAAAB4AAAAYAAAAGAAAAB | |
gAAAAeAAAAGAAAABgAAAAYAAAAHgAAABgAAAAYAAAAGAAAAB4AAAAYAAAAGAAAABgAAAAeAAAAHg | |
AAAB4AAAAf////8=') | |
#endregion | |
$MainForm.Name = 'MainForm' | |
$MainForm.StartPosition = 'CenterScreen' | |
$MainForm.Text = 'SSRS Deployment Tool' | |
$MainForm.add_Load($MainForm_Load) | |
# | |
# labelLabelResourceType | |
# | |
$labelLabelResourceType.Location = '17, 39' | |
$labelLabelResourceType.Name = 'labelLabelResourceType' | |
$labelLabelResourceType.Size = '100, 23' | |
$labelLabelResourceType.TabIndex = 26 | |
$labelLabelResourceType.Visible = $False | |
$labelLabelResourceType.add_Click($labelLabelResourceType_Click) | |
# | |
# listboxDSN2 | |
# | |
$listboxDSN2.FormattingEnabled = $True | |
$listboxDSN2.Location = '723, 39' | |
$listboxDSN2.Name = 'listboxDSN2' | |
$listboxDSN2.Size = '441, 69' | |
$listboxDSN2.Sorted = $True | |
$listboxDSN2.TabIndex = 5 | |
$listboxDSN2.add_Click($listboxDSN2_Click) | |
$listboxDSN2.add_SelectedIndexChanged($listboxDSN2_SelectedIndexChanged) | |
# | |
# datagridviewResults | |
# | |
$datagridviewResults.ColumnHeadersHeightSizeMode = 'AutoSize' | |
$datagridviewResults.Location = '25, 170' | |
$datagridviewResults.Name = 'datagridviewResults' | |
$datagridviewResults.SelectionMode = 'FullRowSelect' | |
$datagridviewResults.Size = '1139, 374' | |
$datagridviewResults.TabIndex = 10 | |
$datagridviewResults.add_CellContentClick($datagridviewResults_CellContentClick) | |
# | |
# checkboxAdd | |
# | |
$checkboxAdd.Location = '197, 36' | |
$checkboxAdd.Name = 'checkboxAdd' | |
$checkboxAdd.Size = '68, 24' | |
$checkboxAdd.TabIndex = 25 | |
$checkboxAdd.Text = 'Add' | |
$checkboxAdd.UseVisualStyleBackColor = $True | |
$checkboxAdd.Visible = $False | |
# | |
# labelUserName | |
# | |
$labelUserName.Location = '382, 119' | |
$labelUserName.Name = 'labelUserName' | |
$labelUserName.Size = '311, 23' | |
$labelUserName.TabIndex = 24 | |
# | |
# checkboxDeploy | |
# | |
$checkboxDeploy.Location = '928, 118' | |
$checkboxDeploy.Name = 'checkboxDeploy' | |
$checkboxDeploy.Size = '135, 24' | |
$checkboxDeploy.TabIndex = 11 | |
$checkboxDeploy.Text = 'Deploy Report' | |
$checkboxDeploy.UseVisualStyleBackColor = $True | |
$checkboxDeploy.add_CheckedChanged($checkboxDeploy_CheckedChanged) | |
# | |
# buttonBrowseSrc | |
# | |
$buttonBrowseSrc.Location = '570, 13' | |
$buttonBrowseSrc.Name = 'buttonBrowseSrc' | |
$buttonBrowseSrc.Size = '27, 23' | |
$buttonBrowseSrc.TabIndex = 1 | |
$buttonBrowseSrc.Text = '...' | |
$buttonBrowseSrc.UseVisualStyleBackColor = $True | |
$buttonBrowseSrc.add_Click($buttonBrowseSrc_Click) | |
# | |
# textboxSource | |
# | |
$textboxSource.AcceptsReturn = $True | |
$textboxSource.AutoCompleteMode = 'SuggestAppend' | |
$textboxSource.AutoCompleteSource = 'FileSystem' | |
$textboxSource.Location = '123, 13' | |
$textboxSource.Name = 'textboxSource' | |
$textboxSource.RightToLeft = 'No' | |
$textboxSource.Size = '441, 20' | |
$textboxSource.TabIndex = 0 | |
$textboxSource.add_TextChanged($textboxSource_TextChanged) | |
$textboxSource.add_KeyDown($textboxSource_KeyDown) | |
# | |
# textboxWebSVC | |
# | |
$textboxWebSVC.Location = '723, 10' | |
$textboxWebSVC.Name = 'textboxWebSVC' | |
$textboxWebSVC.Size = '441, 20' | |
$textboxWebSVC.TabIndex = 6 | |
$textboxWebSVC.Text = 'http://pgmossweb2d/sites/pultegroupdev/pultebi/_vti_bin/ReportServer/ReportService2010.asmx' | |
$textboxWebSVC.add_TextChanged($textboxWebSVC_TextChanged) | |
# | |
# labelReportWebService | |
# | |
$labelReportWebService.Location = '612, 13' | |
$labelReportWebService.Name = 'labelReportWebService' | |
$labelReportWebService.Size = '100, 23' | |
$labelReportWebService.TabIndex = 19 | |
$labelReportWebService.Text = 'ReportWebService' | |
# | |
# labelDatasourceURL | |
# | |
$labelDatasourceURL.Location = '13, 87' | |
$labelDatasourceURL.Name = 'labelDatasourceURL' | |
$labelDatasourceURL.Size = '100, 23' | |
$labelDatasourceURL.TabIndex = 18 | |
$labelDatasourceURL.Text = 'Datasource(URL)' | |
# | |
# textboxDSNUrl | |
# | |
$textboxDSNUrl.Location = '123, 84' | |
$textboxDSNUrl.Name = 'textboxDSNUrl' | |
$textboxDSNUrl.Size = '441, 20' | |
$textboxDSNUrl.TabIndex = 4 | |
$textboxDSNUrl.Text = 'http://pgmossweb2d/sites/pultegroupdev/pultebi/Shared Documents/Data Sources' | |
$textboxDSNUrl.add_TextChanged($textboxDSNUrl_TextChanged) | |
# | |
# labelDatasourceDSN | |
# | |
$labelDatasourceDSN.Location = '612, 41' | |
$labelDatasourceDSN.Name = 'labelDatasourceDSN' | |
$labelDatasourceDSN.Size = '100, 23' | |
$labelDatasourceDSN.TabIndex = 16 | |
$labelDatasourceDSN.Text = 'Datasource(DSN)' | |
$labelDatasourceDSN.add_Click($labelDatasourceDSN_Click) | |
# | |
# buttonCredentials | |
# | |
$buttonCredentials.Location = '789, 119' | |
$buttonCredentials.Name = 'buttonCredentials' | |
$buttonCredentials.Size = '71, 23' | |
$buttonCredentials.TabIndex = 13 | |
$buttonCredentials.Text = 'Credentials' | |
$buttonCredentials.UseVisualStyleBackColor = $True | |
$buttonCredentials.add_Click($buttonCredentials_Click) | |
# | |
# labelStatus | |
# | |
$labelStatus.Location = '23, 547' | |
$labelStatus.Name = 'labelStatus' | |
$labelStatus.Size = '100, 23' | |
$labelStatus.TabIndex = 12 | |
$labelStatus.Text = 'Status' | |
# | |
# buttonExit | |
# | |
$buttonExit.DialogResult = 'No' | |
$buttonExit.Location = '866, 119' | |
$buttonExit.Name = 'buttonExit' | |
$buttonExit.Size = '56, 23' | |
$buttonExit.TabIndex = 12 | |
$buttonExit.Text = 'Exit' | |
$buttonExit.UseVisualStyleBackColor = $True | |
$buttonExit.add_Click($buttonExit_Click) | |
# | |
# buttonGo | |
# | |
$buttonGo.Enabled = $False | |
$buttonGo.Location = '723, 119' | |
$buttonGo.Name = 'buttonGo' | |
$buttonGo.Size = '62, 23' | |
$buttonGo.TabIndex = 14 | |
$buttonGo.Text = 'Go' | |
$buttonGo.UseVisualStyleBackColor = $True | |
$buttonGo.add_Click($buttonGo_Click) | |
# | |
# richtextboxStatus | |
# | |
$richtextboxStatus.Location = '25, 573' | |
$richtextboxStatus.Name = 'richtextboxStatus' | |
$richtextboxStatus.Size = '1139, 47' | |
$richtextboxStatus.TabIndex = 15 | |
$richtextboxStatus.Text = '' | |
$richtextboxStatus.add_TextChanged($richtextboxStatus_TextChanged) | |
# | |
# checkboxRecurse | |
# | |
$checkboxRecurse.Location = '123, 36' | |
$checkboxRecurse.Name = 'checkboxRecurse' | |
$checkboxRecurse.Size = '68, 24' | |
$checkboxRecurse.TabIndex = 2 | |
$checkboxRecurse.Text = 'Recurse' | |
$checkboxRecurse.UseVisualStyleBackColor = $True | |
$checkboxRecurse.add_CheckedChanged($checkboxRecurse_CheckedChanged) | |
# | |
# labelDestination | |
# | |
$labelDestination.Location = '14, 64' | |
$labelDestination.Name = 'labelDestination' | |
$labelDestination.Size = '100, 23' | |
$labelDestination.TabIndex = 5 | |
$labelDestination.Text = 'Destination' | |
# | |
# labelSource | |
# | |
$labelSource.Location = '13, 16' | |
$labelSource.Name = 'labelSource' | |
$labelSource.Size = '100, 23' | |
$labelSource.TabIndex = 4 | |
$labelSource.Text = 'Source' | |
$labelSource.add_Click($labelSource_Click) | |
# | |
# textboxDest | |
# | |
$textboxDest.Location = '123, 61' | |
$textboxDest.Name = 'textboxDest' | |
$textboxDest.Size = '441, 20' | |
$textboxDest.TabIndex = 3 | |
$textboxDest.Text = 'http://pgmossweb2d/sites/pultegroupdev/pultebi/Shared Documents/Test' | |
$textboxDest.add_TextChanged($textboxDest_TextChanged) | |
$textboxDest.add_Validated($textboxDest_Validated) | |
# | |
# groupAction | |
# | |
$groupAction.Controls.Add($radiobuttonGetReports) | |
$groupAction.Controls.Add($radiobuttonRemove) | |
$groupAction.Controls.Add($radiobuttonAdd) | |
$groupAction.Location = '123, 110' | |
$groupAction.Name = 'groupAction' | |
$groupAction.Size = '226, 54' | |
$groupAction.TabIndex = 0 | |
$groupAction.TabStop = $False | |
$groupAction.Text = 'Choose An Action' | |
# | |
# radiobuttonGetReports | |
# | |
$radiobuttonGetReports.Location = '127, 21' | |
$radiobuttonGetReports.Name = 'radiobuttonGetReports' | |
$radiobuttonGetReports.Size = '88, 22' | |
$radiobuttonGetReports.TabIndex = 9 | |
$radiobuttonGetReports.TabStop = $True | |
$radiobuttonGetReports.Text = 'Get Reports' | |
$radiobuttonGetReports.UseVisualStyleBackColor = $True | |
$radiobuttonGetReports.add_CheckedChanged($radiobuttonGetReports_CheckedChanged) | |
# | |
# radiobuttonRemove | |
# | |
$radiobuttonRemove.Location = '58, 21' | |
$radiobuttonRemove.Name = 'radiobuttonRemove' | |
$radiobuttonRemove.Size = '73, 22' | |
$radiobuttonRemove.TabIndex = 8 | |
$radiobuttonRemove.TabStop = $True | |
$radiobuttonRemove.Text = 'Remove' | |
$radiobuttonRemove.UseVisualStyleBackColor = $True | |
$radiobuttonRemove.add_CheckedChanged($radiobuttonRemove_CheckedChanged) | |
# | |
# radiobuttonAdd | |
# | |
$radiobuttonAdd.Location = '10, 21' | |
$radiobuttonAdd.Name = 'radiobuttonAdd' | |
$radiobuttonAdd.Size = '48, 22' | |
$radiobuttonAdd.TabIndex = 7 | |
$radiobuttonAdd.TabStop = $True | |
$radiobuttonAdd.Text = 'Add' | |
$radiobuttonAdd.UseVisualStyleBackColor = $True | |
$radiobuttonAdd.add_CheckedChanged($radiobuttonAdd_CheckedChanged) | |
# | |
# errorprovider1 | |
# | |
$errorprovider1.ContainerControl = $MainForm | |
# | |
# openfiledialog1 | |
# | |
$openfiledialog1.DefaultExt = 'txt' | |
$openfiledialog1.Filter = 'SSRS File (.rdl*)|*.rdl*|All Files|*.*' | |
$openfiledialog1.Multiselect = $True | |
$openfiledialog1.ShowHelp = $True | |
$openfiledialog1.add_FileOk($openfiledialog1_FileOk) | |
# | |
# checkedlistbox1 | |
# | |
$checkedlistbox1.FormattingEnabled = $True | |
$checkedlistbox1.Location = '0, 0' | |
$checkedlistbox1.Name = 'checkedlistbox1' | |
$checkedlistbox1.Size = '120, 94' | |
$checkedlistbox1.TabIndex = 0 | |
# | |
# folderbrowserdialog1 | |
# | |
$folderbrowserdialog1.add_HelpRequest($folderbrowserdialog1_HelpRequest) | |
# | |
# folderbrowsermoderndialog1 | |
# | |
$groupAction.ResumeLayout() | |
$MainForm.ResumeLayout() | |
#endregion Generated Form Code | |
#---------------------------------------------- | |
#Save the initial state of the form | |
$InitialFormWindowState = $MainForm.WindowState | |
#Init the OnLoad event to correct the initial state of the form | |
$MainForm.add_Load($Form_StateCorrection_Load) | |
#Clean up the control events | |
$MainForm.add_FormClosed($Form_Cleanup_FormClosed) | |
#Store the control values when form is closing | |
$MainForm.add_Closing($Form_StoreValues_Closing) | |
#Show the Form | |
return $MainForm.ShowDialog() | |
} | |
#endregion Source: MainForm.psf | |
#region Source: Globals.ps1 | |
#------------------------------------------------------------------------------------------- | |
# Name: Set-SSRSDataSourceInfo | |
# Description: This script will set the data source url for all reports in a doclib | |
# Usage: Run the function with the DocLibUrl,DataSourceName and DataSourceURL parameters | |
# By: Ivan Josipovic, softlanding.ca | |
# found here: https://gallery.technet.microsoft.com/Set-SSRS-Data-Source-3b074747 | |
#commands https://technet.microsoft.com/en-us/library/ee890108.aspx | |
#command builder for sharepoint http://www.microsoft.com/en-us/download/details.aspx?id=27588 | |
#https://blogs.infosupport.com/managing-ssrs-reports-with-powershell/ | |
# By: Ivan Josipovic, softlanding.ca | |
# found here: https://gallery.technet.microsoft.com/Set-SSRS-Data-Source-3b074747 | |
#commands https://technet.microsoft.com/en-us/library/ee890108.aspx | |
#command builder for sharepoint http://www.microsoft.com/en-us/download/details.aspx?id=27588 | |
#https://blogs.infosupport.com/managing-ssrs-reports-with-powershell/ | |
#------------------------------------------------------------------------------------------- | |
<# | |
.SYNOPSIS | |
A brief description of the Set-SSRSDataSourceInfo function. | |
.DESCRIPTION | |
A detailed description of the Set-SSRSDataSourceInfo function. | |
.PARAMETER DocLibUrl | |
DocLibUrl= Document library where the SSRS reports live | |
.PARAMETER DataSourceName | |
DataSourceName = Data source name to associate to the SSRS report | |
.PARAMETER reportDataSourceName | |
The name of the datasource for the report | |
.PARAMETER DataSourceURL | |
The url where the data source lives. | |
.PARAMETER FileName | |
The file name to be uploaded or checked. | |
.PARAMETER reportWebService | |
The webservice that contains the methods for allowing methods to be get or set. | |
.PARAMETER method | |
Method | |
Get this tells the function to get the values for what is passed. | |
Set this tells the function to set the values for what is passed. | |
.PARAMETER Credentials | |
Credentials of the authorized user allowed to update report properties | |
.EXAMPLE | |
PS C:\> Set-SSRSDataSourceInfo -DocLibUrl $value1 -DataSourceName $value2 | |
.NOTES | |
if the GEt paramater is passed then the function will return an object with the following items: | |
Filename - filename for the rport | |
DocumentLibrary - | |
DataSourceName - | |
DataSourceUrl - | |
ReportWebService - | |
#> | |
Function Set-SSRSDataSourceInfo | |
{ | |
param | |
( | |
[parameter(mandatory)] | |
[uri]$DocLibUrl, | |
[parameter(mandatory)] | |
[uri]$DataSourceName, | |
[string]$reportDataSourceName, | |
[parameter(mandatory)] | |
[uri]$DataSourceURL, | |
[string]$FileName, | |
[parameter(mandatory)] | |
[uri]$reportWebService, | |
[Parameter(Mandatory)] | |
[ValidateSet('GET', 'SET')] | |
[string]$method, | |
[parameter(Mandatory)] | |
[System.Management.Automation.PSCredential]$Credentials | |
) | |
$webfound = $false; | |
$weburl = $DocLibUrl; | |
$is2010 = $false | |
while ($webfound -eq $false) | |
{ | |
$reportProxy = new-webserviceproxy -uri $reportWebService -Credential $credentials | |
if (($reportWebService.Segments | Select-Object -Last 1) -eq 'ReportService2010.asmx') | |
{ | |
$web = $reportProxy.ListChildren($weburl, $false) | |
$web = $web | Where-Object{ $_.name -like '*.rdl' } | |
$is2010 = $true | |
} | |
else | |
{ | |
$web = $ReportProxy.ListChildren($weburl) | |
$web = $web | Where-Object{ $_.name -like '*.rdl' } | |
} | |
if (($DataSourceURL.Segments | Select-Object -last 1) -like '*.rsds') | |
{ | |
$datasourceLoc = ($DataSourceURL.AbsoluteUri.trim(($DataSourceURL.Segments | Select-Object -last 1))).trim('/') | |
} | |
else | |
{ | |
$datasourceLoc = $DataSourceURL | |
} | |
if ($is2010) | |
{ $dsnObject = $reportProxy.listchildren($datasourceLoc, $false) } | |
else | |
{ $dsnObject = $reportProxy.listchildren($datasourceLoc) } | |
if ($web -ne $null) | |
{ | |
$webfound = $true; | |
} | |
else | |
{ | |
write-verbose "$func The Web could not be found"; | |
return -1; | |
} | |
} | |
if ($method -eq 'SET') | |
{ | |
$f = $FileName.ToLower() | |
$singleDoc = $web.path.tolower() | Where-Object { $_ -like "*$f" } | |
$dataSources = $reportProxy.GetItemDataSources($singleDoc) #this gets our datasources for the current selected document | |
$proxyNameSpace = $dataSources.gettype().Namespace | |
$dc = $dsnobject | ?{ $_.path -eq $datasourcename.AbsoluteUri -or $_.path -eq $datasourcename.OriginalString } | |
if ($dc) | |
{ | |
$d = $dataSources | ?{$_.name -like $reportDataSourceName } | |
$newDataSource = New-Object ("$proxyNameSpace.DataSource") | |
$newDataSource.Name = ($datasourcename).segments | select -last 1 | |
$newDataSource.Item = New-Object ("$proxyNamespace.DataSourceReference"); | |
$newDataSource.Item.Reference = $dc.path #$DataSourceURL;# | |
$d.item = $newDataSource.item | |
$reportProxy.SetItemDataSources($singleDoc, $d) | |
$returnObj = 'success' | |
} | |
} | |
if ($method -eq 'GET') | |
{ | |
$returnObj = @() | |
foreach ($item in $web) | |
{ | |
if ($item.name -match '.rdl') | |
{ | |
$dataSCName = (($reportProxy.GetItemDataSources($item.path)).name) | |
$durl = (($dsnObject | where-object{ $_.name -like "$dataScName*" }).path) | |
if (($dataScName -is [array])) | |
{ | |
$i = 0 | |
$tempVar = $null | |
foreach ($s in $dataScname) | |
{ | |
if ($i -eq (($dataScName.count) - 1)) | |
{ | |
$tempVar += "$s" | |
$durl += (($dsnObject | where-object{ $_.name -like "$s*" }).path) | |
} | |
else | |
{ | |
$tempVar += "$s;" | |
$durl += (($dsnObject | where-object{ $_.name -like "$s*" }).path) + ';' | |
} | |
++$i | |
} | |
$dataSCName = $tempVar | |
} | |
if (($durl -is [array])) | |
{ | |
$i = 0 | |
$tempVar = $null | |
foreach ($s in $durl) | |
{ | |
if ($i -eq (($durl.count) - 1)) | |
{ | |
$tempVar += "$s" | |
} | |
else | |
{ | |
$tempVar += "$s;" | |
} | |
++$i | |
} | |
$durl = $tempVar | |
} | |
$obj = New-Object PSObject | |
$obj | Add-Member -MemberType NoteProperty -Name 'FileName' -Value $item.name | |
$obj | Add-Member -MemberType NoteProperty -name 'DocumentLibrary' -Value (($item.path).replace($item.name, '')) | |
$obj | add-member -MemberType NoteProperty -Name 'DataSourceName' -Value $dataSCName | |
$obj | Add-Member -MemberType NoteProperty -Name 'DataSourceUrl' -value $durl | |
$obj | add-member -MemberType NoteProperty -Name 'ReportWebService' -value $reportWebService | |
$returnObj += $obj | |
} | |
} | |
} | |
$returnObj | |
} | |
<# | |
.SYNOPSIS | |
This function uploads files to sharepoint | |
.DESCRIPTION | |
Takes either a folder with single set of files or multiple files and uploads them to Sharepoint | |
destpath -- this is the destinanation that the files are intended to go to. | |
localfilePath -- this is the source of the files where they are coming from can be either a single file or folder | |
Credentials -- this contains the credentials that will authenticate to the Sharepoint server to do the upload. | |
fileext -- this is the extension to upload default extension is *.rdl | |
.EXAMPLE | |
Set-UploadReport -DestPath 'http://pgmossweb2d/sites/pultegroupdev/pultebi/Shared Documents/Sales and Marketing/Survey Reports/CQE Division Reporting' -LocalFilePath 'C:\Users\tyclark\Documents\Finance Analytics and BI\DSS_Reports_SSRS\DSS_Reports_SSRS' -credentials $credentials -fileext '*.rdl' -method 'PUT' | |
.EXAMPLE | |
Set-UploadReport | |
#> | |
Function Set-UploadReport | |
{ | |
param | |
( | |
[Parameter(mandatory)] | |
[string]$DestPath, | |
[Parameter(mandatory)] | |
[string]$LocalFilePath, | |
[Parameter(mandatory)] | |
[System.Management.Automation.PSCredential]$credentials, | |
[string]$fileExt = '*.rdl', | |
[Parameter(Mandatory)] | |
[ValidateSet('PUT', 'DELETE')] | |
[string]$method | |
) | |
# Set the variables | |
$documentlibrary = $DestPath | |
$Files = get-childitem -filter $filext $LocalFilePath | |
$func = 'func Set-UploadReport:' | |
$Uploadedfiles = @() | |
try | |
{ | |
foreach ($file in $files) | |
{ | |
$fileName = $file.Name | |
if ($documentlibrary.EndsWith($fileName)) | |
{ | |
$documentlibrary = $documentlibrary.replace($filename, '') | |
if ($documentlibrary.EndsWith('/')) | |
{ $documentlibrary = $documentlibrary.Substring(0, $documentlibrary.length - 1) } | |
} | |
$dest = "$documentlibrary/" + $fileName | |
if ($method -eq 'PUT') | |
{ | |
Invoke-WebRequest -Method $method -Uri $dest -credential $Credentials -InFile ($file.FullName) | |
$methodname = 'Uploaded' | |
} | |
elseif($method -eq 'DELETE') | |
{ | |
$methodname = 'Deleted' | |
Invoke-WebRequest -Method $method -Uri $dest -Credential $Credentials | |
} | |
write-verbose "$func $methodName $dest with Method $method" | |
$Uploadedfiles += $dest | |
} | |
} | |
catch | |
{ | |
$line = $_.InvocationInfo.ScriptLineNumber | |
"Error was in Line $line cannot upload to $documentlibrary filename $file with Method $method" | |
} | |
return $Uploadedfiles | |
} | |
<# | |
.SYNOPSIS | |
A brief description of the New-SSRSReport function. | |
.DESCRIPTION | |
A detailed description of the New-SSRSReport function. | |
.PARAMETER ReportObject | |
A description of the ReportObject parameter. | |
.PARAMETER filename | |
A description of the filename parameter. | |
.EXAMPLE | |
PS C:\> New-SSRSReport -ReportObject $value1 -filename 'Value2' | |
.NOTES | |
Additional information about the function. | |
#> | |
function New-SSRSReport | |
{ | |
param ( | |
[Parameter(mandatory)] | |
[object]$ReportObject, | |
[parameter (Mandatory)] | |
[string]$filename | |
) | |
if (!(test-path $filename)) | |
{ | |
$file = new-item $filename -Force | |
} | |
$reportobject | export-csv ($file.fullname) | |
} | |
<# | |
.SYNOPSIS | |
Tests to see if a string passed is a valid uri | |
.DESCRIPTION | |
Tests to see if a string passed is a valid uri | |
.PARAMETER address | |
Returns true if the url is a valid Uri | |
.EXAMPLE | |
PS C:\> Test-IsURI 'https://www.sapien.com/blog/2014/05/01/powershell-studio-2014-rename-refactoring/' | |
.NOTES | |
Returns true if the url is a valid Uri | |
#> | |
function Test-IsURI($address) | |
{ | |
($address -as [System.URI]).AbsoluteURI -ne $null | |
} | |
<# | |
.SYNOPSIS | |
Tests to see if a string passed is a valid http or https uri | |
.DESCRIPTION | |
Tests to see if a string passed is a valid http or https uri | |
.PARAMETER address | |
address parameter is a text parameter to test if it is a valid uri | |
.EXAMPLE | |
PS C:\> Test-IsURIWeb 'https://www.sapien.com/blog/2014/05/01/powershell-studio-2014-rename-refactoring/' | |
.NOTES | |
Returns true if the url is a valid Uri of HTTP or HTTPS | |
#> | |
function Test-IsURIWeb($address) | |
{ | |
$uri = $address -as [System.URI] | |
$uri.AbsoluteURI -ne $null -and $uri.Scheme -match '[http|https]' | |
} | |
<# | |
.SYNOPSIS | |
retreives DSN's from url in the WEbService Textbox | |
.DESCRIPTION | |
This function only works with a form to retreive the DSN's from the webservice provided in the TextboxWebSvc. | |
Once they are found the load-listbox is called and the DSN names are populated in that List box. | |
.EXAMPLE | |
This is called from the form. Get-DSNs | |
.NOTES | |
Additional information about the function. | |
#> | |
function Get-DSNs | |
{ | |
[uri]$reportWebService = $textboxWebSvc.text | |
$webfound = $false | |
$weburl = $textboxDSNUrl.text | |
if (!($Global:Credentials)) | |
{ $Global:Credentials = (Get-Credential) } | |
while ($webfound -eq $false) | |
{ | |
$reportProxy = new-webserviceproxy -uri $reportWebService -Credential $Global:Credentials | |
if (($reportWebService.Segments | Select-Object -Last 1) -eq 'ReportService2010.asmx') | |
{ | |
$web = $reportProxy.ListChildren($weburl, $false) | |
$webfound = $true | |
} | |
else | |
{ | |
$web = $ReportProxy.ListChildren($weburl) | |
$webfound = $true | |
} | |
} | |
load-listbox -listbox $listboxDSN -items ($web.name) | |
load-listbox -listbox $listboxDSN2 -items ($web.name) | |
} | |
<# | |
.SYNOPSIS | |
A brief description of the Update-Datagrid function. | |
.DESCRIPTION | |
A detailed description of the Update-Datagrid function. | |
.EXAMPLE | |
PS C:\> Update-Datagrid | |
.NOTES | |
Additional information about the function. | |
#> | |
function Update-Datagrid | |
{ | |
Update-DeployUrls | |
if (!($radiobuttonGetReports.checked)) | |
{ | |
$checkboxDeploy.Text = 'Deploy Report' | |
$selectedRow = $datagridviewResults.CurrentRow.Index | |
if ($selectedRow -is [int]) | |
{ | |
$datagridviewResults.DataSource[$selectedRow].documentlibrary = $textboxDest.Text | |
$datagridviewResults.DataSource[$selectedRow].DataSourceUrl = $textboxDSNUrl.Text | |
$rDSNcount =(($datagridviewResults.DataSource[$selectedRow].ReportDataSourceName).Split(',')).count | |
$datagridviewResults.DataSource[$selectedRow].datasourcename = $listboxDSN2.SelectedItem | |
} | |
if ($datagridviewResults.DataSource) | |
{ | |
if (($datagridviewResults.documentlibrary -ne '' ) -and ($datagridviewResults.DataSource[$selectedRow].documentlibrary -ne '' ) -and ($datagridviewResults.DataSource[$selectedRow].DataSourceUrl -ne '') -and ($datagridviewResults.DataSource[$selectedRow].datasourcename -ne '')) | |
{ $datagridviewResults.DataSource[$selectedRow].Deploy = $checkboxDeploy.Checked } | |
else { $datagridviewResults.DataSource[$selectedRow].Deploy = $false } | |
$buttonGo.enabled = $true | |
} | |
else | |
{ $buttonGo.enabled = $false } | |
$datagridviewResults.Refresh() | |
} | |
else | |
{ | |
if ($datagridviewResults.DataSource -eq $null) | |
{ | |
$Error.clear() | |
if (!($Global:Credentials)) | |
{ | |
$Global:Credentials = Get-Credential | |
$labelUserName.Text = "$($Global:Credentials.UserName)" | |
} | |
$richtextboxStatus.Text = "Getting information from $($textboxDest.Text) using datasourceurl $($textboxDSNUrl.Text) with reportService Webapi $($textboxWebSVC.Text)" | |
$richtextboxStatus.Text += "`n----Please be patient-----" | |
$returnResults = Set-SSRSDataSourceInfo -DocLibUrl $textboxDest.Text -DataSourceName 'EDW' -DataSourceURL $textboxDSNUrl.Text -reportWebService $textboxWebSVC.Text -credentials $Global:Credentials -method GET | |
$richtextboxStatus.Text = $Error | |
$array = New-Object System.Collections.ArrayList | |
$array.addrange($returnResults) | |
$datagridviewResults.DataSource = $array | |
$datagridviewResults.Refresh | |
$checkboxDeploy.Text = 'Update Report' | |
} | |
else | |
{ | |
$selectedRow = $datagridviewResults.CurrentRow.Index | |
$datagridviewResults.DataSource[$selectedRow].documentlibrary = $textboxDest.Text | |
$datagridviewResults.DataSource[$selectedRow].DataSourceUrl = $textboxDSNUrl.Text | |
$selectedItems = ($listboxdsn.selecteditems -join ',') | |
$datagridviewResults.DataSource[$selectedRow].datasourcename = $selectedItems | |
if (($textboxBoxDest.Text -ne '') -and ($textboxDSNUrl.Text -ne '') -and ($datagridviewResults.DataSource -ne '') -and ($textboxWebSVC.text -ne '')) | |
{ | |
if (($datagridviewResults.documentlibrary -ne '') -and ($datagridviewResults.DataSource[$selectedRow].documentlibrary -ne '') -and ($datagridviewResults.DataSource[$selectedRow].DataSourceUrl -ne '') -and ($datagridviewResults.DataSource[$selectedRow].datasourcename -ne '')) | |
{ $datagridviewResults.DataSource[$selectedRow].Deploy = $checkboxDeploy.Checked } | |
else { $datagridviewResults.DataSource[$selectedRow].Deploy = $false } | |
$buttonGo.enabled = $true | |
} | |
else | |
{ $buttonGo.enabled = $false } | |
$datagridviewResults.Refresh() | |
} | |
} | |
} | |
<# | |
.SYNOPSIS | |
A brief description of the New-SSRSGrid function. | |
.DESCRIPTION | |
A detailed description of the New-SSRSGrid function. | |
.EXAMPLE | |
PS C:\> New-SSRSGrid | |
.NOTES | |
Additional information about the function. | |
#> | |
function New-SSRSGrid | |
{ | |
if ($openfiledialog1.FileName -eq '') | |
{ $filenameRef = $textboxSource.text } | |
else{$filenameRef = $openfiledialog1.FileName} | |
if ($checkboxRecurse.Checked -eq $true) | |
{ | |
$array = New-Object System.Collections.ArrayList | |
$filename = $filenameRef | |
$dir = (Get-Item $filename).directoryName | |
$fileExt = (Get-Item $filename).extension | |
if ($checkboxAdd.checked) | |
{ | |
$fs = gci -Path $dir -recurse -Filter "*$fileExt" -File | |
$files = New-ReportObject -files $fs | |
} | |
else | |
{ | |
$fs = gci -Path $dir -recurse -Filter "*$fileExt" -File | |
$files = New-ReportObject -files $fs | |
} | |
$array.addrange($files) | |
$datagridviewResults.DataSource = $array | |
$datagridviewResults.Refresh | |
} | |
else | |
{ | |
$array = New-Object System.Collections.ArrayList | |
$dir = @() | |
foreach ($d in $openfiledialog1.FileNames) | |
{ | |
$dir += Get-Item $d | |
} | |
if ($checkboxadd.checked) | |
{ | |
$fs = gci -Path $dir -recurse -Filter "*$fileExt" -File | |
$files = New-ReportObject -files $fs | |
} | |
else | |
{ | |
$fs = gci -Path $dir -recurse -Filter "*$fileExt" -File | |
$files = New-ReportObject -files $fs | |
} | |
if ($files.Count -gt 1) | |
{ $array.addrange($files) } | |
else { $array.add($files) } | |
$datagridviewResults.DataSource = $array | |
$datagridviewResults.Refresh | |
} | |
} | |
<# | |
.SYNOPSIS | |
A brief description of the Deploy_Reports function. | |
.DESCRIPTION | |
A detailed description of the Deploy_Reports function. | |
.PARAMETER deployType | |
A description of the deployType parameter. | |
.EXAMPLE | |
PS C:\> Deploy_Reports -deployType $value1 | |
.NOTES | |
Additional information about the function. | |
#> | |
function Deploy_Reports | |
{ | |
param ( | |
[ValidateSet('PUT', 'Delete')] | |
$deployType) | |
if ($datagridviewResults.DataSource -ne $null) | |
{ | |
foreach ($source in $datagridviewResults.DataSource) | |
{ | |
if (!($Global:Credentials)) | |
{ | |
$Global:Credentials = Get-Credential | |
$labelUserName.Text = "$($Global:Credentials.UserName)" | |
} | |
#$returnedDataSources = Set-SSRSDataSourceInfo -DocLibUrl $textboxDest.Text -DataSourceName $textboxDSN -DataSourceURL $textboxDSNUrl -FileName $fname -reportWebService $reportWebService -credentials $Global:Credentials -method GET | |
if ($source) | |
{ | |
if ($source.Deploy -eq $true) | |
{ | |
$richtextboxStatus.AppendText("`nSet-UploadReport -DestPath $($source.documentlibrary)/$($source.filename) -localFilePath $($source.DirectoryName)\$($source.filename) -credentials $(($Global:Credentials).UserName) -method $deployType") | |
$status = Set-UploadReport -DestPath "$($source.documentlibrary)/$($source.filename)" -localFilePath "$($source.DirectoryName)\$($source.filename)" -credentials $Credentials -method $deployType | |
$richtextboxStatus.appendtext("`nUploadStatus - $status") | |
if ($deployType -eq 'PUT') | |
{ | |
$dsns = ($source.datasourcename).split(',') | |
foreach ($d in $dsns) | |
{ | |
$richtextboxStatus.AppendText("`nSet-SSRSDataSourceInfo -DocLibUrl $($source.documentlibrary) -DataSourceName $($source.DatasourceUrl)/$d -DataSourceURL $($source.DatasourceUrl) -FileName $($source.filename) -reportWebService $($source.reportwebservice) -method SET -credentials$(($Global:Credentials).UserName)") | |
$datasourceStatus = Set-SSRSDataSourceInfo -DocLibUrl "$($source.documentlibrary)" -reportDataSourceName $($source.ReportDataSourceName) -DataSourceName "$($source.DatasourceUrl)/$d" -DataSourceURL "$($source.DatasourceUrl)" -FileName "$($source.filename)" -reportWebService "$($source.reportwebservice)" -method SET -credentials $Credentials | |
$richtextboxStatus.appendtext("`nSetDataSourceStatus - $datasourceStatus") | |
} | |
} | |
$richtextboxStatus.appendtext("`n") | |
} | |
else | |
{ | |
$richtextboxStatus.Text += "`nFilename: $($source.fileName) --> not set for deployment" | |
} | |
} | |
} | |
} | |
else | |
{ | |
$richtextboxStatus.Text = "Not enough information is available to process your request" | |
} | |
} | |
<# | |
.SYNOPSIS | |
A brief description of the New-ReportObject function. | |
.DESCRIPTION | |
A detailed description of the New-ReportObject function. | |
.PARAMETER files | |
A description of the files parameter. | |
.EXAMPLE | |
PS C:\> New-ReportObject -files $value1 | |
.NOTES | |
Additional information about the function. | |
#> | |
function New-ReportObject | |
{ | |
param ($files) | |
foreach ($f in $files) | |
{ | |
[xml]$tempXml = get-content $f.FullName | |
$richtextboxStatus.text = "Reading DataSource from $($f.fullname)" | |
$dssnname = ($tempXml.Report.DataSources.DataSource.Name) #-join ',' | |
foreach ($d in $dssnname) | |
{ | |
if (($listboxDSN2.Items.Count -gt 0) -and (($listboxDSN2.Items | ?{ $_ -like "$d*" }).count -eq 1)) | |
{ | |
$suggestedDataSource = $listboxDSN2.Items | ?{ $_ -like "$d*" } | |
$richtextboxStatus.text += "`nProviding suggested dataSource of $suggestedDataSource " | |
} | |
else | |
{ $suggestedDataSource = '' } | |
[PSCustomObject]@{ | |
'FileName' = $f.Name | |
'Deploy' = $checkboxDeploy.Checked | |
'Documentlibrary' = $textboxDest.Text | |
'DataSourceUrl' = $textboxDSNUrl.Text | |
'DataSourceName' = $suggestedDataSource | |
'ReportDataSourceName' = $d | |
'ReportWebService' = $textboxWebSVC.text | |
'DirectoryName' = $f.DirectoryName | |
'CreationTime' = $f.creationTime | |
} | |
} | |
$richtextboxStatus.refresh() | |
} | |
} | |
<# | |
.SYNOPSIS | |
This function looks to see if the url passed is a sharepoint url or not. | |
.DESCRIPTION | |
This function looks to see if the url passed is a sharepoint url or not. It looks at the header from a get of the url passed for keys in the header that have sharepoint. | |
.PARAMETER url | |
A description of the url parameter. This url parameter is required to be of type [uri]. | |
.EXAMPLE | |
PS C:\> Test-Sharepoint -url http://ssrs.yourserver.com | |
.NOTES | |
returns true if it is found to have a Sharepoint key in the header. | |
#> | |
function Test-Sharepoint | |
{ | |
param ([uri]$url) | |
$returnval = $false | |
If (!($Credentials)) | |
{ $Global:Credentials = Get-Credential} | |
if ((invoke-webrequest -uri ($url.AbsoluteUri) -Credential $credentials -UseBasicParsing).headers | ?{ $_.keys -like "*sharepoint*" }) | |
{ | |
$returnval = $true | |
} | |
} | |
#region Control Helper Functions | |
function Load-DataGridView | |
{ | |
<# | |
.SYNOPSIS | |
This functions helps you load items into a DataGridView. | |
.DESCRIPTION | |
Use this function to dynamically load items into the DataGridView control. | |
.PARAMETER DataGridView | |
The DataGridView control you want to add items to. | |
.PARAMETER Item | |
The object or objects you wish to load into the DataGridView's items collection. | |
.PARAMETER DataMember | |
Sets the name of the list or table in the data source for which the DataGridView is displaying data. | |
#> | |
Param ( | |
[ValidateNotNull()] | |
[Parameter(Mandatory = $true)] | |
[System.Windows.Forms.DataGridView]$DataGridView, | |
[ValidateNotNull()] | |
[Parameter(Mandatory = $true)] | |
$Item, | |
[Parameter(Mandatory = $false)] | |
[string]$DataMember | |
) | |
$DataGridView.SuspendLayout() | |
$DataGridView.DataMember = $DataMember | |
if ($Item -is [System.ComponentModel.IListSource]` | |
-or $Item -is [System.ComponentModel.IBindingList] -or $Item -is [System.ComponentModel.IBindingListView]) | |
{ | |
$DataGridView.DataSource = $Item | |
} | |
else | |
{ | |
$array = New-Object System.Collections.ArrayList | |
if ($Item -is [System.Collections.IList]) | |
{ | |
$array.AddRange($Item) | |
} | |
else | |
{ | |
$array.Add($Item) | |
} | |
$DataGridView.DataSource = $array | |
} | |
$DataGridView.ResumeLayout() | |
} | |
function ConvertTo-DataTable | |
{ | |
<# | |
.SYNOPSIS | |
Converts objects into a DataTable. | |
.DESCRIPTION | |
Converts objects into a DataTable, which are used for DataBinding. | |
.PARAMETER InputObject | |
The input to convert into a DataTable. | |
.PARAMETER Table | |
The DataTable you wish to load the input into. | |
.PARAMETER RetainColumns | |
This switch tells the function to keep the DataTable's existing columns. | |
.PARAMETER FilterWMIProperties | |
This switch removes WMI properties that start with an underline. | |
.EXAMPLE | |
$DataTable = ConvertTo-DataTable -InputObject (Get-Process) | |
#> | |
[OutputType([System.Data.DataTable])] | |
param ( | |
[ValidateNotNull()] | |
$InputObject, | |
[ValidateNotNull()] | |
[System.Data.DataTable]$Table, | |
[switch]$RetainColumns, | |
[switch]$FilterWMIProperties) | |
if ($Table -eq $null) | |
{ | |
$Table = New-Object System.Data.DataTable | |
} | |
if ($InputObject -is [System.Data.DataTable]) | |
{ | |
$Table = $InputObject | |
} | |
else | |
{ | |
if (-not $RetainColumns -or $Table.Columns.Count -eq 0) | |
{ | |
#Clear out the Table Contents | |
$Table.Clear() | |
if ($InputObject -eq $null) { return } #Empty Data | |
$object = $null | |
#find the first non null value | |
foreach ($item in $InputObject) | |
{ | |
if ($item -ne $null) | |
{ | |
$object = $item | |
break | |
} | |
} | |
if ($object -eq $null) { return } #All null then empty | |
#Get all the properties in order to create the columns | |
foreach ($prop in $object.PSObject.Get_Properties()) | |
{ | |
if (-not $FilterWMIProperties -or -not $prop.Name.StartsWith('__')) #filter out WMI properties | |
{ | |
#Get the type from the Definition string | |
$type = $null | |
if ($prop.Value -ne $null) | |
{ | |
try { $type = $prop.Value.GetType() } | |
catch { } | |
} | |
if ($type -ne $null) # -and [System.Type]::GetTypeCode($type) -ne 'Object') | |
{ | |
[void]$table.Columns.Add($prop.Name, $type) | |
} | |
else #Type info not found | |
{ | |
[void]$table.Columns.Add($prop.Name) | |
} | |
} | |
} | |
if ($object -is [System.Data.DataRow]) | |
{ | |
foreach ($item in $InputObject) | |
{ | |
$Table.Rows.Add($item) | |
} | |
return @(, $Table) | |
} | |
} | |
else | |
{ | |
$Table.Rows.Clear() | |
} | |
foreach ($item in $InputObject) | |
{ | |
$row = $table.NewRow() | |
if ($item) | |
{ | |
foreach ($prop in $item.PSObject.Get_Properties()) | |
{ | |
if ($table.Columns.Contains($prop.Name)) | |
{ | |
$row.Item($prop.Name) = $prop.Value | |
} | |
} | |
} | |
[void]$table.Rows.Add($row) | |
} | |
} | |
return @(, $Table) | |
} | |
function Load-ComboBox | |
{ | |
<# | |
.SYNOPSIS | |
This functions helps you load items into a ComboBox. | |
.DESCRIPTION | |
Use this function to dynamically load items into the ComboBox control. | |
.PARAMETER ComboBox | |
The ComboBox control you want to add items to. | |
.PARAMETER Items | |
The object or objects you wish to load into the ComboBox's Items collection. | |
.PARAMETER DisplayMember | |
Indicates the property to display for the items in this control. | |
.PARAMETER Append | |
Adds the item(s) to the ComboBox without clearing the Items collection. | |
.EXAMPLE | |
Load-ComboBox $combobox1 "Red", "White", "Blue" | |
.EXAMPLE | |
Load-ComboBox $combobox1 "Red" -Append | |
Load-ComboBox $combobox1 "White" -Append | |
Load-ComboBox $combobox1 "Blue" -Append | |
.EXAMPLE | |
Load-ComboBox $combobox1 (Get-Process) "ProcessName" | |
#> | |
Param ( | |
[ValidateNotNull()] | |
[Parameter(Mandatory = $true)] | |
[System.Windows.Forms.ComboBox]$ComboBox, | |
[ValidateNotNull()] | |
[Parameter(Mandatory = $true)] | |
$Items, | |
[Parameter(Mandatory = $false)] | |
[string]$DisplayMember, | |
[switch]$Append | |
) | |
if (-not $Append) | |
{ | |
$ComboBox.Items.Clear() | |
} | |
if ($Items -is [Object[]]) | |
{ | |
$ComboBox.Items.AddRange($Items) | |
} | |
elseif ($Items -is [Array]) | |
{ | |
$ComboBox.BeginUpdate() | |
foreach ($obj in $Items) | |
{ | |
$ComboBox.Items.Add($obj) | |
} | |
$ComboBox.EndUpdate() | |
} | |
else | |
{ | |
$ComboBox.Items.Add($Items) | |
} | |
$ComboBox.DisplayMember = $DisplayMember | |
} | |
function Load-ListBox | |
{ | |
<# | |
.SYNOPSIS | |
This functions helps you load items into a ListBox or CheckedListBox. | |
.DESCRIPTION | |
Use this function to dynamically load items into the ListBox control. | |
.PARAMETER ListBox | |
The ListBox control you want to add items to. | |
.PARAMETER Items | |
The object or objects you wish to load into the ListBox's Items collection. | |
.PARAMETER DisplayMember | |
Indicates the property to display for the items in this control. | |
.PARAMETER Append | |
Adds the item(s) to the ListBox without clearing the Items collection. | |
.EXAMPLE | |
Load-ListBox $ListBox1 "Red", "White", "Blue" | |
.EXAMPLE | |
Load-ListBox $listBox1 "Red" -Append | |
Load-ListBox $listBox1 "White" -Append | |
Load-ListBox $listBox1 "Blue" -Append | |
.EXAMPLE | |
Load-ListBox $listBox1 (Get-Process) "ProcessName" | |
#> | |
Param ( | |
[ValidateNotNull()] | |
[Parameter(Mandatory = $true)] | |
[System.Windows.Forms.ListBox]$ListBox, | |
[ValidateNotNull()] | |
[Parameter(Mandatory = $true)] | |
$Items, | |
[Parameter(Mandatory = $false)] | |
[string]$DisplayMember, | |
[switch]$Append | |
) | |
if (-not $Append) | |
{ | |
$listBox.Items.Clear() | |
} | |
if ($Items -is [System.Windows.Forms.ListBox+ObjectCollection]) | |
{ | |
$listBox.Items.AddRange($Items) | |
} | |
elseif ($Items -is [Array]) | |
{ | |
$listBox.BeginUpdate() | |
foreach ($obj in $Items) | |
{ | |
$listBox.Items.Add($obj) | |
} | |
$listBox.EndUpdate() | |
} | |
else | |
{ | |
$listBox.Items.Add($Items) | |
} | |
$listBox.DisplayMember = $DisplayMember | |
} | |
<# | |
.SYNOPSIS | |
A brief description of the Update-DeployUrls function. | |
.DESCRIPTION | |
A detailed description of the Update-DeployUrls function. | |
.EXAMPLE | |
PS C:\> Update-DeployUrls | |
.NOTES | |
Additional information about the function. | |
#> | |
function Update-DeployUrls | |
{ | |
#first we need to test each text box to see if they are pointing to the same url? | |
#then we need to test each url to see if they are sharepoint or native ssrs | |
[uri]$Dest = $textboxDest.Text | |
[uri]$Datasource = $textboxDSNUrl.text | |
[uri]$WebService = $textboxWebSVC.text | |
if (($Dest.Host -eq $Datasource.Host) -and ($Datasource.Host -eq $WebService.host)) # this means that all of the urls have the same host. | |
{ | |
if (Test-Sharepoint $dest) | |
{ | |
$labelLabelResourceType.visible = $true | |
$labelLabelResourceType.text = 'Sharepoint Server' | |
$textboxDest.text = Format-SharepointUrl $textboxDest.text | |
$textboxDSNUrl.text = format-sharepointurl $textboxDest.text | |
} | |
else | |
{ | |
$labelLabelResourceType.visible = $true | |
$labelLabelResourceType.text = 'SSRS Native' | |
} | |
} | |
} | |
<# | |
.SYNOPSIS | |
Resolves a sharepoint url from a encoded string that is passed. | |
.DESCRIPTION | |
When using sharepoint urls they have long strings that contain the actual root. This function parses the passed url and returns a root url from what is passed. | |
.PARAMETER url | |
A description of the url parameter. | |
.EXAMPLE | |
PS C:\> Format-SharepointUrl -url ' | |
.NOTES | |
Additional information about the function. | |
#> | |
function Format-SharepointUrl | |
{ | |
param | |
( | |
[parameter(Mandatory = $true)] | |
[uri]$url | |
) | |
$newUrl = $url | |
[System.Collections.Specialized.NameValueCollection]$uCollection = [System.Web.Httputility]::ParseQuerySTring($url) | |
if ($uCollection.GetValues(($ucollection.keys | ?{ $_ -like "*RootFolder*" }))) | |
{ | |
$cUrl = $uCollection.GetValues(($ucollection.keys | ?{ $_ -like "*RootFolder*" })) | |
$newUrl = "$($url.Scheme)://$($url.Host)/$cUrl" | |
} | |
$newUrl | |
} | |
#endregion | |
#endregion Source: Globals.ps1 | |
#Start the application | |
Main ($CommandLine) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To run this you'll need to make a .config file similar to below called SSRSDeploy.config
C:\Reports_SSRS http://yourdestinationServer/Test http://datasourcelocation/Data Sources http://reportserver/ReportService2010.asmx true false false true true