Thursday, January 3, 2013

Script Windows 7 Library

Question: What is the best way to script the creation of a Window 7 Library item within Explorer?

Answer:

Set oShell = CreateObject( "WScript.Shell" )
userp=oShell.ExpandEnvironmentStrings("%userprofile%")
strFolder = "" & userp & "\Documents\SymantecCloudBackup"
set objFSO = createobject("Scripting.FileSystemObject")

if objFSO.FolderExists(strFolder) = False then
 objFSO.CreateFolder strFolder

else

end if
WScript.Sleep 3000
set objShell = wscript.createObject("wscript.shell")
shlib1 = "cmd.exe /C C:\ProgramData\1E\NomadBranch\LDC0032F_Cache\shlib create %userprofile%\AppData\Roaming\Microsoft\Windows\Libraries\SymantecCloudBackup.library-ms"
shlib2 = "cmd.exe /C C:\ProgramData\1E\NomadBranch\LDC0032F_Cache\shlib add %userprofile%\AppData\Roaming\Microsoft\Windows\Libraries\SymantecCloudBackup.library-ms " & strFolder & ""
objShell.Run shlib1
objShell.Run shlib2

No comments:

Post a Comment