Descripción Determina si los productos de Microsoft Office se instalaron mediante el modo de usuario o de PC. Código de la secuencia de comandos 'Copyright (c) 2005, Microsoft Corporation Const cOffice = "78E1-11D2-B60F-006097C998E7}.6000-11D3-8CFE-0050048383C9} .6000-11D3-8CFE-0150048383C9}.BDCA-11D1-B7AE-00C04FB92F3D} .6D54-11D4-BEE3-00C04F990354}" Const cReadOnly = 0: Const cForWriting = 2: Const cPID_WORDCOUNT = 15 Const cHKEY_CLASSES_ROOT = &H80000000: Const iProdLen = 28
On Error Resume Next
Set msi = CreateObject("WindowsInstaller.Installer")
If Err.Number = 0 Then
'Initialize/Reset it to empty string
sOutput = vbNullString
'Create the shell object to gather computername and
temp directory information
Set wshl = CreateObject("WScript.Shell")
sComputerName = wshl.ExpandEnvironmentStrings("%COMPUTERNAME%")
sTempDir = wshl.ExpandEnvironmentStrings("%TEMP%")
sPathOutputFolder = sTempDir &"\"
'Write computername to output string
sOutput = "Computername: " & sComputerName &
vbCrLf & vbCrLf
'Iterate through all installed PRODUCTS based on Windows Installer
For Each prod In msi.Products
'Check if the current product is within the Office family
If InStr(cOffice, UCase(Right(prod, iProdLen))) > 0 Then
'Gather information from ProductInfo
sProductName = msi.ProductInfo(prod, "ProductName")
If msi.ProductInfo(prod, "AssignmentType") = 0 Then
SAssignment = "Installation Type = ""Per-User"" mode."
Else
SAssignment = "Installation Type = ""Per-Computer"" mode."
End If
'Write product information to output string
sOutput = sOutput & sProductName & vbCrLf &
SAssignment & vbCrLf & vbCrLf
End If
Next
'Clean up objects
Set msi = Nothing
'Create FileSystemObject for logfile generation
Set fso = CreateObject("Scripting.FileSystemObject")
Set fileOutput = fso.OpenTextFile(sPathOutputFolder & "\" &
sComputerName & ".txt", cForWriting, True, True)
fileOutput.Write sOutput
fileOutput.CloseMsgBox "Logfile has been created as " & sPathOutputFolder & sComputerName & ".txt" wshl.Run sPathOutputFolder & sComputerName & ".txt" Set wshl = Nothing 'Clean up FileSystemObject Set fso = Nothing End If Para recibir soporte en línea de un colega, únase a la comunidad microsoft.public.windows.server.scripting en el servidor de noticias msnews.microsoft.com. Para proporcionar retroalimentación o información sobre errores en las secuencias de comandos muestra o en la Guía de programación, contacte Microsoft TechNet. Renuncia Las cadenas de comandos que se presentan como muestra no reciben soporte en ningún programa o servicio estándar de soporte de Microsoft. Las cadenas de comandos muestra se proporcionan COMO ESTÁN sin garantía alguna. Microsoft también renuncia a cualquier garantía implícita, incluyendo de manera enunciativa más no limitativa cualquier garantía de comerciabilidad o adecuación para un propósito específico. Usted asume todo el riesgo que se derive del uso o el rendimiento de las cadenas de comandos muestra y la documentación. En ningún caso Microsoft, sus autores u otra persona involucrada en la creación, producción o entrega de las cadenas de comandos será responsable por ningún tipo de daño, cualquiera que éste sea (incluyendo, de manera enunciativa mas no limitativa, daños por pérdida de utilidades comerciales, interrupción del negocio, pérdida de información de negocios, o pérdida pecuniaria) que surja del uso o la incapacidad para usar las cadenas de comandos muestra o la documentación, incluso si Microsoft ha advertido la posibilidad de dichos daños. |