Windows 10: How can i make to run a powershell comand as administrator on startup?

Discus and support How can i make to run a powershell comand as administrator on startup? in Windows 10 Ask Insider to solve the problem; . submitted by /u/gerardit04 [link] [comments] https://www.reddit.com/r/Windows10/comments/hsi58r/how_can_i_make_to_run_a_powershell_comand_as/ Discussion in 'Windows 10 Ask Insider' started by /u/gerardit04, Jul 16, 2020.

  1. How can i make to run a powershell comand as administrator on startup?

    /u/gerardit04, Jul 16, 2020
    #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:
    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. How can i make to run a powershell comand as administrator on startup? :)

    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, Jul 16, 2020
    #2
  3. Ed Wood Win User
    How can I edit the Administrator File

    I tried as you suggested. I can change my password, but I cannot change the email address listed for the administrator of the account. I have found a procedure for making the change that involves logging into Windows 10, creating a new temporary administrator account, log out of current administrator account, log in the temporary administrator account, delete the old administrator account, restart the computer, and login with the temporary administrator account as the new administrator account.

    It sounds a little complicated and I have not tried it yet. I don't know what effect it would have on my installed programs.

    Regards,
     
    Ed Wood, Jul 16, 2020
    #3
  4. Graeme.P Win User

    How can i make to run a powershell comand as administrator on startup?

    Powershell issues

    Hi Bloxxer, I'm Graeme, an independent adviser here to help.

    Can you see those files and folders in File Explorer normally?

    The first suggestion I'd make is to make sure you're logged in as an administrator. You can also make sure you're running PowerShell as an administrator by right-clicking PowerShell and clicking Run as Administrator.

    Secondly, check in File Explorer to see that the files aren't marked as hidden. You can right-click the folders and click on Properties to see if they're hidden or not.

    Once you've tried these steps, let me know if you need further directions! Thanks!
     
    Graeme.P, Jul 16, 2020
    #4
Thema:

How can i make to run a powershell comand as administrator on startup?

Loading...
  1. How can i make to run a powershell comand as administrator on startup? - Similar Threads - run powershell comand

  2. windows PowerShell is running during startup?!

    in Windows 10 Gaming
    windows PowerShell is running during startup?!: Hi. i have problem when my surface want to start. it is running very slowly and windows PowerShell is running too and goes in to windows PowerShell command and typing many words?!...
  3. Inside Windows Sandbox, how can I run PowerShell or Cmd as a non-administrator?

    in Windows 10 Ask Insider
    Inside Windows Sandbox, how can I run PowerShell or Cmd as a non-administrator?: submitted by /u/krk_computers [link] [comments] https://www.reddit.com/r/Windows10/comments/v0t3pn/inside_windows_sandbox_how_can_i_run_powershell/
  4. How to make a PowerShell script run on System Startup in the OOBE Sysprep environment.

    in Windows 10 Gaming
    How to make a PowerShell script run on System Startup in the OOBE Sysprep environment.: Thanks for stopping by, I've searched the corners of the internet but haven't gotten anywhere. To provision devices for my organization, we must manually run PowerShell commands using SHIFT + F10 in the Windows 11 OOBE as we have multiple methods, one of which being legacy....
  5. How to make a PowerShell script run on System Startup in the OOBE Sysprep environment.

    in Windows 10 Software and Apps
    How to make a PowerShell script run on System Startup in the OOBE Sysprep environment.: Thanks for stopping by, I've searched the corners of the internet but haven't gotten anywhere. To provision devices for my organization, we must manually run PowerShell commands using SHIFT + F10 in the Windows 11 OOBE as we have multiple methods, one of which being legacy....
  6. How to always run Command Prompt and PowerShell as Administrator

    in Windows 10 News
    How to always run Command Prompt and PowerShell as Administrator: [ATTACH]How often do you need to run the Command Prompt or PowerShell as administrator on your Windows 10? For me what happens is, I often forget to right-click and select Run as administrator and I know it only when I get the error in running any command as shown in the...
  7. How to fix the comand of powershell?

    in Windows 10 BSOD Crashes and Debugging
    How to fix the comand of powershell?: 我不小心在PowerShell中删除了命令“ ls”。我该如何修复或恢复它? https://answers.microsoft.com/en-us/windows/forum/all/how-to-fix-the-comand-of-powershell/5a300b37-1310-4d57-8c7b-aa96387e75d5
  8. run comand

    in Windows 10 Customization
    run comand: I clic on start / run and type in regedit. it use to stay there, how do I get that com to stay in there. when I close it wipes out that cmd. https://answers.microsoft.com/en-us/windows/forum/all/run-comand/42849a18-85c8-489b-835b-3bc08fa77a2c
  9. Run PowerShell Script As An Administrator

    in Windows 10 Support
    Run PowerShell Script As An Administrator: Hi. So I've been searching online on a way to do this yet I cannot find a way to do it. _______________________________________ I need this in specific: I want to double click a PowerShell script file (which will run as an administrator) from Windows Explorer that has...
  10. How to run a .bat file as administrator in startup?

    in Windows 10 Support
    How to run a .bat file as administrator in startup?: Hello. As BitDefender as an ongoing error, I want to run a small "bdfix.bat" at login time. But this .bat file MUST be run as an administrator to work. How do I do that? *Redface 120997