Harvesting asset info and output to CSV
I need a script modified that will run on all servers in a work group in order to gather asset data on the appliances running Windows Server 2000 embedded edition. There are no domain services and these systems and this network technology is not an option
in our environment due to proprietary security, networking and infrastructure restrictions. I have found a script that works but i need it modified to output to a csv as it wont output and .xls .xlsx properly. The script will be run on the only computer on
the network that can access these devices. Any help on this would be awesome.
' Get Windows Server Information
' Written By Kely Mulcahey, E.C.S. LLC.
' Created: March 1, 2006
' Version: 3.0, Revised 5/30/2014
On Error Resume Next
Dim PUBOSVer ' Global OS Version
' Open File For Writing
Set WshNetwork = WScript.CreateObject("WScript.Network")
Const ForReading = 1
' Get Server List
strServerFilename = "servers.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strServerFilename) Then
' Open Servers File
Set objServers = objFSO.OpenTextFile(strServerFilename, ForReading)
Else
' Server File is missing: Exit
intMsg = MsgBox("File: " & Chr(34) & UCASE(strServerFilename) & Chr(34) & _
" is either " & _
"Missing or Damaged!" & vbcrlf & _
vbcrlf & _
"This Script will now Exit.", vbCritical, "Server File Error")
WScript.Quit(0)
End If
Do Until objServers.AtEndOfStream
strNewServer = Trim(objServers.ReadLine)
strServerList = strServerList & strNewServer & vbcrlf
intServerCnt = intServerCnt + 1
Loop
' Enumerate Server Array
For a = 0 To intServerCnt - 1
strServer = Split(strServerList, vbcrlf)
Next
' Create Excel Spreadsheet
Set objXLA = CreateObject("Excel.Application")
objXLA.Visible = False
objXLA.DisplayAlerts = False
Set objWorkbook = objXLA.Workbooks.Add()
Set objWorksheet = objWorkbook.Worksheets(1)
'Excel Constants
Const xlEdgeLeft = 7
Const xlContinuous = 1
Const xlNone = -4142
Const xlMedium = -4138
Const xlThin = 2
'Set Headers
' System Information
objXLA.Cells(1,1).Value = "Service ID"
objXLA.Cells(1,2).Value = "Company Name"
objXLA.Cells(1,3).Value = "Manufacturer"
objXLA.Cells(1,4).Value = "Model"
objXLA.Cells(1,5).Value = "Operating System"
' Processors
objXLA.Cells(1,6).Value = "Processor Type"
objXLA.Cells(1,7).Value = "Processors"
' RAM
objXLA.Cells(1,8).Value = "RAM"
objXLA.Cells(1,9).Value = "Slots"
objXLA.Cells(1,10).Value = "Max Capacity"
' Network
objXLA.Cells(1,11).Value = "NIC Port"
objXLA.Cells(1,12).Value = "Speed"
objXLA.Cells(1,13).Value = "Connection Name"
objXLA.Cells(1,14).Value = "Primary IP"
objXLA.Cells(1,15).Value = "Virtual IP"
objXLA.Cells(1,16).Value = "Primary DNS"
objXLA.Cells(1,17).Value = "Secondary DNS"
' Hard Disks
objXLA.Cells(1,18).Value = "Interface"
objXLA.Cells(1,19).Value = "Physical Disks"
objXLA.Cells(1,20).Value = "Disk Size"
objXLA.Cells(1,21).Value = "Fault Tolerant"
objXLA.Cells(1,22).Value = "Hot Spare"
' Set Top Line
objXLA.Cells(1, 1).EntireRow.Font.Bold = True
objXLA.Cells(1, 1).EntireRow.Font.Underline = True
For b = 0 To UBound(strServer) - 1
strServerParts = Split(strServer(b), " ")
strComputer = strServerParts(0)
' Parse Server Information
If UBound(strServerParts) = 2 Then
strUsername = Trim(strServerParts(1))
strPassword = Trim(strServerParts(2))
End If
' Create Connection Object
Set objWMIService = Nothing
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objSWbemLocator.ConnectServer _
(strComputer, "root\cimv2", strUsername, strPassword)
objWMIServices.Security_.ImpersonationLevel = 3
' Check if Server Exists
For intWMICheck = 0 To 15
If Not objWMIService Is Nothing Then
Exit For
Else
WScript.Sleep(1000)
End If
Next
' Server Exists
If intWMICheck < 15 Then
' Get CPU Information
Set colProcessor = objWMIService.ExecQuery("SELECT * FROM Win32_Processor")
For Each colProc In colProcessor
strManuf = colProc.Manufacturer
strDescription = ProcessorName(colProc.Name)
strClockSpeed = colProc.CurrentClockSpeed
strSocket = strSocket & colProc.SocketDesignation & vbcrlf
strProcID = strProcID & colProc.ProcessorID & vbcrlf
strUniqueID = strUniqueID & colProc.UniqueID & vbcrlf
ProcCount = ProcCount + 1
Next
' Determine if Hyperthreading is Enabled
strHTStatus = GetHTStatus(strSocket, ProcCount, strProcID, strUniqueID)
' DC / HT Results
If strHTStatus = "True" Then
If InStr(strManuf, "Intel") Then
strDescription = strDescription & " (Dual Core or H/T)"
Else
strDescription = strDescription & " (Dual Core)"
End If
ProcCount = ProcCount / 2
End If
' Export Information
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colCS = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
' Write Basic System Information
For Each objItem in colCS
Set colOS = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objItemOS in colOS
' Get SP Version
If objItemOS.CSDVersion <> "" Then
strSPVersion = objItemOS.CSDVersion
Else
strSPVersion = "No Service Packs Installed"
End If
If objItemOS.LastBootUpTime <> "" Then
strLastBoot = DateConvert(objItemOS.LastBootUpTime)
Else
strLastBoot = "N/A"
End If
' Set OS Version Information
PUBOSVer = objItemOS.Caption
objXLA.Cells(b + 2, 1).Value = objItemOS.csname
objXLA.Cells(b + 2, 3).Value = objItem.Manufacturer
objXLA.Cells(b + 2, 4).Value = objItem.Model
objXLA.Cells(b + 2, 5).Value = PUBOSVer & " - " & strSPVersion
objXLA.Cells(b + 2, 6).Value = strDescription
objXLA.Cells(b + 2, 7).Value = ProcCount
objXLA.Cells(b + 2, 8).Value = MemoryConvert(objItem.TotalPhysicalMemory)
Next
Next
' Get Memory Breakdown
Dim strMemBreak
strMemBreak = Split(MemoryBreakdown(), vbcrlf)
n = 0
For n = 0 To UBound(strMemBreak) - 1
strSlots = strSlots & strMemBreak(n) & Chr(10)
Next
strMaxCapacity = strMemBreak(UBound(strMemBreak))
objXLA.Cells(b + 2, 9).Value = Left(strSlots, Len(strSlots) - 1)
objXLA.Cells(b + 2, 10).Value = strMaxCapacity
' Dispose
strMemBreak = ""
strMaxCapacity = ""
strSlots = ""
'--------------Computer Information (End)------------------'
'-------------Partition Information (Start)----------------'
' Get Drive Count
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set DiskItemsParent = objWMIService.ExecQuery("Select * from Win32_DiskDrive")
intCount = DiskItemsParent.Count
' Process Drives
intDriveMark = 0
For i = 0 To intCount - 1
Set DiskItems = objWMIService.ExecQuery("Select * from Win32_DiskDrive WHERE Index = " & i)
For Each diskItem in DiskItems
' Convert Drive Size
If diskItem.Size <> "" Then strSize = strSize & ByteConvert(diskItem.Size) & Chr(10) Else strSize = "N/A" & Chr(10)
If diskItem.StatusInfo <> "" Then strStsInfo = diskItem.StatusInfo Else strStsInfo = "N/A"
If diskItem.SCSIBus <> "" Then strSCSIBus = diskItem.SCSIBus Else strSCSIBus = "N/A"
If diskItem.SCSILogicalUnit <> "" Then strSCSILog = diskItem.SCSILogicalUnit Else strSCSILog = "N/A"
If diskItem.SCSIPort <> "" Then strSCSIPort = diskItem.SCSIPort Else strSCSIPort = "N/A"
If diskItem.SCSITargetId <> "" Then strSCSITarget = diskItem.SCSITargetId Else strSCSITarget = "N/A"
' Get Model
strModel = Split(diskItem.Model, " ")
' Detect HP Array
If (UCase(strModel(0)) = "HP" Or UCase(strModel(0)) = "COMPAQ") And intDriveMark = 0 Then
strGetHPArray = GetHPArray(strComputer, strUsername, strPassword)
If strGetHPArray <> "" Then
strSplitHP = Split(strGetHPArray, Chr(13))
For a = 0 To UBound(strSplitHP)
strSplitResult = Split(strSplitHP(a), ":")
i = i + 1
strDriveCount = strDriveCount & Trim(strSplitResult(0)) & Chr(10)
strDriveSize = strDriveSize & Trim(strSplitResult(1)) & Chr(10)
strDriveFault = strDriveFault & Trim(strSplitResult(2)) & Chr(10)
strDriveSpare = strDriveSpare & Trim(strSplitResult(3)) & Chr(10)
strInterface = strInterface & "HP SCSI" & Chr(10)
Next
' Set Controller Output
objXLA.Cells(b + 2, 19).Value = Trim(Left(strDriveCount, Len(strDriveCount) - 1))
objXLA.Cells(b + 2, 20).Value = Trim(Left(strDriveSize, Len(strDriveSize) - 1))
objXLA.Cells(b + 2, 21).Value = Trim(Left(strDriveFault, Len(strDriveFault) - 1))
objXLA.Cells(b + 2, 22).Value = Trim(Left(strDriveSpare, Len(strDriveSpare) - 1))
intDriveMark = 1 ' Mark That Data was Obtained
Else
strDriveCount = strDriveCount & "1" & Chr(10)
strDriveSize = strDriveSize & strSize & Chr(10)
strDriveFault = strDriveFault & "N/A" & Chr(10)
strDriveSpare = strDriveSpare & "N/A" & Chr(10)
strInterface = strInterface & "HP SCSI " & Chr(10)
' Set Controller Output
intDriveMark = 1 ' Mark That Another Pass is Invalid
' Set Controller Output
objXLA.Cells(b + 2, 19).Value = Trim(Left(strDriveCount, Len(strDriveCount) - 1))
objXLA.Cells(b + 2, 20).Value = Trim(Left(strDriveSize, Len(strDriveSize) - 1))
objXLA.Cells(b + 2, 21).Value = Trim(Left(strDriveFault, Len(strDriveFault) - 1))
objXLA.Cells(b + 2, 22).Value = Trim(Left(strDriveSpare, Len(strDriveSpare) - 1))
End If
Else
strDriveCount = strDriveCount & "1" & Chr(10)
strDriveSize = strDriveSize & strSize & Chr(10)
strDriveFault = strDriveFault & "N/A" & Chr(10)
strDriveSpare = strDriveSpare & "N/A" & Chr(10)
' Set Controller Output
intDriveMark = 1 ' Mark That Another Pass is Invalid
' Set Controller Output
objXLA.Cells(b + 2, 19).Value = Trim(Left(strDriveCount, Len(strDriveCount) - 1))
objXLA.Cells(b + 2, 20).Value = Trim(Left(strDriveSize, Len(strDriveSize) - 1))
objXLA.Cells(b + 2, 21).Value = Trim(Left(strDriveFault, Len(strDriveFault) - 1))
objXLA.Cells(b + 2, 22).Value = Trim(Left(strDriveSpare, Len(strDriveSpare) - 1))
' Set Interface
If diskItem.InterfaceType = "IDE" Then
strInterface = strInterface & "ATA" & Chr(10)
Else
strInterface = strInterface & "SATA/SCSI" & Chr(10)
End If
End If
' Set Cell Value "Interface"
objXLA.Cells(b + 2, 18).Value = Left(strInterface, Len(strInterface) - 1)
Next
' Dispose Drive Sizes
strDriveSize = ""
Next
' Dispose Drive Values
strDriveCount = ""
strDriveFault = ""
strDriveSpare = ""
strInterface = ""
'----Partition Information (End)---------------------------'
'----Network Information (Start)---------------------------'
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter")
i = 1
eth = 0
Dim STOREDIP(0)
intNum = 0
For Each objItem in colItems
If objItem.NetConnectionStatus <> "" Then
' Determine Connection Status
If objItem.NetConnectionStatus = 0 Then
strNetStat = "Disabled"
ElseIf objItem.NetConnectionStatus = 2 Then
strNetStat = "Connected"
ElseIf objItem.NetConnectionStatus = 7 Then
strNetStat = "Disconnected"
Else
strNetStat = "Unknown"
End If
If objItem.NetConnectionStatus <> 0 Then
' Get Network Card Information
Const HKEY_LOCAL_MACHINE = &H80000002
strKeyPath1 = "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"
strKeyPath2 = "SYSTEM\CurrentControlSet\Services\NetBT\Parameters"
strHostEntry = "Hostname"
strDomainEntry = "Domain"
strNodeEntry = "DhcpNodeType"
strRoutingEntry = "IPEnableRouter"
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath1,strHostEntry,strHostname
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath1,strDomainEntry,strDomain
objReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath2,strNodeEntry,dwNodeType
objReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath1,strRoutingEntry,dwIPRouting
Select Case dwNodeType
Case 4 strNodeType = "Mixed"
Case 8 strNodeType = "Hybrid"
Case Else strNodeType = dwNodeType
End Select
If dwIPRouting = 0 Then
strIPRouting = "No"
ElseIf dwIPRouting = 1 Then
strIPRouting = "Yes"
Else
strIPRouting = "?"
End If
Set colFirstNicConfig = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each objFirstNicConfig In colFirstNicConfig
strDnsWins = objFirstNicConfig.DNSEnabledForWINSResolution
Next
Set colNicConfigs = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
' Display per-adapter settings.
For Each objNicConfig In colNicConfigs
intIndex = objNicConfig.Index
Set objNic = objWMIService.Get("Win32_NetworkAdapter.DeviceID=" & intIndex)
' Connection Name
If GetOsVer > 5 Then
' Works only in XP / 2003
strNetConn = objNic.NetConnectionID
ElseIf GetOsVer = 5 Then
strNetConn = ""
' Get Home Drive of Remote Server
Set objShell = CreateObject("WScript.Shell")
Set objEtherName = objShell.Exec("cmd /c ipconfig | find " & Chr(34) & "Ethernet" & Chr(34))
strEtherName = objEtherName.StdOut.ReadAll()
strEtherParse = Split(strEtherName, Chr(13))
strEtherConn = Split(strEtherParse(eth), " ")
For y = 2 To UBound(strEtherConn)
strNetConn = strNetConn & " " & strEtherConn(y)
Next
' Trim Connection Name
strNetConn = Left(Trim(strNetConn), Len(Trim(strNetConn)) - 1)
Else
strNetConn = ""
End If
' IP Addresses
strIPAddresses = ""
If Not IsNull(objNicConfig.IPAddress) Then
For Each strIPAddress In objNicConfig.IPAddress
strIPAddresses = strIPAddresses & strIPAddress & " "
Next
End If
strIPCollection = Split(strIPAddresses, " ")
' Subnets
strIPSubnets = ""
If Not IsNull(objNicConfig.IPSubnet) Then
For Each strIPSubnet In objNicConfig.IPSubnet
strIPSubnets = strIPSubnets & strIPSubnet & " "
Next
End If
strSMCollection = Split(strIPSubnets, " ")
' Virtual IP's
strVirtual = ""
If UBound(strIPCollection) > 1 Then
For IPCount = 1 To UBound(strIPCollection) - 1
strVirtual = strVirtual & (strIPCollection(IPCount) & " / " & strSMCollection(IPCount)) & Chr(10)
Next
strVirtual = Left(strVirtual, Len(strVirtual) - 1)
End If
If Trim(strVirtual) = "" Then strVirtual = "N/A"
' Gateways
strDefaultIPGateways = ""
If Not IsNull(objNicConfig.DefaultIPGateway) Then
For Each strDefaultIPGateway In objNicConfig.DefaultIPGateway
strDefaultIPGateways = strDefaultIPGateways & strDefaultIPGateway & " "
Next
Else
strDefaultIPGateways = "N/A"
End If
' If IP is repeated, and was already reported.
intSkipLoop = 0
If Trim(strNetConn) <> "" Then
For j = 0 To intNum - 1
If STOREDIP(j) = strIPAddresses Then
intSkipLoop = 1
Exit For
End If
Next
If intSkipLoop = 0 Then
ReDim Preserve STOREDIP(intNum)
STOREDIP(intNum) = strIPAddresses
intNum = intNum + 1
End If
Else
intSkipLoop = 1
End If
' DNS
strDNSServerSearchOrder = ""
If Not IsNull(objNicConfig.DNSServerSearchOrder) Then
For Each strDNSServer In objNicConfig.DNSServerSearchOrder
strDNSServerSearchOrder = strDNSServerSearchOrder & strDNSServer & " "
Next
strDNS = Split(strDNSServerSearchOrder, " ")
strDNS1 = strDNS(0)
If Trim(strDNS1) = "" Then strDNS1 = "N/A"
If UBound(strDNS) > 1 Then
strDNS2 = strDNS(1)
Else
strDNS2 = "N/A"
End If
Else
strDNS1 = "N/A"
strDNS2 = "N/A"
End If
' Run Output Process
If intSkipLoop = 0 Then
' Connection Speed
strSpeed = "Unknown"
Set objWMIService2 = objSWbemLocator.ConnectServer _
(strComputer, "root\WMI", strUsername, strPassword)
objWMIServices.Security_.ImpersonationLevel = 3
Set listAdapters = objWMIService2.ExecQuery("SELECT * FROM MSNdis_LinkSpeed")
Set enumAdapters = objWMIService2.ExecQuery("SELECT * FROM MSNdis_EnumerateAdapter")
For Each objAdapter in listAdapters
For Each objEnum in enumAdapters
intEnum = Len(objEnum.DeviceName)
If objNicConfig.SettingID = Right(objEnum.DeviceName, intEnum - 8) Then
If objEnum.InstanceName = objAdapter.InstanceName Then
intLength = Len(objAdapter.NdisLinkSpeed/10000)
If intLength > 3 Then
strSpeed = Left(objAdapter.NdisLinkSpeed/10000, intLength - 3)
strSpeed = strSpeed & ".0 Gbps"
Else
strSpeed = objAdapter.NdisLinkSpeed/10000 & " Mbps"
End If
End If
End If
Next
Next
strTotalDesc = strTotalDesc & objNicConfig.Description & Chr(10)
strTotalSpeed = strTotalSpeed & strSpeed & Chr(10)
strTotalNetConn = strTotalNetConn & strNetConn & Chr(10)
strPrimaryIP = strPrimaryIP & strIPCollection(0) & " / " & strSMCollection(0) & Chr(10)
strDNSTotal1 = strDNSTotal1 & strDNS1 & Chr(10)
strDNSTotal2 = strDNSTotal2 & strDNS2 & Chr(10)
strTotalVirtual = strTotalVirtual & strVirtual & Chr(10)
i = i + 1
eth = eth + 2
' Dispose
strDescription = ""
ProcCount = 0
strClockSpeed = ""
strInterface = ""
intCount = 0
strSize = ""
strSpeed = ""
strIPCollection = ""
strVirtual = ""
strDNS = ""
strDNS1 = ""
strDNS2 = ""
End If
Next
' Output
' Trim Leading Chr(10)
If Left(strPrimaryIP, 1) = Chr(10) Then strPrimaryIP = Right(strPrimaryIP, Len(strPrimaryIP) - 1)
If Left(strTotalVirtual, 1) = Chr(10) Then strTotalVirtual = Right(strTotalVirtual, Len(strTotalVirtual) - 1)
If Left(strDNSTotal1, 1) = Chr(10) Then strDNSTotal1 = Right(strDNSTotal1, Len(strDNSTotal1) - 1)
If Left(strDNSTotal2, 1) = Chr(10) Then strDNSTotal2 = Right(strDNSTotal2, Len(strDNSTotal2) - 1)
objXLA.Cells(b + 2, 11).Value = Trim(Left(strTotalDesc, Len(strTotalDesc) - 1))
objXLA.Cells(b + 2, 12).Value = Trim(Left(strTotalSpeed, Len(strTotalSpeed) - 1))
objXLA.Cells(b + 2, 13).Value = Trim(Left(strTotalNetConn, Len(strTotalNetConn) - 1))
objXLA.Cells(b + 2, 14).Value = Trim(Left(strPrimaryIP, Len(strPrimaryIP) - 1))
objXLA.Cells(b + 2, 15).Value = Trim(Left(strTotalVirtual, Len(strTotalVirtual) - 1))
objXLA.Cells(b + 2, 16).Value = Trim(Left(strDNSTotal1, Len(strDNSTotal1) - 1))
objXLA.Cells(b + 2, 17).Value = Trim(Left(strDNSTotal2, Len(strDNSTotal2) - 1))
End If
End If
' Dispose Per Loop
strTotalDesc = ""
strTotalSpeed = ""
strTotalNetConn = ""
strPrimaryIP = ""
strDNSTotal1 = ""
strDNSTotal2 = ""
strTotalVirtual = ""
Set eth = 0
Set i = 0
Next
'------------Network Information (End)------------------'
Else
'No Data Present
objXLA.Cells(b + 2, 1).Value = strComputer
objXLA.Cells(b + 2, 3).Value = "Information Not Available"
objXLA.Cells(b + 2, 1).EntireRow.Font.Bold = True
objXLA.Cells(b + 2, 1).EntireRow.Interior.ColorIndex = 44
End If
' Dispose Per Server
ProcCount = 0
strSocket = ""
strProcID = ""
strUniqueID = ""
Set objWMIService = Nothing
Next
'-----------------Functions (Start)---------------------'
' System Memory Conversion
Function MemoryConvert(strMem)
Dim intLength
Dim intExp
Dim intSize
Dim strSize
Dim strMeasure
Dim strMemory
intLength = Len(strMem)
If (intLength Mod 4 = 0) Then
intExp = CInt((intLength / 3) - 2)
Else
intExp = CInt((intLength / 3) - 1)
End If
' Convert to Lowest Integer Value
For intCount = 1 To Len(intExp)
chrRead = Mid(intExp, intCount, 1)
If chrRead = "." Then
Exit For
Else
strRead = strRead & chrRead
End If
Next
intExp = Cint(strRead)
intSize = CLng(strMem / (2 ^ (intExp * (10))))
If Len(intSize) = 1 Then
strFormat = FormatNumber(CStr(intSize), 2)
Else
strFormat = intSize + 1
End If
If (intExp = 1) Then
strMeasure = "KB"
ElseIf (intExp = 2) Then
strMeasure = "MB"
ElseIf (intExp = 3) Then
strMeasure = "GB"
ElseIf (intExp = 4) Then
strMeasure = "TB"
ElseIf (intExp = 5) Then
strMeasure = "PB"
ElseIf (intExp = 6) Then
strMeasure = "EB"
End If
MemoryConvert = strFormat & " " & strMeasure
End Function
' System Byte Conversion
Function ByteConvert(strMem)
Dim intLength
Dim intExp
Dim intSize
Dim strSize
Dim strMeasure
Dim strMemory
intLength = Len(strMem)
If (intLength Mod 3 = 0) Then
intExp = (intLength / 3) - 1
Else
intExp = (intLength / 3)
End If
' Convert to Lowest Integer Value
For intCount = 1 To Len(intExp)
chrRead = Mid(intExp, intCount, 1)
If chrRead = "." Then
Exit For
Else
strRead = strRead & chrRead
End If
Next
intExp = Cint(strRead)
intSize = CLng(strMem / (2 ^ (intExp * (10))))
strFormat = FormatNumber(CStr(intSize), 2)
If (intExp = 1) Then
strMeasure = "KB"
ElseIf (intExp = 2) Then
strMeasure = "MB"
ElseIf (intExp = 3) Then
strMeasure = "GB"
ElseIf (intExp = 4) Then
strMeasure = "TB"
ElseIf (intExp = 5) Then
strMeasure = "PB"
ElseIf (intExp = 6) Then
strMeasure = "EB"
End If
ByteConvert = strFormat & " " & strMeasure
End Function
' System RAID Byte Conversion
Function ByteConvertRAID(strMem)
Dim intLength
Dim intExp
Dim intSize
Dim strSize
Dim strMeasure
Dim strMemory
intLength = Len(strMem)
If (intLength Mod 3 = 0) Then
intExp = (intLength / 3) - 1
Else
intExp = (intLength / 3)
End If
' Convert to Lowest Integer Value
For intCount = 1 To Len(intExp)
chrRead = Mid(intExp, intCount, 1)
If chrRead = "." Then
Exit For
Else
strRead = strRead & chrRead
End If
Next
intExp = Cint(strRead)
intSize = (strMem / (2 ^ (intExp * (10))))
strFormat = FormatNumber(CStr(intSize), 2)
If (intExp = 0) Then
strMeasure = "MB"
ElseIf (intExp = 1) Then
strMeasure = "GB"
ElseIf (intExp = 2) Then
strMeasure = "TB"
ElseIf (intExp = 3) Then
strMeasure = "PB"
ElseIf (intExp = 4) Then
strMeasure = "EB"
End If
ByteConvertRAID = strFormat & " " & strMeasure
End Function
' Trim Processor Description
Function ProcessorName(strName)
Dim intCounter
Dim strRead
Dim chrRead, chrReadMore
For intCounter = 1 to Len(strName)
chrRead = Mid(strName, intCounter, 1)
chrReadMore = Mid(strName, intCounter + 1, 1)
If ((chrRead <> " ") Or ((chrRead = " ") And (chrReadMore <> " "))) Then
strRead = strRead & chrRead
End If
Next
ProcessorName = Trim(strRead)
End Function
' Get Hyper-Threading Status
Function GetHTStatus(strName, intProc, strID, strUnique)
strNameArray = Split(strName, vbcrlf)
strIDArray = Split(strID, vbcrlf)
strUniqueList = Split(strUnique, vbcrlf)
intTotal = 0
' Check Socket Designation
For i = 0 To UBound(strNameArray) - 1
intMark = 1
' Check for Redundancies
For j = i + 1 To UBound(strNameArray) - 1
If strNameArray(i) = strNameArray(j) Then
intMark = 0
End If
Next
' If Redundant Unique ID's Exist
For j = i + 1 To UBound(strNameArray) - 1
If strUniqueList(i) <> "" And strUniqueList(j) <> "" And _
(strUniqueList(i) <> strUniqueList(j)) Then
intMark = 1
End If
Next
' Check for NULL ProcessorID
If Trim(strIDArray(i)) = "0000000000000000" Then
intMark = 0
End If
' Calculate Total
If intMark = 1 Then
intTotal = intTotal + intMark
End If
Next
' Compare Results
If intProc = 2 * intTotal Then
GetHTStatus = "True"
Else
GetHTStatus = "False"
End If
End Function
' Get Memory Breakdown
Function MemoryBreakdown
Set colPMAItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemoryArray",,48)
For Each objPMAItem in colPMAItems
lngMax = CLng(objPMAItem.MaxCapacity)
intCount = CInt(objPMAItem.MemoryDevices)
Next
ReDim Preserve strPMArray(intCount)
Set colPMItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory",,48)
For Each objPMItem in colPMItems
strValue = strValue & objPMItem.DeviceLocator & ": "
strValue = strValue & objPMItem.Capacity / 2^20 & "MB, "
strValue = strValue & objPMItem.Speed & "MHz"
strPMArray(TrimTrailingNumber(objPMItem.Tag)) = strValue
strValue = ""
Next
j = 0
strResult = ""
For j = 0 To intCount - 1
If Trim(strPMArray(j)) = "" Then strPMArray(j) = "<Empty>"
strResult = strResult & strPMArray(j) & vbcrlf
Next
strResult = strResult & (lngMax / 2^10) & "MB"
MemoryBreakdown = strResult
End Function
' Get Part Name
Function ExtractPartName(strName)
Dim chrRead
Dim strRead
Dim i
For i = 2 To Len(strName)
chrRead = Mid(strName, Len(strName) - (i - 1), 1)
If chrRead <> Chr(34) Then
strRead = chrRead & strRead
Else
Exit For
End If
Next
ExtractPartName = strRead
End Function
' Get Trailing Number
Function TrimTrailingNumber(strNum)
Dim chrRead
Dim strRead
Dim intLen
strNum = Trim(strNum)
intLen = Len(strNum)
i = 1
For i = 1 To intLen
chrRead = Mid(strNum, intLen - (i - 1), 1)
If IsNumeric(chrRead) = "True" Then
strRead = chrRead & strRead
Else
Exit For
End If
Next
TrimTrailingNumber = strRead
End Function
' Function: WMIDateStringToDate(dtmDate)
Function WMIDateToString(dtmDate)
WMIDateToString = CDate(Mid(dtmDate, 5, 2) & "/" & _
Mid(dtmDate, 7, 2) & "/" & _
Left(dtmDate, 4) & " " & _
Mid(dtmDate, 9, 2) & ":" & _
Mid(dtmDate, 11, 2) & ":" & _
Mid(dtmDate, 13, 2))
End Function
' Function: GetOsVer
Function GetOsVer
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem In colOperatingSystems
GetOSVer = CSng(Left(objOperatingSystem.Version, 3))
Next
End Function
' Function: GetHPArray
Function GetHPArray(strComputer2, strUsername2, strPassword2)
' Check for 64-bit Windows
If InStr(PUBOSVer, "x64") Then
strCompaq = "Program Files (x86)\Compaq\Cpqacuxe\Bin"
Else
strCompaq = "Program Files\Compaq\Cpqacuxe\Bin"
End If
' Create Connection Object
Set objWMIServiceRem = objWMIService.Get("Win32_Process")
' Confirm Location of Compaq Array Manager
Set objHPShell = CreateObject("WScript.Shell")
Set objHPFSO = CreateObject("Scripting.FileSystemObject")
Set WshNetwork2 = WScript.CreateObject("WScript.Network")
WshNetwork2.MapNetworkDrive "", "\\" & strComputer2 & "\C$" ,,strUsername2, strPassword2
strProgram = "\\" & strComputer2 & "\C$\" & strCompaq & "\cpqacuxe.exe"
' Ensure Access is Possible
If objHPFSO.FileExists(strProgram) Then
' Process Array Config
strProcess = Chr(34) & "C:\" & strCompaq & "\cpqacuxe.exe" & Chr(34) & " -c c:\output.txt"
Process = objWMIServiceRem.Create(strProcess, null, null, intProcessID)
' Check for "output.txt"
For intTimerHP = 0 To 10
If objFSO.FileExists("\\" & strComputer2 & "\C$\output.txt") Then
Exit For
Else
WScript.Sleep(1000)
End If
Next
' Process Output
If intTimerHP < 10 Then
' Check for Locked Output File
Set objHPOutputFile = objHPFSO.GetFile("\\" & strComputer2 & "\C$\output.txt")
If objHPOutputFile.Size <> 0 Then
' Close File
Set objHPOutputFile = Nothing
' Continue Processesing File
Set objHPInputFile = objHPFSO.OpenTextFile("\\" & strComputer2 & "\C$\output.txt", ForReading)
Do Until objHPInputFile.AtEndOfStream
strHPArray = strHPArray & objHPInputFile.ReadLine & vbcrlf
Loop
' Close Input File
objHPInputFile.Close
' Close Link to Server
objHPFSO.DeleteFile("\\" & strComputer2 & "\C$\output.txt")
Set objGetHPArray = objHPShell.Exec("net use \\" & strComputer2 & "\C$ /delete /yes")
Do While (objGetHPArray.Status = 0)
WScript.Sleep(500)
Loop
' Create String Array
strHPParse = Split(strHPArray, vbcrlf)
' Parse For Individual RAID Arrays
Dim strArrayList()
z = 0
For i = 0 To UBound(strHPParse)
j = 0
' Array and Drives
If InStr(strHPParse(i), "Array Specifications") Then
ReDim Preserve strArrayList(z)
strArrayList(z) = strArrayList(z) & strHPParse(i) & vbcrlf
For j = i + 1 To Ubound(strHPParse)
If InStr(strHPParse(j), "Array Specifications") Then
Exit For
Else
strArrayList(z) = strArrayList(z) & strHPParse(j) & vbcrlf
End If
Next
z = z + 1
End If
Next
' Process Each RAID Array
x = 0
For x = 0 To UBound(strArrayList)
strListParse = Split(strArrayList(x), vbcrlf)
For y = 0 To UBound(strListParse)
' Drives
If Left(strListParse(y), 6) = "Drive=" Then
strDrives = ""
strDrives = Split(strListParse(y), ",")
k = 0
For j = 0 To UBound(strDrives)
k = k + 1
Next
strDriveCount = k ' For Output
End If
' Hot Spare
If InStr(strListParse(y), "OnlineSpare=") Then
If InStr(strListParse(y), "OnlineSpare= No") Then
strHotSpare = strHotSpare & "N" ' For Output
Else
strHotSpare = strHotSpare & "Y" ' For Output
End If
End If
' Logical Drives
If InStr(strListParse(y), "Logical Drive Specifications") Then
' Find First Logical Drive
strRAID = Split(strListParse(y + 2), " ")
strRAIDResult = strRAIDResult & "RAID " & strRAID(1) & " / " ' For Output
strGetDrive = Split(strListParse(y + 3), " ")
strRAIDSize = strRAIDSize & ByteConvertRAID(strGetDrive(1)) & " / " ' For Output
End If
Next
' Process Results
strRAIDSize = Left(strRAIDSize, Len(strRAIDSize) - 3)
strRAIDResult = Left(strRAIDResult, Len(strRAIDResult) - 3)
strNewList = strNewList & strDriveCount & _
":" & strRAIDSize & ":" & strRAIDResult & ":" & strHotSpare & Chr(13)
' Dispose Array Variables
strDriveCount = ""
strRAIDSize = ""
strRAIDResult = ""
strHotSpare = ""
Next
' Return Array Output
GetHPArray = Left(strNewList, Len(strNewList) - 1)
Exit Function
Else ' "output.txt" Is Locked
' Close File
Set objHPOutputFile = Nothing
' Kill Remote Connection
Set objGetHPArray = objHPShell.Exec("net use \\" & strComputer2 & "\C$ /delete /yes")
Do While (objGetHPArray.Status = 0)
WScript.Sleep(500)
Loop
GetHPArray = ""
Exit Function
End If
Else ' "output.txt" Does not Exist
' Kill Remote Connection
Set objGetHPArray = objHPShell.Exec("net use \\" & strComputer2 & "\C$ /delete /yes")
Do While (objGetHPArray.Status = 0)
WScript.Sleep(500)
Loop
GetHPArray = ""
Exit Function
End If
Else ' "Array Manager Does not Exist
' Input not Available
Set objGetHPArray = objHPShell.Exec("net use \\" & strComputer2 & "\C$ /delete /yes")
Do While (objGetHPArray.Status = 0)
WScript.Sleep(500)
Loop
GetHPArray = ""
Exit Function
End If
End Function
'--------------------Functions (End)--------------------'
' Set Excel Attributes
Const xlVAlignTop = -4160
Set objRange2 = objWorksheet.UsedRange
objRange2.VerticalAlignment = xlVAlignTop
' Set Font Attributes
objXLA.Cells.Font.Size = 8
objXLA.Cells.Font.Name = "Arial"
objXLA.Cells.Font.ColorIndex = 11
objXLA.Cells.EntireColumn.AutoFit
objXLA.Cells(1, 9).ColumnWidth = 30 ' RAM Slots
objXLA.Cells(1, 11).ColumnWidth = 40 ' NIC Port
objXLA.Cells(1, 13).ColumnWidth = 25 ' Connection Name
objXLA.Cells(1, 14).ColumnWidth = 25 ' Interface IP's
objXLA.Cells(1, 15).ColumnWidth = 25 ' Virtual IP's
objXLA.Cells(1, 16).ColumnWidth = 15 ' DNS1
objXLA.Cells(1, 17).ColumnWidth = 15 ' DNS2
objXLA.Cells(1, 18).ColumnWidth = 15 ' Interface Type
objXLA.Cells.HorizontalAlignment = 2 ' Drive Count
objXLA.Cells(1, 20).ColumnWidth = 20 ' Virtual IP's
objXLA.Cells(1, 21).ColumnWidth = 20 ' Virtual IP's
' Save
set objFSO2 = CreateObject("Scripting.FileSystemObject")
strFileName = objFSO2.getAbsolutePathName("") & "\Scan Results.xls"
objWorkbook.SaveAs(strFileName)
objWorkbook.Close
objXLA.Quit
' Notify User
WScript.Echo "Process Completed (" & Now & ")"
' Close Program
WScript.Quit(0)
I Need my script modified to run this script and output to CSV but its so big I am not sure where to start. I don't need it in XLS at all, and I can add my own headers, cell sizes and colors, etc. so It should just output the data to a simple CSV.
On Error Resume Next
Dim PUBOSVer ' Global OS Version
' Open File For Writing
Set WshNetwork = WScript.CreateObject("WScript.Network")
Const ForReading = 1
' Get Server List
strServerFilename = "servers.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strServerFilename) Then
' Open Servers File
Set objServers = objFSO.OpenTextFile(strServerFilename, ForReading)
Else
' Server File is missing: Exit
intMsg = MsgBox("File: " & Chr(34) & UCASE(strServerFilename) & Chr(34) & _
" is either " & _
"Missing or Damaged!" & vbcrlf & _
vbcrlf & _
"This Script will now Exit.", vbCritical, "Server File Error")
WScript.Quit(0)
End If
Do Until objServers.AtEndOfStream
strNewServer = Trim(objServers.ReadLine)
strServerList = strServerList & strNewServer & vbcrlf
intServerCnt = intServerCnt + 1
Loop
' Enumerate Server Array
For a = 0 To intServerCnt - 1
strServer = Split(strServerList, vbcrlf)
Next
' Create Excel Spreadsheet
Set objXLA = CreateObject("Excel.Application")
objXLA.Visible = False
objXLA.DisplayAlerts = False
Set objWorkbook = objXLA.Workbooks.Add()
Set objWorksheet = objWorkbook.Worksheets(1)
'Excel Constants
Const xlEdgeLeft = 7
Const xlContinuous = 1
Const xlNone = -4142
Const xlMedium = -4138
Const xlThin = 2
'Set Headers
' System Information
objXLA.Cells(1,1).Value = "Service ID"
objXLA.Cells(1,2).Value = "Company Name"
objXLA.Cells(1,3).Value = "Manufacturer"
objXLA.Cells(1,4).Value = "Model"
objXLA.Cells(1,5).Value = "Operating System"
' Processors
objXLA.Cells(1,6).Value = "Processor Type"
objXLA.Cells(1,7).Value = "Processors"
' RAM
objXLA.Cells(1,8).Value = "RAM"
objXLA.Cells(1,9).Value = "Slots"
objXLA.Cells(1,10).Value = "Max Capacity"
' Network
objXLA.Cells(1,11).Value = "NIC Port"
objXLA.Cells(1,12).Value = "Speed"
objXLA.Cells(1,13).Value = "Connection Name"
objXLA.Cells(1,14).Value = "Primary IP"
objXLA.Cells(1,15).Value = "Virtual IP"
objXLA.Cells(1,16).Value = "Primary DNS"
objXLA.Cells(1,17).Value = "Secondary DNS"
' Hard Disks
objXLA.Cells(1,18).Value = "Interface"
objXLA.Cells(1,19).Value = "Physical Disks"
objXLA.Cells(1,20).Value = "Disk Size"
objXLA.Cells(1,21).Value = "Fault Tolerant"
objXLA.Cells(1,22).Value = "Hot Spare"
' Set Top Line
objXLA.Cells(1, 1).EntireRow.Font.Bold = True
objXLA.Cells(1, 1).EntireRow.Font.Underline = True
For b = 0 To UBound(strServer) - 1
strServerParts = Split(strServer(b), " ")
strComputer = strServerParts(0)
' Parse Server Information
If UBound(strServerParts) = 2 Then
strUsername = Trim(strServerParts(1))
strPassword = Trim(strServerParts(2))
End If
' Create Connection Object
Set objWMIService = Nothing
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objSWbemLocator.ConnectServer _
(strComputer, "root\cimv2", strUsername, strPassword)
objWMIServices.Security_.ImpersonationLevel = 3
' Check if Server Exists
For intWMICheck = 0 To 15
If Not objWMIService Is Nothing Then
Exit For
Else
WScript.Sleep(1000)
End If
Next
' Server Exists
If intWMICheck < 15 Then
' Get CPU Information
Set colProcessor = objWMIService.ExecQuery("SELECT * FROM Win32_Processor")
For Each colProc In colProcessor
strManuf = colProc.Manufacturer
strDescription = ProcessorName(colProc.Name)
strClockSpeed = colProc.CurrentClockSpeed
strSocket = strSocket & colProc.SocketDesignation & vbcrlf
strProcID = strProcID & colProc.ProcessorID & vbcrlf
strUniqueID = strUniqueID & colProc.UniqueID & vbcrlf
ProcCount = ProcCount + 1
Next
' Determine if Hyperthreading is Enabled
strHTStatus = GetHTStatus(strSocket, ProcCount, strProcID, strUniqueID)
' DC / HT Results
If strHTStatus = "True" Then
If InStr(strManuf, "Intel") Then
strDescription = strDescription & " (Dual Core or H/T)"
Else
strDescription = strDescription & " (Dual Core)"
End If
ProcCount = ProcCount / 2
End If
' Export Information
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colCS = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
' Write Basic System Information
For Each objItem in colCS
Set colOS = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objItemOS in colOS
' Get SP Version
If objItemOS.CSDVersion <> "" Then
strSPVersion = objItemOS.CSDVersion
Else
strSPVersion = "No Service Packs Installed"
End If
If objItemOS.LastBootUpTime <> "" Then
strLastBoot = DateConvert(objItemOS.LastBootUpTime)
Else
strLastBoot = "N/A"
End If
' Set OS Version Information
PUBOSVer = objItemOS.Caption
objXLA.Cells(b + 2, 1).Value = objItemOS.csname
objXLA.Cells(b + 2, 3).Value = objItem.Manufacturer
objXLA.Cells(b + 2, 4).Value = objItem.Model
objXLA.Cells(b + 2, 5).Value = PUBOSVer & " - " & strSPVersion
objXLA.Cells(b + 2, 6).Value = strDescription
objXLA.Cells(b + 2, 7).Value = ProcCount
objXLA.Cells(b + 2, 8).Value = MemoryConvert(objItem.TotalPhysicalMemory)
Next
Next
' Get Memory Breakdown
Dim strMemBreak
strMemBreak = Split(MemoryBreakdown(), vbcrlf)
n = 0
For n = 0 To UBound(strMemBreak) - 1
strSlots = strSlots & strMemBreak(n) & Chr(10)
Next
strMaxCapacity = strMemBreak(UBound(strMemBreak))
objXLA.Cells(b + 2, 9).Value = Left(strSlots, Len(strSlots) - 1)
objXLA.Cells(b + 2, 10).Value = strMaxCapacity
' Dispose
strMemBreak = ""
strMaxCapacity = ""
strSlots = ""
'--------------Computer Information (End)------------------'
'-------------Partition Information (Start)----------------'
' Get Drive Count
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set DiskItemsParent = objWMIService.ExecQuery("Select * from Win32_DiskDrive")
intCount = DiskItemsParent.Count
' Process Drives
intDriveMark = 0
For i = 0 To intCount - 1
Set DiskItems = objWMIService.ExecQuery("Select * from Win32_DiskDrive WHERE Index = " & i)
For Each diskItem in DiskItems
' Convert Drive Size
If diskItem.Size <> "" Then strSize = strSize & ByteConvert(diskItem.Size) & Chr(10) Else strSize = "N/A" & Chr(10)
If diskItem.StatusInfo <> "" Then strStsInfo = diskItem.StatusInfo Else strStsInfo = "N/A"
If diskItem.SCSIBus <> "" Then strSCSIBus = diskItem.SCSIBus Else strSCSIBus = "N/A"
If diskItem.SCSILogicalUnit <> "" Then strSCSILog = diskItem.SCSILogicalUnit Else strSCSILog = "N/A"
If diskItem.SCSIPort <> "" Then strSCSIPort = diskItem.SCSIPort Else strSCSIPort = "N/A"
If diskItem.SCSITargetId <> "" Then strSCSITarget = diskItem.SCSITargetId Else strSCSITarget = "N/A"
' Get Model
strModel = Split(diskItem.Model, " ")
' Detect HP Array
If (UCase(strModel(0)) = "HP" Or UCase(strModel(0)) = "COMPAQ") And intDriveMark = 0 Then
strGetHPArray = GetHPArray(strComputer, strUsername, strPassword)
If strGetHPArray <> "" Then
strSplitHP = Split(strGetHPArray, Chr(13))
For a = 0 To UBound(strSplitHP)
strSplitResult = Split(strSplitHP(a), ":")
i = i + 1
strDriveCount = strDriveCount & Trim(strSplitResult(0)) & Chr(10)
strDriveSize = strDriveSize & Trim(strSplitResult(1)) & Chr(10)
strDriveFault = strDriveFault & Trim(strSplitResult(2)) & Chr(10)
strDriveSpare = strDriveSpare & Trim(strSplitResult(3)) & Chr(10)
strInterface = strInterface & "HP SCSI" & Chr(10)
Next
' Set Controller Output
objXLA.Cells(b + 2, 19).Value = Trim(Left(strDriveCount, Len(strDriveCount) - 1))
objXLA.Cells(b + 2, 20).Value = Trim(Left(strDriveSize, Len(strDriveSize) - 1))
objXLA.Cells(b + 2, 21).Value = Trim(Left(strDriveFault, Len(strDriveFault) - 1))
objXLA.Cells(b + 2, 22).Value = Trim(Left(strDriveSpare, Len(strDriveSpare) - 1))
intDriveMark = 1 ' Mark That Data was Obtained
Else
strDriveCount = strDriveCount & "1" & Chr(10)
strDriveSize = strDriveSize & strSize & Chr(10)
strDriveFault = strDriveFault & "N/A" & Chr(10)
strDriveSpare = strDriveSpare & "N/A" & Chr(10)
strInterface = strInterface & "HP SCSI " & Chr(10)
' Set Controller Output
intDriveMark = 1 ' Mark That Another Pass is Invalid
' Set Controller Output
objXLA.Cells(b + 2, 19).Value = Trim(Left(strDriveCount, Len(strDriveCount) - 1))
objXLA.Cells(b + 2, 20).Value = Trim(Left(strDriveSize, Len(strDriveSize) - 1))
objXLA.Cells(b + 2, 21).Value = Trim(Left(strDriveFault, Len(strDriveFault) - 1))
objXLA.Cells(b + 2, 22).Value = Trim(Left(strDriveSpare, Len(strDriveSpare) - 1))
End If
Else
strDriveCount = strDriveCount & "1" & Chr(10)
strDriveSize = strDriveSize & strSize & Chr(10)
strDriveFault = strDriveFault & "N/A" & Chr(10)
strDriveSpare = strDriveSpare & "N/A" & Chr(10)
' Set Controller Output
intDriveMark = 1 ' Mark That Another Pass is Invalid
' Set Controller Output
objXLA.Cells(b + 2, 19).Value = Trim(Left(strDriveCount, Len(strDriveCount) - 1))
objXLA.Cells(b + 2, 20).Value = Trim(Left(strDriveSize, Len(strDriveSize) - 1))
objXLA.Cells(b + 2, 21).Value = Trim(Left(strDriveFault, Len(strDriveFault) - 1))
objXLA.Cells(b + 2, 22).Value = Trim(Left(strDriveSpare, Len(strDriveSpare) - 1))
' Set Interface
If diskItem.InterfaceType = "IDE" Then
strInterface = strInterface & "ATA" & Chr(10)
Else
strInterface = strInterface & "SATA/SCSI" & Chr(10)
End If
End If
' Set Cell Value "Interface"
objXLA.Cells(b + 2, 18).Value = Left(strInterface, Len(strInterface) - 1)
Next
' Dispose Drive Sizes
strDriveSize = ""
Next
' Dispose Drive Values
strDriveCount = ""
strDriveFault = ""
strDriveSpare = ""
strInterface = ""
'----Partition Information (End)---------------------------'
'----Network Information (Start)---------------------------'
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter")
i = 1
eth = 0
Dim STOREDIP(0)
intNum = 0
For Each objItem in colItems
If objItem.NetConnectionStatus <> "" Then
' Determine Connection Status
If objItem.NetConnectionStatus = 0 Then
strNetStat = "Disabled"
ElseIf objItem.NetConnectionStatus = 2 Then
strNetStat = "Connected"
ElseIf objItem.NetConnectionStatus = 7 Then
strNetStat = "Disconnected"
Else
strNetStat = "Unknown"
End If
If objItem.NetConnectionStatus <> 0 Then
' Get Network Card Information
Const HKEY_LOCAL_MACHINE = &H80000002
strKeyPath1 = "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters"
strKeyPath2 = "SYSTEM\CurrentControlSet\Services\NetBT\Parameters"
strHostEntry = "Hostname"
strDomainEntry = "Domain"
strNodeEntry = "DhcpNodeType"
strRoutingEntry = "IPEnableRouter"
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath1,strHostEntry,strHostname
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath1,strDomainEntry,strDomain
objReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath2,strNodeEntry,dwNodeType
objReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath1,strRoutingEntry,dwIPRouting
Select Case dwNodeType
Case 4 strNodeType = "Mixed"
Case 8 strNodeType = "Hybrid"
Case Else strNodeType = dwNodeType
End Select
If dwIPRouting = 0 Then
strIPRouting = "No"
ElseIf dwIPRouting = 1 Then
strIPRouting = "Yes"
Else
strIPRouting = "?"
End If
Set colFirstNicConfig = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each objFirstNicConfig In colFirstNicConfig
strDnsWins = objFirstNicConfig.DNSEnabledForWINSResolution
Next
Set colNicConfigs = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
' Display per-adapter settings.
For Each objNicConfig In colNicConfigs
intIndex = objNicConfig.Index
Set objNic = objWMIService.Get("Win32_NetworkAdapter.DeviceID=" & intIndex)
' Connection Name
If GetOsVer > 5 Then
' Works only in XP / 2003
strNetConn = objNic.NetConnectionID
ElseIf GetOsVer = 5 Then
strNetConn = ""
' Get Home Drive of Remote Server
Set objShell = CreateObject("WScript.Shell")
Set objEtherName = objShell.Exec("cmd /c ipconfig | find " & Chr(34) & "Ethernet" & Chr(34))
strEtherName = objEtherName.StdOut.ReadAll()
strEtherParse = Split(strEtherName, Chr(13))
strEtherConn = Split(strEtherParse(eth), " ")
For y = 2 To UBound(strEtherConn)
strNetConn = strNetConn & " " & strEtherConn(y)
Next
' Trim Connection Name
strNetConn = Left(Trim(strNetConn), Len(Trim(strNetConn)) - 1)
Else
strNetConn = ""
End If
' IP Addresses
strIPAddresses = ""
If Not IsNull(objNicConfig.IPAddress) Then
For Each strIPAddress In objNicConfig.IPAddress
strIPAddresses = strIPAddresses & strIPAddress & " "
Next
End If
strIPCollection = Split(strIPAddresses, " ")
' Subnets
strIPSubnets = ""
If Not IsNull(objNicConfig.IPSubnet) Then
For Each strIPSubnet In objNicConfig.IPSubnet
strIPSubnets = strIPSubnets & strIPSubnet & " "
Next
End If
strSMCollection = Split(strIPSubnets, " ")
' Virtual IP's
strVirtual = ""
If UBound(strIPCollection) > 1 Then
For IPCount = 1 To UBound(strIPCollection) - 1
strVirtual = strVirtual & (strIPCollection(IPCount) & " / " & strSMCollection(IPCount)) & Chr(10)
Next
strVirtual = Left(strVirtual, Len(strVirtual) - 1)
End If
If Trim(strVirtual) = "" Then strVirtual = "N/A"
' Gateways
strDefaultIPGateways = ""
If Not IsNull(objNicConfig.DefaultIPGateway) Then
For Each strDefaultIPGateway In objNicConfig.DefaultIPGateway
strDefaultIPGateways = strDefaultIPGateways & strDefaultIPGateway & " "
Next
Else
strDefaultIPGateways = "N/A"
End If
' If IP is repeated, and was already reported.
intSkipLoop = 0
If Trim(strNetConn) <> "" Then
For j = 0 To intNum - 1
If STOREDIP(j) = strIPAddresses Then
intSkipLoop = 1
Exit For
End If
Next
If intSkipLoop = 0 Then
ReDim Preserve STOREDIP(intNum)
STOREDIP(intNum) = strIPAddresses
intNum = intNum + 1
End If
Else
intSkipLoop = 1
End If
' DNS
strDNSServerSearchOrder = ""
If Not IsNull(objNicConfig.DNSServerSearchOrder) Then
For Each strDNSServer In objNicConfig.DNSServerSearchOrder
strDNSServerSearchOrder = strDNSServerSearchOrder & strDNSServer & " "
Next
strDNS = Split(strDNSServerSearchOrder, " ")
strDNS1 = strDNS(0)
If Trim(strDNS1) = "" Then strDNS1 = "N/A"
If UBound(strDNS) > 1 Then
strDNS2 = strDNS(1)
Else
strDNS2 = "N/A"
End If
Else
strDNS1 = "N/A"
strDNS2 = "N/A"
End If
' Run Output Process
If intSkipLoop = 0 Then
' Connection Speed
strSpeed = "Unknown"
Set objWMIService2 = objSWbemLocator.ConnectServer _
(strComputer, "root\WMI", strUsername, strPassword)
objWMIServices.Security_.ImpersonationLevel = 3
Set listAdapters = objWMIService2.ExecQuery("SELECT * FROM MSNdis_LinkSpeed")
Set enumAdapters = objWMIService2.ExecQuery("SELECT * FROM MSNdis_EnumerateAdapter")
For Each objAdapter in listAdapters
For Each objEnum in enumAdapters
intEnum = Len(objEnum.DeviceName)
If objNicConfig.SettingID = Right(objEnum.DeviceName, intEnum - 8) Then
If objEnum.InstanceName = objAdapter.InstanceName Then
intLength = Len(objAdapter.NdisLinkSpeed/10000)
If intLength > 3 Then
strSpeed = Left(objAdapter.NdisLinkSpeed/10000, intLength - 3)
strSpeed = strSpeed & ".0 Gbps"
Else
strSpeed = objAdapter.NdisLinkSpeed/10000 & " Mbps"
End If
End If
End If
Next
Next
strTotalDesc = strTotalDesc & objNicConfig.Description & Chr(10)
strTotalSpeed = strTotalSpeed & strSpeed & Chr(10)
strTotalNetConn = strTotalNetConn & strNetConn & Chr(10)
strPrimaryIP = strPrimaryIP & strIPCollection(0) & " / " & strSMCollection(0) & Chr(10)
strDNSTotal1 = strDNSTotal1 & strDNS1 & Chr(10)
strDNSTotal2 = strDNSTotal2 & strDNS2 & Chr(10)
strTotalVirtual = strTotalVirtual & strVirtual & Chr(10)
i = i + 1
eth = eth + 2
' Dispose
strDescription = ""
ProcCount = 0
strClockSpeed = ""
strInterface = ""
intCount = 0
strSize = ""
strSpeed = ""
strIPCollection = ""
strVirtual = ""
strDNS = ""
strDNS1 = ""
strDNS2 = ""
End If
Next
' Output
' Trim Leading Chr(10)
If Left(strPrimaryIP, 1) = Chr(10) Then strPrimaryIP = Right(strPrimaryIP, Len(strPrimaryIP) - 1)
If Left(strTotalVirtual, 1) = Chr(10) Then strTotalVirtual = Right(strTotalVirtual, Len(strTotalVirtual) - 1)
If Left(strDNSTotal1, 1) = Chr(10) Then strDNSTotal1 = Right(strDNSTotal1, Len(strDNSTotal1) - 1)
If Left(strDNSTotal2, 1) = Chr(10) Then strDNSTotal2 = Right(strDNSTotal2, Len(strDNSTotal2) - 1)
objXLA.Cells(b + 2, 11).Value = Trim(Left(strTotalDesc, Len(strTotalDesc) - 1))
objXLA.Cells(b + 2, 12).Value = Trim(Left(strTotalSpeed, Len(strTotalSpeed) - 1))
objXLA.Cells(b + 2, 13).Value = Trim(Left(strTotalNetConn, Len(strTotalNetConn) - 1))
objXLA.Cells(b + 2, 14).Value = Trim(Left(strPrimaryIP, Len(strPrimaryIP) - 1))
objXLA.Cells(b + 2, 15).Value = Trim(Left(strTotalVirtual, Len(strTotalVirtual) - 1))
objXLA.Cells(b + 2, 16).Value = Trim(Left(strDNSTotal1, Len(strDNSTotal1) - 1))
objXLA.Cells(b + 2, 17).Value = Trim(Left(strDNSTotal2, Len(strDNSTotal2) - 1))
End If
End If
' Dispose Per Loop
strTotalDesc = ""
strTotalSpeed = ""
strTotalNetConn = ""
strPrimaryIP = ""
strDNSTotal1 = ""
strDNSTotal2 = ""
strTotalVirtual = ""
Set eth = 0
Set i = 0
Next
'------------Network Information (End)------------------'
Else
'No Data Present
objXLA.Cells(b + 2, 1).Value = strComputer
objXLA.Cells(b + 2, 3).Value = "Information Not Available"
objXLA.Cells(b + 2, 1).EntireRow.Font.Bold = True
objXLA.Cells(b + 2, 1).EntireRow.Interior.ColorIndex = 44
End If
' Dispose Per Server
ProcCount = 0
strSocket = ""
strProcID = ""
strUniqueID = ""
Set objWMIService = Nothing
Next
'-----------------Functions (Start)---------------------'
' System Memory Conversion
Function MemoryConvert(strMem)
Dim intLength
Dim intExp
Dim intSize
Dim strSize
Dim strMeasure
Dim strMemory
intLength = Len(strMem)
If (intLength Mod 4 = 0) Then
intExp = CInt((intLength / 3) - 2)
Else
intExp = CInt((intLength / 3) - 1)
End If
' Convert to Lowest Integer Value
For intCount = 1 To Len(intExp)
chrRead = Mid(intExp, intCount, 1)
If chrRead = "." Then
Exit For
Else
strRead = strRead & chrRead
End If
Next
intExp = Cint(strRead)
intSize = CLng(strMem / (2 ^ (intExp * (10))))
If Len(intSize) = 1 Then
strFormat = FormatNumber(CStr(intSize), 2)
Else
strFormat = intSize + 1
End If
If (intExp = 1) Then
strMeasure = "KB"
ElseIf (intExp = 2) Then
strMeasure = "MB"
ElseIf (intExp = 3) Then
strMeasure = "GB"
ElseIf (intExp = 4) Then
strMeasure = "TB"
ElseIf (intExp = 5) Then
strMeasure = "PB"
ElseIf (intExp = 6) Then
strMeasure = "EB"
End If
MemoryConvert = strFormat & " " & strMeasure
End Function
' System Byte Conversion
Function ByteConvert(strMem)
Dim intLength
Dim intExp
Dim intSize
Dim strSize
Dim strMeasure
Dim strMemory
intLength = Len(strMem)
If (intLength Mod 3 = 0) Then
intExp = (intLength / 3) - 1
Else
intExp = (intLength / 3)
End If
' Convert to Lowest Integer Value
For intCount = 1 To Len(intExp)
chrRead = Mid(intExp, intCount, 1)
If chrRead = "." Then
Exit For
Else
strRead = strRead & chrRead
End If
Next
intExp = Cint(strRead)
intSize = CLng(strMem / (2 ^ (intExp * (10))))
strFormat = FormatNumber(CStr(intSize), 2)
If (intExp = 1) Then
strMeasure = "KB"
ElseIf (intExp = 2) Then
strMeasure = "MB"
ElseIf (intExp = 3) Then
strMeasure = "GB"
ElseIf (intExp = 4) Then
strMeasure = "TB"
ElseIf (intExp = 5) Then
strMeasure = "PB"
ElseIf (intExp = 6) Then
strMeasure = "EB"
End If
ByteConvert = strFormat & " " & strMeasure
End Function
' System RAID Byte Conversion
Function ByteConvertRAID(strMem)
Dim intLength
Dim intExp
Dim intSize
Dim strSize
Dim strMeasure
Dim strMemory
intLength = Len(strMem)
If (intLength Mod 3 = 0) Then
intExp = (intLength / 3) - 1
Else
intExp = (intLength / 3)
End If
' Convert to Lowest Integer Value
For intCount = 1 To Len(intExp)
chrRead = Mid(intExp, intCount, 1)
If chrRead = "." Then
Exit For
Else
strRead = strRead & chrRead
End If
Next
intExp = Cint(strRead)
intSize = (strMem / (2 ^ (intExp * (10))))
strFormat = FormatNumber(CStr(intSize), 2)
If (intExp = 0) Then
strMeasure = "MB"
ElseIf (intExp = 1) Then
strMeasure = "GB"
ElseIf (intExp = 2) Then
strMeasure = "TB"
ElseIf (intExp = 3) Then
strMeasure = "PB"
ElseIf (intExp = 4) Then
strMeasure = "EB"
End If
ByteConvertRAID = strFormat & " " & strMeasure
End Function
' Trim Processor Description
Function ProcessorName(strName)
Dim intCounter
Dim strRead
Dim chrRead, chrReadMore
For intCounter = 1 to Len(strName)
chrRead = Mid(strName, intCounter, 1)
chrReadMore = Mid(strName, intCounter + 1, 1)
If ((chrRead <> " ") Or ((chrRead = " ") And (chrReadMore <> " "))) Then
strRead = strRead & chrRead
End If
Next
ProcessorName = Trim(strRead)
End Function
' Get Hyper-Threading Status
Function GetHTStatus(strName, intProc, strID, strUnique)
strNameArray = Split(strName, vbcrlf)
strIDArray = Split(strID, vbcrlf)
strUniqueList = Split(strUnique, vbcrlf)
intTotal = 0
' Check Socket Designation
For i = 0 To UBound(strNameArray) - 1
intMark = 1
' Check for Redundancies
For j = i + 1 To UBound(strNameArray) - 1
If strNameArray(i) = strNameArray(j) Then
intMark = 0
End If
Next
' If Redundant Unique ID's Exist
For j = i + 1 To UBound(strNameArray) - 1
If strUniqueList(i) <> "" And strUniqueList(j) <> "" And _
(strUniqueList(i) <> strUniqueList(j)) Then
intMark = 1
End If
Next
' Check for NULL ProcessorID
If Trim(strIDArray(i)) = "0000000000000000" Then
intMark = 0
End If
' Calculate Total
If intMark = 1 Then
intTotal = intTotal + intMark
End If
Next
' Compare Results
If intProc = 2 * intTotal Then
GetHTStatus = "True"
Else
GetHTStatus = "False"
End If
End Function
' Get Memory Breakdown
Function MemoryBreakdown
Set colPMAItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemoryArray",,48)
For Each objPMAItem in colPMAItems
lngMax = CLng(objPMAItem.MaxCapacity)
intCount = CInt(objPMAItem.MemoryDevices)
Next
ReDim Preserve strPMArray(intCount)
Set colPMItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory",,48)
For Each objPMItem in colPMItems
strValue = strValue & objPMItem.DeviceLocator & ": "
strValue = strValue & objPMItem.Capacity / 2^20 & "MB, "
strValue = strValue & objPMItem.Speed & "MHz"
strPMArray(TrimTrailingNumber(objPMItem.Tag)) = strValue
strValue = ""
Next
j = 0
strResult = ""
For j = 0 To intCount - 1
If Trim(strPMArray(j)) = "" Then strPMArray(j) = "<Empty>"
strResult = strResult & strPMArray(j) & vbcrlf
Next
strResult = strResult & (lngMax / 2^10) & "MB"
MemoryBreakdown = strResult
End Function
' Get Part Name
Function ExtractPartName(strName)
Dim chrRead
Dim strRead
Dim i
For i = 2 To Len(strName)
chrRead = Mid(strName, Len(strName) - (i - 1), 1)
If chrRead <> Chr(34) Then
strRead = chrRead & strRead
Else
Exit For
End If
Next
ExtractPartName = strRead
End Function
' Get Trailing Number
Function TrimTrailingNumber(strNum)
Dim chrRead
Dim strRead
Dim intLen
strNum = Trim(strNum)
intLen = Len(strNum)
i = 1
For i = 1 To intLen
chrRead = Mid(strNum, intLen - (i - 1), 1)
If IsNumeric(chrRead) = "True" Then
strRead = chrRead & strRead
Else
Exit For
End If
Next
TrimTrailingNumber = strRead
End Function
' Function: WMIDateStringToDate(dtmDate)
Function WMIDateToString(dtmDate)
WMIDateToString = CDate(Mid(dtmDate, 5, 2) & "/" & _
Mid(dtmDate, 7, 2) & "/" & _
Left(dtmDate, 4) & " " & _
Mid(dtmDate, 9, 2) & ":" & _
Mid(dtmDate, 11, 2) & ":" & _
Mid(dtmDate, 13, 2))
End Function
' Function: GetOsVer
Function GetOsVer
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem In colOperatingSystems
GetOSVer = CSng(Left(objOperatingSystem.Version, 3))
Next
End Function
' Function: GetHPArray
Function GetHPArray(strComputer2, strUsername2, strPassword2)
' Check for 64-bit Windows
If InStr(PUBOSVer, "x64") Then
strCompaq = "Program Files (x86)\Compaq\Cpqacuxe\Bin"
Else
strCompaq = "Program Files\Compaq\Cpqacuxe\Bin"
End If
' Create Connection Object
Set objWMIServiceRem = objWMIService.Get("Win32_Process")
' Confirm Location of Compaq Array Manager
Set objHPShell = CreateObject("WScript.Shell")
Set objHPFSO = CreateObject("Scripting.FileSystemObject")
Set WshNetwork2 = WScript.CreateObject("WScript.Network")
WshNetwork2.MapNetworkDrive "", "\\" & strComputer2 & "\C$" ,,strUsername2, strPassword2
strProgram = "\\" & strComputer2 & "\C$\" & strCompaq & "\cpqacuxe.exe"
' Ensure Access is Possible
If objHPFSO.FileExists(strProgram) Then
' Process Array Config
strProcess = Chr(34) & "C:\" & strCompaq & "\cpqacuxe.exe" & Chr(34) & " -c c:\output.txt"
Process = objWMIServiceRem.Create(strProcess, null, null, intProcessID)
' Check for "output.txt"
For intTimerHP = 0 To 10
If objFSO.FileExists("\\" & strComputer2 & "\C$\output.txt") Then
Exit For
Else
WScript.Sleep(1000)
End If
Next
' Process Output
If intTimerHP < 10 Then
' Check for Locked Output File
Set objHPOutputFile = objHPFSO.GetFile("\\" & strComputer2 & "\C$\output.txt")
If objHPOutputFile.Size <> 0 Then
' Close File
Set objHPOutputFile = Nothing
' Continue Processesing File
Set objHPInputFile = objHPFSO.OpenTextFile("\\" & strComputer2 & "\C$\output.txt", ForReading)
Do Until objHPInputFile.AtEndOfStream
strHPArray = strHPArray & objHPInputFile.ReadLine & vbcrlf
Loop
' Close Input File
objHPInputFile.Close
' Close Link to Server
objHPFSO.DeleteFile("\\" & strComputer2 & "\C$\output.txt")
Set objGetHPArray = objHPShell.Exec("net use \\" & strComputer2 & "\C$ /delete /yes")
Do While (objGetHPArray.Status = 0)
WScript.Sleep(500)
Loop
' Create String Array
strHPParse = Split(strHPArray, vbcrlf)
' Parse For Individual RAID Arrays
Dim strArrayList()
z = 0
For i = 0 To UBound(strHPParse)
j = 0
' Array and Drives
If InStr(strHPParse(i), "Array Specifications") Then
ReDim Preserve strArrayList(z)
strArrayList(z) = strArrayList(z) & strHPParse(i) & vbcrlf
For j = i + 1 To Ubound(strHPParse)
If InStr(strHPParse(j), "Array Specifications") Then
Exit For
Else
strArrayList(z) = strArrayList(z) & strHPParse(j) & vbcrlf
End If
Next
z = z + 1
End If
Next
' Process Each RAID Array
x = 0
For x = 0 To UBound(strArrayList)
strListParse = Split(strArrayList(x), vbcrlf)
For y = 0 To UBound(strListParse)
' Drives
If Left(strListParse(y), 6) = "Drive=" Then
strDrives = ""
strDrives = Split(strListParse(y), ",")
k = 0
For j = 0 To UBound(strDrives)
k = k + 1
Next
strDriveCount = k ' For Output
End If
' Hot Spare
If InStr(strListParse(y), "OnlineSpare=") Then
If InStr(strListParse(y), "OnlineSpare= No") Then
strHotSpare = strHotSpare & "N" ' For Output
Else
strHotSpare = strHotSpare & "Y" ' For Output
End If
End If
' Logical Drives
If InStr(strListParse(y), "Logical Drive Specifications") Then
' Find First Logical Drive
strRAID = Split(strListParse(y + 2), " ")
strRAIDResult = strRAIDResult & "RAID " & strRAID(1) & " / " ' For Output
strGetDrive = Split(strListParse(y + 3), " ")
strRAIDSize = strRAIDSize & ByteConvertRAID(strGetDrive(1)) & " / " ' For Output
End If
Next
' Process Results
strRAIDSize = Left(strRAIDSize, Len(strRAIDSize) - 3)
strRAIDResult = Left(strRAIDResult, Len(strRAIDResult) - 3)
strNewList = strNewList & strDriveCount & _
":" & strRAIDSize & ":" & strRAIDResult & ":" & strHotSpare & Chr(13)
' Dispose Array Variables
strDriveCount = ""
strRAIDSize = ""
strRAIDResult = ""
strHotSpare = ""
Next
' Return Array Output
GetHPArray = Left(strNewList, Len(strNewList) - 1)
Exit Function
Else ' "output.txt" Is Locked
' Close File
Set objHPOutputFile = Nothing
' Kill Remote Connection
Set objGetHPArray = objHPShell.Exec("net use \\" & strComputer2 & "\C$ /delete /yes")
Do While (objGetHPArray.Status = 0)
WScript.Sleep(500)
Loop
GetHPArray = ""
Exit Function
End If
Else ' "output.txt" Does not Exist
' Kill Remote Connection
Set objGetHPArray = objHPShell.Exec("net use \\" & strComputer2 & "\C$ /delete /yes")
Do While (objGetHPArray.Status = 0)
WScript.Sleep(500)
Loop
GetHPArray = ""
Exit Function
End If
Else ' "Array Manager Does not Exist
' Input not Available
Set objGetHPArray = objHPShell.Exec("net use \\" & strComputer2 & "\C$ /delete /yes")
Do While (objGetHPArray.Status = 0)
WScript.Sleep(500)
Loop
GetHPArray = ""
Exit Function
End If
End Function
'--------------------Functions (End)--------------------'
' Set Excel Attributes
Const xlVAlignTop = -4160
Set objRange2 = objWorksheet.UsedRange
objRange2.VerticalAlignment = xlVAlignTop
' Set Font Attributes
objXLA.Cells.Font.Size = 8
objXLA.Cells.Font.Name = "Arial"
objXLA.Cells.Font.ColorIndex = 11
objXLA.Cells.EntireColumn.AutoFit
objXLA.Cells(1, 9).ColumnWidth = 30 ' RAM Slots
objXLA.Cells(1, 11).ColumnWidth = 40 ' NIC Port
objXLA.Cells(1, 13).ColumnWidth = 25 ' Connection Name
objXLA.Cells(1, 14).ColumnWidth = 25 ' Interface IP's
objXLA.Cells(1, 15).ColumnWidth = 25 ' Virtual IP's
objXLA.Cells(1, 16).ColumnWidth = 15 ' DNS1
objXLA.Cells(1, 17).ColumnWidth = 15 ' DNS2
objXLA.Cells(1, 18).ColumnWidth = 15 ' Interface Type
objXLA.Cells.HorizontalAlignment = 2 ' Drive Count
objXLA.Cells(1, 20).ColumnWidth = 20 ' Virtual IP's
objXLA.Cells(1, 21).ColumnWidth = 20 ' Virtual IP's
' Save
set objFSO2 = CreateObject("Scripting.FileSystemObject")
strFileName = objFSO2.getAbsolutePathName("") & "\Scan Results.xls"
objWorkbook.SaveAs(strFileName)
objWorkbook.Close
objXLA.Quit
' Notify User
WScript.Echo "Process Completed (" & Now & ")"
' Close Program
WScript.Quit(0)
Similar Messages
-
How can I read, millions of records and write as *.csv file
I have to return some set of columns values(based on current date) from the database (could be million of record also) The dbms_output can accomodate only 20000 records. (I am retrieving thru a procedure using cursor).
I should write these values to a file with extn .csv (comma separated file) I thought of using a utl_file. But I heard there is some restriction on the number of records even in utl_file.
If so, what is the restriction. Is there any other way I can achive it? (BLOB or CLOB ??).
Please help me in solving this problem.
I have to write to .csv file, the values from the cursor I have concatinated with "," and now its returning the value to the screen (using dbms_output, temporarily) I have to redirect the output to .csv
and the .csv should be in some physical directory and I have to upload(ftp) the file from the directory to the website.
Please help me out.Jimmy,
Make sure that utl_file is properly installed, make sure that the utl_file_dir parameter is set in the init.ora file and that the database has been re-started so that it will take effect, make sure that you have sufficient privileges granted directly, not through roles, including privileges to the file and directory that you are trying to write to, add the exception block below to your procedure to narrow down the source of the exception, then test again. If you still get an error, please post a cut and paste of the exact code that you run and any messages that you received.
exception
when utl_file.invalid_path then
raise_application_error(-20001,
'INVALID_PATH: File location or filename was invalid.');
when utl_file.invalid_mode then
raise_application_error(-20002,
'INVALID_MODE: The open_mode parameter in FOPEN was
invalid.');
when utl_file.invalid_filehandle then
raise_application_error(-20002,
'INVALID_FILEHANDLE: The file handle was invalid.');
when utl_file.invalid_operation then
raise_application_error(-20003,
'INVALID_OPERATION: The file could not be opened or
operated on as requested.');
when utl_file.read_error then
raise_application_error(-20004,
'READ_ERROR: An operating system error occurred during
the read operation.');
when utl_file.write_error then
raise_application_error(-20005,
'WRITE_ERROR: An operating system error occurred
during the write operation.');
when utl_file.internal_error then
raise_application_error(-20006,
'INTERNAL_ERROR: An unspecified error in PL/SQL.'); -
I have been searching high and low for this one. I have a vbscript that can successfully perform the function if one file is listed. It does a Wscript.echo on the results and if I run this via command using cscript, I can output to a text file
that way. However, I cannot seem to get it to work properly if I want it to search ALL the files in the folder. At one point, I was able to have it create the output file and appear as if it worked, but it never showed any results when the script
was executed and folder was scanned. So I am going back to the drawing board and starting from the beginning.
I also have a txt file that contains the list of string text entries I would like it to search for. Just for testing, I placed 4 lines of sample text and one single matching text in various target files and nothing comes back. The current script
I use for each file has been executed with a few hundred string text lines I want it to search against to well over one thousand. It might take awhile, but it works every time. The purpose is to let this run against various log files in a folder and
let it search. There is no deleting, moving, changing of either the target folder/files to run against, nor of the file that contains the strings to search for. It is a search (read) only function, going thru the entire contents of the folder and
when done, performs the loop function and onto the next file to repeat the process until all files are searched. When completed, instead of running a cscript to execute the script and outputting the results to text, I am trying to create that as part
of the overall script. Saving yet another step for me to do.
My current script is set to append to the same results file and will echo [name of file I am searching]: No errors found. Otherwise, the
output shows the filename and the string text that matched. Because the results append to it, I can only run the script against each file separately or create individual output names. I would rather not do that if I could include it all in one.
This would also free me from babysitting it and running each file script separately upon the other's completion. I can continue with my job and come back later and view the completed report all in one. So
if I could perform this on an entire folder, then I would want the entries to include the filename, the line number that the match occurred on in that file and the string text that was matched (each occurrence). I don't want the entire line to be listed
where the error was, just the match itself.
Example: (In the event this doesn't display correctly below, each match, it's corresponding filename and line number all go together on the same line. It somehow posted the example jumbled when I listed it)
File1.txt Line 54
Job terminated unexpectedly
File1.txt Line 58 Process not completed
File1.txt
Line 101 User input not provided
File1.txt
Line 105 Process not completed
File2.txt
No errors found
File3.txt
Line 35 No tape media found
File3.txt
Line 156 Bad surface media
File3.txt Line 188
Process terminated
Those are just random fake examples for this post.
This allows me to perform analysis on a set of files for various projects I am doing. Later on, when the entire search is completed, I can go back to the results file and look and see what files had items I wish to follow up on. Therefore, the
line number that each match was found on will allow me to see the big picture of what was going on when the entry was logged.
I actually import the results file into a spreadsheet, where further information is stored regarding each individual text string I am using. Very useful.
If you know how I can successfully achieve this in one script, please share. I have seen plenty of posts out there where people have requested all different aspects of it, but I have yet to see it all put together in one and work successfully.
Thanks for helping.I'm sorry. I was so consumed in locating the issue that I completely overlooked posting what exactly I was needing help with. I did have one created, but I came across one that seemed more organized than what I originally created. Later
on I would learn that I had an error in log location on my original script and therefore thought it wasn't working properly. Now that I am thinking that I am pretty close to achieving what I want with this one, I am just going to stick with it.
However, I could still use help on it. I am not sure what I did not set correctly or perhaps overlooking as a typing error that my very last line of this throws an "Expected Statement" error. If I end with End, then it still gives same
results.
So to give credit where I located this:
http://vbscriptwmi.uw.hu/ch12lev1sec7.html
I then adjusted it for what I was doing.
What this does does is it searches thru log files in a directory you specify when prompted. It looks for words that are contained in another file; objFile2, and outputs the results of all matching words in each of those log files to another file: errors.log
Once all files are scanned to the end, the objects are closed and then a message is echoed letting you know (whether there errors found or not), so you know the script has been completed.
What I had hoped to achieve was an output to the errors.log (when matches were found) the file name, the line number that match was located on in that file and what was the actual string text (not the whole line) that matched. That way, I can go directly
to each instance for particular events if further analysis is needed later on.
So I could use help on what statement should I be closing this with. What event, events or error did I overlook that I keep getting prompted for that. Any help would be appreciated.
Option Explicit
'Prompt user for the log file they want to search
Dim varLogPath
varLogPath = InputBox("Enter the complete path of the logs folder.")
'Create filesystem object
Dim oFSO
Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
'Creates the output file that will contain errors found during search
Dim oTSOut
Set oTSOut = oFSO.CreateTextFile("c:\Scripts\errors.log")
'Loop through each file in the folder
Dim oFile, varFoundNone
VarFoundNone = True
For Each oFile In oFSO.GetFolder(varLogPath).Files
'Verifies files scanned are log files
If LCase(Right(oFile.Name,3)) = "log" Then
'Open the log file
Dim oTS
oTS = oFSO.OpenTextFile(oFile.Path)
'Sets the file log that contains error list to look for
Dim oFile2
Set oFile2 = oFSO.OpenTextFile("c:\Scripts\livescan\lserrors.txt", ForReading)
'Begin reading each line of the textstream
Dim varLine
Do Until oTS.AtEndOfStream
varLine = oTS.ReadLine
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Global = True
Dim colMatches, strName, strText
Do Until oErrors.AtEndOfStream
strName = oFile2.ReadLine
objRegEx.Pattern = ".{0,}" & strName & ".{0,}\n"
Set colMatches = objRegEx.Execute(varLine)
If colMatches.Count > 0 Then
For Each strMatch in colMatches
strText = strText & strMatch.Value
WScript.Echo "Errors found."
oTSOut.WriteLine oFile.Name, varLine.Line, varLine
VarFoundNone = False
Next
End If
Loop
oTS.Close
oFile2.Close
oTSOut.Close
Exit Do
If VarFoundNone = True Then
WScript.Echo "No errors found."
Else
WScript.Echo "Errors found. Check logfile for more info."
End If
End if -
How to get Report Output in csv format
Hi,
How can i get report Output in csv format, can any one tell me the word used for output type to get output in csv format.
i have used XLS output type but it opens in excel format.
conc.addLayout(appCode,concReqCode,"en-US","US",XLS);
Thanks
BabuHi Babu,
Till now in xmlpublisher there is no method to create file in csv format ,you have to create Excel file and then save it in .csv format.Unless and until ur using BI Publisher in which some work around are possible.
Thanks -
FINALLY INPUTTING and OUTPUTTING Annotations!
Ok, before everyone thinks that this is a very bad solution, I have to tell that I`m no programmer and my knowledge of PostgreSQL, Ruby or any other language is very poor.
With useful help from Jamie Hodge, fbm and Nicholas Stokes (mainly)
I could manage to write a command for inputting and outputting from Final Cut Server Annotations.
So lets go to the fun part:
INPUTTING:
1- Create a Response called "Annotations IN" (or whatever you want):
a - Reponse Action: "Run an external script or command"
b - Run Script > *Commnad Path: /Library/Application Support/Final Cut Server/Final Cut Server.bundle/Contents/Resources/sbin/fcsvr_run
Command Parameters: psql px pxdb -c "COPY pxtcmdvalue FROM '/FCSRV/annotation-in.txt' USING DELIMITERS '|';"
2 - Create a poll Watcher with name: "Watch for Annotations IN"
a - Enable: true
b - Monitor Address: Chooses a Device (create a new one or use a tmp one) and path to where you`ll going to put a txt file with the annotations.
c - Response List: Choose the Response you created "Annotations IN" in my case.
d - Event Type Filter: Created, Modified
e - Poll Watcher > Listing Frequency: 2 (or any number of seconds you feel like it).
Listing multiple: 2
Wildcard include Filter: *.txt (or any custom extensions you want)
3 - Create a txt file and use this as a template:
{ASSET_ENTITYID}|1527|{TCIN}/(30000,1001)|{TCOUT}/(30000,1001)|{Annotation}|{USE RID}|{DATE}
Where:
{ASSET_ENTITYID} = Is the entityid of your asset. You can find what number it is by issuing:
/Library/Application\ Support/Final\ Cut\ Server/Final\ Cut\ Server.bundle/Contents/Resources/sbin/fcsvr_run psql px pxdb -c "SELECT pxmdvalue.entityid, pxmdvalue.value AS asset_name FROM pxmdvalue INNER JOIN pxentity ON pxentity.entityid = pxmdvalue.entityid WHERE pxmdvalue.fieldid='1543' AND pxentity.address LIKE '/asset/%';"
This will output ALL your assets, so if you know the name or want to parse the name you can use:
/Library/Application\ Support/Final\ Cut\ Server/Final\ Cut\ Server.bundle/Contents/Resources/sbin/fcsvr_run psql px pxdb -c "SELECT pxmdvalue.entityid, pxmdvalue.value AS asset_name FROM pxmdvalue INNER JOIN pxentity ON pxentity.entityid = pxmdvalue.entityid WHERE pxmdvalue.fieldid='1543' AND pxmdvalue.value='ASSETNAME' AND pxentity.address LIKE '/asset/%';"
Where in ASSETNAME you`ll have to put your Asset Name without extension.
{TCIN} and {TCOUT} is, of course, the TC`s points. In the form of: HH:MM:SS;FF
{Annotation} is the commentary.
{USERID} (in my case was 1)
{DATE}: This one is tricky. My example is 2009-03-15 19:31:15.839795-03
So is in the form YYYY-MM-DD HH:MM:SS.????? I really don`t know the rest. Could be milliseconds?
Of course one can write a script to translate everything from a txt file like:
ASSETNAME | TCIN | TCOUT | ANNOTATIONS | USER
But as I`ve said I`m no programmer
Ok.. now the time for the OUTPUT:
The command-line is:
/Library/Application\ Support/Final\ Cut\ Server/Final\ Cut\ Server.bundle/Contents/Resources/sbin/fcsvr_run psql px pxdb -c "SELECT pxmdvalue.value AS Asset_NAME, pxtcmdvalue.value, pxtcmdvalue.begintc, pxtcmdvalue.endtc FROM pxmdvalue INNER JOIN pxtcmdvalue ON pxmdvalue.entityid = pxtcmdvalue.entityid WHERE pxmdvalue.value='ASSETNAME';"
Where ASSETNAME is the Asset name without the extension.
Or issuing the following to OUTPUT ANNOTATIONS from ALL assets:
/Library/Application\ Support/Final\ Cut\ Server/Final\ Cut\ Server.bundle/Contents/Resources/sbin/fcsvr_run psql px pxdb -c "select * from pxtcmdvalue;"
Adding "> /PATHTO_WHERE_IN_WANT/ANNOTATIONSOUTPUT.TXT" at the end will put all output into a txt file.
It`s possible (in theory) to:
1- Create a boolean md field in FCSRV called "EXPORT Annotations" (don`t choose lookup)
2- add or create a md group called "Export Annotations" and add the above md field to it (don`t choose lookup)
3- Add "Export Annotations" md field to Asset Filter md group
4- Make a Response for Running external command. Command path: /Library/Application Support/Final Cut Server/Final Cut Server.bundle/Contents/Resources/sbin/fcsvr_run
Command Parameters: psql px pxdb -c 'SELECT pxmdvalue.value AS Asset_NAME, pxtcmdvalue.value, pxtcmdvalue.begintc, pxtcmdvalue.endtc FROM pxmdvalue INNER JOIN pxtcmdvalue ON pxmdvalue.entityid = pxtcmdvalue.entityid WHERE pxmdvalue.value=[FileName];' > ~/Desktop/ann-out.txt
(I`m having problem with this, it doesn`t work).
5- Make a Subscription that if Export Annotations modified = true, trigger if changed and trigger the Response above.
6- Add exporting annotations md group to Media md set.
In theory it`s possible to modify the FinalCutServerIntegrationSample get and input annotations instead of adding another "comment" field to md group list.
Few!
Ok so please help beautify this out!
This will be very useful for a lot of people.... We know that it`s only a matter of time to FCSVR have this function built-in... but this "time" could be years.
So let`s start ourselves!
Thank you very much!!
Regards!AlphaBlue wrote:
jverd wrote:
What were you hoping for? Someone reading your mind for what exactly you need, and handing you a giftwrapped answer, without you doing any work or clearly communicating a specific problem? This site doesn't really work that way.Fair enough. I'm asking for insight into how to input from and output to a StarOffice Spreadsheet into/from a Java program. (Think java.io except with spreadsheet files instead of .txt files.) I already answered that question.
I need to accomplish this without the use of a community-created library.That's a bizarre requriement. Why?
>
Okay, [here you go|http://lmgtfy.com/?q=communication+between+StarOffice+Spreadsheets+and+Java].
If you don't have any knowledge or experience, on the matter, please refrain from directing me to a google search. I assure you, I have already performed such a task.How would I know that.
But okay, let's say I know that. Let's say you bothered to point out that you've already done that. Further, let's say I do have knowledge of the subject at hand. Maybe I'm an expert. Maybe I wrote Star Office and an open source library (which wheel for some reason you must reinvent). You are assuming that I also have psychic powers, so that I can read your mind and know exactly what you've read so far and exactly what parts of your very broad and vague question said reading did not answer.
In short, you have received answers commensurate with your questions. -
Table name input. and output i need all rows and columns using procedures
hi,
question: table name input. and output i need all rows and columns by using procedures.
thanks,
To AllAn example of using DBMS_SQL package to execute dynamic SQL (in this case to generate CSV data in a file)...
As sys user:
CREATE OR REPLACE DIRECTORY TEST_DIR AS '\tmp\myfiles'
GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser
/As myuser:
CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2
,p_dir IN VARCHAR2
,p_header_file IN VARCHAR2
,p_data_file IN VARCHAR2 := NULL) IS
v_finaltxt VARCHAR2(4000);
v_v_val VARCHAR2(4000);
v_n_val NUMBER;
v_d_val DATE;
v_ret NUMBER;
c NUMBER;
d NUMBER;
col_cnt INTEGER;
f BOOLEAN;
rec_tab DBMS_SQL.DESC_TAB;
col_num NUMBER;
v_fh UTL_FILE.FILE_TYPE;
v_samefile BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file);
BEGIN
c := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
d := DBMS_SQL.EXECUTE(c);
DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
FOR j in 1..col_cnt
LOOP
CASE rec_tab(j).col_type
WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);
WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);
ELSE
DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
END CASE;
END LOOP;
-- This part outputs the HEADER
v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767);
FOR j in 1..col_cnt
LOOP
v_finaltxt := ltrim(v_finaltxt||','||lower(rec_tab(j).col_name),',');
END LOOP;
-- DBMS_OUTPUT.PUT_LINE(v_finaltxt);
UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
IF NOT v_samefile THEN
UTL_FILE.FCLOSE(v_fh);
END IF;
-- This part outputs the DATA
IF NOT v_samefile THEN
v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767);
END IF;
LOOP
v_ret := DBMS_SQL.FETCH_ROWS(c);
EXIT WHEN v_ret = 0;
v_finaltxt := NULL;
FOR j in 1..col_cnt
LOOP
CASE rec_tab(j).col_type
WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
v_finaltxt := ltrim(v_finaltxt||','||v_n_val,',');
WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),',');
ELSE
v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
END CASE;
END LOOP;
-- DBMS_OUTPUT.PUT_LINE(v_finaltxt);
UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
END LOOP;
UTL_FILE.FCLOSE(v_fh);
DBMS_SQL.CLOSE_CURSOR(c);
END;This allows for the header row and the data to be written to seperate files if required.
e.g.
SQL> exec run_query('select * from emp','TEST_DIR','output.txt');
PL/SQL procedure successfully completed.Output.txt file contains:
empno,ename,job,mgr,hiredate,sal,comm,deptno
7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20
7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30
7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30
7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20
7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30
7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30
7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10
7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20
7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10
7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30
7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20
7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30
7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20
7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10The procedure allows for the header and data to go to seperate files if required. Just specifying the "header" filename will put the header and data in the one file.
Adapt to output different datatypes and styles are required. -
Input and output audio not working and no startup chime
The audio, both input and output, on my MacBook Pro has stopped working as well as the startup chime. Otherwise the computer starts up and seems to be working normally. Any ideas as to what the problem is and solutions?
Hey, my MacBook Pro has been doing the EXACT same thing off and on for a few weeks now.
I'm just now having time to browse the forums, so I've not even asked about it.
Yesterday it all started working normally - all sounds.
I'll follow this discussion for sure.
There definitely seems to be enough 'Mac-Daddy' Mac Helpers on here to be able to easily resolve this issue.
i.e.: Andreas! Just reading her stuff lets me know she REALLY knows what she's talking about & is able to explain the highly advanced info in terms people actually get!
Thanks for asking that question!
~dOiTdiGiTaL~ -
Dear Friends,
One advise needed.
I have created 2 VAT G/L Accounts via FS00 i.e.
Input VAT ( which is updated in Purchase Process at the time of MIRO )
(ii) Output VAT( which is updated in Sales Process at the time of VF01 )
Both are balanace Sheet accounts.
Now, I have one doubt,
I have created Input VAT G/L with category "ASSETS"
and Output VAT G/L with category "LIABILITIES"
Is this OK from Concept ? Will it cause any error at the time of period closing ?
Please reply.
Reward Points assured.
Thanks.
Regards,
Gaurav Raghav.
Is this OKHello Mr.Gourav
Its absolutely fine.it will work.But it should have been only balancesheet grou , insted of both assets and liability separetly.
u can directly go for both as liablity also.
where the Debits and the Credits will automaticaaly setoff.
and the balance will be relfected in the balance sheet
but if ur going to do them separeelt as assts and saparetely as liablity then adjustment need to be done at the time of preparing the financial staement version
Hope it will cleare u
Regards
Anup -
How to list the contents of an OSX directory, and output to text file?
hello there any hints with any known program that does following
I have recorded my music directory to DVD and now i would like to make an .txt file what the dvd contains...cos its way of hand to write all 100xx files by hand...
How to list the contents of an OSX directory, and output to text file?
any prog that does that? any hints?
best regardsThis script makes a hierarchical file listing all files in a folder and subfolder:
Click here to launch Script Editor.
choose folder with prompt "Choose a folder to process..." returning theFolder
set theName to name of (info for theFolder)
set thepath to quoted form of POSIX path of theFolder
set currentIndex to theFolder as string
do shell script "ls -R " & thepath returning theDir
set theDirList to every paragraph of theDir
set newList to {"Contents of folder \"" & theName & "\"" & return & thepath & return & return}
set theFilePrefix to ""
repeat with i from 1 to count of theDirList
set theLine to item i of theDirList
set my text item delimiters to "/"
set theMarker to count of text items of thepath
set theCount to count of text items of theLine
set currentFolder to text item -1 of theLine
set theFolderPrefix to ""
if theCount is greater than theMarker then
set theNestIndex to theCount - theMarker
set theTally to -1
set theFilePrefix to ""
set theSuffix to ""
repeat theNestIndex times
set theFolderPrefix to theFolderPrefix & tab
set theFilePrefix to theFilePrefix & tab
if theTally is -1 then
set theSuffix to text item theTally of theLine & theSuffix
else
set theSuffix to text item theTally of theLine & ":" & theSuffix
end if
set currentIndex to "" & theFolder & theSuffix
set theTally to theTally - 1
end repeat
end if
set my text item delimiters to ""
if theLine is not "" then
if word 1 of theLine is "Volumes" then
set end of newList to theFolderPrefix & "Folder: > " & currentFolder & return
else
try
if not folder of (info for alias (currentIndex & theLine & ":")) then
set end of newList to theFilePrefix & tab & tab & tab & "> " & theLine & return
end if
end try
end if
end if
end repeat
open for access file ((path to desktop as string) & "Contents of folder- " & theName & ".txt") ¬
with write permission returning theFile
write (newList as string) to theFile
close access theFile -
Compressor and outputting progressive mpeg-2's
Ok, bit of a dilemma here. Within compressor and outputting a file for a dvd project (mpeg-2), I've created 2 droplets. One, I have set the frame rate to "automatic" and the field output to "automatic" to use with my stock footage containing a frame rate of 23.98. After compressor has created the .m2v file I can import this into DVDSP with no problems. However, the second droplet I have created I have set the frame rate to "23.98" (same as source) and the field output to "progressive"...using this option allows me to control the GOP settings which is why I created the second droplet to begin with. The .m2v file that is output by this droplet will NOT import into DVDSP. It tells me the file format is not compatible. This is confusing me, because both .m2v files should be the same, no?
Can someone explain to me why setting the output fields to "automatic" rather than defining the output settings would make a difference even though the defined output is the same as the source file? I'm confused.Hi
All info by Lennart - but in another way:
A. don't put a mini DVD into Your eMac. You need a trayloaded DVD to do this.
B. Read what Karsten collected:
DVD back to iMovie:
.. and here the complete 'full 9 yards' ... :
http://discussions.apple.com/thread.jspa?messageID=3822853�
DVDs are in a socalled delivery format (mpeg2), which isn't meant and
made for any processing as editing... or, as honorable forum member
QuicktimeKirk stated: I use the analogy of the old Polaroid
"instant" cameras. Push the button, wait for the print to develop and
show it off. ..
for using the iLife apps, you have to convert'em first, in
recommended order, choose one of the following tools/workarounds:
• DVDxDV (free trial, 25$, Pro: 90$)
• Apple mpeg2 plugin (19$) + Streamclip (free)
• VisualHub (23.32$)
• Cinematize >60$
• Mpeg2Works >25$ + Apple plug-in
• Toast 6/7/8 allows converting to dv/insert dvd, hit apple-k
• connect a miniDV Camcorder with analogue input to a DVD-player and transfer disk to tape/use as converter
• Drop2DV (free) a free tool claiming to convert DVDs into dv-stream...
• Use iSquint for your conversions : www.iSquint.org
from: Bobby Keene
none of these apps override copyprotection mechanisms as on commercial dvds...
http://danslagle.com/mac/iMovie/tips_tricks/6010.shtml
http://danslagle.com/mac/iMovie/tips_tricks/6018.shtml
be nice to copy rights ^-^
... and, next time, try the forum's search-feature...
from Beverly M.
http://docs.info.apple.com/article.html?artnum=42724
Yours Bengt W -
Hi All,
I am new to this forum as well as new to SUN.
I tried to boot a Sun Blade 100. The message that appears on the screen is Keyboard not found. use ttya Input and Output.
I have only a normal MS Keyboard which cannot be connected to SUN. Do we need to have a special Keyboard. Whether we have to use USB Keyboard...
I just want to know more about TTYA input and output.
Thanx.Hi Martin
Thanx for your info.I Connected using a second computer that has a serial port as well as a null-modem connection cable.
The following appears in the second computer..I am not able to type anything from the second computer keyboard..Is there any reason for it..?
Sun Blade 100 (UltraSPARC-IIe), No Keyboard
Copyright 1998-2003 Sun Microsystems, Inc. All rights reserved.
OpenBoot 4.10.6, 512 MB memory installed, Serial #51719739.
Ethernet address 0:3:ba:15:2e:3b, Host ID: 83152e3b.
Boot device: disk File and args:
Bad magic number in disk label
Can't open disk label package
Evaluating:
Can't open boot device
Type boot , go (continue), or login (command mode)
> -
How to get sql query data and write into csv file?
I am writing to seek help, in how can I create bat. script which can execute the following logic:
connection to the database
run sql query
create CSV file
output query data, into CSV file
save the CSV file
osql
-S 84.18.111.111
-U adw
-P rem
-i "c:\query.sql"
send ""
sed -e 's/,\s\+/,/g' MCI_04Dec2014.csv > localNoSpaces.csv
-o "c:\MCI_04Dec2014.csv"
This what i have so far, and I am little struggling with the logic after creating CSV file. I am unable to get the above script to work, please advice further, where I may be going wrong.
Can you create if statement logic within window's script, to check for null parameters or data feeds?
Any hints would be most appreciated.Thank you for your reply.
Apology for posting the code irrelevant to the forum, as I am still novice scripting user.
My goal is to create window's script which can compute the above logic and send the final output file (csv), to FTP folder.
Can this logic be implemented via bat. script, if so, is there a example or tutorial i could follow, in order to achieve my task.
Any help would be much appreciated. -
Can we Compare PDF Output with CSV format
Team,
Can we Compare PDF Output with CSV format.
In Excel I need to two text boxes asking us to browse the files and compare the files PDF & CSV format.
Please suggest me if we have solution for this.
Thanks!
KiranHi
I'm afraid the Excel Application does not support this function currently, I am suggesting you to take advantage of a third party component to achieve this goal.
Thanks for your understanding.
Best Regards
Lan
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
SQL server Best Practice Analyzer output in .CSV
Hi Team, I ran SQL server Best practice analyzer on our SQL 2008 R2 server. I was trying to export scan result in .csv format but it is only giving me option to save it in .xml format. I have been looking for ways to export output in such a way
that it can be readable and I can send it to our clients but no luck.
How can I export SQL BPA output in .csv or any other user friendly format?
Thanks in Advance.Hi MSRS27,
You can run Best Practices Analyzer (BPA) scans either from Server Manager, by using the BPA GUI, or by using cmdlets in Windows PowerShell. We can view or save BPA results from Windows PowerShell session in different format.
If you want to export BPA results to a comma-separated values (CSV) text file, run the following cmdlet, where Path represents the path and text file name to which you want to save the CSV results.
CSV results can be imported into Microsoft® Excel, or other programs that display data in spreadsheets or grids.
Get-BPAResultModel ID| Export-CSVPath
For more information, see: Run Best Practices Analyzer Scans and Manage Scan Results
http://technet.microsoft.com/en-us/library/hh831400.aspx
Regards,
Sofiya Li
Sofiya Li
TechNet Community Support -
Same input and output format, Why does Final Cut want to transcode it when I export?
I am taking Prores 422 (HQ) footage from a BlackMagic HyperDeck studio throwing it in FCPX adding a few cross desolves and exporting ProRes 422 (HQ) and it insists on transcoding the entire project rather than just writing it to disk. Am I missing something here? I've double checked and all of the cross fades are rendered in 422 (HQ). I swear we were able max out our disk speed and export the video 3 to 4 times faster but it seems to have changed in the last few FCPX updates.
Is anyone else noticing this?I work with a lot of different video formats, and sometimes I have to go back into a new Project and check that the framerate/format matches my original footage and output. I also check Field Dominance in Inspector -> Info -> Settings View.
Hope this might help!
-Andrew
ps~ Maybe the canvas got nudged a pixel or something?
Maybe you are looking for
-
No print from Windows 7 Desktop and Officejet Pro 8610
I purchased and installed a new Officejet Pro 8610 about a month ago. My desktop computer is an HP Windows 7 unit. The printer is setup wireless. Up until a few days ago, everything has run fine, but now I cannot print anything from my desktop comp
-
Hi all, I have an HTC One running 4.4.2 and noticed while driving around today that my phone was two hours ahead of the actual time. When I checked my settings, the phone was set to Automatic date & time and Automatic time zone. When I looked at the
-
How to get CDC-HI commercial license info ?
Hi, I need to add SSL support to PhoneME CDC+FP1.1 (MR2) on an embedded target device. From other google results, seems the way to do this is to acquire CDC-Hi commercial license, so I can access SECOP (security option) source code (which is not open
-
SAP DMS Features vs MS Sharepoint
We are trying to find out the reasons why on why we should or should not use SAP DMS over MS Sharepoint I am completely new to SAP DMS and I would like to do a comparison based on features/ease of implementation/cost etc. SAP is already implemented i
-
How to call stored procedure having parameter as oracle type from java???
Hello, I have created following type & stored procedure in oracle. How can i call this stored procedure from my java class? I want to pass 2d array to this procedure. CREATE OR REPLACE TYPE type_survey AS OBJECT ( emp_id number,emp_name varchar(100))