This project has moved. For the latest updates, please go here.
2
Vote

AutoSPInstaller cannot load SP management Shell

description

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

brianlala wrote Mar 22 at 4:25 PM

Interesting, it's as though the shortcut for the management shell wasn't created properly. It's not actually trying to load the management shell, it's just setting the shortcut to run as administrator. Can you check if the shortcut exists (either in the specified path, or in your Start Menu)? If the shortcut doesn't exist then there may be something amiss with your SharePoint installation in general.

Brian

YCastilloux wrote Mar 22 at 7:59 PM

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"

wrote Mar 22 at 9:33 PM

wrote Apr 18 at 7:47 AM