labunix's blog

labunixのラボUnix

Windows2012の「役割と機能」のデフォルトを取得

■Windows2012の「役割と機能」のデフォルトを取得
 WindowsUpdate位はするよね。

■Hotfixのプロパティ

PS> Get-WmiObject -Class Win32_QuickFixEngineering | Get-Member -MemberType property

   TypeName: System.Management.ManagementObject#root\cimv2\Win32_QuickFixEngineering

Name                MemberType Definition
----                ---------- ----------
Caption             Property   string Caption {get;set;}
CSName              Property   string CSName {get;set;}
Description         Property   string Description {get;set;}
FixComments         Property   string FixComments {get;set;}
HotFixID            Property   string HotFixID {get;set;}
InstallDate         Property   string InstallDate {get;set;}
InstalledBy         Property   string InstalledBy {get;set;}
Name                Property   string Name {get;set;}
ServicePackInEffect Property   string ServicePackInEffect {get;set;}
Status              Property   string Status {get;set;}
__CLASS             Property   string __CLASS {get;set;}
__DERIVATION        Property   string[] __DERIVATION {get;set;}
__DYNASTY           Property   string __DYNASTY {get;set;}
__GENUS             Property   int __GENUS {get;set;}
__NAMESPACE         Property   string __NAMESPACE {get;set;}
__PATH              Property   string __PATH {get;set;}
__PROPERTY_COUNT    Property   int __PROPERTY_COUNT {get;set;}
__RELPATH           Property   string __RELPATH {get;set;}
__SERVER            Property   string __SERVER {get;set;}
__SUPERCLASS        Property   string __SUPERCLASS {get;set;}

PS> Get-WmiObject -Class Win32_QuickFixEngineering | Where-Object {$_.InstalledBy -like "*Administrator"} | Select-Object HotFixID,InstalledOn,Caption,Description | ConvertTo-Csv -NoTypeInformation
"HotFixID","InstalledOn","Caption","Description"
"KB2718704","2014/02/20 0:00:00","http://support.microsoft.com/?kbid=2718704","Update"
"KB2718791","2014/02/20 0:00:00","http://support.microsoft.com/?kbid=2718791","Update"
"KB2719985","2014/02/20 0:00:00","http://support.microsoft.com/?kbid=2719985","Security Update"
"KB2729457","2014/02/20 0:00:00","http://support.microsoft.com/?kbid=2729457","Security Update"
"KB2737082","2014/02/20 0:00:00","http://support.microsoft.com/?kbid=2737082","Security Update"
"KB2753842","2014/02/20 0:00:00","http://support.microsoft.com/?kbid=2753842","Security Update"
"KB2758857","2014/02/20 0:00:00","http://support.microsoft.com/?kbid=2758857","Security Update"
"KB2761226","2014/02/20 0:00:00","http://support.microsoft.com/?kbid=2761226","Security Update"
"KB2779030","2014/02/20 0:00:00","http://support.microsoft.com/?kbid=2779030","Security Update"
"KB2785605","2014/02/20 0:00:00","http://support.microsoft.com/?kbid=2785605","Update"

■w3m位は欲しいですね。。。

> Get-WmiObject -Class Win32_QuickFixEngineering | Where-Object {$_.InstalledBy -like "*Administrator"} | Select-Object Caption | Format-Table -HideTableHeaders > unix.list

$ for list in `nkf -Lu -d -w unix.list`;do \
    w3m -dump_source ${list} 2>/dev/null | \
      sed s/"<"/"\n&"/g | grep "^<a href=.mailto:.body=KB" | \
      awk -F\" '{print $2}' | grep [A-z] || echo "$list" | awk -F= '{print $2}'; \
  done
mailto:?body=KB2718704 Unauthorized digital certificates could allow spoofing http://support.microsoft.com/kb/2718704
2718791
mailto:?body=KB2719985 MS12-043: Description of the security update for XML Core Services 3.0: July 10, 2012 http://support.microsoft.com/kb/2719985
2729457
2737082
mailto:?body=KB2753842 MS12-078: Description of the security update for the Windows OpenType Compact Font Format (CFF) driver: December 11, 2012 http://support.microsoft.com/kb/2753842
mailto:?body=KB2758857 MS12-081: Vulnerability in Windows file handling component could allow remote code execution: December 11, 2012 http://support.microsoft.com/kb/2758857
mailto:?body=KB2761226 MS12-075: Vulnerabilities in Windows kernel-mode drivers could allow remote code execution: November 13, 2012 http://support.microsoft.com/kb/2761226
mailto:?body=KB2779030 MS12-078: Description of the security update for Windows kernel-mode drivers: December 11, 2012 http://support.microsoft.com/kb/2779030
mailto:?body=KB2785605 Microsoft Security Advisory: Update for Vulnerabilities in Adobe Flash Player in Internet Explorer 10 http://support.microsoft.com/kb/2785605

