Help with creating a PowerShell Snapin
-
@Tom - Can said bat or cmd just be uploaded to FOG, or do I have to encapsulate it first?
Basically, what i’ve done is, made a PS script that sends an “Invoke-Command” to a server that I have PDQ Deploy (a software deployment system) running on. The invoke-command tells PDQ Deploy to run and deploy a specific software package to the machine that the PS script originally ran from. So, once it’s set up as a snapin, I can image, rename, join to domain, and deploy any software package to any/all of my PCs.
Then, taking if further, I want to eventually set up a daily recurring script that checks PDQ Deploy’s Package Library, for specific software updates. Once it finds one, it will download the package, and somehow notify FOG to Wake on LAN all machines, then invoke the deploy command to all machines in a specific IP range. This would essentially make Full Zero Touch with Automatic Updates!
-
FOG can run batch files, no need to create a exe file for that. I however create a exe file If I have more than 1 file to run.
-
[quote=“Albatros, post: 24014, member: 16710”]FOG can run batch files, no need to create a exe file for that. I however create a exe file If I have more than 1 file to run.[/quote]
I have a lot of batch files. I use psexec to push them to all my hosts to deploy software etc. Can someone tell me how to use these batch files as a FOG snap-in?
-
Do you know this tutorial?
[url]http://fogproject.org/forum/threads/how-to-make-a-simple-snapin-start-to-finish.304/[/url]With the help of the tutorial you can make a exe file that contains a 7-zip file and this file contains batch files.
-
Thanks for the post Albatros. I did already see that. It needs a little updating though, as the guide is following an older version, and they’ve changed the interface a little. But, overall I still got it to work. I now have a full zero touch deployment system with deployment of any software package I choose.
My next goal is to make a script that will check daily for Flash and Java updates. When it finds one, the plan is to have the script change out the existing installer with the new one, then somehow notify FOG to reset the snapin deployment to all machines in a group. This should essentially create a sort of Auto Updater…
-
OOOHH… Just had an epiphany as 5am…
Better yet, I’ll just have a machine group set up in PDQ Deploy, with all of the same machines that are in the FOG group. This way, I can just have the script talk directly to the PDQ Deploy machine group, instead of going all the way out and through FOG.
-
[quote=“BigMan99211, post: 24135, member: 21932”]OOOHH… Just had an epiphany as 5am…
Better yet, I’ll just have a machine group set up in PDQ Deploy, with all of the same machines that are in the FOG group. This way, I can just have the script talk directly to the PDQ Deploy machine group, instead of going all the way out and through FOG.[/quote]
Any more updates at this? I’ve just got the script working to pull updates from PDQDeploy on the machine, but am wondering how to fire it off after an image. Are you still using a snappin, or something different? I’d love to get this r unning, as I’ve got 1200 machines to image next month…
-
[quote=“Bob Henderson, post: 47213, member: 1291”]Any more updates at this? I’ve just got the script working to pull updates from PDQDeploy on the machine, but am wondering how to fire it off after an image. Are you still using a snappin, or something different? I’d love to get this r unning, as I’ve got 1200 machines to image next month…[/quote]
And yes, thread necro, but for relevance!
-
If you have a domain, there is zero reasons to “Deploy” a powershell script.
Powershell can control domain-connected clients like puppets. You can literally push out whatever you want to whatever computer you want, instantly, from powershell itself on a DC.
-
[quote=“Wayne Workman, post: 47235, member: 28155”]If you have a domain, there is zero reasons to “Deploy” a powershell script.
Powershell can control domain-connected clients like puppets. You can literally push out whatever you want to whatever computer you want, instantly, from powershell itself on a DC.[/quote]
Completely understood. Problem is, I’m doing something a bit different. To lay it out easily:
- I create a base image (Windows 7 + Office2013) and get it all sysprepped and into FOG.
- I deploy base image to various hardware.
- I have this script to invoke a deployment job using PDQ deploy to install the rest of my packages in their updated versions.
I’d love to get it so that that script fires off automatically. Problem is, since it’s powershell using WinRM to invoke the PDQ Deploy command, I need to be domain joined. If I’m not mistaken, this puts adding the script to the SetupComplete.cmd file out of the question, as the domainjoin from FOG hasn’t ran yet.
Any suggestions?
-
I suppose you could use the “RunOnce” registry value, and put a batch script on the image. You can raise elevation within a batch script, and then run a powershell script from that.
The pointer will point to a network share where your actual script is, perhaps copy it down and run it locally.
But yeah you’re right, without being joined to the domain… you have to do other things. I used to to something similar to the above back in college, but using nothing but batch files. It worked really well, long as the share path and remote script name never changed; which wasn’t an issue.
-
Would run once work with domain join/rename bit of Fog? I’m worried that with the fact it usually gets to a login before domain join, then reboots, it would run and then fail.
-
[quote=“Bob Henderson, post: 47245, member: 1291”]Would run once work with domain join/rename bit of Fog? I’m worried that with the fact it usually gets to a login before domain join, then reboots, it would run and then fail.[/quote]
No way to know but to try…
Set the FOG Client Service to delayed start?
You could also try a startup-script. You can set this via Local Group Policy on the image itself. Then, to get rid of it later once it’s on the domain, you can set policy to get rid of it on your DC.
-
Sadly, tried that, no luck. Since it’s a powershell script, it really needs the domain to be working well, which means I cant have it on RunOnce registry unless I could somehow get that key added after the domainjoin task.
Startupscript via local group policy is an option I’ll be trying today. I’d just need to set the last step of the task to delete the script…
I’m honestly wondering how BigMan99211 got it working up there, and was hoping he’d chime in!
-
- Re-package your desired software that you normally deploy with PDQ deploy into MSI’s (test all of them to confirm they install correctly).
- Create Snapins and have them auto-deploy when desired.
- ???
- Profit!