OMPM용 예제 SMS 배포 스크립트
업데이트 날짜: 2009년 1월
적용 대상: Office Resource Kit
마지막으로 수정된 항목: 2009-01-13
이러한 파일을 중앙 파일 공유에서 호출하는 다음과 같은 스크립트를 사용할 수 있습니다. 이 스크립트는 SMS를 통해 배포할 수 있습니다.
'*************************************************************************************
' File Name: OffScan.vbs
' Version: 1.0
' Purpose: Executes offscan.exe and generate the MIF message based on output of offscan.exe
'*************************************************************************************
Option Explicit
''On Error Resume Next
Dim oFso, oWsh, g_strRoot, g_SourcePath, g_optFile, g_intReturnCode
'------------------- Creating Objects -------------------------------
Set oFso = Wscript.CreateObject("Scripting.FileSystemObject")
Set oWsh = Wscript.CreateObject("Wscript.Shell")
'------------- Get the Parent Folder -------------------------------
g_strRoot = oFso.GetParentFolderName(Wscript.ScriptFullName)
g_optFile = oWsh.ExpandEnvironmentStrings("%temp%\offscan_output.txt")
g_SourcePath = oFso.BuildPath(g_strRoot,"bits\offscan.exe")
If oFso.FileExists(g_optFile) Then
oFso.DeleteFile g_optFile
End If
g_intReturnCode= oWsh.Run("%comspec% /c " & g_SourcePath & " >> " & g_optFile,0,True)
'// Remove this if network copy is not requried
CopycabfiletoNetworkLocation
Quit()
'****************************************************************************************************************
'Sub Name : GenerateMIFMessage()
'Purpose: Generates the MIF message
'****************************************************************************************************************
Sub GenerateMIFMessage()
'On Error Resume Next
Dim l_varGetFile,l_strReadFile,l_strLine, l_oMIFGen, l_strMifMessage
If oFso.FileExists(g_optFile) Then
Set l_varGetFile = oFso.GetFile(g_optFile)
Set l_strReadFile = l_varGetFile.OpenAsTextStream(1,-2)
Do While l_strReadFile.AtEndofStream = False
l_strLine = l_strReadFile.ReadLine
If Not Trim(l_strLine) = "" Then
If Instr(lcase(l_strLine),"total time") or Instr(lcase(l_strLine),"total number") Then
If Trim(l_strMifMessage) = "" Then
l_strMifMessage = g_intReturnCode & ":" & l_strLine
Else
l_strMifMessage = l_strMifMessage & ";" & l_strLine
End If
End If
If Instr(lcase(l_strLine),"error:") Then
If Trim(l_strMifMessage) = "" Then
l_strMifMessage = g_intReturnCode & ":" & Split(Split(l_strLine,".")(0),":")(1)
Else
l_strMifMessage = l_strMifMessage & ";" & Split(Split(l_strLine,".")(0),":")(1)
End If
End If
End If
Loop
Set l_strReadFile = Nothing
Set l_varGetFile = Nothing
Else
l_strMifMessage="Output file NOT found"
End If
Set l_oMIFGen = WScript.CreateObject("ISMIFCOM.InstallStatusMIF")
l_oMIFGen.Create "OffScan.MIF", "Microsoft", "Office File Scanner", "1.0", "ENU", 1, l_strMifMessage, 1
End Sub
'*************************************************************************************
' Sub Name: Quit
' Purpose: Exit
'*************************************************************************************
Sub Quit()
'On Error Resume Next
GenerateMIFMessage()
Set oWsh = Nothing
Set oFso = Nothing
Wscript.Quit(0)
End Sub
'*************************************************************************************
'Sub Name : CopycabfiletoNetworkLocation()
'Purpose: Copy the cab file to specified common folder
'*************************************************************************************
Sub CopycabfiletoNetworkLocation()
'On Error Resume Next
Dim l_strDemoFolder, l_strFile, l_oFileCollection
Dim l_offSacnIniPath, l_SourceFolder, l_destinationFolder
l_offSacnIniPath="bits\offscan.ini"
l_SourceFolder="%temp%\offscan" '%temp%\offscan - this shold be same as in offscan.ini file.
'//--------------- Specify the Share name (share name should end with "\" )--------------------
l_destinationFolder= "\\server\sharename\"
l_offSacnIniPath = oFso.BuildPath(g_strRoot,l_offSacnIniPath)
If oFso.FileExists(l_offSacnIniPath) Then
l_SourceFolder = oWsh.ExpandEnvironmentStrings(l_SourceFolder)
Set l_strDemoFolder = oFso.GetFolder(l_SourceFolder)
Set l_oFileCollection = l_strDemoFolder.Files
For Each l_strFile in l_oFileCollection
oFso.CopyFile l_strFile,l_destinationFolder
Next
Set l_oFileCollection = Nothing
Set l_strDemoFolder = Nothing
End If
If oFso.FileExists(g_optFile) Then
oFso.CopyFile g_optFile,l_destinationFolder
End If
End Sub
이 문서의 다운로드
이 항목은 다운로드 가능한 다음 문서에도 포함되어 있어 더 쉽게 읽고 인쇄할 수 있습니다.
-
사용 가능한 문서의 전체 목록은 다운로드 가능한 2007 Office Resource Kit 관련 콘텐츠 (영문)를 참조하십시오.