SOLVED

deleting a shortcut on desktop via intune

%3CLINGO-SUB%20id%3D%22lingo-sub-3256162%22%20slang%3D%22en-US%22%3Edeleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3256162%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20do%20I%20delete%20a%20shortcut%20via%20intune%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20created%20a%20shortcut%20using%20powershell%20but%20I%20had%20to%20update%20the%20URL%20which%20seems%20to%20have%20broke%20the%20shortcut%20so%20need%20to%20delete%20it%20and%20redeploy%20a%20new%20shortcut.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20help!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3256162%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Friday%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EConditional%20Access%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EGraph%20API%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EIntune%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMobile%20Application%20Management%20(MAM)%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMobile%20Device%20Management%20(MDM)%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESoftware%20Management%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257737%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257737%22%20slang%3D%22en-US%22%3EIt%20should%20clear%20up%20the%20next%20time%2C%20it%20gives%20you%20the%20status%20'with%20issues'%20because%20it%20detected%20a%20condition%20that%20you%20don't%20want%20(Shortcut%20exists)%20Remediation%20worked%2C%20issue%20fixed%2C%20and%20it%20should%20report%20'Without%20issues'%20later%20on%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257731%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257731%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1209009%22%20target%3D%22_blank%22%3E%40Harm_Veenstra%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20now%20confused%20aha%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202022-03-15%20at%203.17.47%20PM.png%22%20style%3D%22width%3A%20905px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F355929i92C4AA5AB501F42C%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202022-03-15%20at%203.17.47%20PM.png%22%20alt%3D%22Screenshot%202022-03-15%20at%203.17.47%20PM.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EIssue%20fixed%20on%20remediation%20status%20but%20with%20issues%20on%20detection%20status%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257653%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257653%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F575283%22%20target%3D%22_blank%22%3E%40AB21805%3C%2FA%3E%26nbsp%3BChanged%20it%20to%20handle%20both%20situations%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDetection%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%24desktop%20%3D%20%5BEnvironment%5D%3A%3AGetFolderPath(%22Desktop%22)%0Aif%20(Test-Path%20-Path%20%22%24(%24desktop)%5CWifi%20Connect.lnk%22)%20%7B%0A%20%20%20%20write-Host%20Found%20shortcut%0A%20%20%20%20exit%201%0A%7D%0AElse%20%7B%0A%20%20%20%20Write-Host%20Shortcut%20not%20found%0A%20%20%20%20exit%200%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERemediation%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E%24desktop%20%3D%20%5BEnvironment%5D%3A%3AGetFolderPath(%22Desktop%22)%0ARemove-Item%20-Path%20%22%24(%24desktop)%5CWifi%20Connect.lnk%22%20-Force%3A%24true%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257641%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257641%22%20slang%3D%22en-US%22%3Esome%20students%20have%20got%20this%20set%20up%20too.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20would%20think%20I%20need%20to%20put%20both%20in%20the%20script%2C%20is%20that%20possible%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257592%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257592%22%20slang%3D%22en-US%22%3EBut%20do%20you%20redirect%20the%20desktop%2Fmy%20documents%2Fmy%20pictures%20to%20OneDrive%3F%20Because%20then%20the%20path%20would%20be%20different%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257590%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257590%22%20slang%3D%22en-US%22%3EYes%2C%20in%20case%20of%20spaces%20in%20file%20or%20directory%20you%20need%20to%20escape%20that.%20You%20can%20test%20it%20on%20your%20own%20machine%20by%20creating%20the%20wifi%20connect%20shortcut%20on%20your%20desktop.%20You%20did%20forget%20the%20closing%20)-sign%20%2C%20it%20should%20be%20like%20this%3A%3CBR%20%2F%3E%3CBR%20%2F%3Eif%20(Test-Path%20-Path%20%22%24(%24env%3AUSERPROFILE)%5Cdesktop%5CWifi%20Connect.lnk%22)%20%7B%3CBR%20%2F%3Ewrite-Host%20Found%20shortcut%3CBR%20%2F%3Eexit%201%3CBR%20%2F%3E%7D%3CBR%20%2F%3EElse%20%7B%3CBR%20%2F%3EWrite-Host%20Shortcut%20not%20found%3CBR%20%2F%3Eexit%200%3CBR%20%2F%3E%7D%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257584%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257584%22%20slang%3D%22en-US%22%3ESo%20would%20that%20look%20like%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3Eif%20(Test-Path%20-Path%20%22%24(%24env%3AUSERPROFILE)%5Cdesktop%5CWifi%20Connect.lnk%22%20%7B%3CBR%20%2F%3Ewrite-Host%20Found%20shortcut%3CBR%20%2F%3Eexit%201%3CBR%20%2F%3E%7D%3CBR%20%2F%3EElse%20%7B%3CBR%20%2F%3EWrite-Host%20Shortcut%20not%20found%3CBR%20%2F%3Eexit%200%3CBR%20%2F%3E%7D%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257576%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257576%22%20slang%3D%22en-US%22%3EAnd%20also%20for%20the%20detection%20%3Ap%3C%2Fimg%3E%20(Change%20the%20path)%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257573%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257573%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1209009%22%20target%3D%22_blank%22%3E%40Harm_Veenstra%3C%2FA%3E%26nbsp%3BThanks%20does%20this%20look%20better%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202022-03-15%20at%201.50.53%20PM.png%22%20style%3D%22width%3A%20846px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F355869i92D60054F09A4CE7%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202022-03-15%20at%201.50.53%20PM.png%22%20alt%3D%22Screenshot%202022-03-15%20at%201.50.53%20PM.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257559%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257559%22%20slang%3D%22en-US%22%3E%3CP%3ETwo%20things%20%3A)%3C%2Fimg%3E%3CBR%20%2F%3E1-%20Use%20Remove-Item%20%22%24(%24env%3AUSERPROFILE)%5Cdesktop%5CWifi%20Connect.lnk%22%20-force%3A%24true%20because%20there's%20space%20in%20the%20filename%3CBR%20%2F%3E2-%20You're%20not%20running%20it%20as%20the%20logged%20in%20user%20in%20the%20Remediation%20screenshot%20that%20your%20shared%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257537%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257537%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1209009%22%20target%3D%22_blank%22%3E%40Harm_Veenstra%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESame%20issue%20again%20hasnt%20run.%20I%20have%20checked%20the%20agent%20extractor%20and%20I%20noticed%20this%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Capture.PNG%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F355860i6A65C83105D007DA%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Capture.PNG%22%20alt%3D%22Capture.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20can%20I%20try%20to%20fix%20this%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257402%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257402%22%20slang%3D%22en-US%22%3Eyes%20they%20are!%20I%20will%20let%20you%20know%20how%20I%20get%20on%20with%20this!%20Thanks%20again!%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257400%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257400%22%20slang%3D%22en-US%22%3EI%20don't%20think%20it%20really%20matters%20in%20this%20case%20what%20version%20you%20use%2C%20you're%20client%20are%20all%2064bit%20I%20guess%20%3B)%3C%2Fimg%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257396%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257396%22%20slang%3D%22en-US%22%3E%3CP%3EAll%20set%20up%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAre%20the%20config%20correct%20like%2064%20bit%20powershell%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202022-03-15%20at%2011.29.24%20AM.png%22%20style%3D%22width%3A%20835px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F355819i6590B4BE5F31D09E%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202022-03-15%20at%2011.29.24%20AM.png%22%20alt%3D%22Screenshot%202022-03-15%20at%2011.29.24%20AM.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257390%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257390%22%20slang%3D%22en-US%22%3EOk..%20Just%20put%20in%20a%20Notepad%20and%20copy%2Fpaste%20from%20there%20perhaps%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257386%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257386%22%20slang%3D%22en-US%22%3Eso%20strange%20today%20any%20code%20I%20make%20in%20powershell%20and%20upload%20to%20proactive%20analytics%20area%20in%20endpoint%20comes%20up%20with%20those%20random%20code%20ill%20try%20using%20visual%20studio%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257369%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257369%22%20slang%3D%22en-US%22%3EIt%20should%20be%20like%20it%20is%20in%20my%20post%2C%20I%20think%20copy%2Fpaste%20destroyed%20the%20formatting%20in%20the%20first%20line%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257356%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257356%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1209009%22%20target%3D%22_blank%22%3E%40Harm_Veenstra%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoes%20this%20look%20correct%3F%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202022-03-15%20at%2010.36.13%20AM.png%22%20style%3D%22width%3A%20822px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F355811i3A7C69FC223FCE4D%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202022-03-15%20at%2010.36.13%20AM.png%22%20alt%3D%22Screenshot%202022-03-15%20at%2010.36.13%20AM.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDont%20know%20whats%20at%20the%20beginning%20of%20each%20script%20with%20those%20random%20symbols%20as%20I%20didnt%20include%20that%20when%20putting%20scripts%20in%20powershell%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257343%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257343%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F575283%22%20target%3D%22_blank%22%3E%40AB21805%3C%2FA%3E%26nbsp%3BRemediation%20script%20would%20be%20better%2C%20it's%20more%20difficult%20running%20a%20uninstall%20and%20detection%20for%20user%20things...%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDetection%20script%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3Eif%20(Test-Path%20-Path%20%24env%3AUSERPROFILE%5CDesktop%5Cshortcut.lnk)%20%7B%0A%20%20%20write-Host%20Found%20shortcut%0A%20%20%20exit%201%0A%7D%0AElse%20%7B%0A%20%20%20Write-Host%20Shortcut%20not%20found%0A%20%20%20exit%200%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3ERemediation%20script%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3ERemove-Item%20%24env%3AUSERPROFILE%5CDesktop%5Cshortcut.lnk%20-Force%3A%24true%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257326%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257326%22%20slang%3D%22en-US%22%3EHow%20would%20I%20do%20this%3F%20either%20option%20would%20be%20fine%20I%20just%20really%20need%20to%20get%20this%20shortcut%20off%20as%20the%20link%20doesnt%20seem%20to%20be%20replaced%20with%20the%20correct%20one.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20used%20this%20site%2Fscript%20to%20create%20the%20shortcut%3A%20%3CA%20href%3D%22https%3A%2F%2Fwww.thelazyadministrator.com%2F2019%2F11%2F14%2Fdeploy-web-link-shortcuts-to-the-desktop-and-start-menu-using-intune%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.thelazyadministrator.com%2F2019%2F11%2F14%2Fdeploy-web-link-shortcuts-to-the-desktop-and-start-menu-using-intune%2F%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3ESo%20im%20guessing%20the%20win%20package%20would%20point%20to%20a%20script%3F%20What%20would%20the%20script%20contain%3F%20to%20delete%20from%20users%20desktop%3F%20Would%20I%20create%20a%20detection%20file%20with%20the%20win32%20app%20or%20after%20so%20that%20the%20shortcuts%20deleted%20first%20%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257321%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257321%22%20slang%3D%22en-US%22%3EScripts%20work%20as%20system%2C%20so%20that's%20not%20going%20to%20work%20indeed.%20So%2C%20Remediation%20is%20an%20option%20but%20you%20have%20issues%20doing%20that%20somehow%20now...%20You%20could%20also%20create%20a%20Win32%20package%20and%20run%20that%20as%20user%20to%20delete%20the%20file%20but..%20Detection%20is%20done%20as%20system%20there%2C%20you%20could%20create%20a%20file%20in%20c%3A%5Cprogramdata%5Ccompany%5Cshortcutdelete%5Cshortcut.txt%20somehting%20and%20check%20on%20that.%20If%20not%20there%2C%20run%20the%20install.cmd%20from%20the%20Win32%20package%20which%20deletes%20the%20file%20from%20the%20desktop%20and%20creates%20the%20shortcut.txt%20file%20so%20that%20is%20does%20not%20run%20again..%3CBR%20%2F%3E%3CBR%20%2F%3EBut..%20You're%20main%20question%20was%3A%20%22I%20have%20created%20a%20shortcut%20using%20powershell%20but%20I%20had%20to%20update%20the%20URL%20which%20seems%20to%20have%20broke%20the%20shortcut%20so%20need%20to%20delete%20it%20and%20redeploy%20a%20new%20shortcut.%20%22%20You%20could%20create%20a%20new%20package%20which%20deletes%20the%20old%20shortcut%2Freplaces%20the%20shortcut%20and%20does%20a%20detection%20on%20a%20file%20like%20I%20mentioned%20before%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3257302%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3257302%22%20slang%3D%22en-US%22%3EHi%3CBR%20%2F%3E%3CBR%20%2F%3EThis%20doesnt%20work%20for%20me%2C%20the%20shortcuts%20are%20in%20C%3A%5Cusers%5Ctheuser%5CDesktop%3CBR%20%2F%3E%3CBR%20%2F%3EIs%20there%20a%20way%20I%20can%20create%20a%20script%20to%20delete%20it%20via%20the%20user%20logged%20in's%20desktop%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3256595%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3256595%22%20slang%3D%22en-US%22%3EScripts%20in%20Devices%20should%20also%20work%2C%20if%20you%20know%20the%20filename%20and%20it%20only%20has%20to%20run%20once..%20(%22remove-item%20c%3A%5Cusers%5Cpublic%5Cdesktop%5Cshortcut.url%22)%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3256571%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3256571%22%20slang%3D%22en-US%22%3EOkay%20thanks%20I%E2%80%99ll%20take%20a%20look%20tomorrow%20when%20I%20have%20the%20device%20again!%3CBR%20%2F%3E%3CBR%20%2F%3EIs%20there%20another%20way%20from%20just%20powershell%20scripts%20area%20%2F%20configuration%20policies%20that%20will%20do%20the%20same%20thing%20%3F%20Just%20incase%20I%20can%E2%80%99t%20figure%20this%20out%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3256537%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3256537%22%20slang%3D%22en-US%22%3EThat%20or%20the%20AgentExecutor%20logfile%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3256501%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3256501%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1209009%22%20target%3D%22_blank%22%3E%40Harm_Veenstra%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERemediation%3A%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%26lt%3B%23%3C%2FP%3E%3CP%20class%3D%22%22%3E.SYNOPSIS%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3EDetect%20and%20remove%20desktop%20shortcuts%20using%20Proactive%20Remediations%20in%20Microft%20Endpoint%20Manager.%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E.DESCRIPTION%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3EDetect%20and%20remove%20desktop%20shortcuts%20using%20Proactive%20Remediations%20in%20Microft%20Endpoint%20Manager.%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3EShortcuts%20on%20All%20Users%20desktop%20(public%20desktop)%20or%20the%20current%20user's%20desktop%20can%20be%20detected%20and%20removed.%3C%2FP%3E%3CP%20class%3D%22%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22%22%3E.NOTES%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3EFilename%3A%20Remediation-DeleteShortcuts.ps1%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3EVersion%3A%201.0%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3EAuthor%3A%20Martin%20Bengtsson%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3EBlog%3A%20%3CA%20href%3D%22http%3A%2F%2Fwww.imab.dk%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ewww.imab.dk%3C%2FA%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3ETwitter%3A%20%40mwbengtsson%3C%2FP%3E%3CP%20class%3D%22%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22%22%3E.LINK%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fimab.dk%2Fremove-desktop-shortcuts-for-the-current-user-and-public-profile-using-powershell-and-proactive-remediations%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fimab.dk%2Fremove-desktop-shortcuts-for-the-current-user-and-public-profile-using-powershell-and-proactive-remediations%3C%2FA%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%23%26gt%3B%3C%2FP%3E%3CP%20class%3D%22%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22%22%3E%23region%20Functions%3C%2FP%3E%3CP%20class%3D%22%22%3E%23Getting%20the%20current%20user's%20username%20by%20querying%20the%20explorer.exe%20process%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3Efunction%3C%2FSPAN%3E%20Get-CurrentUser%3CSPAN%20class%3D%22%22%3E()%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Etry%3C%2FSPAN%3E%20%7B%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%24currentUser%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EGet-Process%3C%2FSPAN%3E%20-IncludeUserName%20-Name%20%3CSPAN%20class%3D%22%22%3Eexplorer%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%7C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3ESelect-Object%3C%2FSPAN%3E%20-First%20%3CSPAN%20class%3D%22%22%3E1%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%7C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3ESelect-Object%3C%2FSPAN%3E%20-ExpandProperty%20%3CSPAN%20class%3D%22%22%3EUserName%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3ESplit(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%22%5C%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Ecatch%3C%2FSPAN%3E%20%7B%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%22Failed%20to%20get%20current%20user.%22%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eif%3C%2FSPAN%3E%20(%3CSPAN%20class%3D%22%22%3E-NOT%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Estring%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5D%3A%3A%3C%2FSPAN%3EIsNullOrEmpty(%3CSPAN%20class%3D%22%22%3E%24currentUser%3C%2FSPAN%3E))%20%7B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3EWrite-Output%20%3CSPAN%20class%3D%22%22%3E%24currentUser%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%23Getting%20the%20current%20user's%20SID%20by%20using%20the%20user's%20username%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3Efunction%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3EGet-UserSID%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Estring%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5D%3C%2FSPAN%3E%24fCurrentUser%3CSPAN%20class%3D%22%22%3E)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Etry%3C%2FSPAN%3E%20%7B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%24user%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3ENew-Object%3C%2FSPAN%3E%20System.Security.Principal.NTAccount%3CSPAN%20class%3D%22%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%24fcurrentUser%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E)%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%24sid%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%24user%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3ETranslate(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5B%3C%2FSPAN%3ESystem.Security.Principal.SecurityIdentifier%3CSPAN%20class%3D%22%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E)%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Ecatch%3C%2FSPAN%3E%20%7B%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%22Failed%20to%20get%20current%20user%20SID.%22%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eif%3C%2FSPAN%3E%20(%3CSPAN%20class%3D%22%22%3E-NOT%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Estring%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5D%3A%3A%3C%2FSPAN%3EIsNullOrEmpty(%3CSPAN%20class%3D%22%22%3E%24sid%3C%2FSPAN%3E))%20%7B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%24sid%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E.%3C%2FSPAN%3EValue%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%23Getting%20the%20current%20user's%20desktop%20path%20by%20querying%20registry%20with%20the%20user's%20SID%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3Efunction%3C%2FSPAN%3E%20Get-CurrentUserDesktop%3CSPAN%20class%3D%22%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Estring%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%24fUserRegistryPath%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Etry%3C%2FSPAN%3E%20%7B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eif%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3ETest-Path%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E-Path%3C%2FSPAN%3E%20%24fUserRegistryPath%3CSPAN%20class%3D%22%22%3E)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%24currentUserDesktop%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EGet-ItemProperty%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E-Path%3C%2FSPAN%3E%20%24fUserRegistryPath%20%3CSPAN%20class%3D%22%22%3E-Name%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3EDesktop%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E-ErrorAction%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3EIgnore%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EDesktop%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Ecatch%3C%2FSPAN%3E%20%7B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%22Failed%20to%20get%20current%20user's%20desktop%22%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eif%3C%2FSPAN%3E%20(%3CSPAN%20class%3D%22%22%3E-NOT%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Estring%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5D%3A%3A%3C%2FSPAN%3EIsNullOrEmpty(%3CSPAN%20class%3D%22%22%3E%24currentUserDesktop%3C%2FSPAN%3E))%20%7B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%24currentUserDesktop%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%23endregion%3C%2FP%3E%3CP%20class%3D%22%22%3E%23region%20Execution%3C%2FP%3E%3CP%20class%3D%22%22%3Etry%3CSPAN%20class%3D%22%22%3E%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%23Edit%20here%20with%20names%20of%20the%20shortcuts%20you%20want%20removed%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%24shortCutNames%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20%40(%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%22*WiFi%20Connect*%22%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E)%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%23Create%20empty%20array%20for%20shortcutsFound%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%24shortcutsFound%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20%40()%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%23Retrieving%20current%20user%20and%20current%20user's%20SID%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%24currentUser%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%20Get-CurrentUser%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%24currentUserSID%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3EGet-UserSID%3C%2FSPAN%3E%20%24currentUser%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%23%20Getting%20the%20AllUsers%20desktop%20path%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%24allUsersDesktop%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EEnvironment%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5D%3A%3A%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EGetFolderPath(%3C%2FSPAN%3E%22CommonDesktopDirectory%22%3CSPAN%20class%3D%22%22%3E)%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%24userRegistryPath%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%20%22Registry%3A%3AHKEY_USERS%5C%3CSPAN%20class%3D%22%22%3E%24(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%24currentUserSID%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E)%3C%2FSPAN%3E%5CSOFTWARE%5CMicrosoft%5CWindows%5CCurrentVersion%5CExplorer%5CShell%20Folders%22%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%24currentUserDesktop%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3EGet-CurrentUserDesktop%3C%2FSPAN%3E%20%24userRegistryPath%3C%2FP%3E%3CP%20class%3D%22%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eif%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3ETest-Path%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E-Path%3C%2FSPAN%3E%20%24allUsersDesktop%3CSPAN%20class%3D%22%22%3E)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eforeach%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20(%3C%2FSPAN%3E%24ShortcutName%20%3CSPAN%20class%3D%22%22%3Ein%3C%2FSPAN%3E%20%24shortCutNames%3CSPAN%20class%3D%22%22%3E)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%24shortCutsFound%20%3CSPAN%20class%3D%22%22%3E%2B%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3EGet-ChildItem%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E-Path%3C%2FSPAN%3E%20%24allUsersDesktop%20%3CSPAN%20class%3D%22%22%3E-Filter%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E*.lnk%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%7C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3EWhere-Object%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20%7B%3C%2FSPAN%3E%24_%3CSPAN%20class%3D%22%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EName%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E-like%3C%2FSPAN%3E%20%24shortCutName%3CSPAN%20class%3D%22%22%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eif%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3ETest-Path%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E-Path%3C%2FSPAN%3E%20%24currentUserDesktop%3CSPAN%20class%3D%22%22%3E)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eforeach%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20(%3C%2FSPAN%3E%24ShortcutName%20%3CSPAN%20class%3D%22%22%3Ein%3C%2FSPAN%3E%20%24shortCutNames%3CSPAN%20class%3D%22%22%3E)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%24shortCutsFound%20%3CSPAN%20class%3D%22%22%3E%2B%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3EGet-ChildItem%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E-Path%3C%2FSPAN%3E%20%24currentUserDesktop%20%3CSPAN%20class%3D%22%22%3E-Filter%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E*.lnk%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%7C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3EWhere-Object%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20%7B%3C%2FSPAN%3E%24_%3CSPAN%20class%3D%22%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EName%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E-like%3C%2FSPAN%3E%20%24shortCutName%3CSPAN%20class%3D%22%22%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eif%3C%2FSPAN%3E%20(%3CSPAN%20class%3D%22%22%3E-NOT%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Estring%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5D%3A%3A%3C%2FSPAN%3EIsNullOrEmpty(%3CSPAN%20class%3D%22%22%3E%24shortcutsFound%3C%2FSPAN%3E))%20%7B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%22Desktop%20shortcuts%20found.%20Returning%20True%22%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%24shortcutsFoundStatus%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%20%24true%3C%2FP%3E%3CP%20class%3D%22%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eelseif%3C%2FSPAN%3E%20(%3CSPAN%20class%3D%22%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Estring%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5D%3A%3A%3C%2FSPAN%3EIsNullOrEmpty(%3CSPAN%20class%3D%22%22%3E%24shortcutsFound%3C%2FSPAN%3E))%20%7B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%22Desktop%20shortcuts%20NOT%20found.%20Returning%20False%22%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%24shortcutsFoundStatus%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%20%24false%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3Ecatch%3CSPAN%20class%3D%22%22%3E%20%7B%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%22Something%20went%20wrong%20during%20running%20of%20the%20script.%20Variable%20values%20are%3A%20%3CSPAN%20class%3D%22%22%3E%24currentUser%3C%2FSPAN%3E%2C%3CSPAN%20class%3D%22%22%3E%24currentUserSID%3C%2FSPAN%3E%2C%3CSPAN%20class%3D%22%22%3E%24allUsersDesktop%3C%2FSPAN%3E%2C%3CSPAN%20class%3D%22%22%3E%24currentUserDesktop%3C%2FSPAN%3E%22%3C%2FP%3E%3CP%20class%3D%22%22%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22%22%3Efinally%3CSPAN%20class%3D%22%22%3E%20%7B%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eif%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20(%3C%2FSPAN%3E%24shortcutsFoundStatus%20%3CSPAN%20class%3D%22%22%3E-eq%3C%2FSPAN%3E%20%24true%3CSPAN%20class%3D%22%22%3E)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%22shortcutsFoundStatus%20equals%20True.%20Removing%20shortcuts...%22%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eforeach%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20(%3C%2FSPAN%3E%24shortcut%20%3CSPAN%20class%3D%22%22%3Ein%3C%2FSPAN%3E%20%24shortcutsFound%3CSPAN%20class%3D%22%22%3E)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Etry%3C%2FSPAN%3E%20%7B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3ERemove-Item%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E-Path%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%24shortcut%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E.%3C%2FSPAN%3EFullName%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Ecatch%3C%2FSPAN%3E%20%7B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%22Failed%20to%20remove%20shortcut%3A%20%3CSPAN%20class%3D%22%22%3E%24(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%24shortcut%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EName)%3C%2FSPAN%3E%22%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eelseif%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20(%3C%2FSPAN%3E%24shortcutsFoundStatus%20%3CSPAN%20class%3D%22%22%3E-eq%3C%2FSPAN%3E%20%24false%3CSPAN%20class%3D%22%22%3E)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%22shortcutsFoundStatus%20equals%20False.%20Doing%20nothing%22%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%23endregion%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3EDetection%3A%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%26lt%3B%23%3C%2FP%3E%3CP%20class%3D%22%22%3E.SYNOPSIS%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3EDetect%20and%20remove%20desktop%20shortcuts%20using%20Proactive%20Remediations%20in%20Microft%20Endpoint%20Manager.%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E.DESCRIPTION%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3EDetect%20and%20remove%20desktop%20shortcuts%20using%20Proactive%20Remediations%20in%20Microft%20Endpoint%20Manager.%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3EShortcuts%20on%20All%20Users%20desktop%20(public%20desktop)%20or%20the%20current%20user's%20desktop%20can%20be%20detected%20and%20removed.%3C%2FP%3E%3CP%20class%3D%22%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22%22%3E.NOTES%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3EFilename%3A%20Detection-DeleteShortcuts.ps1%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3EVersion%3A%201.0%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3EAuthor%3A%20Martin%20Bengtsson%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3EBlog%3A%20%3CA%20href%3D%22http%3A%2F%2Fwww.imab.dk%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ewww.imab.dk%3C%2FA%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3ETwitter%3A%20%40mwbengtsson%3C%2FP%3E%3CP%20class%3D%22%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22%22%3E.LINK%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fimab.dk%2Fremove-desktop-shortcuts-for-the-current-user-and-public-profile-using-powershell-and-proactive-remediations%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fimab.dk%2Fremove-desktop-shortcuts-for-the-current-user-and-public-profile-using-powershell-and-proactive-remediations%3C%2FA%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%23%26gt%3B%3C%2FP%3E%3CP%20class%3D%22%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22%22%3E%23region%20Functions%3C%2FP%3E%3CP%20class%3D%22%22%3E%23Getting%20the%20current%20user's%20username%20by%20querying%20the%20explorer.exe%20process%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3Efunction%3C%2FSPAN%3E%20Get-CurrentUser%3CSPAN%20class%3D%22%22%3E()%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Etry%3C%2FSPAN%3E%20%7B%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%24currentUser%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EGet-Process%3C%2FSPAN%3E%20-IncludeUserName%20-Name%20%3CSPAN%20class%3D%22%22%3Eexplorer%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%7C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3ESelect-Object%3C%2FSPAN%3E%20-First%20%3CSPAN%20class%3D%22%22%3E1%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%7C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3ESelect-Object%3C%2FSPAN%3E%20-ExpandProperty%20%3CSPAN%20class%3D%22%22%3EUserName%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3ESplit(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%22%5C%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Ecatch%3C%2FSPAN%3E%20%7B%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%22Failed%20to%20get%20current%20user.%22%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eif%3C%2FSPAN%3E%20(%3CSPAN%20class%3D%22%22%3E-NOT%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Estring%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5D%3A%3A%3C%2FSPAN%3EIsNullOrEmpty(%3CSPAN%20class%3D%22%22%3E%24currentUser%3C%2FSPAN%3E))%20%7B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3EWrite-Output%20%3CSPAN%20class%3D%22%22%3E%24currentUser%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%23Getting%20the%20current%20user's%20SID%20by%20using%20the%20user's%20username%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3Efunction%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3EGet-UserSID%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Estring%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5D%3C%2FSPAN%3E%24fCurrentUser%3CSPAN%20class%3D%22%22%3E)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Etry%3C%2FSPAN%3E%20%7B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%24user%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3ENew-Object%3C%2FSPAN%3E%20System.Security.Principal.NTAccount%3CSPAN%20class%3D%22%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%24fcurrentUser%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E)%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%24sid%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%24user%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3ETranslate(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5B%3C%2FSPAN%3ESystem.Security.Principal.SecurityIdentifier%3CSPAN%20class%3D%22%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E)%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Ecatch%3C%2FSPAN%3E%20%7B%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%22Failed%20to%20get%20current%20user%20SID.%22%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eif%3C%2FSPAN%3E%20(%3CSPAN%20class%3D%22%22%3E-NOT%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Estring%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5D%3A%3A%3C%2FSPAN%3EIsNullOrEmpty(%3CSPAN%20class%3D%22%22%3E%24sid%3C%2FSPAN%3E))%20%7B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%24sid%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E.%3C%2FSPAN%3EValue%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%23Getting%20the%20current%20user's%20desktop%20path%20by%20querying%20registry%20with%20the%20user's%20SID%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3Efunction%3C%2FSPAN%3E%20Get-CurrentUserDesktop%3CSPAN%20class%3D%22%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Estring%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5D%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%24fUserRegistryPath%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Etry%3C%2FSPAN%3E%20%7B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eif%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3ETest-Path%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E-Path%3C%2FSPAN%3E%20%24fUserRegistryPath%3CSPAN%20class%3D%22%22%3E)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%24currentUserDesktop%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EGet-ItemProperty%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E-Path%3C%2FSPAN%3E%20%24fUserRegistryPath%20%3CSPAN%20class%3D%22%22%3E-Name%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3EDesktop%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E-ErrorAction%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3EIgnore%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EDesktop%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Ecatch%3C%2FSPAN%3E%20%7B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%22Failed%20to%20get%20current%20user's%20desktop%22%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eif%3C%2FSPAN%3E%20(%3CSPAN%20class%3D%22%22%3E-NOT%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Estring%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5D%3A%3A%3C%2FSPAN%3EIsNullOrEmpty(%3CSPAN%20class%3D%22%22%3E%24currentUserDesktop%3C%2FSPAN%3E))%20%7B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%24currentUserDesktop%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%23endregion%3C%2FP%3E%3CP%20class%3D%22%22%3E%23region%20Execution%3C%2FP%3E%3CP%20class%3D%22%22%3Etry%3CSPAN%20class%3D%22%22%3E%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%23Edit%20here%20with%20names%20of%20the%20shortcuts%20you%20want%20removed%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%24shortCutNames%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20%40(%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%22*WiFi%20Connect*%22%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E)%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%23Create%20empty%20array%20for%20shortcutsFound%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%24shortcutsFound%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20%40()%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%23Retrieving%20current%20user%20and%20current%20user's%20SID%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%24currentUser%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%20Get-CurrentUser%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%24currentUserSID%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3EGet-UserSID%3C%2FSPAN%3E%20%24currentUser%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%23%20Getting%20the%20AllUsers%20desktop%20path%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%24allUsersDesktop%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EEnvironment%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5D%3A%3A%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EGetFolderPath(%3C%2FSPAN%3E%22CommonDesktopDirectory%22%3CSPAN%20class%3D%22%22%3E)%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%24userRegistryPath%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%20%22Registry%3A%3AHKEY_USERS%5C%3CSPAN%20class%3D%22%22%3E%24(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%24currentUserSID%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E)%3C%2FSPAN%3E%5CSOFTWARE%5CMicrosoft%5CWindows%5CCurrentVersion%5CExplorer%5CShell%20Folders%22%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%24currentUserDesktop%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3EGet-CurrentUserDesktop%3C%2FSPAN%3E%20%24userRegistryPath%3C%2FP%3E%3CP%20class%3D%22%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eif%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3ETest-Path%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E-Path%3C%2FSPAN%3E%20%24allUsersDesktop%3CSPAN%20class%3D%22%22%3E)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eforeach%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20(%3C%2FSPAN%3E%24ShortcutName%20%3CSPAN%20class%3D%22%22%3Ein%3C%2FSPAN%3E%20%24shortCutNames%3CSPAN%20class%3D%22%22%3E)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%24shortCutsFound%20%3CSPAN%20class%3D%22%22%3E%2B%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3EGet-ChildItem%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E-Path%3C%2FSPAN%3E%20%24allUsersDesktop%20%3CSPAN%20class%3D%22%22%3E-Filter%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E*.lnk%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%7C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3EWhere-Object%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20%7B%3C%2FSPAN%3E%24_%3CSPAN%20class%3D%22%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EName%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E-like%3C%2FSPAN%3E%20%24shortCutName%3CSPAN%20class%3D%22%22%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eif%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20(%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3ETest-Path%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E-Path%3C%2FSPAN%3E%20%24currentUserDesktop%3CSPAN%20class%3D%22%22%3E)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eforeach%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20(%3C%2FSPAN%3E%24ShortcutName%20%3CSPAN%20class%3D%22%22%3Ein%3C%2FSPAN%3E%20%24shortCutNames%3CSPAN%20class%3D%22%22%3E)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%24shortCutsFound%20%3CSPAN%20class%3D%22%22%3E%2B%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3EGet-ChildItem%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E-Path%3C%2FSPAN%3E%20%24currentUserDesktop%20%3CSPAN%20class%3D%22%22%3E-Filter%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E*.lnk%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%7C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3EWhere-Object%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20%7B%3C%2FSPAN%3E%24_%3CSPAN%20class%3D%22%22%3E.%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EName%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E-like%3C%2FSPAN%3E%20%24shortCutName%3CSPAN%20class%3D%22%22%3E%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eif%3C%2FSPAN%3E%20(%3CSPAN%20class%3D%22%22%3E-NOT%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Estring%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5D%3A%3A%3C%2FSPAN%3EIsNullOrEmpty(%3CSPAN%20class%3D%22%22%3E%24shortcutsFound%3C%2FSPAN%3E))%20%7B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%22Desktop%20shortcuts%20found.%20Returning%20True%22%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%24shortcutsFoundStatus%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%20%24true%3C%2FP%3E%3CP%20class%3D%22%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eelseif%3C%2FSPAN%3E%20(%3CSPAN%20class%3D%22%22%3E%5B%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Estring%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%5D%3A%3A%3C%2FSPAN%3EIsNullOrEmpty(%3CSPAN%20class%3D%22%22%3E%24shortcutsFound%3C%2FSPAN%3E))%20%7B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%22Desktop%20shortcuts%20NOT%20found.%20Returning%20False%22%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%24shortcutsFoundStatus%20%3CSPAN%20class%3D%22%22%3E%3D%3C%2FSPAN%3E%20%24false%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3Ecatch%3CSPAN%20class%3D%22%22%3E%20%7B%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%22Something%20went%20wrong%20during%20running%20of%20the%20script.%20Variable%20values%20are%3A%20%3CSPAN%20class%3D%22%22%3E%24currentUser%3C%2FSPAN%3E%2C%3CSPAN%20class%3D%22%22%3E%24currentUserSID%3C%2FSPAN%3E%2C%3CSPAN%20class%3D%22%22%3E%24allUsersDesktop%3C%2FSPAN%3E%2C%3CSPAN%20class%3D%22%22%3E%24currentUserDesktop%3C%2FSPAN%3E%22%3C%2FP%3E%3CP%20class%3D%22%22%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22%22%3Efinally%3CSPAN%20class%3D%22%22%3E%20%7B%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eif%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20(%3C%2FSPAN%3E%24shortcutsFoundStatus%20%3CSPAN%20class%3D%22%22%3E-eq%3C%2FSPAN%3E%20%24true%3CSPAN%20class%3D%22%22%3E)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%22shortcutsFoundStatus%20equals%20True.%20Exiting%20with%201%22%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eexit%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E1%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eelseif%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3E%20(%3C%2FSPAN%3E%24shortcutsFoundStatus%20%3CSPAN%20class%3D%22%22%3E-eq%3C%2FSPAN%3E%20%24false%3CSPAN%20class%3D%22%22%3E)%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3EWrite-Output%3C%2FSPAN%3E%20%22shortcutsFoundStatus%20equals%20False.%20Exiting%20with%200%22%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22%22%3Eexit%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E0%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%7D%3C%2FP%3E%3CP%20class%3D%22%22%3E%23endregion%3CSPAN%20class%3D%22%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3EFor%20logs%20I%20couldnt%20see%20much%20but%20is%20it%20the%20intunemanagementextension%20document%20I%20need%20to%20check%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%20class%3D%22%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3256480%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3256480%22%20slang%3D%22en-US%22%3E%3CP%3ECould%20you%20share%20the%20detection%20and%20remediation%20script%3F%20Anything%20showing%20in%20the%20logs%20of%20a%20client%3F%20(And%20it%20is%20a%20Windows%2010%2F11%20Enterprise%20machine%3F)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3256475%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3256475%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1209009%22%20target%3D%22_blank%22%3E%40Harm_Veenstra%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20had%20it%20running%20for%20a%20while%20now.%20I%20have%20passed%20the%20Detection%20with%20no%20issues%20but%20the%20remediation%20hasnt%20run%20yet%20and%20its%20been%20like%204%20hours%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202022-03-14%20at%203.03.58%20PM.png%22%20style%3D%22width%3A%20984px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F355540iC3FE62193073609F%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202022-03-14%20at%203.03.58%20PM.png%22%20alt%3D%22Screenshot%202022-03-14%20at%203.03.58%20PM.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20used%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fwww.imab.dk%2Fremove-desktop-shortcuts-for-the-current-user-and-public-profile-using-powershell-and-proactive-remediations%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.imab.dk%2Fremove-desktop-shortcuts-for-the-current-user-and-public-profile-using-powershell-and-proactive-remediations%2F%3C%2FA%3E%26nbsp%3Bfor%20help%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20ideas%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3256268%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3256268%22%20slang%3D%22en-US%22%3EJust%20trying%20this%20now!%20thank%20you.%20I%20will%20let%20you%20know%20how%20I%20get%20on%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3256246%22%20slang%3D%22en-US%22%3ERe%3A%20deleting%20a%20shortcut%20on%20desktop%20via%20intune%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3256246%22%20slang%3D%22en-US%22%3EYou%20can%20run%20a%20Remediation%20script%20on%20your%20devices%20with%20a%20detection%20and%20remove%20script%20(If%20you%20have%20Windows%20Enterprise)%20or%20run%20a%20script%20(%3CA%20href%3D%22https%3A%2F%2Fendpoint.microsoft.com%2F%23blade%2FMicrosoft_Intune_DeviceSettings%2FDevicesMenu%2Fpowershell%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fendpoint.microsoft.com%2F%23blade%2FMicrosoft_Intune_DeviceSettings%2FDevicesMenu%2Fpowershell%3C%2FA%3E)%20which%20is%20just%20a%20%22remove-item%20c%3A%5Cusers%5Cpublic%5Cdesktop%5Cshortcut.url%22%20The%20last%20will%20run%20only%20once%20if%20succesful%20and%20is%20perhaps%20the%20fasted%20method%20now%20I%20guess%3F%3C%2FLINGO-BODY%3E
Super Contributor

