Sure.
Mi code es su code. (Or somethin’…)
You’ll have to modify server names and locations to your needs.
***Edit: The ‘Purpose’ section is a bit dated. There’s no CheckUpdateVsn block. That used to be when we ran it as a batch file.
' ========================================================================
' Author: Hannah Willett
' Date: 08/18/2018
' Version: 10.2.200.11
'
' Purpose: This script is used to install or update Domain Users' Epicor
' 10.2 clients. Can be run using Group Policy at logon. The
' current version will check for the presence of a text file
' called 10.2.200.0.txt. Subsequent updates that don't use Epicor
' AutoUpdate will require the check of a new file that needs to
' be placed at \\<YourServer>\ERP10.2.200.0Deployment\Client\config
' and the CheckUpdateVsn block will need to be updated with the
' new patch level. Patches are cumulative, so the old can be
' overwritten.
' ========================================================================
' Locations
ExtractTo = "C:\Epicor\ERP10.2Client\Client\"
RootFolder = "C:\Epicor\ERP10.2Client"
OldClient = "C:\Epicor\ERP10.1Client"
Old102Client = "C:\Epicor\ERP10.2Client_OLD"
ConfigFolder = "C:\Epicor\ERP10.2Client\Client\Config\"
CheckFile = "C:\Epicor\ERP10.2Client\Client\config\10.2.200.0.txt"
' Files to unzip
ClientFilesZip = "\\<YourServer>\ERP10.2.200.0Deployment\ReleaseClient.Zip"
LocalClientFilesZip = "C:\Epicor\ERP10.2Client\Client\ReleaseClient.Zip"
UpdateZip = "\\<YourServer>\ERP10.2.200.0Deployment\Custom\Client\Update\ERP10.2.200.11.zip"
LocalUpdateZip = "C:\Epicor\ERP10.2Client\Client\ERP10.2.200.11.zip"
DocSenderZip = "\\<YourServer>\ERP10.2.200.0Deployment\Custom\Client\DocumentSender\DocumentSender.zip"
LocalDocSenderZip = "C:\Epicor\ERP10.2Client\Client\DocumentSender.zip"
UserProcZip = "\\<YourServer>\ERP10.2.200.0Deployment\Custom\Client\User Process Scheduler\User Process Scheduler.zip"
LocalUserProcZip = "C:\Epicor\ERP10.2Client\Client\User Process Scheduler.zip"
HandheldZip = "\\<YourServer>\ERP10.2.200.0Deployment\Custom\Client\Handheld\Handheld.zip"
LocalHandheldZip = "C:\Epicor\ERP10.2Client\Client\Handheld.zip"
' Icons and Config Files
Icons = "\\<YourServer>\ERP10.2.200.0Deployment\Icons\*.*"
ConfigFiles = "\\isimke\Epicor\Installers\E10.2\*.sysconfig"
' Local Desktop Variables
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshMyEnv = WshShell.Environment("PROCESS")
userprof = WshMyEnv("userprofile")
UserFolder = userprof & "\Desktop\"
' -----------------------------------------------------------------------
' Copys the old directory to a new folder called OLD and creates a
' fresh directory
' -----------------------------------------------------------------------
Set fso = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Shell.Application")
If( Not fso.FileExists(CheckFile) )Then
' -----------------------------------------------------------------------
' Delete Old Icons
' -----------------------------------------------------------------------
Set objFolder = fso.GetFolder(UserFolder)
Set colFiles = objFolder.Files
On Error Resume Next
For Each objFile in colFiles
If( instr(ucase(objFile.Name),"TEST") <> 0 )Then
fso.DeleteFile UserFolder & "*TEST*.lnk"
ElseIf( instr(ucase(objFile.Name),"LIVE") <> 0 )Then
fso.DeleteFile UserFolder & "*LIVE*.lnk"
ElseIf( instr(ucase(objFile.Name),"PILOT") <> 0 )Then
fso.DeleteFile UserFolder & "*PILOT*.lnk"
ElseIf( instr(ucase(objFile.Name),"EPICOR") <> 0 )Then
fso.DeleteFile UserFolder & "*EPICOR*.lnk"
End If
Next
' Delete 10.1 Client
If fso.FolderExists(OldClient) Then
fso.DeleteFolder OldClient
End If
'Delete 10.2 Old Client
If fso.FolderExists(Old102Client) Then
fso.DeleteFolder OldClient
End If
If fso.FolderExists(ExtractTo) Then
fso.MoveFolder RootFolder, OldClient
End If
On error goto 0
folders = Split(ExtractTo, "\")
For i = 0 To UBound(folders)
fname = fso.BuildPath(fname, folders(i))
If fso.FolderExists(fname) Then
Set objFolder = fso.GetFolder(fName)
Else
Set objFolder = fso.CreateFolder(fname)
End If
Next
' -----------------------------------------------------------------------
' Base 10.2.200.0 Client folder, Document Sender, Icons, and SysConfig
' -----------------------------------------------------------------------
'fso.CopyFile ClientFilesZip, ExtractTo, True
objShell.NameSpace(ExtractTo).CopyHere ClientFilesZip, 16
objShell.NameSpace(ExtractTo).CopyHere UpdateZip, 16
objShell.NameSpace(ExtractTo).CopyHere DocSenderZip, 16
objShell.NameSpace(ExtractTo).CopyHere UserProcZip, 16
objShell.NameSpace(ExtractTo).CopyHere HandheldZip, 16
' -----------------------------------------------------------------------
' Unzip Files
' -----------------------------------------------------------------------
' Unzip Local Client Files
If fso.FileExists(LocalClientFilesZip) Then
Set FilesInZip=objShell.NameSpace(LocalClientFilesZip).Items()
objShell.NameSpace(ExtractTo).CopyHere FilesInZip, 16
fso.DeleteFile LocalClientFilesZip
End If
' Unzip Update Files
If fso.FileExists(LocalUpdateZip) Then
Set FilesInZip=objShell.NameSpace(LocalUpdateZip).Items()
objShell.NameSpace(ExtractTo).CopyHere FilesInZip, 16
fso.DeleteFile LocalUpdateZip
End If
' Unzip Local DocSender Files
If fso.FileExists(LocalDocSenderZip) Then
Set FilesInZip=objShell.NameSpace(LocalDocSenderZip).Items()
objShell.NameSpace(ExtractTo).CopyHere FilesInZip, 16
fso.DeleteFile LocalDocSenderZip
End If
' Unzip Local UserProc Files
If fso.FileExists(LocalUserProcZip) Then
Set FilesInZip=objShell.NameSpace(LocalUserProcZip).Items()
objShell.NameSpace(ExtractTo).CopyHere FilesInZip, 16
fso.DeleteFile LocalUserProcZip
End If
' Unzip Local Handheld Files
If fso.FileExists(LocalHandheldZip) Then
Set FilesInZip=objShell.NameSpace(LocalHandheldZip).Items()
objShell.NameSpace(ExtractTo).CopyHere FilesInZip, 16
fso.DeleteFile LocalHandHeldZip
End If
' -----------------------------------------------------------------------
' Copy icons and config files to user folders
' -----------------------------------------------------------------------
fso.CopyFile ConfigFiles, ConfigFolder, True
fso.CopyFile Icons, UserFolder, True
' -----------------------------------------------------------------------
' Creates a check file so the install does not run every time
' -----------------------------------------------------------------------
Set objFile = fso.CreateTextFile(CheckFile,True)
objFile.Write "10.2.200.0 Installed"
objFile.Close
End If
Set fso = Nothing
Set objShell = Nothing
Obligatory “Use at your own risk” blah, blah, blah.
This was developed to work for our environment. Changes may be needed to suit yours.