locked
0x8004530d, The specified property is out of range. RRS feed

  • Question

  • Hello,

    I'm trying to run a PowerShell script that I have created which will go get the quota size of a bunch of folders located in a FS with Server 2012 R2 and apply the same quota size parameter on a folder located in a different FS with Server 2012 R2. 
    When I run the script I'm getting the below error, I have tried to debug it and found out that it's blocking on the parameter -size ($quota_size) of the New-FSRMQuota method, however when I ran the same command with a static -size parameter it works fine or even with manually defining the value of the -size variable things will go ok. I suspected that the variable type on the $quota_size could be wrong but $quota_size.GetType() shows that the type is Int64 which is correct. I'm running out of ideas, so could you please help me out addressing this?

    Script:

    $dest_srv = "Fss_erver01"
    $dest = "D:\groups"
    $src = "G:\groups"
    $groups = Get-ChildItem -Path $src -name

    foreach ($group in $groups) {

        $result = Get-FsrmQuota -Path $src+'\'+$group
        $quota_size = $result.Size
        $path_dest = $dest+'\'+$group
        $s = New-PSSession -Computer $dest_srv
        Invoke-Command -Session $s -ScriptBlock {
            New-fsrmQuota -Path $path_dest -Size $quota_size}
        }



    Error:

    0x8004530d, The specified property is out of range.
        + CategoryInfo          : NotSpecified: (MSFT_FSRMQuota:Root/Microsoft/.../MSFT_FSRMQuota) [New-FsrmQuota], CimException
        + FullyQualifiedErrorId : HRESULT 0x8004530d,New-FsrmQuota
        + PSComputerName        : wancyufs01




    • Edited by Med Achref Tuesday, October 17, 2017 7:47 AM
    Tuesday, October 17, 2017 7:43 AM

All replies

  • Start with: HELP INVOKE-COMMAND -FULL

    You need arguments to make this work.


    \_(ツ)_/

    Tuesday, October 17, 2017 8:08 AM
  • Can you please give me further details?
    Tuesday, October 17, 2017 8:10 AM
  • Yes.  Carefully read the help to learn how to use the command.

    \_(ツ)_/

    Tuesday, October 17, 2017 8:12 AM
  • Sorry I'm new to powershell and I'm really struggling with these few lines of code, could you please tell me what is the missing arguments?


    • Edited by Med Achref Tuesday, October 17, 2017 8:17 AM
    Tuesday, October 17, 2017 8:17 AM
  • Please read the help.  It has the definition or "ArgumentList" and explains in detail with examples. Don't make us read it for you.  It will do you no good.

    The first lesson for anyone wanting to use PowerSHell is to learn how to type "help".


    \_(ツ)_/

    Tuesday, October 17, 2017 8:40 AM
  • Hi ,

    Just checking in to see if the information provided was helpful.

    Please let us know if you would like further assistance.

    Best Regards,

    Candy


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Monday, October 23, 2017 8:33 AM
  • I agree with JRV for the learning, but just to unblock you if it is urgent, check this:

    #requires -Version 3.0
    $dest_srv = 'Fss_erver01'
    $Session = New-PSSession -ComputerName $dest_srv
    $dest = 'D:\groups'
    $src = 'G:\groups'
    $groups = Get-ChildItem -Path $src -Name
    foreach ($group in $groups) 
    {
      $result = Get-FsrmQuota -Path "$src\$group"
      $quota_size = $result.Size
      $path_dest = "$dest\$group"
      Invoke-Command -Session $Session -ScriptBlock {
        Param(
          [Parameter(Mandatory)]
          [string]$path_dest,
          
          [Parameter(Mandatory)]
          [string]$quota_size
        )
        New-fsrmQuota -Path $path_dest -Size $quota_size
      } -ArgumentList $path_dest, $quota_size
    }
    
    Attention that you should not do New-PSSession in a loop. The reason is that the PSSession number is limited by default to 5. If you want to do this you have to close your pssession every time. The best way is doing what I did. One session for the whole threat. Remark: I don't say it is always the best way.


    The key of learning is practice.

    Monday, October 23, 2017 8:29 PM