none
How do I suppress messages/loading bars from Import-Module and Import-PSSession? RRS feed

  • Question

  • Hello,

    How do I suppress messages/loading bars from Import-Module and Import-PSSession?

    I am writing a script that will be using these commands and it makes the script look clunky/scary to novice users.

    Thank you for your time.

    Tuesday, June 17, 2014 4:01 PM

Answers

  • Use preferences to suppress or enable messages

    $ProgressPreference

    Help about_preference_variables


    ¯\_(ツ)_/¯

    • Proposed as answer by Mike Laughlin Tuesday, June 17, 2014 5:27 PM
    • Marked as answer by Cosmo_Kramer Tuesday, June 17, 2014 5:56 PM
    Tuesday, June 17, 2014 5:24 PM

All replies

  • Use preferences to suppress or enable messages

    $ProgressPreference

    Help about_preference_variables


    ¯\_(ツ)_/¯

    • Proposed as answer by Mike Laughlin Tuesday, June 17, 2014 5:27 PM
    • Marked as answer by Cosmo_Kramer Tuesday, June 17, 2014 5:56 PM
    Tuesday, June 17, 2014 5:24 PM
  • Use preferences to suppress or enable messages

    $ProgressPreference

    Help about_preference_variables


    ¯\_(ツ)_/¯


    Thank you so much.
    Tuesday, June 17, 2014 5:56 PM
  • No problem.  Poke around in help when you have time.  You will find all kinds of interesting things.

    ¯\_(ツ)_/¯

    Tuesday, June 17, 2014 5:59 PM
  • No problem.  Poke around in help when you have time.  You will find all kinds of interesting things.

    ¯\_(ツ)_/¯

    Sorry to bring this back up, but it seems that the ProgressPreference worked for Exchange, but it didn't affect the Active Directory progress bar. Any ideas why?

    Thank you for your time.

    Tuesday, July 1, 2014 11:55 PM
  • Sorry to bring this back up, but it seems that the ProgressPreference worked for Exchange, but it didn't affect the Active Directory progress bar. Any ideas why?

    Strange, this worked just fine for me (no module loading indication):

    PS C:\Users\mike.admin> $ProgressPreference = 'SilentlyContinue'
    PS C:\Users\mike.admin> Get-ADUser mike.admin | Select Name
    
    Name
    ----
    mike.admin


    Don't retire TechNet! - (Don't give up yet - 12,950+ strong and growing)

    Wednesday, July 2, 2014 12:45 AM
  • Sorry to bring this back up, but it seems that the ProgressPreference worked for Exchange, but it didn't affect the Active Directory progress bar. Any ideas why?

    Strange, this worked just fine for me (no module loading indication):

    PS C:\Users\mike.admin> $ProgressPreference = 'SilentlyContinue'
    PS C:\Users\mike.admin> Get-ADUser mike.admin | Select Name
    
    Name
    ----
    mike.admin


    Don't retire TechNet! - (Don't give up yet - 12,950+ strong and growing)


    I do run the Import-Module command inside a function, but I doubt that would do it because I assume the preference is set scriptwide.
    Wednesday, July 2, 2014 10:35 AM
  • I can't reproduce either. Steps:

    1. Open PowerShell console window.

    2. Enter command: $ProgressPreference = "SilentlyContinue"

    3. Enter command: Import-Module ActiveDirectory

    No progress bar.


    -- Bill Stewart [Bill_Stewart]

    Wednesday, July 2, 2014 2:22 PM
    Moderator
  • Sorry to bring this back up, but it seems that the ProgressPreference worked for Exchange, but it didn't affect the Active Directory progress bar. Any ideas why?

    Strange, this worked just fine for me (no module loading indication):

    PS C:\Users\mike.admin> $ProgressPreference = 'SilentlyContinue'
    PS C:\Users\mike.admin> Get-ADUser mike.admin | Select Name
    
    Name
    ----
    mike.admin


    Don't retire TechNet! - (Don't give up yet - 12,950+ strong and growing)


    I do run the Import-Module command inside a function, but I doubt that would do it because I assume the preference is set scriptwide.

    This will work anywhere.

    $global:ProgressPreference='SilentlyContinue'


    ¯\_(ツ)_/¯

    • Proposed as answer by jrv Wednesday, July 2, 2014 2:31 PM
    Wednesday, July 2, 2014 2:30 PM