CSV to send reports and fixing dates

I am trying to create a script that will send different reports. From now on I'm only instant reports and SCSI hardware, but I intend to add to my script once I learned how to get the current things to work properly. I wish I could create a spreadsheet for some of the data I receive and fix the spreadsheet to my email that I create. This is the code I have right now:

$scsiLog = "C:\Users\myself\Documents\ScsiLogTest.csv".
$rows = @)
Get - VM | Get-SCSI controller. {ForEach-Object
$row = $_
$os = (get-VMGuest - vm $row.parent). OSFullName
$row | Add-Member-type NoteProperty - name-value $os OS
$rows = $rows + $row
}
$scsiReport = $rows | Select the Type, Parent, OS | Export-CSV $scsiLog

$snapshotReport = get-file-vm name. Get - VM | Get-Snapshot | Select Name, VM, @{n = "Size"; e = {'{0:N2}' f $_.}} SizeMb}}, created. Out-string
Send-mailmessage-to 'E-mail'-'email' - 'server'-'$snapshotReport, $scsiReport' body - SmtpServer topic 'Test report '.

When I run that I am able to get the instant passage of my report to work properly, however I am not able to get the SCSI report to create a worksheet and attach it to the email. I know the portion of my code SCSI works fine if run by itself and does not seek to generate a mail so the problem is probably where I'm trying to use export-CSV $log.

If you want to have this file as an attachment, use the attachment setting.

Something like that

Send-MailMessage -Attachments $scsilog -From "email" -To "email" -SmtpServer "server" -Body $snapshotReport -Subject "Report Test"

Tags: VMware

Similar Questions

  • VM inventory report and missing data

    All, I wrote a VM inventory report that seems to pull all the data I need, except for a single field, Type of NETWORK adapter. I get some data in this area, but the vast majority is left white. When I run a one-liner (Get - VM - < name of vm > |) Get-NetworkAdapter | Select the Type), I get the data you want. Can anyone help to determine why I get no coherent, fully poplulated data fields?

    Here's the script:

    $HostReport = @)
    Get - VM | object sort name | {foreach ($_.name)}
    $Report = "" | Select the host name, Cluster, NumCPU, MemoryMB, network, SCSI, Datastore, ToolsVersion, ToolsStatus
    $Report.Hostname = $_. Name
    $report. Cluster = ($_ |) Get - Cluster). Name
    $report. NumCPU = $_. NumCPU
    $report. MemoryMB = $_. MemoryMB
    $report.Network = ($_ |) Get - NetworkAdapter). Type
    $report. SCSI = ($_ |) Get - ScsiController). Type
    $report. Data store = ($_ |) Get - Datastore). Name
    $report. ToolsVersion = $_. ToolsVersion
    $report. ToolsStatus = $_. ToolsVersionStatus
    $HostReport += $Report
    }
    $HostReport | Export-Csv-path c:\TEMP\vm-hw.csv - NoTypeInformation - UseCulture

    TIA,

    -gc

    Hello, gary1012-

    Maybe you have a few virtual machines with more than one network card?  If so, this line that gets the Type to interconnect the virtual machine would produce no output for these machines.  To manage the virtual machines with more than one NETWORK card, edit the "$report.Network =...". "line to something like:

    $report.Network = ($_ | Get-NetworkAdapter | %{$_.Type}) -join ","
    

    This will give a single type for virtual machines with a NETWORK card or a string of separation by commas of type names for virtual machines with more than one NIC

    How does do for you?

  • On the forms send us and receive in return, data in the form of fields will be not print.  We can view the data, but the fields to print Virgin.  How can I fix it?

    On the forms send us and receive in return, data in the form of fields will be not print.  We can view the data, but the fields to print Virgin.  How can I fix it?

    OK, it's different. These text boxes are (at least engineering point of view) not considered form data, they are annotations (or markup). On your print dialogue box, you will see a group of "Comments & Form". Make sure that the first control is set to "Document and annotations:

    After this change, you should see the markup of your impressions.

  • Need help with vSphere data script, packaging and sending it to the data warehouse

    Greetings PowerCLI gurus.


    Everyone can offer suggestions on a script which can query vSphere and pull on the following fields of the virtual computer:

    NameStateStatusHostSpace in useSpace used

    Format in a file in the CSV format and send the file to an FTP server?

    Much respect to all, thanks a lot in advance.

    Hello-

    Happy to help you.

    OK, well, if this database is accessible through a UNC path, you might make a copy directly using Copy-Item.  If you use different credentials, you can encrypt and store in an XML file.  HAL Rottenberg wrote to do http://halr9000.com/article/531.

    Or, if this pension data is something that supports the secure copy (scp) or secure FTP (SFTP), those who would be good options.  Again, you can store the alternative credentials in an encrypted in an XML file format and use them as needed.

    Certainly, there is a balance to be struck between security and ease of use.  It may be such that the transmitted data are not considered sensitive to all, and clear data transfers are acceptable.  Probably still a good idea to take measures to protect the credentials at least.

  • When I send a text message and mobile data are off, it is not given, but I do not see this message for a few minutes. I can then refer using "send as a text message. How can I 'send as a text message' in the first place?

    When I send a text message and mobile data are off, it is not given, but I do not see this message for a few minutes. I can then refer using "send as a text message. How can I 'send as a text message' in the first place?

    Disable the iMessage?

  • Firefox 4 does not save form data after sending form and pressing the previous button

    Firefox 4 does not save form data after sending form and pressing the back button... It's very annoying that it erases all data. It worked fine on FF3.

    See:

    • Firefox or tools > Options > privacy > History: "don't forget to search and form history."
  • Send and receive data packets on the network

    Hi all.

    Let's say I have a GPRS Modem that sends a data packet to an IP address of a server.

    How can I receive and read the packet data using Labview?

    In other words, how can I send a packet of data to the server using Labview?

    Thank you.

    Dear UOI,

    First of all, in my opinion, you must decide which protocol you we will use to connect both sides of the application.

    Is that UDP or TCP, for example?

    Reading of the package depends on the Protocol, according to me. But it is possible.

    About these two examples of Protocol that I quoted, that's two white papers for you to analyze.

    LabVIEW basic TCP/IP communication

    Communication UDP in LabVIEW

    Kind regards

  • I am new to the ethernet communication using labview. I don't have any material. I have two laptop, I need to send and receive data through these 2 portable by using labview. Kindly help me on this.

    I am new to the ethernet communication using labview. I don't have any material. I have two laptop, I need to send and receive data through these 2 portable by using labview. Kindly help me on this.

    Dennis has already said: for a direct PC - PC connection, you need a cross over cable. If you connect through a router or a switch, you use a standard cable.

  • Question about the reports and data of rollups

    We followed in place that I need to create monthly reports. There is a custom agent that collects two key all measures that can be used to define a percentage of system availability. They check essentially two types of errors that may occur together or individually. I have not really used reports in Foglight but has spent a good amount of time to play with them today. The main problem/issue I have at this point is how to deal with the accumulation of data. Our retention policy performs three stacks of separate data in a month, how can you effectively report on these data rolled upward?

    Example: one of the agents simply return a 0 if the system is ok and 1 if it finds the error. In the end, we just need to know how many times that 1 has been returned in a month. How would one accomplish? If the sum is for example, 40 for a total of 4 hours is that it means that he met the 40 times error? The frequency of the agent is set to 60 seconds, so that would mean 40 minutes of time error...?

    The other control agent returns specific error codes and not a simple binary value. If the above example or the question is trivial I still don't know how to deal with this one...

    Most likely, you can use the value of the sum for the metric, just as you might have guessed.  Because the value is 0 or 1, the amount will be the total of the values for the time period.  There are also a number of samples, which should / could be higher because there might be 0.

  • using PIN messages to send the query and return data

    I am working on an app that will send a request to another blackberry and return the data all via PIN messages. There is a user interface where the user selects the contact and start the PIN message with the request. There is a background application that listens to these requests. When we arrive, he must inform the user and allow them to send the requested data or reject the request. If they choose to send, it will undertake a PIN to the sender with the requested data, which will then be returned to the screen. Is it possible by using PIN messages, and if so, can I prevent their display in the list of messages?

    You * can * remove PIN of the Inbox messages. For all purposes useful, this is just a specific instance of an ELECTRONIC message.

  • I want to see the metrics around email opens, clicks, unsubscribe, bounce and form submit them? who report I should date?

    I want to see the metrics around email opens, clicks, unsubscribe, bounce and form submit them? who report I should date?

    Hello

    You can extract Email Analysis Overview report see E-mail openings, clicks, unsubscribe, bounce and form submit them.

    Thank you

  • Google Analytics can provide reports and data from a form created in Muse?

    My Muse site will be held by a third-party free image host, as I am creating a new customer. My client wants to be able to see a monthly report of inquiries submitted through the contact form, which was established in Muse. Google Analytics can provide reports and data from a form created in Muse?

    Muse done files through the interface design approach. It actually has nothing to do with the operation of your site. And this forum is for Business Catalyst, Adobe CMS. And if you use not only a 3rd party then for monitoring etc. based on you or someone another installation the analytical code of google on this Web site. Muse has nothing to do with it.

    Here is the departure of google for this guide.

    http://www.Google.com/intl/en-AU/Analytics/learn/setupchecklist.html

  • automatic scheduling of the report and send the output to the user by e-mail

    Hello
    Please I need scheduled report and send the output by email in discoverer. Please can someone help how to achieve this?

    Hello

    Yes, do you that.

    Please see Metalink Note 373812.1 how the schedule of reports to run at a given time while automatically the output electronics

    Thank you
    Fati

  • Dat.Files and NTuser.dat Journal

    I'm having problems of performance and troubleshooting, found that in C:/users of my computer

    There is my ntuserdat PC. newspapers and dat files.

    In addition, public user - same ntuser files

    By default - same ntuser files

    and the user: me has a data.local app file that has only 2 more files that

    me-pc user that has the same data files accurate local app at least two files of hp.

    I also seem to have 2 keyboards, moniters, winstock, memory addresses and others. The performace is bad! I think it's all these user accounts. Weird, as I am the only user and I have only 1 account - I. How can I fix it? I tried the defrag, disk Cleanup, health reports and see what is in my system. Please someone help me. It is a Pavilion hp 32-bit, windows vista sp2

    Hello

    I would backup several times using different methods like a couple of backups in the
    external and backup of important data on a DVD - safety in numbers. Then re-install Windows
    as he came on the system. The upgrade would be unwise and may not work with a system
    who has problems.

    Your system as it is now may be fixable without reinstalling by technical support
    However, a new installation should also address these issues.

    Rob - bicycle - Mark Twain said it is good.

  • Send report bursting to multiple e-mail addresses

    Hello

    I am getting error when sending report of burst with several following email address, please help me.

    Message detail:

    : RIPPLE_DELIVERY_FAILED: [INSTANCE_ID = bipublisher. 1364735550094] [SUBJOB_ID = 1256]: DOCUMENT_DELIVERY_FAILED: [INSTANCE_ID = bipublisher. 1364735550094] [DELIVERY_ID = 1154] Exception that was passed when the email::deliver API call launch delivery ProcessingException:Email delivery document failed with discount Exception::Email failed with DeliveryException::oracle.xdo .delivery .DeliveryException: javax.mail.internet.AddressException: illegal semicolon, not in a group in the chain "[email protected] ; [email protected] "24::oracle.xdo .delivery .DeliveryExcept .service position

    Here the sample below

    Set query data

    SELECT EmpNo,

    Ename,

    SAL

    WCP

    Application of bursting

    SELECT empno AS KEY,

    'burst_emp_sal' AS TEMPLATE,

    'en-US' AS LOCAL.

    'PDF' AS OUTPUT_FORMAT,

    "E-MAIL" AS DEL_CHANNEL,

    Email AS "Parameter1",

    Email AS parameter3,

    "Salary slip" parameter4.

    'Salvation'. Ename | "Please find enclosed." AS PARAMETER5,.

    'true' AS PARAMETER6

    WCP

    Data in the table

    7839 CLARK 5000 [email protected]

    7782 SCOTT 2450 [email protected] ; [email protected]

    7566 JOHN 2975 [email protected]

    7788 HUGE 3000 [email protected]

    There are two thing wrong in your logic

    1. use the comma instead of a semicolon

    2 parameter3 isn't a right parameter to send several email address actually see the parameter3 from, is not possible SHAPE can be several email address, if you really want then use PARAMETER1 and PARAMETER2 to several e-mail address because it refers to and CC

    Hopefully, your problem will be solved if you look over the points.

    Let me know if you still stuck with the same problem.

Maybe you are looking for