Script di distribuzione SMS di esempio per Gestione pianificazione migrazioni di Microsoft Office
Aggiornamento: gennaio 2009
Si applica a: Office Resource Kit
Ultima modifica dell'argomento: 2009-01-13
È possibile utilizzare uno script simile al seguente che chiama questi file dalla condivisione file centrale. Lo script può essere distribuito con 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
Scaricare il manuale
Questo argomento è incluso nel manuale seguente, che può essere scaricato per una lettura e una stampa più agevoli:
Informazioni di riferimento tecnico per la versione 2007 di Office
Per un elenco completo dei manuali disponibili, vedere la pagina di informazioni sul contenuto scaricabile per Office Resource Kit 2007 (informazioni in lingua inglese).