4 Replies Latest reply on Mar 13, 2017 2:33 PM by AnthonyDowns

    Powershell through Heat

    AnthonyDowns Specialist

      Has anyone had issues running powershell through Heat? I followed the instructions in the help guide and it looks like it is working but it is not.

       

      Right now I'm trying a simple script to unlock a user and reset the password. If I run the script in the powershell console it works as intended, however, when I run with a quick action in Heat it does not work but when I look at the run program history it shows completed and no errors.

       

      Remote Host Settings

      Quick action

      Script 

      param(
      [string]$user
      )

      $ran = New-Object random
      $num = $ran.Next(1000, 9999)

      $day = (Get-Date).DayOfWeek
      $pass = "$day" + "$num"
      $newpassword = ConvertTo-SecureString -String $pass -AsPlainText -Force

      Set-ADAccountPassword $user -NewPassword $newpassword -Reset -PassThru | Set-ADUser -ChangePasswordAtLogon $true
      Unlock-ADAccount $user

      Write-Host Password for user: $user reset to: $pass