您是否想知道当您不在的时候是否有人登录过您的 PC?在前一个技能中我们解释了如何从 Windows 安全日志中解析详细的审计信息,假设您拥有管理员权限。
To find out who logged into your PC, try the code below! The function Get-LogonInfo searches for security events with ID 4624. Security information is protected, so you need to be an Administrator to run this code. This is why the code uses a #requires statement that prevents non-Admins from running the code. 要查看谁登录到了您的 PC,请试试以下代码!Get-LogonInfo 函数搜索 ID 为 4624 的安全事件。安全信息是受保护的,所以只有管理员账户才能执行这段代码。这是为什么这段代码使用 #requires 来防止非管理员执行这段代码的原因。
functionExplore-WMI { # find all WMI classes that start with "Win32_"... $class = Get-WmiObject-Class Win32_* -List | # exclude performance counter classes... Where-Object { $_.Name -notlike'Win32_Perf*' } | # exclude classes with less than 6 properties... Where-Object { $_.Properties.Count -gt5 } | # let the user select one of the found classes Out-GridView-Title'Select one'-OutputMode Single
# display selected class name Write-Warning"Klassenname: $($class.Name)"
# query class... Get-WmiObject-Class$class.Name | # and show all of its properties Select-Object-Property *
如果您使用 PowerShellGet 模块(默认随着 Windows 10 和 Server 2016 分发),您可以方便地下载和安装共享的 PowerShell 脚本和模块:
1 2 3 4 5 6 7 8
PS> Find-Module-Tag Security
Version Name Repository Description -------------------------------- 2.5.0 Carbon PSGallery Carbon is a PowerShell module for automating t... 0.8.1 ACMESharp PSGallery Client library for the ACME protocol, which is... 2.22 DSInternals PSGallery The DSInternals PowerShell Module exposes seve... 1.2.0.0 DSCEA PSGallery DSCEA is a scanning engine for processing Test...
DisplayVersion DisplayName -------------- ----------- Definition Update for Microsoft Office 2013 (KB3115404) 32-Bit... 15.0.4569.1506 Microsoft Access MUI (English) 2013 15.0.4569.1506 Microsoft Access Setup Metadata MUI (English) 2013 15.0.4569.1506 Microsoft DCF MUI (English) 2013 15.0.4569.1506 Microsoft Excel MUI (English) 2013 15.0.4569.1506 Microsoft Groove MUI (English) 2013 (...)