waithidden { pathname of file ((it as string) of value “Path” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell” of native registry) } -ExecutionPolicy Bypass -File “c:\temp{parameter script}”
For the ‘download’ command, relevance substitution is not performed on the URL. You may be able to use a prefetch block and add prefetch item, but you will need to supply the file name, size, url, and hashes.
Similarly you can use the ‘download now’ command to do the same; but both curl and ‘download now’ download from the client directly, skipping the Relays, and means the client needs direct access to the download server (which is not great, I advise clients should never have direct access to the root server for security reasons)
i need to develop a fixlet where it would accept the script parameter as dynamic as it would be store in the uploads directly and keep on updated by Admin ,
so idea is server/uploads/adhoc/script.ps1 - which might be updated by Admin and uploaded into the adhoc directory
i tried with all para options but i have to keep the dynamic path for the “theMSI” as script on this path is keep on changing , and tis fixlet i want to use it from client macines
begin prefetch block
parameter "thePath" = "<<http://path of the script>>"
parameter "theName" = "{(name of it ) of file (parameter "thePath")}"
parameter "theSha1" = "{(sha1 of it ) of file (parameter "thePath")}"
parameter "theSize" = "{(size of it ) of file (parameter "thePath")}"
parameter "theUrl" = "http://server:52311/Uploads/adhoc/{{parameter "theName"}"
add prefetch item name={parameter "theName"} sha1={parameter "theSha1"} size={parameter "theSize"} url={parameter "theUrl"}
collect prefetch items
end prefetch block
I think what you’re looking for is ‘add nohash prefetch item’.
I don’t know whether it allows a relevance substitution for the URL though so you may need to supply that before you send the action.
Parameters 2,3 & 4 won’t give you anything useful - file{parameter "thePath"} isn’t a file
Even if it were, dynamically calculating the size & hashes is pointless. The purpose of the size and hash in the download to to enable the client to check it has the file you intended, and not some randomly updated or maliciously changed content
@mail2vij, I’m still not sure – what are you trying to make happen? The prefetch function has certain characteristics with benefits, but you seem to be trying to work around them.
The ‘add nohash prefetch item’ command cannot take a relevance substitution.
This is mostly for security but also architectural reasons.
I’m not sure why you’re trying to use a parameter when you’re still just supplying a static value (maybe eventually you want this to prompt the operator for a download filename to run?) But this whole concept you’re attempting is a non-starter.
i wanted to prompt user to put a script url which may change all the time with updated version of script and for this purpose i would use dynamic parameter instead of static , but as you said this would not work in prefetch block , so i wrote script to new method with help of curl and may change my script to dynamic para instead of static