Dynamically obtain  CSV name in Export output as CSV section

Hi,
In the report export section i like to export the report in CSV format where in the Filename section i want to get as itemvalue.csv where the itemvalue is a tablename obtain from item.Say my item is p1_x as text field now when i press export button my requirement is that download the CSV adding the p1_x value means the tablename.csv .I tried with &p1_x..csv or :p1_x .csv but fails .
How to achive this ? I think i am making mistakes in the syntax.
Anyidea?
Thnx in advance.
Rosy

Hi Vikas .....
I have modified little bit of your application where the Table name must be input through the user but in my case i am getting the tablename dynamically looking on the CSV .Means if u going to upload a file called 'myfile.csv' then after pressing the submit button in file upload region, the string 'myfile' automatically be populated on the upload to table region text field 'P1_TABLENAME' by firing a process by using the SQL with some instring,substr and length function.Now what i am not getting is the after Export to CSV the same csv file should be obtained.
I have tried with what u suggest earlier that &P1_TABLENAME..csv to track the CSV name as myfile.csv but alas! i failed .The diff of ur example is that u r using the textfield there amd i have to press enter there but in my cases that is not the reqr.Only clicking on the CSV link i should get it as myfile.csv .
N.B : Here myfile is the table name where i am going to upload the data thru CSV myfile.csv.
Hope this makes clear understanding ......
Thnx again...
Cheers,
ROSY.

Similar Messages

  • Dynamic Names for the Outputs

    Hi,
    I was wondering if it would be possible to name the PDF outputs dynamically?
    Say for example, I have a tag in the XML <TemplateName>ABC</TemplateName>. Can I have the output PDF with the name 'ABC'?
    And
    Is it possible to explicitly specifiy the name 'ABC' somewhere in the INI file so that the outputs generated will be multiple versions for 'ABC' (like ABC001, ABC002 etc)?
    Many Thanks,
    Phew

    Phew,
    As mentioned earlier, in order to rename the file you have two steps:
    1) Make the input data value available to genprint - this is normally done by creating a global variable.
    2) Configure the PDF print driver. Depending on the version of Documaker you are using you can refer to one of the following manuals:
    a) 11.5 - Using the PDF Print Driver - http://docs.oracle.com/cd/E16256_01/pdf_book.pdf (see section "Generating Separate Print Files")
    b) 12.x - Printers Reference - http://docs.oracle.com/cd/E22582_01/printers_rg.pdf (see section "Generating Separate Print Files")
    Essentially you will configure the INI like so:
    < BatchPrint >
    PDF = ~FUNCTION .PDF
    Where ~FUNCTION is an INI Built-in function like one of these:
    ~DALRUN {function name} - executes a DAL function to return a string which is used to name the file.
    ~DALVAR {variable name} - returns the value of a DAL variable which is used to name the file.
    Don't forget the space after the built-in function before the static bit of the filename...
    Best,
    Andy

  • 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)

  • 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 All

    An 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.

  • How do I expand a ActiveDirectorySubnetCollection so I can view all elements and export to a CSV file?

    Hello,
    In the following, I list SiteName, Location, Subnets, and Severs, however I don't see all the servers or the subnets, presumably because Subnets are an ActiveDirectorySubnetColletion and Servers are a ReadOnlyDirectoryServerCollection.  So I want to
    expand this property so I can see all the elements of the collection, or array.  I've tried the Select-Object -ExpandProperty, but I get an error due to -ExpandProperty looking for a string.
    Any suggestions on how to expand both the Subnet and Server collections so I can see all elements and I can export to a CSV file?
    [cmdletbinding()]
    param()
    $MyArray = @()
    $Sites =[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Sites
    foreach ($Site in $Sites) {
    $obj = New-Object -Type PSObject -Property (
    "SiteName" = $Site.Name;
    "SiteLocation" = $Site.Location;
    "SubNets" = $Site.Subnets;
    "Servers" = $Site.Servers
    $Obj | Sort $Site.Name | FL
    $MyArray += $obj
    $MyArray | export-csv -path $env:HOMEPATH\SitesSubs.csv -NoTypeInformation
    Thanks for your help! SdeDot

    I've got a script that might help you out:
    http://gallery.technet.microsoft.com/scriptcenter/Convert-OutoutForCSV-6e552fc6
    Blog reference:
    http://learn-powershell.net/2014/01/24/avoiding-system-object-or-similar-output-when-using-export-csv/
    Boe Prox
    Blog |
    Twitter
    PoshWSUS |
    PoshPAIG | PoshChat |
    PoshEventUI
    PowerShell Deep Dives Book

  • 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

  • Export Users to CSV

    We have Hundreds of customers, many separated across several companies and OUs.
    What I need is a Power Shell script to export existing user information (User Name, E-mail, Mailbox Size, Number of e-mails, Real Name, Creation Date, etc.) to a CSV sheet, Based on OU, Or Company name, or Domain.
    Is this at all possible?
    I am very new to Windows Power Shell and I have no idea where to start, especially considering of the potential of breaking something critical.

    You can use Power Shell or any other scripting language.  You can even use DS commands. 
    Here are some examples -
    http://social.technet.microsoft.com/wiki/contents/articles/3537.active-directory-active-directory-domain-services-ad-ds-commands-and-scripts.aspx
    You can use  the following command to export all
    samAccountName and Name to an output file.  Modify the filter based on your requirement. 
    Dsquery * -filter "&(objectClass=User)(objectCategory=Person)" –attr samAccountName Name >>Output.csv
    Santhosh Sivarajan | Houston, TX
    Windows 2012 Book - Migrating from 2008 to Windows Server 2012
    http://www.sivarajan.com/
    This posting is provided AS IS with no warranties,and confers no rights.

  • Formatting output to CSV

    I'm looking for some help with my script that I have.
    The process in how it works is as follows,
    1. Gather all computer objects within a domain (dnshostname)
    2. Ping test to see which ones are up and active.
    3. For each active computer
     3.1 Print the hostname
     3.2 query the objects Sid,sAMAccountName, etc information
     3.3 Print the output from Get-LocalAcctInfo into a text file.
    4. Repeat
    Here's the code I'm using, I know it's not perfect but it's a work in progress.
    function Get-LocalAcctInfo {
    [CmdletBinding()]
    param (
    [Parameter(Mandatory=$true)]
    $ComputerName
    Process {
    Foreach ($Computer in $ComputerName) {
    Try {
    Add-Type -AssemblyName System.DirectoryServices.AccountManagement
    $PrincipalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::Machine, $Computer)
    $UserPrincipal = New-Object System.DirectoryServices.AccountManagement.UserPrincipal($PrincipalContext)
    $Searcher = New-Object System.DirectoryServices.AccountManagement.PrincipalSearcher
    $Searcher.QueryFilter = $UserPrincipal
    $computer
    $Searcher.FindAll() | Format-List -Property Sid,SamAccountName,Enabled,LastPasswordSet,PasswordNotRequired,PasswordNeverExpires,UserCannotChangePassword
    Catch {
    Write-Warning -Message "$($_.Exception.Message)"
    $rtn = $null
    $count = 0
    Get-ADComputer -Filter * |
    ForEach-Object {
    if((Test-Connection -CN $_.dnshostname -Count 1 -Buffersize 16 -quiet) -match 'True')
    write-host -ForegroundColor green $_.dnshostname
    Get-LocalAcctInfo $_.dnshostname | Out-File C:\Users\UserAccount\Desktop\results.txt -append
    $count = $count + 1
    else
    write-host -ForegroundColor red $_.dnshostname
    write-host $count " hosts are active and were enumerated on the domain."
    What I'm trying to accomplish is to have the computer name along with the account information formatted nicely within a csv file. 
    I have working code that is able to place all the information about the computer object within a csv when I use the following within my function and code.
    $Searcher.FindAll() | Where-Object {$_.Sid -Like "*-*"}
    Get-SWLocalAdmin $_.dnshostname | Export-Csv C:\Users\adsecure_rstrong\Desktop\text.csv
    The output of the code that I pasted in the code block above is the following
    "computername.domain.com
    Sid                      : S-1-5-21-1213413474-1213434134760-84413413436-500
    SamAccountName           : Administrator
    Enabled                  : True
    LastPasswordSet          : 1/1/2014 8:27:20 PM
    PasswordNotRequired      : False
    PasswordNeverExpires     : False
    UserCannotChangePassword : False"
    I'd like the computername to be placed with the rest of the output and in csv format
    Any suggestions or recommendations are welcome. I'm new to Powershell and learning/teaching myself along the way. Note, that my original code works but I'd rather put it into a csv file so I can easily filter out different columns.
    Thanks,
    Rob.

    We have all the information on domain accounts regarding password last set, password doesn't expire etc.
    We're looking to check for each computer that exists within the AD domain, what LOCAL user accounts exist on those devices and the information surrounding them. 
    The Get-ADComputer line just gives me the computers that exist within the domain, so that I can feed that information into my function and pull out the local user information.
    Here's an example of my local user account output in a nicer format.
    Sid SamAccountName Enabled LastPasswordSet
    S-1-5-21-277684375-1707151907-12... Administrator True 12/4/2008 8:20:54 PM
    S-1-5-21-277684375-1707151907-12... User1 True 5/28/2010 6:02:54 PM
    S-1-5-21-277684375-1707151907-12... User2 True 5/28/2010 6:04:58 PM
    S-1-5-21-277684375-1707151907-12... User3 True 5/28/2010 6:11:59 PM
    S-1-5-21-277684375-1707151907-12... Guest False 3/20/2014 7:30:24 PM
    S-1-5-21-277684375-1707151907-12... IUSRTESTUSER True 7/28/2010 1:47:45 PM
    S-1-5-21-277684375-1707151907-12... IUSRWEBUSER True 5/2/2013 7:11:03 PM
    S-1-5-21-277684375-1707151907-12... SUPPORT_388945a0 False 12/5/2008 1:26:33 AM
    S-1-5-21-277684375-1707151907-12... ServiceAccountUser1 True 5/28/2010 6:06:36 PM
    Hope this explains it a little better.
    I'll try out your suggestions and see if I can get anywhere further.

  • Dynamic Logo file names in PO XSL-FO stylesheet

    We have different company logo files for different operating units. Hence , we require to use a dynamic logo file name in XSL-FO template.
    When I use the below for a single file it works.
         <fo:inline>
    <fo:external-graphic content-width="50pt" content-height="50pt" src="url({'${OA_MEDIA}/Logo_medium_COMCEL.jpg'})" />
    </fo:inline>
    However, I would need to make the filename dynamic.
    When a tried usng an xsl variable tos tore fielname, it didnt work.
    Any pointers as to how we can achieve that would be helpful

    Thanks for your quick reply Dave, I appreciate your time.
    But I couldn't test the new template as I was neither able to create a new PO nor was able to run the PO Output for communication Report. When I tried to create a PO the Purchase Order form did not open saying I am not setup as an employee, even the PO Output for communication did not give any LOV for the PO's.
    I tried to define employee name in the employee's login
    information (System administrator/Security/User/Define) for my user, but some how my name doesn't appear in LOV. Any help is appreciated.
    Thanks,
    Sharmila

  • Name of exported PDF file

    <p>Hello,</p><p>I hope I&#39;m in the correct section and that someone will be able to help me.</p><p>I run a web application (within Weblogic 8.1 sp5) which allows the direct generation of reports in PDF.<br />Each report has a unique name and I want the PDF to open in my Web browser.<br />The problem I get is that the name of this PDF is not the one that I want.</p><p>As the export is always in PDF, I&#39;m using the ReportExportControl class.<br />When I use <font face="courier new,courier">setExportAsAttachment(false)</font> along with <font face="courier new,courier">setName(idReport)</font>, the name of the PDF when I click &#39;Save&#39; is the name of my jsp, not <font face="courier new,courier">idReport</font>.<br />When I use setExportAsAttachment(true), the name is not exactly idReport.</p><p>I also tried forcing the response header to specify the attachment name, without any success either.<br />Do someone have any idea ?</p><p>Here below a sample of my code :</p><font size="2"><p><font size="1"><font face="courier new,courier">ReportExportControl exportControl = <strong><font color="#7f0055">new</font></strong></font></font><font face="courier new,courier" size="1"> ReportExportControl();<br /></font><font face="courier new,courier" size="1">exportControl.setReportSource(reportSource);<br /></font><font size="1"><font face="courier new,courier">ExportOptions exportOptions = <strong><font color="#7f0055">new</font></strong></font></font><font face="courier new,courier" size="1"> ExportOptions();<br /></font><font color="#3f7f5f"><font face="courier new,courier" size="1">//exportControl.setExportAsAttachment(false); // this will open the file in the current window<br /></font></font><font size="1"><font face="courier new,courier">exportControl.setExportAsAttachment(<strong><font color="#7f0055">true</font></strong></font></font><font size="1"><font face="courier new,courier">); <font color="#3f7f5f">// this will open a &#39;save as&#39; popup<br /></font></font></font><font color="#3f7f5f"><font face="courier new,courier" size="1">//exportControl.setOwnForm(true);<br /></font></font><font size="1"><font face="courier new,courier">exportControl.setOwnPage(<strong><font color="#7f0055">true</font></strong></font></font><font face="courier new,courier" size="1">);<br /></font><font face="courier new,courier" size="1">exportControl.setName(idPackage);<br /></font><font face="courier new,courier" size="1">exportOptions.setExportFormatType(ReportExportFormat.PDF);<br /></font><font face="courier new,courier" size="1">exportControl.setExportOptions(exportOptions);<br /></font><font color="#3f7f5f"><font face="courier new,courier" size="1">// Assign Fields collection to the viewer<br /></font></font><font face="courier new,courier" size="1">exportControl.setParameterFields(parameterFields);<br /></font><font color="#3f7f5f"><font face="courier new,courier" size="1">// Disable database logon information request<br /></font></font><font size="1"><font face="courier new,courier">exportControl.setEnableLogonPrompt(<strong><font color="#7f0055">false</font></strong></font></font><font face="courier new,courier" size="1">);<br /></font><font color="#3f7f5f"><font face="courier new,courier" size="1">// Assign the connectionInfos to the viewer<br /></font></font><font color="#3f7f5f"><font face="courier new,courier" size="1">//exportControl.setDatabaseLogonInfos(connectionInfos);<br /></font></font><font face="courier new,courier" size="1">response.reset();<br /></font><font face="courier new,courier" size="1">response.setContentType(<font color="#2a00ff">"application/pdf"</font>);<br /></font><font face="courier new,courier" size="1">response.setHeader(<font color="#2a00ff">"Content-Disposition"</font>,<font color="#2a00ff">"inline;filename="</font> + idPackage + <font color="#2a00ff">".pdf"</font>);<br /></font><font size="1"><font face="courier new,courier">exportControl.processHttpRequest(request, response, getServletConfig().getServletContext(), <strong><font color="#7f0055">null</font></strong></font></font><font size="2"><font face="courier new,courier" size="1">);<br /></font><font face="courier new,courier" size="1">exportControl.dispose();<br /></font></font></p></font><p>Thanks alot for helping ;)</p><p>Bernard</p>

    <p> </p><p>The ReportExportControl specifies the header info, so it will not keep the values you set in code. Two options:</p><p>1. If you&#39;re using JRC XI Release 2 or newer, get the export using ReportClientDocument.getPrintOutputController().export(...) method.  You can then redirect the export output to the HTTP Response stream after specifying the header info as you&#39;re doing now.</p><p>2. If you need to use ReportExportControl, get the export format stream by passing processHttpRequest a &#39;fake&#39; HTTPResponse object that you create yourself.  Make the &#39;fake&#39; response return a &#39;fake&#39; ServletOutputStream that you create yourself, where you override the write(...) method to pass it to the &#39;real&#39; HTTP Response stream.  This way, you can throw out all the header info that ReportExportControl uses, and specify your own.</p><p>One thing - you have to be careful to ensure that your report pdf name represents a valid filename on every client OS that your page is being viewed.</p><p>TUeda </p>

  • New problem with file name while exporting files

    Hi all. Whenever I export files from Crystal, it converts the filename from mixed case to lowercase, i.e. Vendors.pdf or Vendors.csv becomes vendors.pdf or vendors.csv. The destination folder has other files of mixed case, it's not a setting on that side. Since this file is data for an upload, it's a problem. Can't find a setting in Crystal. Is there a fix somewhere?
    Thanks
    Robin

    Hi Robin,
    When exporting this is by design, most OS's won't allow the same name so it's mostly not an issue. You could write a small application that exports for you then you can rename it to anything you want.
    Thank you
    Don

  • Obtaining file name from the file path given

    hi,
    how to obtain  file name from the file path given

    Hi bharath,
    1. PC_SPLIT_COMPLETE_FILENAME
    2.
    DATA : path LIKE pcfile-path.
    DATA : extension(5) TYPE c.
    path = filename.
    CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
    EXPORTING
    complete_filename = path
    * CHECK_DOS_FORMAT =
    IMPORTING
    * DRIVE =
    extension = extension
    name = name
    * NAME_WITH_EXT =
    * PATH =
    EXCEPTIONS
    invalid_drive = 1
    invalid_extension = 2
    invalid_name = 3
    invalid_path = 4
    OTHERS = 5
    regards,
    amit m.

  • Export data in CSV and store the file in local drive

    Hi,
    Here is the requirements.
    Fetch the values from table (around 60000 records), and export them into CSV file and store the file in local drive.
    I have written servlet to to this and it is working fine expect saving the file in local drive. At the moment, it is asking to save as in local drive. i want to save the file automatically in particular path (/var/www/files/). Below is the code.
    String file = "CandidatesDetails" + sd + ".csv";
                        queryString = "select * from candidate where candidate.status='A'";
                        connection = ConnectionPoolHelper.getConnection();
                        response.setContentType("application/csv");
                        response.setHeader("content-disposition", "filename=" + file);
                        System.out.println("Query= " + queryString);
                        ps = connection.prepareStatement(queryString,
                                  ResultSet.TYPE_SCROLL_INSENSITIVE,
                                  ResultSet.CONCUR_READ_ONLY);
                        rs = ps.executeQuery();
                        datas = "CANDIDATE ID,CANDIDATE TITLE,FIRST NAME,LAST NAME,E-MAIL,NATIONALITY ID,NATIONALITY,COUNTRY ID,COUNTRY NAME,INDUSTRY ID,INDUSTRY DESCRIPTION,EXPERIENCE,DATE OF BIRTH,HEAR ABOUT US\n";
                        oout.write(datas);
                        String country = "";
                        String nationality = "";
                        String hearABtUs = "";
                        while (rs.next()) {
                             nationality = rs.getString(7);
                             if (nationality == null)
                                  nationality = "";
                             else if (nationality.equals("null"))
                                  nationality = "";
                             country = rs.getString(9);
                             if (country == null)
                                  country = "";
                             else if (country.equals("null"))
                                  country = "";
                             hearABtUs = rs.getString(14);
                             if (hearABtUs == null)
                                  hearABtUs = "";
                             else if (hearABtUs.equals("null"))
                                  hearABtUs = "";
                             else
                                  hearABtUs = hearABtUs.replaceAll(",", ";");
                             datas = rs.getInt(1) + "," + rs.getString(2) + ","
                                       + rs.getString(3) + "," + rs.getString(4) + ","
                                       + rs.getString(5) + "," + rs.getInt(6) + ","
                                       + nationality + "," + rs.getInt(8) + "," + country
                                       + "," + rs.getInt(10) + "," + rs.getString(11)
                                       + "," + rs.getString(12) + "," + rs.getString(13)
                                       + "," + hearABtUs + "\n";
                             oout.write(datas); Regards,
    Dongan.

    Here is the first few lines
    public void doGet(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
              HttpSession session = request.getSession(true);
              String datas = "";
              PreparedStatement ps = null;
              ResultSet rs = null;
              String queryString = "";
              Connection connection;
              PrintWriter oout = response.getWriter();
              java.util.Date d = new java.util.Date();
              SimpleDateFormat dateformat = new SimpleDateFormat("dd-MMM-yyyy");
              String sd = dateformat.format(d);
              tryAt the moment, when i run http://localhost:8080/project/CandidatesDetail, it will ask me to save the file somewhere. I should manually mention the path to save the file. what i want is, it should automatically save it in the location C:\projects\files\.
    thanks.
    Regards,
    Dongan
    Edited by: Dongan on Oct 26, 2007 5:22 AM

  • HTML DB SQL Workshop Output to csv Max Row Count

    I am using HTML DB 1.6 with Oracle 10g 10.1.0.3.0 On SuSE Linux Enterprise Server 9.
    When I execute a query in SQL Workshop SQL Command Processor that returns a result set of greater than 5,000 rows and click the Output to Excel link, it exports NO MORE than 5,000 records.
    In working through Metalink with Oracle Tech Support, apparently for Reports in HTML DB there is a way to change the Max Row Count default limitation of 5,0000. However, this isn't in a report. It is simply from the query results page in SQL Workshop. Tech Support has been unable to idnetify ANYWHERE where I can change the default Max Row Count for simply outputting the results to csv format through the Output to Excel link.
    I am desperately looking for where I can globally change this default that will allow me to use SQL Worskshop to output greater than 5,000 records from within SQL Workshop.
    Thanks for you help!
    Mike

    hi mikes--
    that sqlworkshop 5k row limit issue was corrected in htmldb 2.0. in 1.6.x, i'm pretty sure you're always limited to 5k no matter what you select for that Max Rows attribute.
    regards,
    raj

  • Output to CSV problem

    I added the 'output to CSV' option to my report. When I click on the Output to Excel button and the dialog box opens, I click on the Open button. The data is displayed AND there is something I don't expect - the XML code. An example is shown below:
    <script type="text/javascript">                    
    var rowStyle = new Array(10);                    
    var rowActive = new Array(10);                    
    var rowStyleHover = new Array(10);                
    rowStyle[1]='';                    
    rowStyleHover[1]='';                    
    rowActive[1]='N';                    
    Could someone tell me why the XML code is being saved with the exported data, and more importantly, how do I prevent it.
    Thanks in advance for any assistance!
    Gerald Kuzminsky

    That's cumbersome. We are still on v1.6. Is it
    fixed in a later version?Haven't checked if this is fixed in 2.0 or 2.2. I'm still using 2.0 and I honestly got used to the workaround so don't know if it's been changed/fixed.
    Earl

Maybe you are looking for