s***@gmail.com
2015-10-28 18:21:51 UTC
Hello I have 3 different vb Scripts that I like to put it in one.
And the script should be run only if the folder or file not present. Scripts should run so people can not see any error messages. Trying to avoid phone calls to help desk.Is it possible to make a one script out of all three if yes can I get an example of the script. I have Windows 7 machines in my organization.
Script 1 Creates folder (Because root folder exist but not the entire path)
========================================
Option Explicit
Dim shl
Set shl = CreateObject("WScript.Shell")
Call shl.Run("%COMSPEC% /c mkdir ""%APPDATA%\Microsoft\Document Building Blocks\1033\15""",0,true)
=================================================
Script 2
==================================================
Set objFSO = CreateObject("Scripting.FileSystemObject")
set objWShell = wScript.createObject("WScript.Shell")
usrName = objWShell.expandEnvironmentStrings("%USERNAME%")
objFSO.CopyFile "\\192.168.80.19\public\building blocks.dotx " , "C:\Users\" & usrName & "\appdata\Roaming\Microsoft\Document Building Blocks\1033\", True
=======================================================
Script 3
===============================================
Set objFSO = CreateObject("Scripting.FileSystemObject")
set objWShell = wScript.createObject("WScript.Shell")
usrName = objWShell.expandEnvironmentStrings("%USERNAME%")
objFSO.CopyFile "\\192.168.80.19\public\building blocks.dotx " , "C:\Users\" & usrName & "\appdata\Roaming\Microsoft\Document Building Blocks\1033\15\", True
==============================================================================
All three scripts work from the same User Login script group policy. But like to enhance
And the script should be run only if the folder or file not present. Scripts should run so people can not see any error messages. Trying to avoid phone calls to help desk.Is it possible to make a one script out of all three if yes can I get an example of the script. I have Windows 7 machines in my organization.
Script 1 Creates folder (Because root folder exist but not the entire path)
========================================
Option Explicit
Dim shl
Set shl = CreateObject("WScript.Shell")
Call shl.Run("%COMSPEC% /c mkdir ""%APPDATA%\Microsoft\Document Building Blocks\1033\15""",0,true)
=================================================
Script 2
==================================================
Set objFSO = CreateObject("Scripting.FileSystemObject")
set objWShell = wScript.createObject("WScript.Shell")
usrName = objWShell.expandEnvironmentStrings("%USERNAME%")
objFSO.CopyFile "\\192.168.80.19\public\building blocks.dotx " , "C:\Users\" & usrName & "\appdata\Roaming\Microsoft\Document Building Blocks\1033\", True
=======================================================
Script 3
===============================================
Set objFSO = CreateObject("Scripting.FileSystemObject")
set objWShell = wScript.createObject("WScript.Shell")
usrName = objWShell.expandEnvironmentStrings("%USERNAME%")
objFSO.CopyFile "\\192.168.80.19\public\building blocks.dotx " , "C:\Users\" & usrName & "\appdata\Roaming\Microsoft\Document Building Blocks\1033\15\", True
==============================================================================
All three scripts work from the same User Login script group policy. But like to enhance