Apr 27 2020 07:47 AM
Hi,
I want to execute a command on all computers in my domain but in order for it to work, it needs to run with elevated permissions.
Is there a possibility to do this?
my command:
get-winevent -filterXML([xml](Get-Content "C:\Execute\Inventorview.xml")) | sort timecreated -descending | export-csv c:\execute\result.csv
the response i get:
get-winevent : Could not retrieve information about the Security log. Error: Poging tot het uitvoeren van een niet-gema
chtigde bewerking..
At line:1 char:1
+ get-winevent -filterXML([xml](Get-Content "C:\Execute\Inventorview.xm ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-WinEvent], Exception
+ FullyQualifiedErrorId : LogInfoUnavailable,Microsoft.PowerShell.Commands.GetWinEventCommand
(Poging tot het uitvoeren van een niet-gemachtigde bewerking... = dutch for 'trying to execute a non-authorized...')
Thanks in advance!
May 05 2020 10:27 PM - edited May 05 2020 10:30 PM
Have you verified this command on a computer where you have administrator level access?
If it provides the information you require, it's a matter of having admin access to all computers and launching PS under that user's context.
get-winevent has a -credential parameter you can use.
May 08 2020 06:32 AM
@Animesh Joshi I have verified this command with an admin account.
Can you run a scheduled task to all computers to run this script as an admin?
I'ts the first time that i'm trying anything like this so it's all kind of new for me.
May 10 2020 03:50 PM