locked
Add semicolon in powershell report RRS feed

  • Question

  • I have created a script a which generates a report and i want to add semicolon in the script i tried but its not working. Can somebody help me.

    $FormatEnumerationLimit = -1
    $arrayOfStrings = Get-BrokerMachine -MaxRecordCount 1000 |ft dnsname, Desktopgroupname, Ostype, IPAddress, AssociatedUserNames -AutoSize | Out-String -Width 1000
    $separator = ";"
    [string]::Join($separator,$arrayOfStrings) |Out-File C:\test1.txt
    


    Lalit

    Monday, October 9, 2017 3:06 AM

Answers

  • I fixed it myself
    asnp citrix*
    $FormatEnumerationLimit = -1
    Get-BrokerMachine -MaxRecordCount 1000 -AdminAddress eselnxdc10 |select dnsname, Desktopgroupname, IPAddress, OSType  |export-csv -delimiter `; -path C:\test.csv -notype
    
    


    Lalit

    • Marked as answer by Kumar Lalit Monday, October 9, 2017 10:51 AM
    Monday, October 9, 2017 10:51 AM

All replies

  • Please try the following.

    ($arrayOfStrings | foreach-object {$_.trim($separator)}) -join $seperator


    Komal.

    Monday, October 9, 2017 4:24 AM
  • PS>$array = 'one','two','three'
    PS>$array -join ';'
    one;two;three
    PS>[string]::Join(';',$array)
    one;two;three
    PS>
    You cannot join an array of objects.

    \_(ツ)_/



    • Edited by jrv Monday, October 9, 2017 5:45 AM
    Monday, October 9, 2017 5:41 AM
  • none of the above method is working. still the same output

    Lalit

    Monday, October 9, 2017 9:36 AM
  • I fixed it myself
    asnp citrix*
    $FormatEnumerationLimit = -1
    Get-BrokerMachine -MaxRecordCount 1000 -AdminAddress eselnxdc10 |select dnsname, Desktopgroupname, IPAddress, OSType  |export-csv -delimiter `; -path C:\test.csv -notype
    
    


    Lalit

    • Marked as answer by Kumar Lalit Monday, October 9, 2017 10:51 AM
    Monday, October 9, 2017 10:51 AM
  • Which has nothing to do with the question you asked.  Try to ask a clear and accurate question the next time. We cannot guess what you are thinking.

    \_(ツ)_/

    Monday, October 9, 2017 10:57 AM