ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login
    1. Topics
    2. Lakshmana
    3. Posts
    • Profile
    • Following 66
    • Followers 3
    • Topics 313
    • Posts 1,763
    • Groups 0

    Posts

    Recent Best Controversial
    • Powershell Integration Help Needed

      I have already asking the help for the Powershell to send the mail through SMTP with the excel content.Now i have made .html which creates a Table where the data needs to be copied inside the table.When i copy the html code which through the error for &,since the body is in HTML format which is not accepting.Any suggestions.Whether the html code path can be given if yes how to proceed.HTML code is 2000 lines where gives the proper output of the table

      $email = "[email protected]"
      $smtpServer = "mail.somecompany.com"
      $ForEmail = @()
      ######################################
      #Create and get my Excel Obj
      $x1 = New-Object -comobject Excel.Application
      $UserWorkBook = $x1.Workbooks.Open("C:\temp\bluenose.xlsx")
      
      #Select first Sheet
      $UserWorksheet = $UserWorkBook.Worksheets.Item(1)
      $UserWorksheet.activate()
      
      #Copy the part of the sheet I want in the Email
      $rgeSource=$UserWorksheet.range("A1","E20")
      $rgeSource.Copy() | out-null
      
      $Results = Get-Clipboard
      foreach ($Result in $Results)
      {
          $ForEmail += "$Result<br>"
      }
      
      ######################################
      
      $msg = new-object Net.Mail.MailMessage
      $smtp = new-object Net.Mail.SmtpClient($smtpServer)
      
      $msg.From = "[email protected]"
      $msg.To.Add($email)
      $msg.Subject = "Excel Pasted"
      $msg.IsBodyHtml = $True
      
      $msg.Body = "Here is the contents of the excel file<br>
      <br>
      $ForEmail
      <br>
      "
      $smtp.Send($msg)
      
      posted in IT Discussion powershell
      LakshmanaL
      Lakshmana
    • RE: Mangolassi Access Issue

      @scottalanmiller needs your input. the issue cannot be only in my phone since many users facing after clearing the cache files also

      posted in Mango Happenings
      LakshmanaL
      Lakshmana
    • RE: Mangolassi Access Issue

      @scottalanmiller said in Mangolassi Access Issue:

      Haven’t seen any issues on iPhone.

      But the issue is there in Android cleared the cache and tried but its not working

      posted in Mango Happenings
      LakshmanaL
      Lakshmana
    • Mangolassi Access Issue

      Actually from today morning i have issue in accessing menu bars in Mangolassi where no output is coming while clicking in my phone Chrome browser. Any facing this issues?? There are notifications are there where i am unable click on it

      posted in Mango Happenings
      LakshmanaL
      Lakshmana
    • RE: Mail Allignment Issue

      @stess
      @scottalanmiller
      I got one script for copying the excel sheet content to the mail body which have issue in it.The issue where the table is not copying to body only contents are copied to the mail body without table.Help needed

      $email = "[email protected]"
      $smtpServer = "mail.somecompany.com"
      $ForEmail = @()
      ######################################
      #Create and get my Excel Obj
      $x1 = New-Object -comobject Excel.Application
      $UserWorkBook = $x1.Workbooks.Open("C:\temp\bluenose.xlsx")
       
      #Select first Sheet
      $UserWorksheet = $UserWorkBook.Worksheets.Item(1)
      $UserWorksheet.activate()
       
      #Copy the part of the sheet I want in the Email
      $rgeSource=$UserWorksheet.range("A1","E20")
      $rgeSource.Copy() | out-null
       
      $Results = Get-Clipboard
      foreach ($Result in $Results)
      {
          $ForEmail += "$Result<br>"
      }
       
      ######################################
       
      $msg = new-object Net.Mail.MailMessage
      $smtp = new-object Net.Mail.SmtpClient($smtpServer)
       
      $msg.From = "[email protected]"
      $msg.To.Add($email)
      $msg.Subject = "Excel Pasted"
      $msg.IsBodyHtml = $True
       
      $msg.Body = "Here is the contents of the excel file<br>
      <br>
      $ForEmail
      <br>
      "
      $smtp.Send($msg)](![image url](image url))
      
      posted in IT Discussion
      LakshmanaL
      Lakshmana
    • RE: Mail Allignment Issue

      How to add Hyperlink to the Introduction where <a href="">is not working here

      Help needed !!!

      $xl=New-Object -ComObject Excel.Application
      $wb=$xl.Workbooks.Open('c:\scripts\process.xlsx')
      $ws=$wb.Sheets.Item(1)
      $ws.MailEnvelope.Introduction = "This is a sample worksheet."
      $ws.MailEnvelope.Item.To = "[email protected]"
      $ws.MailEnvelope.Item.Subject = "My subject"
      $ws.MailEnvelope.Item.Send()
      
      posted in IT Discussion
      LakshmanaL
      Lakshmana
    • RE: Mail Allignment Issue

      whether can i convert. xlsx to. csv andcopy data to body of mail??? ![alt text](image url)

      posted in IT Discussion
      LakshmanaL
      Lakshmana
    • RE: Powershell Filter Data and Copy Data to new .csv file

      @stess i get error as "Warning: one or more headers were not specified. Defaults names starting with H have been used in place of any missing headers"

      there is no data copied here to. csv

      posted in IT Discussion
      LakshmanaL
      Lakshmana
    • RE: Powershell Filter Data and Copy Data to new .csv file

      @stess said in Powershell Filter Data and Copy Data to new .csv file:

      @stess

      Hmmm.. I don't know how to post code here. 😛

      $csvFile = ".\etc.csv" #dummy file. Change it to whereevery your file is at.
      $csvImport = Import-Csv $csvFile
      
      # Create Array for Exporting out data
      $csvArray = "" #this clear for testing purpose. But it works in production environment as well.. so I didn't bother to remove it.
      $csvArray = [System.Collections.ArrayList]@()
      
      # Entry count
      $lineCounter = 1
      
      # Foreach Loop
      Foreach ($csvImportedItem in $csvImport){
      $lineCounter++ #this let me know which line in the entry is the problem.
      $importedName = $csvImportedItem.Name
      $importedID = $csvImportedItem.ID
      $importedDept = $csvImportedItem.Department
      $importedNote = $csvImportedItem.Note
      if($importedNote -eq "C"){
      $csvArray += $csvImportedItem
      "[$lineCounter] $importedName $importedID $importedDept $importedNote`n" #For outputing result. Testing purpose
      $csvImportedItem #For outputing result. Testing purpose
      
      
      }
      }
      $csvArray #For outputing result before exporting to new CSV
      #$csvArray | Export-Csv $NEWPATH -NoTypeInformation #destinate new path.
      
      Name ID Department Note
      Caroline Bates 10035 Sales A
      Danny Harrison 11523 Customer Service B
      Armando Kelley 16423 Sales C
      Dorothy Colon 10245 HR B
      Joanna Sutton 19853 Accounting C

      Neat!

      if there "ticket id" and "Assigned date" is there in heading means??

      posted in IT Discussion
      LakshmanaL
      Lakshmana
    • RE: Mail Allignment Issue

      here the file is xlsx where i need to copy sheet1 only from excel to body of the mail!!

      posted in IT Discussion
      LakshmanaL
      Lakshmana
    • RE: Mail Allignment Issue

      @stess can you help me on this tooo??

      posted in IT Discussion
      LakshmanaL
      Lakshmana
    • RE: Powershell Filter Data and Copy Data to new .csv file

      @stess said in Powershell Filter Data and Copy Data to new .csv file:

      @lakshmana

      You mean send mail using whatever the data in the CSV is?

      $SmtpServer = "smtp.com"
      $SmtpServerPort = "25 or 587"
      $SmtpFrom = "[email protected]"
      $SmtpTo = "[email protected]"
      $SmtpBody = "$csvArray"
      $SmtpSubject = "Subject"
      
      Send-MailMessage -SmtpServer $SmtpServer -Port $SmtpServerPort -From $SmtpFrom -To $SmtpTo -subject $SmtpSubject -body $SmtpBody
      

      Thank you so much

      posted in IT Discussion
      LakshmanaL
      Lakshmana
    • RE: Powershell Filter Data and Copy Data to new .csv file

      @tim_g said in Powershell Filter Data and Copy Data to new .csv file:

      @stess

      This site uses Markdown: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet

      To post code, you use three ``` before and after your code. Single line or above and below your block of code.

      This git hub is for?

      posted in IT Discussion
      LakshmanaL
      Lakshmana
    • RE: Powershell Filter Data and Copy Data to new .csv file

      If there is any possibility to copy the new content of the data from. csv to smtp mail by powershell???

      posted in IT Discussion
      LakshmanaL
      Lakshmana
    • Powershell Filter Data and Copy Data to new .csv file

      How to filter data and copy the selective data to the new .csv according to our need ?

      Any powershell commands is there ?

      I have .csv file with the content of Sl.No ,User details ,login id and i need to filter the login id and then copy to new .csv file

      Is that possible to do by powershell?

      posted in IT Discussion
      LakshmanaL
      Lakshmana
    • RE: Mail Allignment Issue

      @dafyre said in Mail Allignment Issue:

      $filename = 'file.xlsx'
      $From ="[email protected]"
      $to = "[email protected]"
      $SMTP= "mail.domain.com"
      $filepath = "C:\Location$filename"

      $excel = New-Object -comobject Excel.Application
      $ReportWorkBook = $excel.Workbooks.Open($filePath)
      $excel.Visible = $false
      $ws = $ReportWorkBook.Worksheets.Item(1)
      $SelectedRange = $ws.UsedRange
      $SelectedRange.Copy()
      #$newmail.GetInspector.WordEditor.Range().Paste()

      $body = @"

      My email content goes here

      "@

      #initate message
      $email = New-Object System.Net.Mail.MailMessage
      $email.From = $emailFrom
      $email.To.Add($emailTo)
      $email.Subject = $subject
      $email.Body = $body

      #initiate email attachment
      $emailAttach = $SelectedRange.Paste()
      $email.Attachments.Add($emailAttach)

      #initiate sending email
      $smtp = new-object Net.Mail.SmtpClient($smtp)
      $smtp.Send($email)

      Exception calling "Add" with "1" argument(s): "Value cannot be null.
      Parameter name: item"
      At C:\Reports\excel.ps1:26 char:1
      + $email.To.Add($emailTo)
      + ~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
          + FullyQualifiedErrorId : ArgumentNullException
       
      Method invocation failed because [System.__ComObject] does not contain a method named 'Paste'.
      At C:\Reports\excel.ps1:31 char:1
      + $emailAttach = $SelectedRange.Paste()
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidOperation: (Paste:String) [], RuntimeException
          + FullyQualifiedErrorId : MethodNotFound
       
      Exception calling "Add" with "1" argument(s): "Value cannot be null.
      Parameter name: item"
      At C:\Reports\excel.ps1:32 char:1
      + $email.Attachments.Add($emailAttach)
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
          + FullyQualifiedErrorId : ArgumentNullException
       
      Exception calling "Send" with "1" argument(s): "A recipient must be specified."
      At C:\Reports\excel.ps1:37 char:1
      + $smtp.Send($email)
      + ~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
          + FullyQualifiedErrorId : InvalidOperationException
      
      posted in IT Discussion
      LakshmanaL
      Lakshmana
    • RE: Mail Allignment Issue

      Help Needed to paste the excel sheet inside email body

      $filename = 'file.xlsx'
      $From ="[email protected]"
      $to = "[email protected]"
      $SMTP= "[email protected]"
      $filepath = "C:\Location"
      
      
      $excel = New-Object -comobject Excel.Application
      $ReportWorkBook = $excel.Workbooks.Open($filePath)
      $excel.Visible = $false
      $ws = $ReportWorkBook.Worksheets.Item(1)
      $SelectedRange = $ws.UsedRange
      $SelectedRange.Copy() 
      $newmail.GetInspector.WordEditor.Range().Paste()
      
      Function sendEmail([string]$emailFrom, [string]$emailTo, [string]$subject,[string]$body,[string]$smtpServer,[string]$filepath)
      {
      #initate message
      $email = New-Object System.Net.Mail.MailMessage 
      $email.From = $emailFrom
      $email.To.Add($emailTo)
      $email.Subject = $subject
      $email.Body = $body
      #initiate email attachment
      
      
      $emailAttach = New-Object System.Net.Mail.Attachment $newmail.GetInspector.WordEditor.Range().Paste()
      $email.Attachments.Add($emailAttach)
      
      
      #initiate sending email 
      $smtp = new-object Net.Mail.SmtpClient($smtpServer)
      $smtp.Send($email)
      }
      Send-MailMessage -From $From -To $to -Subject "Test Report -$(Get-Date)" -BodyAsHtml "Report" -SmtpServer $SMTP
      
      posted in IT Discussion
      LakshmanaL
      Lakshmana
    • Mail Allignment Issue

      Hi Team,

      Actually I am having the Shift Handover file in which Sheet 1 needs to be send mail automatically through Powershell.I am using this link to export the sheet 1 to the mail body where the allignment is not coming good..Kindly help with this script

      https://social.technet.microsoft.com/Forums/scriptcenter/en-US/21643bfc-40c0-4b2e-8a75-365361f0654e/...

      #Create and get my Excel Obj
      $x1 = New-Object -comobject Excel.Application
      $UserWorkBook = $x1.Workbooks.Open("C:\MyExcelFile.xls")

      #Select first Sheet
      $UserWorksheet = $UserWorkBook.Worksheets.Item(1)
      $UserWorksheet.activate()

      #Copy the part of the sheet I want in the Email
      $rgeSource=$UserWorksheet.range("A1","E20").Copy()

      #create outlook Object
      $Outlook = New-Object -comObject Outlook.Application
      $Mail = $Outlook.CreateItem(0)
      $Mail.Recipients.Add("[email protected]")

      #Add the text part I want to display first
      $Mail.Body = "My Comment on the Excel Spreadsheet"

      #Then Copy the Excel using parameters to format it
      $Mail.Getinspector.WordEditor.Range().PasteExcelTable($true,$false,$false)
      #Then it becomes possible to insert text before
      $wdDoc = $Mail.Getinspector.WordEditor
      $wdRange = $wdDoc.Range()
      $wdRange.InsertBefore("Hello world!")
      $Mail.Display()

      posted in IT Discussion
      LakshmanaL
      Lakshmana
    • RE: Happy Birthday Thread

      @scottalanmiller Happy Birthday to you @scottalanmiller

      posted in Water Closet
      LakshmanaL
      Lakshmana
    • RE: Task Scheduler not running when system is locked

      @black3dynamite said in Task Scheduler not running when system is locked:

      NT AUTHORITY\SYSTEM

      NT AUTHORITY \SYSTEM is not working and Trigger is set for Daily at 05:50 PM
      When clicking on Run with highest privieges i am getting the same error which was mentioned already

      posted in IT Discussion
      LakshmanaL
      Lakshmana
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 88
    • 89
    • 5 / 89