PowerShell 7.3 - implementing Retrieving Windows Event Logs from Remote Machine Due to Permissions
I'm testing a new approach and I'm trying to use PowerShell 7.3 to retrieve Windows Event Logs from a remote machine using the `Get-WinEvent` cmdlet, but I keep running into permission issues... I have verified that I am running the PowerShell script with administrator privileges, yet when I execute the command, I receive the following behavior: ``` Get-WinEvent : Access is denied ``` I have ensured that the remote machine has WinRM enabled and I have configured the necessary firewall rules to allow for WinRM traffic. My command looks like this: ```powershell $session = New-PSSession -ComputerName "RemotePC" -Credential (Get-Credential) Invoke-Command -Session $session -ScriptBlock { Get-WinEvent -LogName "Application" -MaxEvents 10 } ``` I've also tried using the `-Credential` parameter with the `Get-WinEvent` cmdlet directly, but I still encounter the same access denied behavior. The account I'm using has local administrator rights on the remote machine. Additionally, I've checked the Event Log Security settings on the remote machine to ensure that the account has access. I’ve even experimented with using `Get-EventLog` instead, but it seems to be deprecated for the scenarios I'm working with. Is there any specific configuration or setting I might be missing? Am I overlooking something related to remote permissions or security settings in PowerShell 7.3? Any insights would be greatly appreciated! I'm using Powershell 3.10 in this project. Am I missing something obvious?