Command failed (Substitution failed while writing file) createfile until _eof

The following action script is encountering the below error:

Command failed (Substitution failed while writing file) createfile until _eof

action uses wow64 redirection {not x64 of operating system}
delete __createfile
delete C:\ProgramData\script.ps1

createfile until _eof
#START#
function Show-BaloonPopup([String]$Title, [String]$Message , [int]$Delay=15000)
{
Add-Type -AssemblyName System.Windows.Forms
$script:balloon = New-Object System.Windows.Forms.NotifyIcon

$Icon = 'Warning'
$balloon.Icon=[System.Drawing.Icon]::ExtractAssociatedIcon("C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\__UICache\_clientui.ico")

$balloon.BalloonTipIcon  = $Icon
$balloon.BalloonTipText  = $Message
$balloon.BalloonTipTitle = $Title
$balloon.Visible         = $true
$balloon.ShowBalloonTip($Delay)

}

$TimeStart = Get-Date
$TimeEnd = $TimeStart.addminutes(1)

Do
{
$TimeNow = Get-Date
Show-BaloonPopup “Attention ‘$Env:USERNAME’” “This is a test message.” 15000
Start-Sleep -Seconds 15
}
Until ($TimeNow -ge $TimeEnd)
#END#
_eof

move __createfile C:\ProgramData\script.ps1

waithidden powershell.exe -windowstyle hidden -ExecutionPolicy Bypass -File C:\ProgramData\script.ps1

What am I missing here?

Every time actionscript sees the { character it is expecting a Relevance Substitution command. To put a literal { into the createfile you must escape it as {{.

2 Likes

Thanks Jason! It’s now working.

action uses wow64 redirection {not x64 of operating system}
delete __createfile
delete C:\ProgramData\script.ps1

createfile until _eof
#START#
function Show-BaloonPopup([String]$Title, [String]$Message , [int]$Delay=15000)
{{
Add-Type -AssemblyName System.Windows.Forms
$script:balloon = New-Object System.Windows.Forms.NotifyIcon

$Icon = ‘Warning’
$balloon.Icon=[System.Drawing.Icon]::ExtractAssociatedIcon(“C:\Program Files (x86)\BigFix Enterprise\BES Client__BESData__UICache_clientui.ico”)

$balloon.BalloonTipIcon = $Icon
$balloon.BalloonTipText = $Message
$balloon.BalloonTipTitle = $Title
$balloon.Visible = $true
$balloon.ShowBalloonTip($Delay)
}

$TimeStart = Get-Date
$TimeEnd = $TimeStart.addminutes(1)

Do
{{
$TimeNow = Get-Date
Show-BaloonPopup “Attention ‘$Env:USERNAME’” “This is a test message.” 15000
Start-Sleep -Seconds 15
}
Until ($TimeNow -ge $TimeEnd)
#END#
_eof

move __createfile C:\ProgramData\script.ps1

waithidden powershell.exe -windowstyle hidden -ExecutionPolicy Bypass -File C:\ProgramData\script.ps1

1 Like