/build/static/layout/Breadcrumb_cap_w.png

Scripting Question


Moving a shortcut from a userprofile to a folder

08/15/2016 849 views

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 HKLM = &H80000002 'HKEY_LOCAL_MACHINE
Const HKUS = &H80000003 'HKEY_USERS
Const HKCC = &H80000005 'HKEY_CURRENT_CONFIG

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")

oShellEnv("SEE_MASK_NOZONECHECKS") = 1

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

Comments

  • I am not sure if we can use OCT for C2R deployments


Community Chosen Answer

1
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

All Answers

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

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