Record transcript


Write output from console to log file
Note: It does not the cmdlet itself, just the output
set-location "C:\Temp"
$dateinfo = get-date -Format "MMddyyy_HHmmss"
$logfilename = "log" + $dateinfo + ".log"

Start-Transcript -Path $logfilename
get-process | select -first 5

Get-Location

Stop-Transcript

Output result from the log file

**********************
Windows PowerShell transcript start
Start time: 20230507202317
Username: domain\test
RunAs User: domain\test
Configuration Name: 
Machine: testPC (Microsoft Windows NT 10.0.19045.0)
Host Application: C:\Windows\system32\WindowsPowerShell\v1.0\PowerShell_ISE.exe
Process ID: 8884
PSVersion: 5.1.19041.2673
PSEdition: Desktop
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.19041.2673
BuildVersion: 10.0.19041.2673
CLRVersion: 4.0.30319.42000
WSManStackVersion: 3.0
PSRemotingProtocolVersion: 2.3
SerializationVersion: 1.1.0.1
**********************
Transcript started, output file is log05072023_202317.log

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
   1587      44    58340      29632     134.83   9492   2 1Password
    248      14    12824       8236       2.30  16148   2 1Password
    945      28    96832      10956      12.25  28976   2 1Password
    245      16     7208       6428       1.58  17304   2 1Password-BrowserSupport
   1301      51    64400      29216             28080   0 Agent

Drive        : C
Provider     : Microsoft.PowerShell.Core\FileSystem
ProviderPath : C:\Temp
Path         : C:\Temp

**********************
Windows PowerShell transcript end
End time: 20230507202317
**********************