Add scripts
This commit is contained in:
		
							parent
							
								
									422934aef7
								
							
						
					
					
						commit
						350807c951
					
				
					 30 changed files with 574 additions and 0 deletions
				
			
		
							
								
								
									
										13
									
								
								Scripts/Log-Logon.ps1
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								Scripts/Log-Logon.ps1
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,13 @@ | |||
| $srv = "localhost" | ||||
| $FilterXPath = '<QueryList><Query Id="0"><Select>*[System[EventID=21]]</Select></Query></QueryList>' | ||||
| $RDPAuths = Get-WinEvent -ComputerName $srv -LogName "Microsoft-Windows-TerminalServices-LocalSessionManager/Operational" -FilterXPath $FilterXPath | ||||
| [xml[]]$xml = $RDPAuths | Foreach {$_.ToXml()} | ||||
| $EventData = Foreach ($event in $xml.Event) { | ||||
| New-Object PSObject -Property @{ | ||||
| "Connection Time" = (Get-Date ($event.System.TimeCreated.SystemTime) -Format 'yyyy-MM-dd hh:mm K') | ||||
| "User Name" = $event.UserData.EventXML.User | ||||
| "User ID" = $event.UserData.EventXML.SessionID | ||||
| "User Address" = $event.UserData.EventXML.Address | ||||
| "Event ID" = $event.System.EventID | ||||
| }} | ||||
| $EventData | ft | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue