这是我正在处理的脚本的开始:
#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...'
当我开始这个时,我在控制台中得到了这个:
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...
那么为什么在我明确地将VerbosePreference设置为SilentlyContinue时它会显示这个'导出函数'详细消息?
模块UMF只包含一个功能,即Write-Log
。