powershell PackageManagement模块加载显示在高级函数的详细输出中

ktecyv1j  于 2023-04-06  发布在  Shell
关注(0)|答案(1)|浏览(116)

我创建了一个具有高级功能的PowerShell模块。当我在详细模式下调用此函数时,PackageManagement模块加载详细输出也会在开始时显示。有没有一种方法可以抑制它并限制为仅来自函数的详细输出,我已经创建了。

VERBOSE: Loading module from path 'C:\Program
Files\WindowsPowerShell\Modules\PackageManagement\1.0.0.1\PackageManagement.psd1'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Program
Files\WindowsPowerShell\Modules\PackageManagement\1.0.0.1\PackageManagement.format.ps1xml'.
VERBOSE: Loading module from path 'C:\Program
Files\WindowsPowerShell\Modules\PackageManagement\1.0.0.1\Microsoft.PowerShell.PackageManagement.dll'.
VERBOSE: Exporting cmdlet 'Find-Package'.
VERBOSE: Exporting cmdlet 'Get-Package'.
VERBOSE: Exporting cmdlet 'Get-PackageProvider'.
VERBOSE: Exporting cmdlet 'Get-PackageSource'.
VERBOSE: Exporting cmdlet 'Install-Package'.
VERBOSE: Exporting cmdlet 'Import-PackageProvider'.
VERBOSE: Exporting cmdlet 'Find-PackageProvider'.
VERBOSE: Exporting cmdlet 'Install-PackageProvider'.
VERBOSE: Exporting cmdlet 'Register-PackageSource'.
VERBOSE: Exporting cmdlet 'Save-Package'.
VERBOSE: Exporting cmdlet 'Set-PackageSource'.
VERBOSE: Exporting cmdlet 'Uninstall-Package'.
VERBOSE: Exporting cmdlet 'Unregister-PackageSource'.
VERBOSE: Importing cmdlet 'Find-Package'.
VERBOSE: Importing cmdlet 'Find-PackageProvider'.
VERBOSE: Importing cmdlet 'Get-Package'.
VERBOSE: Importing cmdlet 'Get-PackageProvider'.
VERBOSE: Importing cmdlet 'Get-PackageSource'.
VERBOSE: Importing cmdlet 'Import-PackageProvider'.
VERBOSE: Importing cmdlet 'Install-Package'.
VERBOSE: Importing cmdlet 'Install-PackageProvider'.
VERBOSE: Importing cmdlet 'Register-PackageSource'.
VERBOSE: Importing cmdlet 'Save-Package'.
VERBOSE: Importing cmdlet 'Set-PackageSource'.
VERBOSE: Importing cmdlet 'Uninstall-Package'.
VERBOSE: Importing cmdlet 'Unregister-PackageSource'.
hkmswyz6

hkmswyz61#

正如@ guiwhatstthat所说,您必须将-Verbose:$false参数附加到Import-Module调用中:

Import-Module -Name ModuleName -Verbose:$false

相关问题