Why won't excel read my csv file created with the powersell out-file automatically.

I wrote a PowerShell script that creates a CSV formatted file.  The script simply creates a comma delimited string for each entry and adds it to a collection.  Then the out-file command write it to a file.
When you open it with Excel each line is put into one cell.  If you import the file and specify the "," as the delimiter, it imports just fine.  If the data is saved out again as a csv file,  the file is about half the size and opens
just fine with excel.
If you open the original file and the file created by Excel with notepad, they look the same.
So the files are different in size, contents look the same, but Excel won't automatically open the original file.
Any ideas of why this happens?  Also PowerShell and Excel are both running on Server 2012 R2.  Excel is a remote app.
If I do an export-CSV, I get some kind of information about the object.
Here is the script:
foreach ($group in $groups)
   $header += '"' + $group.name + '",'
   $CSVdata = @()
   $CSVdata += $header
   # Create a user entry
   $users = Get-ADUser -filter * |select SamAccountname, Name | sort SamAccountName
   foreach ($user in $users)
      $Groupmembership = Get-ADPrincipalGroupMembership -Identity $user.SamAccountName
      $userentry = '"' + $user.SamAccountName + '",'
      $user
      foreach ($group in $groups)
          if ($Groupmembership.SamAccountName -contains $group.SamAccountName) { $userentry += '"X",'}
          else { $userentry += '"",' }
       $CSVdata += $userentry
      $CSVdata
      Out-File -inputobject $CSVdata -FilePath c:\batch\GroupMembership.csv

Ok the script works exactly like I want it.  Thank you very much.
I am trying to understand the script but I am unable to figure out what the line "$keys=$t.Keys|%{$_}"
does.  I figured ".keys" was a method but my search for it comes up blank.  Do you have a reference you can point me to?  

