troubleshooting Question

store items in variable - Powershell

Avatar of Kelly Garcia
Kelly GarciaFlag for United Kingdom of Great Britain and Northern Ireland asked on
ExchangePowershell* WPF
4 Comments1 Solution136 ViewsLast Modified:
Hi All,

I have this line of code in my script:

if ($null -ne $ListView.SelectedItems) {
        $ListView.ItemsSource = @($ListView.SelectedItems | Select-Object DisplayName, TotalItemSize, ItemCount, Database, TotalDeletedItemSize,DeletedItemCount, LastLoggedOnUserAccount, LastLogonTime, LastLogoffTime -OutVariable $mailboxtomigrate)
		$m = $mailboxtomigrate | Out-String

the selected can be many. I need to store it in a variable so I can loop through it when I run the new-moverequest script.

so I need the display names to be stored as a string in the variable e.g. $mailboxtomigrate = "display name 1", "display name 2", "display name 3"

how do I do this?

is better if I out the results into an array?  how do I do this?

thank you in advance
Kelly Garcia
Senior Systems Administrator

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros