Windows 10: Converting Excel Data to Powershell Script

Discus and support Converting Excel Data to Powershell Script in Windows 10 Network and Sharing to solve the problem; How would I go about converting Excel Data to Powershell Script?... Discussion in 'Windows 10 Network and Sharing' started by DetectiveKn1ght, Aug 16, 2019.

  1. Converting Excel Data to Powershell Script


    How would I go about converting Excel Data to Powershell Script?

    :)
     
    DetectiveKn1ght, Aug 16, 2019
    #1
  2. ddelo Win User

    Export All Administrative Events to Excel


    To analyze events, from the Windows Event Viewer, there is a simple way to export all Administrative Events to Excel, with PowerShell.

    Exporting all Administrative Events to Excel is a simple two Step process, as described here:

    Step 1 - Create the Administrative Events View .xml file
    1. Open Eventviewer (%windir%\system32\eventvwr.msc)
    2. Navigate to: Event Viewer (Local) > Custom Views > Administrative Events
    3. In the “Actions” pane select “Filter Current Custom View”.
    4. Select the the XML tab.
    5. Press Ctrl+A to select all the XML code of the Custom View.
    6. Open a notepad, paste the selected code and save the file to your Desktop as AdmEvtView.xml


    Step 2 - Create the csv file with the events
    1. Download the ExportEvtCSV.zip file, which contains the script ExportEvtCSV.ps1 and unzip it, on your Desktop.
      It's not a fancy script, just basic PowerShell commands to create a csv file on the Desktop.
    2. In Windows Search, type “ISE” (without the quotes) to open “Windows PowerShell ISE” and Run as administrator
    3. To allow running the script, change the ExecutionPolicy, for this session. To do that, in the Console pane type:
      Code:
      Code:
      Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -force
    4. In the Windows PowerShell ISE, open and run the script: ExportEvtCSV.ps1
      The script will create a csv file with a name YYYYMMDD.HHMM.csv on the Desktop
    5. When done, open the newly created .csv file, format the columns as needed and optionally save it as .xlsx, if you wish.
    That’s it! You now have all the Administrative Events in Excel for filtering and further analysis. Converting Excel Data to Powershell Script :)

    Now to the more technical hard stuff... *Confused

    There is a reason for running the script from within PowerShell ISE!

    It would be great if everything was also working perfectly, when running the script from an elevated PowerShell too.

    We can run it from an elevated PowerShell, which means that you just follow the Step 1, as above but for the Step 2 instead of the ISE you run the script from an elevated PowerShell.

    The problem is that it will work only for anybody who has en-US format for the dates. Everyone else, who has another format (i.e. en-GB, fr-FR, el-GR etc.), the dates are not translated properly by Excel (although the script uses the –UseCulture switch) and remain as text in the en-US format.

    I'm not sure if this a bug of the "export-csv" cmdlet, but although it runs the way it supposed to from within the ISE, from PowerShell there is a problem with the dates format.
    As I haven’t found a way to overcome this obstacle, any suggestion from the PowerShell gurus of the forum (like my good friend Shawn @Brink, for instance), is welcome.
     
    ddelo, Aug 16, 2019
    #2
  3. Refreshing Excel SpreadSheet by runnig script using Task Scheduler

    Hi,



    Thank you for writing to Microsoft Community Forums.



    I understand that you are unable to run the script to refresh the Excel spreadsheet.



    However, as the issue is related to refreshing the data in Excel spreadsheet using a script, I suggest you to post your query on

    MSDN
    forums, where they provide dedicated support on issues with running scripts for Excel.



    In addition, to run the script using Task Scheduler you can refer the article

    Configure to run a PowerShell Script into Task Scheduler
    .



    Hope it helps.



    Regards,

    Prakhar Khare

    Microsoft Community – Moderator
     
    Prakhar_Khare, Aug 16, 2019
    #3
  4. Converting Excel Data to Powershell Script

    PowerShell scripts not working with Call operator

    Hi,



    Thank you for writing to Microsoft Community Forums.



    I understand that you are facing issues while developing a PowerShell script using the Call operator. I would suggest you to refer the articles

    The Windows PowerShell ISE
    .



    However, as the issue is related to developing PowerShell scripts, I would suggest you to post your query on

    MSDN forums
    , where we have expertise and developers who are well equipped with the knowledge of developing PowerShell scripts in Windows.



    Regards,

    Prakhar Khare

    Microsoft Community – Moderator
     
    Prakhar_Khare, Aug 16, 2019
    #4
Thema:

Converting Excel Data to Powershell Script

Loading...
  1. Converting Excel Data to Powershell Script - Similar Threads - Converting Excel Data

  2. Issue in Powershell script

    in Windows 10 Software and Apps
    Issue in Powershell script: HI Team,We have a power shell script. It will check if the user is available in the ACL list of ADL. To get the ACL list, we are connecting to the Azure Datalake storage using Connect-AzAccount and authenticating with SPN. To get the group member details, we authenticate the...
  3. PowerShell script

    in Windows 10 Support
    PowerShell script: The code below tests a series of IPs in a txt file.The result is as follows and is written in a txt file. 19.191.12.161 - online 19.191.12.162 - offline 19.191.12.163 - offline 19.191.12.164 - offline 19.191.12.165 - offline also see the scrennshot Code: $Output= @()$GetIP =...
  4. powershell scripts

    in AntiVirus, Firewalls and System Security
    powershell scripts: Hi, I have azure. Someone is somehow installing powershell scripts onto my computer that allows them to host my PC through P2P and UDP connections, well I think so anyway. I have only just found powershell script entry changes in my registry by accident. These criminals...
  5. powershell script

    in Windows 10 Customization
    powershell script: looking for a script to monitor for a folder, if there is a file in that folder send it as an email, once the email is sent out, confirm and then move the files to an archive folder. monitor c:\test\*.pdf No files, do not send email. Yes Files, send an email to someone at...
  6. converting Excel to PDF

    in Windows 10 Network and Sharing
    converting Excel to PDF: I am trying to convert an excel sheet to pdf in windows 10. I follow the instructions using Export. But instead of saving the current sheet, it saves a sheet from 2 years ago which is not opened...
  7. Powershell Script on Shutdown

    in Windows 10 Performance & Maintenance
    Powershell Script on Shutdown: Hi all, I try to run a Powershell Script (*.ps1) when i shut down my PC. I created the script and it is working fine when i run it. However if i want to run it on a regular Shutdown it seems like it does not start or is not finished, before Windows is killing every running...
  8. Converting data

    in Windows 10 Software and Apps
    Converting data: From an e-mail, is there any way to convert data on a notepad to an Excel spreadsheet? https://answers.microsoft.com/en-us/windows/forum/apps_windows_10-outlook_mail/converting-data/194812ce-c9ba-4d69-98b4-250b718306b0
  9. A Powershell Script for HandBrake

    in Windows 10 Software and Apps
    A Powershell Script for HandBrake: Here's the thing. My system is an age-old i3-530 overclocked to 3.5GHz coupled with GTX 1050 2GB. I have around 1.5TB of tutorial videos that I have to encode due to dearth in HDD space. I want to encode the videos while keeping the folder and subfolder structure intact....
  10. PowerShell Scripting - The Basics

    in Windows 10 Tutorials
    PowerShell Scripting - The Basics: How to: PowerShell Scripting - The Basics [img] Information A PowerShell script is a collection of commands and cmdlets to be run in logical order, previous lines in script determining values and variables in command lines thereafter. The principle is the same than in...