Hi,
I tested this with all the escape characters I could think of and couldn’t get it to work ☹ I guess that the $ is reserved for variables but the controller.
So, I looked at using a bat file to execute this but again there are some difficulties and you need to have your command in a .ps1 file and call that from the .bat file and it does work I am getting the guid file created every 10 mins in C:\Temp:
Here is the Training-Create_New_File.ps1 file:
New-Item -Path "C:\Temp" -Name $((New-GUID).Guid) -ItemType File
Here is the Training-Create_New_File.bat file:
Powershell -ExecutionPolicy Bypass -File .\Training-Create_New_File.ps1
Here is the new package file with the new files added:
<package info>
name = Training-Create_New_File
description = Create a new file in C:\Temp, with a GUID for a file name.
copyright = (C) Copyright 2018
group = Training
author = my_name
date = 30/08/2018
version = 1.0
build = 3
no_drop = no
</package info>
<Training-Create_New_File>
name = Training-Create_New_File
type = simple
OStype = windows
OS = win64
update = Training-Create_New_File
<files>
<Training-Create_New_File.ps1>
type = binary
access = 0755
dir = probes/training/training-create_new_file
</Training-Create_New_File.ps1>
<Training-Create_New_File.bat>
type = script
access = 0755
dir = probes/training/training-create_new_file
</Training-Create_New_File.bat>
</files>
<Training-Create_New_File>
description = Create a new file in C:\Temp, with a GUID for a file name.
group = Training
active = yes
preserve_state = yes
type = timed
timespec = interval 10 min
workdir = probes/training/training-create_new_file
command = Training-Create_New_File.bat
arguments =
config = Training-Create_New_File.cfg
logfile = Training-Create_New_File.log
datafile =
</Training-Create_New_File>
</Training-Create_New_File>
You’ll need to create the Training-Create_New_File.ps1 and Training-Create_New_File.bat files and add them to your package. The package needs the workdir so it can find the files and the command is the Training-Create_New_File.bat file with no arguments.
I hope this helps.
Steve D'Arcy