Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

working with collections in powershell

$
0
0

Hi,

I'm struggeling with collections in Powershell in general.
I have a variable of type SPWebCollection created and want to add
1) a single SPWeb - Object
2) another collection of SPWeb - Objects

Can someone tell me please why the following doesn't work:

[Microsoft.Sharepoint.SPWebCollection]$allWebs += Get-SPWeb $URL1

or this

[Microsoft.Sharepoint.SPWebCollection]$allWebs += $site.AllWebs | Where-Object {$_.Url -like $URL2}

Finally I want to empty the $allWebs collection i.e. remove all objects. How do I do that?


I appreciate any feedback
Thank you


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>