Hi Guys. I am stuck at a point and I really need to figure this out. 

Background: I have my VB script written to uninstall Microsoft office 2010 and Install Microsoft office 365 pro plus. On Side-by-Side install it does not create a Folder structure. My script creates a "Microsoft Office 2016 folder and moves all the shortcut into the folder".  The only shortcut which fails to move is "Microsoft OneDrive" as it resides in the userprofile (C:\Users\xyz\AppData\Roaming\Microsoft\Windows\Start Menu\Program\Microsoft OneDrive.lnk) .

Below is a part of my script with one example of How I am copying the other shortcuts

What do I add in the script to move Microsoft OneDrive Shortcut in the folder?.

On Error Resume Next

Const HKCR = &H80000000 'HKEY_CLASSES_ROOT
Const HKCU = &H80000001 'HKEY_CURRENT_USER
Const HKUS = &H80000003 'HKEY_USERS

Dim Vis16,Proj16,Vis13,Proj13,Vis10,Proj10

Vis16 = False
Proj16 = False
Vis13 = False
Proj13 = False

Set oShell = WScript.CreateObject("WScript.Shell")

Set oShellEnv = oShell.Environment("PROCESS")


Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")

If Not oFSO.FolderExists("C:\windows\temp\DeploymentLogs") Then
Set objFolder = oFSO.CreateFolder("C:\windows\temp\DeploymentLogs")
End If

sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")+"\"

' Start Menu Structure
If Not oFSO.FolderExists("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office 2016") Then
Set objFolder = oFSO.CreateFolder("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office 2016")
End If

oFSO.CopyFile "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Access 2016.lnk", "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office 2016\", True 
oFSO.DeleteFile "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Access 2016.lnk"

1 Comment   [ + ] Show Comment


  • I am not sure if we can use OCT for C2R deployments
Please log in to comment

Community Chosen Answer

Why not use the OCT to put the shortcuts where you want them in the first place?
Answered 08/16/2016 by: VBScab
Red Belt

Please log in to comment


Resolved it. Had to expand the environmental variable. Thanks
Answered 08/16/2016 by: hazzysh
White Belt

Please log in to comment
Answer this question or Comment on this question for clarity