temp/test.ps1
$testscriptblock = { Get-Process | Where-Object { $_.Name -like '*explorer' } } $initializeVm = { Param( [parameter(Mandatory = $true)][String]$test ) $ErrorActionPreference = "SilentlyContinue" try { Stop-Transcript | out-null } catch { $error.clear() } New-Item -ItemType Directory -Force -Path C:\Install\Log -ErrorAction SilentlyContinue | Out-Null Start-Transcript -Path "C:\Install\Log\InitVM.$(get-date -format yyyyMMddhhmmss).log" if (-not([string]::IsNullOrEmpty($test))) { Write-Host "Variable enthaelt: $test" } Import-Module -Name SetupD365Environment Initialize-CustomAzVm Stop-Transcript } $installD365Module = { try { Stop-Transcript | out-null } catch { $error.clear() } New-Item -ItemType Directory -Force -Path C:\Install\Log -ErrorAction SilentlyContinue | Out-Null Start-Transcript -Path "C:\Install\Log\InstallD365Module.$(get-date -format yyyyMMddhhmmss).log" if (Get-Module -Name SetupD365Environment -ListAvailable) { Update-Module -Name SetupD365Environment -Force } else { Install-Module -Name SetupD365Environment -Force } Stop-Transcript } |