PowerShell Scripts in FOG Snapins



  • So what is settings to get a powershell script to work. I have one that does a custom start menu layout and I am unable to get it to run. If I run it manually on a machine it works. What is need in the snappin settings to make a ps1 file execute?



  • @george1421
    I was able to get the one Powershell script to work via a Batch file. But I am having problems getting this bat file to work:
    PowerShell.exe -Command “&Import-StartLayout –LayoutPath C:\Installs\StartMenu.xml –MountPath $env:SystemDrive”


  • Moderator

    @imagingmaster21 That may be a question for our FOG Client @Developers on how/if its possible to run a snapin as the current logged on user.

    The only way I found is to leave what I call bread crumbs for the users to find. The concept is that you use a plugin to update a registry key to have a script run like in HKLM/Software/…/Run which will be executed each time a user logs in. Then have that script run in the user’s context.

    The other way I’ve done it is to use a plugin to drop any necessary files, then use a GPO to update what needs to be done. You can either use a Policy pro Policy Preference to set what needs to be set.



  • @george1421
    So how would I get it to work under current user? What would be the easiest way. Or is there something I can put in the file to run as system?


  • Moderator

    [Mod Note] Moving this thread out of the tutorials forum.


  • Moderator

    The fog client should run the powershell script no problem. What may be your problem is whom the powershell script runs as.

    The FOG client runs as user SYSTEM (which has no visible desktop). So your powershell script is probably running perfectly fine for SYSTEM. But what I imagine you are trying to do is mess with either the current logged in user or hklm via powershell. That won’t work so well.


 

433
Online

41.8k
Users

12.3k
Topics

116.1k
Posts