Similar Messages

  • Looking for answers on XMP files - where should they be stored as sidecar files?  With the original raw file or in a separate folder?

    Looking for answers on XMP files - where should they be stored as sidecar files?  With the original raw file or in a separate folder?
    Relatively new user of Adobe LR5 and PS CC, about a year old. 
    If they should be stored somewhere beside the folder that contains the originals, where and how to change the settings?
    If I choose to write metadata to the original files, is that sidecar files or does the XMP file show separately?
    To be honest, I usually find a video and I cannot figure this out.  I have never received an answer on any of my questions by the way. 

    Hi there,
    You answered a prior question from me so I wanted to reach out to you about this.   I just need a step by step on how, if possible, to View LRCC on my MacBookPro when the main interface is on my iMac

  • How do I revert to replaced audio files being saved with the project file, *not* with the original audio files?

    In the latest release, when you send an audio clip to Audition, the newly created audio clip - which was previously saved in the same folder as the project file - is saved next to the original audio file.
    Makes sense, but for reasons to boring to go into, it's a major headache for my workflow, because it means combing through folders to find the files, instead of having them all in once place.
    So how to I turn this off and revert to those files being saved next to the project file?

    Hey Steve,
    You'll want to connect your phone to your computer and sync it in iTunes. You can read more about it here:
    iOS: Syncing your data with iTunes
    http://support.apple.com/kb/HT1386
    Welcome to Apple Support Communities!
    Have a good one,
    Delgadoh

  • Share via E-Mail redline a PDF file jointly with the clean DOC file

    Morning.
    For professional use I do need a script or an automatic workflow to achieve that a file such I have modified in Change Tracking Mode, is »Shared via Email« as (a) a PDF file showing the changes, and (b) jointly with a clean version DOC file (all changes and comments accepted).
    Do you know, how to achieve such preferably at »one click«?
    TIA and kind regards, Friedrich

    It should be possible to write an applescript that does it, but it would involve quite a lot of work. Search the forum and the internet for applescript and "tell application pages", and you will find some examples that will give you a base to build on.

  • Captivate File Created with Trial Will Not Open in Paid for Captivate

    I have a file created by Trial version of captivate. It was created in a different computer. Now, I have to make some modification in the file. However, when I tried to open it with Captivate 5.5, I got the error shown below. I am not able to use the popular solution provided in this link Click here to view   because the file was not created in my computer. I believe that there is a lock on the file since it was created with Trial version of captivate. Is it possible that I send the file to a representative, and they look into it?

    Was the file created with the same version? You talk about 'trial', but the only trial version available at this moment is Captivate 8. You were never able to open a Captivate project in a previous version, that explains why you cannot open it in 5.5.

  • File created with Trial version cannot be opened by Captivate 5.5 (Ensure that the file isn't open, the file isn't damaged....etc.)

    Hi,
    I have a file created by Trial version of captivate. It was created in a different computer. Now, I have to make some modification in the file. However, when I tried to open it with Captivate 5.5, I got the error shown below. I am not able to use the popular solution provided in this link Click here to view   because the file was not created in my computer. I believe that there is a lock on the file since it was created with Trial version of captivate. Is it possible that I send the file to a representative, and they look into it?

    Was the file created with the same version? You talk about 'trial', but the only trial version available at this moment is Captivate 8. You were never able to open a Captivate project in a previous version, that explains why you cannot open it in 5.5.

  • Usage limitations on files created with CS6 beta?

    My gut tells me that the cs6 beta falls under the cs6 license sections "Non-Serialized Software" and "Evaluation software" which state:
    "...for demonstration, evaluation, and training purposes only, and only if any Output Files or other materials produced through such use are used only for internal, non-commercial, and non-production purposes."
    Am I correct in assuming that this applies to all files created with the cs6 beta? I don't see this discussed anywhere which makes me wonder. I have made some nice progress on one of my files and now I'm wondering if I have to stop and redo everything in my old version. I don't want to sink much time into the beta if nothing I create is publicly usable.
    Official clarification would be appreciated.

    It's completely awkward that I haven't realised this so far, usually I export everything to PNG -> resize PNG with ACDSee -> convert to JPEG and then forget about it Thank you for clearing this up!

  • Displaying icon file associated with the exe file.

    Hi ,
    I want to display the icon file associated with the an exe file.
    I know that it is posssible to (Using wni32 API's) it is possible to extract the ico file. But I don't know how I can display it in my Java application.
    It will be great if anybody can throw light on it.
    With Regards,
    Praveena

    Hi,
    what functions do you both have in mind when talking about extracting the icon file using JNI and Win32 API? I know there is ExtractIcon in VisualBasic and Delphi that works for this, yet I do not see anything similar in JNI.
    Thanks in advance,
    Gleb.
    P.S. You should be able to display .ico files after decoding them & encoding them into gif/jpg in JIMI (Sun package for advanced image/graphics management).

  • Why won't adobe reader open my jpeg files?

    why won't adobe reader 11 open my jpeg files?

    Hi Nassman,
    Adobe Reader is a read only software for PDF files. JPEG is not a supported format which would open in Adobe Reader. You would need to open Jpeg in application which supports this file format.(e.g. Photoshop, Picture Viewer, MS Paint)
    Hope this helps. Let me know if you have any other question.
    Regards,
    ~Pranav

  • Why won't Adobe reader no longer let me view previously download (from Safari) pdf's? I am running OSX 10.8.5 and have uninstalled and reinstalled latest version of Reader?

    Why won't Adobe reader no longer let me view previously download (from Safari) pdf's? I am running OSX 10.8.5 and have uninstalled and reinstalled latest version of Reader. I get this error message "Adobe Reader could not open 'OD Test Bed Proposals_0.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded)."  I have tried changing the 'open with' options too. Thanks

    Try this:
    Go to: Mac HD/Library/Internet Plug-ins
    Trash the AdobePDFViewer.plugin and AdobePDFViewerNPAPI.plugin files
    Empty the trash
    Relaunch Safari. You can now download undamaged PDFs.

  • Why won't siri read back my messages before asking me to send?

    Why won't siri read back my messages before asking me to send?

    go to settings>general>siri >toggle it off and then on
    then try
    if problem continues
    Press and hold the Sleep/Wake button and the Home button together for at least ten seconds, until the Apple logo appears. DONT CONNECT YOUR DEVICE TO A COMPUTER.

  • Why won't my imac email send unless I restart the whole computer?

    why won't my imac email send unless I restart the whole computer?

    Two things, first see if it shows up in "Apple > About This Mac > More Info.. > Disc Burning" . If you still see it there the system still recognizes it but it isn't responding. Next do a
    SMC RESET
    http://support.apple.com/kb/HT3964
    Shut down the computer.
    Unplug the computer's power cord and ALL peripherals.
    Wait 15 seconds.
    Attach the computers power cable.
    Wait another 5 seconds and press the power button to turn on the computer.
    The 5 second timing is important to a successful reset.
    Hopefully this will reset the power to the drive.

  • Why won't my videos play? They start on the device that they are on, then stop and I get an error message...An error occured loading this content.

    Why won't my videos play? They start on the device that they are on, then stop and I get an error message...An error occured loading this content. This comes up on all of my computers. I reset the Apple TV to Factory Settings and still get the same message.

    Hi There,
    I had the same problem took me several hours to try and sort it out but nothing worked.
    I then went to the following apple link
    http://support.apple.com/kb/TS5376
    Follow everything to a T and you will get the use of your Itunes again.
    Hope this helps. Good luck (And remember to breath lol )

  • I uninstalled ver 11, installed ver 10.7 because ver11 won't work on my XPsp3 machine with my vinyl conversion software to mp3, but upon launch i get :"itunes library.itl cannot be read because it was created with a newer version of itunes'.

    I uninstalled and deleted ver 11, installed ver 10.7 because ver11 won't work on my XPsp3 machine with my vinyl conversion software to mp3, but upon launch i get :"itunes library.itl cannot be read because it was created with a newer version of itunes'.

    Hello, Stephen.
    Thank you for the question.  You will need to rebuild your iTunes library file in order to open an older version of iTunes.  Below, I have included the article that walks you through this process.  Start with the section labeled Re-creating the iTunes Library file.
    iTunes: How to re-create your iTunes library and playlists
    http://support.apple.com/kb/ht1451
    Cheers,
    Jason H. 

  • I'm trying to burn a playlist to a CD but some of the songs won't burn.  They appear grey shaded with the checkbox unchecked.  I can play these songs.  Any idea why they wont burn?

    I'm trying to burn a playlist to a CD but some of the songs won't burn.  They appear grey shaded with the checkbox unchecked.  I can play these songs.  Any idea why they wont burn?

    Hello VwecheRiste,
    Thanks for using Apple Support Communities.
    To troubleshoot this issue where some songs do not burn to a CD, please follow the directions in the article below.
    Can't burn a CD in iTunes for Windows - Apple Support
    Take care,
    Alex H.

Maybe you are looking for

  • 3gs will no longer charge and not recognized in itunes

    Tries sveral differnt cables as well as wall charger -   Never an issue with this phone and did not drop or get wet -   Any help appreciated

  • Problem with indesign CS4 program

    I've searched for this already but have had no luck finding a fix. My problem is that when I am running indesign CS4 on my laptop I cannot select the master page nor any other pages. Also certain other controls are not functioning like ruler guides,

  • Image split error in iBooks

    My epub file contains an error I'm unsure how to fix. When looking at the file in iBooks horizontally, some images split between two pages (ie the top of an image appears at the bottom of the page and the remaining image appears at the top of the nex

  • FMS on AMS

    Hello All, I purchased FMS 4.5 for Amazon web services (AWS)  but there is no Amazon Machine Images for this verison. When I purchase the AMS verison of FMS 4.5 it comes with a licence key and it haves a generate to generate more keys. However when I

  • "sudo" in UCM

    Hi! I was wondering if there was a kind of sudo in content server. I need to have a user (or some users) executing a service as system administrator but can't give to him the role of admin or sysmanager. In fact, they just need to update a metadata i