NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform.
You will still be able to view content, but posting and replying will be temporarily disabled.
To learn more, please review the information in this blog post.

ONTAP Discussions

Remove AD Domain Name from Get-NcQuotaReport

EdS
3,902 Views

We have a PowerShell script that reports on the top 50 consumers on one of our volumes.  The volume has tracing quotas enabled so we are using Get-NcQuotaReport to get the information.  The username returned from Get-NcQuotaReport comes back as DomainName\Username via $_QuotaUsers.QuotaUserName. Is there a way via an inline expression to remove the "DomainName\" from the output?  Here is how we get the output.

 

$diskused = Get-NcQuotaReport | Where-Object {$_.Volume -eq 'OurVolume'} | Where-Object {$_.QuotaUsers.QuotaUserName -notlike '*Admin*'} | select QuotaUsers,DiskUsed


$diskused | Sort-Object -Unique -Descending { [int64]$_.DiskUsed} |
Format-Table @{Name='Username';Expression={$_.QuotaUsers.QuotaUserName}}, @{Name='GigaBytes';Expression={($_.DiskUsed -shr 20)};align='right'; Width=10} |
Select-Object -First 50 | Out-String -Width 80 |
Out-File $reportfile -Append

 

1 ACCEPTED SOLUTION

JGPSHNTAP
3,894 Views
2 REPLIES 2

JGPSHNTAP
3,895 Views

Use .replace()

EdS
3,876 Views
Public