Forum Discussion

acelestial's avatar
acelestial
Copper Contributor
Aug 01, 2019

Clear-ASMonitoringSqlDatabase cmdlet in non-interactive mode

Hi,

 

I'm trying to automate running of powershell command below in non-interactive way. The command prompts for a confirmation.

 

Is there a way to bypass the confirmation prompt or accept the default confirmation response in the command/script so that it'll run automatically?

 

Clear-ASMonitoringSqlDatabase -ConnectionString "Data Source=localhost;Initial Catalog=Monitoring;Integrated Security=False;User ID=xxx;Password=xxx" -MaxAge 3 -PurgeMode EventAgeMode

 

Any help is much appreciated!

 

Regards,

Arman

 

2 Replies

  • gastone's avatar
    gastone
    Copper Contributor

    acelestial  put a -force

    Clear-ASMonitoringSqlDatabase -ConnectionString "Data Source=localhost;Initial Catalog=Monitoring;Integrated Security=False;User ID=xxx;Password=xxx" -MaxAge 3 -PurgeMode EventAgeMode -force

     

    • acelestial's avatar
      acelestial
      Copper Contributor

      gastone  Clear-ASMonitoringSqlDatabase cmdlet has no  either -Force or -Confirm options.

Resources