1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PowerShellで起動時に自動でログを取得する

Posted at

事前準備:PowerShell起動時に署名付きスクリプトを実行出来るようにして、起動時のprofileに署名をする

1. 起動時スクリプトを編集する

notepad $profile

2. スクリプト編集

# 自動ログ取得開始

$LogFolder = "d:\dev\work\PSLog"
$TimeStamp   = (Get-Date -Format 'yyyyMMdd-HHmmss')
$UserInfo    = $Env:COMPUTERNAME + '-' + $Env:USERNAME
$LogFilePath = $LogFolder + '\PS_' + $TimeStamp + '_' + $UserInfo + '.log'

Start-Transcript -Path $LogFilePath -Append
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?