PowerShell and SharePoint

Hi

How do I assign $User to my field ($item[“MySharePointName”])?
$User = Get-MsolUser -SearchString “test” | Select UserPrincipalName -ExpandProperty UserPrincipalName

 

Thank you.

The post is a bit vague. $item appears to be a HashTable, so emulating that $User returns ‘Foo’, you would assign it like this:

$user = 'Foo'

$item = @{}
$item[“MySharePointName”] = $user