Skip to content

Commit

Permalink
(MicrosoftDocsGH-8645) Clarify PSModuleAutoloadingPreference (Microso…
Browse files Browse the repository at this point in the history
…ftDocs#8648)

Prior to this commit, the `$PSModuleAutoloadingPreference` section of
the `about_Preference_Variables` document explained how to use the
variable in the list item for the **All** setting and did not explicitly
indicate PowerShell's behavior when the variable is not set.

This commit updates the `$PSModuleAutoloadingPreference` section of the
`about_Preference_Variables` document to clarify that the variable is
not instantiated automatically but the behavior is still the described
default of **All**.

It also moves the behavior explanation from the list item for the
**All** setting into the opening paragraph to improve clarity.

Finally, this commit moves the note on using `Import-Module` to import
modules regardless of the variable's setting into its own paragraph.
  • Loading branch information
michaeltlombardi committed Mar 11, 2022
1 parent 924ebbc commit 8a6dcd3
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Variables that customize the behavior of PowerShell.
Locale: en-US
ms.date: 02/09/2022
ms.date: 03/11/2022
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-5.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about Preference Variables
Expand Down Expand Up @@ -1098,8 +1098,14 @@ cmdlet.
## \$PSModuleAutoloadingPreference

Enables and disables automatic importing of modules in the session. **All** is
the default. Regardless of the variable's value, you can use
[Import-Module](xref:Microsoft.PowerShell.Core.Import-Module) to import a module.
the default. To import a module, get or use any command in the module. For
example, use `Get-Command`. The `$PSModuleAutoloadingPreference` variable does
not exist by default. The default behavior when the variable is not defined is
the same as `$PSModuleAutoloadingPreference = 'All'`.

Regardless of the variable's value, you can use
[Import-Module](xref:Microsoft.PowerShell.Core.Import-Module) to import a
module.

The `$PSModuleAutoloadingPreference` variable takes one of the
[`PSModuleAutoLoadingPreference`](/dotnet/api/system.management.automation.psmoduleautoloadingpreference)
Expand All @@ -1108,8 +1114,7 @@ enumeration values:

Valid values are:

- **All**: Modules are imported automatically on first-use. To import a module,
get or use any command in the module. For example, use `Get-Command`.
- **All**: Modules are imported automatically on first-use.
- **ModuleQualified**: Modules are imported automatically only when a user uses
the module-qualified name of a command in the module. For example, if the
user types `MyModule\MyCommand`, PowerShell imports the **MyModule** module.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Variables that customize the behavior of PowerShell.
Locale: en-US
ms.date: 02/09/2022
ms.date: 03/11/2022
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about Preference Variables
Expand Down Expand Up @@ -975,8 +975,14 @@ cmdlet.
## \$PSModuleAutoloadingPreference

Enables and disables automatic importing of modules in the session. **All** is
the default. Regardless of the variable's value, you can use
[Import-Module](xref:Microsoft.PowerShell.Core.Import-Module) to import a module.
the default. To import a module, get or use any command in the module. For
example, use `Get-Command`. The `$PSModuleAutoloadingPreference` variable does
not exist by default. The default behavior when the variable is not defined is
the same as `$PSModuleAutoloadingPreference = 'All'`.

Regardless of the variable's value, you can use
[Import-Module](xref:Microsoft.PowerShell.Core.Import-Module) to import a
module.

The `$PSModuleAutoloadingPreference` variable takes one of the
[`PSModuleAutoLoadingPreference`](/dotnet/api/system.management.automation.psmoduleautoloadingpreference)
Expand All @@ -985,8 +991,7 @@ enumeration values:

Valid values are:

- **All**: Modules are imported automatically on first-use. To import a module,
get or use any command in the module. For example, use `Get-Command`.
- **All**: Modules are imported automatically on first-use.
- **ModuleQualified**: Modules are imported automatically only when a user uses
the module-qualified name of a command in the module. For example, if the
user types `MyModule\MyCommand`, PowerShell imports the **MyModule** module.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Variables that customize the behavior of PowerShell.
Locale: en-US
ms.date: 02/09/2022
ms.date: 03/11/2022
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.1&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about Preference Variables
Expand Down Expand Up @@ -975,8 +975,14 @@ cmdlet.
### \$PSModuleAutoloadingPreference

Enables and disables automatic importing of modules in the session. **All** is
the default. Regardless of the variable's value, you can use
[Import-Module](xref:Microsoft.PowerShell.Core.Import-Module) to import a module.
the default. To import a module, get or use any command in the module. For
example, use `Get-Command`. The `$PSModuleAutoloadingPreference` variable does
not exist by default. The default behavior when the variable is not defined is
the same as `$PSModuleAutoloadingPreference = 'All'`.

Regardless of the variable's value, you can use
[Import-Module](xref:Microsoft.PowerShell.Core.Import-Module) to import a
module.

The `$PSModuleAutoloadingPreference` variable takes one of the
[`PSModuleAutoLoadingPreference`](/dotnet/api/system.management.automation.psmoduleautoloadingpreference)
Expand All @@ -985,8 +991,7 @@ enumeration values:

Valid values are:

- **All**: Modules are imported automatically on first-use. To import a module,
get or use any command in the module. For example, use `Get-Command`.
- **All**: Modules are imported automatically on first-use.
- **ModuleQualified**: Modules are imported automatically only when a user uses
the module-qualified name of a command in the module. For example, if the
user types `MyModule\MyCommand`, PowerShell imports the **MyModule** module.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Variables that customize the behavior of PowerShell.
Locale: en-US
ms.date: 02/09/2022
ms.date: 03/11/2022
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.2&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about Preference Variables
Expand Down Expand Up @@ -976,8 +976,14 @@ cmdlet.
## \$PSModuleAutoloadingPreference

Enables and disables automatic importing of modules in the session. **All** is
the default. Regardless of the variable's value, you can use
[Import-Module](xref:Microsoft.PowerShell.Core.Import-Module) to import a module.
the default. To import a module, get or use any command in the module. For
example, use `Get-Command`. The `$PSModuleAutoloadingPreference` variable does
not exist by default. The default behavior when the variable is not defined is
the same as `$PSModuleAutoloadingPreference = 'All'`.

Regardless of the variable's value, you can use
[Import-Module](xref:Microsoft.PowerShell.Core.Import-Module) to import a
module.

The `$PSModuleAutoloadingPreference` variable takes one of the
[`PSModuleAutoLoadingPreference`](/dotnet/api/system.management.automation.psmoduleautoloadingpreference)
Expand All @@ -986,8 +992,7 @@ enumeration values:

Valid values are:

- **All**: Modules are imported automatically on first-use. To import a module,
get or use any command in the module. For example, use `Get-Command`.
- **All**: Modules are imported automatically on first-use.
- **ModuleQualified**: Modules are imported automatically only when a user uses
the module-qualified name of a command in the module. For example, if the
user types `MyModule\MyCommand`, PowerShell imports the **MyModule** module.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: Variables that customize the behavior of PowerShell.
Locale: en-US
ms.date: 02/09/2022
ms.date: 03/11/2022
online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3&WT.mc_id=ps-gethelp
schema: 2.0.0
title: about Preference Variables
Expand Down Expand Up @@ -976,8 +976,14 @@ cmdlet.
## \$PSModuleAutoloadingPreference

Enables and disables automatic importing of modules in the session. **All** is
the default. Regardless of the variable's value, you can use
[Import-Module](xref:Microsoft.PowerShell.Core.Import-Module) to import a module.
the default. To import a module, get or use any command in the module. For
example, use `Get-Command`. The `$PSModuleAutoloadingPreference` variable does
not exist by default. The default behavior when the variable is not defined is
the same as `$PSModuleAutoloadingPreference = 'All'`.

Regardless of the variable's value, you can use
[Import-Module](xref:Microsoft.PowerShell.Core.Import-Module) to import a
module.

The `$PSModuleAutoloadingPreference` variable takes one of the
[`PSModuleAutoLoadingPreference`](/dotnet/api/system.management.automation.psmoduleautoloadingpreference)
Expand All @@ -986,8 +992,7 @@ enumeration values:

Valid values are:

- **All**: Modules are imported automatically on first-use. To import a module,
get or use any command in the module. For example, use `Get-Command`.
- **All**: Modules are imported automatically on first-use.
- **ModuleQualified**: Modules are imported automatically only when a user uses
the module-qualified name of a command in the module. For example, if the
user types `MyModule\MyCommand`, PowerShell imports the **MyModule** module.
Expand Down

0 comments on commit 8a6dcd3

Please sign in to comment.