{
	"id": "4668e040-741b-4c51-b403-3fa51ad575bf",
	"created_at": "2026-04-06T01:31:40.538285Z",
	"updated_at": "2026-04-10T03:21:51.850823Z",
	"deleted_at": null,
	"sha1_hash": "ab7630db0906f41f073c4d354e0c9d5c4e96aa56",
	"title": "about_Preference_Variables - PowerShell",
	"llm_title": "",
	"authors": "",
	"file_creation_date": "0001-01-01T00:00:00Z",
	"file_modification_date": "0001-01-01T00:00:00Z",
	"file_size": 362633,
	"plain_text": "about_Preference_Variables - PowerShell\r\nBy sdwheeler\r\nArchived: 2026-04-06 00:17:45 UTC\r\nVariables that customize the behavior of PowerShell.\r\nPowerShell includes a set of variables that enable you to customize its behavior. These preference variables work like the\r\noptions in GUI-based systems.\r\nThe preference variables affect the PowerShell operating environment and all commands run in the environment. Some\r\ncmdlets have parameters that allow you to override the preference behavior for a specific command.\r\nThe following table lists the preference variables and their default values.\r\nVariable Default Value\r\n$ConfirmPreference High\r\n$DebugPreference SilentlyContinue\r\n$ErrorActionPreference Continue\r\n$ErrorView ConciseView\r\n$FormatEnumerationLimit 4\r\n$InformationPreference SilentlyContinue\r\n$LogCommandHealthEvent $false (not logged)\r\n$LogCommandLifecycleEvent $false (not logged)\r\n$LogEngineHealthEvent $true (logged)\r\n$LogEngineLifecycleEvent $true (logged)\r\n$LogProviderHealthEvent $true (logged)\r\n$LogProviderLifecycleEvent $true (logged)\r\n$MaximumHistoryCount 4096\r\n$OFS Space character ( \" \" )\r\n$OutputEncoding UTF8Encoding object\r\n$ProgressPreference Continue\r\n$PSDefaultParameterValues @{} (empty hash table)\r\n$PSEmailServer $null (none)\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 1 of 27\n\nVariable Default Value\r\n$PSModuleAutoLoadingPreference All\r\n$PSNativeCommandArgumentPassing Windows on Windows, Standard on Non-Windows\r\n$PSNativeCommandUseErrorActionPreference $false\r\n$PSSessionApplicationName 'wsman'\r\n$PSSessionConfigurationName 'http://schemas.microsoft.com/powershell/Microsoft.PowerShell'\r\n$PSSessionOption PSSessionOption object\r\n$PSStyle PSStyle object\r\n$Transcript $null (none)\r\n$VerbosePreference SilentlyContinue\r\n$WarningPreference Continue\r\n$WhatIfPreference $false\r\nPowerShell includes the following environment variables that store user preferences. For more information about these\r\nenvironment variables, see about_Environment_Variables.\r\n$Env:PSExecutionPolicyPreference\r\n$Env:PSModulePath\r\nNote\r\nChanges to preference variables apply only in the scope they are made and any child scopes thereof. For example, you can\r\nlimit the effects of changing a preference variable to a single function or script. For more information, see about_Scopes.\r\nThis document describes each of the preference variables.\r\nTo display the current value of a specific preference variable, type the variable's name. For example, the following\r\ncommand displays the $ConfirmPreference variable's value.\r\n $ConfirmPreference\r\nHigh\r\nTo change a variable's value, use an assignment statement. For example, the following statement changes the\r\n$ConfirmPreference parameter's value to Medium.\r\n$ConfirmPreference = \"Medium\"\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 2 of 27\n\nThe values that you set are specific to the current PowerShell session. To make variables effective in all PowerShell\r\nsessions, add them to your PowerShell profile. For more information, see about_Profiles.\r\nWhen you run commands on a remote computer, the remote commands are only subject to the preferences set in the\r\nremote computer's PowerShell client. For example, when you run a remote command, the value of the remote computer's\r\n$DebugPreference variable determines how PowerShell responds to debugging messages.\r\nFor more information about remote commands, see about_Remote.\r\nDetermines whether PowerShell automatically prompts you for confirmation before running a cmdlet or function.\r\nThe $ConfirmPreference variable takes one of the ConfirmImpact enumeration values: High, Medium, Low, or None.\r\nCmdlets and functions are assigned a risk of High, Medium, or Low. When the value of the $ConfirmPreference\r\nvariable is less than or equal to the risk assigned to a cmdlet or function, PowerShell automatically prompts you for\r\nconfirmation before running the cmdlet or function. For more information about assigning a risk to cmdlets or functions,\r\nsee about_Functions_CmdletBindingAttribute.\r\nIf the value of the $ConfirmPreference variable is None, PowerShell never automatically prompts you before running a\r\ncmdlet or function.\r\nTo change the confirming behavior for all cmdlets and functions in the session, change $ConfirmPreference variable's\r\nvalue.\r\nTo override the $ConfirmPreference for a single command, use a cmdlet's or function's Confirm parameter. To request\r\nconfirmation, use -Confirm . To suppress confirmation, use -Confirm:$false .\r\nValid values of $ConfirmPreference :\r\nNone: PowerShell doesn't prompt automatically. To request confirmation of a particular command, use the\r\nConfirm parameter of the cmdlet or function.\r\nLow: PowerShell prompts for confirmation before running cmdlets or functions with a low, medium, or high risk.\r\nMedium: PowerShell prompts for confirmation before running cmdlets or functions with a medium, or high risk.\r\nHigh: PowerShell prompts for confirmation before running cmdlets or functions with a high risk.\r\nPowerShell can automatically prompt you for confirmation before doing an action. For example, when cmdlet or function\r\nsignificantly affects the system to delete data or use a significant amount of system resources.\r\nRemove-Item -Path C:\\file.txt\r\nConfirm\r\nAre you sure you want to perform this action?\r\nPerforming operation \"Remove File\" on Target \"C:\\file.txt\".\r\n[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is \"Y\"):\r\nThe estimate of the risk is an attribute of the cmdlet or function known as its ConfirmImpact. Users can't change it.\r\nCmdlets and functions that might pose a risk to the system have a Confirm parameter that you can use to request or\r\nsuppress confirmation for a single command.\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 3 of 27\n\nMost cmdlets and functions keep the default value of Medium for ConfirmImpact. $ConfirmPreference is set to High\r\nby default. Therefore, it's rare that commands automatically prompt for confirmation when users don't specify the\r\nConfirm parameter. To extend automatic confirmation prompting to more cmdlets and functions, set the value of\r\n$ConfirmPreference to Medium or Low.\r\nThis example shows the effect of the $ConfirmPreference variable's default value, High. The High value only confirms\r\nhigh-risk cmdlets and functions. Since most cmdlets and functions are medium risk, they aren't automatically confirmed\r\nand Remove-Item deletes the file. Adding -Confirm to the command prompts the user for confirmation.\r\n$ConfirmPreference\r\nHigh\r\nRemove-Item -Path C:\\temp1.txt\r\nUse -Confirm to request confirmation.\r\nRemove-Item -Path C:\\temp2.txt -Confirm\r\nConfirm\r\nAre you sure you want to perform this action?\r\nPerforming operation \"Remove File\" on Target \"C:\\temp2.txt\".\r\n[Y] Yes [A] Yes to All [N] No [L] No to All\r\n[?] Help (default is \"Y\"):\r\nThe following example shows the effect of changing the value of $ConfirmPreference to Medium. Because most\r\ncmdlets and function are medium risk, they're automatically confirmed. To suppress the confirmation prompt for a single\r\ncommand, use the Confirm parameter with a value of $false .\r\n$ConfirmPreference = \"Medium\"\r\nRemove-Item -Path C:\\temp2.txt\r\nConfirm\r\nAre you sure you want to perform this action?\r\nPerforming operation \"Remove File\" on Target \"C:\\temp2.txt\".\r\n[Y] Yes [A] Yes to All [N] No [L] No to All\r\n[?] Help (default is \"Y\"):\r\nRemove-Item -Path C:\\temp3.txt -Confirm:$false\r\nDetermines how PowerShell responds to debugging messages generated by a script, cmdlet or provider, or by a Write-Debug command at the command line.\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 4 of 27\n\nThe $DebugPreference variable takes one of the ActionPreference enumeration values: SilentlyContinue, Stop,\r\nContinue, Inquire, Ignore, Suspend, or Break.\r\nSome cmdlets display debugging messages, which are typically technical messages designed for programmers and\r\ntechnical support professionals. By default, debugging messages aren't displayed, but you can display debugging messages\r\nby changing the value of $DebugPreference .\r\nYou can use the Debug common parameter of a cmdlet to display or hide the debugging messages for a specific command.\r\nFor more information, see about_CommonParameters.\r\nThe valid values are as follows:\r\nBreak - Enter the debugger when an error occurs or when an exception is raised.\r\nStop: Displays the debug message and stops executing. Writes an error to the console.\r\nInquire: Displays the debug message and asks you whether you want to continue.\r\nContinue: Displays the debug message and continues with execution.\r\nSilentlyContinue: (Default) No effect. The debug message isn't displayed and execution continues without\r\ninterruption.\r\nAdding the Debug common parameter to a command, when the command is configured to generate a debugging message,\r\nchanges the value of the $DebugPreference variable to Continue.\r\nThe following examples show the effect of changing the values of $DebugPreference when a Write-Debug command is\r\nentered at the command line. The change affects all debugging messages, including messages generated by cmdlets and\r\nscripts. The examples show the Debug parameter, which displays or hides the debugging messages related to a single\r\ncommand.\r\nThis example shows the effect of the $DebugPreference variable's default value, SilentlyContinue. By default, the\r\nWrite-Debug cmdlet's debug message isn't displayed and processing continues. When the Debug parameter is used, it\r\noverrides the preference for a single command. The debug message is displayed.\r\n$DebugPreference\r\nSilentlyContinue\r\nWrite-Debug -Message \"Hello, World\"\r\nWrite-Debug -Message \"Hello, World\" -Debug\r\nDEBUG: Hello, World\r\nThis example shows the effect of $DebugPreference with the Continue value. The debug message is displayed and the\r\ncommand continues to process.\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 5 of 27\n\n$DebugPreference = \"Continue\"\r\nWrite-Debug -Message \"Hello, World\"\r\nDEBUG: Hello, World\r\nThis example uses the Debug parameter with a value of $false to suppress the message for a single command. The\r\ndebug message isn't displayed.\r\nWrite-Debug -Message \"Hello, World\" -Debug:$false\r\nThis example shows the effect of $DebugPreference being set to the Stop value. The debug message is displayed and the\r\ncommand is stopped.\r\n$DebugPreference = \"Stop\"\r\nWrite-Debug -Message \"Hello, World\"\r\nDEBUG: Hello, World\r\nWrite-Debug : The running command stopped because the preference variable\r\n \"DebugPreference\" or common parameter is set to Stop: Hello, World\r\nAt line:1 char:1\r\n+ Write-Debug -Message \"Hello, World\"\r\nThis example uses the Debug parameter with a value of $false to suppress the message for a single command. The\r\ndebug message isn't displayed and processing isn't stopped.\r\nWrite-Debug -Message \"Hello, World\" -Debug:$false\r\nThis example shows the effect of $DebugPreference being set to the Inquire value. The debug message is displayed and\r\nthe user is prompted for confirmation.\r\n$DebugPreference = \"Inquire\"\r\nWrite-Debug -Message \"Hello, World\"\r\nDEBUG: Hello, World\r\nConfirm\r\nContinue with this operation?\r\n[Y] Yes [A] Yes to All [H] Halt Command [?] Help (default is \"Y\"):\r\nThis example uses the Debug parameter with a value of $false to suppress the message for a single command. The\r\ndebug message isn't displayed and processing continues.\r\nWrite-Debug -Message \"Hello, World\" -Debug:$false\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 6 of 27\n\nDetermines how PowerShell responds to a non-terminating error, an error that doesn't stop the cmdlet processing. For\r\nexample, at the command line or in a script, cmdlet, or provider, such as the errors generated by the Write-Error cmdlet.\r\nThe $ErrorActionPreference variable takes one of the ActionPreference enumeration values: SilentlyContinue,\r\nStop, Continue, Inquire, Ignore, Suspend, or Break.\r\nYou can use a cmdlet's ErrorAction common parameter to override the preference for a specific command.\r\nThe valid values are as follows:\r\nBreak - Enter the debugger when an error occurs or when an exception is raised.\r\nContinue: (Default) Displays the error message and continues executing.\r\nIgnore: Suppresses the error message and continues to execute the command. Unlike SilentlyContinue, Ignore\r\ndoesn't add the error message to the $Error automatic variable. The Ignore value is also valid for\r\n$ErrorActionPreference , where it suppresses both non-terminating and statement-terminating errors. However,\r\nIgnore only prevents $Error recording for non-terminating errors. Terminating errors that are suppressed by\r\nIgnore are still recorded in $Error .\r\nInquire: Displays the error message and asks you whether you want to continue.\r\nSilentlyContinue: No effect. The error message isn't displayed and execution continues without interruption.\r\nStop: Displays the error message and stops executing. In addition to the error generated, the Stop value generates\r\nan ActionPreferenceStopException object to the error stream.\r\nSuspend: Automatically suspends a workflow job to allow for further investigation. After investigation, the\r\nworkflow can be resumed. The Suspend value is intended for per-command use, not for use as saved preference.\r\nSuspend isn't a valid value for the $ErrorActionPreference variable.\r\n$ErrorActionPreference applies to both non-terminating and statement-terminating errors. Unlike the -ErrorAction\r\nparameter (which only affects non-terminating errors), the preference variable can also suppress or escalate errors\r\ngenerated by $PSCmdlet.ThrowTerminatingError() . When set to Stop, it escalates non-terminating errors to script-terminating errors. For more information about error categories, see about_Error_Handling. For more information about\r\nthe ErrorAction common parameter, see about_CommonParameters.\r\nMany native commands write to stderr as an alternative stream for additional information. This behavior can cause\r\nconfusion when looking through errors or the additional output information can be lost to the user if\r\n$ErrorActionPreference is set to a state that mutes the output.\r\nBeginning in PowerShell 7.2, error records redirected from native commands, like when using redirection operators\r\n( 2\u003e\u00261 ), aren't written to the $Error variable and the preference variable $ErrorActionPreference doesn't affect the\r\nredirected output.\r\nPowerShell 7.4 added a feature that allows you to control how messages written to stderr are handled. For more\r\ninformation, see $PSNativeCommandUseErrorActionPreference.\r\nThese examples show the effect of the different values of the $ErrorActionPreference variable. The ErrorAction\r\nparameter is used to override the $ErrorActionPreference value.\r\nThis example shows the $ErrorActionPreference default value, Continue. A non-terminating error is generated. The\r\nmessage is displayed and processing continues.\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 7 of 27\n\n# Change the ErrorActionPreference to 'Continue'\r\n$ErrorActionPreference = 'Continue'\r\n# Generate a non-terminating error and continue processing the script.\r\nWrite-Error -Message 'Test Error' ; Write-Host 'Hello World'\r\nWrite-Error: Test Error\r\nHello World\r\nThis example shows the $ErrorActionPreference default value, Inquire. An error is generated and a prompt for action\r\nis shown.\r\n# Change the ErrorActionPreference to 'Inquire'\r\n$ErrorActionPreference = 'Inquire'\r\nWrite-Error -Message 'Test Error' ; Write-Host 'Hello World'\r\nConfirm\r\nTest Error\r\n[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is \"Y\"):\r\nThis example shows the $ErrorActionPreference set to SilentlyContinue. The error message is suppressed.\r\n# Change the ErrorActionPreference to 'SilentlyContinue'\r\n$ErrorActionPreference = 'SilentlyContinue'\r\n# Generate an error message\r\nWrite-Error -Message 'Test Error' ; Write-Host 'Hello World'\r\n# Error message is suppressed and script continues processing\r\nHello World\r\nThis example shows the $ErrorActionPreference set to Stop. It also shows the extra object generated to the $Error\r\nvariable.\r\n# Change the ErrorActionPreference to 'Stop'\r\n$ErrorActionPreference = 'Stop'\r\n# Error message is generated and script stops processing\r\nWrite-Error -Message 'Test Error' ; Write-Host 'Hello World'\r\n# Show the ActionPreferenceStopException and the error generated\r\n$Error[0]\r\n$Error[1]\r\nWrite-Error: Test Error\r\nErrorRecord : Test Error\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 8 of 27\n\nWasThrownFromThrowStatement : False\r\nTargetSite : System.Collections.ObjectModel.Collection`1[System.Management.Automation.PSObject]\r\n Invoke(System.Collections.IEnumerable)\r\nStackTrace : at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)\r\n at Microsoft.PowerShell.Executor.ExecuteCommandHelper(Pipeline tempPipeline,\r\n Exception\u0026 exceptionThrown, ExecutionOptions options)\r\nMessage : The running command stopped because the preference variable \"ErrorActionPreference\" or\r\n common parameter is set to Stop: Test Error\r\nData : {System.Management.Automation.Interpreter.InterpretedFrameInfo}\r\nInnerException :\r\nHelpLink :\r\nSource : System.Management.Automation\r\nHResult : -2146233087\r\nWrite-Error: Test Error\r\nDetermines the display format of error messages in PowerShell.\r\nThe $ErrorView variable takes one of the ErrorView enumeration values: NormalView, CategoryView, or\r\nConciseView.\r\nThe valid values are as follows:\r\nConciseView: (Default) Provides a concise error message and a refactored view for advanced module builders. As\r\nof PowerShell 7.2, if the error is from the command line or a script module the output is a single line error message.\r\nOtherwise, you receive a multiline error message that contains the error and a pointer to the error showing where it\r\noccurs in that line. If the terminal supports Virtual Terminal, then ANSI color codes are used to provide color\r\naccent. The Accent color can be changed at $Host.PrivateData.ErrorAccentColor . Use Get-Error cmdlet for a\r\ncomprehensive detailed view of the fully qualified error, including inner exceptions.\r\nConciseView was added in PowerShell 7.\r\nNormalView: A detailed view designed for most users. Consists of a description of the error and the name of the\r\nobject involved in the error.\r\nCategoryView: A succinct, structured view designed for production environments. The format is as follows:\r\n{Category}: ({TargetName}:{TargetType}):[{Activity}], {Reason}\r\nFor more information about the fields in CategoryView, see ErrorCategoryInfo class.\r\nThis example shows how an error appears when the value of $ErrorView is the default, ConciseView. Get-ChildItem\r\nis used to find a non-existent directory.\r\nGet-ChildItem -Path 'C:\\NoRealDirectory'\r\nGet-ChildItem: Can't find path 'C:\\NoRealDirectory' because it doesn't exist.\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 9 of 27\n\nThis example shows how an error appears when the value of $ErrorView is the default, ConciseView. Script.ps1 is\r\nrun and throws an error from Get-Item statement.\r\n./Script.ps1\r\nGet-Item: C:\\Script.ps1\r\nLine |\r\n 11 | Get-Item -Path .\\stuff\r\n | ^ Can't find path 'C:\\demo\\stuff' because it doesn't exist.\r\nThis example shows how an error appears when the value of $ErrorView is changed to NormalView. Get-ChildItem is\r\nused to find a non-existent file.\r\nGet-ChildItem -Path C:\\nofile.txt\r\nGet-ChildItem : Can't find path 'C:\\nofile.txt' because it doesn't exist.\r\nAt line:1 char:1\r\n+ Get-ChildItem -Path C:\\nofile.txt\r\nThis example shows how the same error appears when the value of $ErrorView is changed to CategoryView.\r\n$ErrorView = \"CategoryView\"\r\nGet-ChildItem -Path C:\\nofile.txt\r\nObjectNotFound: (C:\\nofile.txt:String) [Get-ChildItem], ItemNotFoundException\r\nThis example demonstrates that the value of $ErrorView only affects the error display. It doesn't change the structure of\r\nthe error object that's stored in the $Error automatic variable. For information about the $Error automatic variable, see\r\nabout_Automatic_Variables.\r\nThe following command takes the ErrorRecord object associated with the most recent error in the error array, element 0,\r\nand formats the properties of object in a list.\r\n$Error[0] | Format-List -Property * -Force\r\nPSMessageDetails :\r\nException : System.Management.Automation.ItemNotFoundException:\r\n Cannot find path 'C:\\nofile.txt' because it does\r\n not exist.\r\n at System.Management.Automation.SessionStateInternal.\r\n GetChildItems(String path, Boolean recurse, UInt32\r\n depth, CmdletProviderContext context)\r\n at System.Management.Automation.ChildItemCmdlet\r\n ProviderIntrinsics.Get(String path, Boolean\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 10 of 27\n\nrecurse, UInt32 depth, CmdletProviderContext context)\r\n at Microsoft.PowerShell.Commands.GetChildItemCommand.\r\n ProcessRecord()\r\nTargetObject : C:\\nofile.txt\r\nCategoryInfo : ObjectNotFound: (C:\\nofile.txt:String) [Get-ChildItem],\r\n ItemNotFoundException\r\nFullyQualifiedErrorId : PathNotFound,\r\n Microsoft.PowerShell.Commands.GetChildItemCommand\r\nErrorDetails :\r\nInvocationInfo : System.Management.Automation.InvocationInfo\r\nScriptStackTrace : at \u003cScriptBlock\u003e, \u003cNo file\u003e: line 1\r\nPipelineIterationInfo : {0, 1}\r\nDetermines how many enumerated items are included in a display. This variable doesn't affect the underlying objects, only\r\nthe display. When the value of $FormatEnumerationLimit is fewer than the number of enumerated items, PowerShell\r\nadds an ellipsis ( ... ) to indicate items not shown.\r\nValid values: Integers ( Int32 )\r\nDefault value: 4\r\nThis example shows how to use the $FormatEnumerationLimit variable to improve the display of enumerated items.\r\nThe command in this example generates a table that lists all the services running on the computer in two groups: one for\r\nrunning services and one for stopped services. It uses a Get-Service command to get all the services, and then sends\r\nthe results through the pipeline to the Group-Object cmdlet, which groups the results by the service status.\r\nThe result is a table that lists the status in the Name column, and the processes in the Group column. To change the\r\ncolumn labels, use a hash table, see about_Hash_Tables. For more information, see the examples in Format-Table.\r\nFind the current value of $FormatEnumerationLimit .\r\n$FormatEnumerationLimit\r\n4\r\nList all services grouped by Status. There are a maximum of four services listed in the Group column for each status\r\nbecause $FormatEnumerationLimit has a value of 4.\r\nGet-Service | Group-Object -Property Status\r\nCount Name Group\r\n----- ---- -----\r\n60 Running {AdtAgent, ALG, Ati HotKey Poller, AudioSrv...}\r\n41 Stopped {Alerter, AppMgmt, aspnet_state, ATI Smart...}\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 11 of 27\n\nTo increase the number of items listed, increase the value of $FormatEnumerationLimit to 1000. Use Get-Service and\r\nGroup-Object to display the services.\r\n$FormatEnumerationLimit = 1000\r\nGet-Service | Group-Object -Property Status\r\nCount Name Group\r\n----- ---- -----\r\n60 Running {AdtAgent, ALG, Ati HotKey Poller, AudioSrv, BITS, CcmExec...\r\n41 Stopped {Alerter, AppMgmt, aspnet_state, ATI Smart, Browser, CiSvc...\r\nUse Format-Table with the Wrap parameter to display the list of services.\r\nGet-Service | Group-Object -Property Status | Format-Table -Wrap\r\nCount Name Group\r\n----- ---- -----\r\n60 Running {AdtAgent, ALG, Ati HotKey Poller, AudioSrv, BITS, CcmExec,\r\n Client for NFS, CryptSvc, DcomLaunch, Dhcp, dmserver,\r\n Dnscache, ERSvc, Eventlog, EventSystem, FwcAgent, helpsvc,\r\n HidServ, IISADMIN, InoRPC, InoRT, InoTask, lanmanserver,\r\n lanmanworkstation, LmHosts, MDM, Netlogon, Netman, Nla,\r\n NtLmSsp, PlugPlay, PolicyAgent, ProtectedStorage, RasMan,\r\n RemoteRegistry, RpcSs, SamSs, Schedule, seclogon, SENS,\r\n SharedAccess, ShellHWDetection, SMT PSVC, Spooler,\r\n srservice, SSDPSRV, stisvc, TapiSrv, TermService, Themes,\r\n TrkWks, UMWdf, W32Time, W3SVC, WebClient, winmgmt, wscsvc,\r\n wuauserv, WZCSVC, zzInterix}\r\n41 Stopped {Alerter, AppMgmt, aspnet_state, ATI Smart, Browser, CiSvc,\r\n ClipSrv, clr_optimization_v2.0.50727_32, COMSysApp,\r\n CronService, dmadmin, FastUserSwitchingCompatibility,\r\n HTTPFilter, ImapiService, Mapsvc, Messenger, mnmsrvc,\r\n MSDTC, MSIServer, msvsmon80, NetDDE, NetDDEdsdm, NtmsSvc,\r\n NVSvc, ose, RasAuto, RDSessMgr, RemoteAccess, RpcLocator,\r\n SCardSvr, SwPrv, SysmonLog, TlntSvr, upnphost, UPS, VSS,\r\n WmdmPmSN, Wmi, WmiApSrv, xmlprov}\r\nThe $InformationPreference variable lets you set information stream preferences that you want displayed to users.\r\nSpecifically, informational messages that you added to commands or scripts by adding the Write-Information cmdlet. If\r\nthe InformationAction parameter is used, its value overrides the value of the $InformationPreference variable. Write-Information was introduced in PowerShell 5.0.\r\nThe $InformationPreference variable takes one of the ActionPreference enumeration values: SilentlyContinue,\r\nStop, Continue, Inquire, Ignore, Suspend, or Break.\r\nThe valid values are as follows:\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 12 of 27\n\nBreak - Enter the debugger when you write to the Information stream.\r\nStop: Stops a command or script at an occurrence of the Write-Information command.\r\nInquire: Displays the informational message that you specify in a Write-Information command, then asks\r\nwhether you want to continue.\r\nContinue: Displays the informational message, and continues running.\r\nSilentlyContinue: (Default) No effect. The informational messages aren't displayed, and the script continues\r\nwithout interruption.\r\nThe Log*Event preference variables determine which types of events are written to the PowerShell event log in Event\r\nViewer. By default, only engine and provider events are logged. But, you can use the Log*Event preference variables to\r\ncustomize your log, such as logging events about commands.\r\nThe Log*Event preference variables are as follows:\r\n$LogCommandHealthEvent : Logs errors and exceptions in command initialization and processing. The default is\r\n$false (not logged).\r\n$LogCommandLifecycleEvent : Logs the starting and stopping of commands and command pipelines and security\r\nexceptions in command discovery. The default is $false (not logged).\r\n$LogEngineHealthEvent : Logs errors and failures of sessions. The default is $true (logged).\r\n$LogEngineLifecycleEvent : Logs the opening and closing of sessions. The default is $true (logged).\r\n$LogProviderHealthEvent : Logs provider errors, such as read and write errors, lookup errors, and invocation\r\nerrors. The default is $true (logged).\r\n$LogProviderLifecycleEvent : Logs adding and removing of PowerShell providers. The default is $true\r\n(logged). For information about PowerShell providers, see about_Providers.\r\nTo enable a Log*Event, type the variable with a value of $true , for example:\r\n$LogCommandLifecycleEvent = $true\r\nTo disable an event type, type the variable with a value of $false , for example:\r\n$LogCommandLifecycleEvent = $false\r\nThe events that you enable are effective only for the current PowerShell console. To apply the configuration to all\r\nconsoles, save the variable settings in your PowerShell profile. For more information, see about_Profiles.\r\nDetermines how many commands are saved in the command history for the current session.\r\nValid values: 1 - 32768 ( Int32 )\r\nDefault: 4096\r\nTo determine the number of commands current saved in the command history, type:\r\n(Get-History).Count\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 13 of 27\n\nTo see the commands saved in your session history, use the Get-History cmdlet. For more information, see\r\nabout_History.\r\nThe Output Field Separator (OFS) specifies the character that separates the elements of an array that's converted to a\r\nstring.\r\nValid values: Any string.\r\nDefault: Space\r\nBy default, the $OFS variable doesn't exist and the output file separator is a space, but you can add this variable and set it\r\nto any string. You can change the value of $OFS in your session, by typing $OFS=\"\u003cvalue\u003e\" .\r\nNote\r\nIf you're expecting the default value of a space ( \" \" ) in your script, module, or configuration output, be careful that the\r\n$OFS default value hasn't been changed elsewhere in your code.\r\nThis example shows that a space is used to separate the values when an array is converted to a string. In this case, an array\r\nof integers is stored in a variable and then the variable is cast as a string.\r\n$array = 1,2,3,4\r\n[string]$array\r\n1 2 3 4\r\nTo change the separator, add the $OFS variable by assigning a value to it. The variable must be named $OFS .\r\n$OFS = \"+\"\r\n[string]$array\r\n1+2+3+4\r\nTo restore the default behavior, you can assign a space ( \" \" ) to the value of $OFS or delete the variable. The following\r\ncommands delete the variable and then verify that the separator is a space.\r\nRemove-Variable OFS\r\n[string]$array\r\n1 2 3 4\r\nDetermines the character encoding method that PowerShell uses when piping data into native applications.\r\nNote\r\nIn the majority of scenarios, the value for $OutputEncoding should align to the value of [Console]::InputEncoding .\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 14 of 27\n\nThe valid values are as follows: Objects derived from an Encoding class, such as ASCIIEncoding, UTF7Encoding,\r\nUTF8Encoding, UTF32Encoding, and UnicodeEncoding.\r\nDefault: UTF8Encoding object.\r\nThe first command finds the value of $OutputEncoding . Because the value is an encoding object, display only its\r\nEncodingName property.\r\n$OutputEncoding.EncodingName\r\nThe remaining examples use the following PowerShell script saved as hexdump.ps1 to illustrate the behavior of\r\n$OutputEncoding .\r\n$inputStream = [Console]::OpenStandardInput()\r\ntry {\r\n $buffer = [byte[]]::new(1024)\r\n $read = $inputStream.Read($buffer, 0, $buffer.Length)\r\n Format-Hex -InputObject $buffer -Count $read\r\n} finally {\r\n $inputStream.Dispose()\r\n}\r\nThe following example shows how the string value café is encoded to bytes when piped into hexdump.ps1 created\r\nabove. It demonstrates that the string value is encoded using the UTF8Encoding scheme.\r\n'café' | pwsh -File ./hexdump.ps1\r\n Label: Byte[] (System.Byte[]) \u003c28873E25\u003e\r\n Offset Bytes Ascii\r\n 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F\r\n ------ ----------------------------------------------- -----\r\n0000000000000000 63 61 66 C3 A9 0D 0A cafÃ©��\r\nThe following example shows how the bytes change when changing the encoding to UnicodeEncoding.\r\n$OutputEncoding = [System.Text.Encoding]::Unicode\r\n'café' | pwsh -File ./hexdump.ps1\r\n Label: Byte[] (System.Byte[]) \u003c515A7DC3\u003e\r\n Offset Bytes Ascii\r\n 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F\r\n ------ ----------------------------------------------- -----\r\n0000000000000000 FF FE 63 00 61 00 66 00 E9 00 0D 00 0A 00 ÿþc a f é � �\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 15 of 27\n\nDetermines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress\r\nbars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's\r\nstatus.\r\nThe $ProgressPreference variable takes one of the ActionPreference enumeration values: SilentlyContinue, Stop,\r\nContinue, Inquire, Ignore, Suspend, or Break.\r\nThe valid values are as follows:\r\nBreak - Enter the debugger when you write to the Progress stream.\r\nStop: Doesn't display the progress bar. Instead, it displays an error message and stops executing.\r\nInquire: Doesn't display the progress bar. Prompts for permission to continue. If you reply with Y or A , it\r\ndisplays the progress bar.\r\nContinue: (Default) Displays the progress bar and continues with execution.\r\nSilentlyContinue: Executes the command, but doesn't display the progress bar.\r\nSpecifies default values for the parameters of cmdlets and advanced functions. The value of $PSDefaultParameterValues\r\nis a hash table where the key consists of the cmdlet name and parameter name separated by a colon ( : ). The value is a\r\ncustom default value that you specify.\r\n$PSDefaultParameterValues was introduced in PowerShell 3.0.\r\nFor more information about this preference variable, see about_Parameters_Default_Values.\r\nSpecifies the default email server that's used to send email messages. This preference variable is used by cmdlets that send\r\nemail, such as the Send-MailMessage cmdlet.\r\nEnables and disables automatic importing of modules in the session. The $PSModuleAutoLoadingPreference variable\r\ndoesn't exist by default. The default behavior when the variable isn't defined is the same as\r\n$PSModuleAutoLoadingPreference = 'All' .\r\nTo automatically import a module, get or use a command contained in the module.\r\nThe $PSModuleAutoLoadingPreference variable takes one of the PSModuleAutoLoadingPreference enumeration values:\r\nAll : Modules are imported automatically on first-use.\r\nModuleQualified : Modules are imported automatically only when a user uses the module-qualified name of a\r\ncommand in the module. For example, if the user types MyModule\\MyCommand , PowerShell imports the MyModule\r\nmodule.\r\nNone : Disables the automatic importing of modules. To import a module, use the Import-Module cmdlet.\r\nFor more information about automatic importing of modules, see about_Modules.\r\nPowerShell 7.3 changed the way it parses the command line for native commands. The new\r\n$PSNativeCommandArgumentPassing preference variable controls this behavior.\r\nCaution\r\nThe new behavior is a breaking change from the previous behavior. This may break scripts and automation that work\r\naround the various issues when invoking native applications.\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 16 of 27\n\nThe automatic variable $PSNativeCommandArgumentPassing allows you to select the behavior at runtime. The valid values\r\nare Legacy , Standard , and Windows . Legacy is the historic behavior.\r\nThe $PSNativeCommandArgumentPassing variable is defined by default but the value is platform specific.\r\nOn Windows, the preference is set to Windows .\r\nOn non-Windows platforms, the preference is set to Standard .\r\nIf you have removed the $PSNativeCommandArgumentPassing variable, PowerShell uses the Standard behavior.\r\nThe behavior of Windows and Standard mode are the same except, in Windows mode, PowerShell uses the Legacy\r\nbehavior of argument passing when you run the following files.\r\ncmd.exe\r\ncscript.exe\r\nfind.exe\r\nsqlcmd.exe\r\nwscript.exe\r\nFiles ending with:\r\n.bat\r\n.cmd\r\n.js\r\n.vbs\r\n.wsf\r\nIf the $PSNativeCommandArgumentPassing is set to either Legacy or Standard , the parser doesn't check for these files.\r\nFor examples of the new behavior, see about_Parsing.\r\nPowerShell 7.3 also added the ability to trace parameter binding for native commands. For more information, see Trace-Command.\r\nWhen $PSNativeCommandUseErrorActionPreference is $true , native commands with non-zero exit codes issue errors\r\naccording to $ErrorActionPreference .\r\nSome native commands, like robocopy use non-zero exit codes to represent information other than errors. In these cases,\r\nyou can temporarily disable the behavior and prevent non-zero exit codes from issuing errors.\r\n\u0026 {\r\n # Disable $PSNativeCommandUseErrorActionPreference for this scriptblock\r\n $PSNativeCommandUseErrorActionPreference = $false\r\n robocopy.exe D:\\reports\\operational \"\\\\reporting\\ops\" CY2022Q4.md\r\n if ($LASTEXITCODE -gt 8) {\r\n throw \"robocopy failed with exit code $LASTEXITCODE\"\r\n }\r\n}\r\nIn this example, the $PSNativeCommandUseErrorActionPreference variable is changed inside a scriptblock. The change is\r\nlocal to the scriptblock. When the scriptblock exits, the variable reverts to its previous value.\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 17 of 27\n\nSpecifies the default application name for a remote command that uses Web Services for Management (WS-Management)\r\ntechnology. For more information, see About Windows Remote Management.\r\nThe system default application name is WSMAN , but you can use this preference variable to change the default.\r\nThe application name is the last node in a connection URI. For example, the application name in the following sample\r\nURI is WSMAN .\r\nhttp://Server01:8080/WSMAN\r\nThe default application name is used when the remote command doesn't specify a connection URI or an application name.\r\nThe WinRM service uses the application name to select a listener to service the connection request. The parameter's value\r\nshould match the value of the URLPrefix property of a listener on the remote computer.\r\nTo override the system default and the value of this variable, and select a different application name for a particular\r\nsession, use the ConnectionURI or ApplicationName parameters of the New-PSSession, Enter-PSSession, or Invoke-Command cmdlets.\r\nThe $PSSessionApplicationName preference variable is set on the local computer, but it specifies a listener on the remote\r\ncomputer. If the application name that you specify doesn't exist on the remote computer, the command to establish the\r\nsession fails.\r\nSpecifies the default session configuration that's used to create new sessions in the current session.\r\nThis preference variable is set on the local computer, but it specifies a session configuration that's located on the remote\r\ncomputer.\r\nThe value of the $PSSessionConfigurationName variable is a fully qualified resource URI.\r\nThe default value http://schemas.microsoft.com/PowerShell/microsoft.PowerShell indicates the\r\nMicrosoft.PowerShell session configuration on the remote computer.\r\nIf you specify only a configuration name, the following schema URI is prepended:\r\nhttp://schemas.microsoft.com/PowerShell/\r\nYou can override the default and select a different session configuration for a particular session by using the\r\nConfigurationName parameter of the New-PSSession , Enter-PSSession , or Invoke-Command cmdlets.\r\nYou can change the value of this variable at any time. When you do, remember that the session configuration that you\r\nselect must exist on the remote computer. If it doesn't, the command to create a session that uses the session configuration\r\nfails.\r\nThis preference variable doesn't determine which local session configurations are used when remote users create a session\r\nthat connects to this computer. However, you can use the permissions for the local session configurations to determine\r\nwhich users may use them.\r\nEstablishes the default values for advanced user options in a remote session. These option preferences override the system\r\ndefault values for session options.\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 18 of 27\n\nThe $PSSessionOption variable contains a PSSessionOption object. For more information, see\r\nSystem.Management.Automation.Remoting.PSSessionOption. Each property of the object represents a session option. For\r\nexample, the NoCompression property turns of data compression during the session.\r\nBy default, the $PSSessionOption variable contains a PSSessionOption object with the default values for all options, as\r\nshown below.\r\nMaximumConnectionRedirectionCount : 5\r\nNoCompression : False\r\nNoMachineProfile : False\r\nProxyAccessType : None\r\nProxyAuthentication : Negotiate\r\nProxyCredential :\r\nSkipCACheck : False\r\nSkipCNCheck : False\r\nSkipRevocationCheck : False\r\nOperationTimeout : 00:03:00\r\nNoEncryption : False\r\nUseUTF16 : False\r\nIncludePortInSPN : False\r\nOutputBufferingMode : None\r\nCulture :\r\nUICulture :\r\nMaximumReceivedDataSizePerCommand :\r\nMaximumReceivedObjectSize : 209715200\r\nApplicationArguments :\r\nOpenTimeout : 00:03:00\r\nCancelTimeout : 00:01:00\r\nIdleTimeout : -00:00:00.0010000\r\nFor descriptions of these options and more information, see New-PSSessionOption. For more information about remote\r\ncommands and sessions, see about_Remote and about_PSSessions.\r\nTo change the value of the $PSSessionOption preference variable, use the New-PSSessionOption cmdlet to create a\r\nPSSessionOption object with the option values you prefer. Save the output in a variable called $PSSessionOption .\r\n$PSSessionOption = New-PSSessionOption -NoCompression\r\nTo use the $PSSessionOption preference variable in every PowerShell session, add a New-PSSessionOption command\r\nthat creates the $PSSessionOption variable to your PowerShell profile. For more information, see about_Profiles.\r\nYou can set custom options for a particular remote session. The options that you set take precedence over the system\r\ndefaults and the value of the $PSSessionOption preference variable.\r\nTo set custom session options, use the New-PSSessionOption cmdlet to create a PSSessionOption object. Then, use the\r\nPSSessionOption object as the value of the SessionOption parameter in cmdlets that create a session, such as New-PSSession , Enter-PSSession , and Invoke-Command .\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 19 of 27\n\nAs of PowerShell 7.2 you can now access the $PSStyle automatic variable to view and change the rendering of ANSI\r\nstring output. $PSStyle is an instance of the PSStyle class. The members of this class define strings containing ANSI\r\nescape sequences that control the rendering of text in the terminal.\r\nThe base members return strings of ANSI escape sequences mapped to their names. The values are settable to allow\r\ncustomization. The property names make it easier for you to create decorated strings using tab completion. For example:\r\n\"$($PSStyle.Background.BrightCyan)Power$($PSStyle.Underline)$($PSStyle.Bold)Shell$($PSStyle.Reset)\"\r\nThe Background and Foreground members also have a FromRgb() method to specify 24-bit color.\r\nFor more information about $PSStyle , see about_ANSI_Terminals.\r\nUsed by Start-Transcript to specify the name and location of the transcript file. If you don't specify a value for the\r\nPath parameter, Start-Transcript uses the path in the value of the $Transcript global variable. If you haven't created\r\nthis variable, Start-Transcript stores the transcripts in the following location using the default name:\r\nOn Windows: $HOME\\Documents\r\nOn Linux or macOS: $HOME\r\nThe default filename is: PowerShell_transcript.\u003ccomputername\u003e.\u003crandom\u003e.\u003ctimestamp\u003e.txt .\r\nDetermines how PowerShell responds to verbose messages generated by a script, cmdlet, or provider, such as the\r\nmessages generated by the Write-Verbose cmdlet. Verbose messages describe the actions performed to execute a\r\ncommand.\r\nBy default, verbose messages aren't displayed, but you can change this behavior by changing the value of\r\n$VerbosePreference .\r\nThe $VerbosePreference variable takes one of the ActionPreference enumeration values: SilentlyContinue, Stop,\r\nContinue, Inquire, Ignore, Suspend, or Break.\r\nThe valid values are as follows:\r\nBreak - Enter the debugger when you write to the Verbose stream.\r\nStop: Displays the verbose message and an error message and then stops executing.\r\nInquire: Displays the verbose message and then displays a prompt that asks you whether you want to continue.\r\nContinue: Displays the verbose message and then continues with execution.\r\nSilentlyContinue: (Default) Doesn't display the verbose message. Continues executing.\r\nYou can use the Verbose common parameter of a cmdlet to display or hide the verbose messages for a specific command.\r\nFor more information, see about_CommonParameters.\r\nThese examples show the effect of the different values of $VerbosePreference and the Verbose parameter to override\r\nthe preference value.\r\nThis example shows the effect of the SilentlyContinue value, that's the default. The command uses the Message\r\nparameter, but doesn't write a message to the PowerShell console.\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 20 of 27\n\nWrite-Verbose -Message \"Verbose message test.\"\r\nWhen the Verbose parameter is used, the message is written.\r\nWrite-Verbose -Message \"Verbose message test.\" -Verbose\r\nVERBOSE: Verbose message test.\r\nThis example shows the effect of the Continue value. The $VerbosePreference variable is set to Continue and the\r\nmessage is displayed.\r\n$VerbosePreference = \"Continue\"\r\nWrite-Verbose -Message \"Verbose message test.\"\r\nVERBOSE: Verbose message test.\r\nThis example uses the Verbose parameter with a value of $false that overrides the Continue value. The message isn't\r\ndisplayed.\r\nWrite-Verbose -Message \"Verbose message test.\" -Verbose:$false\r\nThis example shows the effect of the Stop value. The $VerbosePreference variable is set to Stop and the message is\r\ndisplayed. The command is stopped.\r\n$VerbosePreference = \"Stop\"\r\nWrite-Verbose -Message \"Verbose message test.\"\r\nVERBOSE: Verbose message test.\r\nWrite-Verbose : The running command stopped because the preference variable\r\n \"VerbosePreference\" or common parameter is set to Stop: Verbose message test.\r\nAt line:1 char:1\r\n+ Write-Verbose -Message \"Verbose message test.\"\r\nThis example uses the Verbose parameter with a value of $false that overrides the Stop value. The message isn't\r\ndisplayed.\r\nWrite-Verbose -Message \"Verbose message test.\" -Verbose:$false\r\nThis example shows the effect of the Inquire value. The $VerbosePreference variable is set to Inquire. The message is\r\ndisplayed and the user is prompted for confirmation.\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 21 of 27\n\n$VerbosePreference = \"Inquire\"\r\nWrite-Verbose -Message \"Verbose message test.\"\r\nVERBOSE: Verbose message test.\r\nConfirm\r\nContinue with this operation?\r\n[Y] Yes [A] Yes to All [H] Halt Command [?] Help (default is \"Y\"):\r\nThis example uses the Verbose parameter with a value of $false that overrides the Inquire value. The user isn't\r\nprompted and the message isn't displayed.\r\nWrite-Verbose -Message \"Verbose message test.\" -Verbose:$false\r\nDetermines how PowerShell responds to warning messages generated by a script, cmdlet, or provider, such as the\r\nmessages generated by the Write-Warning cmdlet.\r\nBy default, warning messages are displayed and execution continues, but you can change this behavior by changing the\r\nvalue of $WarningPreference .\r\nThe $WarningPreference variable takes one of the ActionPreference enumeration values: SilentlyContinue, Stop,\r\nContinue, Inquire, Ignore, Suspend, or Break.\r\nThe valid values are as follows:\r\nBreak - Enter the debugger when a warning message is written.\r\nStop: Displays the warning message and an error message and then stops executing.\r\nInquire: Displays the warning message and then prompts for permission to continue.\r\nContinue: (Default) Displays the warning message and then continues executing.\r\nSilentlyContinue: Doesn't display the warning message. Continues executing.\r\nYou can use the WarningAction common parameter of a cmdlet to determine how PowerShell responds to warnings from\r\na particular command. For more information, see about_CommonParameters.\r\nThese examples show the effect of the different values of $WarningPreference . The WarningAction parameter overrides\r\nthe preference value.\r\nThis example shows the effect of the default value, Continue.\r\n$m = \"This action can delete data.\"\r\nWrite-Warning -Message $m\r\nWARNING: This action can delete data.\r\nThis example uses the WarningAction parameter with the value SilentlyContinue to suppress the warning. The message\r\nisn't displayed.\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 22 of 27\n\n$m = \"This action can delete data.\"\r\nWrite-Warning -Message $m -WarningAction SilentlyContinue\r\nThis example changes the $WarningPreference variable to the SilentlyContinue value. The message isn't displayed.\r\n$WarningPreference = \"SilentlyContinue\"\r\n$m = \"This action can delete data.\"\r\nWrite-Warning -Message $m\r\nThis example uses the WarningAction parameter to stop when a warning is generated.\r\n$m = \"This action can delete data.\"\r\nWrite-Warning -Message $m -WarningAction Stop\r\nWARNING: This action can delete data.\r\nWrite-Warning : The running command stopped because the preference variable\r\n \"WarningPreference\" or common parameter is set to Stop:\r\n This action can delete data.\r\nAt line:1 char:1\r\n+ Write-Warning -Message $m -WarningAction Stop\r\nThis example changes the $WarningPreference variable to the Inquire value. The user is prompted for confirmation.\r\n$WarningPreference = \"Inquire\"\r\n$m = \"This action can delete data.\"\r\nWrite-Warning -Message $m\r\nWARNING: This action can delete data.\r\nConfirm\r\nContinue with this operation?\r\n[Y] Yes [A] Yes to All [H] Halt Command [?] Help (default is \"Y\"):\r\nThis example uses the WarningAction parameter with the value SilentlyContinue. The command continues to execute\r\nand no message is displayed.\r\n$m = \"This action can delete data.\"\r\nWrite-Warning -Message $m -WarningAction SilentlyContinue\r\nThis example changes the $WarningPreference value to Stop.\r\n$WarningPreference = \"Stop\"\r\n$m = \"This action can delete data.\"\r\nWrite-Warning -Message $m\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 23 of 27\n\nWARNING: This action can delete data.\r\nWrite-Warning : The running command stopped because the preference variable\r\n \"WarningPreference\" or common parameter is set to Stop:\r\n This action can delete data.\r\nAt line:1 char:1\r\n+ Write-Warning -Message $m\r\nThis example uses the WarningAction with the Inquire value. The user is prompted when a warning occurs.\r\n$m = \"This action can delete data.\"\r\nWrite-Warning -Message $m -WarningAction Inquire\r\nWARNING: This action can delete data.\r\nConfirm\r\nContinue with this operation?\r\n[Y] Yes [A] Yes to All [H] Halt Command [?] Help (default is \"Y\"):\r\nDetermines whether WhatIf is automatically enabled for every command that supports it. When WhatIf is enabled, the\r\ncmdlet reports the expected effect of the command, but doesn't execute the command.\r\nThe valid values are as follows:\r\nFalse (0, not enabled): (Default) WhatIf isn't automatically enabled. To enable it manually, use the cmdlet's\r\nWhatIf parameter.\r\nTrue (1, enabled): WhatIf is automatically enabled on any command that supports it. Users can use the WhatIf\r\nparameter with a value of False to disable it manually, such as -WhatIf:$false .\r\nThese examples show the effect of the different values of $WhatIfPreference . They show how to use the WhatIf\r\nparameter to override the preference value for a specific command.\r\nThis example shows the effect of the $WhatIfPreference variable set to the default value, False. Use Get-ChildItem to\r\nverify that the file exists. Remove-Item deletes the file. After the file is deleted, you can verify the deletion with Get-ChildItem .\r\nGet-ChildItem -Path .\\test.txt\r\nRemove-Item -Path ./test.txt\r\n Directory: C:\\Test\r\nMode LastWriteTime Length Name\r\n---- ------------- ------ ----\r\n-a--- 9/13/2019 10:53 10 test.txt\r\nGet-ChildItem -Path .\\test.txt\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 24 of 27\n\nGet-ChildItem : Cannot find path 'C:\\Test\\test.txt' because it does not exist.\r\nAt line:1 char:1\r\n+ Get-ChildItem -File test.txt\r\nThis example shows the effect of using the WhatIf parameter when the value of $WhatIfPreference is False.\r\nVerify that the file exists.\r\nGet-ChildItem -Path .\\test2.txt\r\n Directory: C:\\Test\r\nMode LastWriteTime Length Name\r\n---- ------------- ------ ----\r\n-a--- 2/28/2019 17:06 12 test2.txt\r\nUse the WhatIf parameter to determine the result of attempting to delete the file.\r\nRemove-Item -Path .\\test2.txt -WhatIf\r\nWhat if: Performing the operation \"Remove File\" on target \"C:\\Test\\test2.txt\".\r\nVerify that the file wasn't deleted.\r\nGet-ChildItem -Path .\\test2.txt\r\n Directory: C:\\Test\r\nMode LastWriteTime Length Name\r\n---- ------------- ------ ----\r\n-a--- 2/28/2019 17:06 12 test2.txt\r\nThis example shows the effect of the $WhatIfPreference variable set to the value, True. When you use Remove-Item to\r\ndelete a file, the file's path is displayed, but the file isn't deleted.\r\nAttempt to delete a file. A message is displayed about what would happen if Remove-Item was run, but the file isn't\r\ndeleted.\r\n$WhatIfPreference = \"True\"\r\nRemove-Item -Path .\\test2.txt\r\nWhat if: Performing the operation \"Remove File\" on target \"C:\\Test\\test2.txt\".\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 25 of 27\n\nUse Get-ChildItem to verify that the file wasn't deleted.\r\nGet-ChildItem -Path .\\test2.txt\r\n Directory: C:\\Test\r\nMode LastWriteTime Length Name\r\n---- ------------- ------ ----\r\n-a--- 2/28/2019 17:06 12 test2.txt\r\nThis example shows how to delete a file when the value of $WhatIfPreference is True. It uses the WhatIf parameter\r\nwith a value of $false . Use Get-ChildItem to verify the file was deleted.\r\nRemove-Item -Path .\\test2.txt -WhatIf:$false\r\nGet-ChildItem -Path .\\test2.txt\r\nGet-ChildItem : Cannot find path 'C:\\Test\\test2.txt' because it does not exist.\r\nAt line:1 char:1\r\n+ Get-ChildItem -Path .\\test2.txt\r\nThe following are examples of the Get-Process cmdlet that doesn't support WhatIf and Stop-Process that does\r\nsupport WhatIf. The $WhatIfPreference variable's value is True.\r\nGet-Process doesn't support WhatIf. When the command is executed, it displays the Winword process.\r\nGet-Process -Name Winword\r\n NPM(K) PM(M) WS(M) CPU(s) Id SI ProcessName\r\n ------ ----- ----- ------ -- -- -----------\r\n 130 119.84 173.38 8.39 15024 4 WINWORD\r\nStop-Process does support WhatIf. The Winword process isn't stopped.\r\nStop-Process -Name Winword\r\nWhat if: Performing the operation \"Stop-Process\" on target \"WINWORD (15024)\".\r\nYou can override the Stop-Process WhatIf behavior by using the WhatIf parameter with a value of $false . The\r\nWinword process is stopped.\r\nStop-Process -Name Winword -WhatIf:$false\r\nTo verify that the Winword process was stopped, use Get-Process .\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 26 of 27\n\nGet-Process -Name Winword\r\nGet-Process : Cannot find a process with the name \"Winword\".\r\n Verify the process name and call the cmdlet again.\r\nAt line:1 char:1\r\n+ Get-Process -Name Winword\r\nabout_Automatic_Variables\r\nabout_CommonParameters\r\nabout_Environment_Variables\r\nabout_Error_Handling\r\nabout_Profiles\r\nabout_Remote\r\nabout_Scopes\r\nabout_Variables\r\nSource: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugprefere\r\nnce\r\nhttps://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference\r\nPage 27 of 27",
	"extraction_quality": 1,
	"language": "EN",
	"sources": [
		"MITRE"
	],
	"references": [
		"https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7.3#debugpreference"
	],
	"report_names": [
		"about_preference_variables?view=powershell-7.3#debugpreference"
	],
	"threat_actors": [],
	"ts_created_at": 1775439100,
	"ts_updated_at": 1775791311,
	"ts_creation_date": 0,
	"ts_modification_date": 0,
	"files": {
		"pdf": "https://archive.orkl.eu/ab7630db0906f41f073c4d354e0c9d5c4e96aa56.pdf",
		"text": "https://archive.orkl.eu/ab7630db0906f41f073c4d354e0c9d5c4e96aa56.txt",
		"img": "https://archive.orkl.eu/ab7630db0906f41f073c4d354e0c9d5c4e96aa56.jpg"
	}
}