Export multiple variables to csv

I am a bit lost in adding my results to a csv.
I tried several way, but the objects are not written to csv.
# Var
$wdb = Read-Host "Enter Mailbox Database"
add-pssnapin microsoft.exchange.management.powershell.e2010
Import-Module ActiveDirectory
$ADSettings = Get-adserversettings
If ($AdSettings.ViewEntireForest -ne $true) {
Set-AdServerSettings -ViewEntireForest $true
function Get-ADUserLastLogon([string]$userName)
$dcs = Get-ADDomainController -Filter {Name -like "*"}
$time = 0
foreach($dc in $dcs)
$hostname = $dc.HostName
$user = Get-ADUser $userName | Get-ADObject -Properties lastLogon
if($user.LastLogon -gt $time)
$time = $user.LastLogon
$dt = [DateTime]::FromFileTime($time)
$AdvStats = Get-mailbox $U.SamAccountName | Get-MailboxStatistics
Write-Host "$($username) last logged on at: $($dt), the Mailbox was last accessed on $($AdvStats.LastLogOffTime) by $($AdvStats.LastLoggedOnUserAccount).
The mailboxsize is $($Advstats.TotalItemSize) and contains $($AdvStats.ItemCount)."
$Item = {
$Item.UserName = $userName
$Item.LastLogonAD = $dt
$Item.LastMailboxLogoff = $AdvStats.LastLogOffTime
$Item.LastLoggedOnMailbox = $AdvStats.LastLoggedOnUserAccount
$Item.MailboxTotalItemsize = $Advstats.TotalItemSize
$Item.MailboxItemCount = $AdvStats.ItemCount
$Collection = $Item.toString()
$DisAcc = Get-Mailbox -database $wdb -resultsize Unlimited | ? {$_.Identity -like "*/Disabled_Accounts/*"}
Foreach ($U in $DisAcc) {Get-AdUserLastLogon $U.SamAccountName}
$Collection | Export-Csv -Path C:\Temp\DisabledAcc_$($wdb).csv
# End
I also tried with select-Object ... | Export-csv -Path ... -append
Answers provided are coming from personal experience, and come with no warranty of success. I as everybody else do make mistakes.

Thanks for your reply, it is greatly appriciated. I am not a native scripter, but am working on automating more via powershell and get some more decent experience on the subject. 
The idea of the script is to get the last logon to AD for users in a Exchange database, in addition it shows the last logon to the mailbox and the user who logged on last to that mailbox. As aditional information I also added the Mailbox size and Item Count. 
The script i created runs in which it displays the requested information.
Write-Host "$($username) last logged on at: $($dt), the Mailbox was last accessed on $($AdvStats.LastLogOffTime) by $($AdvStats.LastLoggedOnUserAccount).
The mailboxsize is $($Advstats.TotalItemSize) and contains $($AdvStats.ItemCount)."
In addition i wanted to export that information to a csv, which i can again use for information and maybe even further in the eventual cleaning process. However that is failing. 
The scriptlet you created only looks at lastlogon to the mailbox and not on the AD object. It could be that the account is still used, while the mailbox is not, therefore I want to collect all that information.
Answers provided are coming from personal experience, and come with no warranty of success. I as everybody else do make mistakes.
Nope
Actually, i retreive information from ADuser 
$user = get-aduser $mbx.name
-properties enabled,lastlogondate
You can simply add lines for get-mailboxfolderstatistics
$user = get-aduser $mbx.name
-properties enabled,lastlogondate
$mbxstat = get-mailboxfolderstatistics $mbx |select itemsinfolder ... whatever you want
Then add rows to the table
Itemsinfolder = $mbxstat.itemsinfolder
Got the idea?    You can combine any cmdlets and put them into one table
At this moment im kinda busy doing my work, but later i can modify my script to get exact output you need.
In your script, your primary source of data is AD user, i use maibox instead and get the Aduser info from there
Modified my script (few lines above) .. it should work for you  (i would run it over all mailboxes though: get-mailbox -resultsize unlimited)

Similar Messages

  • Exporting Shared Variables to csv

    When I try and export SV information to csv, LV (2009, DSC) doesn't seem to recognize any variables that are located within virtual folders in the library. Does anyone know a work-around to get that data tabulated short of cycling through the whole library writing values from SharedVariableIO property nodes to file?
    Thanks,
    Kyle
    CLD using LV, DSC 8.5-2009, RT 8.5
    Ghoti!

    muks wrote:
    Have you seen this?
    Yep. That's the problem. The shared variable library I'm working with contains well over 1000 variables that are organized into a few dozen virtual folders within the library. When I use the Export Variables function you linked to, it doesn't "see" any variables in folders, only those in the library root.
    CLD using LV, DSC 8.5-2009, RT 8.5
    Ghoti!

  • Export multiple entries in CSV format - Adobe Captivate Results Analyzer

    I'm currently developing and testing a quiz in Captivate 8, which I have set up with the assistance of my IT colleagues to report to an internal server.
    All appears to be working correctly with regard to capturing the data. I can access and read the data using Adobe Captivate Quiz Results Analyzer 1.5.
    I note that I can see the individual responses and I can drill down to see the details of the interactions - interaction type, correct answer, student answer etc.
    My issue is that it seems that you can't batch export this detailed information for multiple participants when I use the 'Export to CSV' function. It appears to only allow you to export the data for each individual that you have drilled down into. Given that I have several hundred participants that isn't going to work.
    Can someone tell me if this is a limitation of Adobe Captivate Results Analyzer or is there a way to do this using this tool?
    Thanks

    Hi there, I have similar issue that I have explained in this post. Any ideas please?
    Thank you
    B

  • LV 8.2 DSC Multiple Variable Editor - Import/Exp​ort bug?

    Hi,
    Has anyone used the export/import feature in the Multiple Variable Editor in LV DSC 8.2?  I'm having problems importing a Comma Separated Variable (CSV) file and it fails to include the "Bind to Source" parameters.
    You can test this by simply exporting a bound variable and then importing it into a new library.  Not all the features are imported.
    Is this a bug or have I simply not read the documentation or is it not meant to work like this!?
    ...Andy
    Lead Engineer, Controls and Electrical
    Irvine CA

    Rudi,
    Apparently this has been identified by Doug Mumford (NI) in an email to our consultant (ThinkG):
    "There is a bug in the importing/exporting of CSV files using the Multiple Variable Editor. This will be addressed in the next maintence release of LabVIEW. Attached is a VI that should fix this -- make a backup of the original and replace it with the attached VI. The path to this VI is <labview>\resource\dialog\variable."
    See Doug, he'll have the VI.
    The bug omitted a ":" e.g. "Network Buffsize" instead of "Network:Buffsize" so that when items were imported back in the items were loaded incorrectly.
    Regards...Andy
    Lead Engineer, Controls and Electrical
    Irvine CA

  • Automated Script to Export Multiple Businesscards

    Hi all,
    i have found a script which lets me exporting multiple businesscards using a textfile here:
    http://www.kirupa.com/motiongraphics/scripting4.htm
    But it is not working properly - something is wrong in line 23. Besides, i think its the wrong link to the scriptfile too?
    Anyway, the method described here is exactly what i am looking for.
    And in addition i wanto to export different backroung graphics using LayerComp-Export.
    Who knows about Photoshop scripting to produce the right code?
    Help much appreciated - Cheers

    The info in that link is old. From CS and looks like it has not been updated. I also don't think that is the best way to do somethink like this.
    Search for Variable Data Sets in the help file. If that looks like something that will work for you I can help you create a script.

  • Export multiple forms to xml/excel - field headings are missing

    I have created a dynamic flow multiple page form in Livecycle.  When I first tested the form I would export -> multiple forms to a spreadsheet -> an xml file that I would then open in excel.  This worked great and the field headings showed at the top.
    I did some edits to my form and now when I run the export to xml and then open in excel, the field headings are gone.  What controls this variable, does anyone know how I can correct this?
    Thank you in advance!

    Hi,
    The heading are in the table pt_fcat - you don't seem to be passing that in form....
    PERFORM setup_and_display_alv_ver2
    USING
    it_out_alvp "Parameter structure
    it_output[] "Internal Data table(header table)
    it_output[]. "Dummy table for Hierarchical ALV!!(item table)
    which I guessing in in one of the includes?
    Saying that the extract pof code does not show where you are calling form it_out_alv_fieldcat_before ...which populates the headings...
    Regards
    Stu

  • Bug? Cannot export shared variable, if it's in a virtual folder within an .lvlib

    Hello,
    I was trying to keep my libary of shared variables organized by categorizing the variables into different virtual folders. However, it turns out that variables in virtual folders are excluded from exports, even though they (and their folders) are visible in the Multiple Variable Editor.
    Is this by design (in LabVIEW 2012)? If so, what's the rationale?
    Thanks!

    Hi,
    When there are variables inside nested virtual folders within a Library, the multiple variable editor does not work. If you select several variables in a virtual folder and right-click and select Multiple variable editor, the editor opens but you cannot change anything.
    Workaround: Convert folders to libraries or move variables under a single folder.
    Regards,

  • Vestigial fields when exporting shared variables

    Hello,
    Is this a bug? I have a network-published shared variable that used to have aliasing enabled. After I cleared the "Bind to:" field and disabled aliasing, I exported its library into CSV mode. However, it still contained the columns (among others):
    NetworkrojectBinding = TRUE
    NetworkrojectPath = <old variable that it was bound to>
    The extra columns messed up my CSV parser. The only way I could find to prevent their appearance was to delete all the variables that used to have project binding, and re-create them

    JKSH,
    I was able to reproduce the same issue here.  I'll look into this a little more and see if this may in fact be a bug.  
    James K.
    National Instruments
    Applications Engineer

  • How to check empty string and null? Assign same value to multiple variables

    Hi,
    1.
    How do I check for empty string and null?
    in_value IN VARCHAR2
    2. Also how do I assign same value to multiple variables?
    var_one NUMBER := 0;
    var_two NUMBER := 0;
    var_one := var_two := 0; --- Gives an error
    Thanks

    MichaelS wrote:
    Not always: Beware of CHAR's:
    Bug 727361: ZERO-LENGTH STRING DOES NOT RETURN NULL WHEN USED WITH CHAR DATA TYPE IN PL/SQL:
    SQL> declare
      2    l_str1   char (10) := '';
      3    l_str2   char (10) := null;
      4  begin
      5  
      6    if l_str1 is null
      7    then
      8      dbms_output.put_line ('oh STR1 is null');
      9    elsif l_str1 is not null
    10    then
    11      dbms_output.put_line ('oh STR1 is NOT null');
    12    end if;
    13  
    14    if l_str2 is null
    15    then
    16      dbms_output.put_line ('oh STR2 is null');
    17    elsif l_str2 is not null
    18    then
    19      dbms_output.put_line ('oh STR2 is NOT null');
    20    end if;
    21  end;
    22  /
    oh STR1 is NOT null
    oh STR2 is null
    PL/SQL procedure successfully completed.
    SQL> alter session set events '10932 trace name context forever, level 16384';
    Session altered.
    SQL> declare
      2    l_str1   char (10) := '';
      3    l_str2   char (10) := null;
      4  begin
      5  
      6    if l_str1 is null
      7    then
      8      dbms_output.put_line ('oh STR1 is null');
      9    elsif l_str1 is not null
    10    then
    11      dbms_output.put_line ('oh STR1 is NOT null');
    12    end if;
    13  
    14    if l_str2 is null
    15    then
    16      dbms_output.put_line ('oh STR2 is null');
    17    elsif l_str2 is not null
    18    then
    19      dbms_output.put_line ('oh STR2 is NOT null');
    20    end if;
    21  end;
    22  /
    oh STR1 is null
    oh STR2 is null
    PL/SQL procedure successfully completed.
    SQL> SY.

  • How to delete multiple variables from the variables list

    Hello,
    Iam using FrameMaker 9.0. Is there a way I can select multiple variables from the book and delete them together.
    Thanks,
    CP.

    NO in FM9. Take SQUIDDS TOOLBOX the free tool: 'Formats'
    'Formats' is a very helpful tool for 'deleting' paragraph formats, character formats, cross reference formats, table formats, color definitions and variables.
    You can delete unused one or all formats of selected. For paragraph and character you can also decide to 'add new one in catalog'.
    -Georg

  • How can i export multiple sesssion at a time

    Hi,
      My requirement is to write an equivalent query for the sap standard program RSBDCDAT_NEW which will export a particualr session information into a flat file. I have to modify this program to export multiple bdc sessions at a time in one go. the session names will be given as an input from a flat file present in application server.
    An any body give me any idea regarding this requirement.
    thanx in advance.
    Regards,
    Maqsood

    You can't from the phone.
    If they are iCloud contacts you can sign into iCloud.com with Your Apple ID from a web browser on your computer. Click Contacts, select the contacts you want to delete, click the gear icon on the bottom left then delete.

  • Can I use preview to export multiple page PDF as jpegs?

    Using Preview, I export multiple page PDF as jpeg and results are the first page only as jpeg. Can I use preview to export multiple page PDF as jpeg for every page?

    Automator is great for this if you need to export many pages to JPG, or just have to do this often.
    Two other quick and dirty way sto get it done:
    (1) Enable thumbnail view, click on the ONE PAGE you want to convert to jpg, then choose "export." If you choose more than one page, only the first will get exported to jpg.
    (2) Create a copy of the file, delete all the pages except the one you want to export to JPG, and export that page. You may be able to "undo" the delete, get all your pages back again, and re-delete all but the one you want to export, etc. I would not recommend doing this on the original version of the file because of Preview's autosave so-called "feature."

  • How do i export multiple full resolution movie files at the same time in final cut pro 6?

    I've been using Final Cut Pro since version 3 came out, know the program well, have even had jobs consisting of just operating the program.  I'm currently running version 6 because that's the latest one that works on my computer.  Back in verison 3, there used to be an option under Export to export a "Final Cut Pro" movie, which was really a Quicktime movie but appeared with a FCP icon and defaulted to opening in FCP, but the important thing about it is that it was a full resolution copy of the movie with no compression.  Now, that option seems to have been changed to "export Quicktime movie."  In my opinion that change is kind of stupid since it is so much less specific and is even less of an implication that one is exporting a full resolution file.  But in fact you are.
    One also has the option of using Compressor to export a version of a movie, and therein there are so many different options that if you are not confused by it I think there's something wrong with you.  Moreover, it would appear that there is no equivalent of exporting a full resolution version of a file in Compressor.  Fair enough: a full-resolution file involves no compression so is not appropriate for "Compressor."  BUT, suppose you want to export multiple uncompressed, full-resolution movies at once.  When you use Compressor, you are able to create batch lists and export many things at the same time, for instance, lists that will take many hours to complete so you can go to bed and get the results the next day.  But as far as I can tell there is no way to do this at full resolution without compression.  Instead you have to sit at the computer waiting for each one to finish and after each one, manually go to the next and select "export Quicktime movie."  Even if there is a way to do this I would complain that such an obviously desireable thing is so unaccessable.  In fact, the only reason I've typed out my question at such length is because I'm stuck here waiting for each one of my movies to export.
    Anyway, all my complaints aside, anyone know how to do this?

    what you're missing to export multiple files is the batch export command available in the file menu or by control clicking on the items in the browser.  You can export multiple sequences/clips at full resolution with this.
    This has been available in fcp for a long long time.
    Wow, you are right.  Now that you mention it, I can't believe I never noticed that.  Thanks.
    Only if you have the 'Self-Contained' box checked.  Otherwise you'll end up with a reference movie.
    Correct.  That box is typically checked by default.  There are other default settings you could change that would not result in a full-quality version, but what I meant was hitting that option from the pull-down menu, then changing nothing and hitting ok.

  • Can I export multiple folders at the same time, keeping the album structure

    I'm exporting all of my photos from 2010 so far. Is there a way to export multiple folders at the same time, while keeping the existing album structure? It seems that when I try it, iPhoto exports them all to the same folder.
    I really don't want to do this one album at a time, and here's why -
    I'd like to select all of the albums, then export, using the plugin, to WalMart so that I can order prints.

    Check out [iPhotoToDisk|http://www.iphototodisk.com/index.html]
    I'd like to select all of the albums, then export, using the plugin, to WalMart so that I can order prints.
    Why not upload to Walmart from iPhoto? Check out the first option here:
    There are many, many ways to access your files in iPhoto:
    *For Users of 10.5 and later*
    You can use any Open / Attach / Browse dialogue. On the left there's a Media heading, your pics can be accessed there. Command-Click for selecting multiple pics.
    Uploaded with plasq's Skitch!
    (Note the above illustration is not a Finder Window. It's the dialogue you get when you go File -> Open)
    You can access the Library from the New Message Window in Mail:
    Uploaded with plasq's Skitch!
    *For users of 10.4 and later* ...
    Many internet sites such as Flickr and SmugMug have plug-ins for accessing the iPhoto Library. If the site you want to use doesn’t then some, one or any of these will also work:
    To upload to a site that does not have an iPhoto Export Plug-in the recommended way is to Select the Pic in the iPhoto Window and go File -> Export and export the pic to the desktop, then upload from there. After the upload you can trash the pic on the desktop. It's only a copy and your original is safe in iPhoto.
    This is also true for emailing with Web-based services. However, if you're using Gmail you can use iPhoto2GMail
    If you use Apple's Mail, Entourage, AOL or Eudora you can email from within iPhoto.
    If you use a Cocoa-based Browser such as Safari, you can drag the pics from the iPhoto Window to the Attach window in the browser.
    *If you want to access the files with iPhoto not running*:
    For users of 10.6 and later:
    You can download a free Services component from MacOSXAutomation which will give you access to the iPhoto Library from your Services Menu. Using the Services Preference Pane you can even create a keyboard shortcut for it.
    For Users of 10.4 and later:
    Create a Media Browser using Automator (takes about 10 seconds) or use this free utility Karelia iMedia Browser
    Other options include:
    1. *Drag and Drop*: Drag a photo from the iPhoto Window to the desktop, there iPhoto will make a full-sized copy of the pic.
    2. *File -> Export*: Select the files in the iPhoto Window and go File -> Export. The dialogue will give you various options, including altering the format, naming the files and changing the size. Again, producing a copy.
    3. *Show File*: Right- (or Control-) Click on a pic and in the resulting dialogue choose 'Show File'. A Finder window will pop open with the file already selected.
    Regards
    TD

  • How can I export the universe  to CSV format in Rational      (java)

    How can I export the universe to CSV format in Rational ,please give me one demo .thanks!!

    There's no direct access to an Universe from Java - Universes do have an SDK, but it's COM-based.
    If what you want is to retrieve data from the Universe, what you can do is create a Web Intelligence document reporting off that Universe, create a Query with the data you want from the Universe, then use the ReportEngine (REBean) SDK to retrieve the ResultSet from the Query - note that there's no CSV export option, so you'd have to walk through the ResultSet and write to an CSV yourself.
    Sincerely,
    Ted Ueda

Maybe you are looking for

  • Key generation in Remote Systems.

    Hi,    When we are creating a remote Sytem we have a filed called Key Generation , where we can specify the from , to Range. Can any one provide me the business scenario where this key generation is used?           I have an idea about key mapping wh

  • Vendor Withholding Tax Clearing

    Dear All, I have an issue with Withholding Tax on Vendor Down payment making and Invoice.... While making Vendor downpayment Rs.10000/-, the entry is, Vendor A/c Dr-10000 To Bank A/c-9800 To TDS -200 While doing invoice, the entry is Expense A/c Dr-1

  • Flash player crashes on multiple websites on all browsers

    I was viewing www.liveleak.com watching many videos perfectly fine. I left to take a break for awhile and now any time i attempt to watch a video it will crash. The whole page will load up except the flash player. As soon as it attempts to load up th

  • OpenEXR plug-ins for CS3?

    Are there any Universal Binary OpenEXR plug-ins for Photoshop CS3? The only one I can find is PowerPC only.

  • I cannot activate my photoshop cs

    I have photoshop CS and cannot get activation. Phone activation said it failed ... I went to chat and they said they don't support "older" products. So how do I get the program installed?