Giter Club home page Giter Club logo

os-scripts's Introduction

Hi visitor Visitor Count of the day! Wave

I know my GitHub seems lacking at the moment, but I do hobbyist programming/coding, and I'm always interested in new opportunites. So, reach out if you'd like for me to do some work for you!

  • ๐Ÿ”ญ Iโ€™m currently working on automating tasks in my current job with OS scripting.
  • ๐ŸŒฑ Iโ€™m currently learning software development on my own, where free time allows, due a busy full-time job in IT.
  • ๐Ÿ‘ฏ Iโ€™m looking to collaborate on pretty much anything, just contact me!
  • ๐Ÿค” Iโ€™m looking for help with getting involved in software development projects.
  • ๐Ÿ’ฌ Ask me about anything, really, I love questions!
  • ๐Ÿ“ซ How to reach me: you can contact me below, or use my email on the left!
    • Reply to @Andrew_J_Larson
  • โ˜• Feeling generous?
    • Ko-fi
    • Patreon
    • PayPal
  • ๐Ÿ˜„ Pronouns: he/him/his
  • โšก Fun fact: I really enjoy adding tiny features onto websites online via Tampermonkey (injected JS) or Stylus (injected CSS).
Andrew-J-Larson's GitHub stats Top Langs
Excluded Repos

None at the moment! (but thanks for checking)

Can't seem to find a repository that used to be here? Try looking around my alt account at https://github.com/Andrew-J-Larson-Alt.

os-scripts's People

Contributors

andrew-j-larson avatar bartlaarhoven avatar gregpafs avatar umhau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

os-scripts's Issues

[Add App] Recreate-Base-Shortcuts.ps1 - Autodesk Software

Looking to get AutoDesk apps added, such as AutoCad, Inventor and Revit..

here are the Paths to the install locations..

  • AutoCad 2023 - C:\Program Files\Autodesk\AutoCAD 2023\acad.exe
  • Inventor 2023 - C:\Program Files\Autodesk\Inventor 2023\Bin\Inventor.exe
  • Revit 2023 - C:\Program Files\Autodesk\Revit 2022\Revit.exe

let me know if that is what you need or if you need something else.. If I can get this added it will keep our Engineering Lab teachers from hunting me down :)

Thank you

[Enhancement] Recreate-Base-Shortcuts.ps1 - Make warnings not report as errors

The script is showing as Failed in intune, because each app that is not installed is failing like this:

Visio
WARNING: Target invalid! Doesn't exist or is spelled wrong:
C:\Program Files\Microsoft Office\root\Office16\VISIO.EXE

That's for everything that's not installed. Log file is showing that it's creating those shortcuts which are missing, and skipping those that already exist. As a result (presumably that's why!), it's showing as failed in Device Status for all devices.

[Bug] Recreate-Base-Shortcuts.ps1 - MethodInvocationException

I seem to get MethodInvocationException on every detected shortcut. The script runs successfully and creates the shortcuts as expected, but the errors thrown make the script report as failed when deployed via Intune:

Script logs:

Microsoft Edge
WARNING: Target invalid! Doesn't exist or is spelled wrong:
C:\Program Files\Microsoft\Edge\Application\msedge.exe

