private/steps/1-initialization/step-initialize-startosdcloudlogs.ps1
function step-initialize-startosdcloudlogs { [CmdletBinding()] param () #================================================= # Start the step $Message = "[$(Get-Date -format G)] [$($MyInvocation.MyCommand.Name)] Start" Write-Debug -Message $Message; Write-Verbose -Message $Message # Get the configuration of the step $Step = $global:OSDCloudWorkflowCurrentStep #================================================= #region Main $LogsPath = "$env:TEMP\osdcloud-logs" $Params = @{ Path = $LogsPath ItemType = 'Directory' Force = $true ErrorAction = 'SilentlyContinue' } if (-not (Test-Path $Params.Path)) { New-Item @Params | Out-Null } $TranscriptFullName = Join-Path $LogsPath "transcript.log" # Write-Host -ForegroundColor DarkGray "[$(Get-Date -format G)] $TranscriptFullName" Start-Transcript -Path $TranscriptFullName #endregion #================================================= # End the function $Message = "[$(Get-Date -format G)] [$($MyInvocation.MyCommand.Name)] End" Write-Verbose -Message $Message; Write-Debug -Message $Message #================================================= } |