■役割と機能のプロパティ

PS> Import-Module ServerManager
PS> Get-WindowsFeature | Get-Member -MemberType property


   TypeName: Microsoft.Windows.ServerManager.Commands.Feature

Name                      MemberType Definition
----                      ---------- ----------
AdditionalInfo            Property   hashtable AdditionalInfo {get;}
BestPracticesModelId      Property   string BestPracticesModelId {get;}
DependsOn                 Property   string[] DependsOn {get;}
Depth                     Property   int Depth {get;}
Description               Property   string Description {get;}
DisplayName               Property   string DisplayName {get;}
EventQuery                Property   string EventQuery {get;}
FeatureType               Property   string FeatureType {get;}
Installed                 Property   bool Installed {get;}
InstallState              Property   Microsoft.Windows.ServerManager.Commands.InstallState InstallState {get;}
Name                      Property   string Name {get;}
Notification              Property   Microsoft.Windows.ServerManager.ServerComponentManager.Internal.Notification[] ...
Parent                    Property   string Parent {get;}
Path                      Property   string Path {get;}
PostConfigurationNeeded   Property   bool PostConfigurationNeeded {get;}
ServerComponentDescriptor Property   psobject ServerComponentDescriptor {get;}
SubFeatures               Property   string[] SubFeatures {get;}
SystemService             Property   string[] SystemService {get;}

■デフォルトでインストールされている役割の一覧

PS> Get-WindowsFeature | Select-Object Depth,Installed,FeatureType,DisplayName | Where-Object {($_.Installed -eq "True") -and ($_.FeatureType -eq "Role")} | ConvertTo-Csv -NoTypeInformation
"Depth","Installed","FeatureType","DisplayName"
"1","True","Role","ファイル サービスおよび記憶域サービス"

■デフォルトでインストールされている機能の一覧
 「深さかインデントか、それが問題だ。」

PS> Get-WindowsFeature | Select-Object Depth,Installed,FeatureType,DisplayName | Where-Object {($_.Installed -eq "True") -and ($_.FeatureType -eq "Feature")} | ConvertTo-Csv -NoTypeInformation
"Depth","Installed","FeatureType","DisplayName"
"1","True","Feature",".NET Framework 4.5 Features"
"2","True","Feature",".NET Framework 4.5"
"2","True","Feature","WCF サービス"
"3","True","Feature","TCP ポート共有"
"1","True","Feature","Windows PowerShell"
"2","True","Feature","Windows PowerShell 3.0"
"2","True","Feature","Windows PowerShell ISE"
"1","True","Feature","WoW64 サポート"
"1","True","Feature","ユーザー インターフェイスとインフラストラクチャ"
"2","True","Feature","グラフィック管理ツールとインフラストラクチャ"
"2","True","Feature","サーバー グラフィック シェル"

■見慣れた一覧で。


PS> Get-WindowsFeature | Where-Object {($_.Installed -eq "True") -and ($_.FeatureType -eq "Role")}

Display Name                                            Name                       Install State
------------                                            ----                       -------------
[X] ファイル サービスおよび記憶域サービス               FileAndStorage-Services        Installed

PS> Get-WindowsFeature | Where-Object {($_.Installed -eq "True") -and ($_.FeatureType -eq "Feature")}

Display Name                                            Name                       Install State
------------                                            ----                       -------------
[X] .NET Framework 4.5 Features                         NET-Framework-45-Fea...        Installed
    [X] .NET Framework 4.5                              NET-Framework-45-Core          Installed
    [X] WCF サービス                                    NET-WCF-Services45             Installed
        [X] TCP ポート共有                              NET-WCF-TCP-PortShar...        Installed
[X] Windows PowerShell                                  PowerShellRoot                 Installed
    [X] Windows PowerShell 3.0                          PowerShell                     Installed
    [X] Windows PowerShell ISE                          PowerShell-ISE                 Installed
[X] WoW64 サポート                                      WoW64-Support                  Installed
[X] ユーザー インターフェイスとインフラストラクチャ     User-Interfaces-Infra          Installed
    [X] グラフィック管理ツールとインフラストラクチャ    Server-Gui-Mgmt-Infra          Installed
    [X] サーバー グラフィック シェル                    Server-Gui-Shell               Installed