Sorting array not working when run as a job

I have a Powershell script that reads data from a log file, extracts a username and adds it to an array. I then sort the array to remove duplicates and export the data to a CSV file. The script works fine when run locally on the server but I need to call
the script remotely for a number of servers and when I do this it does not output anything to the CSV. The script is run as a job.
$ArrList = [System.Collections.ArrayList]@()
# open file and read data
$arrlist.Add("$final")
$arrlist | sort -unique | out-file c:\scripts\iis_users.csv
If I change the script to use add-content it can add entries to the same CSV file. But ideally I need to sort the output as there are many duplicates.

Not sure why but that would only export the last user. I didn't have time to investigate so instead I decided to only add users to the array after first checking they didn't exist already:
if ($arrlist -notcontains $final)
$arrlist.Add("$final")
add-content c:\scripts\iis_users.csv "$final"
I thought this would create a performance hit but it seems almost as fast.

Similar Messages

  • Multitouch on track pad not working when running Windows 8 in boot camp

    Does anyone know a work around on how to resolve the issue of more than one fingers on the trackpad? For example, I use one finger to click a window then another finger to slide/move the window to a different location on the screen. This does not work when running Windows 8 in Boot Camp latest version. Any suggestion is much appreciated.

    very very few gestures are supported in windows
    https://discussions.apple.com/message/24548533#24548533
    if it's a limitation from ms you need to contact them
    if it's a limitation from apples drivers you can use feedback channel
    http://www.apple.com/feedback/

  • Hyperlink is not working when running on sun solaris OS

    Hi,
    I have Created PDF file using oracle reports 2.5 version and included hyperlinks in reports which will open files located on our intranet server(http://cup2.ngc.co.uk). Hyperlinks are working properly when I generated report on window xp machine but not working when I compiled and executed report on solaris unix server(reports 6i).
    please let me know why hyperlinks is not working when executed on solaris((5.8). do we need any setup to work hyperlinks on unix server.
    Thanks in advance,

    Ok, there are 2 docs i've tried.
    A = Doc created originally from MPB Pages with hyperlink
    B = Doc created from iPad Pages with hyperlink
    A was transfered to iPad Pages using iTune. I emailed A as pdf from iPad to gmail and reopen the file on iPad using Quickoffice / PDF Reader Lite, the link is NOT active, not working. BUT, when i read A using MBP gmail, the link is ACTIVE, i click on the link and it brings me to the correct webpage.
    As for B, after the page was created with links on iPad, i emailed B as pdf from iPad to gmail, reopen the file on iPad using Quickoffice / PDF Reader Lite, the link is NOT active, and this time, when i read B using MBP gmail, the link is NOT active as well.
    Weird huh? I'm starting to sense that is the problem with iPad Pages. What say you?

  • Powershell Script Send-zip not working when running in cmd

    I found there is powershell send-zip script available in technet.  I tested it and found that it works when the script is running under powershell env, but when it is calling in cmd env, I can see the zip file, but there is nothing in it.  If
    I add the "-noexit" switch it runs normally.  Anyone have ideas what might be happening?
    The orig codes is as following:
    function global:SEND-ZIP ($zipfilename, $filename) { 
    # The $zipHeader variable contains all the data that needs to sit on the top of the 
    # Binary file for a standard .ZIP file
    $zipHeader=[char]80 + [char]75 + [char]5 + [char]6 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0 + [char]0
    # Check to see if the Zip file exists, if not create a blank one
    If ( (TEST-PATH $zipfilename) -eq $FALSE ) { Add-Content $zipfilename -value $zipHeader }
    # Create an instance to Windows Explorer's Shell comObject
    $ExplorerShell=NEW-OBJECT -comobject 'Shell.Application'
    # Send whatever file / Folder is specified in $filename to the Zipped folder $zipfilename
    $SendToZip=$ExplorerShell.Namespace($zipfilename.tostring()).CopyHere($filename.ToString())
    SEND-ZIP C:\abc\a.ZIP C:\a\a.bak

    I've had the same problem with similar code found on another web site.
    The reason the zip file ends up being empty is that the temporary $ExplorerShell object you created is deleted when the send-zip function returns,
    and any incomplete copy operation that may still be ongoing at that time is aborted. (The copy operation is asynchronous, and continues after the CopyHere() function returns.)
    To work around this, you need to add a delay loop before you return, waiting for the copied object to appear in the zip.
    (Note that adding a fixed delay, like I've seen on other web sites, does not work: Small files appear almost immediately, whereas large file or worse still large subdirectory trees can take a long time to appear.)
    Try changing the end of your routine to something like...
    # Create an instance to Windows Explorer's Shell comObject 
    $ExplorerShell=NEW-OBJECT -comobject 'Shell.Application' 
    # Open the zip file object
    $zipFile = $ExplorerShell.Namespace($zipfilename.tostring())
    # Count how many objects were in the zip file initially
    $count = $zipFile.Items().Count
    # Send whatever file / Folder is specified in $filename to the Zipped folder $zipfilename 
    $SendToZip=$zipFile.CopyHere($filename.ToString())
    # Wait until the file / folder appears in the zip file
    $count += 1 # We expect one more object to be there eventually
    while ($zipFile.Items().Count -lt $count) {
        Write-Debug "$filename not in the zip file yet. Sleeping 100ms"
        Start-Sleep -milliseconds 100
    # Return deletes the $zipFile object, and aborts incomplete copy operations.

  • Why does this script not work when run with osascript cli?

    I wrote the following to interface with geektool to display a list of todo's on my desktop (i'm sure it's been done elsewhere, but I wanted to try it myself). I had it working fine until I tried ordering the output to place the highest priority items at the top of the list. The following code works properly during development in Script Editor, but when geektool launches the command using osascript ~/Library/Scripts/todos.scpt it only displays the initial "TODOS:" without displaying the rest of the info. Searching the Applescript Release notes, I found that some versions of Applescript 1.8 had issues with null characters when using the osascript cli, however, I'm running 1.10.7 so it shouldn't be an issue (and I'm not sure how to check for null characters in Applescript even if it were). Anybody have any ideas on what's going on here?
    set output to {"TODOS:
    set highpri to {}
    set medium to {}
    set low to {}
    set nada to {}
    tell application "iCal"
    repeat with i in calendars
    repeat with j in todos of i
    if (completion date of j as string) is equal to "" then
    if priority of j as string is equal to "high priority" then
    copy summary of j & "
    " to end of highpri
    end if
    if priority of j as string is equal to "medium priority" then
    copy summary of j & "
    " to end of medium
    end if
    if priority of j as string is equal to "low priority" then
    copy summary of j & "
    " to end of low
    end if
    if priority of j as string is equal to "no priority" then
    copy summary of j & "
    " to end of nada
    end if
    end if
    end repeat
    end repeat
    end tell
    return (output & highpri & medium & low & nada) as string

    well, i'd been pulling my hair out for quite a while with this and decided it was time to ask for help, but I thought I'd give it one last shot and found a resolution almost immediately. I figured that problem had to be caused by the way applescript was concatenating the lists, so I got rid of the lists completely and it still wouldn't work. This convinced me that it must be newline related since that was the only special character left in the string. I opened up the script in vi, but the default compiled script format is not human readable. The osascript man page indicated that it would accept both compiled and text scripts, so I gave it a try, and osascript handled the raw text file wonderfully.

  • [SOLVED] Pacman and yaourt not working when run with "sudo"

    Hi,
    I am an Arch newbie, just installed Arch 3.10 on my machine. I access internet through a proxy server and I'm facing this strange problem -
    Pacman is unable to fetch packages when I run it through sudo - "sudo pacman -S smplayer" (It gives network unreachable error).
    However when I run it through root, it retrieves those same packages successfully.
    yaourt also faces a similar kind of problem -
    When I run it through sudo or as root, it is unable to retrieve packages which can be downloaded by pacman. But, when I run pacman to download those same packages, it is able to do so.
    I am using gnome 3.8, and use radiotray ( It's for listening online radios ). When I run it via 'Alt-F2' or as a startup application, it's not able to connect to any radio station ( which means it's not connecting to the internet ). However, on running it via terminal, it connects to the internet successfully. Are these 2 problems related ? I'm facing the first one even without loading gnome, so it's not gnome's problem, i guess.
    I can ping successfully through my administrator as well as root account, connect to the internet via browser, and ssh, git, bzr are also working fine.
    What can I do to resolve this ?
    Thanks
    Last edited by parinporecha (2013-09-12 06:01:06)

    parinporecha wrote:
    To configure proxy, I added the line "export http_proxy=PROXY_LINK" to the bashrc files of user and root.
    Regarding Arch 3.10, yes i meant the installation media from 2013.09.01 ( kernel 3.10 )
    That's why root works, but not sudo. Sudo clears the environment. See man sudo and man sudoers.

  • GUI_GET_DESKTOP_INFO is not worked when run in background

    Dear all,
    I want to retrieve the computer name using this function module. It is working fine in foreground but it returns no result when I run in background. Is there any other method to get the computer name in background? Thanks in advance.

    Problem solved using the following method:
      DATA: BEGIN OF usr_tabl OCCURS 10.
              INCLUDE STRUCTURE uinfo.
      DATA: END OF usr_tabl.
      DATA  th_opcode(1)                    TYPE x.
      data: size type i.
      CONSTANTS: opcode_list LIKE th_opcode VALUE 2.
      CALL 'ThUsrInfo' ID 'OPCODE' FIELD opcode_list
        ID 'TAB' FIELD usr_tabl-sys.
      describe table usr_tabl lines size.
      read table usr_tabl index size.
      write usr_tabl-term.
    while usr_tabl-term is the computer name. It works in background as well.
    Edited by: Chiew Ngee Ho on Mar 12, 2009 9:36 AM

  • Satellite L450D-11H - WLan not working when running on battery

    Hi everyone,
    I have a Satellite L450D-11H laptop running Windows 7 OS.
    When my laptop is plugged into the mains my wireless connection works fine.
    But when I unplug it and just run it using the battery, my wireless connection stops working.
    I have looked at the power settings and changed the battery option to "Maximum performance when wireless"
    But I still have the same problem. Could this be a driver issue?
    Any ideas?
    Thanks.

    [ShopOfGHD.com]Free Shipping on GHD Hair Straighteners and UGG Boots
    GHD Limited Edition Rare Only £77.01 + Free Shipping
    GHD LImited Edition Radiance Set Only £71.77 + Free Shipping
    GHD Kiss MK4 Pink Only £67.50 + Free Shipping
    GHD IV Styler Purple £84.63 + Free Shipping
    GHD Hair Straightener MK4 Pink Only £69.00 + Free Shipping
    GHD IV MK4 Dark Hair Straightener Flat Only £66.53 + Free Shipping
    GHD Ceramic Hair Straightener (MK4) Black Only £65.84 + Free Shipping
    GHD IV MK4 Gold Hair Straightener Flat Only £64.60 + Free Shipping
    GHD IV MK4 Pure Hair Straightener Flat Only £66.53 + Free Shipping
    GHD Limited Edition Hair Straightener Kit Black Only £64.69 + Free Shipping
    Discount UGG Boots 50% Off + Free Shipping
    ShopOfGHD.com specializes in selling ghd hair straighteners and ugg boots, ghd hair straightener, ghd straightener, ghd straighteners, discount ghd hair straighteners, discount ghd hair straightener.
    Website: http://www.shopofghd.com

  • FUNCTION IS NOT WORKING WHEN RUN IN SRW.RUN_REPORT, URGENT

    Hi,
    I have a report. it has got 1 Query and 2 groups.
    Q1
    |
    |
    __G1__
    |F1 |
    |F2 |
    |F3 |
    |
    |
    |
    __G2__
    |Items|
    |Sales|
    | Qty|
    |Store|
    |Func4|
    |Func5|
    |Func6|
    The Query looks like above. Now In the report I have a 3 User parameters . For Each record in G2 the functions Func4,Func5 and Func6 adds the value to the user parameters at the report level.
    Now the Func1,Func2,Func3 takes the value of last 4 record for each item at each G1 Level and devides it by 4 and prints . As an example given below
    ITEMS-----SALES-------QTY-----------STORE
    10001-----10000-------200-------------100
    10001-----20000-------500-------------200
    10001-----15000-------350-------------175
    10001-----45000-------650-------------225
    10001-----50000-------700-------------300
    AVERAGE==>32500-------550-------------225 ==> Calculated by F1,F2,F3
    20001-----70000-------900-------------400
    20001-----30000-------600-------------350
    20001-----20000-------500-------------300
    20001-----25000-------450-------------275
    20001-----35000-------550-------------225
    20001-----65000-------800-------------400
    AVERAGE==>36250-------650-------------300 ==> Avg of last 4 records
    This report takes an parameter which is part of the Where condition of the Query Q1. If I run this report from the report builder and provide the value for the parameter then the report runs fine printing the exact values. If I run the report from another report(which I have to do, due to circumstances) using SRW.Run_Report and pass the parameter in the same command. The the function FUNC4, FUNC5, FUNC6 does not do the addition, as a result the Func1,Func2,Func3 returns 0. I dont know why this is happenning .
    This is very very URGENT, My project manager is on my head to finish it ASAP. Please help.
    Thanks
    Feroz

    Hi Toby and Danny,
    Thanks for the quick reply. I dont think I am having an interdependancy of the functions. Here is an sample what two functions do at each level
    Func6 =========> This function at group level G2
    begin
    -- To initialize the user parameter for each new item.
         If :CNT = 1 Then
              :Wk4_Pos_Qty := 0;
         End If;          
    -- to add the qty value to the user parameter for last 4 records. Uchange is the no of records for each item     
    If :CNT >= :UCHANGE - 3 Then
         :Wk4_Pos_Qty := :Wk4_Pos_Qty + :Qty;
    End If;     
    return 0;
    end;
    Func3 ======> this function at group level G1
    Begin
    -- if no of records are less than 4 then devide by the no of records or devide by 4.
         If :UChange < 4 Then
                   return((:Wk4_Pos_Qty + :Qty) / :UChange);
         Else
                   return((:Wk4_Pos_Qty + :Qty)/ 4);     
         End If;     
    end;
    Here Wk4_Pos_Qty is the User parameter created to hold the calue for the Um of last 4 records Qty.
    I tried to modify the Func3 so that it looks like this
    Func3
    begin
    srw.reference(:Wk4_Pos_Qty);
         If :UChange < 4 Then
                   return((:Wk4_Pos_Qty + :Qty) / :UChange);
         Else
                   return((:Wk4_Pos_Qty + :Qty)/ 4);     
         End If;     
    end;
    But it does not effect anything. I mean its the same. The Wk4_Pos_Qty returns 0 and Func3 returns 0.
    Any Suggestions .
    Thanks
    Feroz

  • Link in Report does not work when run on Citrix

    Hello,
    we use Crystal Reports (v11) for creating Reports.
    Data is based on our CRM system "SuperOffice".
    We have several reports and what we did is to add a column that includes a link to SuperOffice.
    For example - if I have a list of contacts as a report, then every line has a link to SuperOffice.
    If I click this link, the contact in SuperOffice gets open.
    This works on lokal pc installations.
    But is doesn't work on a citrix server.
    If I click the link - nothing happens.
    Is that a known problem or does anyone have any ideas for that?
    Are there any known problems with links in reports on citrix servers?
    Thanks in advance.
    Best regards,
    Tony

    Hi Don,
    thank you for fast response.
    That is a good advice. We will check that.
    The main question is, to which folders etc. does CR needs access?
    To explain the situation better: To run the reports we use Crystal Reports Runtime (Version 11.1.1883).
    Do you (or anyone else in these forum) know where we could get information about which kinds of access CR Runtime needs to handle with these links?
    Regards,
    Tony

  • In SharePoint sorting is not working in the list.

    Sorting is not working when i click on the list column, where the column filed is an people or Group datatype.
    Please help me out in this.
    Ramesh S

    Hi,
    You can refer this post-
    https://social.technet.microsoft.com/Forums/office/en-US/b748bb03-4881-4aa5-9c87-bd4558b9201c/unable-to-sort-task-lists-by-assigned-to-column?forum=sharepointadminprevious
    Thanks,
    Danny
    Please remember to Mark as Answer if it works or vote of it is helpful

  • The Horizontal & vertical scroll is not visible or not working when i run the form in Forms 6i.

    Hi all,
    The Horizontal & vertical scroll is not visible or not working when i run the form.
    In this form , there are 5 canvas namely
    CANVAS2 - Stacked Canvas
    PASS - Content Canvas
    MAT_RATES - Content Canvas
    DATE - Content Canvas
    PREVIOUS - Content Canvas
    I have set "Show Horizontal Scroll Bar" to "Yes" and  "Show Vertical Scroll Bar" to "Yes" in the WINDOW Property.
    I have  set "Show Horizontal Scroll Bar" to "Yes" and  "Show Vertical Scroll Bar" to "Yes" in the STACKED CANVAS Property .
    But still the Horizontal and Vertical Scroll Bar is not working when i run the Form.
    Help me with this please. How do i make it visible??
    Oracle Forms 6i..
    Thank You.

    Vijetha wrote:
    Hi all,
    The Horizontal & vertical scroll is not visible or not working when i run the form.
    I have set "Show Horizontal Scroll Bar" to "Yes" and  "Show Vertical Scroll Bar" to "Yes" in the WINDOW Property.
    I have  set "Show Horizontal Scroll Bar" to "Yes" and  "Show Vertical Scroll Bar" to "Yes" in the STACKED CANVAS Property .
    But still the Horizontal and Vertical Scroll Bar is not working when i run the Form.
    Help me with this please. How do i make it visible??
    Oracle Forms 6i..
    Thank You.
    hello vijetha,
    window and canvas show scroll bar when it need.
    You should show block property
    and set block scroll bar
    hope this helps..
    Hamid

  • Flash catalyst cs5.5 not working when i run the project

    when i ran prodjects in flash catalyst cs5 it came up as a webpage that could scroll, now in cs5.5 when i run the prodject it cannot scroll and it doesn't scroll when you export for web servers, help much apreciated.

    Vijetha wrote:
    Hi all,
    The Horizontal & vertical scroll is not visible or not working when i run the form.
    I have set "Show Horizontal Scroll Bar" to "Yes" and  "Show Vertical Scroll Bar" to "Yes" in the WINDOW Property.
    I have  set "Show Horizontal Scroll Bar" to "Yes" and  "Show Vertical Scroll Bar" to "Yes" in the STACKED CANVAS Property .
    But still the Horizontal and Vertical Scroll Bar is not working when i run the Form.
    Help me with this please. How do i make it visible??
    Oracle Forms 6i..
    Thank You.
    hello vijetha,
    window and canvas show scroll bar when it need.
    You should show block property
    and set block scroll bar
    hope this helps..
    Hamid

  • I am using iPad1. Running v4.3 and when connecting to wifi iPad keyboard does not work. Keyboard works for everything else including typing this question out. Why would it not work when typingin password for wifi connection?

    I am using iPad1. Running v4.3 and when connecting to wifi iPad keyboard does not work. Keyboard works for everything else including typing this question out. Why would it not work when typingin password for wifi connection?

    Kowhai wrote:
    Lots of WIFI needs a username and password to get access. I guess you're lucky and yours is set up unsecured.
    Normal secured WiFi requires only a password to get access. The password is used to encrypt traffic between your device and the WiFi access point. If whatever you are using requires a username as well then it is not simply normal secured WiFi. It might be a subscription WiFi service like GOGO, ATT, etc., or a service with authentication, i.e., college campus, etc. To help you out we need to know what you are using and what connection dialog you are being presented with. You don't have exactly the same problem as the original poster. He is having a problem entering a password into the password dialog that iOS presents when one tries to connect to a normal secured WiFi network. Could you clarify exactly which WiFi service you are using.

  • Table sort is not working for columns.

    Hi,
    I am using TableSort.java class. Followed https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sapportals.km.docs/library/user-interface-technology/wd%20java/wdjava%20archive/developing%20with%20tables%20in%20web%20dynpro.pdf
    to create the action and assigned that to onSort event for the table. When I run, I see the ascending-descending icons besides the columns, but nothing happens when I click them. Here is the context.
    Context
    l
    l
    l ---User_Table
             > Email
             > Name
            |
             > Office
    Here Name is a custom string (last name, first name). Also office is a custom string (office1, office2, ...etc).
    Edited by: srinivas M on Feb 8, 2009 6:03 AM
    Edited by: srinivas M on Feb 8, 2009 6:03 AM

    Hi Srinivas,
      If you want to do an initial sort. You have to add the following method to the TableSorter class.
    public void initialSort(String columnId, IWDNode dataSource) {
              // find the things we need
              String direction = WDTableColumnSortDirection.UP;
              IWDTableColumn column = (IWDTableColumn) table.getView().getElement(columnId);
              NodeElementByAttributeComparator elementComparator = (NodeElementByAttributeComparator) comparatorForColumn.get(column);
              if (elementComparator == null){
                   //not a sortable column
                   column.setSortState(WDTableColumnSortDirection.NOT_SORTABLE);
                   return;
              // sorting
              elementComparator.setSortDirection(WDTableColumnSortDirection.valueOf(direction));
              dataSource.sortElements(elementComparator);
    In your wdDoModifyView() after initializing the tablesorter class you have to call the above method.
    if (firstTime) {
                IWDTable table = (IWDTable) view.getElement("Table");
                wdContext.currentContextElement().setTableSorter(
                   new TableSorter(table, wdThis.wdGetSortAction(), null));
                      wdContext.currentContextElement().getTableSorter().initialSort("Your Column ID", wdContext.nodeUser_Search_Results());
    Can you double check in your code if the table is bound to the node "User_Search_Results" and not "User_Table". If the table is bound to the "User_Table" then the sort will not work since in the code you are sorting the node "User_Search_Results".
    If you want to implement sort on only one column you can use the alternate constructor for the TableSorter class.
    TableSorter(IWDTable table, IWDAction sortAction, Map comparators, String[] sortableColumns)
    You have to give a String array of columns that need to be sort enabled.
    Regards,
    Sanyev

Maybe you are looking for

  • Call script in a workflow and get return value?

    hello I want create a workflow to check some attribute in IDM like for the home directory, use the workflow call some script to check there is enough space in the server? and the folder is almost there or not? then get the return value like if no eno

  • Starting up the ipod...

    Hi everybody, Is it normal that the ipod needs a few seconds to power up after several hours of non-usage? It does nothing for about 3 secs, then displays the Apple-logo on unlit display for approx. another 2 secs and goes to normal operation. Does t

  • Export / import privacy property in ical items

    Hi I run into a problem with the privacy property in iCal items (calendar events and to do items). Exporting and importing iCal items as .ics file don't retain the privacy information (the private flag) I can set in the items property dialog. This is

  • Why some classes are not Cloneable?

    I found the library designers designed some classes that are not Cloneable, such as String,StringBuffer, File, Thread, Socket... Since File,Thread and Scoket contain information of the context, they may not work as expected if I transfer them to othe

  • Curly braces {} and | on ibook g4 1GHz Tiger

    I own iBook G4 (14-inch Early 2004) 1GHz as of recently. I just installed MAC OS X Tiger on it. And I want to use it for PHP/HTML/CSS coding. But I can't find curly braces {} or a | on a keyboard? I use English setings. It's a European model ibook (I