Quota error check

Anonymous
2024-02-03T15:49:56+00:00

I'm copying a large number of folders from one server to another. Unfortunately the destination server has  the disk and the volume different (so I can't make a mirror copy with the same path..) With a little patience I can create the list of powershell commands to create the quotas on the destination server

New-FsrmQuota -Path "D:\Vol01\folder1" -Size2GB -Template "QMPA"

Using New-FsrmQuota  by "running" from  powershell ISE  I cannot clearly see/verify the errors (example: the folder does not exist or the path does not exist) especially if the quotas to set are a large number (as 800) 

I was wondering if there is a way with powershell to  verify errors and have a list of unexecuted quotas, the type of error and the corresponding powershell command.

Windows Server Remote and virtual desktops PowerShell

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question. To protect privacy, user profiles for migrated questions are anonymized.

0 comments No comments
{count} votes

20 answers

Sort by: Most helpful
  1. Anonymous
    2024-02-06T09:09:43+00:00

    I am receiving the error below:

    "path","size","template"

    "D:\Vol01\folder1","8GB"

    "D:\Vol01\folder2","3GB"

    "D:\Vol01\folder3","2GB"

    Cannot process argument transformation on parameter 'Size'. Cannot convert value "8GB" to type "System.UInt64". Error: "Input string was not in a correct format."

    0 comments No comments
  2. Anonymous
    2024-02-07T05:26:16+00:00

    It seems the size has to be converted manually. Please see if this works. Sorry I don't currently have a server to test the script.

    $entries = "C:\entries.csv"
    
    Import-CSV -Path $entries | foreach-object {
    
        Try {      
    
            # PowerShell command that might generate an error
    
            New-FsrmQuota -Path $_.path -Size $($_.size/1) -Template "QMPA" -ErrorAction Stop  
        } 
    
        Catch {      
    
            # Log the error message to the log file     
    
            Add-Content -Path $LogFile -Value $("[" + (Get-Date) + "] " + $_.Exception.Message) 
    
        }
    
    }
    
    0 comments No comments
  3. Anonymous
    2024-02-07T07:56:55+00:00

    Thank you very much Ian_Xue,

    it is working now.

    [02/07/2024 08:44:20] 0x80045303, The specified object already exists.

    [02/07/2024 08:44:20] 0x80045303, The specified object already exists.

    [02/07/2024 08:44:20] 0x80045303, The specified object already exists.

    unfortunately this type of outcome does not help me to understand which folder generated the error.

    it is possible have more details of the error (for example would be enough to have also the line below the error that says: : +New-FsrmQuota -Path "D:\Vol01\folder1" -Size 8GB)


    PS C:\WINDOWS\system32> New-FsrmQuota -Path "D:\Vol01\folder1" -Size 8GB

    New-FsrmQuota : 0x80045303, The specified object already exists.

    At line:1 char:1

    + New-FsrmQuota -Path "D:\Vol01\folder1" -Size 8GB

    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : ResourceExists: (MSFT_FSRMQuota:Root/Microsoft/.../MSFT_FSRMQuota) [New-FsrmQuota], CimException

    + FullyQualifiedErrorId : MI RESULT 11,New-FsrmQuota

    1 person found this answer helpful.
    0 comments No comments
  4. Anonymous
    2024-02-08T06:24:53+00:00

    You can simply add the path to the log file like this.

    $entries = "C:\entries.csv"
    Import-CSV -Path $entries | foreach-object {
        $entry = $_
        Try {      
            # PowerShell command that might generate an error
            New-FsrmQuota -Path $_.path -Size $($_.size/1) -Template "QMPA" -ErrorAction Stop  
        } 
        Catch {      
            # Log the error message to the log file     
            Add-Content -Path $LogFile -Value $("[" + (Get-Date) + "] " + "[" + $entry.path + "] " + $_.Exception.Message) 
        }
    }
    
    0 comments No comments
  5. Anonymous
    2024-02-08T09:36:15+00:00

    I have one line more but the error should be "The specified object already exists" and not Access is denied as I can see on the log (below)

    [02/08/2024 10:28:57] [D:\Vol01\folder1] 0x80070005, Access is denied.

    [02/08/2024 10:28:57] [D:\Vol01\folder2] 0x80070005, Access is denied.

    [02/08/2024 10:28:57] [D:\Vol01\folder3] 0x80070005, Access is denied.

    0 comments No comments