Exception calling "ReleaseComObject" with "1" argument(s): "Object reference not set to an instance of an object."
At C:\Program Files (x86)\Microsoft Intune Management 
Extension\Policies\Scripts\0543cd33-9783-479f-b2c0-6a48e6f6c49d_d8abbb42-7cfc-4615-9ba7-050962608636.ps1:116 char:7
+       [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | O ...
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NullReferenceException
Exception calling "ReleaseComObject" with "1" argument(s): "Object reference not set to an instance of an object."
At C:\Program Files (x86)\Microsoft Intune Management
Extension\Policies\Scripts\0543cd33-9783-479f-b2c0-6a48e6f6c49d_d8abbb42-7cfc-4615-9ba7-050962608636.ps1:116 char:7
+       [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | O ...
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NullReferenceException

Microsoft Edge
Created shortcut at:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Edge.lnk

Microsoft Intune Management Extension
WARNING: Target invalid! Doesn't exist or is spelled wrong:
C:\Program Files\Microsoft Intune Management Extension\AgentExecutor.exe

Microsoft Intune Management Extension
A shortcut already exists at:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Intune Management Extension\Microsoft Intune Management Extension.lnk

Exception calling "ReleaseComObject" with "1" argument(s): "Object reference not set to an instance of an object."
At C:\Program Files (x86)\Microsoft Intune Management 
Extension\Policies\Scripts\0543cd33-9783-479f-b2c0-6a48e6f6c49d_d8abbb42-7cfc-4615-9ba7-050962608636.ps1:116 char:7
+       [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | O ...
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NullReferenceException
Exception calling "ReleaseComObject" with "1" argument(s): "Object reference not set to an instance of an object."
At C:\Program Files (x86)\Microsoft Intune Management
Extension\Policies\Scripts\0543cd33-9783-479f-b2c0-6a48e6f6c49d_d8abbb42-7cfc-4615-9ba7-050962608636.ps1:116 char:7
+       [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | O ...
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NullReferenceException

Access
Created shortcut at:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Access.lnk

Exception calling "ReleaseComObject" with "1" argument(s): "Object reference not set to an instance of an object."
At C:\Program Files (x86)\Microsoft Intune Management 
Extension\Policies\Scripts\0543cd33-9783-479f-b2c0-6a48e6f6c49d_d8abbb42-7cfc-4615-9ba7-050962608636.ps1:116 char:7
+       [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | O ...
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NullReferenceException
Exception calling "ReleaseComObject" with "1" argument(s): "Object reference not set to an instance of an object."
At C:\Program Files (x86)\Microsoft Intune Management
Extension\Policies\Scripts\0543cd33-9783-479f-b2c0-6a48e6f6c49d_d8abbb42-7cfc-4615-9ba7-050962608636.ps1:116 char:7
+       [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | O ...
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : NullReferenceException

IntuneManagementExtension logs:

<![LOG[[PowerShell] Fail, the details are {"Version":1,"SigningCode":649,"SigningMsg":"(Success) AccountId:81bc032c-14e5-4216-acbd-78f4b5e3f9f5,PolicyId:d8abbb42-7cfc-4615-9ba7-050962608636,Type:1,Enforce: Enforcement2. OSVersion:10.0.22621,AgentVersion:1.61.156.0. ","ExecutionMsg":"Exception calling \"ReleaseComObject\" with \"1\" argument(s): \"Object reference not set to an instance of an object.\"\r\nAt C:\\Program Files (x86)\\Microsoft Intune Management \r\nExtension\\Policies\\Scripts\\0543cd33-9783-479f-b2c0-6a48e6f6c49d_d8abbb42-7cfc-4615-9ba7-050962608636.ps1:116 char:7\r\n+       [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | O ...\r\n+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException\r\n    + FullyQualifiedErrorId : NullReferenceException\r\n \r\nException calling \"ReleaseComObject\" with \"1\" argument(s): \"Object reference not set to an instance of an object.\"\r\nAt C:\\Program Files (x86)\\Microsoft Intune Management \r\nExtension\\Policies\\Scripts\\0543cd33-9783-479f-b2c0-6a48e6f6c49d_d8abbb42-7cfc-4615-9ba7-050962608636.ps1:116 char:7\r\n+       [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | O ...\r\n+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException\r\n    + FullyQualifiedErrorId : NullReferenceException\r\n \r\nException calling \"ReleaseComObject\" with \"1\" argument(s): \"Object reference not set to an instance of an object.\"\r\nAt C:\\Program Files (x86)\\Microsoft Intune Management \r\nExtension\\Policies\\Scripts\\0543cd33-9783-479f-b2c0-6a48e6f6c49d_d8abbb42-7cfc-4615-9ba7-050962608636.ps1:116 char:7\r\n+       [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | O ...\r\n+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException\r\n    + FullyQualifiedErrorId : NullReferenceException\r\n \r\nException calling \"ReleaseComObject\" with \"1\" argument(s): \"Object reference not set to an instance of an object.\"\r\nAt C:\\Program Files (x86)\\Microsoft Intune Management \r\nExtension\\Policies\\Scripts\\0543cd33-9783-479f-b2c0-6a48e6f6c49d_d8abbb42-7cfc-4615-9ba7-050962608636.ps1:116 char:7\r\n+       [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | O ...\r\n+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException\r\n    + FullyQualifiedErrorId : NullReferenceException\r\n \r\nException calling \"ReleaseComObject\" with \"1\" argument(s): \"Object reference not set to an instance of an object.\"\r\nAt C:\\Program Files (x86)\\Microsoft Intune Management \r\nExtension\\Policies\\Scripts\\0543cd33-9783-479f-b2c0-6a48e6f6c49d_d8abbb42-7cfc-4615-9ba7-050962608636.ps1:116 char:7\r\n+       [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | O ...\r\n+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException\r\n    + FullyQualifiedErrorId : NullReferenceException\r\n \r\nException calling \"ReleaseComObject\" with \"1\" argument(s): \"Object reference not set to an instance of an object.\"\r\nAt C:\\Program Files (x86)\\Microsoft Intune Management \r\nExtension\\Policies\\Scripts\\0543cd33-9783-479f-b2c0-6a48e6f6c49d_d8abbb42-7cfc-4615-9ba7-050962608636.ps1:116 char:7\r\n+       [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | O ...\r\n+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException\r\n    + FullyQualifiedErrorId : NullReferenceException\r\n \r\nException calling \"ReleaseComObject\" with \"1\" argument(s): \"Object reference not set to an instance of an object.\"\r\nAt C:\\Program Files (x86)\\Microsoft Intune Management \r\nExtension\\Policies\\Scripts\\0543cd33-9783-479f-b2c0-6a48e6f6c49d_d8abbb42-7cfc-4615-9ba7-050962608636.ps1:116 char:7\r\n+       [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | O ...\r\n+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException\r\n    + FullyQualifiedErrorId : NullReferenceException\r\n \r\nException calling \"ReleaseComObject\" with \"1\" argument(s): \"Object reference not set to an instance of an object.\"\r\nAt C:\\Program Files (x86)\\Microsoft Intune Management \r\nExtension\\Policies\\Scripts\\0543cd33-9783-479f-b2c0-6a48e6f6c49d_d8abbb42-7cfc-4615-9ba7-050962608636.ps1:116 char:7\r\n+       [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | O ...\r\n+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException\r\n    + FullyQualifiedErrorId : NullReferenceException\r\n \r\nException calling \"ReleaseComObject\" with \"1\" argument(s): \"Object reference not set to an instance of an object.\"\r\nAt C:\\Program Files (x86)\\Microsoft Intune Management \r\nExtension\\Policies\\Scripts\\0543cd33-9783-479f-b2c0-6a48e6f6c49d_d8abbb42-7cfc-4615-9ba7-050962608636.ps1:116 char:7\r\n+       [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | O ...\r\n+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException\r\n    + FullyQualifiedErrorId : NullReferenceException\r\n \r\nException calling \"ReleaseComObject\" with \"1\" argument(s): \"Object reference not set to an instance of an object.\"\r\nAt C:\\Program Files (x86)\\Microsoft Intune Management \r\nExtension\\Policies\\Scripts\\0543cd33-9783-479f-b2c0-6a48e6f6c49d_d8abbb42-7cfc-4615-9ba7-050962608636.ps1:116 char:7\r\n+       [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | O ...\r\n+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException\r\n    + FullyQualifiedErrorId : NullReferenceException\r\n \r\nException calling \"ReleaseComObject\" with \"1\" argument(s): \"Object reference not set to an instance of an object.\"\r\nAt C:\\Program Files (x86)\\Microsoft Intune Management \r\nExtension\\Policies\\Scripts\\0543cd33-9783-479f-b2c0-6a48e6f6c49d_d8abbb42-7cfc-4615-9ba7-050962608636.ps1:116 char:7\r\n+       [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | O ...\r\n+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException\r\n    + FullyQualifiedErrorId : NullReferenceException\r\n \r\nException calling \"ReleaseComObject\" with \"1\" argument(s): \"Object reference not set to an instance of an object.\"\r\nAt C:\\Program Files (x86)\\Microsoft Intune Management \r\nExtension\\Policies\\Scripts\\0543cd33-9783-479f-b2c0-6a48e6f6c49d_d8abbb42-7cfc-4615-9ba7-050962608636.ps1:116 char:7\r\n+       [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | O ...\r\n+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException\r\n    + FullyQualifiedErrorId : NullReferenceException\r\n \r\nException calling \"ReleaseComObject\" with \"1\" argument(s): \"Object reference not set to an instance of an object.\"\r\nAt C:\\Program Files (x86)\\Microsoft Intune Management \r\nExtension\\Policies\\Scripts\\0543cd33-9783-479f-b2c0-6a48e6f6c49d_d8abbb42-7cfc-4615-9ba7-050962608636.ps1:116 char:7\r\n+       [Runtime.InteropServices.Marshal]::ReleaseComObject($Shell) | O ...\r\n+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException\r\n    + FullyQualifiedErrorId : NullReferenceException\r\n \r\nException calling \"ReleaseComObject\" with \"1\" argument(s): \"Object reference	 	01/01/1601 00:00:00	2867984480 (0xAAF1F860)

[Enhancement] Recreate-Startmenu-Shortcuts.ps1 - Reduce size in general

In general, knowing my own code, I can certainly cut down about half the code if I remove the extra lines used to check for Program Files (x86)... but to do so, will require more complicated code (in the case of different names depending on architecture installed)

Will work on this when I have the time, and no other pending bug fixes/feature requests exist.

[Add App] Recreate-Base-Shortcuts.ps1 - Putty + Pulse Secure

Requested from: https://www.reddit.com/r/sysadmin/comments/10d7ykp/comment/j4kumgg/?utm_source=share&utm_medium=web2x&context=3

@{Name="PuTTY"; TargetPath="C:\Program Files\PuTTY\putty.exe"; SystemLnk="PuTTY (64-bit)\"; StartIn="C:\Program Files\PuTTY"; Description="SSH, Telnet and Rlogin client"; },

@{Name="Pulse Secure"; TargetPath="C:\Program Files (x86)\Common Files\Pulse Secure\JamUI\Pulse.exe"; Arguments="-show"; SystemLnk="Pulse Secure\"; StartIn=""; Description="Pulse Secure Desktop Client"; }

[Bug] Recreate-Base-Shortcuts.ps1 - Empty Names in some instances

Intune doesnt like the output from the script and is reporting failure. I tried to remove those apps, so far I noticed etcher, balana and I think WinSpy:

  1. error from script =New-Shortcut : Cannot bind argument to parameter 'sName' because it is an empty string.
    At C:\Program Files (x86)\Microsoft Intune Management 
    Extension\Policies\Scripts\e7ffa3d1-9e1e-465c-a180-64db6504e365_8587b248-0d2f-4ca2-b3b2-84d4aa9ba318.ps1:1384 char:36
    +   $ScriptResults = New-Shortcut -n $aName -tp $aTargetPath -a $aArgum ...
    +                                    ~~~~~~
        + CategoryInfo          : InvalidData: (:) [New-Shortcut], ParameterBindingValidationException
        + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,New-Shortcut
    
    New-Shortcut : Cannot bind argument to parameter 'sName' because it is an empty string.
    At C:\Program Files (x86)\Microsoft Intune Management 
    Extension\Policies\Scripts\e7ffa3d1-9e1e-465c-a180-64db6504e365_8587b248-0d2f-4ca2-b3b2-84d4aa9ba318.ps1:1384 char:36
    +   $ScriptResults = New-Shortcut -n $aName -tp $aTargetPath -a $aArgum ...
    +                                    ~~~~~~
        + CategoryInfo          : InvalidData: (:) [New-Shortcut], ParameterBindingValidationException
        + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,New-Shortcut
    
    -
    
  2. I also noticed it's trying to create shortcuts at C:\Users\%HOSTNAME%\ when running with System Rights from Intune


  3. image

Originally posted by @AlphaSeb in #20 (comment)

Edited by @TheAlienDrew to clarify points of interest (2023-01-19T00:24:07Z)

[Bug] Recreate-Base-Shortcuts.ps1 - Shortcuts try to be created where paths don't exist

Hi

The "Microsoft Office Tools" shortcuts fail on a number of devices, not all. See the error below. Currently this only appears for users based in the Netherlands, not sure what OS language they have set and if this is relevant.

Unable to save shortcut "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office Tools\Database Compare.ln
k".
At C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts\b1d21823-4c45-49ab-9c09-c3d4d644421d_d8
abbb42-7cfc-4615-9ba7-050962608636.ps1:117 char:7
+       $newLNK.Save()
+       ~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], DirectoryNotFoundException
    + FullyQualifiedErrorId : System.IO.DirectoryNotFoundException
Unable to save shortcut "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office Tools\Database Compare.l
nk".
At C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts\b1d21823-4c45-49ab-9c09-c3d4d644421d_d
8abbb42-7cfc-4615-9ba7-050962608636.ps1:117 char:7
+       $newLNK.Save()
+       ~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], DirectoryNotFoundException
    + FullyQualifiedErrorId : System.IO.DirectoryNotFoundException

Database Compare
New-Shortcut : Failed to create shortcut, with target at: C:\Program Files\Microsoft Office\root\Client\AppVLP.exe
At C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts\b1d21823-4c45-49ab-9c09-c3d4d644421d_d8
abbb42-7cfc-4615-9ba7-050962608636.ps1:312 char:20
+ ... ptResults = New-Shortcut -n $aName -tp $aTargetPath -a $aArguments -s ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-Shortcut
New-Shortcut : Failed to create shortcut, with target at: C:\Program Files\Microsoft Office\root\Client\AppVLP.exe
At C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts\b1d21823-4c45-49ab-9c09-c3d4d644421d_d
8abbb42-7cfc-4615-9ba7-050962608636.ps1:312 char:20
+ ... ptResults = New-Shortcut -n $aName -tp $aTargetPath -a $aArguments -s ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-Shortcut


Unable to save shortcut "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office Tools\Office Language Pre
ferences.lnk".
At C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts\b1d21823-4c45-49ab-9c09-c3d4d644421d_d8
abbb42-7cfc-4615-9ba7-050962608636.ps1:117 char:7
+       $newLNK.Save()
+       ~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], DirectoryNotFoundException
    + FullyQualifiedErrorId : System.IO.DirectoryNotFoundException
Unable to save shortcut "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office Tools\Office Language Pr
eferences.lnk".
At C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts\b1d21823-4c45-49ab-9c09-c3d4d644421d_d
8abbb42-7cfc-4615-9ba7-050962608636.ps1:117 char:7
+       $newLNK.Save()
+       ~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], DirectoryNotFoundException
    + FullyQualifiedErrorId : System.IO.DirectoryNotFoundException

Office Language Preferences
New-Shortcut : Failed to create shortcut, with target at: C:\Program Files\Microsoft Office\root\Office16\SETLANG.EXE
At C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts\b1d21823-4c45-49ab-9c09-c3d4d644421d_d8
abbb42-7cfc-4615-9ba7-050962608636.ps1:312 char:20
+ ... ptResults = New-Shortcut -n $aName -tp $aTargetPath -a $aArguments -s ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-Shortcut
New-Shortcut : Failed to create shortcut, with target at: C:\Program Files\Microsoft Office\root\Office16\SETLANG.EXE
At C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts\b1d21823-4c45-49ab-9c09-c3d4d644421d_d
8abbb42-7cfc-4615-9ba7-050962608636.ps1:312 char:20
+ ... ptResults = New-Shortcut -n $aName -tp $aTargetPath -a $aArguments -s ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-Shortcut


Unable to save shortcut "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office Tools\Spreadsheet Compare
.lnk".
At C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts\b1d21823-4c45-49ab-9c09-c3d4d644421d_d8
abbb42-7cfc-4615-9ba7-050962608636.ps1:117 char:7
+       $newLNK.Save()
+       ~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], DirectoryNotFoundException
    + FullyQualifiedErrorId : System.IO.DirectoryNotFoundException
Unable to save shortcut "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office Tools\Spreadsheet Compar
e.lnk".
At C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts\b1d21823-4c45-49ab-9c09-c3d4d644421d_d
8abbb42-7cfc-4615-9ba7-050962608636.ps1:117 char:7
+       $newLNK.Save()
+       ~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], DirectoryNotFoundException
    + FullyQualifiedErrorId : System.IO.DirectoryNotFoundException

Spreadsheet Compare
New-Shortcut : Failed to create shortcut, with target at: C:\Program Files\Microsoft Office\root\Client\AppVLP.exe
At C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts\b1d21823-4c45-49ab-9c09-c3d4d644421d_d8
abbb42-7cfc-4615-9ba7-050962608636.ps1:312 char:20
+ ... ptResults = New-Shortcut -n $aName -tp $aTargetPath -a $aArguments -s ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-Shortcut
New-Shortcut : Failed to create shortcut, with target at: C:\Program Files\Microsoft Office\root\Client\AppVLP.exe
At C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts\b1d21823-4c45-49ab-9c09-c3d4d644421d_d
8abbb42-7cfc-4615-9ba7-050962608636.ps1:312 char:20
+ ... ptResults = New-Shortcut -n $aName -tp $aTargetPath -a $aArguments -s ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-Shortcut


Unable to save shortcut "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office Tools\Telemetry Log for O
ffice.lnk".
At C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts\b1d21823-4c45-49ab-9c09-c3d4d644421d_d8
abbb42-7cfc-4615-9ba7-050962608636.ps1:117 char:7
+       $newLNK.Save()
+       ~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], DirectoryNotFoundException
    + FullyQualifiedErrorId : System.IO.DirectoryNotFoundException
Unable to save shortcut "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office Tools\Telemetry Log for
Office.lnk".
At C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts\b1d21823-4c45-49ab-9c09-c3d4d644421d_d
8abbb42-7cfc-4615-9ba7-050962608636.ps1:117 char:7
+       $newLNK.Save()
+       ~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], DirectoryNotFoundException
    + FullyQualifiedErrorId : System.IO.DirectoryNotFoundException

Telemetry Log for Office
New-Shortcut : Failed to create shortcut, with target at: C:\Program Files\Microsoft Office\root\Office16\msoev.exe
At C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts\b1d21823-4c45-49ab-9c09-c3d4d644421d_d8
abbb42-7cfc-4615-9ba7-050962608636.ps1:312 char:20
+ ... ptResults = New-Shortcut -n $aName -tp $aTargetPath -a $aArguments -s ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-Shortcut
New-Shortcut : Failed to create shortcut, with target at: C:\Program Files\Microsoft Office\root\Office16\msoev.exe
At C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts\b1d21823-4c45-49ab-9c09-c3d4d644421d_d
8abbb42-7cfc-4615-9ba7-050962608636.ps1:312 char:20
+ ... ptResults = New-Shortcut -n $aName -tp $aTargetPath -a $aArguments -s ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-Shortcut

[Bug] Recreate-Base-Shortcuts.ps1 - Does not work for me

1- I have to remove some line

bug

2- Several error for Azure Data Studio

Azure Data Studio
A shortcut already exists at:
C:\Users\lgmor\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Azure Data Studio\Azure Data Studio.lnk
Recreate-Shortcut : Cannot bind argument to parameter 'sName' because it is an empty string.
At line:738 char:37
+     $Results = Recreate-Shortcut -n $aName -tp $aTargetPath -a $sArgu ...
+                                     ~~~~~~
    + CategoryInfo          : InvalidData: (:) [Recreate-Shortcut], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Recreate-Shortcut

3- For Docker Desktop
It says that the shortcut already exists which is not true. But the same test is fine for all other existing shortcuts. I don't know why it believes the file exists

Docker Desktop
A shortcut already exists at:
C:\ProgramData\Microsoft\Windows\Start Menu\Docker Desktop.lnk

Docker Desktop (32-bit)
WARNING: Target invalid! Doesn't exist or is spelled wrong:
C:\Program Files (x86)\Docker\Docker\Docker Desktop.exe

bug

[Bug] Recreate-Base-Shortcuts.ps1 - Few errors

At C:\Tasks\Recreate-Base-Shortcuts.ps1:28 char:31
+     [Parameter(Mandatory=$true]
+                               ~
Missing closing ')' in expression.
At C:\Tasks\Recreate-Base-Shortcuts.ps1:32 char:31
+     [Parameter(Mandatory=$true]
+                               ~
Missing closing ')' in expression.
At C:\Tasks\Recreate-Base-Shortcuts.ps1:52 char:32
+   if ($sName -And $sTarget -And Test-Path $sTarget -PathType leaf) {
+                                ~
You must provide a value expression following the '-And' operator.
At C:\Tasks\Recreate-Base-Shortcuts.ps1:52 char:33
+   if ($sName -And $sTarget -And Test-Path $sTarget -PathType leaf) {
+                                 ~~~~~~~~~
Unexpected token 'Test-Path' in expression or statement.
At C:\Tasks\Recreate-Base-Shortcuts.ps1:52 char:33
+   if ($sName -And $sTarget -And Test-Path $sTarget -PathType leaf) {
+                                 ~~~~~~~~~
Missing closing ')' after expression in 'if' statement.
At C:\Tasks\Recreate-Base-Shortcuts.ps1:23 char:28
+ function Recreate-Shortcut {
+                            ~
Missing closing '}' in statement block or type definition.
At C:\Tasks\Recreate-Base-Shortcuts.ps1:52 char:66
+   if ($sName -And $sTarget -And Test-Path $sTarget -PathType leaf) {
+                                                                  ~
Unexpected token ')' in expression or statement.
At C:\Tasks\Recreate-Base-Shortcuts.ps1:85 char:5
+   } else if (-Not ($sName -Or $sTarget)) {
+     ~~~~
Unexpected token 'else' in expression or statement.
At C:\Tasks\Recreate-Base-Shortcuts.ps1:98 char:1
+ }
+ ~
Unexpected token '}' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : MissingEndParenthesisInExpression

[Bug] Recreate-Base-Shortcuts-INTUNE.ps1- Cannot overwrite variable REMOTE_SCRIPT_LOCATION

Running the Intune Script with SYSTEM Rights, in 64 Bit Shell results into the following:

eNotWritable,Microsoft.PowerShell.Commands.SetVariableCommand

Set-Variable : Cannot overwrite variable REMOTE_SCRIPT_LOCATION because it is read-only or constant.
At line:92 char:1

  • Set-Variable REMOTE_SCRIPT_LOCATION -Option Constant -Value "https:// ...
  •   + CategoryInfo          : WriteError: (REMOTE_SCRIPT_LOCATION:String) [Set-Variable], SessionStateUnauthorizedAcce 
     ssException
      + FullyQualifiedErrorId : VariableNotWritable,Microsoft.PowerShell.Commands.SetVariableCommand
    
    

Set-Variable : Cannot overwrite variable REMOTE_SCRIPT_LOCATION because it is read-only or constant.
At line:92 char:1

  • Set-Variable REMOTE_SCRIPT_LOCATION -Option Constant -Value "https:// ...

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.