I have a simple PowerShell script (.ps1 file, detailed below) and I'm trying to pass a variable that needs to be present in the window title and also a log file name. The script runs, but the places where the variable's string is suppose to be erroneously shows up blank (i.e., "session-" and "log-20210612_155506-session-.log"). What is the correct way to pass this variable??
$mysessionID = [guid]::NewGuid().toString().ToLower()
invoke-expression 'cmd /c start powershell -NoExit -Command {cd .\;$host.ui.RawUI.WindowTitle = "session-$mysessionID"; start-sleep 0 ; .\chia_plot.exe -p 987d987987987fd879879 -f 9x79879f987987sd -t D:\ -d R:\ -n -1 -r 4 -u 128 | Tee-Object -FilePath ".\logs\log-$(get-date -f yyyyMMdd_HHmmss)-session-$mysessionID.log"}'
Invoke-Expressionand the single quotes, leaving justcmd /c start powe......