ONTAP Discussions

Remove AD Domain Name from Get-NcQuotaReport

EdS
2,791 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
2,783 Views
2 REPLIES 2

JGPSHNTAP
2,784 Views

Use .replace()

EdS
2,765 Views
Public