Logon Script to Create Desktop and Startmenu Shortcut Links Dynamically

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 3 years and 2 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
Sharkbone
Posts: 3
Last visit: Mon Jun 14, 2021 3:39 am

Logon Script to Create Desktop and Startmenu Shortcut Links Dynamically

Post by Sharkbone »

I am trying to create desktop and startmenu shortcut links and urls depending on conditions matched. I managed to put the below script together, See code attached...
DesktopLinksVariant2.ps1
DesktopLinkCode
(1.5 KiB) Downloaded 186 times
So the above is supposed to verify user profile > desktop shortcuts and a .lnk, or .url and will create a shortcut if not present or check if it is a startmenu shortcut and create accordingly. I am not sure if the above approach is right ..Will it be possible if the source urls and lnks are populated in a textfile so the script always checks if the file has been populated based on same conditions and updates shortcuts accordingly. This could even be in the same file but maybe comma separated or something. Any ideas how this can be achieved?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Logon Script to Create Desktop and Startmenu Shortcut Links Dynamically

Post by jvierra »

There is no reason why you cannot get the links from a file. Have you tried?
Sharkbone
Posts: 3
Last visit: Mon Jun 14, 2021 3:39 am

Re: Logon Script to Create Desktop and Startmenu Shortcut Links Dynamically

Post by Sharkbone »

jvierra wrote: Thu Mar 04, 2021 3:51 am There is no reason why you cannot get the links from a file. Have you tried?
@Jvierra How do I refactor that process into the script attached, Is that the best approach to add lnks and urls dynamically?. That was my question :) . I am at the beginner level when it comes to posh and will need some pointers. A sample script could help.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Logon Script to Create Desktop and Startmenu Shortcut Links Dynamically

Post by jvierra »

I suggest learning how to use files in PowerShell.

Here is a book that will get you started in PowerShell the right way. It is downloadable and free. Most of your questions will be answered in the first few chapters.

https://www.sapien.com/books_training/W ... werShell-4
Sharkbone
Posts: 3
Last visit: Mon Jun 14, 2021 3:39 am

Re: Logon Script to Create Desktop and Startmenu Shortcut Links Dynamically

Post by Sharkbone »

Will have a look. Thanks for sharing
jvierra wrote: Thu Mar 04, 2021 4:06 am I suggest learning how to use files in PowerShell.

Here is a book that will get you started in PowerShell the right way. It is downloadable and free. Most of your questions will be answered in the first few chapters.

https://www.sapien.com/books_training/W ... werShell-4
This topic is 3 years and 2 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked