Jump to content


tarinhtx

Skype for Business 2016 Shortcut Fix

Recommended Posts

I have a batch file that if I run locally on a test computer it will correct a Skype for Business 2016 shortcut problem in the start menu by replacing the shortcut with a functional one with no problem.


However, I'm having trouble deploying the batch file using as an Application through SCCM 2012 R2. The application deploys and "Installs" but for some reason the batch file never runs and completes the fix.


Is there something I need to change on the line for the Installation Program: "filename.bat" under the Programs tab or maybe modify the batch file? Thanks.



@ECHO OFF

set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"

del "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Skype for Business 2016.lnk"
echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Skype for Business 2016.lnk" >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "C:\Program Files\Microsoft Office\Office16\lync.exe" >> %SCRIPT%
echo oLink.WorkingDirectory ="%SYSTEMDRIVE%\Program Files" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%
cscript /nologo %SCRIPT%
del %SCRIPT%

Share this post


Link to post
Share on other sites

If I copy the batch file to the user's desktop and double click to execute, it completes the shortcut "fix" which deletes the nonworking SFB start menu shortcut and pastes the functioning SFB shortcut. So after the application is deployed hidden and shows up on the client's System Center as "Installed" under status, the batch file fix never took place. I placed the filename.bat file you see above in my content location \\servername\d$\Installs. Sorry, I'm not quite sure what you mean in your second question. Thanks for helping out.

Share this post


Link to post
Share on other sites

That script does seem like the over complicated way of doing it. If i wanted to copy/update a shortcut i would simply take a copy of the functioning shortcut file (.LNK) and then just write a batch file to copy that shortcut into c:\programdata etc.

 

Eg

 

If exist "c:\programdata...\badshortcut.lnk" del "c:\programdata...\badshortcut.lnk"

Copy "myshortcut.lnk" "c:\programadata......" /y

Exit

 

Then your application detection method will be to ensure the new shortcut exists.

Share this post


Link to post
Share on other sites

If I copy the batch file to the user's desktop and double click to execute, it completes the shortcut "fix" which deletes the nonworking SFB start menu shortcut and pastes the functioning SFB shortcut. So after the application is deployed hidden and shows up on the client's System Center as "Installed" under status, the batch file fix never took place. I placed the filename.bat file you see above in my content location \\servername\d$\Installs. Sorry, I'm not quite sure what you mean in your second question. Thanks for helping out.

Let me fix the typo above.

 

Since CM uses the local system account to do just about everything, test your script using this process. https://verbalprocessor.com/2007/12/05/running-a-cmd-prompt-as-local-system/, When it works using this process it will work within CM too.

Share this post


Link to post
Share on other sites

I placed the command in the Installation Program line under the "Programs" tab. Deployed the application and as soon as it appeared in the Software it "Installed" but the batch file still failed to execute.

 

No that is not correct. You need to test your batch file using the PSexec to confirm that the batch file setup correctly.

 

When you execute your batch file on your PC (or any other PC) does the batch file does what it should? My guess it that it will but for the LOCAL SYSTEM account. But that is not what you want, you want it for the locally logon user. Hence why you think that the batch file is failing when executed by CM.

 

Once you confirm this step, you should be able to change the security context to the user security context and ultimately solve your problem.

Share this post


Link to post
Share on other sites

I placed the command in the Installation Program line under the "Programs" tab. Deployed the application and as soon as it appeared in the Software it "Installed" but the batch file still failed to execute.

 

What is your detection method for this script?

If your detection method is just the detection of the presence of this shortcut: "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Skype for Business 2016.lnk"

Then your script will never run as this shortcut already exists (but is incorrect) so it will detect the presence and consider it successful without running it.

 

So, what is your detection method to check whether the script ran succesfully?

 

You can, for instance, create a reg key at the end of the script and use that as a detection method.

Otherwise you could create a shortcut with a slightly different name (e.g. without 2016) and detect the presence of that one.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.