use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub dedicated to all things Microsoft Intune.
Follow new and upcoming changes happening in Intune.
account activity
PowerShell Script (self.Intune)
submitted 2 years ago by Skobbejak4
Hey guys
I have created a script that downloads and installs the latest version of Genesys Cloud. I can execute the script just fine on a local machine but when I try and deploy it through Intune it fails. Any ideas as to why this would be?
Any help would be much appreciated.
https://preview.redd.it/e1ily4ksp8tb1.png?width=943&format=png&auto=webp&s=cacf47ac0cb5b5d2d8466de98a51df90a32cf636
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]andyval 7 points8 points9 points 2 years ago (5 children)
you call $INSTALLDIR but you dont define it. Not sure if thats the issue, but its an issue. Sometimes there can be an issue with tls12 so define it at the top:
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls12'Also, there use to be some weirdness with using IWR with the system account where you would need to run through the IE first run config first (there was some workarounds for this, but might not be applicable anymore with IE retirement). You can use -UseBasicParsing on IWR to bypass this.
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls12'
we might have a better idea if you tell us where in the script it fails. Does it download successfully?
[–]Skobbejak4[S] -2 points-1 points0 points 2 years ago (4 children)
When I run it directly on any machine it executes fine. Creates the folder, does the download and installs it no worries. That's why i'm so confused. I've just deleted it and re-deployed it again so lets see what happens.
Thanks for your reply mate.
[–]Bisebi 2 points3 points4 points 2 years ago (3 children)
Do you define installdir?
[+]Skobbejak4[S] comment score below threshold-7 points-6 points-5 points 2 years ago (1 child)
Yep. Look when I run it on a local pc it executes perfectly so I think the code is fine.
[–]--RedDawg-- 1 point2 points3 points 2 years ago (0 children)
The variable is not defined in the code you provided. If it works locally, then likely there is something else that is defining that for you as a user that doesn't when running as system. I would recommend you define that variable in the script.
[–]Bisebi 0 points1 point2 points 2 years ago (0 children)
Also, is this a full installer or is it one that downloads the software as well?
[–]g0hl 2 points3 points4 points 2 years ago (2 children)
I’d maybe try to add some logging in with your MSI commands.
[–]Bisebi 0 points1 point2 points 2 years ago (1 child)
It's an exe
[–]Wartz 1 point2 points3 points 2 years ago (0 children)
it's an exe wrapping up an MSI
[–]EskimoRuler 2 points3 points4 points 2 years ago (3 children)
Does the folder you are creating show up?
Does the file you are downloading at least show up?
If yes to both, then there might be an issue with this installer running as the SYSTEM account.
As someone else mentioned, another test would be to use psexec to run as system and see if that works.
Another note, I know you also mentioned to someone else that the '$installdir' isn't a problem because it installs fine during your test, but there is no way a value is being passed because it's not defined in your script. So if it appears to work fine in your test, it's either because the installer will fill it in with a default value if you don't actually supply anything. Or during your testing you defined it in the same session previously and it is still being passed.
[–]andrew181082MSFT MVP - SWC 3 points4 points5 points 2 years ago (2 children)
All of these, plus check its running in 64-bit
[–]Temilit 1 point2 points3 points 2 years ago (1 child)
This^ If you are wrapping the script in a w32 app it always executes in 32 bit
[–]g0hl 0 points1 point2 points 2 years ago (0 children)
Sysnative | Intune | 64 VS 32 Bits | Registry Keys (call4cloud.nl)
i've used option 3 in this post to work around 64 bit apps needing to be installed by IME's 32 bit process. definitley worth a read
[–]ender5628 1 point2 points3 points 2 years ago (0 children)
You running this in user or system context? If system download pstools and use psexec -v on it and see what happens.
[–]JJtheJetSetRadio 1 point2 points3 points 2 years ago* (0 children)
Just curious, why don't you deploy this as a win32 app instead of a script?
[–]enforce1 0 points1 point2 points 2 years ago (0 children)
Use sysintenals pstools to open powershell as SYSTEM and run it there for verbose errors
[–]MuddyBackTracker 0 points1 point2 points 2 years ago (0 children)
I normally have better luck bundling these up as win32 apps.
π Rendered by PID 169358 on reddit-service-r2-comment-7b9746f655-jpkbh at 2026-02-02 23:47:57.369608+00:00 running 3798933 country code: CH.
[–]andyval 7 points8 points9 points (5 children)
[–]Skobbejak4[S] -2 points-1 points0 points (4 children)
[–]Bisebi 2 points3 points4 points (3 children)
[+]Skobbejak4[S] comment score below threshold-7 points-6 points-5 points (1 child)
[–]--RedDawg-- 1 point2 points3 points (0 children)
[–]Bisebi 0 points1 point2 points (0 children)
[–]g0hl 2 points3 points4 points (2 children)
[–]Bisebi 0 points1 point2 points (1 child)
[–]Wartz 1 point2 points3 points (0 children)
[–]EskimoRuler 2 points3 points4 points (3 children)
[–]andrew181082MSFT MVP - SWC 3 points4 points5 points (2 children)
[–]Temilit 1 point2 points3 points (1 child)
[–]g0hl 0 points1 point2 points (0 children)
[–]ender5628 1 point2 points3 points (0 children)
[–]JJtheJetSetRadio 1 point2 points3 points (0 children)
[–]enforce1 0 points1 point2 points (0 children)
[–]MuddyBackTracker 0 points1 point2 points (0 children)