DomainPasswordSpray icon indicating copy to clipboard operation
DomainPasswordSpray copied to clipboard

Variable reference is not valid

Open kpomeroy1979 opened this issue 3 years ago • 2 comments

Update - If you don't need it, you can just delete or comment out the function timer and the script works fine.

After a recent update the script fails with the following error

Iex : At line:261 char:21

  •     Write-Host "$Message: Waiting for $($Seconds/60) minutes. $($ ...
    
  •                 ~~~~~~~~~
    

Variable reference is not valid. ':' was not followed by a valid variable name character. Consider using ${} to delimit the name. At line:1 char:1

  • Iex (new-object net.webclient).downloadstring('https://raw.githubuser ...
  •   + CategoryInfo          : ParserError: (:) [Invoke-Expression], ParseException
      + FullyQualifiedErrorId : InvalidVariableReferenceWithDrive,Microsoft.PowerShell.Commands.InvokeExpressionCommand
    

kpomeroy1979 avatar Jan 06 '22 16:01 kpomeroy1979

Alternatively, you can add a single space after $Message to fix the error. I believe that you simply can't have a variable followed by a colon without escaping it or using one of the special cases for colons. So changing line 261 to the following will make the script work: Write-Host "$Message : Waiting for $($Seconds/60) minutes. $($ ...

realspookysocks avatar Feb 18 '22 22:02 realspookysocks

Adding the space works perfectly. Thanks :)

kpomeroy1979 avatar Mar 18 '22 02:03 kpomeroy1979