#Version 3.2 (non-remote edition) ਀␀瘀攀爀猀椀漀渀 㴀 ∀㌀⸀㐀∀ ⌀㰀㰀㰀㰀㰀㰀䌀䠀䄀一䜀䔀 吀䠀䤀匀 䄀一夀吀䤀䴀䔀 䴀伀䐀䤀䘀䤀䔀䐀℀ഀഊ<# ਀吀栀攀 昀漀氀氀漀眀椀渀最 椀渀昀漀爀洀愀琀椀漀渀 椀猀 爀攀瀀漀爀琀攀搀 甀瀀漀渀㨀ഀഊ(In HTML Report) ਀ⴀ匀礀猀琀攀洀 䤀渀昀漀爀洀愀琀椀漀渀 ഀഊ -System Uptime ਀    ⴀ匀礀猀琀攀洀 䴀愀渀甀昀愀挀琀甀爀攀爀ഀഊ -System Model ਀    ⴀ伀匀ഀഊ -CPU Name and Bit-ness ਀    ⴀ䌀倀唀 䌀漀爀攀猀 ⠀倀栀礀猀椀挀愀氀 ☀ 䰀漀最椀挀愀氀⤀ഀഊ -CPU Usage % ਀    ⴀ吀漀琀愀氀 刀䄀䴀ഀഊ -Free RAM ਀    ⴀ倀攀爀挀攀渀琀 昀爀攀攀 刀䄀䴀ഀഊ -Power Plan (and advises High performance if it's not set) ਀  ⴀ䐀椀猀欀 䤀渀昀漀 ☀ 倀攀爀昀漀爀洀愀渀挀攀ഀഊ -Physical Disk ਀      ⴀ䴀漀搀攀氀ഀഊ -DeviceID ਀      ⴀ匀椀稀攀 ⠀䜀䈀⤀ഀഊ -Disk# Name ਀      ⴀ䄀瘀最䐀椀猀欀儀甀攀甀攀䰀攀渀最琀栀ഀഊ -% Idle Time ਀      ⴀ─ 圀爀椀琀攀 吀椀洀攀ഀഊ -% Read Time ਀      ⴀ圀爀椀琀攀 䤀伀倀匀ഀഊ -Read IOPS ਀  ⴀ䴀攀洀漀爀礀 䤀渀昀漀爀洀愀琀椀漀渀ഀഊ -Memory Modules ਀    ⴀ䴀漀搀甀氀攀 匀氀漀琀 一愀洀攀ഀഊ -Module Mfr ਀    ⴀ䴀漀搀甀氀攀 倀愀爀琀 ⌀ഀഊ -Module Serial # ਀    ⴀ䐀愀琀愀 圀椀搀琀栀ഀഊ -Form Factor ਀    ⴀ吀礀瀀攀 ⠀匀漀洀攀琀椀洀攀猀 眀漀爀欀猀⸀⸀⸀ 搀攀瀀攀渀搀攀渀琀 漀渀 洀愀挀栀椀渀攀 䈀䤀伀匀 椀渀昀漀 洀愀搀攀 愀瘀椀氀愀戀氀攀 琀漀 圀䴀䤀ഀഊ -Module Capacity ਀    ⴀ䴀漀搀甀氀攀 匀瀀攀攀搀ഀഊ ਀  ⴀ 匀礀猀琀攀洀 倀爀漀挀攀猀猀攀猀 愀渀搀 匀攀爀瘀椀挀攀猀ഀഊ -System Processes - Top 10 Highest Memory Usage ਀    ⴀ匀礀猀琀攀洀 匀攀爀瘀椀挀攀猀 ⴀ 匀琀漀瀀瀀攀搀ഀഊ -Startup Entries ਀    ⴀ䔀渀瘀椀爀漀渀洀攀渀琀 嘀愀爀椀愀戀氀攀猀ഀഊ -Non-Windows Services ਀    ⴀ一漀渀ⴀ匀琀愀渀搀愀爀搀 匀攀爀瘀椀挀攀 䄀挀挀漀甀渀琀猀ഀഊ -3rd party Scheduled Tasks ਀ⴀ一攀琀眀漀爀欀椀渀最 䤀渀昀漀爀洀愀琀椀漀渀ഀഊ -Active NICs ਀      ⴀ䠀漀猀琀渀愀洀攀ഀഊ -NIC Name ਀      ⴀ一攀琀眀漀爀欀㨀ഀഊ -Link Speed ਀      ⴀ唀瀀 吀椀洀攀ഀഊ -MAC Address ਀      ⴀ䤀倀 䄀搀搀爀攀猀猀ഀഊ -DHCP Server ਀      ⴀ匀甀戀渀攀琀 䴀愀猀欀ഀഊ -Default Gateway ਀      ⴀ䐀一匀 匀甀昀昀椀砀ഀഊ -DNS Servers ਀    ⴀ刀漀甀琀攀 吀愀戀氀攀猀    ഀഊ-Event Logs ਀    ⴀ䔀瘀攀渀琀 琀礀瀀攀 漀昀 攀椀琀栀攀爀 圀愀爀渀椀渀最Ⰰ 䔀爀爀漀爀Ⰰ 漀爀 䌀爀椀琀椀挀愀氀 眀椀琀栀椀渀 ㈀㐀 栀爀猀⸀ഀഊ-Software Information ਀    ⴀ䤀渀猀琀愀氀氀攀搀 倀爀漀最爀愀洀猀ഀഊ -Installed .NET Version ਀    ⴀ䤀渀猀琀愀氀氀攀搀 唀瀀搀愀琀攀猀ഀഊ -Loaded Windows Kernel Drivers - 3rd Party ਀⠀伀琀栀攀爀 䘀椀氀攀猀⤀ഀഊ*Application and System Event logs, ALL warnings errors, in evtx format ਀⨀䜀爀漀甀瀀 倀漀氀椀挀礀 猀攀琀琀椀渀最猀Ⰰ 椀渀 䠀吀䴀䰀 昀漀爀洀愀琀ഀഊAuthor: Vince Vardaro ਀开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开开ഀഊChange Log ਀   ㌀⸀㐀⸀ ഀഊ -Added .NET version detection ਀ഀഊ 3.3.0 ਀   ⴀ䄀搀搀攀搀 䐀椀猀欀 匀琀愀琀甀猀 昀爀漀洀 圀椀渀㌀㈀开䐀椀猀欀搀爀椀瘀攀 焀甀攀爀礀ഀഊ ਀   ㌀⸀㈀⸀ ഀഊ -CSS change ਀   ⴀ䴀漀搀椀昀椀攀搀 䐀爀椀瘀攀爀 䘀甀渀挀琀椀漀渀 琀漀 猀栀漀眀 漀渀氀礀 ㌀爀搀 瀀愀爀琀礀 爀甀渀渀椀渀最 欀攀爀渀攀氀 搀爀椀瘀攀爀猀ഀഊ ਀   ㌀⸀㄀⸀ ഀഊ -Changed System Info to its own function, slimming down repetative WMI queries ਀   ⴀ䄀搀搀攀搀 䈀䤀伀匀 椀渀昀漀爀洀愀琀椀漀渀 椀昀 洀愀挀栀椀渀攀 椀猀 瀀栀礀猀椀挀愀氀Ⰰ 氀攀昀琀 漀甀琀 椀昀 瘀椀爀琀甀愀氀ഀഊ ਀   ㌀⸀ ⸀ ഀഊ -Environment Variables moved under Tasks ਀   ⴀ䌀匀匀 挀栀愀渀最攀猀⸀ 䌀氀攀愀渀攀爀 氀漀漀欀Ⰰ 愀渀搀 挀氀攀愀渀攀爀 挀漀氀氀愀瀀猀椀戀氀攀猀ഀഊ -Added Get-WindowsDriver Function, added running drivers section in report ਀   ⴀ刀攀洀漀瘀攀搀 䐀爀椀瘀攀爀ⴀ儀甀攀爀礀 昀甀渀挀琀椀漀渀Ⰰ 愀猀 眀攀氀氀 愀猀 攀砀瀀漀爀琀 搀爀椀瘀攀爀猀 琀漀 挀猀瘀 昀椀氀攀⸀ഀഊ -Embedded Images ਀   ⴀ刀攀洀漀瘀攀搀 䌀匀嘀 圀椀渀搀漀眀猀 甀瀀搀愀琀攀猀 昀椀氀攀⸀ 刀攀搀甀渀搀愀渀琀ഀഊ -Added Get-WindowsDriver Function, added running drivers section in report ਀   ⴀ䔀爀爀漀爀 栀愀渀搀氀椀渀最℀℀℀ 昀漀爀 爀愀渀搀漀洀 洀攀洀漀爀礀 氀攀愀欀 昀椀砀 愀渀搀 挀氀攀愀渀攀爀 漀甀琀瀀甀琀⸀ഀഊ -Verbose progress throughout script execution on screen. ਀   ⴀ刀攀洀漀瘀攀搀 䄀搀搀ⴀ䠀吀䴀䰀䄀琀琀爀椀戀甀琀攀Ⰰ 爀攀瀀氀愀挀攀搀 眀椀琀栀 昀漀爀攀愀挀栀 ⴀ爀攀瀀氀愀挀攀ഀഊ -Progress Indicators, for sanity purposes on calls ਀  ഀഊ 2.9.5 ਀   ⴀ䄀搀搀攀搀 挀漀氀氀愀瀀猀椀戀氀攀 洀愀樀漀爀 猀攀挀琀椀漀渀猀 漀昀 琀栀攀 爀攀瀀漀爀琀 琀栀爀漀甀最栀 䌀匀匀ഀഊ -Wording changes in report ਀   ⴀ䌀氀攀愀渀攀搀 甀瀀 栀琀洀氀ഀഊ ਀   ㈀⸀㤀⸀㐀ഀഊ -Fixed Date sorting in windows updates listing (which allowed removing duplicate queries) ਀   ⴀ刀攀洀漀瘀攀搀 搀漀甀戀氀攀 圀椀渀搀漀眀猀 唀瀀搀愀琀攀 眀洀椀 焀甀攀爀椀攀猀 昀漀爀 戀攀琀琀攀爀 瀀攀爀昀漀爀洀愀渀挀攀ഀഊ -Implemented "Top Processes" Bar chart function and implementation ਀   ㈀⸀㤀⸀㌀ഀഊ -Moved html sections around for more logical flow ਀   ⴀ䤀渀挀漀爀瀀漀爀愀琀攀搀 渀攀眀 倀爀漀挀攀猀猀 䈀愀爀 挀栀愀爀琀 昀甀渀挀琀椀漀渀 䌀爀攀愀琀攀ⴀ倀爀漀挀䈀愀爀䌀栀愀爀琀Ⰰ 攀洀戀攀搀搀攀搀 瀀爀漀挀攀猀猀 戀愀爀 挀栀愀爀琀ഀഊ -Removed old "remote" commented code ਀   ㈀⸀㤀⸀㈀ഀഊ -Added Environment Variable section ਀   ⴀ䌀栀愀渀最攀搀 琀攀砀琀 椀渀 猀礀猀琀攀洀 猀攀爀瘀椀挀攀猀 愀爀攀愀ഀഊ ਀   ㈀⸀㤀⸀㄀ഀഊ -Added Get-MemoryStats function ਀   ⴀ䄀搀搀攀搀 䴀攀洀漀爀礀 䴀漀搀甀氀攀 椀渀昀漀爀洀愀琀椀漀渀 猀攀挀琀椀漀渀 琀漀 爀攀瀀漀爀琀ഀഊ -Changed Memory table to show limited data when polling a VM, while pulling all data from a physical machine ਀  ഀഊ 2.9.0 ਀   ⴀ䘀漀爀挀攀搀 挀栀攀挀欀 漀昀 愀搀洀椀渀 爀椀最栀琀猀 戀攀昀漀爀攀 攀砀攀挀甀琀椀漀渀⸀ 匀琀漀瀀猀 椀昀 渀漀琀 昀漀甀渀搀ഀഊ -Removed null entries from $softwarereport section ਀  ഀഊ 2.8.9 ਀   ⴀ䄀搀搀攀搀 倀漀眀攀爀 倀氀愀渀 ⠀愀渀搀 愀搀瘀椀猀攀猀 䠀椀最栀 瀀攀爀昀漀爀洀愀渀挀攀 椀昀 椀琀✀猀 渀漀琀 猀攀琀Ⰰ 甀猀椀渀最 椀昀 攀氀猀攀 琀漀 猀攀琀 挀漀氀漀爀 琀漀 爀攀搀⼀戀漀氀搀⤀ഀഊ -Optimized some WMI queries, by using WQL to improve performance of script ਀   ⴀ䘀椀砀攀搀 椀渀挀漀爀爀攀挀琀 栀攀愀搀椀渀最 漀渀 瀀栀礀猀椀挀愀氀 搀椀猀欀 瀀攀爀昀 挀漀甀渀琀攀爀猀⸀ 爀攀愀搀 琀椀洀攀 愀渀搀 眀爀椀琀攀 琀椀洀攀 眀攀爀攀 爀攀瘀攀爀猀攀搀ഀഊ -Fixed Auto-not-started services section. Start Mode now shows values ਀   ⴀ䘀椀砀攀搀 倀爀漀挀攀猀猀 猀攀挀琀椀漀渀⸀⸀⸀ 栀愀搀 琀漀 猀漀爀琀 戀礀 眀漀爀欀椀渀最猀攀琀㘀㐀Ⰰ 一伀吀 圀匀 㨀⤀ഀഊ -Fixed query for logical disk section. Missing freespace object ਀  ഀഊ 2.8.8 ਀   ⴀ䘀椀砀攀搀 洀攀洀漀爀礀 瘀愀氀甀攀 攀爀爀漀爀猀 椀渀 ∀吀漀瀀 倀爀漀挀攀猀猀∀ 猀攀挀琀椀漀渀猀⸀ 䌀栀愀渀最攀搀 琀漀 眀漀爀欀椀渀最猀攀琀㘀㐀⸀ഀഊ Now, WS MB column reflects SQL server memory consumption accurately. It also references the corresponding sources in Windows. ਀  ഀഊ 2.8.7 ਀   ⴀ䄀搀搀攀搀 搀愀琀攀 愀渀搀 琀椀洀攀 椀渀琀漀 昀椀氀攀渀愀洀攀 漀昀 爀攀瀀漀爀琀Ⰰ 愀渀搀 椀洀愀最攀猀 猀漀 琀栀愀琀 爀攀瀀漀爀琀 挀愀渀 戀攀 猀挀栀攀搀甀氀攀搀 洀甀氀琀椀瀀氀攀 琀椀洀攀猀 愀渀搀 眀爀椀琀攀 爀攀瀀漀爀琀猀 椀渀琀漀 琀栀攀 猀愀洀攀 搀椀爀攀挀琀漀爀礀ഀഊ -*Fixed bug in chart image file names. apparently using a _ to seperate variables in the filename parameter doesn't work, leaving out the $computername part. Using a - fixes this ਀  ഀഊ 2.8.6 ਀   ⴀ䌀栀愀渀最攀搀 倀椀攀 䌀栀愀爀琀 䘀甀渀挀琀椀漀渀猀Ⰰ 䄀搀搀攀搀 挀漀氀漀爀 挀漀搀椀渀最 愀渀搀 氀攀最攀渀搀猀Ⰰ 挀栀愀渀最攀搀 琀漀 搀漀渀甀琀 猀琀礀氀攀 最爀愀瀀栀ഀഊ -Minor Tweak in table hover color ਀   ⴀ䔀砀挀攀瀀琀椀漀渀 栀愀渀搀氀椀渀最 椀渀 瀀爀漀挀攀猀猀 漀眀渀攀爀 昀攀愀琀甀爀攀ഀഊ 2.8.5 ਀   ⴀ䤀渀挀漀爀瀀漀爀愀琀攀搀 挀甀猀琀漀洀 䜀攀琀ⴀ一椀挀䤀渀昀漀 昀甀渀挀琀椀漀渀Ⰰ 甀渀椀昀礀椀渀最 一䤀䌀 椀渀昀漀爀洀愀琀椀漀渀 昀爀漀洀 ㈀ 猀攀瀀攀爀愀琀攀 圀䴀䤀 挀愀氀氀猀 椀渀琀漀 漀渀攀 琀愀戀氀攀ഀഊ -Change Network Adapter HTML layout to better fit new function results ਀     ഀഊ 2.8.1 ਀   ⴀ䄀搀搀攀搀 䔀爀爀漀爀 䠀愀渀搀氀椀渀最 椀渀琀漀 瀀椀攀 挀栀愀爀琀 昀甀渀挀琀椀漀渀猀ഀഊ ਀   ㈀⸀㠀ഀഊ -CSS design change ਀   ⴀ䰀愀礀漀甀琀 琀眀攀愀欀椀渀最 漀昀 䠀吀䴀䰀 琀愀戀氀攀猀ഀഊ -Added additional NIC information ਀   ⴀ䌀氀攀愀渀 甀瀀 䠀吀䴀䰀 戀甀最猀 愀渀搀 猀瀀攀氀氀椀渀最 攀爀爀漀爀猀ഀഊ -Added process owner to processes table ਀   ⴀ䌀栀愀渀最攀搀 唀瀀搀愀琀攀 焀甀攀爀礀 昀甀渀挀琀椀漀渀 琀漀 甀猀攀 最眀洀椀 椀渀猀琀攀愀搀 漀昀 眀洀椀挀ഀഊ -Made Update links CLICKABLE :) ਀   ⴀ刀攀洀漀瘀攀 䘀椀爀攀眀愀氀氀 猀攀琀琀椀渀最猀 搀甀攀 琀漀 椀渀愀挀挀甀爀愀挀礀Ⰰ 愀渀搀 漀瘀攀爀 挀漀洀瀀氀椀挀愀琀攀搀 昀甀渀挀琀椀漀渀 甀猀攀搀⸀ 䤀渀瘀攀猀琀椀最愀琀椀渀最 漀琀栀攀爀 漀瀀琀椀漀渀猀ഀഊ ਀   ㈀⸀㜀ഀഊ -HTML design changes ਀   ⴀ䌀栀愀渀最攀搀 䄀挀琀椀瘀攀 一䤀䌀 吀愀戀氀攀 栀攀愀搀攀爀猀 琀漀 愀 洀漀爀攀 攀渀最氀椀猀栀 昀爀椀攀渀搀氀礀 昀漀爀洀愀琀ഀഊ ਀   ㈀⸀㘀ഀഊ -Fixed CPU Info bug that showed null on some servers ਀   ⴀ䄀搀搀攀搀 ⸀挀洀搀 䔀砀攀挀甀琀愀戀氀攀 琀漀 戀礀瀀愀猀猀 琀栀攀 瀀漀眀攀爀猀栀攀氀氀 攀砀攀挀甀琀椀漀渀 瀀漀氀椀挀礀 猀琀攀瀀猀 漀渀 漀琀栀攀爀 洀愀挀栀椀渀攀猀ഀഊ ਀   ㈀⸀㔀ഀഊ -Documented data gathered in script ਀   ⴀ䄀搀搀攀搀 倀栀礀猀椀挀愀氀 搀椀猀欀 䤀渀昀漀爀洀愀琀椀漀渀ഀഊ -Removed Drive Type from "Logical disks" table ਀   ⴀ䄀搀搀攀搀 倀栀礀猀椀挀愀氀 䐀椀猀欀 倀攀爀昀漀爀洀愀渀挀攀 圀䴀䤀 搀愀琀愀ഀഊ -Marked firewall settings in Security Settings category ਀   ⴀ䄀搀搀攀搀 氀椀猀琀 椀渀猀琀愀氀氀攀搀 猀漀昀琀眀愀爀攀ഀഊ -Added more detail in driver report, made function based execute ਀   ⴀ䘀椀砀攀搀 䐀愀琀攀 漀甀琀瀀甀琀 椀渀 䤀渀猀琀愀氀氀攀搀 匀漀昀琀眀愀爀攀ഀഊ -Added 32 bit Programs to program list ਀   ⴀ䄀搀搀攀搀 一漀渀ⴀ圀椀渀搀漀眀猀 匀攀爀瘀椀挀攀猀 猀攀挀琀椀漀渀 椀渀 䠀吀䴀䰀 爀攀瀀漀爀琀ഀഊ ਀   ㈀⸀ ഀഊ -Added Functions Get-RemoteFirewallStatus, Get-RemoteRouteTable, Get-RemoteScheduledTasks ਀   ⴀ䤀渀挀漀爀瀀漀爀愀琀攀搀 愀氀氀 昀甀渀挀琀椀漀渀猀 椀渀琀漀 爀攀瀀漀爀琀ഀഊ -Massive layout change to html and css of report ਀   ⴀ䌀氀攀愀渀攀搀 甀瀀 栀琀洀氀ഀഊ -Specified WindowsCommandOutputRegion, moved driver query into it *Driver query broke, moved back to top. ਀   ⴀ䴀漀瘀攀搀 最攀琀ⴀ眀椀渀攀瘀攀渀琀 昀椀氀琀攀爀 瘀愀爀椀愀戀氀攀猀 琀漀 瘀愀爀☀愀爀最 猀攀挀琀椀漀渀ഀഊ -Pull all warnings/errors from System and Application event logs with wevtutil and saved to file in evtx format ਀   ⴀ倀甀氀氀 刀匀伀倀 眀椀琀栀 最瀀爀攀猀甀氀琀ഀഊ -Tidy up script region markers ਀  ഀഊPowerShell Systems Report ਀䔀砀愀洀瀀氀攀 甀猀愀最攀㨀 ⸀尀匀礀猀琀攀洀猀刀攀瀀漀爀琀⸀瀀猀㄀ ⸀尀氀椀猀琀⸀琀砀琀ഀഊRemember that list.txt is the file containing a list of Server names to run this against ਀倀愀爀琀猀 漀昀 猀挀爀椀瀀琀 挀漀洀洀攀渀琀攀搀 漀甀琀 ⠀⌀⤀Ⰰ 洀愀礀 戀攀 琀甀爀渀攀搀 戀愀挀欀 漀渀 琀漀 愀搀搀 洀甀氀琀椀瀀氀攀 挀漀洀瀀甀琀攀爀 愀戀椀氀椀琀礀 愀渀搀 攀洀愀椀氀 昀甀渀挀琀椀漀渀猀⸀ഀഊ#> ਀⌀爀攀最椀漀渀 嘀愀爀椀愀戀氀攀猀 愀渀搀 䄀爀最甀洀攀渀琀猀ഀഊ#$users = "youremail@yourcompany.com" # List of users to email your report to (separate by comma) ਀⌀␀昀爀漀洀攀洀愀椀氀 㴀 ∀礀漀甀爀攀洀愀椀氀䀀礀漀甀爀挀漀洀瀀愀渀礀⸀挀漀洀∀ഀഊ#$server = "yourmailserver.yourcompany.com" #enter your own SMTP server DNS name / IP address here ਀⌀␀氀椀猀琀 㴀 ␀愀爀最猀嬀 崀 ⌀吀栀椀猀 愀挀挀攀瀀琀猀 琀栀攀 愀爀最甀洀攀渀琀 礀漀甀 愀搀搀 琀漀 礀漀甀爀 猀挀栀攀搀甀氀攀搀 琀愀猀欀 昀漀爀 琀栀攀 氀椀猀琀 漀昀 猀攀爀瘀攀爀猀⸀ 椀⸀攀⸀ 氀椀猀琀⸀琀砀琀ഀഊ#region Admin Check ਀䤀昀 ⠀ⴀ一伀吀 ⠀嬀匀攀挀甀爀椀琀礀⸀倀爀椀渀挀椀瀀愀氀⸀圀椀渀搀漀眀猀倀爀椀渀挀椀瀀愀氀崀 嬀匀攀挀甀爀椀琀礀⸀倀爀椀渀挀椀瀀愀氀⸀圀椀渀搀漀眀猀䤀搀攀渀琀椀琀礀崀㨀㨀䜀攀琀䌀甀爀爀攀渀琀⠀⤀⤀⸀䤀猀䤀渀刀漀氀攀⠀怀ഀഊ [Security.Principal.WindowsBuiltInRole] “Administrator”)) ਀笀ഀഊ Write-Warning “Administrator rights are required to run this script! Please re-run this script as an Administrator!” ਀    匀琀愀爀琀ⴀ匀氀攀攀瀀 ⴀ匀攀挀漀渀搀猀 㔀ഀഊ Break ਀紀ഀഊ#endregion Admin Check ਀␀挀漀洀瀀甀琀攀爀 㴀 栀漀猀琀渀愀洀攀 ⌀最攀琀ⴀ挀漀渀琀攀渀琀 ␀氀椀猀琀 ⌀最爀愀戀 琀栀攀 渀愀洀攀猀 漀昀 琀栀攀 猀攀爀瘀攀爀猀⼀挀漀洀瀀甀琀攀爀猀 琀漀 挀栀攀挀欀 昀爀漀洀 琀栀攀 氀椀猀琀⸀琀砀琀 昀椀氀攀⸀ഀഊ# Set free disk space threshold below in percent (default at 10%) ਀⌀␀琀栀爀攀猀栀漀氀搀猀瀀愀挀攀 㴀 ㈀ ഀഊ[int]$ProcessNumToFetch = 10 ਀␀刀甀渀䄀猀唀猀攀爀 㴀 嬀匀攀挀甀爀椀琀礀⸀倀爀椀渀挀椀瀀愀氀⸀圀椀渀搀漀眀猀䤀搀攀渀琀椀琀礀崀㨀㨀䜀攀琀䌀甀爀爀攀渀琀⠀⤀⸀一愀洀攀ഀഊ$ListOfAttachments = @() ਀␀刀攀瀀漀爀琀 㴀 䀀⠀⤀ഀഊ$date= Get-Date -format g ਀␀䐀愀琀攀䘀椀氀攀一愀洀攀㴀 䜀攀琀ⴀ䐀愀琀攀 ⴀ昀漀爀洀愀琀 䴀䴀䴀开搀搀开栀洀洀琀ഀഊ$SysEvtFilter = [xml]@' ਀㰀儀甀攀爀礀䰀椀猀琀㸀ഀഊ ਀    㰀匀攀氀攀挀琀 倀愀琀栀㴀∀匀礀猀琀攀洀∀㸀⨀嬀匀礀猀琀攀洀嬀⠀䰀攀瘀攀氀㴀㄀  漀爀 䰀攀瘀攀氀㴀㈀ 漀爀 䰀攀瘀攀氀㴀㌀⤀ 愀渀搀 吀椀洀攀䌀爀攀愀琀攀搀嬀琀椀洀攀搀椀昀昀⠀䀀匀礀猀琀攀洀吀椀洀攀⤀ ☀氀琀㬀㴀 㠀㘀㐀     崀崀崀㰀⼀匀攀氀攀挀琀㸀ഀഊ ਀㰀⼀儀甀攀爀礀䰀椀猀琀㸀ഀഊ'@ ਀␀䄀瀀瀀䔀瘀琀䘀椀氀琀攀爀 㴀 嬀砀洀氀崀䀀✀ഀഊ ਀  㰀儀甀攀爀礀 䤀搀㴀∀ ∀ 倀愀琀栀㴀∀䄀瀀瀀氀椀挀愀琀椀漀渀∀㸀ഀഊ ਀  㰀⼀儀甀攀爀礀㸀ഀഊ ਀✀䀀ഀഊ$RedBang = 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAA2FBMVEX///++MjLnalHTJyDVKy3veGf8p6Tpd2HWYl/UKiPvemncTU/leF3fWTf2kYjZPkDWLjDUXlnwhHXXOjTUSyrYaGf1iH7NS0ncYj/USy/eVjTPJxPMJwDMJwb1hnzYOz7ONAX8o6DVQxnhbG7NTE3QKhfZPkHWVS7SXlfic3XnbFTZU0P+/v7PVle1IiHMR0ieGwD1qqD3xLyzSTLLf3DPNBaQHwL99fTcalDjeHTCb2uOFQ7KJhL21MyGJxC3LhWoHQTvuKnkycKAHgjsrqb01tPmmYLSnpF1j2u3AAAAAXRSTlMAQObYZgAAAKxJREFUeF5lz0WWw0AMRVEXmZkdZmZmbNj/jlpKO6PcyT/1RioJkZyUI5FcB3KUF6LacQXEtvoqxPN1IeYLIXTfg0J6yoBSuh0tKR0oPSIR0yqA8+gCY5kQ0ga6P544KYRuDf38bnC6EMIS2q1mOCGErIzW1xtOBmHYLoKv7xNMewghCTTG2P5wZEwLEjxk6ric88mEu870/9SW0amCjtF6f2bcb4L+GN8f3/8DQgYUGINoSt8AAAAASUVORK5CYII=' ਀␀刀攀搀䈀愀渀最䠀吀䴀䰀 㴀 ∀㰀椀洀最 猀爀挀㴀搀愀琀愀㨀椀洀愀最攀⼀瀀渀最㬀戀愀猀攀㘀㐀Ⰰ␀⠀␀刀攀搀䈀愀渀最⤀ 愀氀琀㴀✀䔀爀爀漀爀✀ 猀琀礀氀攀㴀✀瘀攀爀琀椀挀愀氀ⴀ愀氀椀最渀㨀洀椀搀搀氀攀㬀瀀愀搀搀椀渀最ⴀ爀椀最栀琀㨀㔀瀀砀㬀✀⼀㸀∀ഀഊ$YellowBang = 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACdklEQVR42mVSTU8TURR9JCQsoJKIq0oUookpBkJnphqXtD+AX8BfcMOWD2PbtCaaYCKRIhRFi1q1Frvwk6ihKMFFi9ICg0BRISIFtbQKKe3xvjcd08LizH25953zzr13mNVqZS0tLQcw55TaVLcE1W3GvEtp0+/ZbDb9juCWkCghQOQKTt55XS8ghFxKhS7Co35mxcq6esyhdK8P1wGfmoCPTVgfrkfMLnVT7YBjPVFMbvh8uRHZD8eBGVkgO3lMtDJjlxr2t8qJJarc7s/Ro0C8GblcDvl8HtuTjdjw10K9JGO/C1bc16xDal2+ZiLrJ4A5CblsSohER05hc6wOiasmzDqV1uKZ6Q5EnCebmZdGIK4I7GxNCQf+C7X4GjqNdMhIGzGjRIA+hd6l89/66eXpBiJbgFipQCJA+XcmrPadRJzulmwhelGuWaD+dl/VAlEztdBM0yc3q0H8WHkvBNaCJhKg1ZILPqdpu1Lz/z+IO2TXhpesjzHgLWGcEGbILPViJTKAqSsMSR/lgoTHdO43IuZUXJzLB3eO97U3Wg48Z5rIG44y/H1RjRVfNZY8DNt3KfeQcJ9hz1cuNhInLqMfxPfbe0RTDxGeMk3oGcOftSB2kxEk+hjStyl3j8Cd3GH4df0w6J/xMepdKzzQ7GG0IPSEWljuxZfIoJjB1kCBzIVuEW6WgW+NcfsY0azBX7AZIDyiV4mw0MOg0gxSXv6yTmbIDzExTOEgM2BAZsiAtLcS6aEq7UxIDVYh6anEJiF1w0D3DiHDo4fqhO89dWCB9jPuiQ5ZDXdaFie6LIsiEsY7ZC12KovhLp7T60qhpqiB9rPuf+YeJOq16/K9AAAAAElFTkSuQmCC' ਀␀夀攀氀氀漀眀䈀愀渀最䠀吀䴀䰀 㴀 ∀㰀椀洀最 猀爀挀㴀搀愀琀愀㨀椀洀愀最攀⼀瀀渀最㬀戀愀猀攀㘀㐀Ⰰ␀⠀␀夀攀氀氀漀眀䈀愀渀最⤀ 愀氀琀㴀✀圀愀爀渀椀渀最✀ 猀琀礀氀攀㴀✀瘀攀爀琀椀挀愀氀ⴀ愀氀椀最渀㨀洀椀搀搀氀攀㬀瀀愀搀搀椀渀最ⴀ爀椀最栀琀㨀㔀瀀砀㬀✀⼀㸀∀ഀഊ#endregion Variables and Arguments ਀⌀爀攀最椀漀渀 䘀甀渀挀琀椀漀渀猀ഀഊFunction Get-SystemInformation { ਀    瀀愀爀愀洀⠀ഀഊ [string[]] ਀        ␀䌀漀洀瀀甀琀攀爀一愀洀攀㴀␀攀渀瘀㨀挀漀洀瀀甀琀攀爀渀愀洀攀ഀഊ ) ਀    昀漀爀攀愀挀栀 ⠀␀挀漀洀瀀甀琀攀爀 椀渀 ␀䌀漀洀瀀甀琀攀爀一愀洀攀⤀ 笀ഀഊ ਀        ␀䌀漀洀瀀䤀渀昀漀    㴀 䜀攀琀ⴀ圀洀椀伀戀樀攀挀琀 ⴀ儀甀攀爀礀 ∀匀攀氀攀挀琀 䴀愀渀甀昀愀挀琀甀爀攀爀Ⰰ䴀漀搀攀氀 䘀刀伀䴀 圀椀渀㌀㈀开䌀漀洀瀀甀琀攀爀匀礀猀琀攀洀∀ ⴀ挀漀洀瀀甀琀攀爀渀愀洀攀 ␀挀漀洀瀀甀琀攀爀ഀഊ $W32OS = Get-WmiObject Win32_OperatingSystem -computername $computer ਀           ഀഊ ਀           ␀䰀愀猀琀䈀漀漀琀唀瀀吀椀洀攀 㴀 ␀圀㌀㈀伀匀⸀䌀漀渀瘀攀爀琀吀漀䐀愀琀攀吀椀洀攀⠀␀圀㌀㈀伀匀⸀䰀愀猀琀䈀漀漀琀唀瀀吀椀洀攀⤀ഀഊ $Time = (Get-Date) - $LastBootUpTime ਀           ✀笀 㨀  紀 䐀愀礀猀Ⰰ 笀㄀㨀  紀 䠀漀甀爀猀Ⰰ 笀㈀㨀  紀 䴀椀渀甀琀攀猀Ⰰ 笀㌀㨀  紀 匀攀挀漀渀搀猀✀ ⴀ昀 ␀吀椀洀攀⸀䐀愀礀猀Ⰰ ␀吀椀洀攀⸀䠀漀甀爀猀Ⰰ ␀吀椀洀攀⸀䴀椀渀甀琀攀猀Ⰰ ␀吀椀洀攀⸀匀攀挀漀渀搀猀簀匀攀琀ⴀ嘀愀爀椀愀戀氀攀 唀瀀琀椀洀攀ഀഊ $OSPowerInfo = Get-WmiObject -Namespace root\cimv2\power -Class win32_PowerPlan -computername $computer|Where-Object {$_.IsActive -eq "True"}|Select ElementName ਀        ␀䌀瀀甀䤀渀昀漀     㴀 䜀攀琀ⴀ圀洀椀伀戀樀攀挀琀 ⴀ䌀漀洀瀀甀琀攀爀一愀洀攀 ␀挀漀洀瀀甀琀攀爀 ⴀ䌀氀愀猀猀 眀椀渀㌀㈀开瀀爀漀挀攀猀猀漀爀       ഀഊ $CpuName = $CpuInfo|Select -First 1 -Expand Name ਀       ␀䌀瀀甀䄀搀搀爀     㴀 ␀䌀瀀甀䤀渀昀漀簀匀攀氀攀挀琀 ⴀ䘀椀爀猀琀 ㄀ ⴀ䔀砀瀀愀渀搀 䐀愀琀愀圀椀搀琀栀ഀഊ $CpuCores = $CpuInfo|Select -expand NumberOfCores ਀        ␀䌀瀀甀䰀漀最倀爀漀挀  㴀 ␀䌀瀀甀䤀渀昀漀簀猀攀氀攀挀琀 ⴀ䔀砀瀀愀渀搀 一甀洀戀攀爀伀昀䰀漀最椀挀愀氀倀爀漀挀攀猀猀漀爀猀ഀഊ $CpuUsage = $CpuInfo|Select Loadpercentage | Measure-Object LoadPercentage -Average | Select-Object -expand Average ਀           ␀䈀䤀伀匀        㴀 䜀攀琀ⴀ圀洀椀伀戀樀攀挀琀 ⴀ挀漀洀瀀甀琀攀爀渀愀洀攀 ␀挀漀洀瀀甀琀攀爀 ⴀ儀甀攀爀礀 ∀匀䔀䰀䔀䌀吀 䴀愀渀甀昀愀挀琀甀爀攀爀Ⰰ匀䴀䈀䤀伀匀䈀䤀伀匀嘀攀爀猀椀漀渀Ⰰ刀攀氀攀愀猀攀䐀愀琀攀 䘀刀伀䴀 圀椀渀㌀㈀开䈀椀漀猀∀ഀഊ ਀        ␀匀礀猀琀攀洀䤀渀昀漀爀洀愀琀椀漀渀 㴀 一攀眀ⴀ伀戀樀攀挀琀 ⴀ吀礀瀀攀 倀匀伀戀樀攀挀琀 ⴀ倀爀漀瀀攀爀琀礀 䀀笀ഀഊ "System Manufacturer" = $CompInfo.Manufacturer ਀            ∀匀礀猀琀攀洀 䴀漀搀攀氀∀        㴀 ␀䌀漀洀瀀䤀渀昀漀⸀䴀漀搀攀氀ഀഊ "BIOS Vendor" = $BIOS.Manufacturer ਀            ∀䈀䤀伀匀 嘀攀爀猀椀漀渀∀        㴀 ␀䈀䤀伀匀⸀匀䴀䈀䤀伀匀䈀䤀伀匀嘀攀爀猀椀漀渀ഀഊ "BIOS Date" = ($BIOS.ConvertToDateTime($BIOS.ReleaseDate)).ToShortDateString() ਀            ∀䌀倀唀 一愀洀攀∀            㴀 ⠀␀䌀瀀甀一愀洀攀⤀ ⬀ ✀ 砀✀ ⬀ ⠀␀䌀瀀甀䄀搀搀爀⤀ഀഊ "Physical CPU Cores" = $CpuCores|Measure -Sum|Select -ExpandProperty Sum ਀            ∀䰀漀最椀挀愀氀 䌀倀唀 䌀漀爀攀猀∀   㴀 ␀䌀瀀甀䰀漀最倀爀漀挀簀䴀攀愀猀甀爀攀 ⴀ匀甀洀簀猀攀氀攀挀琀 ⴀ䔀砀瀀愀渀搀倀爀漀瀀攀爀琀礀 匀甀洀ഀഊ "System Uptime" = $Uptime ਀            ∀伀瀀攀爀愀琀椀渀最 匀礀猀琀攀洀∀    㴀 ␀圀㌀㈀伀匀⸀挀愀瀀琀椀漀渀 ⬀ ⠀ ␀圀㌀㈀伀匀⸀䌀匀䐀嘀攀爀猀椀漀渀⤀ഀഊ "Power Plan" = if ($OSPowerInfo.ElementName -notlike "*Performance") {"$($OSPowerInfo.ElementName) (Recommended Plan: High Performance)"} ਀                                        攀氀猀攀 笀␀伀匀倀漀眀攀爀䤀渀昀漀⸀䔀氀攀洀攀渀琀一愀洀攀紀ഀഊ "CPU % Usage" = [string](-join $CpuUsage,"%" ) -replace " ", "" ਀            ∀吀漀琀愀氀 刀䄀䴀 ⠀䜀䈀⤀∀      㴀 嬀䴀愀琀栀崀㨀㨀刀漀甀渀搀⠀⠀␀圀㌀㈀伀匀⸀吀漀琀愀氀嘀椀猀椀戀氀攀䴀攀洀漀爀礀匀椀稀攀⼀㄀䴀䈀⤀Ⰰ㈀⤀ഀഊ "Free RAM (GB)" = [Math]::Round(($W32OS.FreePhysicalMemory/1MB),2) ਀            ∀䘀爀攀攀 刀䄀䴀 ─∀          㴀 嬀䴀愀琀栀崀㨀㨀刀漀甀渀搀⠀⠀⠀␀圀㌀㈀伀匀⸀䘀爀攀攀倀栀礀猀椀挀愀氀䴀攀洀漀爀礀⼀␀圀㌀㈀伀匀⸀吀漀琀愀氀嘀椀猀椀戀氀攀䴀攀洀漀爀礀匀椀稀攀⤀ ⨀ ㄀  ⤀Ⰰ㈀⤀ഀഊ } ਀          ഀഊ $SystemInformation ਀        紀ഀഊ ਀紀   ഀഊFunction Create-ProcBarChart { ਀    瀀愀爀愀洀⠀␀䌀漀洀瀀甀琀攀爀一愀洀攀 㴀 ␀攀渀瘀㨀挀漀洀瀀甀琀攀爀渀愀洀攀Ⰰഀഊ [int32]$ProcessNumber ਀          ⤀ഀഊ [void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") ਀       嬀瘀漀椀搀崀嬀刀攀昀氀攀挀琀椀漀渀⸀䄀猀猀攀洀戀氀礀崀㨀㨀䰀漀愀搀圀椀琀栀倀愀爀琀椀愀氀一愀洀攀⠀∀匀礀猀琀攀洀⸀圀椀渀搀漀眀猀⸀䘀漀爀洀猀⸀䐀愀琀愀嘀椀猀甀愀氀椀稀愀琀椀漀渀∀⤀ഀഊ ਀⌀ 挀栀愀爀琀 漀戀樀攀挀琀ഀഊ try { ਀   ␀挀栀愀爀琀㄀ 㴀 一攀眀ⴀ漀戀樀攀挀琀 匀礀猀琀攀洀⸀圀椀渀搀漀眀猀⸀䘀漀爀洀猀⸀䐀愀琀愀嘀椀猀甀愀氀椀稀愀琀椀漀渀⸀䌀栀愀爀琀椀渀最⸀䌀栀愀爀琀ഀഊ $chart1.Width = 400 ਀   ␀挀栀愀爀琀㄀⸀䠀攀椀最栀琀 㴀 ㈀  ഀഊ $chart1.BackColor = [System.Drawing.Color]::White ਀ ഀഊ# title ਀   ⌀嬀瘀漀椀搀崀␀挀栀愀爀琀㄀⸀吀椀琀氀攀猀⸀䄀搀搀⠀∀吀漀瀀 ␀倀爀漀挀攀猀猀一甀洀戀攀爀 ⴀ 䴀攀洀漀爀礀 唀猀愀最攀∀⤀ഀഊ #$chart1.Titles[0].Font = "Arial,11pt" ਀   ⌀␀挀栀愀爀琀㄀⸀吀椀琀氀攀猀嬀 崀⸀䄀氀椀最渀洀攀渀琀 㴀 ∀琀漀瀀䰀攀昀琀∀ഀഊ ਀⌀ 挀栀愀爀琀 愀爀攀愀ഀഊ $chartarea = New-Object System.Windows.Forms.DataVisualization.Charting.ChartArea ਀   ␀挀栀愀爀琀愀爀攀愀⸀一愀洀攀 㴀 ∀䌀栀愀爀琀䄀爀攀愀㄀∀ഀഊ $Chartarea.AxisX.MajorGrid.LineWidth = 0 ਀   ␀䌀栀愀爀琀愀爀攀愀⸀䄀砀椀猀夀⸀䴀愀樀漀爀䜀爀椀搀⸀䰀椀渀攀圀椀搀琀栀 㴀  ഀഊ $chartarea.AxisY.Title = "Memory (MB)" ਀   ␀挀栀愀爀琀愀爀攀愀⸀䄀砀椀猀堀⸀吀椀琀氀攀 㴀 ∀倀爀漀挀攀猀猀 一愀洀攀∀ഀഊ $chartarea.AxisY.IsLogarithmic = $true ਀   ⌀␀挀栀愀爀琀愀爀攀愀⸀䄀砀椀猀夀⸀䤀渀琀攀爀瘀愀氀 㴀 ㄀  ഀഊ $chartarea.AxisX.Interval = 1 ਀   ␀挀栀愀爀琀㄀⸀䌀栀愀爀琀䄀爀攀愀猀⸀䄀搀搀⠀␀挀栀愀爀琀愀爀攀愀⤀ഀഊ ਀⌀ 氀攀最攀渀搀ഀഊ $legend = New-Object system.Windows.Forms.DataVisualization.Charting.Legend ਀   ␀氀攀最攀渀搀⸀渀愀洀攀 㴀 ∀䰀攀最攀渀搀㄀∀ഀഊ $legend.font = "Arial" ਀   ␀䰀攀最攀渀搀⸀搀漀挀欀椀渀最 㴀 ∀吀漀瀀∀ഀഊ $Legend.title = "Processes" ਀   ␀䰀攀最攀渀搀⸀吀椀琀氀攀䘀漀渀琀 㴀∀䄀爀椀愀氀∀ഀഊ $legend.alignment = "center" ਀   ␀䰀攀最攀渀搀⸀䤀猀琀攀砀琀愀甀琀漀昀椀琀 㴀 ␀琀爀甀攀ഀഊ $chart1.Legends.Add($legend) ਀  ഀഊ ਀⌀ 搀愀琀愀 猀漀甀爀挀攀ഀഊ $datasource = Get-Process |Select Name,ID,WorkingSet64 | sort WorkingSet64 -Descending | Select-Object -First $ProcessNumber ਀ ഀഊ# data series ਀   嬀瘀漀椀搀崀␀挀栀愀爀琀㄀⸀匀攀爀椀攀猀⸀䄀搀搀⠀∀圀匀䴀攀洀∀⤀ഀഊ $chart1.Series["WSMem"].ChartType = "Column" ਀   ␀挀栀愀爀琀㄀⸀匀攀爀椀攀猀嬀∀圀匀䴀攀洀∀崀⸀䤀猀嘀椀猀椀戀氀攀䤀渀䰀攀最攀渀搀 㴀 ␀昀愀氀猀攀ഀഊ #$chart1.Series["WSMem"].IsVisibleInLegend = $true ਀   ␀挀栀愀爀琀㄀⸀匀攀爀椀攀猀嬀∀圀匀䴀攀洀∀崀⸀䈀漀爀搀攀爀圀椀搀琀栀  㴀 ㌀ഀഊ $chart1.Series["WSMem"].chartarea = "ChartArea1" ਀   ␀挀栀愀爀琀㄀⸀匀攀爀椀攀猀嬀∀圀匀䴀攀洀∀崀⸀䰀攀最攀渀搀 㴀 ∀䰀攀最攀渀搀㄀∀ഀഊ $chart1.Series["WSMem"].Palette = "SemiTransparent" ਀   ␀䌀栀愀爀琀㄀⸀匀攀爀椀攀猀嬀∀圀匀䴀攀洀∀崀嬀∀䐀爀愀眀椀渀最匀琀礀氀攀∀崀 㴀 ∀䌀礀氀椀渀搀攀爀∀ഀഊ $datasource | ForEach-Object {$chart1.Series["WSMem"].Points.addxy( ("PID "+$_.ID +" "+([Math]::Round($_.WorkingSet64 / 1mb))+" MB") , ([Math]::Round($_.WorkingSet64 / 1mb))) } ਀  ഀഊ ਀⌀ 猀愀瘀攀 挀栀愀爀琀ഀഊ $chart1.SaveImage($env:tmp + "\ProcBar-"+$computername +".png","png") ਀    紀 ഀഊ catch { ਀             ∀䔀爀爀漀爀 挀爀攀愀琀椀渀最 挀栀愀爀琀⸀ 嘀攀爀椀昀礀 䴀椀挀爀漀猀漀昀琀 䌀栀愀爀琀 䌀漀渀琀爀漀氀猀 昀漀爀 䴀椀挀爀漀猀漀昀琀 ⸀一䔀吀 䘀爀愀洀攀眀漀爀欀 ㌀⸀㔀 椀猀 椀渀猀琀愀氀氀攀搀∀ഀഊ } ਀紀ഀഊFunction Create-RAMPieChart { ਀       瀀愀爀愀洀⠀␀䌀漀洀瀀甀琀攀爀一愀洀攀 㴀 ␀攀渀瘀㨀挀漀洀瀀甀琀攀爀渀愀洀攀ഀഊ ) ਀              ഀഊ [void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") ਀       嬀瘀漀椀搀崀嬀刀攀昀氀攀挀琀椀漀渀⸀䄀猀猀攀洀戀氀礀崀㨀㨀䰀漀愀搀圀椀琀栀倀愀爀琀椀愀氀一愀洀攀⠀∀匀礀猀琀攀洀⸀圀椀渀搀漀眀猀⸀䘀漀爀洀猀⸀䐀愀琀愀嘀椀猀甀愀氀椀稀愀琀椀漀渀∀⤀ഀഊ ਀    ⌀䜀愀琀栀攀爀 刀䄀䴀 䐀愀琀愀ഀഊ $SystemInfo = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $ComputerName | Select-Object Name, TotalVisibleMemorySize, FreePhysicalMemory ਀       ␀吀漀琀愀氀刀䄀䴀 㴀 ␀匀礀猀琀攀洀䤀渀昀漀⸀吀漀琀愀氀嘀椀猀椀戀氀攀䴀攀洀漀爀礀匀椀稀攀⼀㄀䴀䈀ഀഊ $FreeRAM = $SystemInfo.FreePhysicalMemory/1MB ਀          ␀唀猀攀搀刀䄀䴀 㴀 ␀吀漀琀愀氀刀䄀䴀 ⴀ ␀䘀爀攀攀刀䄀䴀ഀഊ $RAMPercentFree = ($FreeRAM / $TotalRAM) * 100 ਀          ␀䘀爀攀攀 㴀 嬀䴀愀琀栀崀㨀㨀刀漀甀渀搀⠀␀䘀爀攀攀刀䄀䴀Ⰰ ㈀⤀ഀഊ $Used = [Math]::Round($UsedRAM, 2) ਀         ഀഊ ਀       ⌀䌀爀攀愀琀攀 漀甀爀 挀栀愀爀琀 漀戀樀攀挀琀ഀഊ try { ਀    ␀䌀栀愀爀琀 㴀 一攀眀ⴀ漀戀樀攀挀琀 匀礀猀琀攀洀⸀圀椀渀搀漀眀猀⸀䘀漀爀洀猀⸀䐀愀琀愀嘀椀猀甀愀氀椀稀愀琀椀漀渀⸀䌀栀愀爀琀椀渀最⸀䌀栀愀爀琀      ഀഊ $Chart.Width = 200 ਀       ␀䌀栀愀爀琀⸀䠀攀椀最栀琀 㴀 ㈀  ഀഊ $Chart.Left = 10 ਀       ␀䌀栀愀爀琀⸀吀漀瀀 㴀 ㄀ ഀഊ ਀       ⌀䌀爀攀愀琀攀 愀 挀栀愀爀琀愀爀攀愀 琀漀 搀爀愀眀 漀渀 愀渀搀 愀搀搀 琀栀椀猀 琀漀 琀栀攀 挀栀愀爀琀ഀഊ $ChartArea = New-Object System.Windows.Forms.DataVisualization.Charting.ChartArea ਀       ␀䌀栀愀爀琀⸀䌀栀愀爀琀䄀爀攀愀猀⸀䄀搀搀⠀␀䌀栀愀爀琀䄀爀攀愀⤀ഀഊ [void]$Chart.Series.Add("Data") ਀       ⌀䄀搀搀 愀 搀愀琀愀瀀漀椀渀琀 昀漀爀 攀愀挀栀 瘀愀氀甀攀 猀瀀攀挀椀昀椀攀搀 椀渀 琀栀攀 愀爀最甀洀攀渀琀猀 ⠀愀爀最猀⤀ഀഊ Write-Host "Now processing chart value: " + $used ਀              ␀搀愀琀愀瀀漀椀渀琀 㴀 渀攀眀ⴀ漀戀樀攀挀琀 匀礀猀琀攀洀⸀圀椀渀搀漀眀猀⸀䘀漀爀洀猀⸀䐀愀琀愀嘀椀猀甀愀氀椀稀愀琀椀漀渀⸀䌀栀愀爀琀椀渀最⸀䐀愀琀愀倀漀椀渀琀⠀ Ⰰ ␀唀猀攀搀⤀ഀഊ $datapoint.AxisLabel = "$used GB Used" ਀        ␀搀愀琀愀瀀漀椀渀琀⸀䌀漀氀漀爀 㴀∀䘀椀爀攀䈀爀椀挀欀∀ഀഊ $Chart.Series["Data"].Points.Add($datapoint) ਀   ഀഊ Write-Host "Now processing chart value: " + $Free ਀              ␀搀愀琀愀瀀漀椀渀琀㄀ 㴀 渀攀眀ⴀ漀戀樀攀挀琀 匀礀猀琀攀洀⸀圀椀渀搀漀眀猀⸀䘀漀爀洀猀⸀䐀愀琀愀嘀椀猀甀愀氀椀稀愀琀椀漀渀⸀䌀栀愀爀琀椀渀最⸀䐀愀琀愀倀漀椀渀琀⠀ Ⰰ ␀䘀爀攀攀⤀ഀഊ $datapoint1.AxisLabel = "$Free GB Free" ਀           ␀搀愀琀愀瀀漀椀渀琀㄀⸀䌀漀氀漀爀 㴀∀䐀漀搀最攀爀䈀氀甀攀∀ഀഊ $Chart.Series["Data"].Points.Add($datapoint1) ਀       ഀഊ ਀    ␀䌀栀愀爀琀⸀匀攀爀椀攀猀嬀∀䐀愀琀愀∀崀⸀䌀栀愀爀琀吀礀瀀攀 㴀 嬀匀礀猀琀攀洀⸀圀椀渀搀漀眀猀⸀䘀漀爀洀猀⸀䐀愀琀愀嘀椀猀甀愀氀椀稀愀琀椀漀渀⸀䌀栀愀爀琀椀渀最⸀匀攀爀椀攀猀䌀栀愀爀琀吀礀瀀攀崀㨀㨀䐀漀甀最栀渀甀琀ഀഊ $Chart.Series["Data"]["PieLabelStyle"] = "Outside" ਀       ␀䌀栀愀爀琀⸀匀攀爀椀攀猀嬀∀䐀愀琀愀∀崀嬀∀倀椀攀䰀椀渀攀䌀漀氀漀爀∀崀 㴀 ∀䈀氀愀挀欀∀ഀഊ $Chart.Series["Data"]["PieDrawingStyle"] = "Concave" ਀       ⠀␀䌀栀愀爀琀⸀匀攀爀椀攀猀嬀∀䐀愀琀愀∀崀⸀倀漀椀渀琀猀⸀䘀椀渀搀䴀愀砀䈀礀嘀愀氀甀攀⠀⤀⤀嬀∀䔀砀瀀氀漀搀攀搀∀崀 㴀 ␀琀爀甀攀ഀഊ $Chart.Series["Data"].Font = "Arial" ਀   ഀഊ # Create chart legend ਀        ␀氀攀最攀渀搀 㴀 一攀眀ⴀ伀戀樀攀挀琀 猀礀猀琀攀洀⸀圀椀渀搀漀眀猀⸀䘀漀爀洀猀⸀䐀愀琀愀嘀椀猀甀愀氀椀稀愀琀椀漀渀⸀䌀栀愀爀琀椀渀最⸀䰀攀最攀渀搀ഀഊ $legend.name = "Legend1" ਀        ␀氀攀最攀渀搀⸀昀漀渀琀 㴀 ∀䄀爀椀愀氀∀ഀഊ $Legend.docking = "Top" ਀        ␀䰀攀最攀渀搀⸀琀椀琀氀攀 㴀 ∀刀䄀䴀 唀猀愀最攀∀ഀഊ $Legend.TitleFont ="Arial" ਀        ␀氀攀最攀渀搀⸀愀氀椀最渀洀攀渀琀 㴀 ∀挀攀渀琀攀爀∀ഀഊ $Legend.Istextautofit = $true ਀       ഀഊ ਀        ⌀ 䄀搀搀 挀栀愀爀琀 氀攀最攀渀搀 琀漀 挀栀愀爀琀 漀戀樀攀挀琀ഀഊ $chart.legends.add($legend) ਀       ഀഊ #Set the title of the Chart to the current date and time ਀       ⌀␀吀椀琀氀攀 㴀 渀攀眀ⴀ漀戀樀攀挀琀 匀礀猀琀攀洀⸀圀椀渀搀漀眀猀⸀䘀漀爀洀猀⸀䐀愀琀愀嘀椀猀甀愀氀椀稀愀琀椀漀渀⸀䌀栀愀爀琀椀渀最⸀吀椀琀氀攀ഀഊ #$Chart.Titles.Add($Title) ਀       ⌀␀䌀栀愀爀琀⸀吀椀琀氀攀猀嬀 崀⸀吀攀砀琀 㴀 ∀刀䄀䴀 唀猀愀最攀∀ഀഊ #$Chart.Titles[0].Font = "Arial" ਀       ⌀匀愀瘀攀 琀栀攀 挀栀愀爀琀 琀漀 愀 昀椀氀攀ഀഊ $Chart.SaveImage($env:temp + "\RAM-"+$computername + ".png","png") ਀   ഀഊ } ਀    挀愀琀挀栀 笀ഀഊ "Error creating chart. Verify Microsoft Chart Controls for Microsoft .NET Framework 3.5 is installed" ਀             紀 ഀഊ} ਀䘀甀渀挀琀椀漀渀 䌀爀攀愀琀攀ⴀ䌀倀唀倀椀攀䌀栀愀爀琀 笀ഀഊ param($ComputerName = $env:computername ਀          ⤀ഀഊ ਀       嬀瘀漀椀搀崀嬀刀攀昀氀攀挀琀椀漀渀⸀䄀猀猀攀洀戀氀礀崀㨀㨀䰀漀愀搀圀椀琀栀倀愀爀琀椀愀氀一愀洀攀⠀∀匀礀猀琀攀洀⸀圀椀渀搀漀眀猀⸀䘀漀爀洀猀∀⤀ഀഊ [void][Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms.DataVisualization") ਀       ഀഊ #Get CPU Data ਀    ␀䌀瀀甀䤀渀昀漀 㴀 䜀攀琀ⴀ圀洀椀伀戀樀攀挀琀 ⴀ䌀漀洀瀀甀琀攀爀一愀洀攀 ␀挀漀洀瀀甀琀攀爀渀愀洀攀 ⴀ䌀氀愀猀猀 眀椀渀㌀㈀开瀀爀漀挀攀猀猀漀爀ഀഊ $CpuName = $CpuInfo|Select -First 1 -Expand Name ਀    ␀䌀瀀甀䄀搀搀爀 㴀 ␀䌀瀀甀䤀渀昀漀簀匀攀氀攀挀琀 ⴀ䘀椀爀猀琀 ㄀ ⴀ䔀砀瀀愀渀搀 䐀愀琀愀圀椀搀琀栀ഀഊ $CpuCores = $CpuInfo|Select -expand NumberOfCores ਀    ␀䌀瀀甀唀猀愀最攀 㴀 ␀䌀瀀甀䤀渀昀漀簀匀攀氀攀挀琀 䰀漀愀搀瀀攀爀挀攀渀琀愀最攀 簀 䴀攀愀猀甀爀攀ⴀ伀戀樀攀挀琀 䰀漀愀搀倀攀爀挀攀渀琀愀最攀 ⴀ䄀瘀攀爀愀最攀 簀 匀攀氀攀挀琀ⴀ伀戀樀攀挀琀 ⴀ攀砀瀀愀渀搀 䄀瘀攀爀愀最攀ഀഊ $CpuFree = 100 - [int]$CpuUsage ਀   ഀഊ ਀    ⌀䌀爀攀愀琀攀 漀甀爀 挀栀愀爀琀 漀戀樀攀挀琀ഀഊ try { ਀    ␀䌀栀愀爀琀 㴀 一攀眀ⴀ漀戀樀攀挀琀 匀礀猀琀攀洀⸀圀椀渀搀漀眀猀⸀䘀漀爀洀猀⸀䐀愀琀愀嘀椀猀甀愀氀椀稀愀琀椀漀渀⸀䌀栀愀爀琀椀渀最⸀䌀栀愀爀琀      ഀഊ $Chart.Width = 200 ਀       ␀䌀栀愀爀琀⸀䠀攀椀最栀琀 㴀 ㈀  ഀഊ $Chart.Left = 10 ਀       ␀䌀栀愀爀琀⸀吀漀瀀 㴀 ㄀ ഀഊ ਀       ⌀䌀爀攀愀琀攀 愀 挀栀愀爀琀愀爀攀愀 琀漀 搀爀愀眀 漀渀 愀渀搀 愀搀搀 琀栀椀猀 琀漀 琀栀攀 挀栀愀爀琀ഀഊ $ChartArea = New-Object System.Windows.Forms.DataVisualization.Charting.ChartArea ਀       ␀䌀栀愀爀琀⸀䌀栀愀爀琀䄀爀攀愀猀⸀䄀搀搀⠀␀䌀栀愀爀琀䄀爀攀愀⤀ഀഊ [void]$Chart.Series.Add("Data") ਀       ⌀䄀搀搀 愀 搀愀琀愀瀀漀椀渀琀 昀漀爀 攀愀挀栀 瘀愀氀甀攀 猀瀀攀挀椀昀椀攀搀 椀渀 琀栀攀 愀爀最甀洀攀渀琀猀 ⠀愀爀最猀⤀ഀഊ Write-Host "Now processing chart value: " + $CpuUsage ਀              ␀搀愀琀愀瀀漀椀渀琀 㴀 渀攀眀ⴀ漀戀樀攀挀琀 匀礀猀琀攀洀⸀圀椀渀搀漀眀猀⸀䘀漀爀洀猀⸀䐀愀琀愀嘀椀猀甀愀氀椀稀愀琀椀漀渀⸀䌀栀愀爀琀椀渀最⸀䐀愀琀愀倀漀椀渀琀⠀ Ⰰ ␀䌀瀀甀唀猀愀最攀⤀ഀഊ $datapoint.AxisLabel = "$CpuUsage% Used" ਀        ␀搀愀琀愀瀀漀椀渀琀⸀䌀漀氀漀爀 㴀∀䘀椀爀攀䈀爀椀挀欀∀ഀഊ $Chart.Series["Data"].Points.Add($datapoint) ਀   ഀഊ Write-Host "Now processing chart value: " + $CpuFree ਀              ␀搀愀琀愀瀀漀椀渀琀㄀ 㴀 渀攀眀ⴀ漀戀樀攀挀琀 匀礀猀琀攀洀⸀圀椀渀搀漀眀猀⸀䘀漀爀洀猀⸀䐀愀琀愀嘀椀猀甀愀氀椀稀愀琀椀漀渀⸀䌀栀愀爀琀椀渀最⸀䐀愀琀愀倀漀椀渀琀⠀ Ⰰ ␀䌀瀀甀䘀爀攀攀⤀ഀഊ $datapoint1.AxisLabel = "$CPUFree% Free" ਀           ␀搀愀琀愀瀀漀椀渀琀㄀⸀䌀漀氀漀爀 㴀∀䐀漀搀最攀爀䈀氀甀攀∀ഀഊ $Chart.Series["Data"].Points.Add($datapoint1) ਀       ഀഊ ਀    ␀䌀栀愀爀琀⸀匀攀爀椀攀猀嬀∀䐀愀琀愀∀崀⸀䌀栀愀爀琀吀礀瀀攀 㴀 嬀匀礀猀琀攀洀⸀圀椀渀搀漀眀猀⸀䘀漀爀洀猀⸀䐀愀琀愀嘀椀猀甀愀氀椀稀愀琀椀漀渀⸀䌀栀愀爀琀椀渀最⸀匀攀爀椀攀猀䌀栀愀爀琀吀礀瀀攀崀㨀㨀䐀漀甀最栀渀甀琀ഀഊ $Chart.Series["Data"]["PieLabelStyle"] = "Outside" ਀       ␀䌀栀愀爀琀⸀匀攀爀椀攀猀嬀∀䐀愀琀愀∀崀嬀∀倀椀攀䰀椀渀攀䌀漀氀漀爀∀崀 㴀 ∀䈀氀愀挀欀∀ഀഊ $Chart.Series["Data"]["PieDrawingStyle"] = "Concave" ਀       ⠀␀䌀栀愀爀琀⸀匀攀爀椀攀猀嬀∀䐀愀琀愀∀崀⸀倀漀椀渀琀猀⸀䘀椀渀搀䴀愀砀䈀礀嘀愀氀甀攀⠀⤀⤀嬀∀䔀砀瀀氀漀搀攀搀∀崀 㴀 ␀琀爀甀攀ഀഊ $Chart.Series["Data"].Font = "Arial" ਀   ഀഊ # Create chart legend ਀        ␀氀攀最攀渀搀 㴀 一攀眀ⴀ伀戀樀攀挀琀 猀礀猀琀攀洀⸀圀椀渀搀漀眀猀⸀䘀漀爀洀猀⸀䐀愀琀愀嘀椀猀甀愀氀椀稀愀琀椀漀渀⸀䌀栀愀爀琀椀渀最⸀䰀攀最攀渀搀ഀഊ $legend.name = "Legend1" ਀        ␀氀攀最攀渀搀⸀昀漀渀琀 㴀 ∀䄀爀椀愀氀∀ഀഊ $Legend.docking = "Top" ਀        ␀䰀攀最攀渀搀⸀琀椀琀氀攀 㴀 ∀䌀倀唀 唀猀愀最攀∀ഀഊ $Legend.TitleFont ="Arial" ਀        ␀氀攀最攀渀搀⸀愀氀椀最渀洀攀渀琀 㴀 ∀挀攀渀琀攀爀∀ഀഊ $Legend.Istextautofit = $true ਀       ഀഊ ਀        ⌀ 䄀搀搀 挀栀愀爀琀 氀攀最攀渀搀 琀漀 挀栀愀爀琀 漀戀樀攀挀琀ഀഊ $chart.legends.add($legend) ਀       ഀഊ #Save the chart to a file ਀       ␀䌀栀愀爀琀⸀匀愀瘀攀䤀洀愀最攀⠀␀攀渀瘀㨀琀洀瀀 ⬀ ∀尀䌀倀唀ⴀ∀⬀␀挀漀洀瀀甀琀攀爀渀愀洀攀 ⬀ ∀⸀瀀渀最∀Ⰰ∀瀀渀最∀⤀ഀഊ } ਀    挀愀琀挀栀 笀ഀഊ "Error creating chart. Verify Microsoft Chart Controls for Microsoft .NET Framework 3.5 is installed" ਀             紀ഀഊ} ਀䘀甀渀挀琀椀漀渀 䜀攀琀ⴀ刀攀洀漀琀攀刀漀甀琀攀吀愀戀氀攀 笀ഀഊ <# ਀    ⸀匀夀一伀倀匀䤀匀ഀഊ Gathers remote system route entries. ਀    ⸀䐀䔀匀䌀刀䤀倀吀䤀伀一ഀഊ Gathers remote system route entries, including persistent routes. Utilizes multiple runspaces and ਀       愀氀琀攀爀渀愀琀攀 挀爀攀搀攀渀琀椀愀氀猀 椀昀 搀攀猀椀爀攀搀⸀ഀഊ .PARAMETER ComputerName ਀       匀瀀攀挀椀昀椀攀猀 琀栀攀 琀愀爀最攀琀 挀漀洀瀀甀琀攀爀 昀漀爀 搀愀琀愀 焀甀攀爀礀⸀ഀഊ .PARAMETER ThrottleLimit ਀       匀瀀攀挀椀昀椀攀猀 琀栀攀 洀愀砀椀洀甀洀 渀甀洀戀攀爀 漀昀 猀礀猀琀攀洀猀 琀漀 椀渀瘀攀渀琀漀爀礀 猀椀洀甀氀琀愀渀攀漀甀猀氀礀ഀഊ .PARAMETER Timeout ਀       匀瀀攀挀椀昀椀攀猀 琀栀攀 洀愀砀椀洀甀洀 琀椀洀攀 椀渀 猀攀挀漀渀搀 挀漀洀洀愀渀搀 挀愀渀 爀甀渀 椀渀 戀愀挀欀最爀漀甀渀搀 戀攀昀漀爀攀 琀攀爀洀椀渀愀琀椀渀最 琀栀椀猀 琀栀爀攀愀搀⸀ഀഊ .PARAMETER ShowProgress ਀       匀栀漀眀 瀀爀漀最爀攀猀猀 戀愀爀 椀渀昀漀爀洀愀琀椀漀渀ഀഊ .EXAMPLE ਀       倀匀 㸀 䜀攀琀ⴀ刀攀洀漀琀攀刀漀甀琀攀吀愀戀氀攀ഀഊ ਀      ഀഊ Description ਀       ⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀഀഊ ਀    ⸀一伀吀䔀匀ഀഊ Author: Zachary Loeber ਀       匀椀琀攀㨀 栀琀琀瀀㨀⼀⼀眀眀眀⸀琀栀攀ⴀ氀椀琀琀氀攀ⴀ琀栀椀渀最猀⸀渀攀琀⼀ഀഊ Requires: Powershell 2.0 ਀       嘀攀爀猀椀漀渀 䠀椀猀琀漀爀礀ഀഊ 1.0.0 - 08/31/2013 ਀        ⴀ 䤀渀椀琀椀愀氀 爀攀氀攀愀猀攀ഀഊ #> ਀    嬀䌀洀搀氀攀琀䈀椀渀搀椀渀最⠀⤀崀ഀഊ PARAM ਀    ⠀ഀഊ [Parameter(HelpMessage="Computer or computers to gather information from", ਀                   嘀愀氀甀攀䘀爀漀洀倀椀瀀攀氀椀渀攀㴀␀琀爀甀攀Ⰰഀഊ ValueFromPipelineByPropertyName=$true, ਀                   倀漀猀椀琀椀漀渀㴀 ⤀崀ഀഊ [ValidateNotNullOrEmpty()] ਀        嬀䄀氀椀愀猀⠀✀䐀一匀䠀漀猀琀一愀洀攀✀Ⰰ✀倀匀䌀漀洀瀀甀琀攀爀一愀洀攀✀⤀崀ഀഊ [string[]] ਀        ␀䌀漀洀瀀甀琀攀爀一愀洀攀㴀␀攀渀瘀㨀挀漀洀瀀甀琀攀爀渀愀洀攀Ⰰഀഊ ਀        嬀倀愀爀愀洀攀琀攀爀⠀䠀攀氀瀀䴀攀猀猀愀最攀㴀∀䴀愀砀椀洀甀洀 渀甀洀戀攀爀 漀昀 挀漀渀挀甀爀爀攀渀琀 琀栀爀攀愀搀猀∀⤀崀ഀഊ [ValidateRange(1,65535)] ਀        嬀椀渀琀㌀㈀崀ഀഊ $ThrottleLimit = 32, ਀ ഀഊ [Parameter(HelpMessage="Timeout before a thread stops trying to gather the information")] ਀        嬀嘀愀氀椀搀愀琀攀刀愀渀最攀⠀㄀Ⰰ㘀㔀㔀㌀㔀⤀崀ഀഊ [int32] ਀        ␀吀椀洀攀漀甀琀 㴀 ㄀㈀ Ⰰഀഊ ਀        嬀倀愀爀愀洀攀琀攀爀⠀䠀攀氀瀀䴀攀猀猀愀最攀㴀∀䐀椀猀瀀氀愀礀 瀀爀漀最爀攀猀猀 漀昀 昀甀渀挀琀椀漀渀∀⤀崀ഀഊ [switch] ਀        ␀匀栀漀眀倀爀漀最爀攀猀猀Ⰰഀഊ ਀        嬀倀愀爀愀洀攀琀攀爀⠀䠀攀氀瀀䴀攀猀猀愀最攀㴀∀匀攀琀 琀栀椀猀 椀昀 礀漀甀 眀愀渀琀 琀栀攀 昀甀渀挀琀椀漀渀 琀漀 瀀爀漀洀瀀琀 昀漀爀 愀氀琀攀爀渀愀琀攀 挀爀攀搀攀渀琀椀愀氀猀∀⤀崀ഀഊ [switch] ਀        ␀倀爀漀洀瀀琀䘀漀爀䌀爀攀搀攀渀琀椀愀氀Ⰰഀഊ ਀        嬀倀愀爀愀洀攀琀攀爀⠀䠀攀氀瀀䴀攀猀猀愀最攀㴀∀匀攀琀 琀栀椀猀 椀昀 礀漀甀 眀愀渀琀 琀漀 瀀爀漀瘀椀搀攀 礀漀甀爀 漀眀渀 愀氀琀攀爀渀愀琀攀 挀爀攀搀攀渀琀椀愀氀猀∀⤀崀ഀഊ [System.Management.Automation.Credential()] ਀        ␀䌀爀攀搀攀渀琀椀愀氀 㴀 嬀匀礀猀琀攀洀⸀䴀愀渀愀最攀洀攀渀琀⸀䄀甀琀漀洀愀琀椀漀渀⸀倀匀䌀爀攀搀攀渀琀椀愀氀崀㨀㨀䔀洀瀀琀礀ഀഊ ) ਀    䈀䔀䜀䤀一ഀഊ { ਀        ⌀ 䜀愀琀栀攀爀 瀀漀猀猀椀戀氀攀 氀漀挀愀氀 栀漀猀琀 渀愀洀攀猀 愀渀搀 䤀倀猀 琀漀 瀀爀攀瘀攀渀琀 挀爀攀搀攀渀琀椀愀氀 甀琀椀氀椀稀愀琀椀漀渀 椀渀 猀漀洀攀 挀愀猀攀猀ഀഊ Write-Verbose -Message 'Remote Route Table: Creating local hostname list' ਀        ␀䤀倀䄀搀搀爀攀猀猀攀猀 㴀 嬀渀攀琀⸀搀渀猀崀㨀㨀䜀攀琀䠀漀猀琀䄀搀搀爀攀猀猀攀猀⠀␀攀渀瘀㨀䌀伀䴀倀唀吀䔀刀一䄀䴀䔀⤀ 簀 匀攀氀攀挀琀ⴀ伀戀樀攀挀琀 ⴀ䔀砀瀀愀渀搀倀爀漀瀀攀爀琀礀 䤀瀀䄀搀搀爀攀猀猀吀漀匀琀爀椀渀最ഀഊ $HostNames = $IPAddresses | ForEach-Object { ਀            琀爀礀 笀ഀഊ [net.dns]::GetHostByAddress($_) ਀            紀 挀愀琀挀栀 笀ഀഊ # We do not care about errors here... ਀            紀ഀഊ } | Select-Object -ExpandProperty HostName -Unique ਀        ␀䰀漀挀愀氀䠀漀猀琀 㴀 䀀⠀✀✀Ⰰ ✀⸀✀Ⰰ ✀氀漀挀愀氀栀漀猀琀✀Ⰰ ␀攀渀瘀㨀䌀伀䴀倀唀吀䔀刀一䄀䴀䔀Ⰰ ✀㨀㨀㄀✀Ⰰ ✀㄀㈀㜀⸀ ⸀ ⸀㄀✀⤀ ⬀ ␀䤀倀䄀搀搀爀攀猀猀攀猀 ⬀ ␀䠀漀猀琀一愀洀攀猀ഀഊ ਀        圀爀椀琀攀ⴀ嘀攀爀戀漀猀攀 ⴀ䴀攀猀猀愀最攀 ✀刀攀洀漀琀攀 刀漀甀琀攀 吀愀戀氀攀㨀 䌀爀攀愀琀椀渀最 椀渀椀琀椀愀氀 瘀愀爀椀愀戀氀攀猀✀ഀഊ $runspacetimers = [HashTable]::Synchronized(@{}) ਀        ␀爀甀渀猀瀀愀挀攀猀            㴀 一攀眀ⴀ伀戀樀攀挀琀 ⴀ吀礀瀀攀一愀洀攀 匀礀猀琀攀洀⸀䌀漀氀氀攀挀琀椀漀渀猀⸀䄀爀爀愀礀䰀椀猀琀ഀഊ $bgRunspaceCounter = 0 ਀       ഀഊ if ($PromptForCredential) ਀        笀ഀഊ $Credential = Get-Credential ਀        紀ഀഊ ਀        圀爀椀琀攀ⴀ嘀攀爀戀漀猀攀 ⴀ䴀攀猀猀愀最攀 ✀刀攀洀漀琀攀 刀漀甀琀攀 吀愀戀氀攀㨀 䌀爀攀愀琀椀渀最 䤀渀椀琀椀愀氀 匀攀猀猀椀漀渀 匀琀愀琀攀✀ഀഊ $iss = [System.Management.Automation.Runspaces.InitialSessionState]::CreateDefault() ਀        昀漀爀攀愀挀栀 ⠀␀䔀砀琀攀爀渀愀氀嘀愀爀椀愀戀氀攀 椀渀 ⠀✀爀甀渀猀瀀愀挀攀琀椀洀攀爀猀✀Ⰰ ✀䌀爀攀搀攀渀琀椀愀氀✀Ⰰ ✀䰀漀挀愀氀䠀漀猀琀✀⤀⤀ഀഊ { ਀            圀爀椀琀攀ⴀ嘀攀爀戀漀猀攀 ⴀ䴀攀猀猀愀最攀 ∀刀攀洀漀琀攀 刀漀甀琀攀 吀愀戀氀攀㨀 䄀搀搀椀渀最 瘀愀爀椀愀戀氀攀 ␀䔀砀琀攀爀渀愀氀嘀愀爀椀愀戀氀攀 琀漀 椀渀椀琀椀愀氀 猀攀猀猀椀漀渀 猀琀愀琀攀∀ഀഊ $iss.Variables.Add((New-Object -TypeName System.Management.Automation.Runspaces.SessionStateVariableEntry -ArgumentList $ExternalVariable, (Get-Variable -Name $ExternalVariable -ValueOnly), '')) ਀        紀ഀഊ ਀        圀爀椀琀攀ⴀ嘀攀爀戀漀猀攀 ⴀ䴀攀猀猀愀最攀 ✀刀攀洀漀琀攀 刀漀甀琀攀 吀愀戀氀攀㨀 䌀爀攀愀琀椀渀最 爀甀渀猀瀀愀挀攀 瀀漀漀氀✀ഀഊ $rp = [System.Management.Automation.Runspaces.RunspaceFactory]::CreateRunspacePool(1, $ThrottleLimit, $iss, $Host) ਀        ␀爀瀀⸀䄀瀀愀爀琀洀攀渀琀匀琀愀琀攀 㴀 ✀匀吀䄀✀ഀഊ $rp.Open() ਀ ഀഊ # This is the actual code called for each computer ਀        圀爀椀琀攀ⴀ嘀攀爀戀漀猀攀 ⴀ䴀攀猀猀愀最攀 ✀刀攀洀漀琀攀 刀漀甀琀攀 吀愀戀氀攀㨀 䐀攀昀椀渀椀渀最 戀愀挀欀最爀漀甀渀搀 爀甀渀猀瀀愀挀攀猀 猀挀爀椀瀀琀戀氀漀挀欀✀ഀഊ $ScriptBlock = { ਀            嬀䌀洀搀氀攀琀䈀椀渀搀椀渀最⠀⤀崀ഀഊ Param ਀            ⠀ഀഊ [Parameter(Position=0)] ਀                嬀猀琀爀椀渀最崀ഀഊ $ComputerName, ਀ ഀഊ [Parameter(Position=1)] ਀                嬀椀渀琀崀ഀഊ $bgRunspaceID ਀            ⤀ഀഊ $runspacetimers.$bgRunspaceID = Get-Date ਀           ഀഊ try ਀            笀ഀഊ Write-Verbose -Message ('Remote Route Table: Runspace {0}: Start' -f $ComputerName) ਀                ␀圀䴀䤀䠀愀猀琀 㴀 䀀笀ഀഊ ComputerName = $ComputerName ਀                    䔀爀爀漀爀䄀挀琀椀漀渀 㴀 ✀匀琀漀瀀✀ഀഊ } ਀                椀昀 ⠀⠀␀䰀漀挀愀氀䠀漀猀琀 ⴀ渀漀琀挀漀渀琀愀椀渀猀 ␀䌀漀洀瀀甀琀攀爀一愀洀攀⤀ ⴀ愀渀搀 ⠀␀䌀爀攀搀攀渀琀椀愀氀 ⴀ渀攀 ␀渀甀氀氀⤀⤀ഀഊ { ਀                    ␀圀䴀䤀䠀愀猀琀⸀䌀爀攀搀攀渀琀椀愀氀 㴀 ␀䌀爀攀搀攀渀琀椀愀氀ഀഊ } ਀                ⌀ 䜀攀渀攀爀愀氀 瘀愀爀椀愀戀氀攀猀ഀഊ $ResultSet = @() ਀                ␀倀匀䐀愀琀攀吀椀洀攀 㴀 䜀攀琀ⴀ䐀愀琀攀ഀഊ $RouteType = @('Unknown','Other','Invalid','Direct','Indirect') ਀                ␀刀漀甀琀攀猀 㴀 䀀⠀⤀ഀഊ ਀                ⌀爀攀最椀漀渀 刀漀甀琀攀猀ഀഊ Write-Verbose -Message ('Remote Route Table: Runspace {0}: Route table information' -f $ComputerName) ਀                ⌀ 䴀漀搀椀昀礀 琀栀椀猀 瘀愀爀椀愀戀氀攀 琀漀 挀栀愀渀最攀 礀漀甀爀 搀攀昀愀甀氀琀 猀攀琀 漀昀 搀椀猀瀀氀愀礀 瀀爀漀瀀攀爀琀椀攀猀ഀഊ $defaultProperties = @('ComputerName','Routes') ਀                                        ഀഊ # WMI data ਀                ␀眀洀椀开爀漀甀琀攀猀 㴀 䜀攀琀ⴀ圀洀椀伀戀樀攀挀琀 䀀圀䴀䤀䠀愀猀琀 ⴀ䌀氀愀猀猀 眀椀渀㌀㈀开椀瀀㐀刀漀甀琀攀吀愀戀氀攀ഀഊ $wmi_persistedroutes = Get-WmiObject @WMIHast -Class win32_IP4PersistedRouteTable ਀                昀漀爀攀愀挀栀 ⠀␀椀瀀爀漀甀琀攀 椀渀 ␀眀洀椀开爀漀甀琀攀猀⤀ഀഊ { ਀                    ␀倀攀爀猀椀猀琀愀渀琀 㴀 ␀昀愀氀猀攀ഀഊ foreach ($piproute in $wmi_persistedroutes) ਀                    笀ഀഊ if (($iproute.Destination -eq $piproute.Destination) -and ਀                            ⠀␀椀瀀爀漀甀琀攀⸀䴀愀猀欀 ⴀ攀焀 ␀瀀椀瀀爀漀甀琀攀⸀䴀愀猀欀⤀ ⴀ愀渀搀ഀഊ ($iproute.NextHop -eq $piproute.NextHop)) ਀                        笀ഀഊ $Persistant = $true ਀                        紀ഀഊ } ਀                    ␀刀漀甀琀攀倀爀漀瀀攀爀琀礀 㴀 䀀笀ഀഊ 'InterfaceIndex' = $iproute.InterfaceIndex ਀                        ✀䐀攀猀琀椀渀愀琀椀漀渀✀ 㴀 ␀椀瀀爀漀甀琀攀⸀䐀攀猀琀椀渀愀琀椀漀渀ഀഊ 'Mask' = $iproute.Mask ਀                        ✀一攀砀琀䠀漀瀀✀ 㴀 ␀椀瀀爀漀甀琀攀⸀一攀砀琀䠀漀瀀ഀഊ 'Metric' = $iproute.Metric1 ਀                        ✀倀攀爀猀椀猀琀攀渀琀✀ 㴀 ␀倀攀爀猀椀猀琀愀渀琀ഀഊ 'Type' = $RouteType[[int]$iproute.Type] ਀                    紀ഀഊ $Routes += New-Object -TypeName PSObject -Property $RouteProperty ਀                紀ഀഊ # Setup the default properties for output ਀                ␀刀攀猀甀氀琀伀戀樀攀挀琀 㴀 一攀眀ⴀ伀戀樀攀挀琀 倀匀伀戀樀攀挀琀 ⴀ倀爀漀瀀攀爀琀礀 䀀笀ഀഊ 'PSComputerName' = $ComputerName ਀                                                                ✀䌀漀洀瀀甀琀攀爀一愀洀攀✀ 㴀 ␀䌀漀洀瀀甀琀攀爀一愀洀攀ഀഊ 'PSDateTime' = $PSDateTime ਀                                                                ✀刀漀甀琀攀猀✀ 㴀 ␀刀漀甀琀攀猀ഀഊ } ਀                ␀刀攀猀甀氀琀伀戀樀攀挀琀⸀倀匀伀戀樀攀挀琀⸀吀礀瀀攀一愀洀攀猀⸀䤀渀猀攀爀琀⠀ Ⰰ✀䴀礀⸀刀漀甀琀攀吀愀戀氀攀⸀䤀渀昀漀✀⤀ഀഊ $defaultDisplayPropertySet = New-Object System.Management.Automation.PSPropertySet('DefaultDisplayPropertySet',[string[]]$defaultProperties) ਀                ␀倀匀匀琀愀渀搀愀爀搀䴀攀洀戀攀爀猀 㴀 嬀匀礀猀琀攀洀⸀䴀愀渀愀最攀洀攀渀琀⸀䄀甀琀漀洀愀琀椀漀渀⸀倀匀䴀攀洀戀攀爀䤀渀昀漀嬀崀崀䀀⠀␀搀攀昀愀甀氀琀䐀椀猀瀀氀愀礀倀爀漀瀀攀爀琀礀匀攀琀⤀ഀഊ $ResultObject | Add-Member MemberSet PSStandardMembers $PSStandardMembers ਀                ⌀攀渀搀爀攀最椀漀渀 刀漀甀琀攀猀ഀഊ Write-Output -InputObject $ResultObject ਀            紀ഀഊ catch ਀            笀ഀഊ Write-Warning -Message ('Remote Route Table: {0}: {1}' -f $ComputerName, $_.Exception.Message) ਀            紀ഀഊ Write-Verbose -Message ('Remote Route Table: Runspace {0}: End' -f $ComputerName) ਀        紀ഀഊ ਀        䘀甀渀挀琀椀漀渀 䜀攀琀ⴀ刀攀猀甀氀琀ഀഊ { ਀            嬀䌀洀搀氀攀琀䈀椀渀搀椀渀最⠀⤀崀ഀഊ Param ਀            ⠀ഀഊ [switch]$Wait ਀            ⤀ഀഊ do ਀            笀ഀഊ $More = $false ਀                昀漀爀攀愀挀栀 ⠀␀爀甀渀猀瀀愀挀攀 椀渀 ␀爀甀渀猀瀀愀挀攀猀⤀ഀഊ { ਀                    ␀匀琀愀爀琀吀椀洀攀 㴀 ␀爀甀渀猀瀀愀挀攀琀椀洀攀爀猀嬀␀爀甀渀猀瀀愀挀攀⸀䤀䐀崀ഀഊ if ($runspace.Handle.isCompleted) ਀                    笀ഀഊ Write-Verbose -Message ('Remote Route Table: Thread done for {0}' -f $runspace.IObject) ਀                        ␀爀甀渀猀瀀愀挀攀⸀倀漀眀攀爀匀栀攀氀氀⸀䔀渀搀䤀渀瘀漀欀攀⠀␀爀甀渀猀瀀愀挀攀⸀䠀愀渀搀氀攀⤀ഀഊ $runspace.PowerShell.Dispose() ਀                        ␀爀甀渀猀瀀愀挀攀⸀倀漀眀攀爀匀栀攀氀氀 㴀 ␀渀甀氀氀ഀഊ $runspace.Handle = $null ਀                    紀ഀഊ elseif ($runspace.Handle -ne $null) ਀                    笀ഀഊ $More = $true ਀                    紀ഀഊ if ($Timeout -and $StartTime) ਀                    笀ഀഊ if ((New-TimeSpan -Start $StartTime).TotalSeconds -ge $Timeout -and $runspace.PowerShell) ਀                        笀ഀഊ Write-Warning -Message ('Timeout {0}' -f $runspace.IObject) ਀                            ␀爀甀渀猀瀀愀挀攀⸀倀漀眀攀爀匀栀攀氀氀⸀䐀椀猀瀀漀猀攀⠀⤀ഀഊ $runspace.PowerShell = $null ਀                            ␀爀甀渀猀瀀愀挀攀⸀䠀愀渀搀氀攀 㴀 ␀渀甀氀氀ഀഊ } ਀                    紀ഀഊ } ਀                椀昀 ⠀␀䴀漀爀攀 ⴀ愀渀搀 ␀倀匀䈀漀甀渀搀倀愀爀愀洀攀琀攀爀猀嬀✀圀愀椀琀✀崀⤀ഀഊ { ਀                    匀琀愀爀琀ⴀ匀氀攀攀瀀 ⴀ䴀椀氀氀椀猀攀挀漀渀搀猀 ㄀  ഀഊ } ਀                昀漀爀攀愀挀栀 ⠀␀琀栀爀攀愀琀 椀渀 ␀爀甀渀猀瀀愀挀攀猀⸀䌀氀漀渀攀⠀⤀⤀ഀഊ { ਀                    椀昀 ⠀ ⴀ渀漀琀 ␀琀栀爀攀愀琀⸀栀愀渀搀氀攀⤀ഀഊ { ਀                        圀爀椀琀攀ⴀ嘀攀爀戀漀猀攀 ⴀ䴀攀猀猀愀最攀 ⠀✀刀攀洀漀琀攀 刀漀甀琀攀 吀愀戀氀攀㨀 刀攀洀漀瘀椀渀最 笀 紀 昀爀漀洀 爀甀渀猀瀀愀挀攀猀✀ ⴀ昀 ␀琀栀爀攀愀琀⸀䤀伀戀樀攀挀琀⤀ഀഊ $runspaces.Remove($threat) ਀                    紀ഀഊ } ਀                椀昀 ⠀␀匀栀漀眀倀爀漀最爀攀猀猀⤀ഀഊ { ਀                    ␀倀爀漀最爀攀猀猀匀瀀氀愀琀琀椀渀最 㴀 䀀笀ഀഊ Activity = 'Remote Route Table: Getting info' ਀                        匀琀愀琀甀猀 㴀 ✀刀攀洀漀琀攀 刀漀甀琀攀 吀愀戀氀攀㨀 笀 紀 漀昀 笀㄀紀 琀漀琀愀氀 琀栀爀攀愀搀猀 搀漀渀攀✀ ⴀ昀 ⠀␀戀最刀甀渀猀瀀愀挀攀䌀漀甀渀琀攀爀 ⴀ ␀爀甀渀猀瀀愀挀攀猀⸀䌀漀甀渀琀⤀Ⰰ ␀戀最刀甀渀猀瀀愀挀攀䌀漀甀渀琀攀爀ഀഊ PercentComplete = ($bgRunspaceCounter - $runspaces.Count) / $bgRunspaceCounter * 100 ਀                    紀ഀഊ Write-Progress @ProgressSplatting ਀                紀ഀഊ } ਀            眀栀椀氀攀 ⠀␀䴀漀爀攀 ⴀ愀渀搀 ␀倀匀䈀漀甀渀搀倀愀爀愀洀攀琀攀爀猀嬀✀圀愀椀琀✀崀⤀ഀഊ } ਀    紀ഀഊ PROCESS ਀    笀ഀഊ foreach ($Computer in $ComputerName) ਀        笀ഀഊ $bgRunspaceCounter++ ਀            ␀瀀猀䌀䴀䐀 㴀 嬀匀礀猀琀攀洀⸀䴀愀渀愀最攀洀攀渀琀⸀䄀甀琀漀洀愀琀椀漀渀⸀倀漀眀攀爀匀栀攀氀氀崀㨀㨀䌀爀攀愀琀攀⠀⤀⸀䄀搀搀匀挀爀椀瀀琀⠀␀匀挀爀椀瀀琀䈀氀漀挀欀⤀ഀഊ $null = $psCMD.AddParameter('bgRunspaceID',$bgRunspaceCounter) ਀            ␀渀甀氀氀 㴀 ␀瀀猀䌀䴀䐀⸀䄀搀搀倀愀爀愀洀攀琀攀爀⠀✀䌀漀洀瀀甀琀攀爀一愀洀攀✀Ⰰ␀䌀漀洀瀀甀琀攀爀⤀ഀഊ $null = $psCMD.AddParameter('Verbose',$VerbosePreference) ਀            ␀瀀猀䌀䴀䐀⸀刀甀渀猀瀀愀挀攀倀漀漀氀 㴀 ␀爀瀀ഀഊ ਀            圀爀椀琀攀ⴀ嘀攀爀戀漀猀攀 ⴀ䴀攀猀猀愀最攀 ⠀✀刀攀洀漀琀攀 刀漀甀琀攀 吀愀戀氀攀㨀 匀琀愀爀琀椀渀最 笀 紀✀ ⴀ昀 ␀䌀漀洀瀀甀琀攀爀⤀ഀഊ [void]$runspaces.Add(@{ ਀                䠀愀渀搀氀攀 㴀 ␀瀀猀䌀䴀䐀⸀䈀攀最椀渀䤀渀瘀漀欀攀⠀⤀ഀഊ PowerShell = $psCMD ਀                䤀伀戀樀攀挀琀 㴀 ␀䌀漀洀瀀甀琀攀爀ഀഊ ID = $bgRunspaceCounter ਀           紀⤀ഀഊ Get-Result ਀        紀ഀഊ } ਀     䔀一䐀ഀഊ { ਀        䜀攀琀ⴀ刀攀猀甀氀琀 ⴀ圀愀椀琀ഀഊ if ($ShowProgress) ਀        笀ഀഊ Write-Progress -Activity 'Remote Route Table: Getting route table information' -Status 'Done' -Completed ਀        紀ഀഊ Write-Verbose -Message "Remote Route Table: Closing runspace pool" ਀        ␀爀瀀⸀䌀氀漀猀攀⠀⤀ഀഊ $rp.Dispose() ਀    紀ഀഊ} ਀䘀甀渀挀琀椀漀渀 䜀攀琀ⴀ刀攀洀漀琀攀匀挀栀攀搀甀氀攀搀吀愀猀欀猀 笀ഀഊ <# ਀    ⸀匀夀一伀倀匀䤀匀ഀഊ Gather scheduled task information from a remote system or systems. ਀    ⸀䐀䔀匀䌀刀䤀倀吀䤀伀一ഀഊ Gather scheduled task information from a remote system or systems. If remote credentials ਀        愀爀攀 瀀爀漀瘀椀搀攀搀 倀匀爀攀洀漀琀椀渀最 眀椀氀氀 戀攀 甀琀椀氀椀稀攀搀⸀ഀഊ .PARAMETER ComputerName ਀        匀瀀攀挀椀昀椀攀猀 琀栀攀 琀愀爀最攀琀 挀漀洀瀀甀琀攀爀 漀爀 挀漀洀瀀甀琀攀爀猀 昀漀爀 搀愀琀愀 焀甀攀爀礀⸀ഀഊ .PARAMETER UseRemoting ਀        伀瘀攀爀爀椀搀攀 搀攀昀愀甀氀琀猀 愀渀搀 甀猀攀 倀匀刀攀洀漀琀椀渀最⸀ 䤀昀 愀渀 愀氀琀攀爀渀愀琀攀 挀爀攀搀攀渀琀椀愀氀 椀猀 猀瀀攀挀椀昀椀攀搀 倀匀刀攀洀漀琀椀渀最 椀猀 愀猀猀甀洀攀搀⸀ഀഊ .PARAMETER ThrottleLimit ਀        匀瀀攀挀椀昀椀攀猀 琀栀攀 洀愀砀椀洀甀洀 渀甀洀戀攀爀 漀昀 猀礀猀琀攀洀猀 琀漀 椀渀瘀攀渀琀漀爀礀 猀椀洀甀氀琀愀渀攀漀甀猀氀礀ഀഊ .PARAMETER Timeout ਀        匀瀀攀挀椀昀椀攀猀 琀栀攀 洀愀砀椀洀甀洀 琀椀洀攀 椀渀 猀攀挀漀渀搀 挀漀洀洀愀渀搀 挀愀渀 爀甀渀 椀渀 戀愀挀欀最爀漀甀渀搀 戀攀昀漀爀攀 琀攀爀洀椀渀愀琀椀渀最 琀栀椀猀 琀栀爀攀愀搀⸀ഀഊ .PARAMETER ShowProgress ਀        匀栀漀眀 瀀爀漀最爀攀猀猀 戀愀爀 椀渀昀漀爀洀愀琀椀漀渀ഀഊ .EXAMPLE ਀        倀匀 㸀 ⠀䜀攀琀ⴀ刀攀洀漀琀攀匀挀栀攀搀甀氀攀搀吀愀猀欀猀⤀⸀吀愀猀欀猀 簀ഀഊ Where {(!$_.Hidden) -and ($_.Enabled) -and ($_.NextRunTime -ne 'None')} | ਀             匀攀氀攀挀琀 一愀洀攀Ⰰ䔀渀愀戀氀攀搀Ⰰ一攀砀琀刀甀渀吀椀洀攀Ⰰ䄀甀琀栀漀爀ഀഊ Name Enabled NextRunTime Author ਀        ⴀⴀⴀⴀ                     ⴀⴀⴀⴀⴀⴀⴀ   ⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀ               ⴀⴀⴀⴀⴀⴀ                  ഀഊ Adobe Flash Player Upd...True 10/4/2013 10:24:00 PM Adobe ਀      ഀഊ Description ਀        ⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀഀഊ Gathers all scheduled tasks then filters out all which are enabled, has a next ਀        爀甀渀 琀椀洀攀Ⰰ 愀渀搀 椀猀 渀漀琀 栀椀搀搀攀渀 愀渀搀 搀椀猀瀀氀愀礀猀 琀栀攀 爀攀猀甀氀琀 椀渀 愀 琀愀戀氀攀⸀ഀഊ .EXAMPLE ਀        倀匀 㸀 ␀挀爀攀搀 㴀 䜀攀琀ⴀ䌀爀攀搀攀渀琀椀愀氀ഀഊ PS > $Servers = @('SERVER1','SERVER2') ਀        倀匀 㸀 ␀愀 㴀 䜀攀琀ⴀ刀攀洀漀琀攀匀挀栀攀搀甀氀攀搀吀愀猀欀猀 ⴀ䌀爀攀搀攀渀琀椀愀氀 ␀挀爀攀搀 ⴀ䌀漀洀瀀甀琀攀爀一愀洀攀 ␀匀攀爀瘀攀爀猀ഀഊ Description ਀        ⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀⴀഀഊ Using an alternate credential (and thus PSremoting), $a gets assigned all of the ਀        猀挀栀攀搀甀氀攀搀 琀愀猀欀猀 昀爀漀洀 匀䔀刀嘀䔀刀㄀ 愀渀搀 匀䔀刀嘀䔀刀㈀⸀ഀഊ ਀    ⸀一伀吀䔀匀ഀഊ Author: Zachary Loeber ਀        匀椀琀攀㨀 栀琀琀瀀㨀⼀⼀眀眀眀⸀琀栀攀ⴀ氀椀琀琀氀攀ⴀ琀栀椀渀最猀⸀渀攀琀⼀ഀഊ Requires: Powershell 2.0 ਀        嘀攀爀猀椀漀渀 䠀椀猀琀漀爀礀ഀഊ 1.0.0 - 10/04/2013 ਀        ⴀ 䤀渀椀琀椀愀氀 爀攀氀攀愀猀攀ഀഊ ਀        一漀琀攀㨀ഀഊ ਀        䤀 甀猀攀搀 挀漀搀攀 昀爀漀洀 愀 昀攀眀 猀漀甀爀挀攀猀 琀漀 挀爀攀愀琀攀 琀栀椀猀 猀挀爀椀瀀琀㬀ഀഊ - http://p0w3rsh3ll.wordpress.com/2012/10/22/working-with-scheduled-tasks/ ਀            ⴀ 栀琀琀瀀㨀⼀⼀最愀氀氀攀爀礀⸀琀攀挀栀渀攀琀⸀洀椀挀爀漀猀漀昀琀⸀挀漀洀⼀䜀攀琀ⴀ匀挀栀攀搀甀氀攀搀ⴀ琀愀猀欀猀ⴀ昀爀漀洀ⴀ㌀愀㌀㜀㜀㈀㤀㐀ഀഊ ਀        䤀 眀愀猀 甀渀愀戀氀攀 琀漀 昀椀渀搀 猀攀瘀攀爀愀氀 漀昀 琀栀攀 吀愀猀欀 氀愀猀琀 攀砀椀琀 挀漀搀攀猀⸀ 䄀 最漀漀搀 渀甀洀戀攀爀 漀昀 琀栀攀洀ഀഊ from the following source have been included tough; ਀            ⴀ 栀琀琀瀀㨀⼀⼀洀猀搀渀⸀洀椀挀爀漀猀漀昀琀⸀挀漀洀⼀攀渀ⴀ甀猀⼀氀椀戀爀愀爀礀⼀眀椀渀搀漀眀猀⼀搀攀猀欀琀漀瀀⼀愀愀㌀㠀㌀㘀 㐀⠀瘀㴀瘀猀⸀㠀㔀⤀⸀愀猀瀀砀ഀഊ #> ਀    嬀挀洀搀氀攀琀戀椀渀搀椀渀最⠀⤀崀ഀഊ PARAM ਀    ⠀ഀഊ [Parameter(HelpMessage="Computer or computers to gather information from", ਀                   嘀愀氀甀攀䘀爀漀洀倀椀瀀攀氀椀渀攀㴀␀琀爀甀攀Ⰰഀഊ ValueFromPipelineByPropertyName=$true, ਀                   倀漀猀椀琀椀漀渀㴀 ⤀崀ഀഊ [ValidateNotNullOrEmpty()] ਀        嬀䄀氀椀愀猀⠀✀䐀一匀䠀漀猀琀一愀洀攀✀Ⰰ✀倀匀䌀漀洀瀀甀琀攀爀一愀洀攀✀⤀崀ഀഊ [string[]] ਀        ␀䌀漀洀瀀甀琀攀爀一愀洀攀㴀␀攀渀瘀㨀挀漀洀瀀甀琀攀爀渀愀洀攀Ⰰഀഊ [Parameter(HelpMessage="Override defaults and use PSRemoting. If an alternate credential is specified PSRemoting is assumed.")] ਀        嬀猀眀椀琀挀栀崀ഀഊ $UseRemoting, ਀       ഀഊ [Parameter(HelpMessage="Maximum number of concurrent threads")] ਀        嬀嘀愀氀椀搀愀琀攀刀愀渀最攀⠀㄀Ⰰ㘀㔀㔀㌀㔀⤀崀ഀഊ [int32] ਀        ␀吀栀爀漀琀琀氀攀䰀椀洀椀琀 㴀 ㌀㈀Ⰰഀഊ [Parameter(HelpMessage="Timeout before a thread stops trying to gather the information")] ਀        嬀嘀愀氀椀搀愀琀攀刀愀渀最攀⠀㄀Ⰰ㘀㔀㔀㌀㔀⤀崀ഀഊ [int32] ਀        ␀吀椀洀攀漀甀琀 㴀 ㄀㈀ Ⰰഀഊ [Parameter(HelpMessage="Display progress of function")] ਀        嬀猀眀椀琀挀栀崀ഀഊ $ShowProgress, ਀       ഀഊ [Parameter(HelpMessage="Set this if you want the function to prompt for alternate credentials")] ਀        嬀猀眀椀琀挀栀崀ഀഊ $PromptForCredential, ਀       ഀഊ [Parameter(HelpMessage="Set this if you want to provide your own alternate credentials")] ਀        嬀匀礀猀琀攀洀⸀䴀愀渀愀最攀洀攀渀琀⸀䄀甀琀漀洀愀琀椀漀渀⸀䌀爀攀搀攀渀琀椀愀氀⠀⤀崀ഀഊ $Credential = [System.Management.Automation.PSCredential]::Empty ਀    ⤀ഀഊ BEGIN ਀    笀ഀഊ $ProcessWithPSRemoting = $UseRemoting ਀        ␀䌀漀洀瀀甀琀攀爀一愀洀攀猀 㴀 䀀⠀⤀ഀഊ ਀        ⌀ 䜀愀琀栀攀爀 瀀漀猀猀椀戀氀攀 氀漀挀愀氀 栀漀猀琀 渀愀洀攀猀 愀渀搀 䤀倀猀 琀漀 瀀爀攀瘀攀渀琀 挀爀攀搀攀渀琀椀愀氀 甀琀椀氀椀稀愀琀椀漀渀 椀渀 猀漀洀攀 挀愀猀攀猀ഀഊ Write-Verbose -Message 'Scheduled Tasks: Creating local hostname list' ਀       ഀഊ $IPAddresses = [net.dns]::GetHostAddresses($env:COMPUTERNAME) | Select-Object -ExpandProperty IpAddressToString ਀        ␀䠀漀猀琀一愀洀攀猀 㴀 ␀䤀倀䄀搀搀爀攀猀猀攀猀 簀 䘀漀爀䔀愀挀栀ⴀ伀戀樀攀挀琀 笀ഀഊ try { ਀                嬀渀攀琀⸀搀渀猀崀㨀㨀䜀攀琀䠀漀猀琀䈀礀䄀搀搀爀攀猀猀⠀␀开⤀ഀഊ } catch { ਀                ⌀ 圀攀 搀漀 渀漀琀 挀愀爀攀 愀戀漀甀琀 攀爀爀漀爀猀 栀攀爀攀⸀⸀⸀ഀഊ } ਀        紀 簀 匀攀氀攀挀琀ⴀ伀戀樀攀挀琀 ⴀ䔀砀瀀愀渀搀倀爀漀瀀攀爀琀礀 䠀漀猀琀一愀洀攀 ⴀ唀渀椀焀甀攀ഀഊ $LocalHost = @('', '.', 'localhost', $env:COMPUTERNAME, '::1', '127.0.0.1') + $IPAddresses + $HostNames ਀ ഀഊ Write-Verbose -Message 'Scheduled Tasks: Creating initial variables' ਀        ␀爀甀渀猀瀀愀挀攀琀椀洀攀爀猀       㴀 嬀䠀愀猀栀吀愀戀氀攀崀㨀㨀匀礀渀挀栀爀漀渀椀稀攀搀⠀䀀笀紀⤀ഀഊ $runspaces = New-Object -TypeName System.Collections.ArrayList ਀        ␀戀最刀甀渀猀瀀愀挀攀䌀漀甀渀琀攀爀    㴀  ഀഊ ਀        椀昀 ⠀␀倀爀漀洀瀀琀䘀漀爀䌀爀攀搀攀渀琀椀愀氀⤀ഀഊ { ਀            ␀䌀爀攀搀攀渀琀椀愀氀 㴀 䜀攀琀ⴀ䌀爀攀搀攀渀琀椀愀氀ഀഊ $ProcessWithPSRemoting = $true ਀        紀ഀഊ ਀        圀爀椀琀攀ⴀ嘀攀爀戀漀猀攀 ⴀ䴀攀猀猀愀最攀 ✀匀挀栀攀搀甀氀攀搀 吀愀猀欀猀㨀 䌀爀攀愀琀椀渀最 䤀渀椀琀椀愀氀 匀攀猀猀椀漀渀 匀琀愀琀攀✀ഀഊ $iss = [System.Management.Automation.Runspaces.InitialSessionState]::CreateDefault() ਀        昀漀爀攀愀挀栀 ⠀␀䔀砀琀攀爀渀愀氀嘀愀爀椀愀戀氀攀 椀渀 ⠀✀爀甀渀猀瀀愀挀攀琀椀洀攀爀猀✀Ⰰ ✀䌀爀攀搀攀渀琀椀愀氀✀Ⰰ ✀䰀漀挀愀氀䠀漀猀琀✀⤀⤀ഀഊ { ਀            圀爀椀琀攀ⴀ嘀攀爀戀漀猀攀 ⴀ䴀攀猀猀愀最攀 ∀匀挀栀攀搀甀氀攀搀 吀愀猀欀猀㨀 䄀搀搀椀渀最 瘀愀爀椀愀戀氀攀 ␀䔀砀琀攀爀渀愀氀嘀愀爀椀愀戀氀攀 琀漀 椀渀椀琀椀愀氀 猀攀猀猀椀漀渀 猀琀愀琀攀∀ഀഊ $iss.Variables.Add((New-Object -TypeName System.Management.Automation.Runspaces.SessionStateVariableEntry -ArgumentList $ExternalVariable, (Get-Variable -Name $ExternalVariable -ValueOnly), '')) ਀        紀ഀഊ ਀        圀爀椀琀攀ⴀ嘀攀爀戀漀猀攀 ⴀ䴀攀猀猀愀最攀 ✀匀挀栀攀搀甀氀攀搀 吀愀猀欀猀㨀 䌀爀攀愀琀椀渀最 爀甀渀猀瀀愀挀攀 瀀漀漀氀✀ഀഊ $rp = [System.Management.Automation.Runspaces.RunspaceFactory]::CreateRunspacePool(1, $ThrottleLimit, $iss, $Host) ਀        ␀爀瀀⸀䄀瀀愀爀琀洀攀渀琀匀琀愀琀攀 㴀 ✀匀吀䄀✀ഀഊ $rp.Open() ਀ ഀഊ # This is the actual code called for each computer ਀        圀爀椀琀攀ⴀ嘀攀爀戀漀猀攀 ⴀ䴀攀猀猀愀最攀 ✀匀挀栀攀搀甀氀攀搀 吀愀猀欀猀㨀 䐀攀昀椀渀椀渀最 戀愀挀欀最爀漀甀渀搀 爀甀渀猀瀀愀挀攀猀 猀挀爀椀瀀琀戀氀漀挀欀✀ഀഊ $ScriptBlock = ਀        笀ഀഊ Param ਀            ⠀ഀഊ [Parameter(Position=0)] ਀                嬀猀琀爀椀渀最崀ഀഊ $ComputerName, ਀ ഀഊ [Parameter(Position=1)] ਀                嬀椀渀琀崀ഀഊ $bgRunspaceID, ਀               ഀഊ [Parameter()] ਀                嬀猀眀椀琀挀栀崀ഀഊ $UseRemoting ਀            ⤀ഀഊ $runspacetimers.$bgRunspaceID = Get-Date ਀            ␀䜀攀琀匀挀栀攀搀甀氀攀搀吀愀猀欀 㴀 笀ഀഊ param( ਀                     ␀挀漀洀瀀甀琀攀爀渀愀洀攀 㴀 ∀氀漀挀愀氀栀漀猀琀∀ഀഊ ) ਀                䘀甀渀挀琀椀漀渀 䜀攀琀ⴀ吀愀猀欀匀甀戀䘀漀氀搀攀爀猀ഀഊ { ਀                    瀀愀爀愀洀⠀                      ഀഊ [string]$folder = '\', ਀                        嬀猀眀椀琀挀栀崀␀爀攀挀甀爀猀攀ഀഊ ) ਀                    ␀昀漀氀搀攀爀ഀഊ if ($recurse) ਀                    笀ഀഊ $TaskService.GetFolder($folder).GetFolders(0) | ਀                        䘀漀爀䔀愀挀栀ⴀ伀戀樀攀挀琀 笀ഀഊ Get-TaskSubFolders $_.Path -Recurse ਀                        紀ഀഊ } ਀                    攀氀猀攀ഀഊ { ਀                        ␀吀愀猀欀匀攀爀瘀椀挀攀⸀䜀攀琀䘀漀氀搀攀爀⠀␀昀漀氀搀攀爀⤀⸀䜀攀琀䘀漀氀搀攀爀猀⠀ ⤀ഀഊ } ਀                紀ഀഊ try ਀                笀ഀഊ $TaskService = new-object -com("Schedule.Service") ਀                    ␀吀愀猀欀匀攀爀瘀椀挀攀⸀挀漀渀渀攀挀琀⠀␀䌀漀洀瀀甀琀攀爀一愀洀攀⤀ഀഊ $AllFolders = Get-TaskSubFolders -Recurse ਀                    ␀吀愀猀欀刀攀猀甀氀琀猀 㴀 䀀⠀⤀ഀഊ foreach ($Folder in $AllFolders) ਀                    笀ഀഊ $TaskService.GetFolder($Folder).GetTasks(1) | ਀                        䘀漀爀攀愀挀栀ⴀ伀戀樀攀挀琀 笀ഀഊ switch ([int]$_.State) ਀                            笀ഀഊ 0 { $State = 'Unknown'} ਀                                ㄀ 笀 ␀匀琀愀琀攀 㴀 ✀䐀椀猀愀戀氀攀搀✀紀ഀഊ 2 { $State = 'Queued'} ਀                                ㌀ 笀 ␀匀琀愀琀攀 㴀 ✀刀攀愀搀礀✀紀ഀഊ 4 { $State = 'Running'} ਀                                搀攀昀愀甀氀琀 笀␀匀琀愀琀攀 㴀 ␀开 紀ഀഊ } ਀                           ഀഊ switch ($_.NextRunTime) ਀                            笀ഀഊ (Get-Date -Year 1899 -Month 12 -Day 30 -Minute 00 -Hour 00 -Second 00) {$NextRunTime = "None"} ਀                                搀攀昀愀甀氀琀 笀␀一攀砀琀刀甀渀吀椀洀攀 㴀 ␀开紀ഀഊ } ਀                            ഀഊ switch ($_.LastRunTime) ਀                            笀ഀഊ (Get-Date -Year 1899 -Month 12 -Day 30 -Minute 00 -Hour 00 -Second 00) {$LastRunTime = "Never"} ਀                                搀攀昀愀甀氀琀 笀␀䰀愀猀琀刀甀渀吀椀洀攀 㴀 ␀开紀ഀഊ } ਀                            猀眀椀琀挀栀 ⠀⠀嬀砀洀氀崀␀开⸀堀䴀䰀⤀⸀吀愀猀欀⸀刀攀最椀猀琀爀愀琀椀漀渀䤀渀昀漀⸀䄀甀琀栀漀爀⤀ഀഊ { ਀                                ✀␀⠀䀀─倀爀漀最爀愀洀䘀椀氀攀猀─尀圀椀渀搀漀眀猀 䴀攀搀椀愀 倀氀愀礀攀爀尀眀洀瀀渀猀挀昀最⸀攀砀攀Ⰰⴀ㄀  ㄀⤀✀   笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%systemroot%\system32\acproxy.dll,-101)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─匀礀猀琀攀洀刀漀漀琀─尀猀礀猀琀攀洀㌀㈀尀愀攀瀀搀甀⸀搀氀氀Ⰰⴀ㜀 ㄀⤀✀                     笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%SystemRoot%\system32\aitagent.exe,-701)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─猀礀猀琀攀洀爀漀漀琀─尀猀礀猀琀攀洀㌀㈀尀愀瀀瀀椀搀猀瘀挀⸀搀氀氀Ⰰⴀ㈀ ㄀⤀✀                  笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%systemroot%\system32\appidsvc.dll,-301)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─匀礀猀琀攀洀刀漀漀琀─尀匀礀猀琀攀洀㌀㈀尀䄀甀砀椀氀椀愀爀礀䐀椀猀瀀氀愀礀匀攀爀瘀椀挀攀猀⸀搀氀氀Ⰰⴀ㄀  ㄀⤀✀ 笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%SystemRoot%\system32\bfe.dll,-2001)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─匀礀猀琀攀洀刀漀漀琀─尀猀礀猀琀攀洀㌀㈀尀䈀琀栀唀搀吀愀猀欀⸀攀砀攀Ⰰⴀ㄀  ㈀⤀✀                笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%systemroot%\system32\cscui.dll,-5001)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─匀礀猀琀攀洀刀漀漀琀─尀匀礀猀琀攀洀㌀㈀尀䐀䘀䐀吀匀⸀搀氀氀Ⰰⴀ㄀ ㄀⤀✀                     笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%SystemRoot%\system32\dimsjob.dll,-101)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─猀礀猀琀攀洀爀漀漀琀─尀猀礀猀琀攀洀㌀㈀尀搀瀀猀⸀搀氀氀Ⰰⴀ㘀  ⤀✀                       笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%SystemRoot%\system32\drivers\tcpip.sys,-10000)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─猀礀猀琀攀洀爀漀漀琀─尀猀礀猀琀攀洀㌀㈀尀搀攀昀爀愀最猀瘀挀⸀搀氀氀Ⰰⴀ㠀 ㄀⤀✀                 笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%systemRoot%\system32\energy.dll,-103)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─匀礀猀琀攀洀刀漀漀琀─尀猀礀猀琀攀洀㌀㈀尀䠀漀琀匀琀愀爀琀唀猀攀爀䄀最攀渀琀⸀搀氀氀Ⰰⴀ㔀 ㈀⤀✀         笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%SystemRoot%\system32\kernelceip.dll,-600)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─猀礀猀琀攀洀刀漀漀琀─尀匀礀猀琀攀洀㌀㈀尀氀瀀爀攀洀漀瘀攀⸀攀砀攀Ⰰⴀ㄀  ⤀✀                  笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%SystemRoot%\system32\memdiag.dll,-230)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─匀礀猀琀攀洀刀漀漀琀─尀猀礀猀琀攀洀㌀㈀尀洀猀挀洀猀⸀搀氀氀Ⰰⴀ㈀ ㄀⤀✀                     笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%systemRoot%\System32\msdrm.dll,-6001)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─猀礀猀琀攀洀爀漀漀琀─尀猀礀猀琀攀洀㌀㈀尀洀猀爀愀⸀攀砀攀Ⰰⴀ㘀㠀㘀⤀✀                      笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%SystemRoot%\system32\nettrace.dll,-6911)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─猀礀猀琀攀洀爀漀漀琀─尀猀礀猀琀攀洀㌀㈀尀漀猀瀀瀀挀⸀搀氀氀Ⰰⴀ㈀  ⤀✀                     笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%systemRoot%\System32\perftrack.dll,-2003)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─猀礀猀琀攀洀爀漀漀琀─尀猀礀猀琀攀洀㌀㈀尀倀漀爀琀愀戀氀攀䐀攀瘀椀挀攀䄀瀀椀⸀搀氀氀Ⰰⴀ㄀ ㈀⤀✀         笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%SystemRoot%\system32\profsvc,-500)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─匀礀猀琀攀洀刀漀漀琀─尀猀礀猀琀攀洀㌀㈀尀刀愀挀䔀渀最渀⸀搀氀氀Ⰰⴀ㔀 ㄀⤀✀                   笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%SystemRoot%\system32\rasmbmgr.dll,-201)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─猀礀猀琀攀洀爀漀漀琀─尀猀礀猀琀攀洀㌀㈀尀爀攀最椀搀氀攀⸀搀氀氀Ⰰⴀ㘀  ⤀✀                   笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%systemroot%\system32\sdclt.exe,-2193)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─猀礀猀琀攀洀爀漀漀琀─尀猀礀猀琀攀洀㌀㈀尀猀搀椀愀最猀挀栀搀⸀搀氀氀Ⰰⴀ㄀ ㄀⤀✀                 笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%systemroot%\system32\sppc.dll,-200)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─猀礀猀琀攀洀爀漀漀琀─尀猀礀猀琀攀洀㌀㈀尀猀爀爀猀琀爀⸀搀氀氀Ⰰⴀ㌀㈀㄀⤀✀                    笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%systemroot%\system32\upnphost.dll,-215)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─匀礀猀琀攀洀刀漀漀琀─尀猀礀猀琀攀洀㌀㈀尀甀猀戀挀攀椀瀀⸀搀氀氀Ⰰⴀ㘀  ⤀✀                   笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%systemroot%\system32\w32time.dll,-202)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─猀礀猀琀攀洀爀漀漀琀─尀猀礀猀琀攀洀㌀㈀尀眀搀挀⸀搀氀氀Ⰰⴀ㄀  㐀㄀⤀✀                     笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%SystemRoot%\system32\wer.dll,-293)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─匀礀猀琀攀洀刀漀漀琀─尀匀礀猀琀攀洀㌀㈀尀眀瀀挀洀椀最⸀搀氀氀Ⰰⴀ㌀ ㄀⤀✀                    笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%SystemRoot%\System32\wpcumi.dll,-301)' { $Author = 'Microsoft Corporation'} ਀                                ✀␀⠀䀀─猀礀猀琀攀洀爀漀漀琀─尀猀礀猀琀攀洀㌀㈀尀眀椀渀猀愀琀愀瀀椀⸀搀氀氀Ⰰⴀ㄀㄀㈀⤀✀                 笀 ␀䄀甀琀栀漀爀 㴀 ✀䴀椀挀爀漀猀漀昀琀 䌀漀爀瀀漀爀愀琀椀漀渀✀紀ഀഊ '$(@%SystemRoot%\system32\wat\WatUX.exe,-702)' { $Author = 'Microsoft Corporation'} ਀                                搀攀昀愀甀氀琀 笀␀䄀甀琀栀漀爀 㴀 ␀开 紀                                  ഀഊ } ਀                            猀眀椀琀挀栀 ⠀⠀嬀砀洀氀崀␀开⸀堀䴀䰀⤀⸀吀愀猀欀⸀刀攀最椀猀琀爀愀琀椀漀渀䤀渀昀漀⸀䐀愀琀攀⤀ഀഊ { ਀                                ✀✀      笀␀䌀爀攀愀琀攀搀 㴀 ✀唀渀欀渀漀眀渀✀紀ഀഊ default {$Created = Get-Date -Date $_ } ਀                            紀ഀഊ Switch (([xml]$_.XML).Task.Settings.Hidden) ਀                            笀ഀഊ false { $Hidden = $false} ਀                                琀爀甀攀  笀 ␀䠀椀搀搀攀渀 㴀 ␀琀爀甀攀 紀ഀഊ default { $Hidden = $false} ਀                            紀ഀഊ Switch (([xml]$_.xml).Task.Principals.Principal.UserID) ਀                            笀ഀഊ 'S-1-5-18' {$userid = 'Local System'} ਀                                ✀匀ⴀ㄀ⴀ㔀ⴀ㄀㤀✀ 笀␀甀猀攀爀椀搀 㴀 ✀䰀漀挀愀氀 匀攀爀瘀椀挀攀✀紀ഀഊ 'S-1-5-20' {$userid = 'Network Service'} ਀                                搀攀昀愀甀氀琀    笀␀甀猀攀爀椀搀 㴀 ␀开 紀ഀഊ } ਀                            匀眀椀琀挀栀 ⠀␀开⸀氀愀猀琀琀愀猀欀爀攀猀甀氀琀⤀ഀഊ { ਀                                ✀ ✀ 笀 ␀䰀愀猀琀吀愀猀欀䐀攀琀愀椀氀猀 㴀 ✀吀栀攀 漀瀀攀爀愀琀椀漀渀 挀漀洀瀀氀攀琀攀搀 猀甀挀挀攀猀猀昀甀氀氀礀⸀✀ 紀ഀഊ '1' { $LastTaskDetails = 'Incorrect function called or unknown function called.' } ਀                                ✀㈀✀ 笀 ␀䰀愀猀琀吀愀猀欀䐀攀琀愀椀氀猀 㴀 ✀䘀椀氀攀 渀漀琀 昀漀甀渀搀⸀✀ 紀ഀഊ '10' { $LastTaskDetails = 'The environment is incorrect.' } ਀                                ✀㈀㘀㜀  㠀✀ 笀 ␀䰀愀猀琀吀愀猀欀䐀攀琀愀椀氀猀 㴀 ✀吀愀猀欀 椀猀 爀攀愀搀礀 琀漀 爀甀渀 愀琀 椀琀猀 渀攀砀琀 猀挀栀攀搀甀氀攀搀 琀椀洀攀⸀✀ 紀ഀഊ '267009' { $LastTaskDetails = 'Task is currently running.' } ਀                                ✀㈀㘀㜀 ㄀ ✀ 笀 ␀䰀愀猀琀吀愀猀欀䐀攀琀愀椀氀猀 㴀 ✀吀栀攀 琀愀猀欀 眀椀氀氀 渀漀琀 爀甀渀 愀琀 琀栀攀 猀挀栀攀搀甀氀攀搀 琀椀洀攀猀 戀攀挀愀甀猀攀 椀琀 栀愀猀 戀攀攀渀 搀椀猀愀戀氀攀搀⸀✀ 紀ഀഊ '267011' { $LastTaskDetails = 'Task has not yet run.' } ਀                                ✀㈀㘀㜀 ㄀㈀✀ 笀 ␀䰀愀猀琀吀愀猀欀䐀攀琀愀椀氀猀 㴀 ✀吀栀攀爀攀 愀爀攀 渀漀 洀漀爀攀 爀甀渀猀 猀挀栀攀搀甀氀攀搀 昀漀爀 琀栀椀猀 琀愀猀欀⸀✀ 紀ഀഊ '267013' { $LastTaskDetails = 'One or more of the properties that are needed to run this task on a schedule have not been set.' } ਀                                ✀㈀㘀㜀 ㄀㐀✀ 笀 ␀䰀愀猀琀吀愀猀欀䐀攀琀愀椀氀猀 㴀 ✀吀栀攀 氀愀猀琀 爀甀渀 漀昀 琀栀攀 琀愀猀欀 眀愀猀 琀攀爀洀椀渀愀琀攀搀 戀礀 琀栀攀 甀猀攀爀⸀✀ 紀ഀഊ '267015' { $LastTaskDetails = 'Either the task has no triggers or the existing triggers are disabled or not set.' } ਀                                ✀㈀㄀㐀㜀㜀㔀 㘀㜀㄀✀ 笀 ␀䰀愀猀琀吀愀猀欀䐀攀琀愀椀氀猀 㴀 ✀䌀爀攀搀攀渀琀椀愀氀猀 戀攀挀愀洀攀 挀漀爀爀甀瀀琀攀搀⸀✀ 紀ഀഊ '2147750687' { $LastTaskDetails = 'An instance of this task is already running.' } ਀                                ✀㈀㄀㐀㜀㤀㐀㌀㘀㐀㔀✀ 笀 ␀䰀愀猀琀吀愀猀欀䐀攀琀愀椀氀猀 㴀 ✀吀栀攀 猀攀爀瘀椀挀攀 椀猀 渀漀琀 愀瘀愀椀氀愀戀氀攀 ⠀椀猀 ∀刀甀渀 漀渀氀礀 眀栀攀渀 愀渀 甀猀攀爀 椀猀 氀漀最最攀搀 漀渀∀ 挀栀攀挀欀攀搀㼀⤀⸀✀ 紀ഀഊ '3221225786' { $LastTaskDetails = 'The application terminated as a result of a CTRL+C.' } ਀                                ✀㌀㈀㈀㠀㌀㘀㤀 ㈀㈀✀ 笀 ␀䰀愀猀琀吀愀猀欀䐀攀琀愀椀氀猀 㴀 ✀唀渀欀渀漀眀渀 猀漀昀琀眀愀爀攀 攀砀挀攀瀀琀椀漀渀⸀✀ 紀ഀഊ default {$LastTaskDetails = $_ } ਀                            紀ഀഊ $TaskProps = @{ ਀                                ✀一愀洀攀✀ 㴀 ␀开⸀渀愀洀攀ഀഊ 'Path' = $_.path ਀                                ✀匀琀愀琀攀✀ 㴀 ␀匀琀愀琀攀ഀഊ 'Created' = $Created ਀                                ✀䔀渀愀戀氀攀搀✀ 㴀 ␀开⸀攀渀愀戀氀攀搀ഀഊ 'Hidden' = $Hidden ਀                                ✀䰀愀猀琀刀甀渀吀椀洀攀✀ 㴀 ␀䰀愀猀琀刀甀渀吀椀洀攀ഀഊ 'LastTaskResult' = $_.lasttaskresult ਀                                ✀䰀愀猀琀吀愀猀欀䐀攀琀愀椀氀猀✀ 㴀 ␀䰀愀猀琀吀愀猀欀䐀攀琀愀椀氀猀ഀഊ 'NumberOfMissedRuns' = $_.numberofmissedruns ਀                                ✀一攀砀琀刀甀渀吀椀洀攀✀ 㴀 ␀一攀砀琀刀甀渀吀椀洀攀ഀഊ 'Author' = $Author ਀                                ✀唀猀攀爀䤀搀✀ 㴀 ␀唀猀攀爀䤀䐀ഀഊ 'Description' = ([xml]$_.xml).Task.RegistrationInfo.Description ਀                            紀ഀഊ $TaskResults += New-Object PSCustomObject -Property $TaskProps ਀                        紀ഀഊ } ਀                    圀爀椀琀攀ⴀ伀甀琀瀀甀琀 ⴀ䤀渀瀀甀琀伀戀樀攀挀琀 ␀吀愀猀欀刀攀猀甀氀琀猀ഀഊ } ਀                挀愀琀挀栀ഀഊ { ਀                    圀爀椀琀攀ⴀ圀愀爀渀椀渀最 ⴀ䴀攀猀猀愀最攀 ⠀✀匀挀栀攀搀甀氀攀搀 吀愀猀欀猀㨀 笀 紀㨀 笀㄀紀✀ ⴀ昀 ␀䌀漀洀瀀甀琀攀爀一愀洀攀Ⰰ ␀开⸀䔀砀挀攀瀀琀椀漀渀⸀䴀攀猀猀愀最攀⤀ഀഊ } ਀            紀ഀഊ try ਀            笀ഀഊ Write-Verbose -Message ('Scheduled Tasks: Runspace {0}: Start' -f $ComputerName) ਀                ␀刀攀洀漀琀攀匀瀀氀愀琀 㴀 䀀笀ഀഊ ComputerName = $ComputerName ਀                    䔀爀爀漀爀䄀挀琀椀漀渀 㴀 ✀匀琀漀瀀✀ഀഊ } ਀                ␀倀爀漀挀攀猀猀圀椀琀栀倀匀刀攀洀漀琀椀渀最 㴀 ␀唀猀攀刀攀洀漀琀椀渀最ഀഊ if (($LocalHost -notcontains $ComputerName) -and ਀                    ⠀␀䌀爀攀搀攀渀琀椀愀氀 ⴀ渀攀 嬀匀礀猀琀攀洀⸀䴀愀渀愀最攀洀攀渀琀⸀䄀甀琀漀洀愀琀椀漀渀⸀倀匀䌀爀攀搀攀渀琀椀愀氀崀㨀㨀䔀洀瀀琀礀⤀⤀ഀഊ { ਀                    ␀刀攀洀漀琀攀匀瀀氀愀琀⸀䌀爀攀搀攀渀琀椀愀氀 㴀 ␀䌀爀攀搀攀渀琀椀愀氀ഀഊ $ProcessWithPSRemoting = $true ਀                紀ഀഊ Write-Verbose -Message ('Scheduled Tasks: Runspace {0}: information' -f $ComputerName) ਀                ␀倀匀䐀愀琀攀吀椀洀攀 㴀 䜀攀琀ⴀ䐀愀琀攀ഀഊ $defaultProperties = @('ComputerName','Tasks') ਀              椀昀 ⠀␀倀爀漀挀攀猀猀圀椀琀栀倀匀刀攀洀漀琀椀渀最⤀ഀഊ { ਀                    圀爀椀琀攀ⴀ嘀攀爀戀漀猀攀 ⴀ䴀攀猀猀愀最攀 ⠀✀匀挀栀攀搀甀氀攀搀 吀愀猀欀猀㨀 唀猀椀渀最 倀匀爀攀洀漀琀椀渀最 漀渀 笀 紀✀ ⴀ昀 ␀䌀漀洀瀀甀琀攀爀一愀洀攀⤀ഀഊ $Results = @(Invoke-Command @RemoteSplat ` ਀                                                 ⴀ匀挀爀椀瀀琀䈀氀漀挀欀  ␀䜀攀琀匀挀栀攀搀甀氀攀搀吀愀猀欀 怀ഀഊ -ArgumentList 'localhost') ਀                    ␀倀匀䌀漀渀渀攀挀琀椀漀渀 㴀 ✀倀匀刀攀洀漀琀椀渀最✀ഀഊ } ਀                攀氀猀攀ഀഊ { ਀                    圀爀椀琀攀ⴀ嘀攀爀戀漀猀攀 ⴀ䴀攀猀猀愀最攀 ⠀✀匀挀栀攀搀甀氀攀搀 吀愀猀欀猀㨀 䐀椀爀攀挀琀氀礀 挀漀渀渀攀挀琀椀渀最 琀漀 笀 紀✀ ⴀ昀 ␀䌀漀洀瀀甀琀攀爀一愀洀攀⤀ഀഊ $Results = @(&$GetScheduledTask -ComputerName $ComputerName) ਀                    ␀倀匀䌀漀渀渀攀挀琀椀漀渀 㴀 ✀䐀椀爀攀挀琀✀ഀഊ } ਀               ഀഊ $ResultProperty = @{ ਀                    ✀倀匀䌀漀洀瀀甀琀攀爀一愀洀攀✀㴀 ␀䌀漀洀瀀甀琀攀爀一愀洀攀ഀഊ 'PSDateTime' = $PSDateTime ਀                    ✀倀匀䌀漀渀渀攀挀琀椀漀渀✀  㴀 ␀倀匀䌀漀渀渀攀挀琀椀漀渀ഀഊ 'ComputerName' = $ComputerName ਀                    ✀吀愀猀欀猀✀         㴀 ␀刀攀猀甀氀琀猀                   ഀഊ } ਀                ␀刀攀猀甀氀琀伀戀樀攀挀琀 㴀 一攀眀ⴀ伀戀樀攀挀琀 ⴀ吀礀瀀攀一愀洀攀 倀匀伀戀樀攀挀琀 ⴀ倀爀漀瀀攀爀琀礀 ␀刀攀猀甀氀琀倀爀漀瀀攀爀琀礀ഀഊ ਀                ⌀ 匀攀琀甀瀀 琀栀攀 搀攀昀愀甀氀琀 瀀爀漀瀀攀爀琀椀攀猀 昀漀爀 漀甀琀瀀甀琀ഀഊ $ResultObject.PSObject.TypeNames.Insert(0,'My.ScheduledTask.Info') ਀                ␀搀攀昀愀甀氀琀䐀椀猀瀀氀愀礀倀爀漀瀀攀爀琀礀匀攀琀 㴀 一攀眀ⴀ伀戀樀攀挀琀 匀礀猀琀攀洀⸀䴀愀渀愀最攀洀攀渀琀⸀䄀甀琀漀洀愀琀椀漀渀⸀倀匀倀爀漀瀀攀爀琀礀匀攀琀⠀✀䐀攀昀愀甀氀琀䐀椀猀瀀氀愀礀倀爀漀瀀攀爀琀礀匀攀琀✀Ⰰ嬀猀琀爀椀渀最嬀崀崀␀搀攀昀愀甀氀琀倀爀漀瀀攀爀琀椀攀猀⤀ഀഊ $PSStandardMembers = [System.Management.Automation.PSMemberInfo[]]@($defaultDisplayPropertySet) ਀                ␀刀攀猀甀氀琀伀戀樀攀挀琀 簀 䄀搀搀ⴀ䴀攀洀戀攀爀 䴀攀洀戀攀爀匀攀琀 倀匀匀琀愀渀搀愀爀搀䴀攀洀戀攀爀猀 ␀倀匀匀琀愀渀搀愀爀搀䴀攀洀戀攀爀猀ഀഊ Write-Output -InputObject $ResultObject ਀            紀           ഀഊ catch ਀            笀ഀഊ Write-Warning -Message ('Scheduled Tasks: {0}: {1}' -f $ComputerName, $_.Exception.Message) ਀            紀ഀഊ Write-Verbose -Message ('Scheduled Tasks: Runspace {0}: End' -f $ComputerName) ਀        紀ഀഊ ਀        䘀甀渀挀琀椀漀渀 䜀攀琀ⴀ刀攀猀甀氀琀ഀഊ { ਀            嬀䌀洀搀氀攀琀䈀椀渀搀椀渀最⠀⤀崀ഀഊ Param ਀            ⠀ഀഊ [switch]$Wait ਀            ⤀ഀഊ do ਀            笀ഀഊ $More = $false ਀                昀漀爀攀愀挀栀 ⠀␀爀甀渀猀瀀愀挀攀 椀渀 ␀爀甀渀猀瀀愀挀攀猀⤀ഀഊ { ਀                    ␀匀琀愀爀琀吀椀洀攀 㴀 ␀爀甀渀猀瀀愀挀攀琀椀洀攀爀猀⸀⠀␀爀甀渀猀瀀愀挀攀⸀䤀䐀⤀ഀഊ if ($runspace.Handle.isCompleted) ਀                    笀ഀഊ Write-Verbose -Message ('Scheduled Tasks: Thread done for {0}' -f $runspace.IObject) ਀                        ␀爀甀渀猀瀀愀挀攀⸀倀漀眀攀爀匀栀攀氀氀⸀䔀渀搀䤀渀瘀漀欀攀⠀␀爀甀渀猀瀀愀挀攀⸀䠀愀渀搀氀攀⤀ഀഊ $runspace.PowerShell.Dispose() ਀                        ␀爀甀渀猀瀀愀挀攀⸀倀漀眀攀爀匀栀攀氀氀 㴀 ␀渀甀氀氀ഀഊ $runspace.Handle = $null ਀                    紀ഀഊ elseif ($runspace.Handle -ne $null) ਀                    笀ഀഊ $More = $true ਀                    紀ഀഊ if ($Timeout -and $StartTime) ਀                    笀ഀഊ if ((New-TimeSpan -Start $StartTime).TotalSeconds -ge $Timeout -and $runspace.PowerShell) ਀                        笀ഀഊ Write-Warning -Message ('Timeout {0}' -f $runspace.IObject) ਀                            ␀爀甀渀猀瀀愀挀攀⸀倀漀眀攀爀匀栀攀氀氀⸀䐀椀猀瀀漀猀攀⠀⤀ഀഊ $runspace.PowerShell = $null ਀                            ␀爀甀渀猀瀀愀挀攀⸀䠀愀渀搀氀攀 㴀 ␀渀甀氀氀ഀഊ } ਀                    紀ഀഊ } ਀                椀昀 ⠀␀䴀漀爀攀 ⴀ愀渀搀 ␀倀匀䈀漀甀渀搀倀愀爀愀洀攀琀攀爀猀嬀✀圀愀椀琀✀崀⤀ഀഊ { ਀                    匀琀愀爀琀ⴀ匀氀攀攀瀀 ⴀ䴀椀氀氀椀猀攀挀漀渀搀猀 ㄀  ഀഊ } ਀                昀漀爀攀愀挀栀 ⠀␀琀栀爀攀愀琀 椀渀 ␀爀甀渀猀瀀愀挀攀猀⸀䌀氀漀渀攀⠀⤀⤀ഀഊ { ਀                    椀昀 ⠀ ⴀ渀漀琀 ␀琀栀爀攀愀琀⸀栀愀渀搀氀攀⤀ഀഊ { ਀                        圀爀椀琀攀ⴀ嘀攀爀戀漀猀攀 ⴀ䴀攀猀猀愀最攀 ⠀✀匀挀栀攀搀甀氀攀搀 吀愀猀欀猀㨀 刀攀洀漀瘀椀渀最 笀 紀 昀爀漀洀 爀甀渀猀瀀愀挀攀猀✀ ⴀ昀 ␀琀栀爀攀愀琀⸀䤀伀戀樀攀挀琀⤀ഀഊ $runspaces.Remove($threat) ਀                    紀ഀഊ } ਀                椀昀 ⠀␀匀栀漀眀倀爀漀最爀攀猀猀⤀ഀഊ { ਀                    ␀倀爀漀最爀攀猀猀匀瀀氀愀琀琀椀渀最 㴀 䀀笀ഀഊ Activity = 'Scheduled Tasks: Getting info' ਀                        匀琀愀琀甀猀 㴀 ✀匀挀栀攀搀甀氀攀搀 吀愀猀欀猀㨀 笀 紀 漀昀 笀㄀紀 琀漀琀愀氀 琀栀爀攀愀搀猀 搀漀渀攀✀ ⴀ昀 ⠀␀戀最刀甀渀猀瀀愀挀攀䌀漀甀渀琀攀爀 ⴀ ␀爀甀渀猀瀀愀挀攀猀⸀䌀漀甀渀琀⤀Ⰰ ␀戀最刀甀渀猀瀀愀挀攀䌀漀甀渀琀攀爀ഀഊ PercentComplete = ($bgRunspaceCounter - $runspaces.Count) / $bgRunspaceCounter * 100 ਀                    紀ഀഊ Write-Progress @ProgressSplatting ਀                紀ഀഊ } ਀            眀栀椀氀攀 ⠀␀䴀漀爀攀 ⴀ愀渀搀 ␀倀匀䈀漀甀渀搀倀愀爀愀洀攀琀攀爀猀嬀✀圀愀椀琀✀崀⤀ഀഊ } ਀    紀ഀഊ PROCESS ਀    笀ഀഊ $ComputerNames += $ComputerName ਀    紀ഀഊ END ਀    笀ഀഊ foreach ($Computer in $ComputerName) ਀        笀ഀഊ $bgRunspaceCounter++ ਀            ␀瀀猀䌀䴀䐀 㴀 嬀匀礀猀琀攀洀⸀䴀愀渀愀最攀洀攀渀琀⸀䄀甀琀漀洀愀琀椀漀渀⸀倀漀眀攀爀匀栀攀氀氀崀㨀㨀䌀爀攀愀琀攀⠀⤀⸀䄀搀搀匀挀爀椀瀀琀⠀␀匀挀爀椀瀀琀䈀氀漀挀欀⤀ഀഊ $null = $psCMD.AddParameter('bgRunspaceID',$bgRunspaceCounter) ਀            ␀渀甀氀氀 㴀 ␀瀀猀䌀䴀䐀⸀䄀搀搀倀愀爀愀洀攀琀攀爀⠀✀䌀漀洀瀀甀琀攀爀一愀洀攀✀Ⰰ␀䌀漀洀瀀甀琀攀爀⤀ഀഊ $null = $psCMD.AddParameter('UseRemoting',$UseRemoting) ਀            ␀渀甀氀氀 㴀 ␀瀀猀䌀䴀䐀⸀䄀搀搀倀愀爀愀洀攀琀攀爀⠀✀嘀攀爀戀漀猀攀✀Ⰰ␀嘀攀爀戀漀猀攀倀爀攀昀攀爀攀渀挀攀⤀ഀഊ $psCMD.RunspacePool = $rp ਀ ഀഊ Write-Verbose -Message ('Scheduled Tasks: Starting {0}' -f $Computer) ਀            嬀瘀漀椀搀崀␀爀甀渀猀瀀愀挀攀猀⸀䄀搀搀⠀䀀笀ഀഊ Handle = $psCMD.BeginInvoke() ਀                倀漀眀攀爀匀栀攀氀氀 㴀 ␀瀀猀䌀䴀䐀ഀഊ IObject = $Computer ਀                䤀䐀 㴀 ␀戀最刀甀渀猀瀀愀挀攀䌀漀甀渀琀攀爀ഀഊ }) ਀           䜀攀琀ⴀ刀攀猀甀氀琀ഀഊ } ਀       ഀഊ Get-Result -Wait ਀        椀昀 ⠀␀匀栀漀眀倀爀漀最爀攀猀猀⤀ഀഊ { ਀            圀爀椀琀攀ⴀ倀爀漀最爀攀猀猀 ⴀ䄀挀琀椀瘀椀琀礀 ✀匀挀栀攀搀甀氀攀搀 吀愀猀欀猀㨀 䜀攀琀琀椀渀最 猀栀愀爀攀 猀攀猀猀椀漀渀 椀渀昀漀爀洀愀琀椀漀渀✀ ⴀ匀琀愀琀甀猀 ✀䐀漀渀攀✀ ⴀ䌀漀洀瀀氀攀琀攀搀ഀഊ } ਀        圀爀椀琀攀ⴀ嘀攀爀戀漀猀攀 ⴀ䴀攀猀猀愀最攀 ∀匀挀栀攀搀甀氀攀搀 吀愀猀欀猀㨀 䌀氀漀猀椀渀最 爀甀渀猀瀀愀挀攀 瀀漀漀氀∀ഀഊ $rp.Close() ਀        ␀爀瀀⸀䐀椀猀瀀漀猀攀⠀⤀ഀഊ } ਀紀ഀഊFunction Get-Startup { ਀瀀愀爀愀洀⠀ഀഊ [string]$ComputerName=$env:COMPUTERNAME ਀    ⤀ഀഊ$GetStartup = gwmi -ComputerName $ComputerName Win32_StartupCommand | ਀匀攀氀攀挀琀 一愀洀攀Ⰰ 䌀漀洀洀愀渀搀Ⰰ 䰀漀挀愀琀椀漀渀Ⰰ 唀猀攀爀ഀഊReturn $GetStartup ਀紀ഀഊFunction Get-MSHotfix { ਀    瀀愀爀愀洀⠀ഀഊ [string]$ComputerName=$env:COMPUTERNAME ਀    ⤀ഀഊ$GetMSHotFix = gwmi -ComputerName $ComputerName -Query "SELECT HotFixID,Caption,Description,InstalledOn,InstalledBy FROM win32_quickfixengineering" | ਀匀漀爀琀 䤀渀猀琀愀氀氀攀搀伀渀 ⴀ䐀攀猀挀攀渀搀椀渀最簀ഀഊSelect HotFixID, Caption, Description, InstalledOn, InstalledBy ਀刀攀琀甀爀渀 ␀䜀攀琀䴀匀䠀漀琀䘀椀砀ഀഊ} ਀䘀甀渀挀琀椀漀渀 䜀攀琀ⴀ一椀挀䤀渀昀漀 笀ഀഊparam([string]$ComputerName=$env:COMPUTERNAME) ਀昀漀爀攀愀挀栀 ⠀␀䄀搀愀瀀琀攀爀 椀渀 ⠀最眀洀椀 圀椀渀㌀㈀开一攀琀眀漀爀欀䄀搀愀瀀琀攀爀 ⴀ䌀漀洀瀀甀琀攀爀一愀洀攀 ␀䌀漀洀瀀甀琀攀爀一愀洀攀 ⴀ䘀椀氀琀攀爀 ∀一攀琀䔀渀愀戀氀攀搀㴀✀吀爀甀攀✀∀⤀⤀ 笀ഀഊ$Config = gwmi Win32_NetworkAdapterConfiguration -ComputerName $ComputerName -Filter "Index = '$($Adapter.Index)'" ਀␀伀戀樀㴀 一攀眀ⴀ伀戀樀攀挀琀 ⴀ吀礀瀀攀 倀匀伀戀樀攀挀琀 ⴀ倀爀漀瀀攀爀琀礀 䀀笀ഀഊ Hostname = $Adapter.SystemName ਀        一愀洀攀                  㴀 ␀䄀搀愀瀀琀攀爀⸀渀愀洀攀ഀഊ "Network" = $Adapter.NetConnectionID ਀        ∀䴀䄀䌀 䄀搀搀爀攀猀猀∀         㴀 ␀䌀漀渀昀椀最⸀䴀䄀䌀䄀搀搀爀攀猀猀ഀഊ "IP Address" = $Config.IPAddress -join "; " ਀        ∀䐀䠀䌀倀 匀攀爀瘀攀爀∀         㴀 椀昀 ⠀␀䌀漀渀昀椀最⸀䐀䠀䌀倀匀攀爀瘀攀爀 ⴀ攀焀 ␀渀甀氀氀⤀笀∀䐀䠀䌀倀 䐀椀猀愀戀氀攀搀∀紀ഀഊ else {$Config.DHCPServer} ਀        ∀䐀䠀䌀倀 䔀渀愀戀氀攀搀∀        㴀 ␀䌀漀渀昀椀最⸀䐀䠀䌀倀䔀渀愀戀氀攀搀ഀഊ "DHCP Lease Obtained" = if ($Config.DHCPLeaseObtained -eq $null){"DHCP Disabled"} ਀                                        攀氀猀攀 笀嬀洀愀渀愀最攀洀攀渀琀⸀洀愀渀愀最攀洀攀渀琀䐀愀琀攀吀椀洀攀䌀漀渀瘀攀爀琀攀爀崀㨀㨀吀漀䐀愀琀攀吀椀洀攀⠀␀䌀漀渀昀椀最⸀䐀䠀䌀倀䰀攀愀猀攀伀戀琀愀椀渀攀搀⤀紀ഀഊ "DHCP Lease Expires" = if ($Config.DHCPLeaseExpires -eq $null){"DHCP Disabled"} ਀                                        攀氀猀攀 笀嬀洀愀渀愀最攀洀攀渀琀⸀洀愀渀愀最攀洀攀渀琀䐀愀琀攀吀椀洀攀䌀漀渀瘀攀爀琀攀爀崀㨀㨀吀漀䐀愀琀攀吀椀洀攀⠀␀䌀漀渀昀椀最⸀䐀䠀䌀倀䰀攀愀猀攀䔀砀瀀椀爀攀猀⤀紀ഀഊ "Subnet Mask" = $Config.IPSubnet -join "; " ਀        ∀䐀攀昀愀甀氀琀 䜀愀琀攀眀愀礀∀     㴀 ␀䌀漀渀昀椀最⸀䐀攀昀愀甀氀琀䤀倀䜀愀琀攀眀愀礀 ⴀ樀漀椀渀 ∀㬀 ∀ഀഊ "DNS Suffix" = $Config.DNSDomain ਀        ∀䐀一匀 匀攀爀瘀攀爀猀∀         㴀 ␀䌀漀渀昀椀最⸀䐀一匀匀攀爀瘀攀爀匀攀愀爀挀栀伀爀搀攀爀 ⴀ樀漀椀渀 ∀㬀 ∀ഀഊ "Up Time" = [management.managementDateTimeConverter]::ToDateTime($Adapter.TimeOfLastReset) ਀        ∀䰀椀渀欀 匀瀀攀攀搀∀          㴀 椀昀 ⠀␀䄀搀愀瀀琀攀爀⸀匀瀀攀攀搀 ⴀ最琀 㤀㤀㤀㤀㤀㤀㤀㤀㤀⤀ 笀ഀഊ -join (($Adapter.Speed/1000000000)," ","Gb/s") ਀                                紀ഀഊ ਀                                攀氀猀攀 笀         ഀഊ -join (($Adapter.Speed/1000000)," ","Mb/s") ਀                                紀ഀഊ ਀    紀ഀഊ$Obj|Select "Hostname", ਀∀一愀洀攀∀Ⰰഀഊ"Network", ਀∀䰀椀渀欀 匀瀀攀攀搀∀Ⰰഀഊ"Up Time", ਀∀䴀䄀䌀 䄀搀搀爀攀猀猀∀Ⰰഀഊ"IP Address", ਀∀䐀䠀䌀倀 匀攀爀瘀攀爀∀Ⰰഀഊ"DHCP Enabled", ਀∀䐀䠀䌀倀 䰀攀愀猀攀 伀戀琀愀椀渀攀搀∀Ⰰഀഊ"DHCP Lease Expires", ਀∀匀甀戀渀攀琀 䴀愀猀欀∀Ⰰഀഊ"Default Gateway", ਀∀䐀一匀 匀甀昀昀椀砀∀Ⰰഀഊ"DNS Servers" ਀紀ഀഊ} ਀䘀甀渀挀琀椀漀渀 䜀攀琀ⴀ䴀攀洀漀爀礀匀琀愀琀猀 笀ഀഊparam( ਀    嬀猀琀爀椀渀最崀␀䌀漀洀瀀甀琀攀爀一愀洀攀㴀␀攀渀瘀㨀䌀伀䴀倀唀吀䔀刀一䄀䴀䔀ഀഊ ) ਀        昀甀渀挀琀椀漀渀 最攀琀ⴀ圀洀椀䴀攀洀漀爀礀䘀漀爀洀䘀愀挀琀漀爀 笀ഀഊ param ([uint16] $char) ਀        䤀昀 ⠀␀挀栀愀爀 ⴀ最攀   ⴀ愀渀搀  ␀挀栀愀爀  ⴀ氀攀 ㈀㈀⤀ 笀ഀഊ switch ($char) { ਀              笀∀唀渀欀渀漀眀渀∀紀ഀഊ 1 {"Other"} ਀        ㈀     笀∀匀椀倀∀紀ഀഊ 3 {"DIP"} ਀        㐀     笀∀娀䤀倀∀紀ഀഊ 5 {"SOJ"} ਀        㘀     笀∀倀爀漀瀀爀椀攀琀愀爀礀∀紀ഀഊ 7 {"SIMM"} ਀        㠀     笀∀䐀䤀䴀䴀∀紀ഀഊ 9 {"TSOPO"} ਀        ㄀      笀∀倀䜀䄀∀紀ഀഊ 11 {"RIM"} ਀        ㄀㈀     笀∀匀伀䐀䤀䴀䴀∀紀ഀഊ 13 {"SRIMM"} ਀        ㄀㐀     笀∀匀䴀䐀∀紀ഀഊ 15 {"SSMP"} ਀        ㄀㘀     笀∀儀䘀倀∀紀ഀഊ 17 {"TQFP"} ਀        ㄀㠀     笀∀匀伀䤀䌀∀紀ഀഊ 19 {"LCC"} ਀        ㈀      笀∀倀䰀䌀䌀∀紀ഀഊ 21 {"FPGA"} ਀        ㈀㈀     笀∀䰀䜀䄀∀紀ഀഊ } ਀        紀ഀഊ ਀        攀氀猀攀 笀∀笀 紀 ⴀ 甀渀搀攀昀椀渀攀搀 瘀愀氀甀攀∀ ⴀ昀 ␀挀栀愀爀ഀഊ } ਀       ഀഊ Return ਀        紀ഀഊ ਀        ⌀ 䠀攀氀瀀攀爀 昀甀渀挀琀椀漀渀 琀漀 爀攀琀甀爀渀 洀攀洀漀爀礀 䤀渀琀攀爀氀攀愀瘀攀  倀漀猀椀琀椀漀渀ഀഊ ਀        昀甀渀挀琀椀漀渀 最攀琀ⴀ圀洀椀䤀渀琀攀爀氀攀愀瘀攀倀漀猀椀琀椀漀渀 笀ഀഊ param ([uint32] $char) ਀       ഀഊ If ($char -ge 0 -and $char -le 2) { ਀       ഀഊ switch ($char) { ਀              笀∀一漀渀ⴀ䤀渀琀攀爀氀攀愀瘀攀搀∀紀ഀഊ 1 {"First Position"} ਀        ㈀     笀∀匀攀挀漀渀搀 倀漀猀椀琀椀漀渀∀紀ഀഊ } ਀        紀ഀഊ ਀        攀氀猀攀 笀∀笀 紀 ⴀ 甀渀搀攀昀椀渀攀搀 瘀愀氀甀攀∀ ⴀ昀 ␀挀栀愀爀ഀഊ } ਀       ഀഊ Return ਀        紀ഀഊ ਀       ഀഊ # Helper function to return Memory Type ਀        昀甀渀挀琀椀漀渀 最攀琀ⴀ圀洀椀䴀攀洀漀爀礀吀礀瀀攀 笀ഀഊ param ([uint16] $char) ਀       ഀഊ If ($char -ge 0 -and $char -le 24) { ਀       ഀഊ switch ($char) { ਀              笀∀唀渀欀渀漀眀渀∀紀ഀഊ 1 {"Other"} ਀        ㈀     笀∀䐀刀䄀䴀∀紀ഀഊ 3 {"Synchronous DRAM"} ਀        㐀     笀∀䌀愀挀栀攀 䐀刀䄀䴀∀紀ഀഊ 5 {"EDO"} ਀        㘀     笀∀䔀䐀刀䄀䴀∀紀ഀഊ 7 {"VRAM"} ਀        㠀     笀∀匀刀䄀䴀∀紀ഀഊ 9 {"ROM"} ਀        ㄀      笀∀刀伀䴀∀紀ഀഊ 11 {"FLASH"} ਀        ㄀㈀     笀∀䔀䔀倀刀伀䴀∀紀ഀഊ 13 {"FEPROM"} ਀        ㄀㐀     笀∀䔀倀刀伀䴀∀紀ഀഊ 15 {"CDRAM"} ਀        ㄀㘀     笀∀㌀䐀刀䄀䴀∀紀ഀഊ 17 {"SDRAM"} ਀        ㄀㠀     笀∀匀䜀刀䄀䴀∀紀ഀഊ 19 {"RDRAM"} ਀        ㈀      笀∀䐀䐀刀∀紀ഀഊ 21 {"DDR2"} ਀        ㈀㈀     笀∀䐀䐀刀㈀ 䘀䈀ⴀ䐀䤀䴀䴀∀紀ഀഊ 24 {"DDR3"} ਀        紀ഀഊ ਀        紀ഀഊ ਀        攀氀猀攀 笀∀笀 紀 ⴀ 甀渀搀攀昀椀渀攀搀 瘀愀氀甀攀∀ ⴀ昀 ␀挀栀愀爀ഀഊ } ਀       ഀഊ Return ਀        紀ഀഊ ਀       ഀഊ # Get the object ਀        ␀洀攀洀漀爀礀 㴀 䜀攀琀ⴀ圀䴀䤀伀戀樀攀挀琀 ⴀ䌀漀洀瀀甀琀攀爀一愀洀攀 ␀䌀漀洀瀀甀琀攀爀一愀洀攀 圀椀渀㌀㈀开倀栀礀猀椀挀愀氀䴀攀洀漀爀礀ഀഊ ਀       ഀഊ ਀        䘀漀爀攀愀挀栀 ⠀␀猀琀椀挀欀 椀渀 ␀洀攀洀漀爀礀⤀ 笀ഀഊ ਀        ⌀ 䐀漀 猀漀洀攀 挀漀渀瘀攀爀猀椀漀渀猀ഀഊ $cap=$stick.capacity/1gb ਀        ␀昀昀㴀最攀琀ⴀ圀洀椀䴀攀洀漀爀礀䘀漀爀洀䘀愀挀琀漀爀⠀␀猀琀椀挀欀⸀䘀漀爀洀䘀愀挀琀漀爀⤀ഀഊ $ilp=get-WmiInterleavePosition($stick.InterleavePosition) ਀        ␀洀琀㴀最攀琀ⴀ圀䴀䤀䴀攀洀漀爀礀吀礀瀀攀⠀␀猀琀椀挀欀⸀䴀攀洀漀爀礀吀礀瀀攀⤀ഀഊ ਀        ⌀ 瀀爀椀渀琀 搀攀琀愀椀氀猀 漀昀 攀愀挀栀 猀琀椀挀欀ഀഊ $object = New-Object -type psobject -Property @{ ਀       ഀഊ "Bank" = $stick.DeviceLocator ਀        ∀䌀愀瀀愀挀椀琀礀 ⠀䜀䈀⤀∀       㴀 ␀挀愀瀀ഀഊ "Data Width" = $stick.DataWidth ਀        ∀䐀攀猀挀爀椀瀀琀椀漀渀∀         㴀 ␀猀琀椀挀欀⸀䐀攀猀挀爀椀瀀琀椀漀渀ഀഊ "Form Factor" = $ff ਀        ∀䤀渀琀攀爀氀攀愀瘀攀䐀愀琀愀䐀攀瀀琀栀∀ 㴀 ␀猀琀椀挀欀⸀䤀渀琀攀爀氀攀愀瘀攀䐀愀琀愀䐀攀瀀琀栀ഀഊ "InterleavePosition" = $ilp ਀        ∀䴀愀渀甀昀愀挀琀甀爀攀爀∀        㴀 椀昀 ⠀␀猀琀椀挀欀⸀䴀愀渀甀昀愀挀琀甀爀攀爀 ⴀ攀焀 ␀渀甀氀氀⤀ 笀ഀഊ "Null - Possibly VM"} ਀                                        攀氀猀攀 笀␀猀琀椀挀欀⸀䴀愀渀甀昀愀挀琀甀爀攀爀紀ഀഊ "Memory Type" = $mt ਀        ∀倀愀爀琀 一甀洀戀攀爀∀         㴀 ␀猀琀椀挀欀⸀倀愀爀琀一甀洀戀攀爀ഀഊ "Serial Number" = $stick.SerialNumber ਀        ∀匀瀀攀攀搀∀               㴀 ␀猀琀椀挀欀⸀匀瀀攀攀搀ഀഊ ਀        紀ഀഊ $object #|select Bank,Manufacturer,"Capacity (GB)","Speed","Part Number","Serial Number","Data Width","Form Factor","Memory Type" ਀        紀ഀഊ ਀    紀ഀഊFunction Get-WindowsDriver { ਀㰀⌀ഀഊ .SYNOPSIS ਀        䜀愀琀栀攀爀 爀甀渀渀椀渀最 搀爀椀瘀攀爀 椀渀昀漀爀洀愀琀椀漀渀 昀爀漀洀 愀 爀攀洀漀琀攀 漀爀 氀漀挀愀氀 猀礀猀琀攀洀⸀ഀഊ ਀    ⸀倀䄀刀䄀䴀䔀吀䔀刀 䌀漀洀瀀甀琀攀爀一愀洀攀ഀഊ Specifies the target computer for data query. ਀   ഀഊ .EXAMPLE ਀        倀匀 㸀 䜀攀琀ⴀ圀椀渀搀漀眀猀䐀爀椀瘀攀爀 ⴀ䌀漀洀瀀甀琀攀爀一愀洀攀 氀漀挀愀氀栀漀猀琀 簀猀攀氀攀挀琀 一愀洀攀Ⰰ嘀攀爀猀椀漀渀Ⰰ䐀愀琀攀Ⰰ倀愀琀栀Ⰰ吀礀瀀攀Ⰰ匀琀愀琀攀 ⴀ䘀椀爀猀琀 ㄀簀昀琀ഀഊ ਀        一愀洀攀                          嘀攀爀猀椀漀渀                              䐀愀琀攀                                 倀愀琀栀                                 吀礀瀀攀                                 匀琀愀琀攀                              ഀഊ ---- ------- ---- ---- ---- ----- ਀        䴀椀挀爀漀猀漀昀琀 䄀䌀倀䤀 䐀爀椀瘀攀爀         㘀⸀㄀⸀㜀㘀  ⸀㄀㘀㌀㠀㔀 ⠀眀椀渀㜀开爀琀洀⸀ 㤀 㜀㄀㌀ⴀ㄀⸀⸀⸀ ㄀㄀⼀㈀ ⼀㈀ ㄀  ㄀ 㨀㈀㌀㨀㐀㜀 倀䴀               䌀㨀尀圀椀渀搀漀眀猀尀猀礀猀琀攀洀㌀㈀尀搀爀椀瘀攀爀猀尀䄀䌀倀䤀⸀猀礀猀 䬀攀爀渀攀氀 䐀爀椀瘀攀爀                        刀甀渀渀椀渀最                            ഀഊ ਀        䐀攀猀挀爀椀瀀琀椀漀渀ഀഊ ----------- ਀        䜀愀琀栀攀爀猀 漀渀攀 爀甀渀渀椀渀最 搀爀椀瘀攀爀 氀漀愀搀攀搀 漀渀 挀甀爀爀攀渀琀 猀礀猀琀攀洀⸀ഀഊ #> ਀瀀愀爀愀洀⠀嬀猀琀爀椀渀最崀␀䌀漀洀瀀甀琀攀爀一愀洀攀㴀␀攀渀瘀㨀䌀伀䴀倀唀吀䔀刀一䄀䴀䔀⤀ഀഊforeach ($driver in (gwmi -ComputerName $ComputerName -Query "Select Name,State,Description,DisplayName,PathName,ServiceType,StartMode FROM win32_systemdriver WHERE State='Running'"|select Name,State,Description,DisplayName,PathName,ServiceType,StartMode)) ਀            笀ഀഊ ਀                ␀䐀爀椀瘀攀爀⸀倀愀琀栀渀愀洀攀 㴀 ⠀␀搀爀椀瘀攀爀⸀瀀愀琀栀渀愀洀攀⸀刀攀瀀氀愀挀攀⠀∀尀㼀㼀尀∀Ⰰ∀∀⤀⤀                ഀഊ $Path = Get-ChildItem -Path $Driver.Pathname -ErrorAction SilentlyContinue|Select FullName,LastWriteTime,@{ Label = 'FileVersion'; Expression = { $_.VersionInfo.FileVersion }} ਀                                                           ഀഊ ਀                ␀伀戀樀㴀 一攀眀ⴀ伀戀樀攀挀琀 ⴀ吀礀瀀攀 倀匀伀戀樀攀挀琀 ⴀ倀爀漀瀀攀爀琀礀 䀀笀ഀഊ Name = $Driver.Description ਀                      倀愀琀栀           㴀 ␀䐀爀椀瘀攀爀⸀倀愀琀栀渀愀洀攀ഀഊ Date = $Path.LastWriteTime ਀                      嘀攀爀猀椀漀渀        㴀 ␀倀愀琀栀⸀䘀椀氀攀嘀攀爀猀椀漀渀ഀഊ State = $Driver.State ਀                      吀礀瀀攀           㴀 ␀䐀爀椀瘀攀爀⸀匀攀爀瘀椀挀攀吀礀瀀攀ഀഊ } ਀      ␀伀戀樀 簀圀栀攀爀攀 笀␀开⸀嘀攀爀猀椀漀渀 ⴀ渀漀琀氀椀欀攀 ∀⨀⠀眀椀渀⨀∀紀   ഀഊ # $Obj - to display ALL drivers. For troubleshooting, we are interested in 3rd party drivers, so the above Where {} statement filters out Microsoft drivers. ਀            紀ഀഊ ਀    紀ഀഊfunction Get-NetFrameworkVersion { ਀嬀䌀洀搀氀攀琀䈀椀渀搀椀渀最⠀⤀崀ഀഊparam($ComputerName = $env:COMPUTERNAME) ਀␀搀漀琀一攀琀刀攀最椀猀琀爀礀  㴀 ✀匀伀䘀吀圀䄀刀䔀尀䴀椀挀爀漀猀漀昀琀尀一䔀吀 䘀爀愀洀攀眀漀爀欀 匀攀琀甀瀀尀一䐀倀✀ഀഊ$dotNet4Registry = 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' ਀␀搀漀琀一攀琀㐀䈀甀椀氀搀猀 㴀 䀀笀ഀഊ 30319 = '.NET Framework 4.0' ਀       ㌀㜀㠀㌀㠀㤀 㴀 ✀⸀一䔀吀 䘀爀愀洀攀眀漀爀欀 㐀⸀㔀✀ഀഊ 378675 = '.NET Framework 4.5.1 (8.1/2012R2)' ਀       ㌀㜀㠀㜀㔀㠀 㴀 ✀⸀一䔀吀 䘀爀愀洀攀眀漀爀欀 㐀⸀㔀⸀㄀ ⠀㠀⼀㜀 匀倀㄀⼀嘀椀猀琀愀 匀倀㈀⤀✀ഀഊ 379893 = '.NET Framework 4.5.2' ਀       ㌀㠀  㐀㈀ 㴀 ✀⸀一䔀吀 䘀爀愀洀攀眀漀爀欀 㐀⸀㔀 愀渀搀 氀愀琀攀爀 眀椀琀栀 䬀䈀㌀㄀㘀㠀㈀㜀㔀 爀漀氀氀甀瀀✀ഀഊ 393295 = '.NET Framework 4.6 (Windows 10)' ਀       ㌀㤀㌀㈀㤀㜀 㴀 ✀⸀一䔀吀 䘀爀愀洀攀眀漀爀欀 㐀⸀㘀 ⠀一伀一 圀椀渀搀漀眀猀 ㄀ ⤀✀ഀഊ 394254 = '.NET Framework 4.6.1 (Windows 10)' ਀       ㌀㤀㐀㈀㜀㄀ 㴀 ✀⸀一䔀吀 䘀爀愀洀攀眀漀爀欀 㐀⸀㘀⸀㄀ ⠀一伀一 圀椀渀搀漀眀猀 ㄀ ⤀✀ഀഊ 394802 = '.NET Framework 4.6.2 (Windows 10 Anniversary Update)' ਀       ㌀㤀㐀㠀 㘀 㴀 ✀⸀一䔀吀 䘀爀愀洀攀眀漀爀欀 㐀⸀㘀⸀㈀ ⠀一伀一 圀椀渀搀漀眀猀 ㄀ ⤀✀ഀഊ 460798 = '.NET Framework 4.7 (Windows 10 Creators Update)' ਀       㐀㘀 㠀 㔀 㴀 ✀⸀一䔀吀 䘀爀愀洀攀眀漀爀欀 㐀⸀㜀 ⠀一伀一 圀椀渀搀漀眀猀 ㄀ ⤀✀ഀഊ} ਀昀漀爀攀愀挀栀⠀␀䌀漀洀瀀甀琀攀爀 椀渀 ␀䌀漀洀瀀甀琀攀爀一愀洀攀⤀ 笀ഀഊtry ਀    笀ഀഊ Test-Connection -ComputerName $Computer -Count 1 -ErrorAction Stop|Out-Null ਀        ␀戀甀椀氀琀䤀渀圀椀渀䘀攀愀琀甀爀攀 㴀 䜀攀琀ⴀ圀洀椀伀戀樀攀挀琀 ⴀ䌀漀洀瀀甀琀攀爀一愀洀攀 ␀䌀漀洀瀀甀琀攀爀 ⴀ焀甀攀爀礀 ∀匀䔀䰀䔀䌀吀 䌀愀瀀琀椀漀渀Ⰰ嘀攀爀猀椀漀渀 䘀刀伀䴀 圀椀渀㌀㈀开伀瀀攀爀愀琀椀渀最匀礀猀琀攀洀∀ ⴀ䔀爀爀漀爀䄀挀琀椀漀渀 匀琀漀瀀      ഀഊ } ਀  ഀഊcatch ਀    笀ഀഊ Write-Warning ("$($Computer)- WMI: " + $_.Exception.Message) ਀    ␀戀甀椀氀琀䤀渀圀椀渀䘀攀愀琀甀爀攀 㴀 ␀渀甀氀氀ഀഊ } ਀  ഀഊ #Check if computer is running 2012 or higher. Checking for built-in .NET 4.x installs, since they don't register as the other installable versions. ਀    椀昀 ⠀⠀␀戀甀椀氀琀䤀渀圀椀渀䘀攀愀琀甀爀攀⸀䌀愀瀀琀椀漀渀 ⴀ氀椀欀攀 ∀⨀猀攀爀瘀攀爀⨀∀⤀ ⴀ愀渀搀 ⠀␀戀甀椀氀琀䤀渀圀椀渀䘀攀愀琀甀爀攀⸀䌀愀瀀琀椀漀渀 ⴀ渀漀琀氀椀欀攀 ∀⨀㈀  ⨀∀⤀⤀笀      ഀഊ $netCollection = @() ਀  ഀഊ #handle errors if Get-WinFeature is not found on machine running script, but $computer is a Server 2012 or greater system ਀        琀爀礀 笀ഀഊ $serverDotNet = Get-WindowsFeature -ComputerName $Computer -Name NET* -ErrorAction Stop|Select *|Where {$_.Installed -eq $true -and $_.Parent -eq $null} |Select DisplayName,Installed ਀                紀ഀഊ catch { ਀                ∀䔀爀爀漀爀 氀漀愀搀椀渀最 䜀攀琀ⴀ圀椀渀搀漀眀猀䘀攀愀琀甀爀攀⸀ 匀攀爀瘀攀爀 ␀⠀␀䌀漀洀瀀甀琀攀爀⤀ 椀渀琀攀最爀愀琀攀搀 ⸀一䔀吀 椀渀猀琀愀氀氀猀 眀椀氀氀 渀漀琀 戀攀 猀栀漀眀渀∀ഀഊ } ਀                        昀漀爀攀愀挀栀 ⠀␀昀攀愀琀甀爀攀 椀渀 ␀猀攀爀瘀攀爀䐀漀琀一攀琀⤀ 笀ഀഊ $obj = New-Object -Type PSObject -Property @{ ਀                               䌀漀洀瀀甀琀攀爀一愀洀攀 㴀 ␀䌀漀洀瀀甀琀攀爀ഀഊ NetFXVersion = $feature.Displayname ਀                               一攀琀䘀砀䈀甀椀氀搀   㴀 ⠀␀戀甀椀氀琀䤀渀圀椀渀䘀攀愀琀甀爀攀⸀䌀愀瀀琀椀漀渀 ⴀ爀攀瀀氀愀挀攀 ∀䴀椀挀爀漀猀漀昀琀 ∀Ⰰ∀∀⤀ ⬀ ∀ ⠀䤀渀琀攀最爀愀琀攀搀⤀∀ഀഊ } ਀                        紀ഀഊ ਀                        ⌀伀渀氀礀 眀爀椀琀攀 琀漀 渀攀琀䌀漀氀氀攀挀琀椀漀渀 椀昀 䜀攀琀ⴀ圀椀渀搀漀眀猀䘀攀愀琀甀爀攀 眀漀爀欀攀搀ഀഊ if ($serverDotNet) {$netCollection += $obj} ਀  ഀഊ #loop through registry ਀        椀昀⠀␀爀攀最䬀攀礀 㴀 嬀䴀椀挀爀漀猀漀昀琀⸀圀椀渀㌀㈀⸀刀攀最椀猀琀爀礀䬀攀礀崀㨀㨀伀瀀攀渀刀攀洀漀琀攀䈀愀猀攀䬀攀礀⠀✀䰀漀挀愀氀䴀愀挀栀椀渀攀✀Ⰰ ␀䌀漀洀瀀甀琀攀爀⤀⤀ 笀ഀഊ if ($netRegKey = $regKey.OpenSubKey("$dotNetRegistry")) { ਀                     昀漀爀攀愀挀栀 ⠀␀瘀攀爀猀椀漀渀䬀攀礀一愀洀攀 椀渀 ␀渀攀琀刀攀最䬀攀礀⸀䜀攀琀匀甀戀䬀攀礀一愀洀攀猀⠀⤀⤀ 笀ഀഊ if ($versionKeyName -match '^v[123]') { ਀                                  ␀瘀攀爀猀椀漀渀䬀攀礀 㴀 ␀渀攀琀刀攀最䬀攀礀⸀伀瀀攀渀匀甀戀䬀攀礀⠀␀瘀攀爀猀椀漀渀䬀攀礀一愀洀攀⤀ഀഊ $version = Invoke-Command -scriptblock { $erroractionpreference = "SilentlyContinue" ਀                                  嬀瘀攀爀猀椀漀渀崀⠀␀瘀攀爀猀椀漀渀䬀攀礀⸀䜀攀琀嘀愀氀甀攀⠀✀嘀攀爀猀椀漀渀✀Ⰰ ✀✀⤀⤀紀ഀഊ $objnet = New-Object -TypeName PSObject -Property @{ ਀                                         䌀漀洀瀀甀琀攀爀一愀洀攀 㴀 ␀䌀漀洀瀀甀琀攀爀ഀഊ NetFXBuild = $version.Build ਀                                         一攀琀䘀堀嘀攀爀猀椀漀渀 㴀 ✀⸀一䔀吀 䘀爀愀洀攀眀漀爀欀 ✀ ⬀ ␀瘀攀爀猀椀漀渀⸀䴀愀樀漀爀 ⬀ ✀⸀✀ ⬀ ␀瘀攀爀猀椀漀渀⸀䴀椀渀漀爀ഀഊ } ਀                    椀昀 ⠀␀漀戀樀渀攀琀⸀一攀琀䘀堀䈀甀椀氀搀 ⴀ渀攀 ␀渀甀氀氀⤀笀 ⌀愀搀搀攀搀 琀漀 瀀爀攀瘀攀渀琀 渀甀氀氀 攀渀琀爀椀攀猀 愀渀搀 攀爀爀漀爀猀 昀爀漀洀 ㈀ ㄀㘀 愀渀搀 最爀攀愀琀攀爀 伀⼀匀 眀椀琀栀漀甀琀 ⸀一䔀吀 ㌀⸀砀 爀攀最 瘀愀氀甀攀猀ഀഊ $netCollection += $objnet ਀                            紀 ⌀攀渀搀 椀昀 渀攀琀昀砀戀甀椀氀搀 ␀渀甀氀氀 挀栀攀挀欀ഀഊ ਀                        紀⌀攀渀搀椀昀 瘀攀爀猀椀漀渀欀攀礀渀愀洀攀 昀漀爀攀愀挀栀ഀഊ } #end foreach $versionKeyName ਀              紀⌀攀渀搀䤀昀 ␀渀攀琀刀攀最䬀攀礀ഀഊ if ($net4RegKey = $regKey.OpenSubKey("$dotNet4Registry")) { ਀                     椀昀⠀ⴀ渀漀琀 ⠀␀渀攀琀㐀刀攀氀攀愀猀攀 㴀 ␀渀攀琀㐀刀攀最䬀攀礀⸀䜀攀琀嘀愀氀甀攀⠀✀刀攀氀攀愀猀攀✀⤀⤀⤀ 笀ഀഊ $net4Release = 30319 ਀                     紀ഀഊ $objnet4 = New-Object -TypeName PSObject -Property @{ ਀                           䌀漀洀瀀甀琀攀爀一愀洀攀 㴀 ␀䌀漀洀瀀甀琀攀爀ഀഊ NetFXBuild = $net4Release ਀                           一攀琀䘀堀嘀攀爀猀椀漀渀 㴀 ␀搀漀琀一攀琀㐀䈀甀椀氀搀猀嬀␀渀攀琀㐀刀攀氀攀愀猀攀崀ഀഊ } ਀         ഀഊ $netCollection += $objnet4 ਀                      ഀഊ }#end if $dotNet4RegKey ਀       紀⌀攀渀搀 椀昀 ␀爀攀最欀攀礀ഀഊ $netCollection|select ComputerName, NetFXVersion, NetFXBuild ਀    紀 ⌀攀渀搀 ㈀ ㄀㈀ 漀爀 最爀攀愀琀攀爀 ✀椀昀✀ 氀漀漀瀀ഀഊ else { ਀     ഀഊ try ਀            笀ഀഊ Test-Connection -ComputerName $Computer -Count 1 -ErrorAction Stop| Out-Null ਀                椀昀⠀␀爀攀最䬀攀礀 㴀 嬀䴀椀挀爀漀猀漀昀琀⸀圀椀渀㌀㈀⸀刀攀最椀猀琀爀礀䬀攀礀崀㨀㨀伀瀀攀渀刀攀洀漀琀攀䈀愀猀攀䬀攀礀⠀✀䰀漀挀愀氀䴀愀挀栀椀渀攀✀Ⰰ ␀䌀漀洀瀀甀琀攀爀⤀⤀ 笀ഀഊ if ($netRegKey = $regKey.OpenSubKey("$dotNetRegistry")) { ਀                     昀漀爀攀愀挀栀 ⠀␀瘀攀爀猀椀漀渀䬀攀礀一愀洀攀 椀渀 ␀渀攀琀刀攀最䬀攀礀⸀䜀攀琀匀甀戀䬀攀礀一愀洀攀猀⠀⤀⤀ 笀ഀഊ if ($versionKeyName -match '^v[123]') { ਀                                  ␀瘀攀爀猀椀漀渀䬀攀礀 㴀 ␀渀攀琀刀攀最䬀攀礀⸀伀瀀攀渀匀甀戀䬀攀礀⠀␀瘀攀爀猀椀漀渀䬀攀礀一愀洀攀⤀ഀഊ $version = [version]($versionKey.GetValue('Version', '')) ਀                                  一攀眀ⴀ伀戀樀攀挀琀 ⴀ吀礀瀀攀一愀洀攀 倀匀伀戀樀攀挀琀 ⴀ倀爀漀瀀攀爀琀礀 䀀笀ഀഊ ComputerName = $Computer ਀                                         一攀琀䘀堀䈀甀椀氀搀 㴀 ␀瘀攀爀猀椀漀渀⸀䈀甀椀氀搀ഀഊ NetFXVersion = '.NET Framework ' + $version.Major + '.' + $version.Minor ਀                                  紀 簀 匀攀氀攀挀琀ⴀ伀戀樀攀挀琀 䌀漀洀瀀甀琀攀爀一愀洀攀Ⰰ 一攀琀䘀堀嘀攀爀猀椀漀渀Ⰰ 一攀琀䘀堀䈀甀椀氀搀ഀഊ } ਀                     紀ഀഊ } ਀              椀昀 ⠀␀渀攀琀㐀刀攀最䬀攀礀 㴀 ␀爀攀最䬀攀礀⸀伀瀀攀渀匀甀戀䬀攀礀⠀∀␀搀漀琀一攀琀㐀刀攀最椀猀琀爀礀∀⤀⤀ 笀ഀഊ if(-not ($net4Release = $net4RegKey.GetValue('Release'))) { ਀                           ␀渀攀琀㐀刀攀氀攀愀猀攀 㴀 ㌀ ㌀㄀㤀ഀഊ } ਀                     一攀眀ⴀ伀戀樀攀挀琀 ⴀ吀礀瀀攀一愀洀攀 倀匀伀戀樀攀挀琀 ⴀ倀爀漀瀀攀爀琀礀 䀀笀ഀഊ ComputerName = $Computer ਀                           一攀琀䘀堀䈀甀椀氀搀 㴀 ␀渀攀琀㐀刀攀氀攀愀猀攀ഀഊ NetFXVersion = $dotNet4Builds[$net4Release] ਀                     紀 簀 匀攀氀攀挀琀ⴀ伀戀樀攀挀琀 䌀漀洀瀀甀琀攀爀一愀洀攀Ⰰ 一攀琀䘀堀嘀攀爀猀椀漀渀Ⰰ 一攀琀䘀堀䈀甀椀氀搀ഀഊ } ਀       紀ഀഊ } ਀        挀愀琀挀栀ഀഊ { ਀                圀爀椀琀攀ⴀ圀愀爀渀椀渀最 ⠀∀␀⠀␀䌀漀洀瀀甀琀攀爀⤀ⴀ 刀攀最椀猀琀爀礀㨀 ∀ ⬀ ␀开⸀䔀砀挀攀瀀琀椀漀渀⸀䴀攀猀猀愀最攀⤀ഀഊ } ਀  ഀഊ } #endElse ਀紀⌀攀渀搀 昀漀爀攀愀挀栀ഀഊ}#end function ਀ഀഊ#endregion Functions ਀⌀爀攀最椀漀渀 䄀猀猀攀洀戀氀攀 琀栀攀 䠀吀䴀䰀 䠀攀愀搀攀爀 愀渀搀 䌀匀匀 昀漀爀 刀攀瀀漀爀琀ഀഊ$HTMLHeader = @" ਀㰀℀䐀伀䌀吀夀倀䔀 䠀吀䴀䰀 倀唀䈀䰀䤀䌀 ∀ⴀ⼀⼀圀㌀䌀⼀⼀䐀吀䐀 䠀吀䴀䰀 㐀⸀ ㄀ 䘀爀愀洀攀猀攀琀⼀⼀䔀一∀ ∀栀琀琀瀀㨀⼀⼀眀眀眀⸀眀㌀⸀漀爀最⼀吀刀⼀栀琀洀氀㐀⼀昀爀愀洀攀猀攀琀⸀搀琀搀∀㸀ഀഊ$computer System Health Report ਀㰀猀琀礀氀攀 琀礀瀀攀㴀∀琀攀砀琀⼀挀猀猀∀㸀ഀഊ