<WriteActionModuleType ID="Microsoft.JEE.Apm.Copy.Zip.WriteActionModuleType" Accessibility="Public" Batching="false">
<Configuration/>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<WriteAction ID="CopyFiles" TypeID="Windows!Microsoft.Windows.ScriptWriteAction">
<ScriptName>JEEApmCopyUserFiles.vbs</ScriptName>
<Arguments>"$FileResource[Name='Microsoft.JEE.Apm.Zip']/Path$"</Arguments>
<ScriptBody><Script>
''' Copyright (c) Microsoft Corporation. All rights reserved.
''' Date Created: Apr 23th, 2013
'
Option Explicit
SetLocale("en-us")
'
' Get the FQDN on the machine
'
FUNCTION GetFQDN(WshShell)
DIM TCPParams, hostname, domain
TCPParams = "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\"
hostname = WSHShell.RegRead (TCPParams & "Hostname")
domain = WSHShell.RegRead (TCPParams & "Domain")
IF domain = "" THEN
GetFQDN = hostname
ELSE
GetFQDN = hostname & "." & domain
END IF
END FUNCTION
'
' Copy a single file, if it exists, to specified folder
'
FUNCTION CopyAFile(myWScript, userSuppliedFSO, targetDir, fileName, fqdn)
IF userSuppliedFSO.FileExists(fileName) THEN
userSuppliedFSO.CopyFile fileName, targetDir
myWScript.Echo "Copied " & fileName & " to " & targetDir & " on " & fqdn
END IF
END FUNCTION
'
' Copy the specified file to the system temp folder
'
FUNCTION CopyUserFiles(file1)
DIM myWScript, myFSO, WshShell, WshSystemEnv, targetDir, fqdn
SET myWScript = WScript
SET myFSO = CreateObject("Scripting.FileSystemObject")
SET WshShell = CreateObject("WScript.Shell")
SET WshSystemEnv = WshShell.Environment("System")
targetDir = WshShell.ExpandEnvironmentStrings(WshSystemEnv("TEMP")) & "\"
fqdn = GetFQDN(WshShell)
CopyAFile myWScript, myFSO, targetDir, file1, fqdn
END FUNCTION
DIM oArgs
Set oArgs = WScript.Arguments
if oArgs.Count < 1 Then
Wscript.Quit -1
End If