none
PowerShell - RunOnce Help

    Question

  • Hi everyone,

    I have tweaked a PowerShell script to add icons to Start Menu and Task Bar for users.  I tried a lot of scripts...this is the only one that worked like I wanted/needed it to work: http://stackoverflow.com/questions/9903847/how-to-pin-to-start-menu-using-powershell

    This is a Terminal Server / Citrix environment...so many users on each box.  I've redirected the majority of the user folders, Citrix UPM will capture changes to Start Menu and Task Bar...but the customer basically wants to pre-populate it with some options.  

    I need to have the script RunOnce, for each user...but not after that...as I don't want the icons to be recreated everytime the user logs in if they delete them or want to change.

    I have the PS on a network share \\fileserver\share\AddIcons.ps1

    How do I get this to launch in a RunOnce capacity for users of this new environment so when their new profile/redirected folders are created, this script will throw icons where it's supposed to?  Remember, as it's a TS/Citrix environment...the users will not have elevated privilages.

    Tuesday, December 06, 2016 9:21 PM

All replies

  • Hi,

    >>How do I get this to launch in a RunOnce capacity for users of this new environment so when their new profile/redirected folders are created, this script will throw icons where it's supposed to?

    You could consider creating a startup GPO to do this then check if this icon has been added, not execute this ps script again.

    Besides, PowerShell has a dedicated forum, to get better help, you could post on forum below:

    https://social.technet.microsoft.com/Forums/windows/en-US/home?forum=winserverpowershell

    Best regards,

    Andy


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Wednesday, December 07, 2016 8:03 AM
    Moderator
  • > I need to have the script RunOnce, for each user...
     
    Create a flag... Either a file in the user profile or a registry value in HKCU. Check for that flag in your script...
     
    Wednesday, December 07, 2016 10:42 AM