Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Poweshell Tool NonInteractive Mode

Powershell gives the following when I launch a custom tool: Windows PowerShell is in NonInteractive mode. Read and Prompt functionality is not available. 

The same code works fine when pasted into powershell with a real computer name.  Here is the code:

$name = (Get-ADObject -LDAPFilter:"(anr=$(Computer:TARGET))" -Properties: sAMAccountType | select Distinguishedname)
$new = invoke-command -scriptblock {Read-Host -Prompt 'Input new AD description'}
Set-ADComputer -Identity:$name -Replace:@{"Description"=$new} -Server:""
Invoke-Command -ScriptBlock {pdqinventory ScanComputers -Computers "$(Computer:TARGET)" -ScanProfile "Active Directory"}

I am attempting to change the AD description.  The issue seems to be with the second line:

$new = invoke-command -scriptblock {Read-Host -Prompt 'Input new AD description'}

I am new to PS so please be gentle.



Date Votes
  • Official comment

    We've identified this as an issue within PDQ Inventory that should be resolved with the RTM version of PDQ Inventory 12.

  • This is expected. Read-Host provides you a way to do user input, which is then passed on as a variable to further commands in the script. In the case of PDQ Deploy, and invoke-command, you are say "Put a prompt for input on the remote machine for input". 99% of the time, you are not at that machine to provide the needed input for the script to continue. This is especially true in the case of Running Powershell in PDQ Deploy, as the Powershell console is launched in a hidden session so there is no window showing to the user on the target machine if there happens to be someone logged in at the time.

    In your CSV create a row for Hostname, and a row with the Description

    I would refactor your code to pull data in from a CSV file instead. Play with the following, It's not tested and off the cuff, but I think it should work.

    $new = Get-Content "\\path\to\file.csv"

    Set-ADComputer -Identity:$name -Replace:@{"Description"=$new.Description | Where {$new.Hostname -match $name}} -Server:"someserver.fqdn"


  • Thanks. Do you care to edit your response and anonymize the server.  I missed that and was editing my post when you responded.

  • Done my friend!

  • Thank you very much.  I had originally mis-posted this in Deploy, I have now moved it to Inventory where it belongs.  My intention is to right click a computer, select the tool and enter the new AD description.  I have a kludge that launches a compiled Autoit script to capture the new description and writes it  to a text file. The text file is then read by PS and makes the changes.  I was hoping there was a way accomplishes this without launching an external program. I am guessing that is impossible.


  • Hello, I'm having the same issue in PDQ Deploy when I try to install the PSWindowsUpdate Module.

    Exception calling "ShouldContinue" with "2" argument(s): "Windows PowerShell is in NonInteractive mode. Read and Prompt functionality is not available." At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\\PSModule.psm1:7455 char:8

    • if($Force -or $psCmdlet.ShouldContinue($shouldContinueQueryMessag ...
    •    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      • CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
      • FullyQualifiedErrorId : PSInvalidOperationException

    Script is Find-Module -name "pswindowsupdate" |install-module