locked
Get Description from AD Group and calculate with this information RRS feed

  • Question

  • Hi everyone,

    i looked through many tips how to convert from System.Object to Int32/Double to perform calculation. But it always ends up with:

    [DBG]: PS C:\Users\psuser>> 
    Method invocation failed because [System.Object[]] doesn't contain a method named 'op_Multiply'.
    At C:\scripts\Yo.ps1:12 char:5
    +     $QWarning = $QProhibitSend*0,9
    +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (op_Multiply:String) [], RuntimeException
        + FullyQualifiedErrorId : MethodNotFound

        

    Script:

    $QuotaGroups = Get-ADGroup -SearchBase $QuotaOU -filter {GroupCategory -eq "Distribution"} -Properties * | select-object Name,Description

    ForEach ($QuotaGroup in $Quotagroups)
        {
        [int]$QProhibitSend = $QuotaGroup.Description
        $QWarning = $QProhibitSend*0,9
        }

    Can anyone advise? 


    Regards Stephan

    OneDrive / Sharepoint Blog

    Saturday, September 2, 2017 4:17 PM

Answers

  • This is an illegal syntax:

    $QProhibitSend*0,9

    It also make no sense.


    \_(ツ)_/

    • Marked as answer by Stephan G Saturday, September 2, 2017 5:18 PM
    Saturday, September 2, 2017 4:33 PM

All replies

  • This is an illegal syntax:

    $QProhibitSend*0,9

    It also make no sense.


    \_(ツ)_/

    • Marked as answer by Stephan G Saturday, September 2, 2017 5:18 PM
    Saturday, September 2, 2017 4:33 PM
  • You are right. It must be a (.) point and not a comma.

    (Must be a regional thing that i did not get this right)

    Thank you from Germany


    Regards Stephan

    OneDrive / Sharepoint Blog

    Saturday, September 2, 2017 5:18 PM
  • Please consider the following:

    PS D:\scripts> '12345' * 0.9999
    12345
    PS D:\scripts> .9 * '1'
    0.9


    \_(ツ)_/

    Saturday, September 2, 2017 5:22 PM