r/PowerShell • • May 03 '22

Script to install printer through intune NSFW

Hi Folk

I am trying to install network printers on clients devices through intune. Could you suggest the power shell scrip for that. I have onsite print server installed.

0 Upvotes

24 comments sorted by

View all comments

0

u/[deleted] May 03 '22

[deleted]

1

u/dehin May 03 '22

That just sounds...complicated! I mean the PowerShell script masquerading as an exe wrapped as an IntuneWin file! Just, why?

(Btw, I'm sure you have a good reason, my comment is more tongue in cheek. I am curious how you obfuscate the script as an exe.)

2

u/TestitinProd123 May 03 '22

Mostly because the drivers are stored in an Azure storage blob and pulled down using a SAS which I didn’t really want revealed. I also use exe to obfuscate clients I’ve written that use credentials or keys so that if someone is to browse to the executable they can’t just open it in notepad and pull out potentially usable credentials or secrets.

You can use things like ps2exe or PowerShell ProTools to do the obfuscation.

As for the IntuneWin piece, it’s kind of like a Zip file that contains all the things needed to deploy as a win32 LOB app from endpoint manager, so for example the IntuneWin wrapper might actually contain an executable and dependencies.

I use IntuneWin so that I can leverage managed installer (mark the MEM agent as a managed installer) since MSI are executed by msiexec and not the MEM agent which means that the extended attributes that are supposed to be applied to apps coming down from Intune wouldn’t be applied. When I use IntuneWin however, since the apps are pulled down and installed by the Intune MEM agent the correct attributes are added to all files added to disk during the installation.

2

u/dehin May 03 '22

That's very cool and definitely gives me some ideas as well! Thanks for elaborating.