MID Server | Powershell Transcript Files Are Created in the 'agent' Directory Daily and Eventually Lead to Disk Space IssuesIssue <!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } Directories with name format YYYYMMDD and contain files with name format PowerShell_transcript.<computername>.<random>.<timestamp>.txt are being created daily or frequently directly in the MID Server's agent directory or in a Users $HOME\Documents directory. Example: C:\ServiceNow\MIDServer1\agent\20240601\PowerShell_transcript.WINSRV2019STDA.t7eh07Gy.20240601031500 These directories and files continue to be created and without any manual intervention will eventually take up storage on the MID Server Host to cause Disk Space relate issues. Disk Space issues include, but are not limited too, causing the MID Server to fail a Pre-Upgrade Check or an Upgrade if the Pre-Upgrade Check has been disabled due to there not being enough disk space for the upgrade to complete. Release<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } MID Servers installed on Windows Server Hosts, any Release. Cause<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } This is caused when a Turn on PowerShell Transcription Policy is enabled. When a PowerShell Transcription Policy is enabled: PowerShell Transcripts files with name format "PowerShell_transcript.<computername>.<random>.<timestamp>.txt" are created and stored inside directories with name format YYYYMMDD. Example: C:\ServiceNow\MIDServer1\agent\20240601\PowerShell_transcript.WINSRV2019STDA.t7eh07Gy.20240601031500 The Turn on PowerShell Transcription policy setting lets you capture the input and output of PowerShell commands into text-based transcripts.If you enable this policy setting, PowerShell enables transcription logging for PowerShell and any other applications that leverage the PowerShell engine.By default, PowerShell records transcript output to each users' My Documents directory, with a filename that includes PowerShell_transcript, along with the computer name and time started. Default location: $HOME\DocumentsDefault filename: PowerShell_transcript.<computername>.<random>.<timestamp>.txt Enabling this policy has the same effect as calling the Start-Transcript cmdlet on each PowerShell session.The policy can be defined at the local machine level, in the HKEY_LOCAL_MACHINE registry hive, or at the user level, in user's HKEY_CURRENT_USER registry hive.Depending on the level of where the policy is set seems to determine whether the PowerShell Transcripts of the MID Server's PowerShell Sessions are stored in a User's $HOME\Documents directory when set at the user level, or directly in the MID Server's agent Directory when set at the local machine level.The MID Server Service Log On As user's $HOME environment variable is the full path to it's agent directory, and thus why the PowerShell Transcripts can be created/stored there. PowerShell Command to check if PowerShell Transcription is enabled at the Local Machine level:Get-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\PowerShell PowerShell Command to check if PowerShell Transcription is enabled at the User level:Get-ItemProperty -Path HKCU:\SOFTWARE\Policies\Microsoft\Windows\PowerShell If the EnableTranscripting property is returned and the value does NOT equal 0, then PowerShell Transcription is enabled Resolution<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } Please work internally with the System Administrator of the Windows Server that the MID Server is installed on to either Disable the PowerShell Transcription Policy.Or exclude the Log On As user that the MID Server is running as from the PowerShell Transcription Policy.Or if there is a requirement for the PowerShell Transcription Policy to be in place for the MID Server Log On As user then remediate a retention strategy for the generated PowerShell Transcript files so as not to exhaust the MID Server Host's Disk Space.Or contact Microsoft Support to explore other available options/configurations with PowerShell Transcription Policy Related Links<!-- /*NS Branding Styles*/ --> .ns-kb-css-body-editor-container { p { font-size: 12pt; font-family: Lato; color: #000000; } span { font-size: 12pt; font-family: Lato; color: #000000; } h2 { font-size: 24pt; font-family: Lato; color: black; } h3 { font-size: 18pt; font-family: Lato; color: black; } h4 { font-size: 14pt; font-family: Lato; color: black; } a { font-size: 12pt; font-family: Lato; color: #00718F; } a:hover { font-size: 12pt; color: #024F69; } a:target { font-size: 12pt; color: #032D42; } a:visited { font-size: 12pt; color: #00718f; } ul { font-size: 12pt; font-family: Lato; } li { font-size: 12pt; font-family: Lato; } img { display: ; max-width: ; width: ; height: ; } } Links to Microsoft Documentation on Learn > PowerShell 5.1 > about_Group_Policy_Settings > Turn on PowerShell transcription https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_group_policy_settings?view=powershell-5.1#turn-on-powershell-transcription Learn > PowerShell 5.1 > Microsoft.PowerShell.Host > Start-Transcript https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.host/start-transcript?view=powershell-5.1