So, I am rebuilding all my scripts with the use of a library of functions. I call my library using the . DOT notation.
All “migrated” functions run fine except for this one (part of it):
Create LogFolder for present run
$LogFolder = $SwFolder + "\" + [string]$(get-date -f yyMMddHHmm) Write-Host "LogFolderInFunc = "$LogFolder New-Item -ItemType Directory -Force -Path $LogFolder
$LogFolder is created, so this part is working.
But returning to the main script $LogFolder only holds the value of:
“” + [string]$(get-date -f yyMMddHHmm).
Strangly $SwFolder is vanished
Where am I going wrong?