Array not supported?

%3CLINGO-SUB%20id%3D%22lingo-sub-91646%22%20slang%3D%22en-US%22%3EArray%20not%20supported%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-91646%22%20slang%3D%22en-US%22%3E%3CP%3EWill%20this%20say%20that%20Array%20is%20not%20supported%20by%20set-CsRGSHolidayset%3F%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F17952i7ABFAEA68EF9CCB6%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22DGD_M-QXcAAbMoM.jpg%22%20title%3D%22DGD_M-QXcAAbMoM.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-91646%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESkype%20for%20Business%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-95541%22%20slang%3D%22en-US%22%3ERe%3A%20Array%20not%20supported%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-95541%22%20slang%3D%22en-US%22%3E%3CP%3ESorry%20for%20not%20getting%20back%20to%20this%20post.%20I%20ended%20up%20doing%20it%20like%20this%3A%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20974px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F18563iC2186A86AD7B06AB%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22array.PNG%22%20title%3D%22array.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-95520%22%20slang%3D%22en-US%22%3ERe%3A%20Array%20not%20supported%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-95520%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20error%20message%20says%20that%20it%20can't%20convert%20your%20untyped%20(object%5B%5D)%20array%20to%20the%20required%20type.%3C%2FP%3E%3CP%3ETry%20to%20specify%20the%20type%20for%20array%20elements%3A%3C%2FP%3E%3CP%3E%5BMicrosoft.Rtc.Rgs.Management.WritableSettings.Holiday%5B%5D%5D%24HolSetArray%20%3D%20%40()%3B%3CBR%20%2F%3E%24HolSetArray%20%2B%3D%20New-CsRgsHoliday%20-StartDate%20%222017-01-01T00%3A00%3A00%22%20-EndDate%20%222017-01-01T23%3A59%3A59%22%20-Name%20%22New%20Year's%20Day%22%3CBR%20%2F%3E%24HolSetArray%20%2B%3D%20New-CsRgsHoliday%20-StartDate%20%222017-12-26T00%3A00%3A00%22%20-EndDate%20%222017-12-26T23%3A59%3A59%22%20-Name%20%22Christmas%20Day%22%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-91788%22%20slang%3D%22en-US%22%3ERe%3A%20Array%20not%20supported%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-91788%22%20slang%3D%22en-US%22%3EAccording%20to%20the%20documentation%20is%20does%20indeed%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fgg398403.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fgg398403.aspx%3C%2FA%3E%3CBR%20%2F%3EI%20guess%20it%20is%20a%20different%20cmdlet%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-91787%22%20slang%3D%22en-US%22%3ERe%3A%20Array%20not%20supported%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-91787%22%20slang%3D%22en-US%22%3E%3CP%3EStrange%2C%20as%20it%20works%20for%20new-csrgsholidayset%20%3A%5C%3C%2Fimg%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-91786%22%20slang%3D%22en-US%22%3ERe%3A%20Array%20not%20supported%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-91786%22%20slang%3D%22en-US%22%3EThat%20is%20not%20support%20by%20that%20cmdlet.%20It%20has%20the%20be%20of%20the%20type%20holidayset%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-91778%22%20slang%3D%22en-US%22%3ERe%3A%20Array%20not%20supported%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-91778%22%20slang%3D%22en-US%22%3E%3CP%3EI%20know%20about%20this%2C%20but%20problem%20is%20that%20you%20cant%20use%20.Add(%24x)%20on%20a%20Array.%3C%2FP%3E%3CP%3ENeed%20to%20use%20something%20like%20%24Array%20%2B%3D%20%24newArray.%3C%2FP%3E%3CP%3EI%20tried%20with%20Add-member%20now%2C%20and%20was%20sucessfull%20to%20add%20data%20to%20the%20variable.%3C%2FP%3E%3CP%3EBut%20when%20i%20try%20to%20use%20it%20in%20Set-CsRGSHolidayset%20it%20does%20nothing.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20600px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F17970i08A1436697C825C5%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%221.PNG%22%20title%3D%221.PNG%22%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20503px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F17971i5DE3009E4B03B52A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%222.PNG%22%20title%3D%222.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-91727%22%20slang%3D%22en-US%22%3ERe%3A%20Array%20not%20supported%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-91727%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20right%20way%20to%20add%20is%20descibred%20here%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fgg398736.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Ftechnet.microsoft.com%2Fen-us%2Flibrary%2Fgg398736.aspx%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20following%20example%20is%20what%20you%20are%20looking%20for%3A%3C%2FP%3E%3CPRE%3E%24x%20%3D%20New-CsRgsHoliday%20-StartDate%20%2212%2F25%2F2010%22%20-EndDate%20%2212%2F26%2F2010%22%20-Name%20%22Christmas%20Day%22%0A%24y%20%3D%20Get-CsRgsHolidaySet%20-Identity%20%22service%3AApplicationServer%3Aatl-cs-001.litwareinc.com%22%20-Name%20%222010%20Holidays%22%0A%24y.HolidayList.Add(%24x)%0ASet-CsRgsHolidaySet%20-Instance%20%24y%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
MVP

Will this say that Array is not supported by set-CsRGSHolidayset?

DGD_M-QXcAAbMoM.jpg

7 Replies

The right way to add is descibred here: https://technet.microsoft.com/en-us/library/gg398736.aspx

 

The following example is what you are looking for:

$x = New-CsRgsHoliday -StartDate "12/25/2010" -EndDate "12/26/2010" -Name "Christmas Day"
$y = Get-CsRgsHolidaySet -Identity "service:ApplicationServer:atl-cs-001.litwareinc.com" -Name "2010 Holidays"
$y.HolidayList.Add($x)
Set-CsRgsHolidaySet -Instance $y

 

I know about this, but problem is that you cant use .Add($x) on a Array.

Need to use something like $Array += $newArray.

I tried with Add-member now, and was sucessfull to add data to the variable.

But when i try to use it in Set-CsRGSHolidayset it does nothing.

 

1.PNG2.PNG

That is not support by that cmdlet. It has the be of the type holidayset

Strange, as it works for new-csrgsholidayset :\

According to the documentation is does indeed
https://technet.microsoft.com/en-us/library/gg398403.aspx
I guess it is a different cmdlet

The error message says that it can't convert your untyped (object[]) array to the required type.

Try to specify the type for array elements:

[Microsoft.Rtc.Rgs.Management.WritableSettings.Holiday[]]$HolSetArray = @();
$HolSetArray += New-CsRgsHoliday -StartDate "2017-01-01T00:00:00" -EndDate "2017-01-01T23:59:59" -Name "New Year's Day"
$HolSetArray += New-CsRgsHoliday -StartDate "2017-12-26T00:00:00" -EndDate "2017-12-26T23:59:59" -Name "Christmas Day"

Sorry for not getting back to this post. I ended up doing it like this:
array.PNG