Forum Discussion
tcboeira
Oct 19, 2022Brass Contributor
Is the use of "$psitem" correct?
Hello friends, First of all, I apologize for the words, but I don't speak English and I rely on an online translator. Well, I have a doubt and I believe it is of orientation. Still learning t...
- Dec 15, 2022
Olá Amigos...
Eu descobri como "se livrar" de conteúdo indesejado na tela.
No final da linha, uso uma referência ao objeto que desejo que seja exibido "| Select-Object -ExpandProperty 'NomeObjeto' " ...
O Script na pergunta tem esta aparência:
$CSV = Import-Csv .\Lista-SITEGRP.csv
$CSV. Conte
$CSV. | do proprietário ForEach-Object {
Get-UnifiedGroup -Identity $_ | ForEach-Object -Process {[PSCustomObject][Ordered]@{
Url = $PSItem.SharePointSiteUrl'Owner
' = $PSItem.ManagedBy -join ", "
'StorageQuota' = Get-SPOSite -Identity $_. | SharePointSiteUrl Select-Object -Property @{Name = 'StorageQuota'; Expression={ $PSItem.StorageQuota}} | Select-object -expandProperty 'StorageQuota''StorageUsageCurrent'
= Get-SPOSite -Identity $_. | SharePointSiteUrl Select-Object -Property @{Name = 'StorageUsageCurrent'; Expression={ $PSItem.StorageUsageCurrent}} | Select-object -expandProperty 'StorageUsageCurrent''Template'
= Get-SPOSite -Identity $_. | SharePointSiteUrl Select-Object -Property @{Name = 'Template'; Expression={ $PSItem.Template}} | Select-Object -ExpandProperty 'Template''LocaleId'
= Get-SPOSite -Identity $_. | SharePointSiteUrl Select-Object -Property @{Name = 'LocaleId'; Expression={ $PSItem.LocaleId}} | Select-Object -ExpandProperty 'LocaleId'
}
}
}Muito obrigado a todos pela vossa ajuda e atenção!!!
Grande abraço
tcboeira
Oct 25, 2022Brass Contributor
Thank you very, very much for the clarification!!!
I confess that I get a little confused in the construction of the "command". And sometimes to see it working without understanding what is actually happening is even a little frustrating. although very cool
Well, I would like to share a doubt that is persistent...
When I use this way:
Get-SPOSite -Identity [My Site] | ForEach-Object -Process {
[PSCustomObject][Ordered]@{
Url = $PSItem.Url
'Owner' = Get-UnifiedGroup -Identity [ID] | Select-Object -Property @{Name = 'Owner'; Expression={ $PSItem.ManagedBy -join ", " }}
'Usage' = $PSItem.StorageUsageCurrent
'Space' = $PSItem.StorageQuota
'Last Access' = $PSItem.LastContentModifiedDate
}
}
My return in the Owner field has always been like this:
Owner : @{Owner=name1, name2, name3}
For example: If only "name1, name2, name3" came, when I import the CSV I can handle it and everything else...
IF it were such a reality,
Get-UnifiedGroup -Identity [id] | ForEach-Object -Process {
[PSCustomObject][Ordered]@{
Url = $PSItem.SharePointSiteUrl
'ID' = $PSItem.ExternalDirectoryObjectId
'Owner' = $PSItem.ManagedBy -join ", "
'uAccess' = $PSItem.WhenChanged
}
}
Success is guaranteed, but then I have difficulties mixing the results.
How do I get rid of the "@{Owner=" and "}" in the output of the first example? or rather... How do I understand the best way to do it?
Again, thank you so much for the help!!!
I confess that I get a little confused in the construction of the "command". And sometimes to see it working without understanding what is actually happening is even a little frustrating. although very cool
Well, I would like to share a doubt that is persistent...
When I use this way:
Get-SPOSite -Identity [My Site] | ForEach-Object -Process {
[PSCustomObject][Ordered]@{
Url = $PSItem.Url
'Owner' = Get-UnifiedGroup -Identity [ID] | Select-Object -Property @{Name = 'Owner'; Expression={ $PSItem.ManagedBy -join ", " }}
'Usage' = $PSItem.StorageUsageCurrent
'Space' = $PSItem.StorageQuota
'Last Access' = $PSItem.LastContentModifiedDate
}
}
My return in the Owner field has always been like this:
Owner : @{Owner=name1, name2, name3}
For example: If only "name1, name2, name3" came, when I import the CSV I can handle it and everything else...
IF it were such a reality,
Get-UnifiedGroup -Identity [id] | ForEach-Object -Process {
[PSCustomObject][Ordered]@{
Url = $PSItem.SharePointSiteUrl
'ID' = $PSItem.ExternalDirectoryObjectId
'Owner' = $PSItem.ManagedBy -join ", "
'uAccess' = $PSItem.WhenChanged
}
}
Success is guaranteed, but then I have difficulties mixing the results.
How do I get rid of the "@{Owner=" and "}" in the output of the first example? or rather... How do I understand the best way to do it?
Again, thank you so much for the help!!!
tcboeira
Dec 15, 2022Brass Contributor
Olá Amigos...
Eu descobri como "se livrar" de conteúdo indesejado na tela.
No final da linha, uso uma referência ao objeto que desejo que seja exibido "| Select-Object -ExpandProperty 'NomeObjeto' " ...
O Script na pergunta tem esta aparência:
$CSV = Import-Csv .\Lista-SITEGRP.csv
$CSV. Conte
$CSV. | do proprietário ForEach-Object {
Get-UnifiedGroup -Identity $_ | ForEach-Object -Process {[PSCustomObject][Ordered]@{
Url = $PSItem.SharePointSiteUrl'Owner
' = $PSItem.ManagedBy -join ", "
'StorageQuota' = Get-SPOSite -Identity $_. | SharePointSiteUrl Select-Object -Property @{Name = 'StorageQuota'; Expression={ $PSItem.StorageQuota}} | Select-object -expandProperty 'StorageQuota''StorageUsageCurrent'
= Get-SPOSite -Identity $_. | SharePointSiteUrl Select-Object -Property @{Name = 'StorageUsageCurrent'; Expression={ $PSItem.StorageUsageCurrent}} | Select-object -expandProperty 'StorageUsageCurrent''Template'
= Get-SPOSite -Identity $_. | SharePointSiteUrl Select-Object -Property @{Name = 'Template'; Expression={ $PSItem.Template}} | Select-Object -ExpandProperty 'Template''LocaleId'
= Get-SPOSite -Identity $_. | SharePointSiteUrl Select-Object -Property @{Name = 'LocaleId'; Expression={ $PSItem.LocaleId}} | Select-Object -ExpandProperty 'LocaleId'
}
}
}
Muito obrigado a todos pela vossa ajuda e atenção!!!
Grande abraço