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.
Locked
Sharkbone
Posts: 3
Last visit: Thu Mar 04, 2021 1:43 pm

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 42 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: 14825
Last visit: Thu Jun 10, 2021 11:20 pm
Answers: 10
Has voted: 3 times
Been upvoted: 10 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: Thu Mar 04, 2021 1:43 pm

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: 14825
Last visit: Thu Jun 10, 2021 11:20 pm
Answers: 10
Has voted: 3 times
Been upvoted: 10 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: Thu Mar 04, 2021 1:43 pm

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

Locked