これは私が取り組んでいるスクリプトの始まりです:
#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 には関数が 1 つだけ含まれており、それはWrite-Log
.