Hi all,

 

How do I delete a shortcut via intune? 

 

I have created a shortcut using powershell but I had to update the URL which seems to have broke the shortcut so need to delete it and redeploy a new shortcut. 

 

Please help!

 

 

 

30 Replies
You can run a Remediation script on your devices with a detection and remove script (If you have Windows Enterprise) or run a script (https://endpoint.microsoft.com/#blade/Microsoft_Intune_DeviceSettings/DevicesMenu/powershell) which is just a "remove-item c:\users\public\desktop\shortcut.url" The last will run only once if succesful and is perhaps the fasted method now I guess?
Just trying this now! thank you. I will let you know how I get on

Hi @Harm_Veenstra 

 

I have had it running for a while now. I have passed the Detection with no issues but the remediation hasnt run yet and its been like 4 hours: 

 

Screenshot 2022-03-14 at 3.03.58 PM.png

 

I used https://www.imab.dk/remove-desktop-shortcuts-for-the-current-user-and-public-profile-using-powershel... for help 

 

Any ideas? 

Could you share the detection and remediation script? Anything showing in the logs of a client? (And it is a Windows 10/11 Enterprise machine?)

Hi @Harm_Veenstra 

 

Remediation:

 <#

.SYNOPSIS

    Detect and remove desktop shortcuts using Proactive Remediations in Microft Endpoint Manager. 

   

.DESCRIPTION

    Detect and remove desktop shortcuts using Proactive Remediations in Microft Endpoint Manager.

    Shortcuts on All Users desktop (public desktop) or the current user's desktop can be detected and removed.

 

.NOTES

    Filename: Remediation-DeleteShortcuts.ps1

    Version: 1.0

    Author: Martin Bengtsson

    Blog: www.imab.dk

    Twitter: @mwbengtsson

 

.LINK

    https://imab.dk/remove-desktop-shortcuts-for-the-current-user-and-public-profile-using-powershell-an...   

#>

 

#region Functions

#Getting the current user's username by querying the explorer.exe process

function Get-CurrentUser() {

    try { 

        $currentUser = (Get-Process -IncludeUserName -Name explorer | Select-Object -First 1 | Select-Object -ExpandProperty UserName).Split("\")[1] 

    } 

    catch { 

        Write-Output "Failed to get current user." 

    }

    if (-NOT[string]::IsNullOrEmpty($currentUser)) {

        Write-Output $currentUser

    }

}

#Getting the current user's SID by using the user's username

function Get-UserSID([string]$fCurrentUser) {

    try {

        $user = New-Object System.Security.Principal.NTAccount($fcurrentUser) 

        $sid = $user.Translate([System.Security.Principal.SecurityIdentifier]) 

    }

    catch { 

        Write-Output "Failed to get current user SID."   

    }

    if (-NOT[string]::IsNullOrEmpty($sid)) {

        Write-Output $sid.Value

    }

}

#Getting the current user's desktop path by querying registry with the user's SID

function Get-CurrentUserDesktop([string]$fUserRegistryPath) {

    try {

        if (Test-Path -Path $fUserRegistryPath) {

            $currentUserDesktop = (Get-ItemProperty -Path $fUserRegistryPath -Name Desktop -ErrorAction Ignore).Desktop

        }

    }

    catch {

        Write-Output "Failed to get current user's desktop"

    }

    if (-NOT[string]::IsNullOrEmpty($currentUserDesktop)) {

        Write-Output $currentUserDesktop

    }   

}

#endregion

#region Execution

try {

    #Edit here with names of the shortcuts you want removed

    $shortCutNames = @(

        "*WiFi Connect*"

    )

    #Create empty array for shortcutsFound

    $shortcutsFound = @()

    #Retrieving current user and current user's SID

    $currentUser = Get-CurrentUser

    $currentUserSID = Get-UserSID $currentUser

    # Getting the AllUsers desktop path

    $allUsersDesktop = [Environment]::GetFolderPath("CommonDesktopDirectory")

    $userRegistryPath = "Registry::HKEY_USERS\$($currentUserSID)\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"

    $currentUserDesktop = Get-CurrentUserDesktop $userRegistryPath

 

    if (Test-Path -Path $allUsersDesktop) {

        foreach ($ShortcutName in $shortCutNames) {

           $shortCutsFound += Get-ChildItem -Path $allUsersDesktop -Filter *.lnk | Where-Object {$_.Name -like $shortCutName}

        }

    }

    if (Test-Path -Path $currentUserDesktop) {

        foreach ($ShortcutName in $shortCutNames) {

           $shortCutsFound += Get-ChildItem -Path $currentUserDesktop -Filter *.lnk | Where-Object {$_.Name -like $shortCutName}

        }

    }

    if (-NOT[string]::IsNullOrEmpty($shortcutsFound)) {

        Write-Output "Desktop shortcuts found. Returning True"

        $shortcutsFoundStatus = $true

 

    }

    elseif ([string]::IsNullOrEmpty($shortcutsFound)) {

        Write-Output "Desktop shortcuts NOT found. Returning False"

        $shortcutsFoundStatus = $false

    }

}

catch { 

    Write-Output "Something went wrong during running of the script. Variable values are: $currentUser,$currentUserSID,$allUsersDesktop,$currentUserDesktop"

}

 

finally { 

    if ($shortcutsFoundStatus -eq $true) {

        Write-Output "shortcutsFoundStatus equals True. Removing shortcuts..."

        foreach ($shortcut in $shortcutsFound) {

            try {

                Remove-Item -Path $shortcut.FullName

            }

            catch {

                Write-Output "Failed to remove shortcut: $($shortcut.Name)"

            }

        }

    }

    elseif ($shortcutsFoundStatus -eq $false) {

        Write-Output "shortcutsFoundStatus equals False. Doing nothing"

    }

}

#endregion 

 

Detection: 

 

 <#

.SYNOPSIS

    Detect and remove desktop shortcuts using Proactive Remediations in Microft Endpoint Manager. 

   

.DESCRIPTION

    Detect and remove desktop shortcuts using Proactive Remediations in Microft Endpoint Manager.

    Shortcuts on All Users desktop (public desktop) or the current user's desktop can be detected and removed.

 

.NOTES

    Filename: Detection-DeleteShortcuts.ps1

    Version: 1.0

    Author: Martin Bengtsson

    Blog: www.imab.dk

    Twitter: @mwbengtsson

 

.LINK

    https://imab.dk/remove-desktop-shortcuts-for-the-current-user-and-public-profile-using-powershell-an...

#>

 

#region Functions

#Getting the current user's username by querying the explorer.exe process

function Get-CurrentUser() {

    try { 

        $currentUser = (Get-Process -IncludeUserName -Name explorer | Select-Object -First 1 | Select-Object -ExpandProperty UserName).Split("\")[1] 

    } 

    catch { 

        Write-Output "Failed to get current user." 

    }

    if (-NOT[string]::IsNullOrEmpty($currentUser)) {

        Write-Output $currentUser

    }

}

#Getting the current user's SID by using the user's username

function Get-UserSID([string]$fCurrentUser) {

    try {

        $user = New-Object System.Security.Principal.NTAccount($fcurrentUser) 

        $sid = $user.Translate([System.Security.Principal.SecurityIdentifier]) 

    }

    catch { 

        Write-Output "Failed to get current user SID."   

    }

    if (-NOT[string]::IsNullOrEmpty($sid)) {

        Write-Output $sid.Value

    }

}

#Getting the current user's desktop path by querying registry with the user's SID

function Get-CurrentUserDesktop([string]$fUserRegistryPath) {

    try {

        if (Test-Path -Path $fUserRegistryPath) {

            $currentUserDesktop = (Get-ItemProperty -Path $fUserRegistryPath -Name Desktop -ErrorAction Ignore).Desktop

        }

    }

    catch {

        Write-Output "Failed to get current user's desktop"

    }

    if (-NOT[string]::IsNullOrEmpty($currentUserDesktop)) {

        Write-Output $currentUserDesktop

    }   

}

#endregion

#region Execution

try {

    #Edit here with names of the shortcuts you want removed

    $shortCutNames = @(

        "*WiFi Connect*"

    )

    #Create empty array for shortcutsFound

    $shortcutsFound = @()

    #Retrieving current user and current user's SID

    $currentUser = Get-CurrentUser

    $currentUserSID = Get-UserSID $currentUser

    # Getting the AllUsers desktop path

    $allUsersDesktop = [Environment]::GetFolderPath("CommonDesktopDirectory")

    $userRegistryPath = "Registry::HKEY_USERS\$($currentUserSID)\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"

    $currentUserDesktop = Get-CurrentUserDesktop $userRegistryPath

 

    if (Test-Path -Path $allUsersDesktop) {

        foreach ($ShortcutName in $shortCutNames) {

           $shortCutsFound += Get-ChildItem -Path $allUsersDesktop -Filter *.lnk | Where-Object {$_.Name -like $shortCutName}

        }

    }

    if (Test-Path -Path $currentUserDesktop) {

        foreach ($ShortcutName in $shortCutNames) {

           $shortCutsFound += Get-ChildItem -Path $currentUserDesktop -Filter *.lnk | Where-Object {$_.Name -like $shortCutName}

        }

    }

    if (-NOT[string]::IsNullOrEmpty($shortcutsFound)) {

        Write-Output "Desktop shortcuts found. Returning True"

        $shortcutsFoundStatus = $true

 

    }

    elseif ([string]::IsNullOrEmpty($shortcutsFound)) {

        Write-Output "Desktop shortcuts NOT found. Returning False"

        $shortcutsFoundStatus = $false

    }

}

catch { 

    Write-Output "Something went wrong during running of the script. Variable values are: $currentUser,$currentUserSID,$allUsersDesktop,$currentUserDesktop"

}

 

finally { 

    if ($shortcutsFoundStatus -eq $true) {

        Write-Output "shortcutsFoundStatus equals True. Exiting with 1"

        exit 1

    }

    elseif ($shortcutsFoundStatus -eq $false) {

        Write-Output "shortcutsFoundStatus equals False. Exiting with 0"

        exit 0  

    }

}

#endregion 

 

For logs I couldnt see much but is it the intunemanagementextension document I need to check?

 

 

 

 

That or the AgentExecutor logfile
Okay thanks I’ll take a look tomorrow when I have the device again!

Is there another way from just powershell scripts area / configuration policies that will do the same thing ? Just incase I can’t figure this out
Scripts in Devices should also work, if you know the filename and it only has to run once.. ("remove-item c:\users\public\desktop\shortcut.url")
Hi

This doesnt work for me, the shortcuts are in C:\users\theuser\Desktop

Is there a way I can create a script to delete it via the user logged in's desktop?
Scripts work as system, so that's not going to work indeed. So, Remediation is an option but you have issues doing that somehow now... You could also create a Win32 package and run that as user to delete the file but.. Detection is done as system there, you could create a file in c:\programdata\company\shortcutdelete\shortcut.txt somehting and check on that. If not there, run the install.cmd from the Win32 package which deletes the file from the desktop and creates the shortcut.txt file so that is does not run again..

But.. You're main question was: "I have created a shortcut using powershell but I had to update the URL which seems to have broke the shortcut so need to delete it and redeploy a new shortcut. " You could create a new package which deletes the old shortcut/replaces the shortcut and does a detection on a file like I mentioned before?
How would I do this? either option would be fine I just really need to get this shortcut off as the link doesnt seem to be replaced with the correct one.

I used this site/script to create the shortcut: https://www.thelazyadministrator.com/2019/11/14/deploy-web-link-shortcuts-to-the-desktop-and-start-m...

So im guessing the win package would point to a script? What would the script contain? to delete from users desktop? Would I create a detection file with the win32 app or after so that the shortcuts deleted first ?

@AB21805 Remediation script would be better, it's more difficult running a uninstall and detection for user things... 

 

Detection script

if (Test-Path -Path $env:USERPROFILE\Desktop\shortcut.lnk) {
   write-Host Found shortcut
   exit 1
}
Else {
   Write-Host Shortcut not found
   exit 0
}

Remediation script:

Remove-Item $env:USERPROFILE\Desktop\shortcut.lnk -Force:$true

Hi @Harm_Veenstra 

 

Does this look correct? Screenshot 2022-03-15 at 10.36.13 AM.png

 

Dont know whats at the beginning of each script with those random symbols as I didnt include that when putting scripts in powershell

It should be like it is in my post, I think copy/paste destroyed the formatting in the first line
so strange today any code I make in powershell and upload to proactive analytics area in endpoint comes up with those random code ill try using visual studio
Ok.. Just put in a Notepad and copy/paste from there perhaps?

All set up 

 

Are the config correct like 64 bit powershell? 

 

Screenshot 2022-03-15 at 11.29.24 AM.png

I don't think it really matters in this case what version you use, you're client are all 64bit I guess ;)
yes they are! I will let you know how I get on with this! Thanks again!