Powershell导出函数详细消息

Powershell导出函数详细消息,powershell,scripting,verbose,Powershell,Scripting,Verbose,这是我正在编写的脚本的开始: #Requires –Version 4.0 $DebugPreference = 'SilentlyContinue' $VerbosePreference = 'SilentlyContinue' Import-Module UMF #region Synchronized Collections $FormHash = [hashtable]::Synchronized(@{}) $RunspaceHash = [hashtable]::Synchro

这是我正在编写的脚本的开始:

#Requires –Version 4.0

$DebugPreference = 'SilentlyContinue'
$VerbosePreference = 'SilentlyContinue'

Import-Module UMF

#region Synchronized Collections

$FormHash = [hashtable]::Synchronized(@{})
$RunspaceHash = [hashtable]::Synchronized(@{})
$Jobs = [system.collections.arraylist]::Synchronized((New-Object System.Collections.ArrayList))
$JobCleanup = [hashtable]::Synchronized(@{})

#endregion

#region Pre-Startup Checks

$DebugPreference = 'Continue'
$VerbosePreference = 'Continue'
Write-Log Verbose Info 'Pre-startup checks started...'
当我启动时,我在控制台中得到:

那么,当我显式地将VerbosePreference设置为SilentlyContinue时,为什么它会显示这个“导出函数”详细消息呢


模块UMF只包含一个功能,即
写入日志

我不知道怎么做,但似乎我不再看到这些导出日志了,尽管我仍然在使用“Import Module UMF”,但在设置$VerbosePreference以继续时,我也看到了这种行为,但仅当我通过powershell.exe-F“script.ps1”参数启动这样的脚本时。当我手动或在PowerShell ISE中启动它时,不会出现带有导出功能等的详细消息。我不确定如何启动,但似乎我不再看到这些导出日志,尽管我仍在使用“导入模块UMF”,但在设置$VerbosePreference以继续时,我也会看到这种行为,但仅当我通过PowerShell.exe-F启动此类脚本时“Script.ps1”参数。当我手动或在PowerShell ISE中启动它时,没有带有导出功能等的详细消息。
VERBOSE: Exporting function 'Get-FileHash'.
VERBOSE: Exporting function 'New-TemporaryFile'.
VERBOSE: Exporting function 'New-Guid'.
VERBOSE: Exporting function 'Format-Hex'.
VERBOSE: Exporting alias 'fhx'.
VERBOSE: Exporting function 'Import-PowerShellDataFile'.
VERBOSE: Exporting function 'ConvertFrom-SddlString'
VERBOSE: 2015-12-19 17:44:18,227: Info: Pre-startup checks started...