mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-28 06:03:22 +00:00
fixes to casing, and some basic functions changed to advanced
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
Function Add-ConditionalFormatting {
|
||||
Param (
|
||||
function Add-ConditionalFormatting {
|
||||
param (
|
||||
[Parameter(Mandatory = $true, Position = 0)]
|
||||
[Alias("Range")]
|
||||
$Address ,
|
||||
@@ -50,7 +50,7 @@
|
||||
)
|
||||
|
||||
#Allow conditional formatting to work like Set-ExcelRange (with single ADDRESS parameter), split it to get worksheet and range of cells.
|
||||
If ($Address -is [OfficeOpenXml.Table.ExcelTable]) {
|
||||
if ($Address -is [OfficeOpenXml.Table.ExcelTable]) {
|
||||
$Worksheet = $Address.Address.Worksheet
|
||||
$Address = $Address.Address.Address
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
function Add-ExcelChart {
|
||||
[cmdletbinding(DefaultParameterSetName = 'Worksheet')]
|
||||
[CmdletBinding(DefaultParameterSetName = 'Worksheet')]
|
||||
[OutputType([OfficeOpenXml.Drawing.Chart.ExcelChart])]
|
||||
param(
|
||||
[Parameter(ParameterSetName = 'Worksheet', Mandatory = $true)]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Function Add-ExcelDataValidationRule {
|
||||
function Add-ExcelDataValidationRule {
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
param(
|
||||
[Parameter(ValueFromPipeline = $true,Position=0)]
|
||||
[Alias("Address")]
|
||||
$Range ,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function Add-PivotTable {
|
||||
[cmdletbinding(defaultParameterSetName = 'ChartbyParams')]
|
||||
[CmdletBinding(defaultParameterSetName = 'ChartbyParams')]
|
||||
[OutputType([OfficeOpenXml.Table.PivotTable.ExcelPivotTable])]
|
||||
param (
|
||||
[Parameter(Mandatory = $true)]
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
Function Close-ExcelPackage {
|
||||
function Close-ExcelPackage {
|
||||
[CmdLetBinding()]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword","")]
|
||||
Param (
|
||||
param (
|
||||
[parameter(Mandatory=$true, ValueFromPipeline=$true)]
|
||||
[OfficeOpenXml.ExcelPackage]$ExcelPackage,
|
||||
[switch]$Show,
|
||||
@@ -16,7 +15,7 @@ Function Close-ExcelPackage {
|
||||
else {
|
||||
if ($Calculate) {
|
||||
try { [OfficeOpenXml.CalculationExtension]::Calculate($ExcelPackage.Workbook) }
|
||||
Catch { Write-Warning "One or more errors occured while calculating, save will continue, but there may be errors in the workbook."}
|
||||
catch { Write-Warning "One or more errors occured while calculating, save will continue, but there may be errors in the workbook."}
|
||||
}
|
||||
if ($SaveAs) {
|
||||
$SaveAs = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($SaveAs)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
Function Compare-Worksheet {
|
||||
[cmdletbinding(DefaultParameterSetName)]
|
||||
function Compare-Worksheet {
|
||||
[CmdletBinding(DefaultParameterSetName)]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Justification="Write host used for sub-warning level message to operator which does not form output")]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification="False positives when initializing variable in begin block")]
|
||||
Param(
|
||||
param(
|
||||
[parameter(Mandatory=$true,Position=0)]
|
||||
$Referencefile ,
|
||||
[parameter(Mandatory=$true,Position=1)]
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#if the filenames don't resolve, give up now.
|
||||
try { $oneFile = ((Resolve-Path -Path $Referencefile -ErrorAction Stop).path -eq (Resolve-Path -Path $Differencefile -ErrorAction Stop).path)}
|
||||
Catch { Write-Warning -Message "Could not Resolve the filenames." ; return }
|
||||
catch { Write-Warning -Message "Could not Resolve the filenames." ; return }
|
||||
|
||||
#If we have one file , we must have two different worksheet names. If we have two files we can have a single string or two strings.
|
||||
if ($onefile -and ( ($WorkSheetName.count -ne 2) -or $WorkSheetName[0] -eq $WorkSheetName[1] ) ) {
|
||||
@@ -46,7 +46,7 @@
|
||||
$sheet1 = Import-Excel -Path $Referencefile -WorksheetName $WorkSheet1 @params
|
||||
$sheet2 = Import-Excel -Path $Differencefile -WorksheetName $WorkSheet2 @Params
|
||||
}
|
||||
Catch {Write-Warning -Message "Could not read the worksheet from $Referencefile and/or $Differencefile." ; return }
|
||||
catch {Write-Warning -Message "Could not read the worksheet from $Referencefile and/or $Differencefile." ; return }
|
||||
|
||||
#Get Column headings and create a hash table of Name to column letter.
|
||||
$headings = $Sheet1[-1].psobject.Properties.name # This preserves the sequence - using Get-member would sort them alphabetically!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Function Convert-ExcelRangeToImage {
|
||||
function Convert-ExcelRangeToImage {
|
||||
[alias("Convert-XlRangeToImage")]
|
||||
Param (
|
||||
param (
|
||||
[parameter(Mandatory=$true)]
|
||||
$Path,
|
||||
$workSheetname = "Sheet1" ,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
Function ConvertTo-ExcelXlsx {
|
||||
function ConvertTo-ExcelXlsx {
|
||||
[CmdletBinding()]
|
||||
Param
|
||||
param
|
||||
(
|
||||
[parameter(Mandatory = $true, ValueFromPipeline)]
|
||||
[string]$Path,
|
||||
[parameter(Mandatory = $false)]
|
||||
[switch]$Force
|
||||
)
|
||||
Process {
|
||||
process {
|
||||
if (-Not ($Path | Test-Path) ) {
|
||||
throw "File not found"
|
||||
}
|
||||
|
||||
@@ -1,34 +1,5 @@
|
||||
|
||||
function Expand-NumberFormat {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Converts short names for number formats to the formatting strings used in Excel
|
||||
.DESCRIPTION
|
||||
Where you can type a number format you can write, for example, 'Short-Date'
|
||||
and the module will translate it into the format string used by Excel.
|
||||
Some formats, like Short-Date change how they are presented when Excel
|
||||
loads (so date will use the local ordering of year, month and Day). Other
|
||||
formats change how they appear when loaded with different cultures
|
||||
(depending on the country "," or "." or " " may be the thousand seperator
|
||||
although Excel always stores it as ",")
|
||||
.EXAMPLE
|
||||
Expand-NumberFormat percentage
|
||||
|
||||
Returns "0.00%"
|
||||
.EXAMPLE
|
||||
Expand-NumberFormat Currency
|
||||
|
||||
Returns the currency format specified in the local regional settings. This
|
||||
may not be the same as Excel uses. The regional settings set the currency
|
||||
symbol and then whether it is before or after the number and separated with
|
||||
a space or not; for negative numbers the number may be wrapped in parentheses
|
||||
or a - sign might appear before or after the number and symbol.
|
||||
So this returns $#,##0.00;($#,##0.00) for English US, #,##0.00 €;€#,##0.00-
|
||||
for French. (Note some Eurozone countries write €1,23 and others 1,23€ )
|
||||
In French the decimal point will be rendered as a "," and the thousand
|
||||
separator as a space.
|
||||
#>
|
||||
[cmdletbinding()]
|
||||
function Expand-NumberFormat {
|
||||
[CmdletBinding()]
|
||||
[OutputType([String])]
|
||||
param (
|
||||
#the format string to Expand
|
||||
|
||||
@@ -403,7 +403,7 @@
|
||||
Write-Warning -Message "AutoNameRange: Property name '$targetRangeName' is also a valid Excel address and may cause issues. Consider renaming the property."
|
||||
}
|
||||
}
|
||||
Catch {
|
||||
catch {
|
||||
Write-Warning -Message "AutoNameRange: Testing '$targetRangeName' caused an error. This should be harmless, but a change of property name may be needed.."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
function Export-ExcelSheet {
|
||||
|
||||
[CmdletBinding()]
|
||||
param
|
||||
(
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
function Export-MultipleExcelSheets {
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "")]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification="No suitable singular")]
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
$Path,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Function Get-ExcelSheetInfo {
|
||||
function Get-ExcelSheetInfo {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Alias('FullName')]
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
Function Get-ExcelWorkbookInfo {
|
||||
function Get-ExcelWorkbookInfo {
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
param (
|
||||
[Alias('FullName')]
|
||||
[Parameter(ValueFromPipelineByPropertyName=$true, ValueFromPipeline=$true, Mandatory=$true)]
|
||||
[String]$Path
|
||||
)
|
||||
|
||||
Process {
|
||||
Try {
|
||||
process {
|
||||
try {
|
||||
$Path = (Resolve-Path $Path).ProviderPath
|
||||
|
||||
$stream = New-Object -TypeName System.IO.FileStream -ArgumentList $Path,'Open','Read','ReadWrite'
|
||||
@@ -20,7 +20,7 @@
|
||||
$xl.Dispose()
|
||||
$xl = $null
|
||||
}
|
||||
Catch {
|
||||
catch {
|
||||
throw "Failed retrieving Excel workbook information for '$Path': $_"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
function Get-Range ($start=0,$stop,$step=1) {
|
||||
function Get-Range {
|
||||
[CmdletBinding()]
|
||||
param($start=0,$stop,$step=1)
|
||||
for ($idx = $start; $idx -lt $stop; $idx+=$step) {$idx}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
function Get-XYRange {
|
||||
[CmdletBinding()]
|
||||
param($targetData)
|
||||
|
||||
$record = $targetData | Select-Object -First 1
|
||||
|
||||
@@ -47,20 +47,20 @@
|
||||
else {
|
||||
$Paths = ''
|
||||
}
|
||||
Function Get-PropertyNames {
|
||||
function Get-PropertyNames {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Create objects containing the column number and the column name for each of the different header types.
|
||||
#>
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '', Justification = "Name would be incorrect, and command is not exported")]
|
||||
Param (
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[Int[]]$Columns,
|
||||
[Parameter(Mandatory)]
|
||||
[Int]$StartRow
|
||||
)
|
||||
|
||||
Try {
|
||||
try {
|
||||
if ($HeaderName) {
|
||||
$i = 0
|
||||
foreach ($H in $HeaderName) {
|
||||
@@ -86,7 +86,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
Catch {
|
||||
catch {
|
||||
throw "Failed creating property names: $_" ; return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
function Import-UPS {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
$TrackingNumber,
|
||||
[Switch]$UseDefaultCredentials
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function Import-USPS {
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
$TrackingNumber,
|
||||
[Switch]$UseDefaultCredentials
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
function Invoke-Sum {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
$data,
|
||||
$dimension,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function Merge-MultipleSheets {
|
||||
[cmdletbinding()]
|
||||
[CmdletBinding()]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification="False positives when initializing variable in begin block")]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseSingularNouns', '', Justification="MultipleSheet would be incorrect")]
|
||||
#[Alias("Merge-MulipleSheets")] #There was a spelling error in the first release. This was there to ensure things didn't break but intelisense gave the alias first.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
function Merge-Worksheet {
|
||||
[cmdletbinding(SupportsShouldProcess=$true)]
|
||||
Param(
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param(
|
||||
[parameter(ParameterSetName='A',Mandatory=$true,Position=0)] #A = Compare two files default headers
|
||||
[parameter(ParameterSetName='B',Mandatory=$true,Position=0)] #B = Compare two files user supplied headers
|
||||
[parameter(ParameterSetName='C',Mandatory=$true,Position=0)] #C = Compare two files headers P1, P2, P3 etc
|
||||
@@ -76,7 +76,7 @@
|
||||
if ($Referencefile -and $Differencefile) {
|
||||
#if the filenames don't resolve, give up now.
|
||||
try { $oneFile = ((Resolve-Path -Path $Referencefile -ErrorAction Stop).path -eq (Resolve-Path -Path $Differencefile -ErrorAction Stop).path)}
|
||||
Catch { Write-Warning -Message "Could not Resolve the filenames." ; return }
|
||||
catch { Write-Warning -Message "Could not Resolve the filenames." ; return }
|
||||
|
||||
#If we have one file , we must have two different Worksheet names. If we have two files $WorksheetName can be a single string or two strings.
|
||||
if ($onefile -and ( ($WorksheetName.count -ne 2) -or $WorksheetName[0] -eq $WorksheetName[1] ) ) {
|
||||
@@ -94,7 +94,7 @@
|
||||
$ReferenceObject = Import-Excel -Path $Referencefile -WorksheetName $Worksheet1 @params
|
||||
$DifferenceObject = Import-Excel -Path $Differencefile -WorksheetName $Worksheet2 @Params
|
||||
}
|
||||
Catch {Write-Warning -Message "Could not read the Worksheet from $Referencefile::$Worksheet1 and/or $Differencefile::$Worksheet2." ; return }
|
||||
catch {Write-Warning -Message "Could not read the Worksheet from $Referencefile::$Worksheet1 and/or $Differencefile::$Worksheet2." ; return }
|
||||
if ($NoHeader) {$firstDataRow = $Startrow } else {$firstDataRow = $Startrow + 1}
|
||||
}
|
||||
elseif ( $Differencefile) {
|
||||
@@ -102,7 +102,7 @@
|
||||
$params = @{WorksheetName=$WorksheetName; Path=$Differencefile; ErrorAction=[System.Management.Automation.ActionPreference]::Stop }
|
||||
foreach ($p in @("HeaderName","NoHeader","StartRow")) {if ($PSBoundParameters[$p]) {$params[$p] = $PSBoundParameters[$p]}}
|
||||
try {$DifferenceObject = Import-Excel @Params }
|
||||
Catch {Write-Warning -Message "Could not read the Worksheet '$WorksheetName' from $Differencefile::$WorksheetName." ; return }
|
||||
catch {Write-Warning -Message "Could not read the Worksheet '$WorksheetName' from $Differencefile::$WorksheetName." ; return }
|
||||
if ($DiffPrefix -eq "=>" ) {
|
||||
$DiffPrefix = (Split-Path -Path $Differencefile -Leaf) -replace "\.xlsx$",""
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function New-ConditionalText {
|
||||
[cmdletbinding()]
|
||||
[CmdletBinding()]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '',Justification='Does not change system State')]
|
||||
param(
|
||||
#[Parameter(Mandatory=$true)]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
function New-ExcelChartDefinition {
|
||||
[Alias("New-ExcelChart")] #This was the former name. The new name reflects that we are defining a chart, not making one in the workbook.
|
||||
[cmdletbinding()]
|
||||
[CmdletBinding()]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Does not change system State')]
|
||||
param(
|
||||
$Title = "Chart Title",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function New-ExcelStyle {
|
||||
[cmdletbinding()]
|
||||
[CmdletBinding()]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Does not change system State')]
|
||||
param (
|
||||
[Alias("Address")]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Scope='Function', Target='New*', Justification='Does not change system State')]
|
||||
param()
|
||||
function New-PSItem {
|
||||
|
||||
param()
|
||||
$totalArgs = $args.Count
|
||||
|
||||
if($args[-1] -is [array]) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
Function Open-ExcelPackage {
|
||||
function Open-ExcelPackage {
|
||||
[CmdLetBinding()]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword","")]
|
||||
[OutputType([OfficeOpenXml.ExcelPackage])]
|
||||
Param (
|
||||
param(
|
||||
#The path to the file to open.
|
||||
[Parameter(Mandatory=$true)]$Path,
|
||||
#If specified, any running instances of Excel will be terminated before opening the file.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Function Remove-Worksheet {
|
||||
[cmdletbinding(SupportsShouldProcess=$true)]
|
||||
function Remove-Worksheet {
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param(
|
||||
# [Parameter(ValueFromPipelineByPropertyName)]
|
||||
[Parameter(ValueFromPipelineByPropertyName)]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Function Send-SQLDataToExcel {
|
||||
function Send-SQLDataToExcel {
|
||||
[CmdletBinding(DefaultParameterSetName="none")]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '', Justification="Allowed to use DBSessions Global variable from GETSQL Module")]
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
param()
|
||||
|
||||
function Set-CellStyle {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
$Worksheet,
|
||||
$Row,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
Function Set-ExcelColumn {
|
||||
[cmdletbinding()]
|
||||
function Set-ExcelColumn {
|
||||
[CmdletBinding()]
|
||||
[Alias("Set-Column")]
|
||||
[OutputType([OfficeOpenXml.ExcelColumn],[String])]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '',Justification='Does not change system state')]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingfunctions', '',Justification='Does not change system state')]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification="Variables created for script block which may be passed as a parameter, but not used in the script")]
|
||||
Param (
|
||||
param(
|
||||
[Parameter(ParameterSetName="Package",Mandatory=$true)]
|
||||
[OfficeOpenXml.ExcelPackage]$ExcelPackage,
|
||||
[Parameter(ParameterSetName="Package")]
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
function Set-ExcelRange {
|
||||
[cmdletbinding()]
|
||||
[CmdletBinding()]
|
||||
[Alias("Set-Format")]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '',Justification='Does not change system state')]
|
||||
Param (
|
||||
param(
|
||||
[Parameter(ValueFromPipeline = $true,Position=0)]
|
||||
[Alias("Address")]
|
||||
$Range ,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
Function Set-ExcelRow {
|
||||
[cmdletbinding()]
|
||||
function Set-ExcelRow {
|
||||
[CmdletBinding()]
|
||||
[Alias("Set-Row")]
|
||||
[OutputType([OfficeOpenXml.ExcelRow],[String])]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '',Justification='Does not change system state')]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingfunctions', '',Justification='Does not change system state')]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseDeclaredVarsMoreThanAssignments', '', Justification="Variables created for script block which may be passed as a parameter, but not used in the script")]
|
||||
Param (
|
||||
param(
|
||||
[Parameter(ParameterSetName="Package",Mandatory=$true)]
|
||||
[OfficeOpenXml.ExcelPackage]$ExcelPackage,
|
||||
[Parameter(ParameterSetName="Package")]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Function Set-WorksheetProtection {
|
||||
[Cmdletbinding()]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '',Justification='Does not change system state')]
|
||||
function Set-WorksheetProtection {
|
||||
[CmdletBinding()]
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingfunctions', '',Justification='Does not change system state')]
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[OfficeOpenXml.ExcelWorksheet]$Worksheet ,
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
|
||||
param()
|
||||
|
||||
Function Update-FirstObjectProperties {
|
||||
|
||||
Try {
|
||||
function Update-FirstObjectProperties {
|
||||
[CmdletBinding()]
|
||||
param()
|
||||
try {
|
||||
$Union = @()
|
||||
$Input | ForEach-Object {
|
||||
If ($Union.Count) {
|
||||
@@ -17,7 +18,7 @@ Function Update-FirstObjectProperties {
|
||||
}
|
||||
$Union
|
||||
}
|
||||
Catch {
|
||||
catch {
|
||||
throw "Failed updating the properties of the first object: $_"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user