Removes modules from the current session. (Remove-Module)

   

# NAME
Remove-Module

# SYNOPSIS
Removes modules from the current session.

# SYNTAX
Remove-Module [-ModuleInfo] <PSModuleInfo[]> [-Force] [-Confirm] [-WhatIf] [<CommonParameters>]

Remove-Module [-Name] <string[]> [-Force] [-Confirm] [-WhatIf] [<CommonParameters>]

# DESCRIPTION
The Remove-Module cmdlet removes the members of a module from the current session.

If the module includes an assembly (.dll), all members that are implemented by the assembly are removed, but the assembly is not unloaded.

# PARAMETERS
-Force [<SwitchParameter>]
Removes modules even when their access mode is read-only.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-ModuleInfo <PSModuleInfo[]>
Specifies the module objects to remove. Enter a variable that contains a module object (PSModuleInfo) or a command that gets a module object, such as a Get-Module command. You can also pipe module objects to Remove-Module.

Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false

-Name <string[]>
Specifies the names of modules to remove. Wildcards are permitted. You can also pipe name strings to Remove-Module.

Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? true

-Confirm [<SwitchParameter>]
Prompts you for confirmation before executing the command.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-WhatIf [<SwitchParameter>]
Describes what would happen if you executed the command without actually executing the command.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

# INPUTS
System.String, System.Management.Automation.PSModuleInfo
You can pipe module names (strings) and module objects to Remove-Module.

# OUTPUTS
None
Remove-Module does not generate any output.

# NOTES

You can also refer to Remove-Module by its alias, "rmo". For more information, see about_Aliases.

# EXAMPLE 1

C:\PS>remove-module -name BitsTransfer

# Description
-----------
This command removes the BitsTransfer module from the current session.

# EXAMPLE 2

C:\PS>get-module | remove-module

# Description
-----------
This command removes all modules from the current session.

# EXAMPLE 3

C:\PS>"FileTransfer", "PSDiagnostics" | remove-module -verbose

VERBOSE: Performing operation "Remove-Module" on Target "filetransfer (Path: 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\f
iletransfer\filetransfer.psd1')".
VERBOSE: Performing operation "Remove-Module" on Target "Microsoft.BackgroundIntelligentTransfer.Management (Path: 'C:\Windows\
assembly\GAC_MSIL\Microsoft.BackgroundIntelligentTransfer.Management\1.0.0.0__31bf3856ad364e35\Microsoft.BackgroundIntelligentTransfe
r.Management.dll')".
VERBOSE: Performing operation "Remove-Module" on Target "psdiagnostics (Path: 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
psdiagnostics\psdiagnostics.psd1')".
VERBOSE: Removing imported function 'Start-Trace'.
VERBOSE: Removing imported function 'Stop-Trace'.
VERBOSE: Removing imported function 'Enable-WSManTrace'.
VERBOSE: Removing imported function 'Disable-WSManTrace'.
VERBOSE: Removing imported function 'Enable-PSWSManCombinedTrace'.
VERBOSE: Removing imported function 'Disable-PSWSManCombinedTrace'.
VERBOSE: Removing imported function 'Set-LogProperties'.
VERBOSE: Removing imported function 'Get-LogProperties'.
VERBOSE: Removing imported function 'Enable-PSTrace'.
VERBOSE: Removing imported function 'Disable-PSTrace'.
VERBOSE: Performing operation "Remove-Module" on Target "PSDiagnostics (Path: 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
psdiagnostics\PSDiagnostics.psm1')".

# Description
-----------
This command removes the FileTransfer and PSDiagnostics modules from the current session.

The command uses a pipeline operator (|) to send the module names to Remove-Module. It uses the Verbose common parameter to get detailed information about the members that are removed.

The Verbose messages show the items that are removed. The messages differ because the BitsTransfer module includes an assembly that implements its cmdlets and a nested module with its own assembly. The PSDiagnostics module includes a module script file (.psm1) that exports functions.

# EXAMPLE 4

C:\PS>$a = get-module BitsTransfer

C:\PS> remove-module -moduleInfo $a

# Description
-----------
This command uses the ModuleInfo parameter to remove the BitsTransfer module.

RELATED LINKS
Online version: http://go.microsoft.com/fwlink/?LinkID=141556
Get-Module
Import-Module
about_modules

C:\Windows>powershell get-help New-ModuleManifest -full

ColorConsole [Version 1.7.1000] PowerShell 2.0-Export
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2014 Microsoft Corporation.

OS: Windows 10, 8.1, 8, 7, Vista / Windows Server 2016, 2012, 2008
»»»» ColorConsole









... Windows-10




Windows 10 How To

... Windows 10 FAQ
... Windows 10 How To




PowerShell: Removes modules from the current session.

HTTP: ... PS_Windows/en/Remove-Module.htm
0.296
10984

Single click to execute or open a file!

 /

Ist es möglich, nur zwei Ordner und nicht 4 Explorer für Windows zu öffnen?

 /

Alle Schriftarten ohne Installation für andere Windows Programme registrieren?

 /

How can i change the colour of the header bar of the active window?

 /

Harry Potter magic wand for the Windows desktop!

 /

Can I position the desktop clock on the desktop freely?

 /

GetWindowText Error message?

 /

Windows Keyboard Shortcut to open DVD/CD plus command line!

 /

If you could remove the mouse focus of the magnifier?

 /

Change your Account Picture in Windows-7 or Browse for new Account Image!

 /

How can I set the order of the individual PDF pages?

 /

On Windows 8.1 or 10, open files with desktop programs and not with APPs!

 /