I have a issue went AutoSPInstaller try to load the management Shell for SharePoint 2016
Configuration
Windows 2016
SQL 2016
here the error
- Setting SharePoint Management Shell to run as Administrator...
- Script halted!
Exception:
System.Management.Automation.MethodInvocationException: Exception calling "ReadAllBytes" with "1" argument(s): "Could not find file 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft SharePoint 2016 Products\SharePoint 2016 Management Shell.lnk'." --->
System.IO.FileNotFoundException: Could not find file 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft SharePoint 2016 Products\SharePoint 2016 Management Shell.lnk'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights,
Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES
secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare
share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean
useLongPath, Boolean checkHost)
at System.IO.File.InternalReadAllBytes(String path, Boolean checkHost)
at CallSite.Target(Closure , CallSite , Type , Object )
--- End of inner exception stack trace ---
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext
funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrameFrame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrameframe)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrameframe)
TargetObject :
CategoryInfo : NotSpecified: (:) [], MethodInvocationException
FullyQualifiedErrorId : FileNotFoundException
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at Set-ShortcutRunAsAdmin, D:\Infra\AutoSPInstaller\AutoSPInstallerFunctions.ps1: line 7723
at Run-Install, D:\Infra\AutoSPInstaller\AutoSPInstallerMain.ps1: line 194
at <ScriptBlock>, D:\Infra\AutoSPInstaller\AutoSPInstallerMain.ps1: line 398
at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
PSMessageDetails :
Comments: ** Comment from web user: YCastilloux **
I manage to solve my probleme to force using short path in the link, ill try to find why Server 2016 in powershell causing this issue.
replace
Set-ShortcutRunAsAdmin -shortcutFile "$env:ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft SharePoint $spYear Products\SharePoint $spYear Management Shell.lnk"
for
Set-ShortcutRunAsAdmin -shortcutFile "$env:ProgramData\Microsoft\Windows\STARTM~1\Programs\MICROS~3\SHAREP~1.LNK"