From: newton-cn Date: Sat, 3 May 2025 08:25:07 +0000 (+0900) Subject: powershell X-Git-Url: https://git.insang.kr/gitweb/?a=commitdiff_plain;h=6d5d522f8a171cbc0c3a624d0f289cba1a08b475;p=newton-cn_pos.git powershell --- diff --git a/newton-cn/bin/Modules/AppBackgroundTask/AppBackgroundTask.psd1 b/newton-cn/bin/Modules/AppBackgroundTask/AppBackgroundTask.psd1 deleted file mode 100644 index 863a5cf..0000000 --- a/newton-cn/bin/Modules/AppBackgroundTask/AppBackgroundTask.psd1 +++ /dev/null @@ -1,35 +0,0 @@ -@{ - GUID = '{eb40bd55-3bab-4fa6-88ee-0dcf3cad5a25}' - Author = 'Microsoft Corporation' - CompanyName = 'Microsoft Corporation' - Copyright = '© Microsoft Corporation. All rights reserved.' - ModuleVersion = '1.0.0.0' - PowerShellVersion = '5.1' - HelpInfoUri = "https://go.microsoft.com/fwlink/?LinkID=286813" - - NestedModules = @( - "PS_BackgroundTask.cdxml", - "microsoft.windows.appbackgroundtask.commands.dll") - FunctionsToExport = @( - "Unregister-AppBackgroundTask", - "Get-AppBackgroundTask", - "Start-AppBackgroundTask" - ) - AliasesToExport = @( - 'iru', - 'pfn', - 'tid' - ) - CmdletsToExport = @( - "Disable-AppBackgroundTaskDiagnosticLog", - "Enable-AppBackgroundTaskDiagnosticLog", - "Set-AppBackgroundTaskResourcePolicy" - ) - FormatsToProcess = @( - 'MSFT_BackgroundTask.Format.ps1xml' - ) - CompatiblePSEditions = @( - 'Core', - 'Desktop' - ) -} diff --git a/newton-cn/bin/Modules/AppBackgroundTask/MSFT_BackgroundTask.Format.ps1xml b/newton-cn/bin/Modules/AppBackgroundTask/MSFT_BackgroundTask.Format.ps1xml deleted file mode 100644 index aec4c60..0000000 --- a/newton-cn/bin/Modules/AppBackgroundTask/MSFT_BackgroundTask.Format.ps1xml +++ /dev/null @@ -1,266 +0,0 @@ - - - - - MSFT_BackgroundTask_TableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_BackgroundTask - - - - - 65 - - - - - - - - - - - - - - - PackageFullName - - - - try - { - $oldValue = $global:FormatEnumerationLimit - $global:FormatEnumerationLimit = 100 - $result="" - $result2="" - $rawUI = $Host.UI.RawUI.BufferSize.Width - if( $rawUI -gt 0 ) { - $maxLen = 0 - $finalLen = 0 - foreach($package in Get-AppxPackage) - { - $currPackage = $package.PackageFamilyName - if( $currPackage.Length -gt $maxLen ) { - $maxLen = $currPackage.Length - } - } - $finalLen = $maxLen - $rawUI = ($rawUI - 65) - $rawUI = ($rawUI / 2) - - for( $i = 0; $i -lt ($_.EntryPoint.Count); $i++ ) - { - if ( $rawUI -gt $_.EntryPoint[$i].Length ) { - $result2=$_.EntryPoint[$i] - $result2 = $result2.TrimStart("{") - $result2 = $result2.TrimEnd("}") - $result2 = $result2+"`r`n" - $result = $result+$result2 - } else { - $result2=$_.EntryPoint[$i] - $result2 = $result2.TrimStart("{") - $result2 = $result2.TrimEnd("}") - $result2 = $result2.Substring(0, ($rawUI - 7 ) )+"..." - $result2 = $result2+"`r`n" - $result = $result+$result2 - } - } - $result - - } else { - for( $i = 0; $i -lt ($_.EntryPoint.Count); $i++ ) - { - $result2=$_.EntryPoint[$i] - $result2 = $result2.TrimStart("{") - $result2 = $result2.TrimEnd("}") - $result2 = $result2.Substring(0, 22 )+"..." - $result2 = $result2+"`r`n" - $result = $result+$result2 - } - $result - } - - } - finally - { - $global:FormatEnumerationLimit = $oldvalue - } - - - - - try - { - $oldValue = $global:FormatEnumerationLimit - $global:FormatEnumerationLimit = 100 - $result="" - $result2="" - $rawUI = $Host.UI.RawUI.BufferSize.Width - - # Only dynamically resize if we're not in the default output layout - - if( $rawUI -gt 120) { - $maxLen = 0 - $finalLen = 0 - foreach($package in Get-AppxPackage) - { - $currPackage = $package.PackageFamilyName - if( $currPackage.Length -gt $maxLen ) { - $maxLen = $currPackage.Length - } - } - $finalLen = $maxLen - $rawUI = ($rawUI - 65) - $rawUI = ($rawUI / 2) - - for( $i = 0; $i -lt ($_.EntryPoint.Count); $i++ ) - { - if ( $rawUI -gt $_.TaskID[$i].Length ) { - $result2=$_.TaskID[$i] - $result2 = $result2.TrimStart("{") - $result2 = $result2.TrimEnd("}") - $result2 = $result2+"`r`n" - $result = $result+$result2 - } else { - $result2=$_.TaskID[$i] - $result2 = $result2.TrimStart("{") - $result2 = $result2.TrimEnd("}") - $result2 = $result2.Substring(0, ($rawUI - 5 ) )+"..." - $result2 = $result2+"`r`n" - $result = $result+$result2 - } - } - $result - - } else { - for( $i = 0; $i -lt ($_.EntryPoint.Count); $i++ ) - { - $result2=$_.TaskID[$i] - $result2 = $result2.TrimStart("{") - $result2 = $result2.TrimEnd("}") - $result2 = $result2.Substring(0, 22 )+"..." - $result2 = $result2+"`r`n" - $result = $result+$result2 - } - $result - } - - } - finally - { - $global:FormatEnumerationLimit = $oldvalue - } - - - - - - - - - MSFT_BackgroundTask_ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_BackgroundTask - - - - - - - - $_.PackageFullName - - - - - try - { - $oldValue = $global:FormatEnumerationLimit - $global:FormatEnumerationLimit = 100 - $result="" - $result2="" - $resultEntryPoint="" - $resultTaskID="" - for( $i = 0; $i -lt ($_.Taskname.Count); $i++ ) - { - $result2="TaskName: "+$_.TaskName[$i] - $result2 = $result2+"`r`n" - $result2 = $result2+"EntryPoint: " - $resultEntryPoint = $_.EntryPoint[$i] - $resultEntryPoint = $resultEntryPoint.TrimStart("{") - $resultEntryPoint = $resultEntryPoint.TrimEnd("}") - $result2= $result2+$resultEntryPoint+"`r`n" - $result2 = $result2+"TaskID: " - $resultTaskID = $_.TaskID[$i] - $resultTaskID = $resultTaskID.TrimStart("{") - $resultTaskID = $resultTaskID.TrimEnd("}") - $result2 = $result2+$resultTaskID - $result2 = $result2+"`r`n"+"`r`n" - $result = $result+$result2 - } - $result - } - finally - { - $global:FormatEnumerationLimit = $oldvalue - } - - - - - - PerfInfo - - - try - { - $oldValue = $global:FormatEnumerationLimit - $global:FormatEnumerationLimit = 100 - if($_.PerfInfo.Count -gt 0) - { - $result="" - $result2="" - for( $i = 0; $i -lt ($_.PerfInfo.Count); $i++ ) - { - $result2=$_.PerfInfo[$i] - $result2 = $result2+"`r`n" - $result = $result+$result2 - } - $result - } - else - { - $result="Resource usage not requested." - $result - } - } - finally - { - $global:FormatEnumerationLimit = $oldvalue - } - - - - - - - - - MSFT_BackgroundTask_WideView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_BackgroundTask - - - 2 - - - - PackageFullName - - - - - - - diff --git a/newton-cn/bin/Modules/AppBackgroundTask/Microsoft.Windows.AppBackgroundTask.Commands.dll b/newton-cn/bin/Modules/AppBackgroundTask/Microsoft.Windows.AppBackgroundTask.Commands.dll deleted file mode 100644 index 3e52a25..0000000 Binary files a/newton-cn/bin/Modules/AppBackgroundTask/Microsoft.Windows.AppBackgroundTask.Commands.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/AppBackgroundTask/PS_BackgroundTask.cdxml b/newton-cn/bin/Modules/AppBackgroundTask/PS_BackgroundTask.cdxml deleted file mode 100644 index e98d4fb..0000000 --- a/newton-cn/bin/Modules/AppBackgroundTask/PS_BackgroundTask.cdxml +++ /dev/null @@ -1,79 +0,0 @@ - - - - 1.0 - AppBackgroundTask - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/AppLocker/AppLocker.psd1 b/newton-cn/bin/Modules/AppLocker/AppLocker.psd1 deleted file mode 100644 index dcb4973..0000000 Binary files a/newton-cn/bin/Modules/AppLocker/AppLocker.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/AppvClient/AppVClientCmdlets.format.ps1xml b/newton-cn/bin/Modules/AppvClient/AppVClientCmdlets.format.ps1xml deleted file mode 100644 index e014218..0000000 --- a/newton-cn/bin/Modules/AppvClient/AppVClientCmdlets.format.ps1xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - VirtualProcess - - System.Diagnostics.Process#AppVVirtualProcess - - - - - - 7 - right - - - - 7 - right - - - - 8 - right - - - - 10 - right - - - - 5 - right - - - - 8 - right - - - - - 8 - right - - - - - 15 - right - - - - - left - - - - - - - - HandleCount - - - [int]($_.NPM / 1024) - - - [int]($_.PM / 1024) - - - [int]($_.WS / 1024) - - - [int]($_.VM / 1048576) - - - -if ($_.CPU -ne $()) -{ - $_.CPU.ToString("N") -} - - - - Id - - - ProcessName - - - $_.VirtualProcessInformation.UserSid - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/AppvClient/AppVClientCmdlets.psm1 b/newton-cn/bin/Modules/AppvClient/AppVClientCmdlets.psm1 deleted file mode 100644 index 94e8bd3..0000000 --- a/newton-cn/bin/Modules/AppvClient/AppVClientCmdlets.psm1 +++ /dev/null @@ -1,242 +0,0 @@ -# .ExternalHelp Microsoft.AppV.AppVClientPowerShell.dll-Help.xml - -function Get-AppvVirtualProcess -{ -[CmdletBinding(DefaultParameterSetName='Name')] -param( - [Parameter(ParameterSetName='Name', Position=0, ValueFromPipelineByPropertyName=$true)] - [Alias('ProcessName')] - [ValidateNotNullOrEmpty()] - [System.String[]] - ${Name}, - - [Parameter(ParameterSetName='Id', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] - [Alias('PID')] - [System.Int32[]] - ${Id}, - - [Parameter(ValueFromPipelineByPropertyName=$true)] - [Alias('Cn')] - [ValidateNotNullOrEmpty()] - [System.String[]] - ${ComputerName}, - - [ValidateNotNull()] - [Switch] - ${Module}, - - [Alias('FV','FVI')] - [ValidateNotNull()] - [Switch] - ${FileVersionInfo}, - - [Parameter(ParameterSetName='InputObject', Mandatory=$true, ValueFromPipeline=$true)] - [System.Diagnostics.Process[]] - ${InputObject}) - -begin -{ - try { - $comConsumer = New-Object Microsoft.AppV.AppvClientFacade.ClientComConsumer - $processList = $null - try { - $processList = $comConsumer.GetAllVirtualProcesses() - } catch { - $processList = $comConsumer.GetUserVirtualProcesses() - } - - if ($FileVersionInfo) - { - $PSBoundParameters['FileVersionInfo'] = $false - } - - $outBuffer = $null - if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) - { - $PSBoundParameters['OutBuffer'] = 1 - } - $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Get-Process', [System.Management.Automation.CommandTypes]::Cmdlet) - $scriptCmd = {& $wrappedCmd @PSBoundParameters | foreach { - if ($processList.ContainsKey($_.Id)) { - Add-Member -InputObject $_ -MemberType NoteProperty -Name AppvPackageData -Value ($processList.Item($_.Id)) - if ($FileVersionInfo) { - $_.MainModule.FileVersionInfo - } else { - $_ - } - } - }} - $steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin) - $steppablePipeline.Begin($PSCmdlet) - } catch { - throw - } -} - -process -{ - try { - $steppablePipeline.Process($_) - } catch { - throw - } -} - -end -{ - try { - $steppablePipeline.End() - } catch { - throw - } -} -} - -# .ExternalHelp Microsoft.AppV.AppVClientPowerShell.dll-Help.xml - -function Start-AppvVirtualProcess -{ -[CmdletBinding(DefaultParameterSetName='Default')] -param( - [Parameter(Mandatory=$true, Position=0)] - [Alias('PSPath')] - [ValidateNotNullOrEmpty()] - [System.String] - ${FilePath}, - - [Parameter(Position=1)] - [Alias('Args')] - [ValidateNotNullOrEmpty()] - [System.String[]] - ${ArgumentList}, - - [Parameter(ParameterSetName='Default')] - [Alias('RunAs')] - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - ${Credential}, - - [ValidateNotNullOrEmpty()] - [System.String] - ${WorkingDirectory}, - - [Parameter(ParameterSetName='Default')] - [Alias('Lup')] - [Switch] - ${LoadUserProfile}, - - [Parameter(ParameterSetName='Default')] - [Alias('nnw')] - [Switch] - ${NoNewWindow}, - - [Switch] - ${PassThru}, - - [Parameter(ParameterSetName='Default')] - [Alias('RSE')] - [ValidateNotNullOrEmpty()] - [System.String] - ${RedirectStandardError}, - - [Parameter(ParameterSetName='Default')] - [Alias('RSI')] - [ValidateNotNullOrEmpty()] - [System.String] - ${RedirectStandardInput}, - - [Parameter(ParameterSetName='Default')] - [Alias('RSO')] - [ValidateNotNullOrEmpty()] - [System.String] - ${RedirectStandardOutput}, - - [Parameter(ParameterSetName='UseShellExecute')] - [ValidateNotNullOrEmpty()] - [System.String] - ${Verb}, - - [Switch] - ${Wait}, - - [Parameter(ParameterSetName='UseShellExecute')] - [ValidateNotNullOrEmpty()] - [System.Diagnostics.ProcessWindowStyle] - ${WindowStyle}, - - [Parameter(ParameterSetName='Default')] - [Switch] - ${UseNewEnvironment}, - - [Parameter(Mandatory=$true)] - ${AppvClientObject}) - -begin -{ - try { - $outBuffer = $null - if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) - { - $PSBoundParameters['OutBuffer'] = 1 - } - $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Start-Process', [System.Management.Automation.CommandTypes]::Cmdlet) - - if($AppvClientObject -is [Microsoft.AppV.AppvClientPowerShell.AppvClientPackage]) - { - if (-not (Get-AppvClientPackage -PackageId $AppvClientObject.PackageId -VersionId $AppvClientObject.VersionId) ) - { - $message = [Microsoft.AppV.AppvClientPowerShell.ResourceRetriever]::GetString("VirtProcessCannotStartBecausePackageNotFound") - throw $message - } - - $PSBoundParameters['ArgumentList'] += "/AppvVe:$($AppvClientObject.PackageId)_$($AppvClientObject.VersionId)" - } - elseif($AppvClientObject -is [Microsoft.AppV.AppvClientPowerShell.AppvClientConnectionGroup]) - { - if (-not (Get-AppvClientConnectionGroup -GroupId $AppvClientObject.GroupId -VersionId $AppvClientObject.VersionId) ) - { - $message = [Microsoft.AppV.AppvClientPowerShell.ResourceRetriever]::GetString("VirtProcessCannotStartBecauseGroupNotFound") - throw $message - } - - $PSBoundParameters['ArgumentList'] += "/AppvVe:$($AppvClientObject.GroupId)_$($AppvClientObject.VersionId)" - } - else - { - $message = [Microsoft.AppV.AppvClientPowerShell.ResourceRetriever]::GetString("InvalidObjectTypeForStartVirtProcess") - throw $message - } - - [Void]$PSBoundParameters.Remove("AppvClientObject") - $scriptCmd = {& $wrappedCmd @PSBoundParameters } - - $steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin) - $steppablePipeline.Begin($PSCmdlet) - } catch { - throw - } -} - -process -{ - [Void][Microsoft.AppV.SharedPerformance.Tracing.PROVIDER_MICROSOFT_APPV_CLIENT_SHAREDPERFORMANCEEVENTS]::Write_ClientProgrammability_StartStartAppvVirtualProcess($FilePath) - - try { - $steppablePipeline.Process($_) - } catch { - throw - } - finally { - [Void][Microsoft.AppV.SharedPerformance.Tracing.PROVIDER_MICROSOFT_APPV_CLIENT_SHAREDPERFORMANCEEVENTS]::Write_ClientProgrammability_StopStartAppvVirtualProcess($FilePath) - } -} - -end -{ - try { - $steppablePipeline.End() - } catch { - throw - } -} -} diff --git a/newton-cn/bin/Modules/AppvClient/AppvClient.psd1 b/newton-cn/bin/Modules/AppvClient/AppvClient.psd1 deleted file mode 100644 index 9ca404e..0000000 --- a/newton-cn/bin/Modules/AppvClient/AppvClient.psd1 +++ /dev/null @@ -1,25 +0,0 @@ -@{ -ModuleVersion = '1.0.0.0' - -GUID = '596D7B43-928B-44D4-89E7-17D34740ECC2' - -Author = 'Microsoft Corporation' - -CompanyName = 'Microsoft Corporation' - -Copyright = '© Microsoft Corporation. All rights reserved.' - -Description = 'Microsoft Application Virtualization Client Module' - -RequiredAssemblies = 'Microsoft.AppV.AppvClientComConsumer.dll' - -NestedModules = 'Microsoft.AppV.AppVClientPowerShell', 'AppVClientCmdlets.psm1' - -ProcessorArchitecture = 'AMD64' - -# Location from which to download updateable help -HelpInfoURI = "https://go.microsoft.com/fwlink/?LinkId=403112 " - -FunctionsToExport = 'Get-AppvVirtualProcess', 'Start-AppvVirtualProcess' - -} diff --git a/newton-cn/bin/Modules/AppvClient/Microsoft.AppV.AppVClientPowerShell.dll b/newton-cn/bin/Modules/AppvClient/Microsoft.AppV.AppVClientPowerShell.dll deleted file mode 100644 index 5bd4a31..0000000 Binary files a/newton-cn/bin/Modules/AppvClient/Microsoft.AppV.AppVClientPowerShell.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/AppvClient/Microsoft.AppV.AppvClientComConsumer.dll b/newton-cn/bin/Modules/AppvClient/Microsoft.AppV.AppvClientComConsumer.dll deleted file mode 100644 index 200f316..0000000 Binary files a/newton-cn/bin/Modules/AppvClient/Microsoft.AppV.AppvClientComConsumer.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/AppvClient/Microsoft.AppV.ClientProgrammability.Eventing.dll b/newton-cn/bin/Modules/AppvClient/Microsoft.AppV.ClientProgrammability.Eventing.dll deleted file mode 100644 index 21776b1..0000000 Binary files a/newton-cn/bin/Modules/AppvClient/Microsoft.AppV.ClientProgrammability.Eventing.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/AppvClient/ko/Microsoft.AppV.AppVClientPowerShell.resources.dll b/newton-cn/bin/Modules/AppvClient/ko/Microsoft.AppV.AppVClientPowerShell.resources.dll deleted file mode 100644 index 5096d5f..0000000 Binary files a/newton-cn/bin/Modules/AppvClient/ko/Microsoft.AppV.AppVClientPowerShell.resources.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/AppvClient/ko/Microsoft.AppV.AppvClientComConsumer.resources.dll b/newton-cn/bin/Modules/AppvClient/ko/Microsoft.AppV.AppvClientComConsumer.resources.dll deleted file mode 100644 index cdcb8cc..0000000 Binary files a/newton-cn/bin/Modules/AppvClient/ko/Microsoft.AppV.AppvClientComConsumer.resources.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/Appx/Appx.format.ps1xml b/newton-cn/bin/Modules/Appx/Appx.format.ps1xml deleted file mode 100644 index eb72ce6..0000000 --- a/newton-cn/bin/Modules/Appx/Appx.format.ps1xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - TableView - - AppxDeploymentEventLog - - - - - - 25 - - - - 12 - - - - - - - - - - $_.timecreated - - - $_.id - - - $_.message - - - - - - - - - TableView - - Microsoft.Windows.Appx.PackageManager.Commands.AppxPackage - - - - - - - Name - - - Publisher - - - Architecture - - - ResourceId - - - Version - - - PackageFullName - - - InstallLocation - - - IsFramework - - - PackageFamilyName - - - PublisherId - - - PackageUserInformation - - ($_.PackageUserInformation.Count -gt 0) - - - - IsResourcePackage - - - IsBundle - - - IsDevelopmentMode - - - NonRemovable - - - Dependencies - - ($_.Dependencies.Count -gt 0) - - - - IsPartiallyStaged - - - SignatureKind - - - Status - - - - - - - - diff --git a/newton-cn/bin/Modules/Appx/Appx.psd1 b/newton-cn/bin/Modules/Appx/Appx.psd1 deleted file mode 100644 index dba9f3b..0000000 --- a/newton-cn/bin/Modules/Appx/Appx.psd1 +++ /dev/null @@ -1,31 +0,0 @@ -@{ - GUID = "{AEEF2BEF-EBA9-4A1D-A3D2-D0B52DF76DEB}" - AliasesToExport = @( - 'Add-AppPackage', - 'Get-AppPackage', - 'Get-AppPackageManifest', - 'Remove-AppPackage', - 'Get-AppPackageVolume', - 'Add-AppPackageVolume', - 'Remove-AppPackageVolume', - 'Mount-AppPackageVolume', - 'Dismount-AppPackageVolume', - 'Move-AppPackage', - 'Get-AppPackageDefaultVolume', - 'Set-AppPackageDefaultVolume', - 'Get-AppPackageLastError', - 'Get-AppPackageLog' - ) - Author = "Microsoft Corporation" - CmdletsToExport = 'Add-AppxPackage', 'Get-AppxPackage', 'Get-AppxPackageManifest', 'Remove-AppxPackage', 'Get-AppxVolume', 'Add-AppxVolume', 'Remove-AppxVolume', 'Mount-AppxVolume', 'Dismount-AppxVolume', 'Move-AppxPackage', 'Get-AppxDefaultVolume', 'Set-AppxDefaultVolume', 'Invoke-CommandInDesktopPackage' - CompanyName = "Microsoft Corporation" - Copyright = "© Microsoft Corporation. All rights reserved." - FunctionsToExport = 'Get-AppxLastError', 'Get-AppxLog' - HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=849912" - ModuleVersion = "2.0.1.0" - ModuleToProcess = 'Microsoft.Windows.Appx.PackageManager.Commands' - FormatsToProcess = 'Appx.format.ps1xml' - NestedModules = 'Appx.psm1' - CompatiblePSEditions = @('Desktop','Core') - PowerShellVersion="5.1" -} diff --git a/newton-cn/bin/Modules/Appx/Appx.psm1 b/newton-cn/bin/Modules/Appx/Appx.psm1 deleted file mode 100644 index 871a911..0000000 --- a/newton-cn/bin/Modules/Appx/Appx.psm1 +++ /dev/null @@ -1,119 +0,0 @@ -<# -Copyright (C) Microsoft. All rights reserved. -#> - -#requires -version 5.1 - -#.ExternalHelp Microsoft.Windows.Appx.PackageManager.Commands.dll-help.xml -Function Get-AppxLastError() -{ - [CmdletBinding(HelpUri="https://go.microsoft.com/fwlink/?LinkId=246401")] - param() - - Import-LocalizedData -bindingVariable msgTable - - # Search for last Add-AppxPackage related error - foreach ($err in $global:Error) - { - if ($err.FullyQualifiedErrorId -match - "DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand") - { - $command = (Get-History | ? {$_.CommandLine -imatch - "Add-AppxPackage"} |Select-Object -Last 1).CommandLine; - - # Read ActivityId from the Exception record - if ($err.Exception -imatch - "\[ActivityId\] ([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})") - { - Write-Host($msgTable.EventLogsFor + ' "' + $command + '"'); - # Retrieve Event Log messages for ActivityId - Get-WinEvent -LogName Microsoft-Windows-Appx* -Oldest | - Where-Object {$_.Activityid -eq $matches[1]} | - ForEach-Object{ - $null = $_.pstypenames.clear() - $null = $_.pstypenames.add('AppxDeploymentEventLog') - $_ - } - break; - } - } - } -} - -#.ExternalHelp Microsoft.Windows.Appx.PackageManager.Commands.dll-help.xml -Function Get-AppxLog() -{ - [CmdletBinding(DefaultParameterSetName="All", - HelpUri="https://go.microsoft.com/fwlink/?LinkId=246400")] - param([switch][parameter(parametersetname="All")]$All, - [string][parameter(parametersetname="ActivityId")]$ActivityId) - - switch($PsCmdlet.ParameterSetName) - { - "All" - { - if ($All) - { - # Get all deployment events - $logevents = Get-WinEvent -log Microsoft-Windows-AppxDeploy* - - # Select only unique activity IDs of deployment events - $activityids = $logevents |% {$_.activityid} | select -unique - - # Grab all logs associated with Appx Deployment - $logevents = Get-WinEvent -log Microsoft-Windows-Appx* - [array]::Reverse($logevents) - foreach($id in $activityids) - { - $logevents | - Where-Object {$_.activityid -eq $id} | - ForEach-Object{ - $null = $_.pstypenames.clear() - $null = $_.pstypenames.add('AppxDeploymentEventLog') - $_ - } - } - } - else - { - $ActivityId = get-winevent -log Microsoft-Windows-AppxDeploy* -max 1 |% {$_.ActivityId} - Get-WinEvent -log Microsoft-Windows-Appx* -oldest | - Where-Object {$_.activityid -eq $ActivityId} | - ForEach-Object{ - $null = $_.pstypenames.clear() - $null = $_.pstypenames.add('AppxDeploymentEventLog') - $_ - } - - } - } - "ActivityId" { Get-WinEvent -log Microsoft-Windows-Appx* -oldest | - Where-Object {$_.activityid -eq $ActivityId} | - ForEach-Object{ - $null = $_.pstypenames.clear() - $null = $_.pstypenames.add('AppxDeploymentEventLog') - $_ - } - } - - } -} - -Microsoft.PowerShell.Utility\Set-Alias Add-AppPackage Add-AppxPackage -Microsoft.PowerShell.Utility\Set-Alias Get-AppPackage Get-AppxPackage -Microsoft.PowerShell.Utility\Set-Alias Get-AppPackageManifest Get-AppxPackageManifest -Microsoft.PowerShell.Utility\Set-Alias Remove-AppPackage Remove-AppxPackage -Microsoft.PowerShell.Utility\Set-Alias Get-AppPackageVolume Get-AppxVolume -Microsoft.PowerShell.Utility\Set-Alias Add-AppPackageVolume Add-AppxVolume -Microsoft.PowerShell.Utility\Set-Alias Remove-AppPackageVolume Remove-AppxVolume -Microsoft.PowerShell.Utility\Set-Alias Mount-AppPackageVolume Mount-AppxVolume -Microsoft.PowerShell.Utility\Set-Alias Dismount-AppPackageVolume Dismount-AppxVolume -Microsoft.PowerShell.Utility\Set-Alias Move-AppPackage Move-AppxPackage -Microsoft.PowerShell.Utility\Set-Alias Get-AppPacakgeDefaultVolume Get-AppxDefaultVolume -Microsoft.PowerShell.Utility\Set-Alias Set-AppPackageDefaultVolume Set-AppxDefaultVolume -Microsoft.PowerShell.Utility\Set-Alias Get-AppPackageLastError Get-AppxLastError -Microsoft.PowerShell.Utility\Set-Alias Get-AppPackageLog Get-AppxLog - -Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-AppxLastError' -Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-AppxLog' -Microsoft.PowerShell.Core\Export-ModuleMember -Alias * diff --git a/newton-cn/bin/Modules/Appx/ko-KR/Appx.psd1 b/newton-cn/bin/Modules/Appx/ko-KR/Appx.psd1 deleted file mode 100644 index cf6bfd9..0000000 --- a/newton-cn/bin/Modules/Appx/ko-KR/Appx.psd1 +++ /dev/null @@ -1,4 +0,0 @@ -# Localized 12/07/2019 08:21 AM (GMT) 303:6.40.20520 AppxStrings.psd1 -ConvertFrom-StringData @' - EventLogsFor=Event logs for command: -'@ diff --git a/newton-cn/bin/Modules/AssignedAccess/AssignedAccess.psd1 b/newton-cn/bin/Modules/AssignedAccess/AssignedAccess.psd1 deleted file mode 100644 index 4612109..0000000 --- a/newton-cn/bin/Modules/AssignedAccess/AssignedAccess.psd1 +++ /dev/null @@ -1,13 +0,0 @@ -@{ -RootModule = '.\AssignedAccess.psm1' -ModuleVersion = '1.0.0.0' -GUID = "{9E72217E-9E27-45F7-81FC-048763587E0A}" -Author = 'Microsoft Corporation' -CompanyName = 'Microsoft Corporation' -Copyright = '(c) Microsoft Corporation. All rights reserved.' -HelpInfoURI = "https://go.microsoft.com/fwlink/?linkid=311962" -FunctionsToExport = @("Clear-AssignedAccess", "Get-AssignedAccess", "Set-AssignedAccess") -CmdletsToExport = @() -AliasesToExport = @() -CompatiblePSEditions = @('Desktop','Core') -} diff --git a/newton-cn/bin/Modules/AssignedAccess/AssignedAccess.psm1 b/newton-cn/bin/Modules/AssignedAccess/AssignedAccess.psm1 deleted file mode 100644 index b2c0700..0000000 --- a/newton-cn/bin/Modules/AssignedAccess/AssignedAccess.psm1 +++ /dev/null @@ -1,342 +0,0 @@ -<# -Copyright (C) Microsoft. All rights reserved. -#> - -# String table for localizable messages to be returned to the user. -$SCStringTable = Data { - ConvertFrom-StringData @' - AppliedSettings = User and Application set, log on as this user to start Assigned Access - ClearedSettings = Cleared Assigned Access, settings reset to factory defaults - ErrorUserNotFound = User was not found. Enter a valid local account UserName or UserSID - ErrorAppNotFound = Application was not found. Enter either a valid AppName or AUMID - ErrorProvisionedAppNameUsed = The app couldn't be set for assigned access by name at this time, run the cmdlet again using the -AppUserModelId option - DeletingInstance = Deleting {0} - ErrorUserDoesNotExist = The assigned access user does not exist: {0}. Run Clear-AssignedAccess to clear assigned access. - ErrorAppDoesNotExist = The assigned access application does not exist: {0}. Run Clear-AssignedAccess to clear assigned access. - ErrorCurrentUserNotAllowed = The assigned access user cannot be set to the current logged in account. - ErrorConnectedUserNotAllowed = You can only set up assigned access for a local standard user account that does not have a Microsoft account associated with it. - ConfirmSet = Set assigned access application to {0} - ConfirmClear = Clear assigned access - ErrorInsufficientPrivilege = This script must be run with Administrator privileges. -'@ -} - -# C# Interop class/interface to check user connected info -$TypeDefinition = @" -using System; -using System.Runtime.InteropServices; -namespace LockdownWMI -{ - // Declare IEnumUnknown - [ - ComImport, - Guid("00000100-0000-0000-C000-000000000046"), - InterfaceType(ComInterfaceType.InterfaceIsIUnknown) - ] - public interface IEnumUnknown - { - } - - // Declare IConnectedUser - [ - ComImport, - Guid("9D5F2149-DE8C-45F2-B313-6587A04F771D"), - InterfaceType(ComInterfaceType.InterfaceIsIUnknown) - ] - public interface IConnectedUser - { - } - - // Declare IConnectedUserStore - [ - ComImport, - Guid("9EC044BC-B01D-4C18-8634-59BD3FF5DCC1"), - InterfaceType(ComInterfaceType.InterfaceIsIUnknown) - ] - public interface IConnectedUserStore - { - int GetConnectedUserEnum( - uint Options, - ref Guid pProviderGUID, - ref IEnumUnknown ppUserEnum - ); - - int CreateConnectedUser( - string LocalUserName, - string IdentityUserName, - ref Guid ProviderGUID, - bool IsAdmin, - IntPtr AuthBuffer, - uint AuthBufferSize - ); - - int ConnectLocalUser( - string LocalPassword, - ref Guid ProviderGUID, - IntPtr AuthBuffer, - uint AuthBufferSize - ); - - int FindConnectedUserByName( - string IdentityUserName, - string ProviderName, - ref Guid pProviderGUID, - ref IConnectedUser ppConnectedUser - ); - - int FindConnectedUserBySid( - IntPtr Sid, - uint SidLength, - ref IConnectedUser ppConnectedUser - ); - } - - // Declare CConnectedUserStore - [ - ComImport, - Guid("40AFA0B6-3B2F-4654-8C3F-161DE85CF80E") - ] - public class CConnectedUserStore {} - - public class UserCheck - { - public static bool IsConnectedUser(String userSid) - { - IConnectedUser connectedUser = null; - IntPtr intPtrSid = IntPtr.Zero; - IConnectedUserStore userStore = (IConnectedUserStore)new CConnectedUserStore(); - try { - bool success = ConvertStringSidToSid(userSid, ref intPtrSid); - if(success) - { - uint sidLength = GetLengthSid(intPtrSid); - userStore.FindConnectedUserBySid(intPtrSid, sidLength, ref connectedUser); - } - } catch (Exception) - { - connectedUser = null; - } - - Marshal.FreeHGlobal(intPtrSid); - return (connectedUser != null); - } - - [DllImport("Advapi32.dll", EntryPoint="ConvertStringSidToSid", CallingConvention=CallingConvention.Winapi, SetLastError=true)] - private static extern bool ConvertStringSidToSid(string strSID, ref IntPtr sid); - - [DllImport("Advapi32.dll", EntryPoint="GetLengthSid", CallingConvention = CallingConvention.Winapi, SetLastError=true)] - private static extern uint GetLengthSid(IntPtr pSid); - } -} -"@ - -try { Add-Type -TypeDefinition $TypeDefinition } catch {} - -$CommonArgs = @{"namespace"="root\standardcimv2\embedded"} - -Import-LocalizedData -BindingVariable SCStringTable -FileName "AssignedAccessMsg.psd1" - -function IsCurrentUserAdmin -{ - [bool](([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) -} - -# .EXTERNALHELP AssignedAccess-help.xml -function Get-AssignedAccess -{ - [CmdletBinding()] - param() - - if (-Not (IsCurrentUserAdmin)) - { - throw $SCStringTable.ErrorInsufficientPrivilege - } - - # Display the instances in WEDL_AssignedAccess - $instance = Get-CimInstance -ClassName WEDL_AssignedAccess @CommonArgs - if(!$instance) { - return - } - - try { - $objSID = New-Object System.Security.Principal.SecurityIdentifier($instance.UserSID) - $objUser = $objSID.Translate([System.Security.Principal.NTAccount]) - } catch { - Write-Error ($SCStringTable.ErrorUserDoesNotExist -f $instance.UserSID) - return - } - - # Tokenizing the app user model id to obtain the app package family name, at index [0] - # aumid = [appx.packagefamilyname]![appxmanifest.id] - $temp = $instance.AppUserModelId.split("!") - $appPackageFamilyName = $temp[0] - - # determining the app name by comparing the app package family name - $appName = (Get-AppxPackage -User $objUser.Value) | Where-Object -Property 'PackageFamilyName' -eq $appPackageFamilyName | Select-Object -Expand Name -First 1 - if(!$appName) { - $temp = $appPackageFamilyName.split("_") - $appName = $temp[0] - } - - # Outputting the details - [PSCustomObject] @{ - UserSID = $instance.UserSID; - UserName = $objUser.Value; - AppUserModelId = $instance.AppUserModelId; - AppName = $appName; - } -} - -# .EXTERNALHELP AssignedAccess-help.xml -function Set-AssignedAccess -{ - [CmdletBinding(DefaultParameterSetName="UserNameANDAppName", - SupportsShouldProcess=$True)] - param( - [parameter(ParameterSetName='UserNameANDAppName', Mandatory=$true)] - [parameter(ParameterSetName='UserNameANDAppId', Mandatory=$true)] - [String] - $UserName, - - [parameter(ParameterSetName='UserSidANDAppName', Mandatory=$true)] - [parameter(ParameterSetName='UserSidANDAppId', Mandatory=$true)] - [String] - $UserSID, - - [parameter(ParameterSetName='UserNameANDAppId', Mandatory=$true)] - [parameter(ParameterSetName='UserSidANDAppId', Mandatory=$true)] - [alias("AUMID")] - [String] - $AppUserModelId, - - [parameter(ParameterSetName='UserNameANDAppName', Mandatory=$true)] - [parameter(ParameterSetName='UserSidANDAppName', Mandatory=$true)] - [String] - $AppName - ) - - if (-Not (IsCurrentUserAdmin)) - { - throw $SCStringTable.ErrorInsufficientPrivilege - } - - try { - # Resolve the user name to its SID if it is passed - if ($UserName) { - $objUser = New-Object System.Security.Principal.NTAccount($UserName) - $UserSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier]).Value - } - - # Validate the SID - # For UserName passed in, convert it into the format Domain\UserName or MachineName\UserName - $objSID = New-Object System.Security.Principal.SecurityIdentifier($UserSID) - $UserName = $objSID.Translate([System.Security.Principal.NTAccount]) - - } catch { - throw $SCStringTable.ErrorUserNotFound - } - - # UserName has been converted to Domain\UserName or MachineName\UserName - # Throw error if UserNamePrefix is not the same as MachineName - # We do not allow configuring AssignedAccss to domain account from Powershell - - $UserNamePrefix = $UserName.Split("\")[0] - $UserNameSuffix = $UserName.Split("\")[1] - if(diff $UserNamePrefix $env:COMPUTERNAME) - { - throw $SCStringTable.ErrorUserNotFound - } - - # Parse output of the command "net localgroup administrators" and try to find $UserName - # if it's not found, it's not admin, we can move on - # otherwise throw an exception because we don't allow admin to be AA account - $NetEXE = $env:SystemDrive + "\windows\system32\net.exe localgroup administrators" - $UserStringFromNetCommand = Invoke-Expression $NetEXE | Where {$_ -eq $UserNameSuffix} - if(!([String]::IsNullOrEmpty($UserStringFromNetCommand))) - { - throw $SCStringTable.ErrorUserNotFound - } - - # If passed in UserSID is the same as current user, do not apply assigned access and return error - $CurrentUserSID = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value - if(!(diff $CurrentUserSID $UserSID)) - { - throw $SCStringTable.ErrorCurrentUserNotAllowed - } - - # If the UserSID represents a user with user connected info (bound with MS account), do not apply assigned access and return error - if([LockdownWMI.UserCheck]::IsConnectedUser($UserSID)) - { - throw $SCStringTable.ErrorConnectedUserNotAllowed - } - - # If the AppName is passed, resolve it to its AppUserModelId - if ($AppName) { - # Selects the first object in case Get-AppxPackage returns multiple packages (if multiple versions of the app exist). - $AppxPkg = ((Get-AppxPackage -User $UserSID -Name $AppName) | Select-Object -First 1) - - if (!$AppxPkg) { - # try to find a provisioned app (DismAppxPackage) based on $AppName - # - if we can find one, throw error and ask user to user -AppUserModelId option - # because for provisioned app, we cannot parse AppName into AUMID in powershell - # - if not, throw regular error - $provisionedApp = Get-AppxProvisionedPackage -online | Where-Object {$_.DisplayName -eq $AppName} - if($provisionedApp) { - throw $SCStringTable.ErrorProvisionedAppNameUsed - } - else { - throw $SCStringTable.ErrorAppNotFound - } - } - - $AppUserModelId = $AppxPkg.PackageFamilyName + "!" + ($AppxPkg | Get-AppxPackageManifest -User $UserSID).Package.Applications.Application.Id - } - - if ($PSCmdlet.ShouldProcess($UserName, ($SCStringTable.ConfirmSet -f $AppUserModelId))) { - - # Check if an instance already exists. We only allow a single instance of WEDL_AssignedAccess. - $instance = Get-CimInstance -ClassName WEDL_AssignedAccess @CommonArgs - if ($instance -and $instance.UserSID -eq $UserSID) { - # Update AppID of existing instance - $instance | Set-CimInstance -Property @{AppUserModelId=$AppUserModelId} -ErrorAction Stop -Confirm:$false - } else { - # If an instance already exists with a different username, - # delete it before creating a new one. - if ($instance) { - Write-Verbose ($SCStringTable.DeletingInstance -f $UserName) - $instance | Remove-CimInstance -Confirm:$false - } - - New-CimInstance -ClassName WEDL_AssignedAccess -Property @{UserSID=$UserSID; AppUserModelId=$AppUserModelId} @CommonArgs -ErrorAction Stop -Confirm:$false | Out-Null - } - Write-Verbose $SCStringTable.AppliedSettings - } -} - -# .EXTERNALHELP AssignedAccess-help.xml -function Clear-AssignedAccess -{ - [CmdletBinding(SupportsShouldProcess=$True)] - param() - - if (-Not (IsCurrentUserAdmin)) - { - throw $SCStringTable.ErrorInsufficientPrivilege - } - - $instance = Get-CimInstance -ClassName WEDL_AssignedAccess @CommonArgs - if ($instance) { - # attempt to translate SID to user name - try { - $objSID = New-Object System.Security.Principal.SecurityIdentifier($instance.UserSID) - $UserName = $objSID.Translate([System.Security.Principal.NTAccount]).Value - } catch { - $UserName = $instance.UserSID - } - - if ($PSCmdlet.ShouldProcess($UserName, $SCStringTable.ConfirmClear)) { - $instance | Remove-CimInstance -Confirm:$false - Write-Verbose $SCStringTable.ClearedSettings - } - } -} diff --git a/newton-cn/bin/Modules/AssignedAccess/ko-KR/AssignedAccessMsg.psd1 b/newton-cn/bin/Modules/AssignedAccess/ko-KR/AssignedAccessMsg.psd1 deleted file mode 100644 index fd9d3c9..0000000 Binary files a/newton-cn/bin/Modules/AssignedAccess/ko-KR/AssignedAccessMsg.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/BitLocker/BitLocker.Format.ps1xml b/newton-cn/bin/Modules/BitLocker/BitLocker.Format.ps1xml deleted file mode 100644 index a928461..0000000 Binary files a/newton-cn/bin/Modules/BitLocker/BitLocker.Format.ps1xml and /dev/null differ diff --git a/newton-cn/bin/Modules/BitLocker/BitLocker.psd1 b/newton-cn/bin/Modules/BitLocker/BitLocker.psd1 deleted file mode 100644 index 5834d34..0000000 Binary files a/newton-cn/bin/Modules/BitLocker/BitLocker.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/BitLocker/BitLocker.psm1 b/newton-cn/bin/Modules/BitLocker/BitLocker.psm1 deleted file mode 100644 index 680cfd8..0000000 Binary files a/newton-cn/bin/Modules/BitLocker/BitLocker.psm1 and /dev/null differ diff --git a/newton-cn/bin/Modules/BitLocker/Microsoft.BitLocker.Structures.dll b/newton-cn/bin/Modules/BitLocker/Microsoft.BitLocker.Structures.dll deleted file mode 100644 index 86b9e7a..0000000 Binary files a/newton-cn/bin/Modules/BitLocker/Microsoft.BitLocker.Structures.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/BitLocker/ko-KR/BitLocker.psd1 b/newton-cn/bin/Modules/BitLocker/ko-KR/BitLocker.psd1 deleted file mode 100644 index 5f96492..0000000 Binary files a/newton-cn/bin/Modules/BitLocker/ko-KR/BitLocker.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/BitsTransfer/BitsTransfer.Format.ps1xml b/newton-cn/bin/Modules/BitsTransfer/BitsTransfer.Format.ps1xml deleted file mode 100644 index a5cf4c2..0000000 --- a/newton-cn/bin/Modules/BitsTransfer/BitsTransfer.Format.ps1xml +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - Microsoft.BackgroundIntelligentTransfer.Management.BitsJob - - Microsoft.BackgroundIntelligentTransfer.Management.BitsJob - - - - - - - - - - - - - - JobId - - - DisplayName - - - TransferType - - - JobState - - - OwnerAccount - - - - - - - - Microsoft.BackgroundIntelligentTransfer.Management.BitsJob - - Microsoft.BackgroundIntelligentTransfer.Management.BitsJob - - - - - - - JobId - - - DisplayName - - - TransferType - - - JobState - - - OwnerAccount - - - Priority - - - TransferPolicy - - - FilesTransferred - - - FilesTotal - - - BytesTransferred - - - BytesTotal - - - CreationTime - - - ModificationTime - - - MinimumRetryDelay - - - NoProgressTimeout - - - TransientErrorCount - - - ProxyUsage - - - ProxyList - - - ProxyBypassList - - - HttpMethod - - - ACLFlags - - - SecurityFlags - - - Dynamic - - - CustomHeaders - - - MaximumDownloadTime - - - NotifyFlags - - - NotifyCmdLine - - - CertificateStoreLocation - - - CertificateStoreName - - - CertificateHash - - - CertificateSubjectName - - - - - - - - diff --git a/newton-cn/bin/Modules/BitsTransfer/BitsTransfer.psd1 b/newton-cn/bin/Modules/BitsTransfer/BitsTransfer.psd1 deleted file mode 100644 index 35aa5b6..0000000 Binary files a/newton-cn/bin/Modules/BitsTransfer/BitsTransfer.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/BitsTransfer/Microsoft.BackgroundIntelligentTransfer.Management.Interop.dll b/newton-cn/bin/Modules/BitsTransfer/Microsoft.BackgroundIntelligentTransfer.Management.Interop.dll deleted file mode 100644 index 4fee62b..0000000 Binary files a/newton-cn/bin/Modules/BitsTransfer/Microsoft.BackgroundIntelligentTransfer.Management.Interop.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/BranchCache/BranchCache.format.ps1xml b/newton-cn/bin/Modules/BranchCache/BranchCache.format.ps1xml deleted file mode 100644 index 6e4f26c..0000000 --- a/newton-cn/bin/Modules/BranchCache/BranchCache.format.ps1xml +++ /dev/null @@ -1,638 +0,0 @@ - - - - - - - - MSFT_NetBranchCache_View - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheStatus - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheStatus - - - - - - - - ClientConfigurationControl - - - - - CurrentClientMode : - - CurrentClientMode - - - HostedCacheServerList : - - HostedCacheServerList - - - HostedCacheDiscoveryEnabled : - - HostedCacheDiscoveryEnabled - - - - - - - - - - - ContentServerConfigurationControl - - - - - ContentServerIsEnabled : - - ContentServerIsEnabled - - - - - - - - - - - HostedCacheServerConfigurationControl - - - - - HostedCacheServerIsEnabled : - - HostedCacheServerIsEnabled - - - ClientAuthenticationMode : - - ClientAuthenticationMode - - - HostedCacheScpRegistrationEnabled : - - HostedCacheScpRegistrationEnabled - - - - - - - - - - - NetworkConfigurationControl - - - - - ContentRetrievalUrlReservationEnabled : - - ContentRetrievalUrlReservationEnabled - - - HostedCacheHttpUrlReservationEnabled : - - HostedCacheHttpUrlReservationEnabled - - - HostedCacheHttpsUrlReservationEnabled : - - HostedCacheHttpsUrlReservationEnabled - - - ContentRetrievalFirewallRulesEnabled : - - ContentRetrievalFirewallRulesEnabled - - - PeerDiscoveryFirewallRulesEnabled : - - PeerDiscoveryFirewallRulesEnabled - - - HostedCacheServerFirewallRulesEnabled : - - HostedCacheServerFirewallRulesEnabled - - - HostedCacheClientFirewallRulesEnabled : - - HostedCacheClientFirewallRulesEnabled - - - - - - - - - - - CacheControl - - - - - CacheFileDirectoryPath : - - CacheFileDirectoryPath - - - MaxCacheSizeAsPercentageOfDiskVolume : - - MaxCacheSizeAsPercentageOfDiskVolume - - - MaxCacheSizeAsNumberOfBytes : - - MaxCacheSizeAsNumberOfBytes - - - CurrentSizeOnDiskAsNumberOfBytes : - - CurrentSizeOnDiskAsNumberOfBytes - - - - - - - - - - PrimaryCacheControl - - - - - - - - $_ - CacheControl - - - - - - - CurrentActiveCacheSize : - - CurrentActiveCacheSize - - - - - - - - - - - - DataCacheExtensionControl - - - - - - - - $_ - CacheControl - - - - - - - - - - - - - - DataCacheExtensionListControl - - - - - - DataCacheExtensions: - - - - 4 - - - DataCacheExtensions - - DataCacheExtensionControl - - - - - - - - - - - - HashCacheControl - - - - - - - - $_ - PrimaryCacheControl - - - - - - - - - - - - - DataCacheControl - - - - - - - - $_ - PrimaryCacheControl - - - - - - - - - - - - $_.DataCacheExtensions.Length -ne $() - - $_ - DataCacheExtensionListControl - - - - - - - - - - - - - - - - - - BranchCacheIsEnabled : - - BranchCacheIsEnabled - - - BranchCacheServiceStatus : - - BranchCacheServiceStatus - - - BranchCacheServiceStartType : - - BranchCacheServiceStartType - - - - - - - ClientConfiguration: - - - - 4 - - - ClientConfiguration - ClientConfigurationControl - - - - - - - - ContentServerConfiguration: - - - - 4 - - - ContentServerConfiguration - ContentServerConfigurationControl - - - - - - - - HostedCacheServerConfiguration: - - - - 4 - - - HostedCacheServerConfiguration - HostedCacheServerConfigurationControl - - - - - - - - NetworkConfiguration: - - - - 4 - - - NetworkConfiguration - NetworkConfigurationControl - - - - - - - - HashCache: - - - - 4 - - - HashCache - HashCacheControl - - - - - - - - DataCache: - - - - 4 - - - DataCache - DataCacheControl - - - - - - - - - - - - - MSFT_NetBranchCacheSettingData_View - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheClientSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheClientSettingData - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheContentServerSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheContentServerSettingData - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheHostedCacheServerSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheHostedCacheServerSettingData - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheNetworkSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheNetworkSettingData - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheClientSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheClientSettingData - - - - CurrentClientMode - - - HostedCacheServerList - - - HostedCacheDiscoveryEnabled - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheContentServerSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheContentServerSettingData - - - - ContentServerIsEnabled - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheHostedCacheServerSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheHostedCacheServerSettingData - - - - HostedCacheServerIsEnabled - - - ClientAuthenticationMode - - - HostedCacheScpRegistrationEnabled - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheNetworkSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheNetworkSettingData - - - - ContentRetrievalUrlReservationEnabled - - - HostedCacheHttpUrlReservationEnabled - - - HostedCacheHttpsUrlReservationEnabled - - - ContentRetrievalFirewallRulesEnabled - - - PeerDiscoveryFirewallRulesEnabled - - - HostedCacheServerFirewallRulesEnabled - - - HostedCacheClientFirewallRulesEnabled - - - - - - - - - - - - - MSFT_NetBranchCacheFile_View - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheHashCache - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheHashCache - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheDataCache - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheDataCache - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheDataCacheExtension - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheDataCacheExtension - - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheHashCache - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheHashCache - - - - CacheFileDirectoryPath - - - MaxCacheSizeAsPercentageOfDiskVolume - - - MaxCacheSizeAsNumberOfBytes - - - CurrentSizeOnDiskAsNumberOfBytes - - - CurrentActiveCacheSize - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheDataCache - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheDataCache - - - - CacheFileDirectoryPath - - - MaxCacheSizeAsPercentageOfDiskVolume - - - MaxCacheSizeAsNumberOfBytes - - - CurrentSizeOnDiskAsNumberOfBytes - - - CurrentActiveCacheSize - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheDataCacheExtension - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheDataCacheExtension - - - - CacheFileDirectoryPath - - - MaxCacheSizeAsPercentageOfDiskVolume - - - MaxCacheSizeAsNumberOfBytes - - - CurrentSizeOnDiskAsNumberOfBytes - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/BranchCache/BranchCache.psd1 b/newton-cn/bin/Modules/BranchCache/BranchCache.psd1 deleted file mode 100644 index 0b6cb32..0000000 --- a/newton-cn/bin/Modules/BranchCache/BranchCache.psd1 +++ /dev/null @@ -1,22 +0,0 @@ -@{ - PowerShellVersion = '5.1' - - GUID='d57aee1e-6fe7-4bbc-8c57-8675a3a83e0d' - ModuleVersion='1.0.0.0' - Author="Microsoft Corporation" - CompanyName="Microsoft Corporation" - Copyright="© Microsoft Corporation. All rights reserved." - - HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=390757" - - FormatsToProcess = 'BranchCache.format.ps1xml' - TypesToProcess = 'BranchCache.types.ps1xml' - - NestedModules = @('BranchCacheClientSettingData.cdxml', 'BranchCacheContentServerSettingData.cdxml', 'BranchCacheHostedCacheServerSettingData.cdxml', 'BranchCacheNetworkSettingData.cdxml', 'BranchCacheOrchestrator.cdxml', 'BranchCachePrimaryPublicationCacheFile.cdxml', 'BranchCachePrimaryRepublicationCacheFile.cdxml', 'BranchCacheSecondaryRepublicationCacheFile.cdxml', 'BranchCacheStatus.cdxml') - - FunctionsToExport = @('Add-BCDataCacheExtension', 'Clear-BCCache', 'Disable-BC', 'Disable-BCDowngrading', 'Disable-BCServeOnBattery', 'Enable-BCDistributed', 'Enable-BCDowngrading', 'Enable-BCHostedClient', 'Enable-BCHostedServer', 'Enable-BCLocal', 'Enable-BCServeOnBattery', 'Export-BCCachePackage', 'Export-BCSecretKey', 'Get-BCClientConfiguration', 'Get-BCContentServerConfiguration', 'Get-BCHostedCacheServerConfiguration', 'Get-BCNetworkConfiguration', 'Get-BCHashCache', 'Get-BCDataCache', 'Get-BCDataCacheExtension', 'Get-BCStatus', 'Import-BCCachePackage', 'Import-BCSecretKey', 'Publish-BCFileContent', 'Publish-BCWebContent', 'Remove-BCDataCacheExtension', 'Reset-BC', 'Set-BCAuthentication', 'Set-BCCache', 'Set-BCMinSMBLatency', 'Set-BCSecretKey', 'Set-BCDataCacheEntryMaxAge') - - CmdletsToExport = @() - AliasesToExport = @() - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/BranchCache/BranchCache.types.ps1xml b/newton-cn/bin/Modules/BranchCache/BranchCache.types.ps1xml deleted file mode 100644 index 9cf05f8..0000000 --- a/newton-cn/bin/Modules/BranchCache/BranchCache.types.ps1xml +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheHostedCacheServerSettingData - - - ClientAuthenticationMode - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.HostedCacheServerSettingData.ClientAuthenticationMode]($this.PSBase.CimInstanceProperties['ClientAuthenticationMode'].Value) - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheHostedCacheServerSettingData - - - ClientAuthenticationMode - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.HostedCacheServerSettingData.ClientAuthenticationMode]($this.PSBase.CimInstanceProperties['ClientAuthenticationMode'].Value) - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheClientSettingData - - - CurrentClientMode - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ClientSettingData.CurrentClientMode]($this.PSBase.CimInstanceProperties['CurrentClientMode'].Value) - - - - PreferredContentInformationVersion - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ClientSettingData.PreferredContentInformationVersion]($this.PSBase.CimInstanceProperties['PreferredContentInformationVersion'].Value) - - - - HostedCacheVersion - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ClientSettingData.HostedCacheVersion]($this.PSBase.CimInstanceProperties['HostedCacheVersion'].Value) - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheClientSettingData - - - CurrentClientMode - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ClientSettingData.CurrentClientMode]($this.PSBase.CimInstanceProperties['CurrentClientMode'].Value) - - - - PreferredContentInformationVersion - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ClientSettingData.PreferredContentInformationVersion]($this.PSBase.CimInstanceProperties['PreferredContentInformationVersion'].Value) - - - - HostedCacheVersion - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ClientSettingData.HostedCacheVersion]($this.PSBase.CimInstanceProperties['HostedCacheVersion'].Value) - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheStatus - - - BranchCacheServiceStatus - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.BranchCacheStatus.BranchCacheServiceStatus]($this.PSBase.CimInstanceProperties['BranchCacheServiceStatus'].Value) - - - - BranchCacheServiceStartType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.BranchCacheStatus.BranchCacheServiceStartType]($this.PSBase.CimInstanceProperties['BranchCacheServiceStartType'].Value) - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheStatus - - - BranchCacheServiceStatus - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.BranchCacheStatus.BranchCacheServiceStatus]($this.PSBase.CimInstanceProperties['BranchCacheServiceStatus'].Value) - - - - BranchCacheServiceStartType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.BranchCacheStatus.BranchCacheServiceStartType]($this.PSBase.CimInstanceProperties['BranchCacheServiceStartType'].Value) - - - - - - diff --git a/newton-cn/bin/Modules/BranchCache/BranchCacheClientSettingData.cdxml b/newton-cn/bin/Modules/BranchCache/BranchCacheClientSettingData.cdxml deleted file mode 100644 index 2305fb7..0000000 --- a/newton-cn/bin/Modules/BranchCache/BranchCacheClientSettingData.cdxml +++ /dev/null @@ -1,10 +0,0 @@ - - - - 1.0.0 - BCClientConfiguration - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/BranchCache/BranchCacheContentServerSettingData.cdxml b/newton-cn/bin/Modules/BranchCache/BranchCacheContentServerSettingData.cdxml deleted file mode 100644 index de8f650..0000000 --- a/newton-cn/bin/Modules/BranchCache/BranchCacheContentServerSettingData.cdxml +++ /dev/null @@ -1,10 +0,0 @@ - - - - 1.0.0 - BCContentServerConfiguration - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/BranchCache/BranchCacheHostedCacheServerSettingData.cdxml b/newton-cn/bin/Modules/BranchCache/BranchCacheHostedCacheServerSettingData.cdxml deleted file mode 100644 index 40c5018..0000000 --- a/newton-cn/bin/Modules/BranchCache/BranchCacheHostedCacheServerSettingData.cdxml +++ /dev/null @@ -1,10 +0,0 @@ - - - - 1.0.0 - BCHostedCacheServerConfiguration - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/BranchCache/BranchCacheNetworkSettingData.cdxml b/newton-cn/bin/Modules/BranchCache/BranchCacheNetworkSettingData.cdxml deleted file mode 100644 index fa399e4..0000000 --- a/newton-cn/bin/Modules/BranchCache/BranchCacheNetworkSettingData.cdxml +++ /dev/null @@ -1,10 +0,0 @@ - - - - 1.0.0 - BCNetworkConfiguration - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/BranchCache/BranchCacheOrchestrator.cdxml b/newton-cn/bin/Modules/BranchCache/BranchCacheOrchestrator.cdxml deleted file mode 100644 index ea9066e..0000000 --- a/newton-cn/bin/Modules/BranchCache/BranchCacheOrchestrator.cdxml +++ /dev/null @@ -1,817 +0,0 @@ - - - - 1.0.0 - BC - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/BranchCache/BranchCachePrimaryPublicationCacheFile.cdxml b/newton-cn/bin/Modules/BranchCache/BranchCachePrimaryPublicationCacheFile.cdxml deleted file mode 100644 index e1a94bb..0000000 --- a/newton-cn/bin/Modules/BranchCache/BranchCachePrimaryPublicationCacheFile.cdxml +++ /dev/null @@ -1,10 +0,0 @@ - - - - 1.0.0 - BCHashCache - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/BranchCache/BranchCachePrimaryRepublicationCacheFile.cdxml b/newton-cn/bin/Modules/BranchCache/BranchCachePrimaryRepublicationCacheFile.cdxml deleted file mode 100644 index d34b6d7..0000000 --- a/newton-cn/bin/Modules/BranchCache/BranchCachePrimaryRepublicationCacheFile.cdxml +++ /dev/null @@ -1,10 +0,0 @@ - - - - 1.0.0 - BCDataCache - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/BranchCache/BranchCacheSecondaryRepublicationCacheFile.cdxml b/newton-cn/bin/Modules/BranchCache/BranchCacheSecondaryRepublicationCacheFile.cdxml deleted file mode 100644 index 09063be..0000000 --- a/newton-cn/bin/Modules/BranchCache/BranchCacheSecondaryRepublicationCacheFile.cdxml +++ /dev/null @@ -1,10 +0,0 @@ - - - - 1.0.0 - BCDataCacheExtension - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/BranchCache/BranchCacheStatus.cdxml b/newton-cn/bin/Modules/BranchCache/BranchCacheStatus.cdxml deleted file mode 100644 index 1fe41ee..0000000 --- a/newton-cn/bin/Modules/BranchCache/BranchCacheStatus.cdxml +++ /dev/null @@ -1,10 +0,0 @@ - - - - 1.0.0 - BCStatus - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/CimCmdlets/CimCmdlets.psd1 b/newton-cn/bin/Modules/CimCmdlets/CimCmdlets.psd1 deleted file mode 100644 index 0517bbe..0000000 Binary files a/newton-cn/bin/Modules/CimCmdlets/CimCmdlets.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/ConfigCI/ConfigCI.psd1 b/newton-cn/bin/Modules/ConfigCI/ConfigCI.psd1 deleted file mode 100644 index 81b895d..0000000 --- a/newton-cn/bin/Modules/ConfigCI/ConfigCI.psd1 +++ /dev/null @@ -1,30 +0,0 @@ -@{ -ModuleVersion = '1.0' -GUID = '28c9a37e-c849-4370-b672-e5563447b0e1' -Author="Microsoft Corporation" -CompanyName="Microsoft Corporation" -Copyright="© Microsoft Corporation. All rights reserved." -HelpInfoUri="http://go.microsoft.com/fwlink/?LinkId=626871" -ModuleToProcess="Microsoft.ConfigCI.Commands" -PowerShellVersion="3.0" -CLRVersion="4.0" -CmdletsToExport=@( - "Get-SystemDriver", - "New-CIPolicyRule", - "New-CIPolicy", - "Get-CIPolicy", - "Merge-CIPolicy", - "Remove-CIPolicyRule", - "Edit-CIPolicyRule", - "Set-RuleOption", - "Set-HVCIOptions", - "Set-CIPolicySetting", - "Set-CIPolicyIdInfo", - "Get-CIPolicyIdInfo", - "Get-CIPolicyInfo", - "Add-SignerRule", - "Set-CIPolicyVersion", - "ConvertFrom-CIPolicy") -FunctionsToExport=@() -AliasesToExport=@() -} diff --git a/newton-cn/bin/Modules/ConfigDefender/ConfigDefender.psd1 b/newton-cn/bin/Modules/ConfigDefender/ConfigDefender.psd1 deleted file mode 100644 index 9f438da..0000000 --- a/newton-cn/bin/Modules/ConfigDefender/ConfigDefender.psd1 +++ /dev/null @@ -1,244 +0,0 @@ -@{ - GUID = 'C46BE3DC-30A9-452F-A5FD-4BF9CA87A854' - Author="Microsoft Corporation" - CompanyName="Microsoft Corporation" - Copyright="Copyright (C) Microsoft Corporation. All rights reserved." - ModuleVersion = '1.0' - NestedModules = @( 'MSFT_MpComputerStatus.cdxml', - 'MSFT_MpPreference.cdxml', - 'MSFT_MpThreat.cdxml', - 'MSFT_MpThreatCatalog.cdxml', - 'MSFT_MpThreatDetection.cdxml', - 'MSFT_MpScan.cdxml', - 'MSFT_MpSignature.cdxml', - 'MSFT_MpWDOScan.cdxml', - 'MSFT_MpRollback.cdxml', - 'MSFT_MpBehavioralNetworkBlockingRules.cdxml' - ) - - FunctionsToExport = @( 'Get-MpPreference', - 'Set-MpPreference', - 'Add-MpPreference', - 'Remove-MpPreference', - 'Get-MpComputerStatus', - 'Get-MpThreat', - 'Get-MpThreatCatalog', - 'Get-MpThreatDetection', - 'Start-MpScan', - 'Update-MpSignature', - 'Remove-MpThreat', - 'Start-MpWDOScan', - 'Start-MpRollback', - 'Get-MpBehavioralNetworkBlockingRules', - 'Remove-MpBehavioralNetworkBlockingRules' - ) - HelpInfoUri="http://go.microsoft.com/fwlink/?linkid=390762" - PowerShellVersion = '3.0' -} - -# SIG # Begin signature block -# MIImEAYJKoZIhvcNAQcCoIImATCCJf0CAQExDzANBglghkgBZQMEAgEFADB5Bgor -# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG -# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAe8sW09SOrnGAk -# xHQAOKM6Sbd9kzILPBEO6kltXbC3OKCCC2IwggTvMIID16ADAgECAhMzAAALjRfo -# TozQcMmkAAAAAAuNMA0GCSqGSIb3DQEBCwUAMHkxCzAJBgNVBAYTAlVTMRMwEQYD -# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy -# b3NvZnQgQ29ycG9yYXRpb24xIzAhBgNVBAMTGk1pY3Jvc29mdCBXaW5kb3dzIFBD -# QSAyMDEwMB4XDTI0MDgyMjIxMzIwNVoXDTI1MDcwNDIxMzIwNVowcDELMAkGA1UE -# BhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAc -# BgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEaMBgGA1UEAxMRTWljcm9zb2Z0 -# IFdpbmRvd3MwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCh4E7Ri5OA -# yPmb7q3dyQb6toqfRY6QGGKDfulXYcupgGPKZu0dHFK4fKaOn60Z1Y1MoNaFWG3f -# e0mpQmrsAw93uYwwDqpMl6r7m1N5HLUkiOSaKO/meceKjprL7USMgRMiK3EWHnTB -# GKs9yqNzpwqvpwTRMnjJDLC35UD7s2Cfn3Yk9jMpTtSwBAeNc7XnS/Pp0GmsXSrZ -# YOOQ9B3GlUkCGoFlscIiYEK3JvJelhYYQAg33us2McxFJJQ+O/BFRko51u1alFzR -# U5ujbc+cr2SpHzlxkIULe4Fvfcv0HRyyeLNBgqunan9xJWf2rAJSMynVUnkgqWZN -# OzHaiYBd9fjZAgMBAAGjggF3MIIBczAfBgNVHSUEGDAWBgorBgEEAYI3CgMGBggr -# BgEFBQcDAzAdBgNVHQ4EFgQUlKchFWOmTlAgDUTsEik8hXWO4o4wVAYDVR0RBE0w -# S6RJMEcxLTArBgNVBAsTJE1pY3Jvc29mdCBJcmVsYW5kIE9wZXJhdGlvbnMgTGlt -# aXRlZDEWMBQGA1UEBRMNMjMwMDI4KzUwMjc5ODAfBgNVHSMEGDAWgBTRT6mKBwjO -# 9CQYmOUA//PWeR03vDBTBgNVHR8ETDBKMEigRqBEhkJodHRwOi8vY3JsLm1pY3Jv -# c29mdC5jb20vcGtpL2NybC9wcm9kdWN0cy9NaWNXaW5QQ0FfMjAxMC0wNy0wNi5j -# cmwwVwYIKwYBBQUHAQEESzBJMEcGCCsGAQUFBzAChjtodHRwOi8vd3d3Lm1pY3Jv -# c29mdC5jb20vcGtpL2NlcnRzL01pY1dpblBDQV8yMDEwLTA3LTA2LmNydDAMBgNV -# HRMBAf8EAjAAMA0GCSqGSIb3DQEBCwUAA4IBAQCaycnh5i2eis6RuXLbNRi3Bj4O -# 4EpM2wWQr1xABTgVNaKVDAi85hpJN/RsyGP0b4w4Mrf0+ALPSJ9Idowj1Mogd+2a -# dDXe55zNrrBo3rjP6ZWMWGA80ftwWhH5m9Aou9TVjiRw7j4MwVREpeihAf1Ih2m8 -# N/DknvQ3ygn0MuvQ549sBPKuB87pIvGzv0y53zjDqenk1DCSqRAZiNm26zr7+fTB -# cT9oOxKTLJXKWEN/ZEQy8nIcY6kGi3GuQxfD9tYfmACSAaVfTnqviXtEqQFHHBal -# s9ZDWp2dTlr3FGtZWeGg2Gb2coCvEyQoKlAHZePOcAHzY7tG65uAv+x1BaXSMIIG -# azCCBFOgAwIBAgIKYQxqGQAAAAAABDANBgkqhkiG9w0BAQsFADCBiDELMAkGA1UE -# BhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAc -# BgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEyMDAGA1UEAxMpTWljcm9zb2Z0 -# IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTAwHhcNMTAwNzA2MjA0MDIz -# WhcNMjUwNzA2MjA1MDIzWjB5MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGlu -# Z3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBv -# cmF0aW9uMSMwIQYDVQQDExpNaWNyb3NvZnQgV2luZG93cyBQQ0EgMjAxMDCCASIw -# DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMB5uzqx8A+EuK1kKnUWc9C7B/Y+ -# DZ0U5LGfwciUsDh8H9AzVfW6I2b1LihIU8cWg7r1Uax+rOAmfw90/FmV3MnGovdS -# cFosHZSrGb+vlX2vZqFvm2JubUu8LzVs3qRqY1pf+/MNTWHMCn4x62wK0E2XD/1/ -# OEbmisdzaXZVaZZM5NjwNOu6sR/OKX7ET50TFasTG3JYYlZsioGjZHeYRmUpnYMU -# pUwIoIPXIx/zX99vLM/aFtgOcgQo2Gs++BOxfKIXeU9+3DrknXAna7/b/B7HB9jA -# vguTHijgc23SVOkoTL9rXZ//XTMSN5UlYTRqQst8nTq7iFnho0JtOlBbSNECAwEA -# AaOCAeMwggHfMBAGCSsGAQQBgjcVAQQDAgEAMB0GA1UdDgQWBBTRT6mKBwjO9CQY -# mOUA//PWeR03vDAZBgkrBgEEAYI3FAIEDB4KAFMAdQBiAEMAQTALBgNVHQ8EBAMC -# AYYwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBTV9lbLj+iiXGJo0T2UkFvX -# zpoYxDBWBgNVHR8ETzBNMEugSaBHhkVodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20v -# cGtpL2NybC9wcm9kdWN0cy9NaWNSb29DZXJBdXRfMjAxMC0wNi0yMy5jcmwwWgYI -# KwYBBQUHAQEETjBMMEoGCCsGAQUFBzAChj5odHRwOi8vd3d3Lm1pY3Jvc29mdC5j -# b20vcGtpL2NlcnRzL01pY1Jvb0NlckF1dF8yMDEwLTA2LTIzLmNydDCBnQYDVR0g -# BIGVMIGSMIGPBgkrBgEEAYI3LgMwgYEwPQYIKwYBBQUHAgEWMWh0dHA6Ly93d3cu -# bWljcm9zb2Z0LmNvbS9QS0kvZG9jcy9DUFMvZGVmYXVsdC5odG0wQAYIKwYBBQUH -# AgIwNB4yIB0ATABlAGcAYQBsAF8AUABvAGwAaQBjAHkAXwBTAHQAYQB0AGUAbQBl -# AG4AdAAuIB0wDQYJKoZIhvcNAQELBQADggIBAC5Bpoa1Bm/wgIX6O8oX6cn65DnC -# lHDDZJTD2FamkI7+5Jr0bfVvjlONWqjzrttGbL5/HVRWGzwdccRRFVR+v+6llUIz -# /Q2QJCTj+dyWyvy4rL/0wjlWuLvtc7MX3X6GUCOLViTKu6YdmocvJ4XnobYKnA0b -# jPMAYkG6SHSHgv1QyfSHKcMDqivfGil56BIkmobt0C7TQIH1B18zBlRdQLX3sWL9 -# TUj3bkFHUhy7G8JXOqiZVpPUxt4mqGB1hrvsYqbwHQRF3z6nhNFbRCNjJTZ3b65b -# 3CLVFCNqQX/QQqbb7yV7BOPSljdiBq/4Gw+Oszmau4n1NQblpFvDjJ43X1PRozf9 -# pE/oGw5rduS4j7DC6v119yxBt5yj4R4F/peSy39ZA22oTo1OgBfU1XL2VuRIn6Mj -# ugagwI7RiE+TIPJwX9hrcqMgSfx3DF3Fx+ECDzhCEA7bAq6aNx1QgCkepKfZxpol -# Vf1Ayq1kEOgx+RJUeRryDtjWqx4z/gLnJm1hSY/xJcKLdJnf+ZMakBzu3ZQzDkJQ -# 239Q+J9iguymghZ8ZrzsmbDBWF2osJphFJHRmS9J5D6Bmdbm78rj/T7u7AmGAwcN -# Gw186/RayZXPhxIKXezFApLNBZlyyn3xKhAYOOQxoyi05kzFUqOcasd9wHEJBA1w -# 3gI/h+5WoezrtUyFMYIaBDCCGgACAQEwgZAweTELMAkGA1UEBhMCVVMxEzARBgNV -# BAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jv -# c29mdCBDb3Jwb3JhdGlvbjEjMCEGA1UEAxMaTWljcm9zb2Z0IFdpbmRvd3MgUENB -# IDIwMTACEzMAAAuNF+hOjNBwyaQAAAAAC40wDQYJYIZIAWUDBAIBBQCgga4wGQYJ -# KoZIhvcNAQkDMQwGCisGAQQBgjcCAQQwHAYKKwYBBAGCNwIBCzEOMAwGCisGAQQB -# gjcCARUwLwYJKoZIhvcNAQkEMSIEIOTf7eKrc94hoXGvCN+t/9wmIe3y91DbCELF -# WHjOrssCMEIGCisGAQQBgjcCAQwxNDAyoBSAEgBNAGkAYwByAG8AcwBvAGYAdKEa -# gBhodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20wDQYJKoZIhvcNAQEBBQAEggEAKwk6 -# 7GG0pU8oDPBJ9s4GNkjBBf4L5m5ilBSxIfbwWLO8tcbQmOZFhM5hJuOxrG9o9nHO -# XsEp/d0qNbkUqWALUP7F2wtHmGWYlDElAQvInYMvmI1nClVsbU9w79/HgEkfmuiq -# +z3IOs0oD7Ljz2wjJwsiblf+sR0CuBNahLrArQnBKhQIeCUOTTyon7c8a5ke8D0N -# vphG0d1MGlbmYhPn/GD99E4Mma0XDhinCTtgeE5sFKd6jud156wK7nEGmYfyigXO -# HGc2DdHhQk5fNbVAB4zZRgWqxs5CG6I1JQdb8pPz0RtO5nm2E/LFnm+3vohhB6VM -# EZSswzcrRyEkEHJ/IqGCF5MwghePBgorBgEEAYI3AwMBMYIXfzCCF3sGCSqGSIb3 -# DQEHAqCCF2wwghdoAgEDMQ8wDQYJYIZIAWUDBAIBBQAwggFRBgsqhkiG9w0BCRAB -# BKCCAUAEggE8MIIBOAIBAQYKKwYBBAGEWQoDATAxMA0GCWCGSAFlAwQCAQUABCCD -# r3BORPngiTkTcYbYvwFdu8anphEKdCYbtnl+gnC5xAIGZ7ejj0+AGBIyMDI1MDMx -# MjA1MDQwMS44MlowBIACAfSggdGkgc4wgcsxCzAJBgNVBAYTAlVTMRMwEQYDVQQI -# EwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3Nv -# ZnQgQ29ycG9yYXRpb24xJTAjBgNVBAsTHE1pY3Jvc29mdCBBbWVyaWNhIE9wZXJh -# dGlvbnMxJzAlBgNVBAsTHm5TaGllbGQgVFNTIEVTTjpBOTM1LTAzRTAtRDk0NzEl -# MCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZaCCEeowggcgMIIF -# CKADAgECAhMzAAACDLlk4zWc7PSuAAEAAAIMMA0GCSqGSIb3DQEBCwUAMHwxCzAJ -# BgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25k -# MR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jv -# c29mdCBUaW1lLVN0YW1wIFBDQSAyMDEwMB4XDTI1MDEzMDE5NDMwMFoXDTI2MDQy -# MjE5NDMwMFowgcsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAw -# DgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24x -# JTAjBgNVBAsTHE1pY3Jvc29mdCBBbWVyaWNhIE9wZXJhdGlvbnMxJzAlBgNVBAsT -# Hm5TaGllbGQgVFNTIEVTTjpBOTM1LTAzRTAtRDk0NzElMCMGA1UEAxMcTWljcm9z -# b2Z0IFRpbWUtU3RhbXAgU2VydmljZTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCC -# AgoCggIBAMoBViY95G2Br9TqPOrKosPQwCiiXbeBwE3nz5n9eyRjA0mxn477BXJB -# iXx09MrX8ELbECJzWb4m9ySqNVpDfYqZRGwRmi2KtBjg8pVb55fBG3evqzOAu6Jz -# qqgeVtejH+XQcm2BRGTMNdYyQqYZIvvPz9yupy+Ziq/y3+yUAXgn6anNv20wVWaP -# Apc41V1HCD1DdZo9kELta+iLs9Eg3aOCNIGcdjIBlKWy0o2ulhvr4a7qhIWRDMal -# Hrn5A0N2Q/i585/g9s6Dd9vi4Y+MjwQ8qWnAzBqLWRDJf5+ByAKhX0n6jwxhgJlR -# 63eTOGHBHOqHosx4ONpcs/vTVJdeJdzZkfO4MdtL+xm0nfrbtxWkKVcQhS+DbGmv -# Ss+Ui0fC2OjU/AwKldiqdgq9fxonydrBP1bwVS67Jk8bXznb6riORWV4ovvH7t6X -# wRN6Ft2TB2EBfJeKZoTNZ6001KYb8p8cCn1zPCwvW8qvhGCf6kgiRke6iZ1/l7jz -# Ur7EhaEsI92m5XzsSoY4r+NuE6dkSrB28DQCUxot+yYJ6Zma6l6Npi4STTn/pwJT -# GAXjMKeQl5h0wA/71niRWHu3NEWzD+VlKXYPsSEgDoqePpF98faTti1IZK/zoJKH -# N+JdrP3LqxO7xIaoXo5sv9678OSK/JWgJ9RdYuOJImytLrcPQQcdAgMBAAGjggFJ -# MIIBRTAdBgNVHQ4EFgQUdQ5FIf+wH+tD9t4PSXlXFDvToYgwHwYDVR0jBBgwFoAU -# n6cVXQBeYl2D9OXSZacbUzUZ6XIwXwYDVR0fBFgwVjBUoFKgUIZOaHR0cDovL3d3 -# dy5taWNyb3NvZnQuY29tL3BraW9wcy9jcmwvTWljcm9zb2Z0JTIwVGltZS1TdGFt -# cCUyMFBDQSUyMDIwMTAoMSkuY3JsMGwGCCsGAQUFBwEBBGAwXjBcBggrBgEFBQcw -# AoZQaHR0cDovL3d3dy5taWNyb3NvZnQuY29tL3BraW9wcy9jZXJ0cy9NaWNyb3Nv -# ZnQlMjBUaW1lLVN0YW1wJTIwUENBJTIwMjAxMCgxKS5jcnQwDAYDVR0TAQH/BAIw -# ADAWBgNVHSUBAf8EDDAKBggrBgEFBQcDCDAOBgNVHQ8BAf8EBAMCB4AwDQYJKoZI -# hvcNAQELBQADggIBANkw+viBWbDB/gYwHll8dKvfi6G6DrLO7gdRP4lYxmrP26Et -# kGhfkI+N0onPABW9ig24uZLT72UDlLviu8qp3+72+nzxUaTpTuAxx5q12qkqVtVF -# 2fZl+sxykjjM5zoG25ivMlXhwSzViZf3m6IDFoQPfjDTYGd+49lcDR52wMFt3iLE -# VTxf/UnQN8hSTVgVg86ubCYjaTXq7pNwo7RilGXBN0Kr287R4QgRHVIuZA0HNf2H -# ZxwK+2B6Q5oGghDdlFqLwOzV/7BwoI/MPioNffE2C8sWIqgDplIb1L/I6sZqJIYh -# 4PLk31VC6pM2OvK4DOO9/lbwBCnfWFXUZtQM6RtR137OQlYpfgWbN543nYQRvKSh -# ZwnlX0zgM8Y3nGkWpfL1o7T51HRRRha6p4uEPJGdV5lxMS7TGCaj6lAdq4VUBKxU -# 5EynxMXx2l6x362qSRDxU28jbSg5+dN8v7tmBQx/uo1XSWXRajmeWvUIm9rVt+TY -# dzkFjUz2x3duUGR7PK8k+fiPRt846sJhPBiw2yOJGX9ZbXw06mLCpyLAWVQ2q1YJ -# EzML2vzhhpQxDzYHLCTjx3i4GiflkDylddLuPAlOMmPlRJ5GX2+NP3w8NnIIU7Z4 -# VI4V0N1/pYGj9ZlQDaEZnSr4nuPXjR9tcJ85QibSPbcdoBXRyQNL+eYL+gXWMIIH -# cTCCBVmgAwIBAgITMwAAABXF52ueAptJmQAAAAAAFTANBgkqhkiG9w0BAQsFADCB -# iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1Jl -# ZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEyMDAGA1UEAxMp -# TWljcm9zb2Z0IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTAwHhcNMjEw -# OTMwMTgyMjI1WhcNMzAwOTMwMTgzMjI1WjB8MQswCQYDVQQGEwJVUzETMBEGA1UE -# CBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9z -# b2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNyb3NvZnQgVGltZS1TdGFtcCBQ -# Q0EgMjAxMDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAOThpkzntHIh -# C3miy9ckeb0O1YLT/e6cBwfSqWxOdcjKNVf2AX9sSuDivbk+F2Az/1xPx2b3lVNx -# WuJ+Slr+uDZnhUYjDLWNE893MsAQGOhgfWpSg0S3po5GawcU88V29YZQ3MFEyHFc -# UTE3oAo4bo3t1w/YJlN8OWECesSq/XJprx2rrPY2vjUmZNqYO7oaezOtgFt+jBAc -# nVL+tuhiJdxqD89d9P6OU8/W7IVWTe/dvI2k45GPsjksUZzpcGkNyjYtcI4xyDUo -# veO0hyTD4MmPfrVUj9z6BVWYbWg7mka97aSueik3rMvrg0XnRm7KMtXAhjBcTyzi -# YrLNueKNiOSWrAFKu75xqRdbZ2De+JKRHh09/SDPc31BmkZ1zcRfNN0Sidb9pSB9 -# fvzZnkXftnIv231fgLrbqn427DZM9ituqBJR6L8FA6PRc6ZNN3SUHDSCD/AQ8rdH -# GO2n6Jl8P0zbr17C89XYcz1DTsEzOUyOArxCaC4Q6oRRRuLRvWoYWmEBc8pnol7X -# KHYC4jMYctenIPDC+hIK12NvDMk2ZItboKaDIV1fMHSRlJTYuVD5C4lh8zYGNRiE -# R9vcG9H9stQcxWv2XFJRXRLbJbqvUAV6bMURHXLvjflSxIUXk8A8FdsaN8cIFRg/ -# eKtFtvUeh17aj54WcmnGrnu3tz5q4i6tAgMBAAGjggHdMIIB2TASBgkrBgEEAYI3 -# FQEEBQIDAQABMCMGCSsGAQQBgjcVAgQWBBQqp1L+ZMSavoKRPEY1Kc8Q/y8E7jAd -# BgNVHQ4EFgQUn6cVXQBeYl2D9OXSZacbUzUZ6XIwXAYDVR0gBFUwUzBRBgwrBgEE -# AYI3TIN9AQEwQTA/BggrBgEFBQcCARYzaHR0cDovL3d3dy5taWNyb3NvZnQuY29t -# L3BraW9wcy9Eb2NzL1JlcG9zaXRvcnkuaHRtMBMGA1UdJQQMMAoGCCsGAQUFBwMI -# MBkGCSsGAQQBgjcUAgQMHgoAUwB1AGIAQwBBMAsGA1UdDwQEAwIBhjAPBgNVHRMB -# Af8EBTADAQH/MB8GA1UdIwQYMBaAFNX2VsuP6KJcYmjRPZSQW9fOmhjEMFYGA1Ud -# HwRPME0wS6BJoEeGRWh0dHA6Ly9jcmwubWljcm9zb2Z0LmNvbS9wa2kvY3JsL3By -# b2R1Y3RzL01pY1Jvb0NlckF1dF8yMDEwLTA2LTIzLmNybDBaBggrBgEFBQcBAQRO -# MEwwSgYIKwYBBQUHMAKGPmh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9wa2kvY2Vy -# dHMvTWljUm9vQ2VyQXV0XzIwMTAtMDYtMjMuY3J0MA0GCSqGSIb3DQEBCwUAA4IC -# AQCdVX38Kq3hLB9nATEkW+Geckv8qW/qXBS2Pk5HZHixBpOXPTEztTnXwnE2P9pk -# bHzQdTltuw8x5MKP+2zRoZQYIu7pZmc6U03dmLq2HnjYNi6cqYJWAAOwBb6J6Gng -# ugnue99qb74py27YP0h1AdkY3m2CDPVtI1TkeFN1JFe53Z/zjj3G82jfZfakVqr3 -# lbYoVSfQJL1AoL8ZthISEV09J+BAljis9/kpicO8F7BUhUKz/AyeixmJ5/ALaoHC -# gRlCGVJ1ijbCHcNhcy4sa3tuPywJeBTpkbKpW99Jo3QMvOyRgNI95ko+ZjtPu4b6 -# MhrZlvSP9pEB9s7GdP32THJvEKt1MMU0sHrYUP4KWN1APMdUbZ1jdEgssU5HLcEU -# BHG/ZPkkvnNtyo4JvbMBV0lUZNlz138eW0QBjloZkWsNn6Qo3GcZKCS6OEuabvsh -# VGtqRRFHqfG3rsjoiV5PndLQTHa1V1QJsWkBRH58oWFsc/4Ku+xBZj1p/cvBQUl+ -# fpO+y/g75LcVv7TOPqUxUYS8vwLBgqJ7Fx0ViY1w/ue10CgaiQuPNtq6TPmb/wrp -# NPgkNWcr4A245oyZ1uEi6vAnQj0llOZ0dFtq0Z4+7X6gMTN9vMvpe784cETRkPHI -# qzqKOghif9lwY1NNje6CbaUFEMFxBmoQtB1VM1izoXBm8qGCA00wggI1AgEBMIH5 -# oYHRpIHOMIHLMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4G -# A1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSUw -# IwYDVQQLExxNaWNyb3NvZnQgQW1lcmljYSBPcGVyYXRpb25zMScwJQYDVQQLEx5u -# U2hpZWxkIFRTUyBFU046QTkzNS0wM0UwLUQ5NDcxJTAjBgNVBAMTHE1pY3Jvc29m -# dCBUaW1lLVN0YW1wIFNlcnZpY2WiIwoBATAHBgUrDgMCGgMVAO+7yGSEQy3lnwt1 -# 5+WzvPUtVTymoIGDMIGApH4wfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hp -# bmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jw -# b3JhdGlvbjEmMCQGA1UEAxMdTWljcm9zb2Z0IFRpbWUtU3RhbXAgUENBIDIwMTAw -# DQYJKoZIhvcNAQELBQACBQDrey0sMCIYDzIwMjUwMzExMjE0NDEyWhgPMjAyNTAz -# MTIyMTQ0MTJaMHQwOgYKKwYBBAGEWQoEATEsMCowCgIFAOt7LSwCAQAwBwIBAAIC -# LE0wBwIBAAICFG0wCgIFAOt8fqwCAQAwNgYKKwYBBAGEWQoEAjEoMCYwDAYKKwYB -# BAGEWQoDAqAKMAgCAQACAwehIKEKMAgCAQACAwGGoDANBgkqhkiG9w0BAQsFAAOC -# AQEASGokbXBYSTF6Awql1Y3U8KcEsxuoxaXdquci0BGl8KZuRblEvUKwQKjtT4Mv -# Z4CwlM+l6/rjMa5SUALn5muUTIggk3mFMLKTcXhgfGfAYlWHhzS+daoHpYn0k74n -# 4r4N+3fLMmr1/Xpfb/74Bfp8SOqoH0hn4J9mOkN658UKstvPve6mz2fcyHTR67QZ -# xoqcw3ePDixiukQ79ZMKmlHaFO5dykpl1X7tra2TIKBI9dmtf+aQSYouqju20DiJ -# zPElfqzoVYhPC6i/Of5dGzzGZrOvSW+qSptYPxtGq1ttrmhogVLL9E9LpePzlcrd -# PUwdR0t4ePPusIzgbJVRSVhVYzGCBA0wggQJAgEBMIGTMHwxCzAJBgNVBAYTAlVT -# MRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQK -# ExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1l -# LVN0YW1wIFBDQSAyMDEwAhMzAAACDLlk4zWc7PSuAAEAAAIMMA0GCWCGSAFlAwQC -# AQUAoIIBSjAaBgkqhkiG9w0BCQMxDQYLKoZIhvcNAQkQAQQwLwYJKoZIhvcNAQkE -# MSIEILKFLQe8IsGP/BfoLCKCv0TIzxCW1piRPWAr0mIck+thMIH6BgsqhkiG9w0B -# CRACLzGB6jCB5zCB5DCBvQQg1SjXtwUxk3jowjk18gCD1THlw7nEz2Ket7muK45n -# wi0wgZgwgYCkfjB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQ -# MA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9u -# MSYwJAYDVQQDEx1NaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMAITMwAAAgy5 -# ZOM1nOz0rgABAAACDDAiBCBCWzynFAlFH+ypR6v//k4WzoQqt9F24O8vKQMZaz7K -# qzANBgkqhkiG9w0BAQsFAASCAgCDgwnEGoP6qGPRHXDfpqPwg3ofERdfROHbqR// -# mBx1eJofolFOuEzGZ8unrh4rAcgj19xGl9wFwJ8rrBxmelenZ7XJhZiUbss/lYwR -# 0onOBnp5SmWcd881vnEHXdDa0rQUPrRTUIivZm6PcsZheBSro5QQzBN0RJdKb7dz -# iMmGvHfwySaBQkGJ0qD2Lrl74/F5YyOFjo/sytojlQ8VejNs6Ugv54dJvuohG7EF -# IvZnm65FNn1bS39kljdook5pDUayZUjgkA0RLxRIAVDA+Nfu7BJgI7+P06awi1US -# cDyNeMr4t9xmSsKuOEQEYFNV1puP6vFNCxGEXhTxCvhiaUaAmLsQ71Z4KUKYp9x1 -# n/5tg5vV1d2MV+0IqXwkAGBlPug2P6I3UiMsGuPlvNtVeiYsNTrxRWBUoBRjmXqV -# /11BNMViaiImWlHH0fPEzKtsXwu30wEQHbkidx+g3RioctXFgi2ehBrUoRBP0dkR -# K2Xl5Z2kykvAYrV3Sag4T78ITLeJHjlO21+6a2W60yhzx9V6xiSgm9NdqOOo0wke -# 3qei5AI3N0zw3eEWgo/7C+N/TccD+d8YlZsP/g5pOQ+IjDUSGyFca9a5AEddfwc6 -# ymb01sDm6M1N6t9aCswQ7FxAw6ixI8N1Nfk+orX2yROmwQkk8+V2sGgkAFxNwNVh -# 5+M55w== -# SIG # End signature block diff --git a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpBehavioralNetworkBlockingRules.cdxml b/newton-cn/bin/Modules/ConfigDefender/MSFT_MpBehavioralNetworkBlockingRules.cdxml deleted file mode 100644 index b74ad97..0000000 --- a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpBehavioralNetworkBlockingRules.cdxml +++ /dev/null @@ -1,240 +0,0 @@ - - - - 1.0 - MpBehavioralNetworkBlockingRules - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpComputerStatus.cdxml b/newton-cn/bin/Modules/ConfigDefender/MSFT_MpComputerStatus.cdxml deleted file mode 100644 index 317a26c..0000000 --- a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpComputerStatus.cdxml +++ /dev/null @@ -1,223 +0,0 @@ - - - - 1.0 - MpComputerStatus - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpPreference.cdxml b/newton-cn/bin/Modules/ConfigDefender/MSFT_MpPreference.cdxml deleted file mode 100644 index 0c6f973..0000000 --- a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpPreference.cdxml +++ /dev/null @@ -1,2449 +0,0 @@ - - - - 1.0 - MpPreference - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Both - Incoming - Outcoming - - - - - - - - - - - - - - - - - Everyday - Sunday - Monday - Tuesday - Wednesday - Thursday - Friday - Saturday - Never - - - - - - - - - - - - - - - NotConfigured - Block - Audit - Off - - - - - - - - - - - - - - - Low - Medium - High - - - - - - - - - - - - - - - NotConfigured - Block - Audit - Off - - - - - - - - - - - - - - - Low - Medium - High - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - QuickScan - FullScan - - - - - - - - - - Everyday - Sunday - Monday - Tuesday - Wednesday - Thursday - Friday - Saturday - Never - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Everyday - Sunday - Monday - Tuesday - Wednesday - Thursday - Friday - Saturday - Never - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Disabled - Basic - Advanced - - - - - - - - - - AlwaysPrompt - SendSafeSamples - NeverSend - SendAllSamples - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Disabled - Enabled - AuditMode - - - - - - - - - - Default - Moderate - High - HighPlus - ZeroTolerance - - - - - - - - - - - - - - - - - Disabled - Enabled - AuditMode - - - - - - - - - - Disabled - Enabled - AuditMode - BlockDiskModificationOnly - AuditDiskModificationOnly - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - NotConfigured - Beta - Preview - Staged - Broad - Delayed - - - - - - - - - - NotConfigured - Beta - Preview - Staged - Broad - Delayed - - - - - - - - - - NotConfigured - Staged - Broad - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Enabled - Disabled - - - - - - - - - - Disabled - ScanRtpExclusions - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpRollback.cdxml b/newton-cn/bin/Modules/ConfigDefender/MSFT_MpRollback.cdxml deleted file mode 100644 index a8487fe..0000000 --- a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpRollback.cdxml +++ /dev/null @@ -1,241 +0,0 @@ - - - - 1.0 - MpRollback - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpScan.cdxml b/newton-cn/bin/Modules/ConfigDefender/MSFT_MpScan.cdxml deleted file mode 100644 index f65a652..0000000 --- a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpScan.cdxml +++ /dev/null @@ -1,254 +0,0 @@ - - - - 1.0 - MpScan - - - - - - - - - - - - - - - - - - - - - - - - - FullScan - QuickScan - CustomScan - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpSignature.cdxml b/newton-cn/bin/Modules/ConfigDefender/MSFT_MpSignature.cdxml deleted file mode 100644 index 7303bc6..0000000 --- a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpSignature.cdxml +++ /dev/null @@ -1,251 +0,0 @@ - - - - 1.0 - MpSignature - - - - - - - - - - - - - - - - - - - - InternalDefinitionUpdateServer - MicrosoftUpdateServer - MMPC - FileShares - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpThreat.cdxml b/newton-cn/bin/Modules/ConfigDefender/MSFT_MpThreat.cdxml deleted file mode 100644 index 240f308..0000000 --- a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpThreat.cdxml +++ /dev/null @@ -1,239 +0,0 @@ - - - - 1.0 - MpThreat - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpThreatCatalog.cdxml b/newton-cn/bin/Modules/ConfigDefender/MSFT_MpThreatCatalog.cdxml deleted file mode 100644 index 2b070bb..0000000 --- a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpThreatCatalog.cdxml +++ /dev/null @@ -1,226 +0,0 @@ - - - - 1.0 - MpThreatCatalog - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpThreatDetection.cdxml b/newton-cn/bin/Modules/ConfigDefender/MSFT_MpThreatDetection.cdxml deleted file mode 100644 index ffc845b..0000000 --- a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpThreatDetection.cdxml +++ /dev/null @@ -1,226 +0,0 @@ - - - - 1.0 - MpThreatDetection - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpWDOScan.cdxml b/newton-cn/bin/Modules/ConfigDefender/MSFT_MpWDOScan.cdxml deleted file mode 100644 index b0f6e8c..0000000 --- a/newton-cn/bin/Modules/ConfigDefender/MSFT_MpWDOScan.cdxml +++ /dev/null @@ -1,226 +0,0 @@ - - - - 1.0 - MpWDOScan - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/ConfigDefenderPerformance/ConfigDefenderPerformance.psd1 b/newton-cn/bin/Modules/ConfigDefenderPerformance/ConfigDefenderPerformance.psd1 deleted file mode 100644 index 705fd29..0000000 --- a/newton-cn/bin/Modules/ConfigDefenderPerformance/ConfigDefenderPerformance.psd1 +++ /dev/null @@ -1,225 +0,0 @@ -@{ - GUID = 'A51E6D9E-BC14-41A7-98A8-888195641250' - Author="Microsoft Corporation" - CompanyName="Microsoft Corporation" - Copyright="Copyright (C) Microsoft Corporation. All rights reserved." - ModuleVersion = '1.0' - NestedModules = @('MSFT_MpPerformanceRecording.psm1') - - FormatsToProcess = @('MSFT_MpPerformanceReport.Format.ps1xml') - - CompatiblePSEditions = @('Desktop', 'Core') - - FunctionsToExport = @( 'New-MpPerformanceRecording', - 'Get-MpPerformanceReport' - ) - HelpInfoUri="http://go.microsoft.com/fwlink/?linkid=390762" - PowerShellVersion = '5.1' -} - -# SIG # Begin signature block -# MIImKgYJKoZIhvcNAQcCoIImGzCCJhcCAQExDzANBglghkgBZQMEAgEFADB5Bgor -# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG -# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCC5QoGq9EV41ZN5 -# fnwNlxKx8aIBP8W7y/AxkQ4SrJmPcKCCC2IwggTvMIID16ADAgECAhMzAAALjRfo -# TozQcMmkAAAAAAuNMA0GCSqGSIb3DQEBCwUAMHkxCzAJBgNVBAYTAlVTMRMwEQYD -# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy -# b3NvZnQgQ29ycG9yYXRpb24xIzAhBgNVBAMTGk1pY3Jvc29mdCBXaW5kb3dzIFBD -# QSAyMDEwMB4XDTI0MDgyMjIxMzIwNVoXDTI1MDcwNDIxMzIwNVowcDELMAkGA1UE -# BhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAc -# BgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEaMBgGA1UEAxMRTWljcm9zb2Z0 -# IFdpbmRvd3MwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCh4E7Ri5OA -# yPmb7q3dyQb6toqfRY6QGGKDfulXYcupgGPKZu0dHFK4fKaOn60Z1Y1MoNaFWG3f -# e0mpQmrsAw93uYwwDqpMl6r7m1N5HLUkiOSaKO/meceKjprL7USMgRMiK3EWHnTB -# GKs9yqNzpwqvpwTRMnjJDLC35UD7s2Cfn3Yk9jMpTtSwBAeNc7XnS/Pp0GmsXSrZ -# YOOQ9B3GlUkCGoFlscIiYEK3JvJelhYYQAg33us2McxFJJQ+O/BFRko51u1alFzR -# U5ujbc+cr2SpHzlxkIULe4Fvfcv0HRyyeLNBgqunan9xJWf2rAJSMynVUnkgqWZN -# OzHaiYBd9fjZAgMBAAGjggF3MIIBczAfBgNVHSUEGDAWBgorBgEEAYI3CgMGBggr -# BgEFBQcDAzAdBgNVHQ4EFgQUlKchFWOmTlAgDUTsEik8hXWO4o4wVAYDVR0RBE0w -# S6RJMEcxLTArBgNVBAsTJE1pY3Jvc29mdCBJcmVsYW5kIE9wZXJhdGlvbnMgTGlt -# aXRlZDEWMBQGA1UEBRMNMjMwMDI4KzUwMjc5ODAfBgNVHSMEGDAWgBTRT6mKBwjO -# 9CQYmOUA//PWeR03vDBTBgNVHR8ETDBKMEigRqBEhkJodHRwOi8vY3JsLm1pY3Jv -# c29mdC5jb20vcGtpL2NybC9wcm9kdWN0cy9NaWNXaW5QQ0FfMjAxMC0wNy0wNi5j -# cmwwVwYIKwYBBQUHAQEESzBJMEcGCCsGAQUFBzAChjtodHRwOi8vd3d3Lm1pY3Jv -# c29mdC5jb20vcGtpL2NlcnRzL01pY1dpblBDQV8yMDEwLTA3LTA2LmNydDAMBgNV -# HRMBAf8EAjAAMA0GCSqGSIb3DQEBCwUAA4IBAQCaycnh5i2eis6RuXLbNRi3Bj4O -# 4EpM2wWQr1xABTgVNaKVDAi85hpJN/RsyGP0b4w4Mrf0+ALPSJ9Idowj1Mogd+2a -# dDXe55zNrrBo3rjP6ZWMWGA80ftwWhH5m9Aou9TVjiRw7j4MwVREpeihAf1Ih2m8 -# N/DknvQ3ygn0MuvQ549sBPKuB87pIvGzv0y53zjDqenk1DCSqRAZiNm26zr7+fTB -# cT9oOxKTLJXKWEN/ZEQy8nIcY6kGi3GuQxfD9tYfmACSAaVfTnqviXtEqQFHHBal -# s9ZDWp2dTlr3FGtZWeGg2Gb2coCvEyQoKlAHZePOcAHzY7tG65uAv+x1BaXSMIIG -# azCCBFOgAwIBAgIKYQxqGQAAAAAABDANBgkqhkiG9w0BAQsFADCBiDELMAkGA1UE -# BhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAc -# BgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEyMDAGA1UEAxMpTWljcm9zb2Z0 -# IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTAwHhcNMTAwNzA2MjA0MDIz -# WhcNMjUwNzA2MjA1MDIzWjB5MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGlu -# Z3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBv -# cmF0aW9uMSMwIQYDVQQDExpNaWNyb3NvZnQgV2luZG93cyBQQ0EgMjAxMDCCASIw -# DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMB5uzqx8A+EuK1kKnUWc9C7B/Y+ -# DZ0U5LGfwciUsDh8H9AzVfW6I2b1LihIU8cWg7r1Uax+rOAmfw90/FmV3MnGovdS -# cFosHZSrGb+vlX2vZqFvm2JubUu8LzVs3qRqY1pf+/MNTWHMCn4x62wK0E2XD/1/ -# OEbmisdzaXZVaZZM5NjwNOu6sR/OKX7ET50TFasTG3JYYlZsioGjZHeYRmUpnYMU -# pUwIoIPXIx/zX99vLM/aFtgOcgQo2Gs++BOxfKIXeU9+3DrknXAna7/b/B7HB9jA -# vguTHijgc23SVOkoTL9rXZ//XTMSN5UlYTRqQst8nTq7iFnho0JtOlBbSNECAwEA -# AaOCAeMwggHfMBAGCSsGAQQBgjcVAQQDAgEAMB0GA1UdDgQWBBTRT6mKBwjO9CQY -# mOUA//PWeR03vDAZBgkrBgEEAYI3FAIEDB4KAFMAdQBiAEMAQTALBgNVHQ8EBAMC -# AYYwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBTV9lbLj+iiXGJo0T2UkFvX -# zpoYxDBWBgNVHR8ETzBNMEugSaBHhkVodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20v -# cGtpL2NybC9wcm9kdWN0cy9NaWNSb29DZXJBdXRfMjAxMC0wNi0yMy5jcmwwWgYI -# KwYBBQUHAQEETjBMMEoGCCsGAQUFBzAChj5odHRwOi8vd3d3Lm1pY3Jvc29mdC5j -# b20vcGtpL2NlcnRzL01pY1Jvb0NlckF1dF8yMDEwLTA2LTIzLmNydDCBnQYDVR0g -# BIGVMIGSMIGPBgkrBgEEAYI3LgMwgYEwPQYIKwYBBQUHAgEWMWh0dHA6Ly93d3cu -# bWljcm9zb2Z0LmNvbS9QS0kvZG9jcy9DUFMvZGVmYXVsdC5odG0wQAYIKwYBBQUH -# AgIwNB4yIB0ATABlAGcAYQBsAF8AUABvAGwAaQBjAHkAXwBTAHQAYQB0AGUAbQBl -# AG4AdAAuIB0wDQYJKoZIhvcNAQELBQADggIBAC5Bpoa1Bm/wgIX6O8oX6cn65DnC -# lHDDZJTD2FamkI7+5Jr0bfVvjlONWqjzrttGbL5/HVRWGzwdccRRFVR+v+6llUIz -# /Q2QJCTj+dyWyvy4rL/0wjlWuLvtc7MX3X6GUCOLViTKu6YdmocvJ4XnobYKnA0b -# jPMAYkG6SHSHgv1QyfSHKcMDqivfGil56BIkmobt0C7TQIH1B18zBlRdQLX3sWL9 -# TUj3bkFHUhy7G8JXOqiZVpPUxt4mqGB1hrvsYqbwHQRF3z6nhNFbRCNjJTZ3b65b -# 3CLVFCNqQX/QQqbb7yV7BOPSljdiBq/4Gw+Oszmau4n1NQblpFvDjJ43X1PRozf9 -# pE/oGw5rduS4j7DC6v119yxBt5yj4R4F/peSy39ZA22oTo1OgBfU1XL2VuRIn6Mj -# ugagwI7RiE+TIPJwX9hrcqMgSfx3DF3Fx+ECDzhCEA7bAq6aNx1QgCkepKfZxpol -# Vf1Ayq1kEOgx+RJUeRryDtjWqx4z/gLnJm1hSY/xJcKLdJnf+ZMakBzu3ZQzDkJQ -# 239Q+J9iguymghZ8ZrzsmbDBWF2osJphFJHRmS9J5D6Bmdbm78rj/T7u7AmGAwcN -# Gw186/RayZXPhxIKXezFApLNBZlyyn3xKhAYOOQxoyi05kzFUqOcasd9wHEJBA1w -# 3gI/h+5WoezrtUyFMYIaHjCCGhoCAQEwgZAweTELMAkGA1UEBhMCVVMxEzARBgNV -# BAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jv -# c29mdCBDb3Jwb3JhdGlvbjEjMCEGA1UEAxMaTWljcm9zb2Z0IFdpbmRvd3MgUENB -# IDIwMTACEzMAAAuNF+hOjNBwyaQAAAAAC40wDQYJYIZIAWUDBAIBBQCgga4wGQYJ -# KoZIhvcNAQkDMQwGCisGAQQBgjcCAQQwHAYKKwYBBAGCNwIBCzEOMAwGCisGAQQB -# gjcCARUwLwYJKoZIhvcNAQkEMSIEICjaAYW6dpF96OECCa1j0HmEWEEdofGluuKS -# KwAnvISeMEIGCisGAQQBgjcCAQwxNDAyoBSAEgBNAGkAYwByAG8AcwBvAGYAdKEa -# gBhodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20wDQYJKoZIhvcNAQEBBQAEggEAPSUw -# uXOOzvVNkifKjBTVinJW7rdqj9J8oWF2ph6LhBx8Cf+GVhy4iiqjkOCR5HJGuXdu -# 2x8GRA+TDZuyc8GdSFc1Z0wuz1njQiqXXFLmCOjaGVpjVc10jSc1lA3BsNEehNax -# lPtIPW5J93z8t7TXEOSh7AZGQ3SmS12xKiusP6jfnDjNhzHgI0I+SgkX4QadjBIt -# QjGRkxrdE9dTJHiqmZKX351c287OQbQFvSCheF5VR5Ab9Tbm8Sw1feM5tRPP/gt0 -# vwW1PfdHPstKcufJEKfxjboBXOAzfKCaRqrj2kzRQfbMj5NjI22Y9YicSXzbJQu9 -# ygJfG1iulp12uxZl7qGCF60wghepBgorBgEEAYI3AwMBMYIXmTCCF5UGCSqGSIb3 -# DQEHAqCCF4YwgheCAgEDMQ8wDQYJYIZIAWUDBAIBBQAwggFaBgsqhkiG9w0BCRAB -# BKCCAUkEggFFMIIBQQIBAQYKKwYBBAGEWQoDATAxMA0GCWCGSAFlAwQCAQUABCDf -# p3n06ofTmz0YuKVhv/9rijFkkr8AB1PliqZjzdfZVwIGZ7YxybG5GBMyMDI1MDMx -# MjA1MDM1OS42ODRaMASAAgH0oIHZpIHWMIHTMQswCQYDVQQGEwJVUzETMBEGA1UE -# CBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9z -# b2Z0IENvcnBvcmF0aW9uMS0wKwYDVQQLEyRNaWNyb3NvZnQgSXJlbGFuZCBPcGVy -# YXRpb25zIExpbWl0ZWQxJzAlBgNVBAsTHm5TaGllbGQgVFNTIEVTTjozNjA1LTA1 -# RTAtRDk0NzElMCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZaCC -# EfswggcoMIIFEKADAgECAhMzAAAB91ggdQTK+8L0AAEAAAH3MA0GCSqGSIb3DQEB -# CwUAMHwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQH -# EwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNV -# BAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQSAyMDEwMB4XDTI0MDcyNTE4MzEw -# NloXDTI1MTAyMjE4MzEwNlowgdMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNo -# aW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29y -# cG9yYXRpb24xLTArBgNVBAsTJE1pY3Jvc29mdCBJcmVsYW5kIE9wZXJhdGlvbnMg -# TGltaXRlZDEnMCUGA1UECxMeblNoaWVsZCBUU1MgRVNOOjM2MDUtMDVFMC1EOTQ3 -# MSUwIwYDVQQDExxNaWNyb3NvZnQgVGltZS1TdGFtcCBTZXJ2aWNlMIICIjANBgkq -# hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0OdHTBNom6/uXKaEKP9rPITkT6QxF11t -# jzB0Nk1byDpPrFTHha3hxwSdTcr8Y0a3k6EQlwqy6ROz42e0R5eDW+dCoQapipDI -# FUOYp3oNuqwX/xepATEkY17MyXFx6rQW2NcWUJW3Qo2AuJ0HOtblSpItQZPGmHnG -# qkt/DB45Fwxk6VoSvxNcQKhKETkuzrt8U6DRccQm1FdhmPKgDzgcfDPM5o+Gnzbi -# Mu6y069A4EHmLMmkecSkVvBmcZ8VnzFHTDkGLdpnDV5FXjVObAgbSM0cnqYSGfRp -# 7VGHBRqyoscvR4bcQ+CV9pDjbJ6S5rZn1uA8hRhj09Hs33HRevt4oWAVYGItgEsG -# +BrCYbpgWMDEIVnAgPZEiPAaI8wBGemE4feEkuz7TAwgkRBcUzLgQ4uvPqRD1A+J -# kt26+pDqWYSn0MA8j0zacQk9q/AvciPXD9It2ez+mqEzgFRRsJGLtcf9HksvK8Js -# d6I5zFShlqi5bpzf1Y4NOiNOh5QwW1pIvA5irlal7qFhkAeeeZqmop8+uNxZXxFC -# QG3R3s5pXW89FiCh9rmXrVqOCwgcXFIJQAQkllKsI+UJqGq9rmRABJz5lHKTFYmF -# wcM52KWWjNx3z6odwz2h+sxaxewToe9GqtDx3/aU+yqNRcB8w0tSXUf+ylN4uk5x -# HEpLpx+ZNNsCAwEAAaOCAUkwggFFMB0GA1UdDgQWBBTfRqQzP3m9PZWuLf1p8/me -# FfkmmDAfBgNVHSMEGDAWgBSfpxVdAF5iXYP05dJlpxtTNRnpcjBfBgNVHR8EWDBW -# MFSgUqBQhk5odHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2NybC9NaWNy -# b3NvZnQlMjBUaW1lLVN0YW1wJTIwUENBJTIwMjAxMCgxKS5jcmwwbAYIKwYBBQUH -# AQEEYDBeMFwGCCsGAQUFBzAChlBodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtp -# b3BzL2NlcnRzL01pY3Jvc29mdCUyMFRpbWUtU3RhbXAlMjBQQ0ElMjAyMDEwKDEp -# LmNydDAMBgNVHRMBAf8EAjAAMBYGA1UdJQEB/wQMMAoGCCsGAQUFBwMIMA4GA1Ud -# DwEB/wQEAwIHgDANBgkqhkiG9w0BAQsFAAOCAgEAN0ajafILeL6SQIMIMAXM1Qd6 -# xaoci2mOrpR8vKWyyTsL3b83A7XGLiAbQxTrqnXvVWWeNst5YQD8saO+UTgOLJdT -# dfUADhLXoK+RlwjfndimIJT9MH9tUYXLzJXKhZM09ouPwNsrn8YOLIpdAi5TPyN8 -# Cl11OGZSlP9r8JnvomW00AoJ4Pl9rlg0G5lcQknAXqHa9nQdWp1ZxXqNd+0JsKml -# R8tcANX33ClM9NnaClJExLQHiKeHUUWtqyLMl65TW6wRM7XlF7Y+PTnC8duNWn4u -# Lng+ON/Z39GO6qBj7IEZxoq4o3avEh9ba43UU6TgzVZaBm8VaA0wSwUe/pqpTOYF -# WN62XL3gl/JC2pzfIPxP66XfRLIxafjBVXm8KVDn2cML9IvRK02s941Y5+RR4gSA -# OhLiQQ6A03VNRup+spMa0k+XTPAi+2aMH5xa1Zjb/K8u9f9M05U0/bUMJXJDP++y -# sWpJbVRDiHG7szaca+r3HiUPjQJyQl2NiOcYTGV/DcLrLCBK2zG503FGb04N5Kf1 -# 0XgAwFaXlod5B9eKh95PnXKx2LNBgLwG85anlhhGxxBQ5mFsJGkBn0PZPtAzZyfr -# 96qxzpp2pH9DJJcjKCDrMmZziXazpa5VVN36CO1kDU4ABkSYTXOM8RmJXuQm7mUF -# 3bWmj+hjAJb4pz6hT5UwggdxMIIFWaADAgECAhMzAAAAFcXna54Cm0mZAAAAAAAV -# MA0GCSqGSIb3DQEBCwUAMIGIMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGlu -# Z3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBv -# cmF0aW9uMTIwMAYDVQQDEylNaWNyb3NvZnQgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRo -# b3JpdHkgMjAxMDAeFw0yMTA5MzAxODIyMjVaFw0zMDA5MzAxODMyMjVaMHwxCzAJ -# BgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25k -# MR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jv -# c29mdCBUaW1lLVN0YW1wIFBDQSAyMDEwMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A -# MIICCgKCAgEA5OGmTOe0ciELeaLL1yR5vQ7VgtP97pwHB9KpbE51yMo1V/YBf2xK -# 4OK9uT4XYDP/XE/HZveVU3Fa4n5KWv64NmeFRiMMtY0Tz3cywBAY6GB9alKDRLem -# jkZrBxTzxXb1hlDcwUTIcVxRMTegCjhuje3XD9gmU3w5YQJ6xKr9cmmvHaus9ja+ -# NSZk2pg7uhp7M62AW36MEBydUv626GIl3GoPz130/o5Tz9bshVZN7928jaTjkY+y -# OSxRnOlwaQ3KNi1wjjHINSi947SHJMPgyY9+tVSP3PoFVZhtaDuaRr3tpK56KTes -# y+uDRedGbsoy1cCGMFxPLOJiss254o2I5JasAUq7vnGpF1tnYN74kpEeHT39IM9z -# fUGaRnXNxF803RKJ1v2lIH1+/NmeRd+2ci/bfV+AutuqfjbsNkz2K26oElHovwUD -# o9Fzpk03dJQcNIIP8BDyt0cY7afomXw/TNuvXsLz1dhzPUNOwTM5TI4CvEJoLhDq -# hFFG4tG9ahhaYQFzymeiXtcodgLiMxhy16cg8ML6EgrXY28MyTZki1ugpoMhXV8w -# dJGUlNi5UPkLiWHzNgY1GIRH29wb0f2y1BzFa/ZcUlFdEtsluq9QBXpsxREdcu+N -# +VLEhReTwDwV2xo3xwgVGD94q0W29R6HXtqPnhZyacaue7e3PmriLq0CAwEAAaOC -# Ad0wggHZMBIGCSsGAQQBgjcVAQQFAgMBAAEwIwYJKwYBBAGCNxUCBBYEFCqnUv5k -# xJq+gpE8RjUpzxD/LwTuMB0GA1UdDgQWBBSfpxVdAF5iXYP05dJlpxtTNRnpcjBc -# BgNVHSAEVTBTMFEGDCsGAQQBgjdMg30BATBBMD8GCCsGAQUFBwIBFjNodHRwOi8v -# d3d3Lm1pY3Jvc29mdC5jb20vcGtpb3BzL0RvY3MvUmVwb3NpdG9yeS5odG0wEwYD -# VR0lBAwwCgYIKwYBBQUHAwgwGQYJKwYBBAGCNxQCBAweCgBTAHUAYgBDAEEwCwYD -# VR0PBAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAU1fZWy4/oolxi -# aNE9lJBb186aGMQwVgYDVR0fBE8wTTBLoEmgR4ZFaHR0cDovL2NybC5taWNyb3Nv -# ZnQuY29tL3BraS9jcmwvcHJvZHVjdHMvTWljUm9vQ2VyQXV0XzIwMTAtMDYtMjMu -# Y3JsMFoGCCsGAQUFBwEBBE4wTDBKBggrBgEFBQcwAoY+aHR0cDovL3d3dy5taWNy -# b3NvZnQuY29tL3BraS9jZXJ0cy9NaWNSb29DZXJBdXRfMjAxMC0wNi0yMy5jcnQw -# DQYJKoZIhvcNAQELBQADggIBAJ1VffwqreEsH2cBMSRb4Z5yS/ypb+pcFLY+Tkdk -# eLEGk5c9MTO1OdfCcTY/2mRsfNB1OW27DzHkwo/7bNGhlBgi7ulmZzpTTd2YurYe -# eNg2LpypglYAA7AFvonoaeC6Ce5732pvvinLbtg/SHUB2RjebYIM9W0jVOR4U3Uk -# V7ndn/OOPcbzaN9l9qRWqveVtihVJ9AkvUCgvxm2EhIRXT0n4ECWOKz3+SmJw7wX -# sFSFQrP8DJ6LGYnn8AtqgcKBGUIZUnWKNsIdw2FzLixre24/LAl4FOmRsqlb30mj -# dAy87JGA0j3mSj5mO0+7hvoyGtmW9I/2kQH2zsZ0/fZMcm8Qq3UwxTSwethQ/gpY -# 3UA8x1RtnWN0SCyxTkctwRQEcb9k+SS+c23Kjgm9swFXSVRk2XPXfx5bRAGOWhmR -# aw2fpCjcZxkoJLo4S5pu+yFUa2pFEUep8beuyOiJXk+d0tBMdrVXVAmxaQFEfnyh -# YWxz/gq77EFmPWn9y8FBSX5+k77L+DvktxW/tM4+pTFRhLy/AsGConsXHRWJjXD+ -# 57XQKBqJC4822rpM+Zv/Cuk0+CQ1ZyvgDbjmjJnW4SLq8CdCPSWU5nR0W2rRnj7t -# fqAxM328y+l7vzhwRNGQ8cirOoo6CGJ/2XBjU02N7oJtpQUQwXEGahC0HVUzWLOh -# cGbyoYIDVjCCAj4CAQEwggEBoYHZpIHWMIHTMQswCQYDVQQGEwJVUzETMBEGA1UE -# CBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9z -# b2Z0IENvcnBvcmF0aW9uMS0wKwYDVQQLEyRNaWNyb3NvZnQgSXJlbGFuZCBPcGVy -# YXRpb25zIExpbWl0ZWQxJzAlBgNVBAsTHm5TaGllbGQgVFNTIEVTTjozNjA1LTA1 -# RTAtRDk0NzElMCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZaIj -# CgEBMAcGBSsOAwIaAxUAb28KDG/xXbNBjmM7/nqw3bgrEOaggYMwgYCkfjB8MQsw -# CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u -# ZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNy -# b3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMDANBgkqhkiG9w0BAQsFAAIFAOt7DJww -# IhgPMjAyNTAzMTExOTI1MTZaGA8yMDI1MDMxMjE5MjUxNlowdDA6BgorBgEEAYRZ -# CgQBMSwwKjAKAgUA63sMnAIBADAHAgEAAgINezAHAgEAAgIUbTAKAgUA63xeHAIB -# ADA2BgorBgEEAYRZCgQCMSgwJjAMBgorBgEEAYRZCgMCoAowCAIBAAIDB6EgoQow -# CAIBAAIDAYagMA0GCSqGSIb3DQEBCwUAA4IBAQByHXKsA3jwBMLStTX9YrUEKeUc -# iKhqb5t2dMmL//ddLgYa4aTMcR336U5cuVv0ei3pMKb+u0i9Khzn+yhGvQmXuS49 -# rvT/96xV3NPh4UtTFiOq32mbWdnPu2Dk/BMopiX3x4H4h4wbPwCyZuw/3I3fYziX -# C82nzfon4kWQGVLsFKPR76FvwKJfCdnORNcsjGHVC0I2dYldnOkXEOagD+HYuxxP -# TheSSsOjyr00FWJrq/+sJEW61k3e0YhiYUkt9xXz6Af941QarQtYUVZOkatiYfSO -# IbsqBNc0QiwhHL+MZfLtkTJby5ZkPGZVW4IpgvkUCP1OGPyfsT6MkX+hwf/9MYIE -# DTCCBAkCAQEwgZMwfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24x -# EDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlv -# bjEmMCQGA1UEAxMdTWljcm9zb2Z0IFRpbWUtU3RhbXAgUENBIDIwMTACEzMAAAH3 -# WCB1BMr7wvQAAQAAAfcwDQYJYIZIAWUDBAIBBQCgggFKMBoGCSqGSIb3DQEJAzEN -# BgsqhkiG9w0BCRABBDAvBgkqhkiG9w0BCQQxIgQg/yRDeNFKnwzs5Rt50bP3NG59 -# w0d+IBESDcY47TiFwVAwgfoGCyqGSIb3DQEJEAIvMYHqMIHnMIHkMIG9BCAh2pja -# a3ca0ecYuhu60uYHP/IKnPbedbVQJ5SoIH5Z4jCBmDCBgKR+MHwxCzAJBgNVBAYT -# AlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYD -# VQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBU -# aW1lLVN0YW1wIFBDQSAyMDEwAhMzAAAB91ggdQTK+8L0AAEAAAH3MCIEIAhgyovm -# 0hKpfTDqUSQodYmLea3PP/1DIDJ7Pag/qvJBMA0GCSqGSIb3DQEBCwUABIICAI3M -# wyyVZaZPcrXoNBl5mLAJ5MmRJDgU+6UCsXyoqNu7dcTCKWRbdOwbI7ha8NW+4rn6 -# yzYRGhgI+9baZsQKF3Uo/rcQH8OyRtqlC3KxaFvfsZ2icfBByjy0d7GZAZLSHe/F -# BXUWdZh9UbDotE9rupdHAzgSlSQDWGuO22zCJmlt7eY6TDoiSXdaqIMFIK4RMAZd -# dZ+OiZjBOIooLV4ATNV58Q/rIOrZ9XQ06km/LBsjQwf6PwEpvQZmZ79zSHcs2qwL -# cc8AXwVtvvAyy2XxGVRRi7WS77TUDyMs4g+ewCtw7zFMft/WPjUS2Mq1BZAbyoHD -# g2ZzsQoOLOD6J46P21Aon5E3RHC1DmuCjWKfYx/a5+myomFa81++yd24QqmG8oV0 -# xuPnxFzd89dtAl5+UIORVYhW15jQbvUjHRThTUo7tmAFx6mPuE6JP3C8921TY7Y/ -# ysNpZj6br46oGcDv86ACtDr7rWRYgLAvbPLacxfsVXC3YGVK7CmX03n7wVAOrFqr -# 0CKROmV8648RimNuSWtokfoSoi8lkb23NUaq4MNrM9j3uJIyts0uR6Bd881tlXIM -# ui+aTFRHo4MmoA6mmzTqV66NEhscgBET2nVUCqWu9pANtAieXwMVkRSykUzbGLb2 -# pigzqgudYrehlVfB6KDxIX7R++VavMqpqCZsNKZP -# SIG # End signature block diff --git a/newton-cn/bin/Modules/ConfigDefenderPerformance/MSFT_MpPerformanceRecording.psm1 b/newton-cn/bin/Modules/ConfigDefenderPerformance/MSFT_MpPerformanceRecording.psm1 deleted file mode 100644 index 6365e6d..0000000 --- a/newton-cn/bin/Modules/ConfigDefenderPerformance/MSFT_MpPerformanceRecording.psm1 +++ /dev/null @@ -1,1936 +0,0 @@ -## Copyright (c) Microsoft Corporation. All rights reserved. - -<# -.SYNOPSIS -This cmdlet collects a performance recording of Microsoft Defender Antivirus -scans. - -.DESCRIPTION -This cmdlet collects a performance recording of Microsoft Defender Antivirus -scans. These performance recordings contain Microsoft-Antimalware-Engine -and NT kernel process events and can be analyzed after collection using the -Get-MpPerformanceReport cmdlet. - -This cmdlet requires elevated administrator privileges. - -The performance analyzer provides insight into problematic files that could -cause performance degradation of Microsoft Defender Antivirus. This tool is -provided "AS IS", and is not intended to provide suggestions on exclusions. -Exclusions can reduce the level of protection on your endpoints. Exclusions, -if any, should be defined with caution. - -.EXAMPLE -New-MpPerformanceRecording -RecordTo:.\Defender-scans.etl - -#> -function New-MpPerformanceRecording { - [CmdletBinding(DefaultParameterSetName='Interactive')] - param( - - # Specifies the location where to save the Microsoft Defender Antivirus - # performance recording. - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [string]$RecordTo, - - # Specifies the duration of the performance recording in seconds. - [Parameter(Mandatory=$true, ParameterSetName='Timed')] - [ValidateRange(0,2147483)] - [int]$Seconds, - - # Specifies the PSSession object in which to create and save the Microsoft - # Defender Antivirus performance recording. When you use this parameter, - # the RecordTo parameter refers to the local path on the remote machine. - [Parameter(Mandatory=$false)] - [System.Management.Automation.Runspaces.PSSession[]]$Session, - - # Optional argument to specifiy a different tool for recording traces. Default is wpr.exe - # When $Session parameter is used this path represents a location on the remote machine. - [Parameter(Mandatory=$false)] - [string]$WPRPath = $null - - ) - - [bool]$interactiveMode = ($PSCmdlet.ParameterSetName -eq 'Interactive') - [bool]$timedMode = ($PSCmdlet.ParameterSetName -eq 'Timed') - - # Hosts - [string]$powerShellHostConsole = 'ConsoleHost' - [string]$powerShellHostISE = 'Windows PowerShell ISE Host' - [string]$powerShellHostRemote = 'ServerRemoteHost' - - if ($interactiveMode -and ($Host.Name -notin @($powerShellHostConsole, $powerShellHostISE, $powerShellHostRemote))) { - $ex = New-Object System.Management.Automation.ItemNotFoundException 'Cmdlet supported only on local PowerShell console, Windows PowerShell ISE and remote PowerShell console.' - $category = [System.Management.Automation.ErrorCategory]::NotImplemented - $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'NotImplemented',$category,$Host.Name - $psCmdlet.WriteError($errRecord) - return - } - - if ($null -ne $Session) { - [int]$RemotedSeconds = if ($timedMode) { $Seconds } else { -1 } - - Invoke-Command -Session:$session -ArgumentList:@($RecordTo, $RemotedSeconds) -ScriptBlock:{ - param( - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [string]$RecordTo, - - [Parameter(Mandatory=$true)] - [ValidateRange(-1,2147483)] - [int]$RemotedSeconds - ) - - if ($RemotedSeconds -eq -1) { - New-MpPerformanceRecording -RecordTo:$RecordTo -WPRPath:$WPRPath - } else { - New-MpPerformanceRecording -RecordTo:$RecordTo -Seconds:$RemotedSeconds -WPRPath:$WPRPath - } - } - - return - } - - if (-not (Test-Path -LiteralPath:$RecordTo -IsValid)) { - $ex = New-Object System.Management.Automation.ItemNotFoundException "Cannot record Microsoft Defender Antivirus performance recording to path '$RecordTo' because the location does not exist." - $category = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'InvalidPath',$category,$RecordTo - $psCmdlet.WriteError($errRecord) - return - } - - # Resolve any relative paths - $RecordTo = $psCmdlet.SessionState.Path.GetUnresolvedProviderPathFromPSPath($RecordTo) - - # Dependencies: WPR Profile - [string]$wprProfile = "$PSScriptRoot\MSFT_MpPerformanceRecording.wprp" - - if (-not (Test-Path -LiteralPath:$wprProfile -PathType:Leaf)) { - $ex = New-Object System.Management.Automation.ItemNotFoundException "Cannot find dependency file '$wprProfile' because it does not exist." - $category = [System.Management.Automation.ErrorCategory]::ObjectNotFound - $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'PathNotFound',$category,$wprProfile - $psCmdlet.WriteError($errRecord) - return - } - - # Dependencies: WPR Version - try - { - # If user provides a valid string as $WPRPath we go with that. - [string]$wprCommand = $WPRPath - - if (!$wprCommand) { - $wprCommand = "wpr.exe" - $wprs = @(Get-Command -All "wpr" 2> $null) - - if ($wprs -and ($wprs.Length -ne 0)) { - $latestVersion = [System.Version]"0.0.0.0" - - $wprs | ForEach-Object { - $currentVersion = $_.Version - $currentFullPath = $_.Source - $currentVersionString = $currentVersion.ToString() - Write-Host "Found $currentVersionString at $currentFullPath" - - if ($currentVersion -gt $latestVersion) { - $latestVersion = $currentVersion - $wprCommand = $currentFullPath - } - } - } - } - } - catch - { - # Fallback to the old ways in case we encounter an error (ex: version string format change). - [string]$wprCommand = "wpr.exe" - } - finally - { - Write-Host "`nUsing $wprCommand version $((Get-Command $wprCommand).FileVersionInfo.FileVersion)`n" - } - - # - # Test dependency presence - # - if (-not (Get-Command $wprCommand -ErrorAction:SilentlyContinue)) { - $ex = New-Object System.Management.Automation.ItemNotFoundException "Cannot find dependency command '$wprCommand' because it does not exist." - $category = [System.Management.Automation.ErrorCategory]::ObjectNotFound - $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'PathNotFound',$category,$wprCommand - $psCmdlet.WriteError($errRecord) - return - } - - # Exclude versions that have known bugs or are not supported any more. - [int]$wprFileVersion = ((Get-Command $wprCommand).Version.Major) -as [int] - if ($wprFileVersion -le 6) { - $ex = New-Object System.Management.Automation.PSNotSupportedException "You are using an older and unsupported version of '$wprCommand'. Please download and install Windows ADK:`r`nhttps://docs.microsoft.com/en-us/windows-hardware/get-started/adk-install`r`nand try again." - $category = [System.Management.Automation.ErrorCategory]::NotInstalled - $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'NotSupported',$category,$wprCommand - $psCmdlet.WriteError($errRecord) - return - } - - function CancelPerformanceRecording { - Write-Host "`n`nCancelling Microsoft Defender Antivirus performance recording... " -NoNewline - - & $wprCommand -cancel -instancename MSFT_MpPerformanceRecording - $wprCommandExitCode = $LASTEXITCODE - - switch ($wprCommandExitCode) { - 0 {} - 0xc5583000 { - Write-Error "Cannot cancel performance recording because currently Windows Performance Recorder is not recording." - return - } - default { - Write-Error ("Cannot cancel performance recording: 0x{0:x08}." -f $wprCommandExitCode) - return - } - } - - Write-Host "ok.`n`nRecording has been cancelled." - } - - # - # Ensure Ctrl-C doesn't abort the app without cleanup - # - - # - local PowerShell consoles: use [Console]::TreatControlCAsInput; cleanup performed and output preserved - # - PowerShell ISE: use try { ... } catch { throw } finally; cleanup performed and output preserved - # - remote PowerShell: use try { ... } catch { throw } finally; cleanup performed but output truncated - - [bool]$canTreatControlCAsInput = $interactiveMode -and ($Host.Name -eq $powerShellHostConsole) - $savedControlCAsInput = $null - - $shouldCancelRecordingOnTerminatingError = $false - - try - { - if ($canTreatControlCAsInput) { - $savedControlCAsInput = [Console]::TreatControlCAsInput - [Console]::TreatControlCAsInput = $true - } - - # - # Start recording - # - - Write-Host "Starting Microsoft Defender Antivirus performance recording... " -NoNewline - - $shouldCancelRecordingOnTerminatingError = $true - - & $wprCommand -start "$wprProfile!Scans.Light" -filemode -instancename MSFT_MpPerformanceRecording - $wprCommandExitCode = $LASTEXITCODE - - switch ($wprCommandExitCode) { - 0 {} - 0xc5583001 { - $shouldCancelRecordingOnTerminatingError = $false - Write-Error "Cannot start performance recording because Windows Performance Recorder is already recording." - return - } - default { - $shouldCancelRecordingOnTerminatingError = $false - Write-Error ("Cannot start performance recording: 0x{0:x08}." -f $wprCommandExitCode) - return - } - } - - Write-Host "ok.`n`nRecording has started." -NoNewline - - if ($timedMode) { - Write-Host "`n`n Recording for $Seconds seconds... " -NoNewline - - Start-Sleep -Seconds:$Seconds - - Write-Host "ok." -NoNewline - } elseif ($interactiveMode) { - $stopPrompt = "`n`n=> Reproduce the scenario that is impacting the performance on your device.`n`n Press to stop and save recording or to cancel recording" - - if ($canTreatControlCAsInput) { - Write-Host "${stopPrompt}: " - - do { - $key = [Console]::ReadKey($true) - if (($key.Modifiers -eq [ConsoleModifiers]::Control) -and (($key.Key -eq [ConsoleKey]::C))) { - - CancelPerformanceRecording - - $shouldCancelRecordingOnTerminatingError = $false - - # - # Restore Ctrl-C behavior - # - - [Console]::TreatControlCAsInput = $savedControlCAsInput - - return - } - - } while (($key.Modifiers -band ([ConsoleModifiers]::Alt -bor [ConsoleModifiers]::Control -bor [ConsoleModifiers]::Shift)) -or ($key.Key -ne [ConsoleKey]::Enter)) - - } else { - Read-Host -Prompt:$stopPrompt - } - } - - # - # Stop recording - # - - Write-Host "`n`nStopping Microsoft Defender Antivirus performance recording... " - - & $wprCommand -stop $RecordTo -instancename MSFT_MpPerformanceRecording - $wprCommandExitCode = $LASTEXITCODE - - switch ($wprCommandExitCode) { - 0 { - $shouldCancelRecordingOnTerminatingError = $false - } - 0xc5583000 { - $shouldCancelRecordingOnTerminatingError = $false - Write-Error "Cannot stop performance recording because Windows Performance Recorder is not recording a trace." - return - } - default { - Write-Error ("Cannot stop performance recording: 0x{0:x08}." -f $wprCommandExitCode) - return - } - } - - Write-Host "ok.`n`nRecording has been saved to '$RecordTo'." - - Write-Host ` -' -The performance analyzer provides insight into problematic files that could -cause performance degradation of Microsoft Defender Antivirus. This tool is -provided "AS IS", and is not intended to provide suggestions on exclusions. -Exclusions can reduce the level of protection on your endpoints. Exclusions, -if any, should be defined with caution. -' -Write-Host ` -' -The trace you have just captured may contain personally identifiable information, -including but not necessarily limited to paths to files accessed, paths to -registry accessed and process names. Exact information depends on the events that -were logged. Please be aware of this when sharing this trace with other people. -' - } catch { - throw - } finally { - if ($shouldCancelRecordingOnTerminatingError) { - CancelPerformanceRecording - } - - if ($null -ne $savedControlCAsInput) { - # - # Restore Ctrl-C behavior - # - - [Console]::TreatControlCAsInput = $savedControlCAsInput - } - } -} - -function PadUserDateTime -{ - [OutputType([DateTime])] - param( - [Parameter(Mandatory = $true, Position = 0)] - [DateTime]$UserDateTime - ) - - # Padding user input to include all events up to the start of the next second. - if (($UserDateTime.Ticks % 10000000) -eq 0) - { - return $UserDateTime.AddTicks(9999999) - } - else - { - return $UserDateTime - } -} - -function ValidateTimeInterval -{ - [OutputType([PSCustomObject])] - param( - [DateTime]$MinStartTime = [DateTime]::MinValue, - [DateTime]$MinEndTime = [DateTime]::MinValue, - [DateTime]$MaxStartTime = [DateTime]::MaxValue, - [DateTime]$MaxEndTime = [DateTime]::MaxValue - ) - - $ret = [PSCustomObject]@{ - arguments = [string[]]@() - status = $false - } - - if ($MinStartTime -gt $MaxEndTime) - { - $ex = New-Object System.Management.Automation.ValidationMetadataException "MinStartTime '$MinStartTime' should have been lower than MaxEndTime '$MaxEndTime'" - $category = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'Invalid time interval',$category,"'$MinStartTime' .. '$MaxEndTime'" - $psCmdlet.WriteError($errRecord) - return $ret - } - - if ($MinStartTime -gt $MaxStartTime) - { - $ex = New-Object System.Management.Automation.ValidationMetadataException "MinStartTime '$MinStartTime' should have been lower than MaxStartTime '$MaxStartTime'" - $category = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'Invalid time interval',$category,"'$MinStartTime' .. '$MaxStartTime'" - $psCmdlet.WriteError($errRecord) - return $ret - } - - if ($MinEndTime -gt $MaxEndTime) - { - $ex = New-Object System.Management.Automation.ValidationMetadataException "MinEndTime '$MinEndTime' should have been lower than MaxEndTime '$MaxEndTime'" - $category = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'Invalid time interval',$category,"'$MinEndTime' .. '$MaxEndTime'" - $psCmdlet.WriteError($errRecord) - return $ret - } - - if ($MinStartTime -gt [DateTime]::MinValue) - { - try - { - $MinStartFileTime = $MinStartTime.ToFileTime() - } - catch - { - $ex = New-Object System.Management.Automation.ValidationMetadataException "MinStartTime '$MinStartTime' is not a valid timestamp." - $category = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'Value has to be a local DateTime between "January 1, 1601 12:00:00 AM UTC" and "December 31, 9999 11:59:59 PM UTC"',$category,"'$MinStartTime'" - $psCmdlet.WriteError($errRecord) - return $ret - } - - $ret.arguments += @('-MinStartTime', $MinStartFileTime) - } - - if ($MaxEndTime -lt [DateTime]::MaxValue) - { - try - { - $MaxEndFileTime = $MaxEndTime.ToFileTime() - } - catch - { - $ex = New-Object System.Management.Automation.ValidationMetadataException "MaxEndTime '$MaxEndTime' is not a valid timestamp." - $category = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'Value has to be a local DateTime between "January 1, 1601 12:00:00 AM UTC" and "December 31, 9999 11:59:59 PM UTC"',$category,"'$MaxEndTime'" - $psCmdlet.WriteError($errRecord) - return $ret - } - - $ret.arguments += @('-MaxEndTime', $MaxEndFileTime) - } - - if ($MaxStartTime -lt [DateTime]::MaxValue) - { - try - { - $MaxStartFileTime = $MaxStartTime.ToFileTime() - } - catch - { - $ex = New-Object System.Management.Automation.ValidationMetadataException "MaxStartTime '$MaxStartTime' is not a valid timestamp." - $category = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'Value has to be a local DateTime between "January 1, 1601 12:00:00 AM UTC" and "December 31, 9999 11:59:59 PM UTC"',$category,"'$MaxStartTime'" - $psCmdlet.WriteError($errRecord) - return $ret - } - - $ret.arguments += @('-MaxStartTime', $MaxStartFileTime) - } - - if ($MinEndTime -gt [DateTime]::MinValue) - { - try - { - $MinEndFileTime = $MinEndTime.ToFileTime() - } - catch - { - $ex = New-Object System.Management.Automation.ValidationMetadataException "MinEndTime '$MinEndTime' is not a valid timestamp." - $category = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'Value has to be a local DateTime between "January 1, 1601 12:00:00 AM UTC" and "December 31, 9999 11:59:59 PM UTC"',$category,"'$MinEndTime'" - $psCmdlet.WriteError($errRecord) - return $ret - } - - $ret.arguments += @('-MinEndTime', $MinEndFileTime) - } - - $ret.status = $true - return $ret -} - -function ParseFriendlyDuration -{ - [OutputType([TimeSpan])] - param( - [Parameter(Mandatory = $true, Position = 0)] - [string] - $FriendlyDuration - ) - - if ($FriendlyDuration -match '^(\d+)(?:\.(\d+))?(sec|ms|us)$') - { - [string]$seconds = $Matches[1] - [string]$decimals = $Matches[2] - [string]$unit = $Matches[3] - - [uint32]$magnitude = - switch ($unit) - { - 'sec' {7} - 'ms' {4} - 'us' {1} - } - - if ($decimals.Length -gt $magnitude) - { - throw [System.ArgumentException]::new("String '$FriendlyDuration' was not recognized as a valid Duration: $($decimals.Length) decimals specified for time unit '$unit'; at most $magnitude expected.") - } - - return [timespan]::FromTicks([int64]::Parse($seconds + $decimals.PadRight($magnitude, '0'))) - } - - [timespan]$result = [timespan]::FromTicks(0) - if ([timespan]::TryParse($FriendlyDuration, [ref]$result)) - { - return $result - } - - throw [System.ArgumentException]::new("String '$FriendlyDuration' was not recognized as a valid Duration; expected a value like '0.1234567sec' or '0.1234ms' or '0.1us' or a valid TimeSpan.") -} - -[scriptblock]$FriendlyTimeSpanToString = { '{0:0.0000}ms' -f ($this.Ticks / 10000.0) } - -function New-FriendlyTimeSpan -{ - param( - [Parameter(Mandatory = $true)] - [uint64]$Ticks, - - [bool]$Raw = $false - ) - - if ($Raw) { - return $Ticks - } - - $result = [TimeSpan]::FromTicks($Ticks) - $result.PsTypeNames.Insert(0, 'MpPerformanceReport.TimeSpan') - $result | Add-Member -Force -MemberType:ScriptMethod -Name:'ToString' -Value:$FriendlyTimeSpanToString - $result -} - -function New-FriendlyDateTime -{ - param( - [Parameter(Mandatory = $true)] - [uint64]$FileTime, - - [bool]$Raw = $false - ) - - if ($Raw) { - return $FileTime - } - - [DateTime]::FromFileTime($FileTime) -} - -function Add-DefenderCollectionType -{ - param( - [Parameter(Mandatory = $true)] - [ref]$CollectionRef - ) - - if ($CollectionRef.Value.Length -and ($CollectionRef.Value | Get-Member -Name:'Processes','Files','Extensions','Scans','Folder')) - { - $CollectionRef.Value.PSTypeNames.Insert(0, 'MpPerformanceReport.NestedCollection') - } -} - -[scriptblock]$FriendlyScanInfoToString = { - [PSCustomObject]@{ - ScanType = $this.ScanType - StartTime = $this.StartTime - EndTime = $this.EndTime - Duration = $this.Duration - Reason = $this.Reason - Path = $this.Path - ProcessPath = $this.ProcessPath - ProcessId = $this.ProcessId - Image = $this.Image - } -} - -function Get-ScanComments -{ - param( - [PSCustomObject[]]$SecondaryEvents, - [bool]$Raw = $false - ) - - $Comments = @() - - foreach ($item in @($SecondaryEvents | Sort-Object -Property:StartTime)) { - if (($item | Get-Member -Name:'Message' -MemberType:NoteProperty).Count -eq 1) { - if (($item | Get-Member -Name:'Duration' -MemberType:NoteProperty).Count -eq 1) { - $Duration = New-FriendlyTimeSpan -Ticks:$item.Duration -Raw:$Raw - $StartTime = New-FriendlyDateTime -FileTime:$item.StartTime -Raw:$Raw - - $Comments += "Expensive operation `"{0}`" started at {1} lasted {2}" -f ($item.Message, $StartTime, $Duration.ToString()) - - if (($item | Get-Member -Name:'Debug' -MemberType:NoteProperty).Count -eq 1) { - $item.Debug | ForEach-Object { - if ($_.EndsWith("is NOT trusted") -or $_.StartsWith("Not trusted, ") -or $_.ToLower().Contains("error") -or $_.Contains("Result of ValidateTrust")) { - $Comments += "$_" - } - } - } - } - else { - if ($item.Message.Contains("subtype=Lowfi")) { - $Comments += $item.Message.Replace("subtype=Lowfi", "Low-fidelity detection") - } - else { - $Comments += $item.Message - } - } - } - elseif (($item | Get-Member -Name:'ScanType' -MemberType:NoteProperty).Count -eq 1) { - $Duration = New-FriendlyTimeSpan -Ticks:$item.Duration -Raw:$Raw - $OpId = "Internal opertion" - - if (($item | Get-Member -Name:'Path' -MemberType:NoteProperty).Count -eq 1) { - $OpId = $item.Path - } - elseif (($item | Get-Member -Name:'ProcessPath' -MemberType:NoteProperty).Count -eq 1) { - $OpId = $item.ProcessPath - } - - $Comments += "{0} {1} lasted {2}" -f ($item.ScanType, $OpId, $Duration.ToString()) - } - } - - $Comments -} - -filter ConvertTo-DefenderScanInfo -{ - param( - [bool]$Raw = $false - ) - - $result = [PSCustomObject]@{ - ScanType = [string]$_.ScanType - StartTime = New-FriendlyDateTime -FileTime:$_.StartTime -Raw:$Raw - EndTime = New-FriendlyDateTime -FileTime:$_.EndTime -Raw:$Raw - Duration = New-FriendlyTimeSpan -Ticks:$_.Duration -Raw:$Raw - Reason = [string]$_.Reason - SkipReason = [string]$_.SkipReason - } - - if (($_ | Get-Member -Name:'Path' -MemberType:NoteProperty).Count -eq 1) { - $result | Add-Member -NotePropertyName:'Path' -NotePropertyValue:([string]$_.Path) - } - - if (($_ | Get-Member -Name:'ProcessPath' -MemberType:NoteProperty).Count -eq 1) { - $result | Add-Member -NotePropertyName:'ProcessPath' -NotePropertyValue:([string]$_.ProcessPath) - } - - if (($_ | Get-Member -Name:'Image' -MemberType:NoteProperty).Count -eq 1) { - $result | Add-Member -NotePropertyName:'Image' -NotePropertyValue:([string]$_.Image) - } - elseif ($_.ProcessPath -and (-not $_.ProcessPath.StartsWith("pid"))) { - try { - $result | Add-Member -NotePropertyName:'Image' -NotePropertyValue:([string]([System.IO.FileInfo]$_.ProcessPath).Name) - } catch { - # Silently ignore. - } - } - - $ProcessId = if ($_.ProcessId -gt 0) { [int]$_.ProcessId } elseif ($_.ScannedProcessId -gt 0) { [int]$_.ScannedProcessId } else { $null } - if ($ProcessId) { - $result | Add-Member -NotePropertyName:'ProcessId' -NotePropertyValue:([int]$ProcessId) - } - - if ($result.Image -and $result.ProcessId) { - $ProcessName = "{0} ({1})" -f $result.Image, $result.ProcessId - $result | Add-Member -NotePropertyName:'ProcessName' -NotePropertyValue:([string]$ProcessName) - } - - if ((($_ | Get-Member -Name:'Extra' -MemberType:NoteProperty).Count -eq 1) -and ($_.Extra.Count -gt 0)) { - $Comments = @(Get-ScanComments -SecondaryEvents:$_.Extra -Raw:$Raw) - $result | Add-Member -NotePropertyName:'Comments' -NotePropertyValue:$Comments - } - - if (-not $Raw) { - $result.PSTypeNames.Insert(0, 'MpPerformanceReport.ScanInfo') - } - - $result | Add-Member -Force -MemberType:ScriptMethod -Name:'ToString' -Value:$FriendlyScanInfoToString - $result -} - -filter ConvertTo-DefenderScanOverview -{ - param( - [bool]$Raw = $false - ) - - $vals = [ordered]@{} - - foreach ($entry in $_.PSObject.Properties) { - if ($entry.Value) { - $Key = $entry.Name.Replace("_", " ") - - if ($Key.EndsWith("Time")) { - $vals[$Key] = New-FriendlyDateTime -FileTime:$entry.Value -Raw:$Raw - } - elseif ($Key.EndsWith("Duration")) { - $vals[$Key] = New-FriendlyTimeSpan -Ticks:$entry.Value -Raw:$Raw - } - else { - $vals[$Key] = $entry.Value - } - } - } - - # Remove duplicates - if (($_ | Get-Member -Name:'PerfHints' -MemberType:NoteProperty).Count -eq 1) { - $hints = [ordered]@{} - foreach ($hint in $_.PerfHints) { - $hints[$hint] = $true - } - - $vals["PerfHints"] = @($hints.Keys) - } - - $result = New-Object PSCustomObject -Property:$vals - $result -} - -filter ConvertTo-DefenderScanStats -{ - param( - [bool]$Raw = $false - ) - - $result = [PSCustomObject]@{ - Count = $_.Count - TotalDuration = New-FriendlyTimeSpan -Ticks:$_.TotalDuration -Raw:$Raw - MinDuration = New-FriendlyTimeSpan -Ticks:$_.MinDuration -Raw:$Raw - AverageDuration = New-FriendlyTimeSpan -Ticks:$_.AverageDuration -Raw:$Raw - MaxDuration = New-FriendlyTimeSpan -Ticks:$_.MaxDuration -Raw:$Raw - MedianDuration = New-FriendlyTimeSpan -Ticks:$_.MedianDuration -Raw:$Raw - } - - if (-not $Raw) { - $result.PSTypeNames.Insert(0, 'MpPerformanceReport.ScanStats') - } - - $result -} - -[scriptblock]$FriendlyScannedFilePathStatsToString = { - [PSCustomObject]@{ - Count = $this.Count - TotalDuration = $this.TotalDuration - MinDuration = $this.MinDuration - AverageDuration = $this.AverageDuration - MaxDuration = $this.MaxDuration - MedianDuration = $this.MedianDuration - Path = $this.Path - } -} - -filter ConvertTo-DefenderScannedFilePathStats -{ - param( - [bool]$Raw = $false - ) - - $result = $_ | ConvertTo-DefenderScanStats -Raw:$Raw - - if (-not $Raw) { - $result.PSTypeNames.Insert(0, 'MpPerformanceReport.ScannedFilePathStats') - } - - $result | Add-Member -NotePropertyName:'Path' -NotePropertyValue:($_.Path) - $result | Add-Member -Force -MemberType:ScriptMethod -Name:'ToString' -Value:$FriendlyScannedFilePathStatsToString - - if ($null -ne $_.Scans) - { - $result | Add-Member -NotePropertyName:'Scans' -NotePropertyValue:@( - $_.Scans | ConvertTo-DefenderScanInfo -Raw:$Raw - ) - - if (-not $Raw) { - Add-DefenderCollectionType -CollectionRef:([ref]$result.Scans) - } - } - - if ($null -ne $_.Processes) - { - $result | Add-Member -NotePropertyName:'Processes' -NotePropertyValue:@( - $_.Processes | ConvertTo-DefenderScannedProcessStats -Raw:$Raw - ) - - if (-not $Raw) { - Add-DefenderCollectionType -CollectionRef:([ref]$result.Processes) - } - } - - $result -} - -[scriptblock]$FriendlyScannedPathsStatsToString = { - [PSCustomObject]@{ - Count = $this.Count - TotalDuration = $this.TotalDuration - MinDuration = $this.MinDuration - AverageDuration = $this.AverageDuration - MaxDuration = $this.MaxDuration - MedianDuration = $this.MedianDuration - Path = $this.Path - Folder = $this.Folder - } -} - -filter ConvertTo-DefenderScannedPathsStats -{ - param( - [bool]$Raw = $false - ) - - $result = $_ | ConvertTo-DefenderScanStats -Raw:$Raw - - if (-not $Raw) { - $result.PSTypeNames.Insert(0, 'MpPerformanceReport.ScannedPathStats') - } - - $result | Add-Member -NotePropertyName:'Path' -NotePropertyValue:($_.Path) - - if ($null -ne $_.Folder) - { - $result | Add-Member -NotePropertyName:'Folder' -NotePropertyValue:@( - $_.Folder | ConvertTo-DefenderScannedPathsStats -Raw:$Raw - ) - $result | Add-Member -Force -MemberType:ScriptMethod -Name:'ToString' -Value:$FriendlyScannedPathsStatsToString - - if (-not $Raw) { - Add-DefenderCollectionType -CollectionRef:([ref]$result.Folder) - } - } - - if ($null -ne $_.Files) - { - $result | Add-Member -NotePropertyName:'Files' -NotePropertyValue:@( - $_.Files | ConvertTo-DefenderScannedFilePathStats -Raw:$Raw - ) - - if (-not $Raw) { - Add-DefenderCollectionType -CollectionRef:([ref]$result.Files) - } - } - - if ($null -ne $_.Scans) - { - $result | Add-Member -NotePropertyName:'Scans' -NotePropertyValue:@( - $_.Scans | ConvertTo-DefenderScanInfo -Raw:$Raw - ) - - if (-not $Raw) { - Add-DefenderCollectionType -CollectionRef:([ref]$result.Scans) - } - } - - if ($null -ne $_.Processes) - { - $result | Add-Member -NotePropertyName:'Processes' -NotePropertyValue:@( - $_.Processes | ConvertTo-DefenderScannedProcessStats -Raw:$Raw - ) - - if (-not $Raw) { - Add-DefenderCollectionType -CollectionRef:([ref]$result.Processes) - } - } - - $result -} - -[scriptblock]$FriendlyScannedFileExtensionStatsToString = { - [PSCustomObject]@{ - Count = $this.Count - TotalDuration = $this.TotalDuration - MinDuration = $this.MinDuration - AverageDuration = $this.AverageDuration - MaxDuration = $this.MaxDuration - MedianDuration = $this.MedianDuration - Extension = $this.Extension - } -} - -filter ConvertTo-DefenderScannedFileExtensionStats -{ - param( - [bool]$Raw = $false - ) - - $result = $_ | ConvertTo-DefenderScanStats -Raw:$Raw - - if (-not $Raw) { - $result.PSTypeNames.Insert(0, 'MpPerformanceReport.ScannedFileExtensionStats') - } - - $result | Add-Member -NotePropertyName:'Extension' -NotePropertyValue:($_.Extension) - $result | Add-Member -Force -MemberType:ScriptMethod -Name:'ToString' -Value:$FriendlyScannedFileExtensionStatsToString - - if ($null -ne $_.Scans) - { - $result | Add-Member -NotePropertyName:'Scans' -NotePropertyValue:@( - $_.Scans | ConvertTo-DefenderScanInfo -Raw:$Raw - ) - - if (-not $Raw) { - Add-DefenderCollectionType -CollectionRef:([ref]$result.Scans) - } - } - - if ($null -ne $_.Files) - { - $result | Add-Member -NotePropertyName:'Files' -NotePropertyValue:@( - $_.Files | ConvertTo-DefenderScannedFilePathStats -Raw:$Raw - ) - - if (-not $Raw) { - Add-DefenderCollectionType -CollectionRef:([ref]$result.Files) - } - } - - if ($null -ne $_.Processes) - { - $result | Add-Member -NotePropertyName:'Processes' -NotePropertyValue:@( - $_.Processes | ConvertTo-DefenderScannedProcessStats -Raw:$Raw - ) - - if (-not $Raw) { - Add-DefenderCollectionType -CollectionRef:([ref]$result.Processes) - } - } - - - if ($null -ne $_.Folder) - { - $result | Add-Member -NotePropertyName:'Folder' -NotePropertyValue:@( - $_.Folder | ConvertTo-DefenderScannedPathsStats -Raw:$Raw - ) - - if (-not $Raw) { - Add-DefenderCollectionType -CollectionRef:([ref]$result.Folder) - } - } - - $result -} - -[scriptblock]$FriendlyScannedProcessStatsToString = { - [PSCustomObject]@{ - Count = $this.Count - TotalDuration = $this.TotalDuration - MinDuration = $this.MinDuration - AverageDuration = $this.AverageDuration - MaxDuration = $this.MaxDuration - MedianDuration = $this.MedianDuration - ProcessPath = $this.ProcessPath - } -} - -filter ConvertTo-DefenderScannedProcessStats -{ - param( - [bool]$Raw - ) - - $result = $_ | ConvertTo-DefenderScanStats -Raw:$Raw - - if (-not $Raw) { - $result.PSTypeNames.Insert(0, 'MpPerformanceReport.ScannedProcessStats') - } - - $result | Add-Member -NotePropertyName:'ProcessPath' -NotePropertyValue:($_.Process) - $result | Add-Member -Force -MemberType:ScriptMethod -Name:'ToString' -Value:$FriendlyScannedProcessStatsToString - - if ($null -ne $_.Scans) - { - $result | Add-Member -NotePropertyName:'Scans' -NotePropertyValue:@( - $_.Scans | ConvertTo-DefenderScanInfo -Raw:$Raw - ) - - if (-not $Raw) { - Add-DefenderCollectionType -CollectionRef:([ref]$result.Scans) - } - } - - if ($null -ne $_.Files) - { - $result | Add-Member -NotePropertyName:'Files' -NotePropertyValue:@( - $_.Files | ConvertTo-DefenderScannedFilePathStats -Raw:$Raw - ) - - if (-not $Raw) { - Add-DefenderCollectionType -CollectionRef:([ref]$result.Files) - } - } - - if ($null -ne $_.Extensions) - { - $result | Add-Member -NotePropertyName:'Extensions' -NotePropertyValue:@( - $_.Extensions | ConvertTo-DefenderScannedFileExtensionStats -Raw:$Raw - ) - - if (-not $Raw) { - Add-DefenderCollectionType -CollectionRef:([ref]$result.Extensions) - } - } - - if ($null -ne $_.Folder) - { - $result | Add-Member -NotePropertyName:'Folder' -NotePropertyValue:@( - $_.Folder | ConvertTo-DefenderScannedPathsStats -Raw:$Raw - ) - - if (-not $Raw) { - Add-DefenderCollectionType -CollectionRef:([ref]$result.Folder) - } - } - - $result -} - -<# -.SYNOPSIS -This cmdlet reports the file paths, file extensions, and processes that cause -the highest impact to Microsoft Defender Antivirus scans. - -.DESCRIPTION -This cmdlet analyzes a previously collected Microsoft Defender Antivirus -performance recording and reports the file paths, file extensions and processes -that cause the highest impact to Microsoft Defender Antivirus scans. - -The performance analyzer provides insight into problematic files that could -cause performance degradation of Microsoft Defender Antivirus. This tool is -provided "AS IS", and is not intended to provide suggestions on exclusions. -Exclusions can reduce the level of protection on your endpoints. Exclusions, -if any, should be defined with caution. - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopFiles:10 -TopExtensions:10 -TopProcesses:10 -TopScans:10 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopFiles:10 -TopExtensions:10 -TopProcesses:10 -TopScans:10 -Raw | ConvertTo-Json - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopFiles:10 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopFiles:10 -TopScansPerFile:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopFiles:10 -TopProcessesPerFile:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopFiles:10 -TopProcessesPerFile:3 -TopScansPerProcessPerFile:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopPathsDepth:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopPathsDepth:3 -TopScansPerPath:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopScansPerPath:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopPathsDepth:3 -TopFilesPerPath:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopFilesPerPath:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopPathsDepth:3 -TopFilesPerPath:3 -TopScansPerFilePerPath:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopFilesPerPath:3 -TopScansPerFilePerPath:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopPathsDepth:3 -TopExtensionsPerPath:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopExtensionsPerPath:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopPathsDepth:3 -TopExtensionsPerPath:3 -TopScansPerExtensionPerPath:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopExtensionsPerPath:3 -TopScansPerExtensionPerPath:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopPathsDepth:3 -TopProcessesPerPath:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopProcessesPerPath:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopPathsDepth:3 -TopProcessesPerPath:3 -TopScansPerProcessPerPath:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopProcessesPerPath:3 -TopScansPerProcessPerPath:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 -TopScansPerExtension:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 -TopPathsPerExtension:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 -TopPathsPerExtension:3 -TopPathsDepth:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 -TopPathsPerExtension:3 -TopPathsDepth:3 -TopScansPerPathPerExtension:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 -TopPathsPerExtension:3 -TopScansPerPathPerExtension:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 -TopFilesPerExtension:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 -TopFilesPerExtension:3 -TopScansPerFilePerExtension:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 -TopProcessesPerExtension:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 -TopProcessesPerExtension:3 -TopScansPerProcessPerExtension:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 -TopScansPerProcess:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 -TopExtensionsPerProcess:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 -TopExtensionsPerProcess:3 -TopScansPerExtensionPerProcess:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 -TopFilesPerProcess:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 -TopFilesPerProcess:3 -TopScansPerFilePerProcess:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 -TopPathsPerProcess:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 -TopPathsPerProcess:3 -TopPathsDepth:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 -TopPathsPerProcess:3 -TopPathsDepth:3 -TopScansPerPathPerProcess:3 - -.EXAMPLE -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 -TopPathsPerProcess:3 -TopScansPerPathPerProcess:3 - -.EXAMPLE -# Find top 10 scans with longest durations that both start and end between MinStartTime and MaxEndTime: -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MinStartTime:"5/14/2022 7:01:11 AM" -MaxEndTime:"5/14/2022 7:01:41 AM" - -.EXAMPLE -# Find top 10 scans with longest durations between MinEndTime and MaxStartTime, possibly partially overlapping this period -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MinEndTime:"5/14/2022 7:01:11 AM" -MaxStartTime:"5/14/2022 7:01:41 AM" - -.EXAMPLE -# Find top 10 scans with longest durations between MinStartTime and MaxStartTime, possibly partially overlapping this period -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MinStartTime:"5/14/2022 7:01:11 AM" -MaxStartTime:"5/14/2022 7:01:41 AM" - -.EXAMPLE -# Find top 10 scans with longest durations that start at MinStartTime or later: -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MinStartTime:"5/14/2022 7:01:11 AM" - -.EXAMPLE -# Find top 10 scans with longest durations that start before or at MaxStartTime: -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MaxStartTime:"5/14/2022 7:01:11 AM" - -.EXAMPLE -# Find top 10 scans with longest durations that end at MinEndTime or later: -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MinEndTime:"5/14/2022 7:01:11 AM" - -.EXAMPLE -# Find top 10 scans with longest durations that end before or at MaxEndTime: -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MaxEndTime:"5/14/2022 7:01:11 AM" - -.EXAMPLE -# Find top 10 scans with longest durations, impacting the current interval, that did not start or end between MaxStartTime and MinEndTime. -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MaxStartTime:"5/14/2022 7:01:11 AM" -MinEndTime:"5/14/2022 7:01:41 AM" - -.EXAMPLE -# Find top 10 scans with longest durations, impacting the current interval, that started between MinStartTime and MaxStartTime, and ended later than MinEndTime. -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MinStartTime:"5/14/2022 7:00:00 AM" -MaxStartTime:"5/14/2022 7:01:11 AM" -MinEndTime:"5/14/2022 7:01:41 AM" - -.EXAMPLE -# Find top 10 scans with longest durations, impacting the current interval, that started before MaxStartTime, and ended between MinEndTime and MaxEndTime. -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MaxStartTime:"5/14/2022 7:01:11 AM" -MinEndTime:"5/14/2022 7:01:41 AM" -MaxEndTime:"5/14/2022 7:02:00 AM" - -.EXAMPLE -# Find top 10 scans with longest durations, impacting the current interval, that started between MinStartTime and MaxStartTime, and ended between MinEndTime and MaxEndTime. -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MinStartTime:"5/14/2022 7:00:00 AM" -MaxStartTime:"5/14/2022 7:01:11 AM" -MinEndTime:"5/14/2022 7:01:41 AM" -MaxEndTime:"5/14/2022 7:02:00 AM" - -.EXAMPLE -# Find top 10 scans with longest durations that both start and end between MinStartTime and MaxEndTime, using DateTime as raw numbers in FILETIME format, e.g. from -Raw report format: -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MinStartTime:([DateTime]::FromFileTime(132969744714304340)) -MaxEndTime:([DateTime]::FromFileTime(132969745000971033)) - -.EXAMPLE -# Find top 10 scans with longest durations between MinEndTime and MaxStartTime, possibly partially overlapping this period, using DateTime as raw numbers in FILETIME format, e.g. from -Raw report format: -Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MinEndTime:([DateTime]::FromFileTime(132969744714304340)) -MaxStartTime:([DateTime]::FromFileTime(132969745000971033)) - -.EXAMPLE -# Display a summary or overview of the scans captured in the trace, in addition to the information displayed regularly through other arguments. Output is influenced by time interval arguments MinStartTime and MaxEndTime. -Get-MpPerformanceReport -Path:.\Defender-scans.etl [other arguments] -Overview - -#> - -function Get-MpPerformanceReport { - [CmdletBinding()] - param( - # Specifies the location of Microsoft Defender Antivirus performance recording to analyze. - [Parameter(Mandatory=$true, - Position=0, - ValueFromPipeline=$true, - ValueFromPipelineByPropertyName=$true, - HelpMessage="Location of Microsoft Defender Antivirus performance recording.")] - [ValidateNotNullOrEmpty()] - [string]$Path, - - # Requests a top files report and specifies how many top files to output, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopFiles = 0, - - # Specifies how many top scans to output for each top file, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopScansPerFile = 0, - - # Specifies how many top processes to output for each top file, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopProcessesPerFile = 0, - - # Specifies how many top scans to output for each top process for each top file, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopScansPerProcessPerFile = 0, - - # Requests a top paths report and specifies how many top entries to output, sorted by "Duration". This is called recursively for each directory entry. Scans are grouped hierarchically per folder and sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopPaths = 0, - - # Specifies the maxmimum depth (path-wise) that will be used to grop scans when $TopPaths is used. - [ValidateRange(1,1024)] - [int]$TopPathsDepth = 0, - - # Specifies how many top scans to output for each top path, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopScansPerPath = 0, - - # Specifies how many top files to output for each top path, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopFilesPerPath = 0, - - # Specifies how many top scans to output for each top file for each top path, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopScansPerFilePerPath = 0, - - # Specifies how many top extensions to output for each top path, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopExtensionsPerPath = 0, - - # Specifies how many top scans to output for each top extension for each top path, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopScansPerExtensionPerPath = 0, - - # Specifies how many top processes to output for each top path, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopProcessesPerPath = 0, - - # Specifies how many top scans to output for each top process for each top path, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopScansPerProcessPerPath = 0, - - # Requests a top extensions report and specifies how many top extensions to output, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopExtensions = 0, - - # Specifies how many top scans to output for each top extension, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopScansPerExtension = 0, - - # Specifies how many top paths to output for each top extension, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopPathsPerExtension = 0, - - # Specifies how many top scans to output for each top path for each top extension, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopScansPerPathPerExtension = 0, - - # Specifies how many top files to output for each top extension, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopFilesPerExtension = 0, - - # Specifies how many top scans to output for each top file for each top extension, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopScansPerFilePerExtension = 0, - - # Specifies how many top processes to output for each top extension, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopProcessesPerExtension = 0, - - # Specifies how many top scans to output for each top process for each top extension, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopScansPerProcessPerExtension = 0, - - # Requests a top processes report and specifies how many top processes to output, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopProcesses = 0, - - # Specifies how many top scans to output for each top process in the Top Processes report, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopScansPerProcess = 0, - - # Specifies how many top files to output for each top process, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopFilesPerProcess = 0, - - # Specifies how many top scans to output for each top file for each top process, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopScansPerFilePerProcess = 0, - - # Specifies how many top extensions to output for each top process, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopExtensionsPerProcess = 0, - - # Specifies how many top scans to output for each top extension for each top process, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopScansPerExtensionPerProcess = 0, - - # Specifies how many top paths to output for each top process, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopPathsPerProcess = 0, - - # Specifies how many top scans to output for each top path for each top process, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopScansPerPathPerProcess = 0, - - # Requests a top scans report and specifies how many top scans to output, sorted by "Duration". - [ValidateRange(0,([int]::MaxValue))] - [int]$TopScans = 0, - - ## TimeSpan format: d | h:m | h:m:s | d.h:m | h:m:.f | h:m:s.f | d.h:m:s | d.h:m:.f | d.h:m:s.f => d | (d.)?h:m(:s(.f)?)? | ((d.)?h:m:.f) - - # Specifies the minimum duration of any scans or total scan durations of files, extensions and processes included in the report. - # Accepts values like '0.1234567sec' or '0.1234ms' or '0.1us' or a valid TimeSpan. - [ValidatePattern('^(?:(?:(\d+)(?:\.(\d+))?(sec|ms|us))|(?:\d+)|(?:(\d+\.)?\d+:\d+(?::\d+(?:\.\d+)?)?)|(?:(\d+\.)?\d+:\d+:\.\d+))$')] - [string]$MinDuration = '0us', - - # Specifies the minimum start time of scans included in the report. Accepts a valid DateTime. - [DateTime]$MinStartTime = [DateTime]::MinValue, - - # Specifies the minimum end time of scans included in the report. Accepts a valid DateTime. - [DateTime]$MinEndTime = [DateTime]::MinValue, - - # Specifies the maximum start time of scans included in the report. Accepts a valid DateTime. - [DateTime]$MaxStartTime = [DateTime]::MaxValue, - - # Specifies the maximum end time of scans included in the report. Accepts a valid DateTime. - [DateTime]$MaxEndTime = [DateTime]::MaxValue, - - # Adds an overview or summary of the scans captured in the trace to the regular output. - [switch]$Overview, - - # Specifies that the output should be machine readable and readily convertible to serialization formats like JSON. - # - Collections and elements are not be formatted. - # - TimeSpan values are represented as number of 100-nanosecond intervals. - # - DateTime values are represented as number of 100-nanosecond intervals since January 1, 1601 (UTC). - [switch]$Raw - ) - - # - # Validate performance recording presence - # - - if (-not (Test-Path -Path:$Path -PathType:Leaf)) { - $ex = New-Object System.Management.Automation.ItemNotFoundException "Cannot find path '$Path'." - $category = [System.Management.Automation.ErrorCategory]::ObjectNotFound - $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'PathNotFound',$category,$Path - $psCmdlet.WriteError($errRecord) - return - } - - function ParameterValidationError { - [CmdletBinding()] - param ( - [Parameter(Mandatory)] - [string] - $ParameterName, - - [Parameter(Mandatory)] - [string] - $ParentParameterName - ) - - $ex = New-Object System.Management.Automation.ValidationMetadataException "Parameter '$ParameterName' requires parameter '$ParentParameterName'." - $category = [System.Management.Automation.ErrorCategory]::MetadataError - $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'InvalidParameter',$category,$ParameterName - $psCmdlet.WriteError($errRecord) - } - - # - # Additional parameter validation - # - - if ($TopFiles -eq 0) - { - if ($TopScansPerFile -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerFile' -ParentParameterName:'TopFiles' - } - - if ($TopProcessesPerFile -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopProcessesPerFile' -ParentParameterName:'TopFiles' - } - } - - if ($TopProcessesPerFile -eq 0) - { - if ($TopScansPerProcessPerFile -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerProcessPerFile' -ParentParameterName:'TopProcessesPerFile' - } - } - - if ($TopPathsDepth -gt 0) - { - if (($TopPaths -eq 0) -and ($TopPathsPerProcess -eq 0) -and ($TopPathsPerExtension -eq 0)) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopPathsDepth' -ParentParameterName:'TopPaths or TopPathsPerProcess or TopPathsPerExtension' - } - } - - if ($TopPaths -eq 0) - { - if ($TopScansPerPath -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerPath' -ParentParameterName:'TopPaths' - } - - if ($TopFilesPerPath -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopFilesPerPath' -ParentParameterName:'TopPaths' - } - - if ($TopExtensionsPerPath -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopExtensionsPerPath' -ParentParameterName:'TopPaths' - } - - if ($TopProcessesPerPath -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopProcessesPerPath' -ParentParameterName:'TopPaths' - } - } - - if ($TopFilesPerPath -eq 0) - { - if ($TopScansPerFilePerPath -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerFilePerPath' -ParentParameterName:'TopFilesPerPath' - } - } - - if ($TopExtensionsPerPath -eq 0) - { - if ($TopScansPerExtensionPerPath -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerExtensionPerPath' -ParentParameterName:'TopExtensionsPerPath' - } - } - - if ($TopProcessesPerPath -eq 0) - { - if ($TopScansPerProcessPerPath -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerProcessPerPath' -ParentParameterName:'TopProcessesPerPath' - } - } - - if ($TopExtensions -eq 0) - { - if ($TopScansPerExtension -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerExtension' -ParentParameterName:'TopExtensions' - } - - if ($TopFilesPerExtension -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopFilesPerExtension' -ParentParameterName:'TopExtensions' - } - - if ($TopProcessesPerExtension -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopProcessesPerExtension' -ParentParameterName:'TopExtensions' - } - - if ($TopPathsPerExtension -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopPathsPerExtension' -ParentParameterName:'TopExtensions' - } - } - - if ($TopFilesPerExtension -eq 0) - { - if ($TopScansPerFilePerExtension -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerFilePerExtension' -ParentParameterName:'TopFilesPerExtension' - } - } - - if ($TopProcessesPerExtension -eq 0) - { - if ($TopScansPerProcessPerExtension -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerProcessPerExtension' -ParentParameterName:'TopProcessesPerExtension' - } - } - - if ($TopPathsPerExtension -eq 0) - { - if ($TopScansPerPathPerExtension -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerPathPerExtension' -ParentParameterName:'TopPathsPerExtension' - } - } - - if ($TopProcesses -eq 0) - { - if ($TopScansPerProcess -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerProcess' -ParentParameterName:'TopProcesses' - } - - if ($TopFilesPerProcess -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopFilesPerProcess' -ParentParameterName:'TopProcesses' - } - - if ($TopExtensionsPerProcess -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopExtensionsPerProcess' -ParentParameterName:'TopProcesses' - } - - if ($TopPathsPerProcess -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopPathsPerProcess' -ParentParameterName:'TopProcesses' - } - } - - if ($TopFilesPerProcess -eq 0) - { - if ($TopScansPerFilePerProcess -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerFilePerProcess' -ParentParameterName:'TopFilesPerProcess' - } - } - - if ($TopExtensionsPerProcess -eq 0) - { - if ($TopScansPerExtensionPerProcess -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerExtensionPerProcess' -ParentParameterName:'TopExtensionsPerProcess' - } - } - - if ($TopPathsPerProcess -eq 0) - { - if ($TopScansPerPathPerProcess -gt 0) - { - ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerPathPerProcess' -ParentParameterName:'TopPathsPerProcess' - } - } - - if (($TopFiles -eq 0) -and ($TopExtensions -eq 0) -and ($TopProcesses -eq 0) -and ($TopScans -eq 0) -and ($TopPaths -eq 0) -and (-not $Overview)) { - $ex = New-Object System.Management.Automation.ItemNotFoundException "At least one of the parameters 'TopFiles', 'TopPaths', 'TopExtensions', 'TopProcesses', 'TopScans' or 'Overview' must be present." - $category = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'InvalidArgument',$category,$wprProfile - $psCmdlet.WriteError($errRecord) - return - } - - # Dependencies - [string]$PlatformPath = (Get-ItemProperty -Path:'HKLM:\Software\Microsoft\Windows Defender' -Name:'InstallLocation' -ErrorAction:Stop).InstallLocation - - # - # Test dependency presence - # - [string]$mpCmdRunCommand = "${PlatformPath}MpCmdRun.exe" - - if (-not (Get-Command $mpCmdRunCommand -ErrorAction:SilentlyContinue)) { - $ex = New-Object System.Management.Automation.ItemNotFoundException "Cannot find '$mpCmdRunCommand'." - $category = [System.Management.Automation.ErrorCategory]::ObjectNotFound - $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'PathNotFound',$category,$mpCmdRunCommand - $psCmdlet.WriteError($errRecord) - return - } - - # assemble report arguments - - [string[]]$reportArguments = @( - $PSBoundParameters.GetEnumerator() | - Where-Object { $_.Key.ToString().StartsWith("Top") -and ($_.Value -gt 0) } | - ForEach-Object { "-$($_.Key)"; "$($_.Value)"; } - ) - - [timespan]$MinDurationTimeSpan = ParseFriendlyDuration -FriendlyDuration:$MinDuration - - if ($MinDurationTimeSpan -gt [TimeSpan]::FromTicks(0)) - { - $reportArguments += @('-MinDuration', ($MinDurationTimeSpan.Ticks)) - } - - $MaxEndTime = PadUserDateTime -UserDateTime:$MaxEndTime - $MaxStartTime = PadUserDateTime -UserDateTime:$MaxStartTime - - $ret = ValidateTimeInterval -MinStartTime:$MinStartTime -MaxEndTime:$MaxEndTime -MaxStartTime:$MaxStartTime -MinEndTime:$MinEndTime - if ($false -eq $ret.status) - { - return - } - - [string[]]$intervalArguments = $ret.arguments - if (($null -ne $intervalArguments) -and ($intervalArguments.Length -gt 0)) - { - $reportArguments += $intervalArguments - } - - if ($Overview) - { - $reportArguments += "-Overview" - } - - $report = (& $mpCmdRunCommand -PerformanceReport -RecordingPath $Path @reportArguments) | Where-Object { -not [string]::IsNullOrEmpty($_) } | ConvertFrom-Json - - $result = [PSCustomObject]@{} - - if (-not $Raw) { - $result.PSTypeNames.Insert(0, 'MpPerformanceReport.Result') - } - - if ($TopFiles -gt 0) - { - $reportTopFiles = @(if ($null -ne $report.TopFiles) { @($report.TopFiles | ConvertTo-DefenderScannedFilePathStats -Raw:$Raw) } else { @() }) - $result | Add-Member -NotePropertyName:'TopFiles' -NotePropertyValue:$reportTopFiles - - if (-not $Raw) { - Add-DefenderCollectionType -CollectionRef:([ref]$result.TopFiles) - } - } - - if ($TopPaths -gt 0) - { - $reportTopPaths = @(if ($null -ne $report.TopPaths) { @($report.TopPaths | ConvertTo-DefenderScannedPathsStats -Raw:$Raw) } else { @() }) - $result | Add-Member -NotePropertyName:'TopPaths' -NotePropertyValue:$reportTopPaths - - if (-not $Raw) { - Add-DefenderCollectionType -CollectionRef:([ref]$result.TopPaths) - } - } - - if ($TopExtensions -gt 0) - { - $reportTopExtensions = @(if ($null -ne $report.TopExtensions) { @($report.TopExtensions | ConvertTo-DefenderScannedFileExtensionStats -Raw:$Raw) } else { @() }) - $result | Add-Member -NotePropertyName:'TopExtensions' -NotePropertyValue:$reportTopExtensions - - if (-not $Raw) { - Add-DefenderCollectionType -CollectionRef:([ref]$result.TopExtensions) - } - } - - if ($TopProcesses -gt 0) - { - $reportTopProcesses = @(if ($null -ne $report.TopProcesses) { @($report.TopProcesses | ConvertTo-DefenderScannedProcessStats -Raw:$Raw) } else { @() }) - $result | Add-Member -NotePropertyName:'TopProcesses' -NotePropertyValue:$reportTopProcesses - - if (-not $Raw) { - Add-DefenderCollectionType -CollectionRef:([ref]$result.TopProcesses) - } - } - - if ($TopScans -gt 0) - { - $reportTopScans = @(if ($null -ne $report.TopScans) { @($report.TopScans | ConvertTo-DefenderScanInfo -Raw:$Raw) } else { @() }) - $result | Add-Member -NotePropertyName:'TopScans' -NotePropertyValue:$reportTopScans - - if (-not $Raw) { - Add-DefenderCollectionType -CollectionRef:([ref]$result.TopScans) - } - } - - if ($Overview) - { - if ($null -ne $report.Overview) { - $reportOverview = $report.Overview | ConvertTo-DefenderScanOverview -Raw:$Raw - $result | Add-Member -NotePropertyName:'Overview' -NotePropertyValue:$reportOverview - - if (-not $Raw) { - $result.Overview.PSTypeNames.Insert(0, 'MpPerformanceReport.Overview') - } - } - } - - $result -} - -$exportModuleMemberParam = @{ - Function = @( - 'New-MpPerformanceRecording' - 'Get-MpPerformanceReport' - ) -} - -Export-ModuleMember @exportModuleMemberParam - -# SIG # Begin signature block -# MIImGwYJKoZIhvcNAQcCoIImDDCCJggCAQExDzANBglghkgBZQMEAgEFADB5Bgor -# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG -# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCABOtUhuRLDSJsH -# 5LjfiBWymKYbjYNumRKF78V/LI3Gd6CCC1MwggTgMIIDyKADAgECAhMzAAALjqZI -# W414yEj+AAAAAAuOMA0GCSqGSIb3DQEBCwUAMHkxCzAJBgNVBAYTAlVTMRMwEQYD -# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy -# b3NvZnQgQ29ycG9yYXRpb24xIzAhBgNVBAMTGk1pY3Jvc29mdCBXaW5kb3dzIFBD -# QSAyMDEwMB4XDTI0MDgyMjIxMzIwNVoXDTI1MDcwNDIxMzIwNVowcDELMAkGA1UE -# BhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAc -# BgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEaMBgGA1UEAxMRTWljcm9zb2Z0 -# IFdpbmRvd3MwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrxl8EJfzA -# QclDL4nqroqJh8zn/bvwptnZ6a99GFLJ5GuBZxQloIPF+ZM+9D1QnH/xeQsnuh4e -# CtIztigcnWawfvQAgpsgS47ROqxM5IsMhoGdbmahsAO9ld46iG/7RsKvfDvFCyip -# SnaKR/Lz4YJl4diHhpSIAviRMkWBPoAXDZlcwIuGk0AeAuL8mxVYgBPuWUsq+MH5 -# HL6ut/M+uzFpfv3atwbdECzGoXERLeHzqtOnpKLkqq+43TJLLWFnz5arpMs0MbjJ -# o+40U3iarvp3hMIiM5O06++zz+PMoBO67yKqu9AcdQwJZ+jZ640qkYGDZeVJHNC4 -# 55PXywdmGqOtAgMBAAGjggFoMIIBZDAfBgNVHSUEGDAWBgorBgEEAYI3CgMGBggr -# BgEFBQcDAzAdBgNVHQ4EFgQU+rpJaEO0Uj4j7pcTCs301fdFu/gwRQYDVR0RBD4w -# PKQ6MDgxHjAcBgNVBAsTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEWMBQGA1UEBRMN -# MjMwMDI4KzUwMjc5NzAfBgNVHSMEGDAWgBTRT6mKBwjO9CQYmOUA//PWeR03vDBT -# BgNVHR8ETDBKMEigRqBEhkJodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpL2Ny -# bC9wcm9kdWN0cy9NaWNXaW5QQ0FfMjAxMC0wNy0wNi5jcmwwVwYIKwYBBQUHAQEE -# SzBJMEcGCCsGAQUFBzAChjtodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpL2Nl -# cnRzL01pY1dpblBDQV8yMDEwLTA3LTA2LmNydDAMBgNVHRMBAf8EAjAAMA0GCSqG -# SIb3DQEBCwUAA4IBAQBsZbDNo5NyFwckNKY3ZusiPl4vHyU0CzJKbaV1lLdwxU// -# ePCQRH0efL+g1HMnT0+3tYo3S+jcYYjbtVPhLT0V1jSIeYK5Raxwqm1Csb7B+zta -# Qt933J/50c+3IiSeWXrNhi4r9Q7/h6f8Fu+TpG0pG9XGF5LmMSQKL16GZTbdOT5R -# mqK5J/GW9+S20QDo5cMULRzoWvxRgYKbXIyQWQeUjIpXG4FdzLpPepPiybYpLztT -# X8Vpcu62J9k2nG6nth0ExLrX3YdfRIpaP+ALXD7qa7fEAuy8hV1mX5eYVJAVmvTu -# yyK779mXw0pqlIbCjbgRd7e0ohoIVzbEap3THr1RMIIGazCCBFOgAwIBAgIKYQxq -# GQAAAAAABDANBgkqhkiG9w0BAQsFADCBiDELMAkGA1UEBhMCVVMxEzARBgNVBAgT -# Cldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29m -# dCBDb3Jwb3JhdGlvbjEyMDAGA1UEAxMpTWljcm9zb2Z0IFJvb3QgQ2VydGlmaWNh -# dGUgQXV0aG9yaXR5IDIwMTAwHhcNMTAwNzA2MjA0MDIzWhcNMjUwNzA2MjA1MDIz -# WjB5MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMH -# UmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSMwIQYDVQQD -# ExpNaWNyb3NvZnQgV2luZG93cyBQQ0EgMjAxMDCCASIwDQYJKoZIhvcNAQEBBQAD -# ggEPADCCAQoCggEBAMB5uzqx8A+EuK1kKnUWc9C7B/Y+DZ0U5LGfwciUsDh8H9Az -# VfW6I2b1LihIU8cWg7r1Uax+rOAmfw90/FmV3MnGovdScFosHZSrGb+vlX2vZqFv -# m2JubUu8LzVs3qRqY1pf+/MNTWHMCn4x62wK0E2XD/1/OEbmisdzaXZVaZZM5Njw -# NOu6sR/OKX7ET50TFasTG3JYYlZsioGjZHeYRmUpnYMUpUwIoIPXIx/zX99vLM/a -# FtgOcgQo2Gs++BOxfKIXeU9+3DrknXAna7/b/B7HB9jAvguTHijgc23SVOkoTL9r -# XZ//XTMSN5UlYTRqQst8nTq7iFnho0JtOlBbSNECAwEAAaOCAeMwggHfMBAGCSsG -# AQQBgjcVAQQDAgEAMB0GA1UdDgQWBBTRT6mKBwjO9CQYmOUA//PWeR03vDAZBgkr -# BgEEAYI3FAIEDB4KAFMAdQBiAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw -# AwEB/zAfBgNVHSMEGDAWgBTV9lbLj+iiXGJo0T2UkFvXzpoYxDBWBgNVHR8ETzBN -# MEugSaBHhkVodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpL2NybC9wcm9kdWN0 -# cy9NaWNSb29DZXJBdXRfMjAxMC0wNi0yMy5jcmwwWgYIKwYBBQUHAQEETjBMMEoG -# CCsGAQUFBzAChj5odHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpL2NlcnRzL01p -# Y1Jvb0NlckF1dF8yMDEwLTA2LTIzLmNydDCBnQYDVR0gBIGVMIGSMIGPBgkrBgEE -# AYI3LgMwgYEwPQYIKwYBBQUHAgEWMWh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9Q -# S0kvZG9jcy9DUFMvZGVmYXVsdC5odG0wQAYIKwYBBQUHAgIwNB4yIB0ATABlAGcA -# YQBsAF8AUABvAGwAaQBjAHkAXwBTAHQAYQB0AGUAbQBlAG4AdAAuIB0wDQYJKoZI -# hvcNAQELBQADggIBAC5Bpoa1Bm/wgIX6O8oX6cn65DnClHDDZJTD2FamkI7+5Jr0 -# bfVvjlONWqjzrttGbL5/HVRWGzwdccRRFVR+v+6llUIz/Q2QJCTj+dyWyvy4rL/0 -# wjlWuLvtc7MX3X6GUCOLViTKu6YdmocvJ4XnobYKnA0bjPMAYkG6SHSHgv1QyfSH -# KcMDqivfGil56BIkmobt0C7TQIH1B18zBlRdQLX3sWL9TUj3bkFHUhy7G8JXOqiZ -# VpPUxt4mqGB1hrvsYqbwHQRF3z6nhNFbRCNjJTZ3b65b3CLVFCNqQX/QQqbb7yV7 -# BOPSljdiBq/4Gw+Oszmau4n1NQblpFvDjJ43X1PRozf9pE/oGw5rduS4j7DC6v11 -# 9yxBt5yj4R4F/peSy39ZA22oTo1OgBfU1XL2VuRIn6MjugagwI7RiE+TIPJwX9hr -# cqMgSfx3DF3Fx+ECDzhCEA7bAq6aNx1QgCkepKfZxpolVf1Ayq1kEOgx+RJUeRry -# DtjWqx4z/gLnJm1hSY/xJcKLdJnf+ZMakBzu3ZQzDkJQ239Q+J9iguymghZ8Zrzs -# mbDBWF2osJphFJHRmS9J5D6Bmdbm78rj/T7u7AmGAwcNGw186/RayZXPhxIKXezF -# ApLNBZlyyn3xKhAYOOQxoyi05kzFUqOcasd9wHEJBA1w3gI/h+5WoezrtUyFMYIa -# HjCCGhoCAQEwgZAweTELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24x -# EDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlv -# bjEjMCEGA1UEAxMaTWljcm9zb2Z0IFdpbmRvd3MgUENBIDIwMTACEzMAAAuOpkhb -# jXjISP4AAAAAC44wDQYJYIZIAWUDBAIBBQCgga4wGQYJKoZIhvcNAQkDMQwGCisG -# AQQBgjcCAQQwHAYKKwYBBAGCNwIBCzEOMAwGCisGAQQBgjcCARUwLwYJKoZIhvcN -# AQkEMSIEIP1nRydeaI+1iJEMHgjg/lvzEqkxTM+0Vgz1fU+wYXo6MEIGCisGAQQB -# gjcCAQwxNDAyoBSAEgBNAGkAYwByAG8AcwBvAGYAdKEagBhodHRwOi8vd3d3Lm1p -# Y3Jvc29mdC5jb20wDQYJKoZIhvcNAQEBBQAEggEAjI2LGBewNO0HMxBBEI15+iRe -# 1sx0dcBDsG00mCnkzIfWSUnKIigCoDdpTUTJBNo+lFpX/H6KXGPrJDRr+o7R67Lp -# FgtyI7SjU4vlSKNMiPkxzOXNP/6IJn2g74I6frSqmuN5cLUrp2UetAt7vop/Dqtz -# KGYDSQAU7uqXovUB0sg+55eo/vJ6UY7G18Cv5E9iGqdFifdJYE2oAJ7flEQdGvID -# 51Qezm83NfZZ+oif4xmn1LuH89vIc41zXVKnb8iG3zHYxMiq4WojI8mJOarGz3Sh -# tYRnLYa1mvm1bwuMLRscrnHvfJN81r2fTYFGoUzoGhof4tPl/cQu4kPa8hoXGqGC -# F60wghepBgorBgEEAYI3AwMBMYIXmTCCF5UGCSqGSIb3DQEHAqCCF4YwgheCAgED -# MQ8wDQYJYIZIAWUDBAIBBQAwggFaBgsqhkiG9w0BCRABBKCCAUkEggFFMIIBQQIB -# AQYKKwYBBAGEWQoDATAxMA0GCWCGSAFlAwQCAQUABCB7XA5tbZ0vYXbRJzULHHo8 -# Gt97peckynvmCFR00V8PWwIGZ7+2XoQYGBMyMDI1MDMxMjA1MDQwMS44MzNaMASA -# AgH0oIHZpIHWMIHTMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQ -# MA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9u -# MS0wKwYDVQQLEyRNaWNyb3NvZnQgSXJlbGFuZCBPcGVyYXRpb25zIExpbWl0ZWQx -# JzAlBgNVBAsTHm5TaGllbGQgVFNTIEVTTjo1NTFBLTA1RTAtRDk0NzElMCMGA1UE -# AxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZaCCEfswggcoMIIFEKADAgEC -# AhMzAAACAdFFWZgQzEJPAAEAAAIBMA0GCSqGSIb3DQEBCwUAMHwxCzAJBgNVBAYT -# AlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYD -# VQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBU -# aW1lLVN0YW1wIFBDQSAyMDEwMB4XDTI0MDcyNTE4MzEyMloXDTI1MTAyMjE4MzEy -# MlowgdMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQH -# EwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xLTArBgNV -# BAsTJE1pY3Jvc29mdCBJcmVsYW5kIE9wZXJhdGlvbnMgTGltaXRlZDEnMCUGA1UE -# CxMeblNoaWVsZCBUU1MgRVNOOjU1MUEtMDVFMC1EOTQ3MSUwIwYDVQQDExxNaWNy -# b3NvZnQgVGltZS1TdGFtcCBTZXJ2aWNlMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A -# MIICCgKCAgEAtWrf+HzDu7sk50y5YHheCIJG0uxRSFFcHNek+Td9ZmyJj20EEjaU -# 8JDJu5pWc4pPAsBI38NEAJ1b+KBnlStqU8uvXF4qnEShDdi8nPsZZQsTZDKWAgUM -# 2iZTOiWIuZcFs5ZC8/+GlrVLM5h1Y9nfMh5B4DnUQOXMremAT9MkvUhg3uaYgmqL -# lmYyODmba4lXZBu104SLAFsXOfl/TLhpToT46y7lI9sbI9uq3/Aerh3aPi2knHvE -# EazilXeooXNLCwdu+Is6o8kQLouUn3KwUQm0b7aUtsv1X/OgPmsOJi6yN3LYWyHI -# SvrNuIrJ4iYNgHdBBumQYK8LjZmQaTKFacxhmXJ0q2gzaIfxF2yIwM+V9sQqkHkg -# /Q+iSDNpMr6mr/OwknOEIjI0g6ZMOymivpChzDNoPz9hkK3gVHZKW7NV8+UBXN4G -# 0aBX69fKUbxBBLyk2cC+PhOoUjkl6UC8/c0huqj5xX8m+YVIk81e7t6I+V/E4yXR -# eeZgr0FhYqNpvTjGcaO2WrkP5XmsYS7IvMPIf4DCyIJUZaqoBMToAJJHGRe+DPqC -# Hg6bmGPm97MrOWv16/Co6S9cQDkXp9vMSSRQWXy4KtJhZfmuDz2vr1jw4NeixwuI -# DGw1mtV/TdSI+vpLJfUiLl/b9w/tJB92BALQT8e1YH8NphdOo1xCwkcCAwEAAaOC -# AUkwggFFMB0GA1UdDgQWBBSwcq9blqLoPPiVrym9mFmFWbyyUjAfBgNVHSMEGDAW -# gBSfpxVdAF5iXYP05dJlpxtTNRnpcjBfBgNVHR8EWDBWMFSgUqBQhk5odHRwOi8v -# d3d3Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2NybC9NaWNyb3NvZnQlMjBUaW1lLVN0 -# YW1wJTIwUENBJTIwMjAxMCgxKS5jcmwwbAYIKwYBBQUHAQEEYDBeMFwGCCsGAQUF -# BzAChlBodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2NlcnRzL01pY3Jv -# c29mdCUyMFRpbWUtU3RhbXAlMjBQQ0ElMjAyMDEwKDEpLmNydDAMBgNVHRMBAf8E -# AjAAMBYGA1UdJQEB/wQMMAoGCCsGAQUFBwMIMA4GA1UdDwEB/wQEAwIHgDANBgkq -# hkiG9w0BAQsFAAOCAgEAOjQAyz0cVztTFGqXX5JLRxFK/O/oMe55uDqEC8Vd1gbc -# M28KBUPgvUIPXm/vdDN2IVBkWHmwCp4AIcy4dZtkuUmd0fnu6aT9Mvo1ndsLp2YJ -# cMoFLEt3TtriLaO+i4Grv0ZULtWXUPAW/Mn5Scjgn0xZduGPBD/Xs3J7+get9+8Z -# vBipsg/N7poimYOVsHxLcem7V5XdMNsytTm/uComhM/wgR5KlDYTVNAXBxcSKMeJ -# aiD3V1+HhNkVliMl5VOP+nw5xWF55u9h6eF2G7eBPqT+qSFQ+rQCQdIrN0yG1QN9 -# PJroguK+FJQJdQzdfD3RWVsciBygbYaZlT1cGJI1IyQ74DQ0UBdTpfeGsyrEQ9PI -# 8QyqVLqb2q7LtI6DJMNphYu+jr//0spr1UVvyDPtuRnbGQRNi1COwJcj9OYmlkFg -# KNeCfbDT7U3uEOvWomekX60Y/m5utRcUPVeAPdhkB+DxDaev3J1ywDNdyu911nAV -# PgRkyKgMK3USLG37EdlatDk8FyuCrx4tiHyqHO3wE6xPw32Q8e/vmuQPoBZuX3qU -# eoFIsyZEenHq2ScMunhcqW32SUVAi5oZ4Z3nf7dAgNau21NEPwgW+2wkrNqDg7Hp -# 8yHyoOKbgEBu6REQbvSfZ5Kh4PV+S2gxf2uq6GoYDnlqABOMYwz309ISi0bPMh8w -# ggdxMIIFWaADAgECAhMzAAAAFcXna54Cm0mZAAAAAAAVMA0GCSqGSIb3DQEBCwUA -# MIGIMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMH -# UmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTIwMAYDVQQD -# EylNaWNyb3NvZnQgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgMjAxMDAeFw0y -# MTA5MzAxODIyMjVaFw0zMDA5MzAxODMyMjVaMHwxCzAJBgNVBAYTAlVTMRMwEQYD -# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy -# b3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1w -# IFBDQSAyMDEwMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA5OGmTOe0 -# ciELeaLL1yR5vQ7VgtP97pwHB9KpbE51yMo1V/YBf2xK4OK9uT4XYDP/XE/HZveV -# U3Fa4n5KWv64NmeFRiMMtY0Tz3cywBAY6GB9alKDRLemjkZrBxTzxXb1hlDcwUTI -# cVxRMTegCjhuje3XD9gmU3w5YQJ6xKr9cmmvHaus9ja+NSZk2pg7uhp7M62AW36M -# EBydUv626GIl3GoPz130/o5Tz9bshVZN7928jaTjkY+yOSxRnOlwaQ3KNi1wjjHI -# NSi947SHJMPgyY9+tVSP3PoFVZhtaDuaRr3tpK56KTesy+uDRedGbsoy1cCGMFxP -# LOJiss254o2I5JasAUq7vnGpF1tnYN74kpEeHT39IM9zfUGaRnXNxF803RKJ1v2l -# IH1+/NmeRd+2ci/bfV+AutuqfjbsNkz2K26oElHovwUDo9Fzpk03dJQcNIIP8BDy -# t0cY7afomXw/TNuvXsLz1dhzPUNOwTM5TI4CvEJoLhDqhFFG4tG9ahhaYQFzymei -# XtcodgLiMxhy16cg8ML6EgrXY28MyTZki1ugpoMhXV8wdJGUlNi5UPkLiWHzNgY1 -# GIRH29wb0f2y1BzFa/ZcUlFdEtsluq9QBXpsxREdcu+N+VLEhReTwDwV2xo3xwgV -# GD94q0W29R6HXtqPnhZyacaue7e3PmriLq0CAwEAAaOCAd0wggHZMBIGCSsGAQQB -# gjcVAQQFAgMBAAEwIwYJKwYBBAGCNxUCBBYEFCqnUv5kxJq+gpE8RjUpzxD/LwTu -# MB0GA1UdDgQWBBSfpxVdAF5iXYP05dJlpxtTNRnpcjBcBgNVHSAEVTBTMFEGDCsG -# AQQBgjdMg30BATBBMD8GCCsGAQUFBwIBFjNodHRwOi8vd3d3Lm1pY3Jvc29mdC5j -# b20vcGtpb3BzL0RvY3MvUmVwb3NpdG9yeS5odG0wEwYDVR0lBAwwCgYIKwYBBQUH -# AwgwGQYJKwYBBAGCNxQCBAweCgBTAHUAYgBDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud -# EwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAU1fZWy4/oolxiaNE9lJBb186aGMQwVgYD -# VR0fBE8wTTBLoEmgR4ZFaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraS9jcmwv -# cHJvZHVjdHMvTWljUm9vQ2VyQXV0XzIwMTAtMDYtMjMuY3JsMFoGCCsGAQUFBwEB -# BE4wTDBKBggrBgEFBQcwAoY+aHR0cDovL3d3dy5taWNyb3NvZnQuY29tL3BraS9j -# ZXJ0cy9NaWNSb29DZXJBdXRfMjAxMC0wNi0yMy5jcnQwDQYJKoZIhvcNAQELBQAD -# ggIBAJ1VffwqreEsH2cBMSRb4Z5yS/ypb+pcFLY+TkdkeLEGk5c9MTO1OdfCcTY/ -# 2mRsfNB1OW27DzHkwo/7bNGhlBgi7ulmZzpTTd2YurYeeNg2LpypglYAA7AFvono -# aeC6Ce5732pvvinLbtg/SHUB2RjebYIM9W0jVOR4U3UkV7ndn/OOPcbzaN9l9qRW -# qveVtihVJ9AkvUCgvxm2EhIRXT0n4ECWOKz3+SmJw7wXsFSFQrP8DJ6LGYnn8Atq -# gcKBGUIZUnWKNsIdw2FzLixre24/LAl4FOmRsqlb30mjdAy87JGA0j3mSj5mO0+7 -# hvoyGtmW9I/2kQH2zsZ0/fZMcm8Qq3UwxTSwethQ/gpY3UA8x1RtnWN0SCyxTkct -# wRQEcb9k+SS+c23Kjgm9swFXSVRk2XPXfx5bRAGOWhmRaw2fpCjcZxkoJLo4S5pu -# +yFUa2pFEUep8beuyOiJXk+d0tBMdrVXVAmxaQFEfnyhYWxz/gq77EFmPWn9y8FB -# SX5+k77L+DvktxW/tM4+pTFRhLy/AsGConsXHRWJjXD+57XQKBqJC4822rpM+Zv/ -# Cuk0+CQ1ZyvgDbjmjJnW4SLq8CdCPSWU5nR0W2rRnj7tfqAxM328y+l7vzhwRNGQ -# 8cirOoo6CGJ/2XBjU02N7oJtpQUQwXEGahC0HVUzWLOhcGbyoYIDVjCCAj4CAQEw -# ggEBoYHZpIHWMIHTMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQ -# MA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9u -# MS0wKwYDVQQLEyRNaWNyb3NvZnQgSXJlbGFuZCBPcGVyYXRpb25zIExpbWl0ZWQx -# JzAlBgNVBAsTHm5TaGllbGQgVFNTIEVTTjo1NTFBLTA1RTAtRDk0NzElMCMGA1UE -# AxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZaIjCgEBMAcGBSsOAwIaAxUA -# 1+26cR/yH100DiNFGWhuAv2rYBqggYMwgYCkfjB8MQswCQYDVQQGEwJVUzETMBEG -# A1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWlj -# cm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNyb3NvZnQgVGltZS1TdGFt -# cCBQQ0EgMjAxMDANBgkqhkiG9w0BAQsFAAIFAOt7V08wIhgPMjAyNTAzMTIwMDQz -# NTlaGA8yMDI1MDMxMzAwNDM1OVowdDA6BgorBgEEAYRZCgQBMSwwKjAKAgUA63tX -# TwIBADAHAgEAAgIkzjAHAgEAAgISezAKAgUA63yozwIBADA2BgorBgEEAYRZCgQC -# MSgwJjAMBgorBgEEAYRZCgMCoAowCAIBAAIDB6EgoQowCAIBAAIDAYagMA0GCSqG -# SIb3DQEBCwUAA4IBAQBgYY3roZdzNuxHIWXhLL+Gsirar0FWd87BAyGArtGKIp3c -# 2LUitjXEvZHJVaLdW0uWyhQF/X602dhGXVewjB6atjnw7xUU+2Q7EGCwKKDmeBHV -# CleToP5mbepnzOiwNwDLk3IXDLcY5BovU0uC3rsxNqqEP38TpHaC7F7iuIEPWgvw -# spqUj4pNzZl+lQNDZs2VWvPJWliJkEEM0q1yL3aGFbvjVntStN/b5xB3Sc7+FTIk -# FYjogUmwaX99WffaQOEedFy6Ab0GxHnx34fQh2rmQ9FCdXUpVQgxt/eYFTWDBeaz -# Mu4Ui1mkwDcRpu3oD9sfaML30OVnMxVwl1CJylDDMYIEDTCCBAkCAQEwgZMwfDEL -# MAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1v -# bmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEmMCQGA1UEAxMdTWlj -# cm9zb2Z0IFRpbWUtU3RhbXAgUENBIDIwMTACEzMAAAIB0UVZmBDMQk8AAQAAAgEw -# DQYJYIZIAWUDBAIBBQCgggFKMBoGCSqGSIb3DQEJAzENBgsqhkiG9w0BCRABBDAv -# BgkqhkiG9w0BCQQxIgQgcZh6+rjlPCra7Qi5xf+gF2cXhKH6zCiIlI46hjmrzFow -# gfoGCyqGSIb3DQEJEAIvMYHqMIHnMIHkMIG9BCBYa7I6TJQRcmx0HaSTWZdJgowd -# rl9+Zrr0pIdqHtc4IzCBmDCBgKR+MHwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpX -# YXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQg -# Q29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQSAy -# MDEwAhMzAAACAdFFWZgQzEJPAAEAAAIBMCIEIPlERA11JlrxgZHhLSdtu1j7TQ02 -# veZ+JH4gXwxwpT8gMA0GCSqGSIb3DQEBCwUABIICAH95iFbRUn2vbIas/MdpGFkV -# tQ8vY+ii/JZEP/5Ivs7s8pAUDTY+40HUEVJHudLyOCfI/H3hpQASrjdA8xzHyqgU -# sX+bMPvSqKUMm0L98NPSYyPR3kVnuZMH2PklqdmCzd9SzaeK3/o+qPgekp9yR3jR -# crZVknbJCi+Vz8DhqePMYhLpaG/t/8u+Tj8+O5rx4t2igXD1IMEZZ25NHYgkCsJM -# wdxnvMlGE9h968q4nIksyZ8V1CSCEK7Xf/cUSajZL0/MyHxw1DVVMyyLs9bAngDW -# LR2RmYI5smZWKPU4D9unCkpgVus0ZcyjCRYkttTHzcoEQWTtjAMymXAfl+2ZcHHi -# APyH+w1FrpilgDHVnXyNNeenr7A4+ytQFQ6c0/DU9Kv7KJ/X1tN0Q+HwnzW8XAW8 -# bxYcoBZ4x65urKbZioEmSp21FsRCFEqL+CBpo79jSq1LOLbY0gl32Xml/D/Ix+Pp -# zEM68KigMDMI5XpRSAaIXkOJ6x1Xk8oiKsXap9z9qZrx6djO1SpBevVjAu2N+osC -# JQm2wCk4ZtefzMQsNSK1FfeeSbeO8UG6dEcNnv96LcE52+O7/lNV+XTfDhlS2m9/ -# gglLNXlhZZzxmXhmr/Bf/Q5V9gEnqRx/RBIEYDQCM9HK8IwM8Vol+xp+nmr+STm6 -# Vd3F7h/aQ3aBi10l1ARJ -# SIG # End signature block diff --git a/newton-cn/bin/Modules/ConfigDefenderPerformance/MSFT_MpPerformanceRecording.wprp b/newton-cn/bin/Modules/ConfigDefenderPerformance/MSFT_MpPerformanceRecording.wprp deleted file mode 100644 index 244520b..0000000 --- a/newton-cn/bin/Modules/ConfigDefenderPerformance/MSFT_MpPerformanceRecording.wprp +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/ConfigDefenderPerformance/MSFT_MpPerformanceReport.Format.ps1xml b/newton-cn/bin/Modules/ConfigDefenderPerformance/MSFT_MpPerformanceReport.Format.ps1xml deleted file mode 100644 index ffc1222..0000000 --- a/newton-cn/bin/Modules/ConfigDefenderPerformance/MSFT_MpPerformanceReport.Format.ps1xml +++ /dev/null @@ -1,1773 +0,0 @@ - - - - - default - - MpPerformanceReport.Result - Deserialized.MpPerformanceReport.Result - - - - - - - Overview - - ($_ | gm -Name:'Overview' -MemberType:NoteProperty).Count -gt 0 - - - - - - - Overview - - ======== - - - - - - - - - ($_ | fl | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - - - - - - - TopFiles - - ($_ | gm -Name:'TopFiles' -MemberType:NoteProperty).Count -gt 0 - - - - - - - TopFiles - - ======== - - - - - - - - MpPerformanceReport.NestedCollection - Deserialized.MpPerformanceReport.NestedCollection - - - - ($_ | fc | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - - - - - - - TopExtensions - - ($_ | gm -Name:'TopExtensions' -MemberType:NoteProperty).Count -gt 0 - - - - - - - TopExtensions - - ============= - - - - - - - - MpPerformanceReport.NestedCollection - Deserialized.MpPerformanceReport.NestedCollection - - - - ($_ | fc | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - - - - - - - TopProcesses - - ($_ | gm -Name:'TopProcesses' -MemberType:NoteProperty).Count -gt 0 - - - - - - - TopProcesses - - ============ - - - - - - - - MpPerformanceReport.NestedCollection - Deserialized.MpPerformanceReport.NestedCollection - - - - ($_ | fc | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - - - - - - - TopPaths - - ($_ | gm -Name:'TopPaths' -MemberType:NoteProperty).Count -gt 0 - - - - - - - TopPaths - - ======== - - - - - - - - MpPerformanceReport.NestedCollection - Deserialized.MpPerformanceReport.NestedCollection - - - - ($_ | fc | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - - - - - - - Folder - - ($_ | gm -Name:'Folder' -MemberType:NoteProperty).Count -gt 0 - - - - - - - Folder - - ====== - - - - - - - - MpPerformanceReport.NestedCollection - Deserialized.MpPerformanceReport.NestedCollection - - - - ($_ | fc | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - - - - - - - TopScans - - ($_ | gm -Name:'TopScans' -MemberType:NoteProperty).Count -gt 0 - - - - - - - TopScans - - ======== - - - - - - - - - ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - - - - - - - - - - - - - default - - MpPerformanceReport.Result - Deserialized.MpPerformanceReport.Result - - - - - - - - - $null -ne $_.Overview - - ($_.Overview | fl | Out-String).TrimStart() - - - - - $null -ne $_.TopFiles - - ($_.TopFiles | fl | Out-String).TrimStart() - - - - - $null -ne $_.TopExtensions - - ($_.TopExtensions | fl | Out-String).TrimStart() - - - - - $null -ne $_.TopPaths - - ($_.TopPaths | fl | Out-String).TrimStart() - - - - - $null -ne $_.TopProcesses - - ($_.TopProcesses | fl | Out-String).TrimStart() - - - - - $null -ne $_.TopScans - - ($_.TopScans | fl | Out-String).TrimStart() - - - - - - - - - default - - MpPerformanceReport.Result - Deserialized.MpPerformanceReport.Result - - - - - - - ForEach($sectionName in @('TopFiles', 'TopExtensions', 'TopProcesses', 'TopScans', 'TopPaths')) { - if ($null -ne $_.$sectionName) { - $sectionName - } - } - - - - - - - - - default - - MpPerformanceReport.Result - Deserialized.MpPerformanceReport.Result - - - - - - - - - 13 - - - - - - - - - - - - - - - - - - - - ($_.Overview | fl | Out-String).TrimStart() - - - ($_.TopExtensions | fw -Column:1 | Out-String).TrimStart() - - - ($_.TopProcesses | fw -Column:1 | Out-String).TrimStart() - - - ($_.TopFiles | fw -Column:1 | Out-String).TrimStart() - - - ($_.TopScans | fw -Column:1 | Out-String).TrimStart() - - - ($_.TopPaths | fw -Column:1 | Out-String).TrimStart() - - - - - - - - - default - - MpPerformanceReport.ScannedFilePathStats - Deserialized.MpPerformanceReport.ScannedFilePathStats - MpPerformanceReport.ScannedFileExtensionStats - Deserialized.MpPerformanceReport.ScannedFileExtensionStats - MpPerformanceReport.ScannedPathStats - Deserialized.MpPerformanceReport.ScannedPathStats - MpPerformanceReport.ScannedProcessStats - Deserialized.MpPerformanceReport.ScannedProcessStats - - - - - - - ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) - - - - - 4 - - - Files - - ($_ | gm -Name:'Files' -MemberType:NoteProperty).Count -eq 1 - - - - - - Files: - - - - - - - - MpPerformanceReport.NestedCollection - Deserialized.MpPerformanceReport.NestedCollection - - - - - - - - - - ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) - - - - - 4 - - - Scans - - ($_ | gm -Name:'Scans' -MemberType:NoteProperty).Count -eq 1 - - - - - - Scans: - - - - - $properties = 'ScanType',@{Name='Duration'; Expression={$_.Duration}; Alignment='Right'},'Reason','SkipReason' - - if (($_ | gm -Name:'ProcessName' -MemberType:NoteProperty).Count -eq 1) { - $properties += 'ProcessName' - } - - if (($_ | gm -Name:'ProcessPath' -MemberType:NoteProperty).Count -eq 1) { - $properties += 'ProcessPath' - } - - ($_ | ft -Property:$properties | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - - - - - - - - - - - - - - ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - - - - - - - Extensions - - ($_ | gm -Name:'Extensions' -MemberType:NoteProperty).Count -eq 1 - - - - - - Extensions: - - - - - - - - MpPerformanceReport.NestedCollection - Deserialized.MpPerformanceReport.NestedCollection - - - - - - - - - - ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) - - - - - 4 - - - Scans - - ($_ | gm -Name:'Scans' -MemberType:NoteProperty).Count -eq 1 - - - - - - Scans: - - - - - $properties = 'ScanType',@{Name='Duration'; Expression={$_.Duration}; Alignment='Right'},'Reason','SkipReason','ProcessName','Path' - ($_ | ft -Property:$properties | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - - - - - - - - - - - - - - ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - - - - - - - Folder - - ($_ | gm -Name:'Folder' -MemberType:NoteProperty).Count -eq 1 - - - - - - Folder: - - - - - - - - MpPerformanceReport.NestedCollection - Deserialized.MpPerformanceReport.NestedCollection - - - - - - - - - - ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) - - - - - 4 - - - Scans - - ($_ | gm -Name:'Scans' -MemberType:NoteProperty).Count -eq 1 - - - - - - Scans: - - - - - $properties = 'ScanType',@{Name='Duration'; Expression={$_.Duration}; Alignment='Right'},'Reason','SkipReason','ProcessName','Path' - ($_ | ft -Property:$properties | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - - - - - 4 - - - Folder - - ($_ | gm -Name:'Folder' -MemberType:NoteProperty).Count -eq 1 - - - - - - Folder: - - - - - ($_ | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - - - - - - - - - - - - - - ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - - - - - - - Processes - - ($_ | gm -Name:'Processes' -MemberType:NoteProperty).Count -eq 1 - - - - - - Processes: - - - - - - - - MpPerformanceReport.NestedCollection - Deserialized.MpPerformanceReport.NestedCollection - - - - - - - - - - ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) - - - - - 4 - - - Scans - - ($_ | gm -Name:'Scans' -MemberType:NoteProperty).Count -eq 1 - - - - - - Scans: - - - - - $properties = 'ScanType',@{Name='Duration'; Expression={$_.Duration}; Alignment='Right'},'Reason','SkipReason','ProcessName','Path' - ($_ | ft -Property:$properties | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - - - - - - - - - - - - - - ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - - - - - - - Scans - - ($_ | gm -Name:'Scans' -MemberType:NoteProperty).Count -eq 1 - - - - - - Scans: - - - - - $properties = 'ScanType',@{Name='Duration'; Expression={$_.Duration}; Alignment='Right'},'Reason','SkipReason' - - if (($_ | gm -Name:'Comments' -MemberType:NoteProperty).Count -eq 1) { - $properties += @{Name='Comments'; Expression={$_.Comments.Count}; Alignment='Right'} - } - - if (($_ | gm -Name:'ProcessName' -MemberType:NoteProperty).Count -eq 1) { - $properties += 'ProcessName' - } - - if (($_ | gm -Name:'Path' -MemberType:NoteProperty).Count -eq 1) { - $properties += 'Path' - } - - ($_ | ft -Property:$properties | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - - - - - - - - - - - default - - MpPerformanceReport.ScanStats - Deserialized.MpPerformanceReport.ScanStats - - - - - - - - $null -ne $_.ProcessPath - - ProcessPath - - - - $null -ne $_.Path - - Path - - - - $null -ne $_.Extension - - Extension - - - Count - - - TotalDuration - - - MinDuration - - - AverageDuration - - - MaxDuration - - - MedianDuration - - - - - $null -ne $_.Extensions - - ($_.Extensions | fl | Out-String).Trim() - - - - - $null -ne $_.Files - - ($_.Files | fl | Out-String).Trim() - - - - - $null -ne $_.Processes - - ($_.Processes | fl | Out-String).Trim() - - - - - $null -ne $_.Scans - - ($_.Scans | fl | Out-String).Trim() - - - - - - - - - default - - MpPerformanceReport.ScannedFilePathStats - Deserialized.MpPerformanceReport.ScannedFilePathStats - - - - - Right - - - Right - - - Right - - - Right - - - Right - - - Right - - - - - - - - - Count - - - TotalDuration - - - MinDuration - - - AverageDuration - - - MaxDuration - - - MedianDuration - - - Path - - - - - - - - - default - - MpPerformanceReport.ScannedFileExtensionStats - Deserialized.MpPerformanceReport.ScannedFileExtensionStats - - - - - Right - - - Right - - - Right - - - Right - - - Right - - - Right - - - - - - - - - Count - - - TotalDuration - - - MinDuration - - - AverageDuration - - - MaxDuration - - - MedianDuration - - - Extension - - - - - - - - - default - - MpPerformanceReport.ScannedPathStats - Deserialized.MpPerformanceReport.ScannedPathStats - - - - - Right - - - Right - - - Right - - - Right - - - Right - - - Right - - - - - - - - - Count - - - TotalDuration - - - MinDuration - - - AverageDuration - - - MaxDuration - - - MedianDuration - - - Path - - - - - - - - - default - - MpPerformanceReport.ScannedProcessStats - Deserialized.MpPerformanceReport.ScannedProcessStats - - - - - Right - - - Right - - - Right - - - Right - - - Right - - - Right - - - - - - - - - Count - - - TotalDuration - - - MinDuration - - - AverageDuration - - - MaxDuration - - - MedianDuration - - - ProcessPath - - - - - - - - - default - - MpPerformanceReport.ScannedFilePathStats - Deserialized.MpPerformanceReport.ScannedFilePathStats - - - - - - Path - - - - - - - - default - - MpPerformanceReport.ScannedFileExtensionStats - Deserialized.MpPerformanceReport.ScannedFileExtensionStats - - - - - - Extension - - - - - - - - default - - MpPerformanceReport.ScannedPathStats - Deserialized.MpPerformanceReport.ScannedPathStats - - - - - - Path - - - - - - - - default - - MpPerformanceReport.ScannedProcessStats - Deserialized.MpPerformanceReport.ScannedProcessStats - - - - - - ProcessPath - - - - - - - - default - - MpPerformanceReport.ScanInfo - Deserialized.MpPerformanceReport.ScanInfo - - - - - - Right - - - - - - Right - - - - - - - - - - - - ScanType - - - Duration - - - Reason - - - SkipReason - - - $_.Comments.Count - - - ProcessName - - - Path - - - - - - - - - default - - MpPerformanceReport.ScanInfo - Deserialized.MpPerformanceReport.ScanInfo - - - - - - - ScanType - - - StartTime - - - EndTime - - - Duration - - - - ($null -ne $_.Reason) -and ($_.Reason.Length -gt 0) - - Reason - - - SkipReason - - - Path - - - - $null -ne $_.ProcessPath - - ProcessPath - - - - $null -ne $_.ProcessId - - ProcessId - - - - $null -ne $_.Image - - Image - - - - $null -ne $_.Comments - - - ($_.Comments | fl | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - default - - MpPerformanceReport.ScanInfo - Deserialized.MpPerformanceReport.ScanInfo - - - - - - Path - - - - - - - - default - - MpPerformanceReport.ScanInfo - Deserialized.MpPerformanceReport.ScanInfo - - - - - - - ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - default - - MpPerformanceReport.Overview - Deserialized.MpPerformanceReport.Overview - - - - - - - ($_ | fl | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - default - - MpPerformanceReport.Overview - Deserialized.MpPerformanceReport.Overview - - - - - - - StartTime - - - EndTime - - - - ($null -ne $_.RealTimeScans) -and ($_.RealTimeScans -gt 0) - - RealTimeScans - - - - ($null -ne $_.OnDemandScans) -and ($_.OnDemandScans -gt 0) - - OnDemandScans - - - - ($null -ne $_.FileScans) -and ($_.FileScans -gt 0) - - FileScans - - - - ($null -ne $_.ProcessScans) -and ($_.ProcessScans -gt 0) - - ProcessScans - - - - ($null -ne $_.RealTimeScansDuration) -and ($_.RealTimeScansDuration -gt 0) - - RealTimeScansDuration - - - - ($null -ne $_.OnDemandScansDuration) -and ($_.OnDemandScansDuration -gt 0) - - OnDemandScansDuration - - - - ($null -ne $_.FileScansDuration) -and ($_.FileScansDuration -gt 0) - - FileScansDuration - - - - ($null -ne $_.ProcessScansDuration) -and ($_.ProcessScansDuration -gt 0) - - ProcessScansDuration - - - MaxScanDuration - - - MedianScanDuration - - - - ($null -ne $_.SkipScanCount) -and ($_.SkipScanCount -gt 0) - - SkipScanCount - - - - ($null -ne $_.PerfHints) -and ($_.PerfHints.Count -gt 0) - - - ($_.PerfHints | fl | Out-String).Trim("`r`n".ToCharArray()) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Defender/Defender.psd1 b/newton-cn/bin/Modules/Defender/Defender.psd1 deleted file mode 100644 index 50ea7c5..0000000 --- a/newton-cn/bin/Modules/Defender/Defender.psd1 +++ /dev/null @@ -1,221 +0,0 @@ - -@{ - GUID = 'C46BE3DC-30A9-452F-A5FD-4BF9CA87A854' - Author="Microsoft Corporation" - CompanyName="Microsoft Corporation" - Copyright="© Microsoft Corporation. All rights reserved." - ModuleVersion = '1.0' - NestedModules = @( 'MSFT_MpComputerStatus.cdxml', - 'MSFT_MpPreference.cdxml', - 'MSFT_MpThreat.cdxml', - 'MSFT_MpThreatCatalog.cdxml', - 'MSFT_MpThreatDetection.cdxml', - 'MSFT_MpScan.cdxml', - 'MSFT_MpSignature.cdxml', - 'MSFT_MpWDOScan.cdxml') - - - AliasesToExport = @() - FunctionsToExport = @( 'Get-MpPreference', - 'Set-MpPreference', - 'Add-MpPreference', - 'Remove-MpPreference', - 'Get-MpComputerStatus', - 'Get-MpThreat', - 'Get-MpThreatCatalog', - 'Get-MpThreatDetection', - 'Start-MpScan', - 'Update-MpSignature', - 'Remove-MpThreat', - 'Start-MpWDOScan') - - PowerShellVersion = '5.1' - HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=390762" - CompatiblePSEditions = @('Desktop', 'Core') -} - -# SIG # Begin signature block -# MIIiMwYJKoZIhvcNAQcCoIIiJDCCIiACAQExDzANBglghkgBZQMEAgEFADB5Bgor -# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG -# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDUbZuRH+aG/7FW -# 9ezsmK3ZGa31rJ8d50nbQ/Xy2TfvNqCCC14wggTrMIID06ADAgECAhMzAAAGjjGX -# Mb+0zHDBAAAAAAaOMA0GCSqGSIb3DQEBCwUAMHkxCzAJBgNVBAYTAlVTMRMwEQYD -# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy -# b3NvZnQgQ29ycG9yYXRpb24xIzAhBgNVBAMTGk1pY3Jvc29mdCBXaW5kb3dzIFBD -# QSAyMDEwMB4XDTE5MDUwMjIwMzUyN1oXDTIwMDUwMjIwMzUyN1owcDELMAkGA1UE -# BhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAc -# BgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEaMBgGA1UEAxMRTWljcm9zb2Z0 -# IFdpbmRvd3MwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCsvVYdcqx5 -# CYVMFPb/2EsJUc9P5loIBWf7HhHqFwFFQ0Fc7Alzdm/06Myx64qpVjCOwgmIA9x6 -# 2634vpYikMt46HFt5539uCkm3/HfX7oYDIIzqxX6EqBd8GLMRe09JMpg57fL0BIl -# do5l/LG60xFsnvBQNJ4mqi4C3TXvmV/vFqRruCXqP6FUejQlhGLEwbMNvgIWYJiK -# Tg16g/rdhlH25JL2jdrIvOrhmLngx3/1Vlh6+ypItfG3ml2mYK4CQYc04sZimz+B -# WzpM8TjP0DvVDddSGSry3sTQpDxZPgQQqTQmyOxTxHfhrUMzfL5XN4T6SpEGret/ -# qDJOT/80eN3DAgMBAAGjggFzMIIBbzAfBgNVHSUEGDAWBgorBgEEAYI3CgMGBggr -# BgEFBQcDAzAdBgNVHQ4EFgQUnC909vAOepLyCEG0Wl1Rzz+QiHMwUAYDVR0RBEkw -# R6RFMEMxKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVyYXRpb25zIFB1ZXJ0byBSaWNv -# MRYwFAYDVQQFEw0yMzAwMjgrNDU0MTM4MB8GA1UdIwQYMBaAFNFPqYoHCM70JBiY -# 5QD/89Z5HTe8MFMGA1UdHwRMMEowSKBGoESGQmh0dHA6Ly9jcmwubWljcm9zb2Z0 -# LmNvbS9wa2kvY3JsL3Byb2R1Y3RzL01pY1dpblBDQV8yMDEwLTA3LTA2LmNybDBX -# BggrBgEFBQcBAQRLMEkwRwYIKwYBBQUHMAKGO2h0dHA6Ly93d3cubWljcm9zb2Z0 -# LmNvbS9wa2kvY2VydHMvTWljV2luUENBXzIwMTAtMDctMDYuY3J0MAwGA1UdEwEB -# /wQCMAAwDQYJKoZIhvcNAQELBQADggEBAFz4krQX84TW3RbjHZj+QkVVwkvT6J46 -# F/s8HuNVxt/gfRHfvFLPIwU4VsDYbBmYv0Vy3hJ1/Eg1fdSgXMRNLW6kPT7bLx5z -# ucCx6JBgLYBDSq0auMm5liQrATrPEM0PoBDqMpE0zsqdQ/C2P8UlkKLNhUS/qD0f -# 6OmLwTp9spa+Y4CL+C1gT1knV4Olku5X5ZoCyWXs6k7D0dltiO4nZjq7eRne53Kr -# +Eo9ocfnUjDalgHpFWOkdwx+cSXpfvh2cI1T0Qug9eS5VQ1j+iLRPWEKhbljly/M -# UWcVFCv+gqGphEkHsBjyKs0TZ4HMfC4n9DonS04Hn+/BskGtHJE+leMwggZrMIIE -# U6ADAgECAgphDGoZAAAAAAAEMA0GCSqGSIb3DQEBCwUAMIGIMQswCQYDVQQGEwJV -# UzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UE -# ChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTIwMAYDVQQDEylNaWNyb3NvZnQgUm9v -# dCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgMjAxMDAeFw0xMDA3MDYyMDQwMjNaFw0y -# NTA3MDYyMDUwMjNaMHkxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9u -# MRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRp -# b24xIzAhBgNVBAMTGk1pY3Jvc29mdCBXaW5kb3dzIFBDQSAyMDEwMIIBIjANBgkq -# hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwHm7OrHwD4S4rWQqdRZz0LsH9j4NnRTk -# sZ/ByJSwOHwf0DNV9bojZvUuKEhTxxaDuvVRrH6s4CZ/D3T8WZXcycai91JwWiwd -# lKsZv6+Vfa9moW+bYm5tS7wvNWzepGpjWl/78w1NYcwKfjHrbArQTZcP/X84RuaK -# x3NpdlVplkzk2PA067qxH84pfsRPnRMVqxMbclhiVmyKgaNkd5hGZSmdgxSlTAig -# g9cjH/Nf328sz9oW2A5yBCjYaz74E7F8ohd5T37cOuSdcCdrv9v8HscH2MC+C5Me -# KOBzbdJU6ShMv2tdn/9dMxI3lSVhNGpCy3ydOruIWeGjQm06UFtI0QIDAQABo4IB -# 4zCCAd8wEAYJKwYBBAGCNxUBBAMCAQAwHQYDVR0OBBYEFNFPqYoHCM70JBiY5QD/ -# 89Z5HTe8MBkGCSsGAQQBgjcUAgQMHgoAUwB1AGIAQwBBMAsGA1UdDwQEAwIBhjAP -# BgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNX2VsuP6KJcYmjRPZSQW9fOmhjE -# MFYGA1UdHwRPME0wS6BJoEeGRWh0dHA6Ly9jcmwubWljcm9zb2Z0LmNvbS9wa2kv -# Y3JsL3Byb2R1Y3RzL01pY1Jvb0NlckF1dF8yMDEwLTA2LTIzLmNybDBaBggrBgEF -# BQcBAQROMEwwSgYIKwYBBQUHMAKGPmh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9w -# a2kvY2VydHMvTWljUm9vQ2VyQXV0XzIwMTAtMDYtMjMuY3J0MIGdBgNVHSAEgZUw -# gZIwgY8GCSsGAQQBgjcuAzCBgTA9BggrBgEFBQcCARYxaHR0cDovL3d3dy5taWNy -# b3NvZnQuY29tL1BLSS9kb2NzL0NQUy9kZWZhdWx0Lmh0bTBABggrBgEFBQcCAjA0 -# HjIgHQBMAGUAZwBhAGwAXwBQAG8AbABpAGMAeQBfAFMAdABhAHQAZQBtAGUAbgB0 -# AC4gHTANBgkqhkiG9w0BAQsFAAOCAgEALkGmhrUGb/CAhfo7yhfpyfrkOcKUcMNk -# lMPYVqaQjv7kmvRt9W+OU41aqPOu20Zsvn8dVFYbPB1xxFEVVH6/7qWVQjP9DZAk -# JOP53JbK/Lisv/TCOVa4u+1zsxfdfoZQI4tWJMq7ph2ahy8nheehtgqcDRuM8wBi -# QbpIdIeC/VDJ9IcpwwOqK98aKXnoEiSahu3QLtNAgfUHXzMGVF1AtfexYv1NSPdu -# QUdSHLsbwlc6qJlWk9TG3iaoYHWGu+xipvAdBEXfPqeE0VtEI2MlNndvrlvcItUU -# I2pBf9BCptvvJXsE49KWN2IGr/gbD46zOZq7ifU1BuWkW8OMnjdfU9GjN/2kT+gb -# Dmt25LiPsMLq/XX3LEG3nKPhHgX+l5LLf1kDbahOjU6AF9TVcvZW5EifoyO6BqDA -# jtGIT5Mg8nBf2GtyoyBJ/HcMXcXH4QIPOEIQDtsCrpo3HVCAKR6kp9nGmiVV/UDK -# rWQQ6DH5ElR5GvIO2NarHjP+AucmbWFJj/Elwot0md/5kxqQHO7dlDMOQlDbf1D4 -# n2KC7KaCFnxmvOyZsMFYXaiwmmEUkdGZL0nkPoGZ1ubvyuP9Pu7sCYYDBw0bDXzr -# 9FrJlc+HEgpd7MUCks0FmXLKffEqEBg45DGjKLTmTMVSo5xqx33AcQkEDXDeAj+H -# 7lah7Ou1TIUxghYrMIIWJwIBATCBkDB5MQswCQYDVQQGEwJVUzETMBEGA1UECBMK -# V2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0 -# IENvcnBvcmF0aW9uMSMwIQYDVQQDExpNaWNyb3NvZnQgV2luZG93cyBQQ0EgMjAx -# MAITMwAABo4xlzG/tMxwwQAAAAAGjjANBglghkgBZQMEAgEFAKCBrjAZBgkqhkiG -# 9w0BCQMxDAYKKwYBBAGCNwIBBDAcBgorBgEEAYI3AgELMQ4wDAYKKwYBBAGCNwIB -# FTAvBgkqhkiG9w0BCQQxIgQgqArPjADquL3us4fMnB/bsIuUMLm3ByQyJDbiEevp -# iwowQgYKKwYBBAGCNwIBDDE0MDKgFIASAE0AaQBjAHIAbwBzAG8AZgB0oRqAGGh0 -# dHA6Ly93d3cubWljcm9zb2Z0LmNvbTANBgkqhkiG9w0BAQEFAASCAQB1jByJbzaz -# oKR0xnnzkHGYsLSpOB+RHzoeuoqL6ApE6NwOjqbo2jnyCB087rmnGu9kzTRbmABY -# kQqOC6Zuc0aLat9cTnW4YkKYMiQe63dj24cr3VvVZOSpydsyPLuAH488brp7Ywwx -# UxKiU+nnVZ/9AHLT1Rk4KGAxH7GwkmbresWhYuLHX6DwURjD/cSPQiUDagLRCJyd -# cMNBuWNd8EyfCLmAimlbeewczksWd4v79AAq+8hVaVtG1Hk2aM3sWMTiXTDFkCHy -# XFPXJi/vhFJCtsn6ZvsLHfKLVLUdV4cLiVq6QbdYZXWciOdRzZhcDTgYybrXQ5X5 -# bDFw+Nnk11+qoYITujCCE7YGCisGAQQBgjcDAwExghOmMIITogYJKoZIhvcNAQcC -# oIITkzCCE48CAQMxDzANBglghkgBZQMEAgEFADCCAVgGCyqGSIb3DQEJEAEEoIIB -# RwSCAUMwggE/AgEBBgorBgEEAYRZCgMBMDEwDQYJYIZIAWUDBAIBBQAEIHlT+9kz -# AlxjMg5+TwvD98601ORheoJ647W22XKMh0vNAgZdiN620kUYEzIwMTkwOTI1MDIw -# NDQ0LjY2N1owBwIBAYACAfSggdSkgdEwgc4xCzAJBgNVBAYTAlVTMRMwEQYDVQQI -# EwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3Nv -# ZnQgQ29ycG9yYXRpb24xKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVyYXRpb25zIFB1 -# ZXJ0byBSaWNvMSYwJAYDVQQLEx1UaGFsZXMgVFNTIEVTTjpGNTI4LTM3NzctOEE3 -# NjElMCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZaCCDyIwggT1 -# MIID3aADAgECAhMzAAABApFjXMW0Wbk8AAAAAAECMA0GCSqGSIb3DQEBCwUAMHwx -# CzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRt -# b25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1p -# Y3Jvc29mdCBUaW1lLVN0YW1wIFBDQSAyMDEwMB4XDTE5MDkwNjIwNDExNloXDTIw -# MTIwNDIwNDExNlowgc4xCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9u -# MRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRp -# b24xKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVyYXRpb25zIFB1ZXJ0byBSaWNvMSYw -# JAYDVQQLEx1UaGFsZXMgVFNTIEVTTjpGNTI4LTM3NzctOEE3NjElMCMGA1UEAxMc -# TWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZTCCASIwDQYJKoZIhvcNAQEBBQAD -# ggEPADCCAQoCggEBAMR9cB7FDTMrBI8h/TzUcyyH/WMnyW+TxPx308rF22K65K6d -# 0Cg/VQyr3xtoT+ir0MEhZ/hvXY5sO8F4HSu2frknt30PYRTQW0I1gzgNc7Tggbcx -# fY4JcXStqM0/3NGZusiKKDl8UvFV85irGYuiP/b36nqe6T5zk1gVIGHx5nFIdfPy -# HjsnoWX6gOxfqIDavfFeb/Ak7lKqZAHUgdAZU08KCYkVKYLtZbaRyQ2W1/KA7cPf -# cT17u+r6dJHZNfMqnCWriLZz9sTdkpTnQgvBr6LdLJ8b0e24taMX98ySqyenc1bB -# foa49rasKev/Ao17wc3sTO1POEkJQzOib6OwiNcCAwEAAaOCARswggEXMB0GA1Ud -# DgQWBBQ/AgaO19V67EZWg1gyCfv3uVC1tjAfBgNVHSMEGDAWgBTVYzpcijGQ80N7 -# fEYbxTNoWoVtVTBWBgNVHR8ETzBNMEugSaBHhkVodHRwOi8vY3JsLm1pY3Jvc29m -# dC5jb20vcGtpL2NybC9wcm9kdWN0cy9NaWNUaW1TdGFQQ0FfMjAxMC0wNy0wMS5j -# cmwwWgYIKwYBBQUHAQEETjBMMEoGCCsGAQUFBzAChj5odHRwOi8vd3d3Lm1pY3Jv -# c29mdC5jb20vcGtpL2NlcnRzL01pY1RpbVN0YVBDQV8yMDEwLTA3LTAxLmNydDAM -# BgNVHRMBAf8EAjAAMBMGA1UdJQQMMAoGCCsGAQUFBwMIMA0GCSqGSIb3DQEBCwUA -# A4IBAQCdMoMxXiGN6lYPaFv/uIVhdPr50PRE0H+4jZwUEOrTU8vJLF7ARizMeK/Z -# mxczuJPQhm7KSZBJXp+FmrX5jRE+gD7+gkPlTaRTiy+A/3jVOFJiPChh17Zxz/fS -# qtbKlejkG7LJv4Ptg/1u7qVI3bNGge85BkDt0xlTUsK8VxA2zGQSq4JfkF5TSPCG -# HQjmKdgJTfiZadCWQ2j/K5W0QAzPxNhrj3QetJp9Dqlr04EiV1IvZNAhY00TUByB -# GGhTlEclYTCzhGG7Agv2+qGkOv1tmeRjqLCETuF3/+WQWjxEzHfjMRsbDfhrcuAl -# AXZMrJktBr+87FwXNzt/81FwkOOkMIIGcTCCBFmgAwIBAgIKYQmBKgAAAAAAAjAN -# BgkqhkiG9w0BAQsFADCBiDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0 -# b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3Jh -# dGlvbjEyMDAGA1UEAxMpTWljcm9zb2Z0IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9y -# aXR5IDIwMTAwHhcNMTAwNzAxMjEzNjU1WhcNMjUwNzAxMjE0NjU1WjB8MQswCQYD -# VQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEe -# MBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNyb3Nv -# ZnQgVGltZS1TdGFtcCBQQ0EgMjAxMDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC -# AQoCggEBAKkdDbx3EYo6IOz8E5f1+n9plGt0VBDVpQoAgoX77XxoSyxfxcPlYcJ2 -# tz5mK1vwFVMnBDEfQRsalR3OCROOfGEwWbEwRA/xYIiEVEMM1024OAizQt2TrNZz -# MFcmgqNFDdDq9UeBzb8kYDJYYEbyWEeGMoQedGFnkV+BVLHPk0ySwcSmXdFhE24o -# xhr5hoC732H8RsEnHSRnEnIaIYqvS2SJUGKxXf13Hz3wV3WsvYpCTUBR0Q+cBj5n -# f/VmwAOWRH7v0Ev9buWayrGo8noqCjHw2k4GkbaICDXoeByw6ZnNPOcvRLqn9Nxk -# vaQBwSAJk3jN/LzAyURdXhacAQVPIk0CAwEAAaOCAeYwggHiMBAGCSsGAQQBgjcV -# AQQDAgEAMB0GA1UdDgQWBBTVYzpcijGQ80N7fEYbxTNoWoVtVTAZBgkrBgEEAYI3 -# FAIEDB4KAFMAdQBiAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAf -# BgNVHSMEGDAWgBTV9lbLj+iiXGJo0T2UkFvXzpoYxDBWBgNVHR8ETzBNMEugSaBH -# hkVodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpL2NybC9wcm9kdWN0cy9NaWNS -# b29DZXJBdXRfMjAxMC0wNi0yMy5jcmwwWgYIKwYBBQUHAQEETjBMMEoGCCsGAQUF -# BzAChj5odHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpL2NlcnRzL01pY1Jvb0Nl -# ckF1dF8yMDEwLTA2LTIzLmNydDCBoAYDVR0gAQH/BIGVMIGSMIGPBgkrBgEEAYI3 -# LgMwgYEwPQYIKwYBBQUHAgEWMWh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9QS0kv -# ZG9jcy9DUFMvZGVmYXVsdC5odG0wQAYIKwYBBQUHAgIwNB4yIB0ATABlAGcAYQBs -# AF8AUABvAGwAaQBjAHkAXwBTAHQAYQB0AGUAbQBlAG4AdAAuIB0wDQYJKoZIhvcN -# AQELBQADggIBAAfmiFEN4sbgmD+BcQM9naOhIW+z66bM9TG+zwXiqf76V20ZMLPC -# xWbJat/15/B4vceoniXj+bzta1RXCCtRgkQS+7lTjMz0YBKKdsxAQEGb3FwX/1z5 -# Xhc1mCRWS3TvQhDIr79/xn/yN31aPxzymXlKkVIArzgPF/UveYFl2am1a+THzvbK -# egBvSzBEJCI8z+0DpZaPWSm8tv0E4XCfMkon/VWvL/625Y4zu2JfmttXQOnxzplm -# kIz/amJ/3cVKC5Em4jnsGUpxY517IW3DnKOiPPp/fZZqkHimbdLhnPkd/DjYlPTG -# pQqWhqS9nhquBEKDuLWAmyI4ILUl5WTs9/S/fmNZJQ96LjlXdqJxqgaKD4kWumGn -# Ecua2A5HmoDF0M2n0O99g/DhO3EJ3110mCIIYdqwUB5vvfHhAN/nMQekkzr3ZUd4 -# 6PioSKv33nJ+YWtvd6mBy6cJrDm77MbL2IK0cs0d9LiFAR6A+xuJKlQ5slvayA1V -# mXqHczsI5pgt6o3gMy4SKfXAL1QnIffIrE7aKLixqduWsqdCosnPGUFN4Ib5Kpqj -# EWYw07t0MkvfY3v1mYovG8chr1m1rtxEPJdQcdeh0sVV42neV8HR3jDA/czmTfsN -# v11P6Z0eGTgvvM9YBS7vDaBQNdrvCScc1bN+NR4Iuto229Nfj950iEkSoYIDsDCC -# ApgCAQEwgf6hgdSkgdEwgc4xCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5n -# dG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9y -# YXRpb24xKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVyYXRpb25zIFB1ZXJ0byBSaWNv -# MSYwJAYDVQQLEx1UaGFsZXMgVFNTIEVTTjpGNTI4LTM3NzctOEE3NjElMCMGA1UE -# AxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZaIlCgEBMAkGBSsOAwIaBQAD -# FQAX6b/thBTl/jMeKcc4lhOUcT39r6CB3jCB26SB2DCB1TELMAkGA1UEBhMCVVMx -# EzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoT -# FU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEpMCcGA1UECxMgTWljcm9zb2Z0IE9wZXJh -# dGlvbnMgUHVlcnRvIFJpY28xJzAlBgNVBAsTHm5DaXBoZXIgTlRTIEVTTjo0REU5 -# LTBDNUUtM0UwOTErMCkGA1UEAxMiTWljcm9zb2Z0IFRpbWUgU291cmNlIE1hc3Rl -# ciBDbG9jazANBgkqhkiG9w0BAQUFAAIFAOE0jQowIhgPMjAxOTA5MjQyMDM5Mzha -# GA8yMDE5MDkyNTIwMzkzOFowdzA9BgorBgEEAYRZCgQBMS8wLTAKAgUA4TSNCgIB -# ADAKAgEAAgIjIQIB/zAHAgEAAgIavTAKAgUA4TXeigIBADA2BgorBgEEAYRZCgQC -# MSgwJjAMBgorBgEEAYRZCgMBoAowCAIBAAIDFuNgoQowCAIBAAIDB6EgMA0GCSqG -# SIb3DQEBBQUAA4IBAQBrASVU9pdcR4F7/4tTy4Ua1pgXaHZeS+WxCk/Y27lXPjX3 -# AXc10+sWzfY399sHeIxloGNPGE2dAbreedpWNUOdASpH4NcmdBIV9Lw+rzINRfDk -# kXnmuMTBCNXUBheACk5PMBJkFmIb3pzS1ltL0VrBjIqrhEHcAODb084kqkowqnLy -# pXjqbqXhtgtCUYb4R3YW4UHh2fELgND4b137hiif1uYPml2eYJF3NkWEx+Yy1bnO -# BoO1HGGOVVkYl0haK9KYO477Aat/W3RXLCi9ZWvUF1zzIzmgEGpmg0IJ0+gc4O/u -# qL4fjQ+v7dr4XZGprDk4K/vnHJuXP6Zx+V9AQYt5MYIC9TCCAvECAQEwgZMwfDEL -# MAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1v -# bmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEmMCQGA1UEAxMdTWlj -# cm9zb2Z0IFRpbWUtU3RhbXAgUENBIDIwMTACEzMAAAECkWNcxbRZuTwAAAAAAQIw -# DQYJYIZIAWUDBAIBBQCgggEyMBoGCSqGSIb3DQEJAzENBgsqhkiG9w0BCRABBDAv -# BgkqhkiG9w0BCQQxIgQgmh0X5htwm7cgRCt/4kIReiD7scc2/3H2LKoBpDH4A6Mw -# geIGCyqGSIb3DQEJEAIMMYHSMIHPMIHMMIGxBBQX6b/thBTl/jMeKcc4lhOUcT39 -# rzCBmDCBgKR+MHwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAw -# DgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24x -# JjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQSAyMDEwAhMzAAABApFj -# XMW0Wbk8AAAAAAECMBYEFE6aCa5er+HPJ0ZM96o0ARtMskdiMA0GCSqGSIb3DQEB -# CwUABIIBADdGN5qukcEbkhbQS5sWxBsxHk9pqERW8f6V+ZHN2z562v9ZUmfLo4TX -# yAZtjbbsqSGTezz/YPziqebgXZP6Xo0akk372tSN7kVFtB9YEWru6/1hgYVHJ50r -# G6ti7OwweZRyUIOdJysSO2p3lzV06FiHQvLtsVtAt/BVFcVLh3i/hv+94Ew7D262 -# 5JiV28qyVTJRoJXChDT1q+tlR7ajbie3YyEKHuxLIa06IvbLayjsULRtTMfTXsS3 -# KCopbN0xpYvkLdWjyOrfc7XXs64UpyCvyQf468lVABcTOfKT/HLlEeIRn8bZZ+Oh -# okD3McQngz1Tv6rjlTi6OPhh4Z6ivFM= -# SIG # End signature block diff --git a/newton-cn/bin/Modules/Defender/MSFT_MpComputerStatus.cdxml b/newton-cn/bin/Modules/Defender/MSFT_MpComputerStatus.cdxml deleted file mode 100644 index f2cb5ea..0000000 --- a/newton-cn/bin/Modules/Defender/MSFT_MpComputerStatus.cdxml +++ /dev/null @@ -1,202 +0,0 @@ - - - - 1.0 - MpComputerStatus - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Defender/MSFT_MpPreference.cdxml b/newton-cn/bin/Modules/Defender/MSFT_MpPreference.cdxml deleted file mode 100644 index 51a31ca..0000000 --- a/newton-cn/bin/Modules/Defender/MSFT_MpPreference.cdxml +++ /dev/null @@ -1,1046 +0,0 @@ - - - - 1.0 - MpPreference - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Both - Incoming - Outcoming - - - - - - - - - - - - - - - - - Everyday - Sunday - Monday - Tuesday - Wednesday - Thursday - Friday - Saturday - Never - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - QuickScan - FullScan - - - - - - - - - - Everyday - Sunday - Monday - Tuesday - Wednesday - Thursday - Friday - Saturday - Never - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Everyday - Sunday - Monday - Tuesday - Wednesday - Thursday - Friday - Saturday - Never - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Disabled - Basic - Advanced - - - - - - - - - - AlwaysPrompt - SendSafeSamples - NeverSend - SendAllSamples - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Disabled - Enabled - AuditMode - - - - - - - - - - Default - Moderate - High - HighPlus - ZeroTolerance - - - - - - - - - - - - - - - - - Disabled - Enabled - AuditMode - - - - - - - - - - Disabled - Enabled - AuditMode - BlockDiskModificationOnly - AuditDiskModificationOnly - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Defender/MSFT_MpScan.cdxml b/newton-cn/bin/Modules/Defender/MSFT_MpScan.cdxml deleted file mode 100644 index 671f9db..0000000 --- a/newton-cn/bin/Modules/Defender/MSFT_MpScan.cdxml +++ /dev/null @@ -1,233 +0,0 @@ - - - - 1.0 - MpScan - - - - - - - - - - - - - - - - - - - - - - - - - FullScan - QuickScan - CustomScan - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Defender/MSFT_MpSignature.cdxml b/newton-cn/bin/Modules/Defender/MSFT_MpSignature.cdxml deleted file mode 100644 index a97a324..0000000 --- a/newton-cn/bin/Modules/Defender/MSFT_MpSignature.cdxml +++ /dev/null @@ -1,230 +0,0 @@ - - - - 1.0 - MpSignature - - - - - - - - - - - - - - - - - - - - InternalDefinitionUpdateServer - MicrosoftUpdateServer - MMPC - FileShares - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Defender/MSFT_MpThreat.cdxml b/newton-cn/bin/Modules/Defender/MSFT_MpThreat.cdxml deleted file mode 100644 index ec817d9..0000000 --- a/newton-cn/bin/Modules/Defender/MSFT_MpThreat.cdxml +++ /dev/null @@ -1,218 +0,0 @@ - - - - 1.0 - MpThreat - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Defender/MSFT_MpThreatCatalog.cdxml b/newton-cn/bin/Modules/Defender/MSFT_MpThreatCatalog.cdxml deleted file mode 100644 index b48296d..0000000 --- a/newton-cn/bin/Modules/Defender/MSFT_MpThreatCatalog.cdxml +++ /dev/null @@ -1,205 +0,0 @@ - - - - 1.0 - MpThreatCatalog - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Defender/MSFT_MpThreatDetection.cdxml b/newton-cn/bin/Modules/Defender/MSFT_MpThreatDetection.cdxml deleted file mode 100644 index 8e2d85c..0000000 --- a/newton-cn/bin/Modules/Defender/MSFT_MpThreatDetection.cdxml +++ /dev/null @@ -1,205 +0,0 @@ - - - - 1.0 - MpThreatDetection - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Defender/MSFT_MpWDOScan.cdxml b/newton-cn/bin/Modules/Defender/MSFT_MpWDOScan.cdxml deleted file mode 100644 index 6955cad..0000000 --- a/newton-cn/bin/Modules/Defender/MSFT_MpWDOScan.cdxml +++ /dev/null @@ -1,205 +0,0 @@ - - - - 1.0 - MpWDOScan - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/DeliveryOptimization/DeliveryOptimization.psd1 b/newton-cn/bin/Modules/DeliveryOptimization/DeliveryOptimization.psd1 deleted file mode 100644 index ec077c4..0000000 --- a/newton-cn/bin/Modules/DeliveryOptimization/DeliveryOptimization.psd1 +++ /dev/null @@ -1,28 +0,0 @@ -@{ - GUID = "{B9AF2675-4726-42FD-ADAB-38228176A516}" - Author = "Microsoft Corporation" - CLRVersion = "4.0" - CompanyName = "Microsoft Corporation" - Copyright = "(c) Microsoft Corporation. All rights reserved." - AliasesToExport = @() - FunctionsToExport = "Disable-DeliveryOptimizationVerboseLogs", - "Enable-DeliveryOptimizationVerboseLogs", - "Get-DeliveryOptimizationStatus", - "Get-DeliveryOptimizationPerfSnap", - "Get-DeliveryOptimizationPerfSnapThisMonth", - "Get-DOConfig", - "Get-DODownloadMode", - "Get-DOPercentageMaxForegroundBandwidth", - "Get-DOPercentageMaxBackgroundBandwidth" - CmdletsToExport = "Delete-DeliveryOptimizationCache", - "Set-DeliveryOptimizationStatus", - "Get-DeliveryOptimizationLog", - "Get-DeliveryOptimizationLogAnalysis", - "Set-DODownloadMode", - "Set-DOPercentageMaxForegroundBandwidth", - "Set-DOPercentageMaxBackgroundBandwidth" - PowerShellVersion = '5.1' - ModuleVersion = "1.0.2.0" - NestedModules = @('Microsoft.Windows.DeliveryOptimization.AdminCommands', 'DeliveryOptimizationVerboseLogs.psm1', 'DeliveryOptimizationStatus.psm1') - CompatiblePSEditions = @('Core','Desktop') -} diff --git a/newton-cn/bin/Modules/DeliveryOptimization/DeliveryOptimizationStatus.psm1 b/newton-cn/bin/Modules/DeliveryOptimization/DeliveryOptimizationStatus.psm1 deleted file mode 100644 index 8b09da3..0000000 --- a/newton-cn/bin/Modules/DeliveryOptimization/DeliveryOptimizationStatus.psm1 +++ /dev/null @@ -1,513 +0,0 @@ - -$global:DONamespace = "root/Microsoft/Windows/DeliveryOptimization" - -enum DownloadMode -{ - CdnOnly = 0 - Lan = 1 - Group = 2 - Internet = 3 - Simple = 99 - Bypass = 100 -} - -enum SwarmStatus -{ - Downloading = 0 - Complete - Caching - Paused -} - -enum Priority -{ - Background - Foreground -} - -enum ConfigProvider -{ - RegistryProvider = 5 - MdmProvider = 7 - SettingsProvider # Settings (UX) provider - AdminProvider # Admin provider (powershell, WMI, etc.) - - DefaultProvider = 99 # Also considered as InvalidProvider -} - -enum PeerType -{ - PeerType_none = 0 - PeerType_LAN - PeerType_CDN - PeerType_Internet - PeerType_Group - PeerType_DOINC - PeerType_LocalCache - PeerType_LinkLocal -} - -class DOPeerInfo -{ - [string] $IP; - [PeerType] $PeerType; - [bool] $ConnectionEstablished; - [uint64] $BytesSent; - [uint64] $BytesReceived; - [uint32] $UploadRateBytes; - [uint32] $DownloadRateBytes; -} - -class DOSwarmStats -{ - [string] $FileId - [uint64] $FileSize - [uint64] $FileSizeInCache - [uint64] $TotalBytesDownloaded - [double] $PercentPeerCaching - [uint64] $BytesFromPeers - [uint64] $BytesFromHttp - [SwarmStatus] $Status - [Priority] $Priority - [uint64] $BytesFromCacheServer - [uint64] $BytesFromLanPeers - [uint64] $BytesFromGroupPeers - [uint64] $BytesFromInternetPeers - [uint64] $BytesToLanPeers - [uint64] $BytesToGroupPeers - [uint64] $BytesToInternetPeers - [timespan] $DownloadDuration - [uint32] $HttpConnectionCount - [uint32] $LanConnectionCount - [uint32] $GroupConnectionCount - [uint32] $InternetConnectionCount - [DownloadMode] $DownloadMode - [uri] $SourceURL - [uri] $CacheHost - [uint32] $NumPeers - [string] $PredefinedCallerApplication - [Nullable[datetime]] $ExpireOn - [bool] $IsPinned -} - -class DOFilePeerInfo -{ - [string] $FileId - [DOPeerInfo[]] $PeersInfo -} - -class DOPerfSnap -{ - [uint32] $FilesDownloaded - [uint32] $FilesUploaded - [uint32] $Files - [uint64] $TotalBytesDownloaded - [uint64] $TotalBytesUploaded - [uint64] $AverageDownloadSize - [uint64] $AverageUploadSize - [DownloadMode] $DownloadMode - [uint64] $CacheSizeBytes - [uint64] $TotalDiskBytes - [uint64] $AvailableDiskBytes - [float] $CpuUsagePct - [uint64] $MemUsageKB - [uint32] $NumberOfPeers - [uint32] $CacheHostConnections - [uint32] $CdnConnections - [uint32] $LanConnections - [uint32] $LinkLocalConnections - [uint32] $GroupConnections - [uint32] $InternetConnections - [uint32] $DownlinkBps - [uint32] $DownlinkUsageBps - [uint32] $UplinkBps - [uint32] $UplinkUsageBps - [uint32] $ForegroundDownloadRatePct - [uint32] $BackgroundDownloadRatePct - [uint32] $UploadRatePct - [uint32] $UploadCount - [uint32] $ForegroundDownloadCount - [uint32] $ForegroundDownloadsPending - [uint32] $BackgroundDownloadCount - [uint32] $BackgroundDownloadsPending -} - -class DOMonthlyPerfSnap -{ - [uint64] $UploadLanBytes - [uint64] $UploadInternetBytes - [uint64] $DownloadHttpBytes - [uint64] $DownloadCacheHostBytes - [uint64] $DownloadLanBytes - [uint64] $DownloadInternetBytes - [uint64] $DownloadFgRateKbps - [uint64] $DownloadBgRateKbps - [bool] $UploadLimitReached - [datetime] $MonthStartDate -} - -class DOConfig -{ - [DownloadMode] $DownloadMode - [ConfigProvider] $DownloadModeProvider - [uint32] $DownBackLimitBps - [ConfigProvider] $DownBackLimitBpsProvider - [uint32] $DownloadForegroundLimitBps - [ConfigProvider] $DownloadForegroundLimitBpsProvider - [uint32] $DownBackLimitPct - [ConfigProvider] $DownBackLimitPctProvider - [uint16] $DownloadForegroundLimitPct - [ConfigProvider] $DownloadForegroundLimitPctProvider - [uint16] $MaxUploadRatePct - [ConfigProvider] $MaxUploadRateProvider - [double] $UploadLimitMonthlyGB - [ConfigProvider] $UploadLimitMonthlyGBProvider -} - -class DOExtendedConfig : DOConfig -{ - [uint16] $BatteryPctToSeed - [ConfigProvider] $BatteryPctToSeedProvider - [string] $WorkingDirectory - [ConfigProvider] $WorkingDirectoryProvider - [uint32] $MinTotalDiskSize - [ConfigProvider] $MinTotalDiskSizeProvider - [uint32] $MinTotalRAM - [ConfigProvider] $MinTotalRAMProvider - [bool] $VpnPeerCachingAllowed - [ConfigProvider] $VpnPeerCachingAllowedProvider - [string] $VpnKeywords - [ConfigProvider] $VpnKeywordsProvider -} - -function Get-DeliveryOptimizationStatus -{ - <# - .LINK - https://aka.ms/do-cmdlets - #> - [CmdletBinding()] - [OutputType([DOSwarmStats],[DOFilePeerInfo],[string],[DOPeerInfo])] - Param( - [Parameter(ParameterSetName="PeerInfo")] - [switch] $PeerInfo, - [Parameter(ParameterSetName="PeerInfo")] - [switch] $AsObject, - [Parameter(ParameterSetName="PeerInfo")] - [int] $SelectPeerCount = 5 - ) - - if ($PeerInfo) - { - $swarms = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DeliveryOptimizationFilePeerInfo - foreach ($swarm in $swarms) - { - $doSwarmInfo = [DOFilePeerInfo]@{ - FileId=$swarm.FileId - PeersInfo=@() - } - if ($swarm.IPs) - { - for ($i = 0; $i -lt $swarm.IPs.Length; $i++) - { - $doSwarmInfo.PeersInfo += [DOPeerInfo]@{ - IP=$swarm.IPs[$i] - PeerType=$swarm.PeerTypes[$i] - ConnectionEstablished=$swarm.ConnectionEstablished[$i] - BytesSent=$swarm.BytesSent[$i] - BytesReceived=$swarm.BytesReceived[$i] - UploadRateBytes=$swarm.UploadRates[$i] - DownloadRateBytes=$swarm.DownloadRates[$i] - } - } - $doSwarmInfo.PeersInfo = $($doSwarmInfo.PeersInfo | Sort-Object BytesReceived -Descending)[0..$($SelectPeerCount-1)] - } - if ($AsObject) - { - Write-output $doSwarmInfo - } - else - { - Write-Output $doSwarmInfo.FileId - Write-Output $doSwarmInfo.PeersInfo[0..$($SelectPeerCount-1)] - } - } - } - else - { - $swarms = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DeliveryOptimizationFile - foreach ($swarm in $swarms) - { - $doSwarmStats = [DOSwarmStats]@{ - FileId=$swarm.FileId - FileSize=$swarm.FileSize - FileSizeInCache=$swarm.FileSizeInCache - TotalBytesDownloaded=$swarm.TotalBytesDownloaded - PercentPeerCaching=0 - BytesFromHttp=$swarm.BytesFromHttp - Status=$swarm.Status - BytesFromCacheServer=$swarm.BytesFromCacheServer - BytesFromLanPeers=$swarm.BytesFromLanPeers - BytesFromGroupPeers=$swarm.BytesFromGroupPeers - BytesFromInternetPeers=$swarm.BytesFromInternetPeers - BytesToLanPeers=$swarm.BytesToLanPeers - BytesToGroupPeers=$swarm.BytesToGroupPeers - DownloadDuration=[TimeSpan]::FromMilliseconds($swarm.DownloadDurationMsecs) - HttpConnectionCount=$swarm.HttpConnectionCount - LanConnectionCount=$swarm.LanConnectionCount - GroupConnectionCount=$swarm.GroupConnectionCount - InternetConnectionCount=$swarm.InternetConnectionCount - DownloadMode=$swarm.DownloadMode - SourceURL=$swarm.SourceURL - CacheHost=$swarm.CacheHost - NumPeers=$swarm.PeerCount - PredefinedCallerApplication=$swarm.PredefinedCallerApplication - ExpireOn=$swarm.ExpireOn - IsPinned=$swarm.IsPinned - } - $doSwarmStats.BytesFromPeers = $doSwarmStats.BytesFromLanPeers + $doSwarmStats.BytesFromGroupPeers + $doSwarmStats.BytesFromInternetPeers - if ($doSwarmStats.TotalBytesDownloaded -ne 0) - { - $doSwarmStats.PercentPeerCaching = (100.0 * $doSwarmStats.BytesFromPeers) / $doSwarmStats.TotalBytesDownloaded - } - if ($swarm.IsBackground) - { - $doSwarmStats.Priority = [Priority]::Background - } - else - { - $doSwarmStats.Priority = [Priority]::Foreground - } - Write-Output $doSwarmStats - } - } -} - -function Get-DeliveryOptimizationPerfSnap -{ - <# - .LINK - https://aka.ms/do-cmdlets - #> - [CmdletBinding()] - [OutputType([DOPerfSnap])] - Param() - - $allStats = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DOBaseStatus - $basicConfig = $allStats | where {($_.CimClass).CimClassName -eq "MSFT_DeliveryOptimizationConfig"} - $currentStatus = $allStats | where {($_.CimClass).CimClassName -eq "MSFT_DOCurrentStatus"} - $downloadUsage = $allStats | where {($_.CimClass).CimClassName -eq "MSFT_DODownloadUsage"} - $uploadUsage = $allStats | where {($_.CimClass).CimClassName -eq "MSFT_DOUploadUsage"} - $snapInfo = [DOPerfSnap]@{ - DownloadMode=$basicConfig.DownloadMode - Files=$currentStatus.Swarms - CacheSizeBytes=$currentStatus.CacheSizeBytes - TotalDiskBytes=$currentStatus.DiskTotalBytes - AvailableDiskBytes=$currentStatus.DiskAvailableBytes - CpuUsagePct=$currentStatus.CpuUsagePct - MemUsageKB=$currentStatus.MemUsageKBytes - NumberOfPeers=$currentStatus.PeerInfoCount - CacheHostConnections=$currentStatus.CacheServerConnections - CdnConnections=$currentStatus.CdnConnections - LanConnections=$currentStatus.LanConnections - LinkLocalConnections=$currentStatus.LinkLocalConnections - GroupConnections=$currentStatus.GroupConnections - InternetConnections=$currentStatus.InternetConnections - DownlinkBps=$downloadUsage.LinkBps - DownlinkUsageBps=$downloadUsage.LinkUsageBps - UplinkBps=$uploadUsage.LinkBps - UplinkUsageBps=$uploadUsage.LinkUsageBps - ForegroundDownloadRatePct=$downloadUsage.ForegroundRatePct - BackgroundDownloadRatePct=$downloadUsage.BackgroundRatePct - UploadRatePct=$uploadUsage.UploadRatePct - UploadCount=$uploadUsage.Uploads - ForegroundDownloadCount=$downloadUsage.PriorityDownloads - ForegroundDownloadsPending=$downloadUsage.PriorityDownloadsPending - BackgroundDownloadCount=$downloadUsage.NormalDownloads - BackgroundDownloadsPending=$downloadUsage.NormalDownloadsPending - } - foreach ($swarmStats in (Get-DeliveryOptimizationStatus)) - { - if ($swarmStats.TotalBytesDownloaded -gt 0) - { - $snapInfo.FilesDownloaded++ - $snapInfo.TotalBytesDownloaded += $swarmStats.TotalBytesDownloaded - $bytesToPeers = $swarmStats.BytesToLanPeers + $swarmStats.BytesToGroupPeers + $swarmStats.BytesToInternetPeers - $snapInfo.TotalBytesUploaded += $bytesToPeers - if ($bytesToPeers -gt 0) - { - $snapInfo.FilesUploaded++ - } - } - - if ($snapInfo.FilesDownloaded -gt 0) - { - $snapInfo.AverageDownloadSize = $snapInfo.TotalBytesDownloaded / $snapInfo.FilesDownloaded; - } - - if ($snapInfo.FilesUploaded -gt 0) - { - $snapInfo.AverageUploadSize = $snapInfo.TotalBytesUploaded / $snapInfo.FilesUploaded - } - } - return $snapInfo -} - -function Get-DeliveryOptimizationPerfSnapThisMonth -{ - <# - .LINK - https://aka.ms/do-cmdlets - #> - [CmdletBinding()] - [OutputType([DOMonthlyPerfSnap])] - Param() - - $usage = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DOBaseStatus - $downloadUsage = $usage | where {($_.CimClass).CimClassName -eq "MSFT_DODownloadUsage"} - $uploadUsage = $usage | where {($_.CimClass).CimClassName -eq "MSFT_DOUploadUsage"} - - $snapInfo = [DOMonthlyPerfSnap]@{ - UploadLanBytes=$uploadUsage.MonthlyLanBytes - UploadInternetBytes=$uploadUsage.MonthlyInternetBytes - DownloadHttpBytes=$downloadUsage.MonthlyCdnBytes - DownloadCacheHostBytes=$downloadUsage.MonthlyCacheHostBytes - DownloadLanBytes=$downloadUsage.MonthlyLanBytes - DownloadInternetBytes=$downloadUsage.MonthlyInternetBytes - DownloadFgRateKbps=$downloadUsage.MonthlyFrRateBps * 8 / 1Kb - DownloadBgRateKbps=$downloadUsage.MonthlyBkRateBps * 8 / 1Kb - UploadLimitReached=$false - MonthStartDate=Get-Date -Day 1 -Hour 0 -Minute 0 -Second 0 - } - if ($uploadUsage.MonthlyUploadRestriction -ne 0) - { - $snapInfo.MonthlyUploadLimitReached = $true - } - - return $snapInfo -} - -function Get-DODownloadMode -{ - <# - .LINK - https://aka.ms/do-cmdlets - #> - [CmdletBinding()] - [OutputType([DownloadMode])] - Param() - - $config = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DeliveryOptimizationConfig - return [DownloadMode]($config.DownloadMode) -} - -function Get-DOMaxBackgroundBandwidth -{ - <# - .LINK - https://aka.ms/do-cmdlets - #> - [CmdletBinding()] - [OutputType([uint32])] - Param() - - $config = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DeliveryOptimizationConfig - return $config.DownBackLimitBps -} - -function Get-DOMaxForegroundBandwidth -{ - <# - .LINK - https://aka.ms/do-cmdlets - #> - [CmdletBinding()] - [OutputType([uint32])] - Param() - - $config = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DeliveryOptimizationConfig - return $config.DownForeLimitBps -} - -function Get-DOPercentageMaxBackgroundBandwidth -{ - <# - .LINK - https://aka.ms/do-cmdlets - #> - [CmdletBinding()] - [OutputType([uint8])] - Param() - - $config = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DeliveryOptimizationConfig - return $config.DownBackLimitPct -} - -function Get-DOPercentageMaxForegroundBandwidth -{ - <# - .LINK - https://aka.ms/do-cmdlets - #> - [CmdletBinding()] - [OutputType([uint32])] - Param() - - $config = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DeliveryOptimizationConfig - return $config.DownForeLimitPct -} - -function PopulateBaseConfig([DOConfig] $outConfig) -{ - $config = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DeliveryOptimizationConfig -verbose:$false - $outConfig.DownloadMode = $config.DownloadMode - $outConfig.DownloadModeProvider = $config.DownloadModeProvider - $outConfig.DownBackLimitBps = $config.DownBackLimitBps - $outConfig.DownBackLimitBpsProvider = $config.DownBackLimitBpsProvider - $outConfig.DownloadForegroundLimitBps = $config.DownForeLimitBps - $outConfig.DownloadForegroundLimitBpsProvider = $config.DownForeLimitBpsProvider - $outConfig.DownBackLimitPct = $config.DownBackLimitPct - $outConfig.DownBackLimitPctProvider = $config.DownBackLimitPctProvider - $outConfig.DownloadForegroundLimitPct = $config.DownForeLimitPct - $outConfig.DownloadForegroundLimitPctProvider = $config.DownForeLimitPctProvider - $outConfig.MaxUploadRatePct = $config.MaxUploadRatePct - $outConfig.MaxUploadRateProvider = $config.MaxUploadRateProvider - $outConfig.UploadLimitMonthlyGB = $config.UpLimitMonthlyGB - $outConfig.UploadLimitMonthlyGBProvider = $config.UpLimitMonthlyGBProvider -} - -function Get-DOConfig -{ - <# - .LINK - https://aka.ms/do-cmdlets - #> - [CmdletBinding()] - [OutputType([DOConfig],[DOExtendedConfig])] - Param() - - if ($VerbosePreference -ne "SilentlyContinue") - { - $extendedConfig = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DeliveryOptimizationExtendedConfig -verbose:$false - $config = [DOExtendedConfig]@{ - BatteryPctToSeed=$extendedConfig.BatteryPctToSeed - BatteryPctToSeedProvider=$extendedConfig.BatteryPctToSeedProvider - WorkingDirectory=$extendedConfig.WorkingDirectory - WorkingDirectoryProvider=$extendedConfig.WorkingDirectoryProvider - MinTotalDiskSize=$extendedConfig.MinTotalDiskSize - MinTotalDiskSizeProvider=$extendedConfig.MinTotalDiskSizeProvider - MinTotalRAM=$extendedConfig.MinTotalRAM - MinTotalRAMProvider=$extendedConfig.MinTotalRAMProvider - VpnPeerCachingAllowed=$extendedConfig.VpnPeerCachingAllowed - VpnPeerCachingAllowedProvider=$extendedConfig.VpnPeerCachingAllowedProvider - VpnKeywords=$extendedConfig.VpnKeywords - VpnKeywordsProvider=$extendedConfig.VpnKeywordsProvider - } - } - else - { - $config = [DOConfig]@{} - } - PopulateBaseConfig($config) - return $config -} diff --git a/newton-cn/bin/Modules/DeliveryOptimization/DeliveryOptimizationVerboseLogs.psm1 b/newton-cn/bin/Modules/DeliveryOptimization/DeliveryOptimizationVerboseLogs.psm1 deleted file mode 100644 index a3fda16..0000000 --- a/newton-cn/bin/Modules/DeliveryOptimization/DeliveryOptimizationVerboseLogs.psm1 +++ /dev/null @@ -1,96 +0,0 @@ -$g_traceRegRoot = "HKU:\S-1-5-20\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Trace" - -function VerifyIsAdmin() -{ - $principal = New-Object System.Security.Principal.WindowsPrincipal([System.Security.Principal.WindowsIdentity]::GetCurrent()) - if (!$principal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)) - { - throw "The command must run with Administrator privileges" - } -} - -function AttemptRestartIfNeeded([bool] $Force) -{ - $shouldRestart = $false - $svc = Get-Service dosvc - if ($svc.Status -eq "Running") - { - # We run as admin so we know we can restart the service - if ($Force) - { - $shouldRestart = $true - } - else - { - $input = Read-Host "Do you want to restart Delivery Optimization? (this will interrupt active downloads) [y/n]" - switch ($input) - { - {$_.ToLower() -eq "n"} { Write-Host "Changes will take effect the next time the Delivery Optimization service starts."; return } - {$_.ToLower() -eq "y"} { $shouldRestart = $true; break } - } - } - } - - if ($shouldRestart) - { - Stop-Service dosvc - Start-Service dosvc - } - Write-Host "Changes successfully applied." -} - -function Enable-DeliveryOptimizationVerboseLogs -{ - <# - .LINK - https://aka.ms/do-cmdlets - #> - [CmdletBinding()] - Param ( - [Switch] - $Force = $false - ) - VerifyIsAdmin - New-PSDrive -Name HKU -PSProvider Registry -Root Registry::HKEY_USERS | Out-Null - - if (!$(Test-Path $g_traceRegRoot)) - { - New-Item $g_traceRegRoot | Out-Null - } - - $traceFileSize = 150 * 1000 - $traceFolderSize = 200 * 1000 - Write-Host "Setting Delivery Optimization tracing to Verbose and increasing the log limits..." - New-ItemProperty -Path $g_traceRegRoot -Name "TraceLevel_Override" -PropertyType Dword -Value 5 -Force | out-null - New-ItemProperty -Path $g_traceRegRoot -Name "TraceFileSizeKBytes" -PropertyType Dword -Value $traceFileSize -Force | out-null - New-ItemProperty -Path $g_traceRegRoot -Name "TraceFolderSizeKBytes" -PropertyType Dword -Value $traceFolderSize -Force | out-null - AttemptRestartIfNeeded $Force -} - -function Disable-DeliveryOptimizationVerboseLogs -{ - <# - .LINK - https://aka.ms/do-cmdlets - #> - [CmdletBinding()] - Param ( - [Switch] - $Force = $false - ) - - VerifyIsAdmin - New-PSDrive -Name HKU -PSProvider Registry -Root Registry::HKEY_USERS | Out-Null - - if (!$(Test-Path $g_traceRegRoot)) - { - Write-Host "Verbose logging is already disabled, exiting." - return - } - Write-Host "Disabling Delivery Optimization verbose logging..." - Remove-ItemProperty -Path $g_traceRegRoot -Name "TraceLevel_Override" -Force | out-null - Remove-ItemProperty -Path $g_traceRegRoot -Name "TraceFileSizeKBytes" -Force | out-null - Remove-ItemProperty -Path $g_traceRegRoot -Name "TraceFolderSizeKBytes" -Force | out-null - - AttemptRestartIfNeeded $Force -} diff --git a/newton-cn/bin/Modules/DeliveryOptimization/Microsoft.Windows.DeliveryOptimization.AdminCommands.dll b/newton-cn/bin/Modules/DeliveryOptimization/Microsoft.Windows.DeliveryOptimization.AdminCommands.dll deleted file mode 100644 index 6097c26..0000000 Binary files a/newton-cn/bin/Modules/DeliveryOptimization/Microsoft.Windows.DeliveryOptimization.AdminCommands.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/DirectAccessClientComponents/DirectAccessClientComponents.psd1 b/newton-cn/bin/Modules/DirectAccessClientComponents/DirectAccessClientComponents.psd1 deleted file mode 100644 index 93ff153..0000000 --- a/newton-cn/bin/Modules/DirectAccessClientComponents/DirectAccessClientComponents.psd1 +++ /dev/null @@ -1,17 +0,0 @@ - -@{ - ModuleVersion = '1.0.0.0' - NestedModules = @("MSFT_DASiteTableEntry.cdxml", "MSFT_DAClientExperienceConfiguration.cdxml") - FormatsToProcess = @("MSFT_DASiteTableEntry.format.ps1xml", "MSFT_DAClientExperienceConfiguration.format.ps1xml") - TypesToProcess = @("MSFT_DASiteTableEntry.types.ps1xml", "MSFT_DAClientExperienceConfiguration.types.ps1xml") - HelpInfoUri = "http://go.microsoft.com/fwlink/?LinkID=285546" - GUID = '{244F8FC0-A410-4b87-8237-7496F557E6D4}' - Author = 'Microsoft Corporation' - CompanyName = 'Microsoft Corporation' - PowerShellVersion = '5.1' - Copyright = '© Microsoft Corporation. All rights reserved.' - FunctionsToExport = @("Disable-DAManualEntryPointSelection", "Enable-DAManualEntryPointSelection", "Get-DAClientExperienceConfiguration", "Get-DAEntryPointTableItem", "New-DAEntryPointTableItem", "Remove-DAEntryPointTableItem", "Rename-DAEntryPointTableItem", "Reset-DAClientExperienceConfiguration", "Reset-DAEntryPointTableItem", "Set-DAClientExperienceConfiguration", "Set-DAEntryPointTableItem") - AliasesToExport = @() - CmdletsToExport = @() - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/DirectAccessClientComponents/MSFT_DAClientExperienceConfiguration.cdxml b/newton-cn/bin/Modules/DirectAccessClientComponents/MSFT_DAClientExperienceConfiguration.cdxml deleted file mode 100644 index 5d15f6c..0000000 --- a/newton-cn/bin/Modules/DirectAccessClientComponents/MSFT_DAClientExperienceConfiguration.cdxml +++ /dev/null @@ -1,191 +0,0 @@ - - - - 1.0 - DAClientExperienceConfiguration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/DirectAccessClientComponents/MSFT_DAClientExperienceConfiguration.format.ps1xml b/newton-cn/bin/Modules/DirectAccessClientComponents/MSFT_DAClientExperienceConfiguration.format.ps1xml deleted file mode 100644 index fd6d641..0000000 --- a/newton-cn/bin/Modules/DirectAccessClientComponents/MSFT_DAClientExperienceConfiguration.format.ps1xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - MSFT_DAClientExperienceConfiguration - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_DAClientExperienceConfiguration - - - - - - - Description - - - CorporateResources - - - IPsecTunnelEndpoints - - - CustomCommands - - - PreferLocalNamesAllowed - - - UserInterface - - - PassiveMode - - - SupportEmail - - - FriendlyName - - - ManualEntryPointSelectionAllowed - - - GslbFqdn - - - ForceTunneling - - - - - - - - - diff --git a/newton-cn/bin/Modules/DirectAccessClientComponents/MSFT_DAClientExperienceConfiguration.types.ps1xml b/newton-cn/bin/Modules/DirectAccessClientComponents/MSFT_DAClientExperienceConfiguration.types.ps1xml deleted file mode 100644 index 30b2eb9..0000000 --- a/newton-cn/bin/Modules/DirectAccessClientComponents/MSFT_DAClientExperienceConfiguration.types.ps1xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_DAClientExperienceConfiguration - - - ForceTunneling - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.DAClientExperienceConfiguration.ForceTunneling]($this.PSBase.CimInstanceProperties['ForceTunneling'].Value) - - - $this.PSBase.CimInstanceProperties['ForceTunneling'].Value = [System.UInt32]$_ - - - - - - diff --git a/newton-cn/bin/Modules/DirectAccessClientComponents/MSFT_DASiteTableEntry.cdxml b/newton-cn/bin/Modules/DirectAccessClientComponents/MSFT_DASiteTableEntry.cdxml deleted file mode 100644 index 46ab2c4..0000000 --- a/newton-cn/bin/Modules/DirectAccessClientComponents/MSFT_DASiteTableEntry.cdxml +++ /dev/null @@ -1,333 +0,0 @@ - - - - 1.0 - DAEntryPointTableItem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/DirectAccessClientComponents/MSFT_DASiteTableEntry.format.ps1xml b/newton-cn/bin/Modules/DirectAccessClientComponents/MSFT_DASiteTableEntry.format.ps1xml deleted file mode 100644 index 83faf28..0000000 --- a/newton-cn/bin/Modules/DirectAccessClientComponents/MSFT_DASiteTableEntry.format.ps1xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - MSFT_DASiteTableEntry - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_DASiteTableEntry - Microsoft.Management.Infrastructure.CimInstance#MSFT_DASiteTableEntry - - - - - - - PolicyStore - - - EntryPointName - - - State - - - ADSite - - - TeredoServerIP - - - EntryPointRange - - - EntryPointIPAddress - - - IPHttpsProfile - - - GslbIP - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/DirectAccessClientComponents/MSFT_DASiteTableEntry.types.ps1xml b/newton-cn/bin/Modules/DirectAccessClientComponents/MSFT_DASiteTableEntry.types.ps1xml deleted file mode 100644 index 686c500..0000000 --- a/newton-cn/bin/Modules/DirectAccessClientComponents/MSFT_DASiteTableEntry.types.ps1xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_DASiteTableEntry - - - State - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.DASiteTableEntry.State]($this.PSBase.CimInstanceProperties['State'].Value) - - - $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_DASiteTableEntry - - - State - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.DASiteTableEntry.State]($this.PSBase.CimInstanceProperties['State'].Value) - - - $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ - - - - - - diff --git a/newton-cn/bin/Modules/Dism/Dism.Format.ps1xml b/newton-cn/bin/Modules/Dism/Dism.Format.ps1xml deleted file mode 100644 index d41d4d7..0000000 --- a/newton-cn/bin/Modules/Dism/Dism.Format.ps1xml +++ /dev/null @@ -1,745 +0,0 @@ - - - - BaseDismObjectList - - Microsoft.Dism.Commands.BaseDismObject - - - - - - - LogPath - - - - - - - - ImageObjectList - - Microsoft.Dism.Commands.ImageObject - - - - - - - Path - - - Online - - - RestartNeeded - - - - - - - - ImageObjectWithStateList - - Microsoft.Dism.Commands.ImageObjectWithState - - - - - - - Path - - - Online - - - ImageHealthState - - - RestartNeeded - - - - - - - - EditionObjectList - - Microsoft.Dism.Commands.EditionObject - - - - - - - Edition - - - - - - - - MountedImageInfoObjectList - - Microsoft.Dism.Commands.MountedImageInfoObject - - - - - - - Path - - - ImagePath - - - ImageIndex - - - MountMode - - - MountStatus - - - - - - - - AppxPackageObjectList - - Microsoft.Dism.Commands.AppxPackageObject - - - - - - - DisplayName - - - Version - - - - - $a = "Unknown" - if($_.Architecture -eq 0){ $a="x86" } - elseif($_.Architecture -eq 5) {$a="arm"} - elseif($_.Architecture -eq 9) {$a="x64"} - elseif($_.Architecture -eq 6) {$a="ia64"} - elseif($_.Architecture -eq 11) {$a="neutral"} - return $a - - - - ResourceId - - - PackageName - - - - - $r = "" - if($_.Regions){ $r=$_.Regions } - return $r - - - - - - - - - BasicImageInfoObjectList - - Microsoft.Dism.Commands.BasicImageInfoObject - - - - - - - ImageIndex - - - ImageName - - - ImageDescription - - - - return $_.ImageSize.ToString("N0", [System.Threading.Thread]::CurrentThread.CurrentCulture) + " bytes" - - - - - - - - ImageInfoObjectList - - Microsoft.Dism.Commands.ImageInfoObject - - - - - - - ImageIndex - - - ImageName - - - ImageDescription - - - - return $_.ImageSize.ToString("N0", [System.Threading.Thread]::CurrentThread.CurrentCulture) + " bytes" - - - - - $a = "Unknown" - if($_.Architecture -eq 0){ $a="x86" } - elseif($_.Architecture -eq 5) {$a="arm"} - elseif($_.Architecture -eq 9) {$a="x64"} - elseif($_.Architecture -eq 6) {$a="ia64"} - return $a - - - - Hal - - - Version - - - SPBuild - - - SPLevel - - - EditionId - - - InstallationType - - - ProductType - - - ProductSuite - - - SystemRoot - - - - - $out = "" - $i=0 - foreach($a in $_.Languages) { - $out = $out + $a - if($i -eq $_.DefaultLanguageIndex) { $out=$out+" (Default)"} - if($i -lt ($_.Languages.count-1)) {$out=$out+"`r`n"} - $i=$i+1 - } - return $out; - - - - - - - - - WimImageInfoObjectList - - Microsoft.Dism.Commands.WimImageInfoObject - - - - - - - ImageIndex - - - ImageName - - - ImageDescription - - - - return $_.ImageSize.ToString("N0", [System.Threading.Thread]::CurrentThread.CurrentCulture) + " bytes" - - - WIMBoot - - - - - $a = "Unknown" - if($_.Architecture -eq 0){ $a="x86" } - elseif($_.Architecture -eq 5) {$a="arm"} - elseif($_.Architecture -eq 9) {$a="x64"} - elseif($_.Architecture -eq 6) {$a="ia64"} - return $a - - - - Hal - - - Version - - - SPBuild - - - SPLevel - - - EditionId - - - InstallationType - - - ProductType - - - ProductSuite - - - SystemRoot - - - DirectoryCount - - - FileCount - - - CreatedTime - - - ModifiedTime - - - - - $out = "" - $i=0 - foreach($a in $_.Languages) { - $out = $out + $a - if($i -eq $_.DefaultLanguageIndex) { $out=$out+" (Default)"} - if($i -lt ($_.Languages.count-1)) {$out=$out+"`r`n"} - $i=$i+1 - } - return $out; - - - - - - - - - BasicFeatureObjectList - - Microsoft.Dism.Commands.BasicFeatureObject - - - - - - - FeatureName - - - State - - - - - - - - AdvancedFeatureObjectList - - Microsoft.Dism.Commands.AdvancedFeatureObject - - - - - - - FeatureName - - - DisplayName - - - Description - - - RestartRequired - - - State - - - - - $a = "`r`n" - $_.CustomProperties | foreach { $a = $a + $_.Path + "\" + $_.Name + " : " + $_.Value + "`r`n" } - return $a - - - - - - - - - BasicPackageObjectList - - Microsoft.Dism.Commands.BasicPackageObject - - - - - - - PackageName - - - PackageState - - - ReleaseType - - - - - if ([System.DateTime]::Equals($_.InstallTime,[System.DateTime]::MinValue)) { return "" } else { return $_.InstallTime } - - - - - - - - - AdvancedPackageObjectList - - Microsoft.Dism.Commands.AdvancedPackageObject - - - - - - - PackageName - - - Applicable - - - Copyright - - - Company - - - - - if ([System.DateTime]::Equals($_.CreationTime,[System.DateTime]::MinValue)) { return "" } else { return $_.CreationTime } - - - - Description - - - InstallClient - - - InstallPackageName - - - - - if ([System.DateTime]::Equals($_.InstallTime,[System.DateTime]::MinValue)) { return "" } else { return $_.InstallTime } - - - - - - if ([System.DateTime]::Equals($_.LastUpdateTime,[System.DateTime]::MinValue)) { return "" } else { return $_.LastUpdateTime } - - - - DisplayName - - - ProductName - - - ProductVersion - - - ReleaseType - - - RestartRequired - - - SupportInformation - - - PackageState - - - CompletelyOfflineCapable - - - CapabilityId - - - - - $a = "`r`n" - $_.CustomProperties | foreach { $a = $a + $_.Path + "\" + $_.Name + " : " + $_.Value + "`r`n" } - return $a - - - - Features - - - - - - - - BasicCapabilityObjectList - - Microsoft.Dism.Commands.BasicCapabilityObject - - - - - - - Name - - - State - - - - - - - - AdvancedCapabilityObjectList - - Microsoft.Dism.Commands.AdvancedCapabilityObject - - - - - - - Name - - - State - - - DisplayName - - - Description - - - DownloadSize - - - InstallSize - - - - - - - - BasicDriverObjectList - - Microsoft.Dism.Commands.BasicDriverObject - - - - - - - Driver - - - OriginalFileName - - - InBox - - - ClassName - - - BootCritical - - - ProviderName - - - - - if ([System.DateTime]::Equals($_.Date,[System.DateTime]::MinValue)) { return "" } else { return $_.Date } - - - - Version - - - - - - - - AdvancedDriverObjectList - - Microsoft.Dism.Commands.AdvancedDriverObject - - - - - - - Driver - - - OriginalFileName - - - InBox - - - ClassName - - - ClassDescription - - - ClassGuid - - - BootCritical - - - ProviderName - - - - - if ([System.DateTime]::Equals($_.Date,[System.DateTime]::MinValue)) { return "" } else { return $_.Date } - - - - Version - - - ManufacturerName - - - HardwareDescription - - - - - $a = "Unknown" - if($_.Architecture -eq 0){ $a="x86" } - elseif($_.Architecture -eq 5) {$a="arm"} - elseif($_.Architecture -eq 9) {$a="x64"} - elseif($_.Architecture -eq 6) {$a="ia64"} - return $a - - - - HardwareId - - - ServiceName - - - CompatibleIds - - - ExcludeIds - - - - - - - - WimBootEntryObjectList - - Microsoft.Dism.Commands.WimBootEntryObject - - - - - - - DataSourceID - - - ImageFile - - - - - - - - ReservedStorageStateObjectList - - Microsoft.Dism.Commands.ReservedStorageStateObject - - - - - - - ReservedStorageState - - - - - - - - diff --git a/newton-cn/bin/Modules/Dism/Dism.Types.ps1xml b/newton-cn/bin/Modules/Dism/Dism.Types.ps1xml deleted file mode 100644 index 4b2802b..0000000 --- a/newton-cn/bin/Modules/Dism/Dism.Types.ps1xml +++ /dev/null @@ -1,586 +0,0 @@ - - - - Microsoft.Dism.Commands.BasicImageInfoObject - - - PsStandardMembers - - - DefaultDisplayProperty - ImagePath - - - DefaultDisplayPropertySet - - ImagePath - ImageName - ImageIndex - ImageDescription - ImageSize - - - - DefaultKeyPropertySet - - ImagePath - - - - - - - - Microsoft.Dism.Commands.ImageInfoObject - - - Version - "{0}.{1}.{2}.{3}" -f $this.MajorVersion, $this.MinorVersion, $this.Build, $this.SPBuild - - - PsStandardMembers - - - DefaultDisplayProperty - ImagePath - - - DefaultDisplayPropertySet - - ImagePath - ImageName - ImageIndex - ImageDescription - ImageSize - Architecture - ProductName - EditionId - InstallationType - Hal - ProductType - ProductSuite - Version - SPLevel - SystemRoot - Languages - DefaultLanguageIndex - - - - DefaultKeyPropertySet - - ImagePath - - - - - - - - Microsoft.Dism.Commands.WimImageInfoObject - - - Version - "{0}.{1}.{2}.{3}" -f $this.MajorVersion, $this.MinorVersion, $this.Build, $this.SPBuild - - - PsStandardMembers - - - DefaultDisplayProperty - ImagePath - - - DefaultDisplayPropertySet - - ImagePath - ImageName - ImageIndex - ImageDescription - ImageSize - WIMBoot - Architecture - ProductName - EditionId - InstallationType - Hal - ProductType - ProductSuite - Version - SPLevel - SystemRoot - Languages - DefaultLanguageIndex - DirectoryCount - FileCount - CreatedTime - ModifiedTime - - - - DefaultKeyPropertySet - - ImagePath - - - - - - - - Microsoft.Dism.Commands.ImageObject - - - PsStandardMembers - - - DefaultDisplayProperty - Path - - - DefaultDisplayPropertySet - - Path - Online - - - - DefaultKeyPropertySet - - Path - - - - - - - - Microsoft.Dism.Commands.MountedImageInfoObject - - - MountPath - Path - - - PsStandardMembers - - - DefaultDisplayProperty - MountPath - - - DefaultDisplayPropertySet - - MountPath - ImagePath - ImageIndex - MountMode - MountStatus - - - - DefaultKeyPropertySet - - MountPath - - - - - - - - Microsoft.Dism.Commands.BasicPackageObject - - - PsStandardMembers - - - DefaultDisplayProperty - PackageName - - - DefaultDisplayPropertySet - - PackageName - PackageState - ReleaseType - InstallTime - - - - DefaultKeyPropertySet - - PackageName - - - - - - - - Microsoft.Dism.Commands.BasicCapabilityObject - - - PsStandardMembers - - - DefaultDisplayProperty - Name - - - DefaultDisplayPropertySet - - Name - State - - - - DefaultKeyPropertySet - - Name - - - - - - - - Microsoft.Dism.Commands.AdvancedPackageObject - - - PsStandardMembers - - - DefaultDisplayProperty - PackageName - - - DefaultDisplayPropertySet - - PackageName - PackageState - ReleaseType - InstallTime - Applicable - Copyright - Company - CreationTime - DisplayName - Description - InstallClient - InstallPackageName - LastUpdateTime - ProductName - ProductVersion - RestartRequired - CompletelyOfflineCapable - CapabilityId - SupportInformation - CustomProperties - Features - - - - DefaultKeyPropertySet - - PackageName - - - - - - - - Microsoft.Dism.Commands.AdvancedCapabilityObject - - - PsStandardMembers - - - DefaultDisplayProperty - Name - - - DefaultDisplayPropertySet - - Name - State - DisplayName - Description - DownloadSize - InstallSize - - - - DefaultKeyPropertySet - - Name - - - - - - - - Microsoft.Dism.Commands.ImageObjectWithState - - - PsStandardMembers - - - DefaultDisplayProperty - ImageHealthState - - - DefaultDisplayPropertySet - - ImageHealthState - - - - DefaultKeyPropertySet - - ImageHealthState - - - - - - - - Microsoft.Dism.Commands.BasicFeatureObject - - - PsStandardMembers - - - DefaultDisplayProperty - FeatureName - - - DefaultDisplayPropertySet - - FeatureName - State - - - - DefaultKeyPropertySet - - FeatureName - - - - - - - - Microsoft.Dism.Commands.AdvancedFeatureObject - - - PsStandardMembers - - - DefaultDisplayProperty - FeatureName - - - DefaultDisplayPropertySet - - FeatureName - State - DisplayName - Description - RestartRequired - CustomProperties - - - - DefaultKeyPropertySet - - FeatureName - - - - - - - - Microsoft.Dism.Commands.EditionObject - - - PsStandardMembers - - - DefaultDisplayProperty - Edition - - - DefaultDisplayPropertySet - - Edition - - - - DefaultKeyPropertySet - - Edition - - - - - - - - Microsoft.Dism.Commands.BasicDriverObject - - - Version - "{0}.{1}.{2}.{3}" -f $this.MajorVersion, $this.MinorVersion, $this.Build, $this.Revision - - - PsStandardMembers - - - DefaultDisplayProperty - Driver - - - DefaultDisplayPropertySet - - Driver - OriginalFileName - InBox - CatalogFile - ClassName - ClassGuid - ClassDescription - BootCritical - DriverSignature - ProviderName - Date - Version - - - - DefaultKeyPropertySet - - Driver - - - - - - - - Microsoft.Dism.Commands.AdvancedDriverObject - - - Version - "{0}.{1}.{2}.{3}" -f $this.MajorVersion, $this.MinorVersion, $this.Build, $this.Revision - - - PsStandardMembers - - - DefaultDisplayProperty - Driver - - - DefaultDisplayPropertySet - - Driver - OriginalFileName - InBox - CatalogFile - ClassName - ClassGuid - ClassDescription - BootCritical - DriverSignature - ProviderName - Date - Version - ManufacturerName - HardwareDescription - HardwareId - Architecture - ServiceName - CompatibleIds - ExcludeIds - - - - DefaultKeyPropertySet - - Driver - - - - - - - - Microsoft.Dism.Commands.AppxPackageObject - - - Version - "{0}.{1}.{2}.{3}" -f $this.MajorVersion, $this.MinorVersion, $this.Build, $this.Revision - - - PsStandardMembers - - - DefaultDisplayProperty - DisplayName - - - DefaultDisplayPropertySet - - DisplayName - PackageName - PublisherId - Version - Architecture - ResourceId - InstallLocation - Region - - - - DefaultKeyPropertySet - - DisplayName - - - - - - - - Microsoft.Dism.Commands.ReservedStorageStateObject - - - PsStandardMembers - - - DefaultDisplayProperty - ReservedStorageState - - - DefaultDisplayPropertySet - - ReservedStorageState - - - - DefaultKeyPropertySet - - ReservedStorageState - - - - - - - diff --git a/newton-cn/bin/Modules/Dism/Dism.psd1 b/newton-cn/bin/Modules/Dism/Dism.psd1 deleted file mode 100644 index 896d5aa..0000000 --- a/newton-cn/bin/Modules/Dism/Dism.psd1 +++ /dev/null @@ -1,86 +0,0 @@ -@{ - GUID = "{389c464d-8b8d-48e9-aafe-6d8a590d6798}" - Author = "Microsoft Corporation" - CompanyName = "Microsoft Corporation" - Copyright = "© Microsoft Corporation. All rights reserved." - HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=390767" - ModuleVersion = "3.0" - PowerShellVersion = "5.1" - ClrVersion = "4.0" - RootModule = "Dism.psm1" - NestedModules = "Microsoft.Dism.PowerShell.dll" - TypesToProcess = "Dism.Types.ps1xml" - FormatsToProcess = "Dism.Format.ps1xml" - CmdletsToExport = @( - 'Add-AppxProvisionedPackage', - 'Add-WindowsDriver', - 'Add-WindowsCapability', - 'Add-WindowsImage', - 'Add-WindowsPackage', - 'Clear-WindowsCorruptMountPoint', - 'Disable-WindowsOptionalFeature', - 'Dismount-WindowsImage', - 'Enable-WindowsOptionalFeature', - 'Expand-WindowsImage', - 'Expand-WindowsCustomDataImage', - 'Export-WindowsCapabilitySource', - 'Export-WindowsDriver', - 'Export-WindowsImage', - 'Get-AppxProvisionedPackage', - 'Get-NonRemovableAppsPolicy', - 'Get-WIMBootEntry', - 'Get-WindowsDriver', - 'Get-WindowsEdition', - 'Get-WindowsCapability', - 'Get-WindowsImage', - 'Get-WindowsImageContent' - 'Get-WindowsOptionalFeature', - 'Get-WindowsPackage', - 'Get-WindowsReservedStorageState', - 'Mount-WindowsImage', - 'New-WindowsImage', - 'New-WindowsCustomImage', - 'Optimize-AppxProvisionedPackages', - 'Optimize-WindowsImage', - 'Remove-AppxProvisionedPackage', - 'Remove-WindowsDriver', - 'Remove-WindowsCapability', - 'Remove-WindowsImage', - 'Remove-WindowsPackage', - 'Repair-WindowsImage', - 'Save-WindowsImage', - 'Set-AppXProvisionedDataFile', - 'Set-NonRemovableAppsPolicy', - 'Set-WindowsEdition', - 'Set-WindowsProductKey', - 'Set-WindowsReservedStorageState', - 'Start-OSUninstall', - 'Split-WindowsImage', - 'Use-WindowsUnattend', - 'Update-WIMBootEntry' - ) - AliasesToExport = @( - 'Apply-WindowsUnattend', - 'Add-ProvisionedAppxPackage', - 'Remove-ProvisionedAppxPackage', - 'Get-ProvisionedAppxPackage', - 'Optimize-ProvisionedAppxPackages', - 'Set-ProvisionedAppXDataFile', - 'Add-AppProvisionedPackage', - 'Remove-AppProvisionedPackage', - 'Get-AppProvisionedPackage', - 'Optimize-AppProvisionedPackages', - 'Set-AppPackageProvisionedDataFile', - 'Add-ProvisionedAppPackage', - 'Remove-ProvisionedAppPackage', - 'Get-ProvisionedAppPackage', - 'Optimize-ProvisionedAppPackages', - 'Set-ProvisionedAppPackageDataFile' - ) - FunctionsToExport = @( - ) - CompatiblePSEditions = @( - 'Desktop', - 'Core' - ) -} diff --git a/newton-cn/bin/Modules/Dism/Dism.psm1 b/newton-cn/bin/Modules/Dism/Dism.psm1 deleted file mode 100644 index de2b93d..0000000 --- a/newton-cn/bin/Modules/Dism/Dism.psm1 +++ /dev/null @@ -1,30 +0,0 @@ -# -# Script Module file for Dism module. -# -# Copyright (c) Microsoft Corporation -# - -# -# Cmdlet aliases -# - -Set-Alias Apply-WindowsUnattend Use-WindowsUnattend -Set-Alias Add-ProvisionedAppxPackage Add-AppxProvisionedPackage -Set-Alias Remove-ProvisionedAppxPackage Remove-AppxProvisionedPackage -Set-Alias Get-ProvisionedAppxPackage Get-AppxProvisionedPackage -Set-Alias Optimize-ProvisionedAppxPackages Optimize-AppxProvisionedPackages -Set-Alias Set-ProvisionedAppXDataFile Set-AppXProvisionedDataFile - -# Below are aliases for Appx related cmdlets and aliases -Set-Alias Add-AppProvisionedPackage Add-AppxProvisionedPackage -Set-Alias Remove-AppProvisionedPackage Remove-AppxProvisionedPackage -Set-Alias Get-AppProvisionedPackage Get-AppxProvisionedPackage -Set-Alias Optimize-AppProvisionedPackages Optimize-AppxProvisionedPackages -Set-Alias Set-AppPackageProvisionedDataFile Set-AppXProvisionedDataFile -Set-Alias Add-ProvisionedAppPackage Add-AppxProvisionedPackage -Set-Alias Remove-ProvisionedAppPackage Remove-AppxProvisionedPackage -Set-Alias Get-ProvisionedAppPackage Get-AppxProvisionedPackage -Set-Alias Optimize-ProvisionedAppPackages Optimize-AppxProvisionedPackages -Set-Alias Set-ProvisionedAppPackageDataFile Set-AppXProvisionedDataFile - -Export-ModuleMember -Alias * -Function * -Cmdlet * diff --git a/newton-cn/bin/Modules/Dism/Microsoft.Dism.PowerShell.dll b/newton-cn/bin/Modules/Dism/Microsoft.Dism.PowerShell.dll deleted file mode 100644 index c85582e..0000000 Binary files a/newton-cn/bin/Modules/Dism/Microsoft.Dism.PowerShell.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/Dism/ko/Microsoft.Dism.Powershell.Resources.dll b/newton-cn/bin/Modules/Dism/ko/Microsoft.Dism.Powershell.Resources.dll deleted file mode 100644 index 43797b7..0000000 Binary files a/newton-cn/bin/Modules/Dism/ko/Microsoft.Dism.Powershell.Resources.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/DnsClient/DnsClient.psd1 b/newton-cn/bin/Modules/DnsClient/DnsClient.psd1 deleted file mode 100644 index 680938c..0000000 --- a/newton-cn/bin/Modules/DnsClient/DnsClient.psd1 +++ /dev/null @@ -1,53 +0,0 @@ -@{ - GUID = "5696d5ef-fa2d-4997-94f1-0bc13daa2ac5" - Author = "Microsoft Corporation" - CompanyName = "Microsoft Corporation" - Copyright = "© Microsoft Corporation. All rights reserved." - ModuleVersion = "1.0.0.0" - PowerShellVersion = '5.1' - ClrVersion = "4.0" - NestedModules = @( - "dnslookup", - "MSFT_DnsClient.cdxml", - "MSFT_DnsClientCache.cdxml", - "MSFT_DnsClientGlobalSetting.cdxml", - "MSFT_DnsClientServerAddress.cdxml", - "PS_DnsClientNrptPolicy_v1.0.0.cdxml", - "PS_DnsClientNRPTGlobal_v1.0.0.cdxml", - "PS_DnsClientNRPTRule_v1.0.0.cdxml" - ) - TypesToProcess = @( - "DnsCmdlets.Types.ps1xml", - "DnsConfig.Types.ps1xml", - "DnsClientPSProvider.Types.ps1xml" - ) - FormatsToProcess = @( - "DnsCmdlets.Format.ps1xml", - "DnsConfig.Format.ps1xml", - "DnsClientPSProvider.Format.ps1xml" - ) - CmdletsToExport = @( - "Resolve-DnsName" - ) - FunctionsToExport = @( - "Clear-DnsClientCache", - "Get-DnsClient", - "Get-DnsClientCache", - "Get-DnsClientGlobalSetting", - "Get-DnsClientServerAddress", - "Register-DnsClient", - "Set-DnsClient", - "Set-DnsClientGlobalSetting", - "Set-DnsClientServerAddress", - "Add-DnsClientNrptRule", - "Get-DnsClientNrptPolicy", - "Get-DnsClientNrptGlobal", - "Get-DnsClientNrptRule", - "Remove-DnsClientNrptRule", - "Set-DnsClientNrptGlobal", - "Set-DnsClientNrptRule" - ) - AliasesToExport = @() - HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=390768" - CompatiblePSEditions = @('Desktop','Core') -} diff --git a/newton-cn/bin/Modules/DnsClient/DnsClientPSProvider.Format.ps1xml b/newton-cn/bin/Modules/DnsClient/DnsClientPSProvider.Format.ps1xml deleted file mode 100644 index cd26b7b..0000000 --- a/newton-cn/bin/Modules/DnsClient/DnsClientPSProvider.Format.ps1xml +++ /dev/null @@ -1,350 +0,0 @@ - - - - - - - - DnsClientNRPTRule_ListView - - Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule - - - - - - - Name - - - Version - - - Namespace - - - IPsecCARestriction - - - DirectAccessDnsServers - - - DirectAccessEnabled - - - DirectAccessProxyType - - - DirectAccessProxyName - - - DirectAccessQueryIPsecEncryption - - - DirectAccessQueryIPsecRequired - - - NameServers - - - DnsSecEnabled - - - DnsSecQueryIPsecEncryption - - - DnsSecQueryIPsecRequired - - - DnsSecValidationRequired - - - NameEncoding - - - DisplayName - - - Comment - - - - - - - - DnsClientNRPTRule_TableView - - Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule - - - - - - 25 - - - - 6 - - - - 30 - - - - 6 - - - - 35 - - - - 20 - - - - - - - Namespace - - - DirectAccessEnabled - - - DirectAccessDnsServers - - - DnsSecEnabled - - - NameServers - - - NameEncoding - - - - - - - - DnsClientNRPTRule_WideView - - Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule - - - - - - Namespace - - - - - - - - - DnsClientNRPTGlobal_TableView - - Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptGlobal - - - - - - - - - EnableDAForAllNetworks - - - QueryPolicy - - - SecureNameQueryFallback - - - - - - - - - DnsClientNRPTGlobal_ListView - - Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptGlobal - - - - - - - EnableDAForAllNetworks - - - QueryPolicy - - - SecureNameQueryFallback - - - - - - - - - DnsClientPolicyConfiguration_ListView - - Microsoft.Management.Infrastructure.CimInstance#DnsClientPolicyConfiguration - - - - - - - Namespace - - - QueryPolicy - - - SecureNameQueryFallback - - - DirectAccessIPsecCARestriction - - - DirectAccessProxyName - - - DirectAccessDnsServers - - - DirectAccessEnabled - - - DirectAccessProxyType - - - DirectAccessQueryIPsecEncryption - - - DirectAccessQueryIPsecRequired - - - NameServers - - - DnsSecIPsecCARestriction - - - DnsSecQueryIPsecEncryption - - - DnsSecQueryIPsecRequired - - - DnsSecValidationRequired - - - NameEncoding - - - - - - - - DnsClientPolicyConfiguration_TableView - - Microsoft.Management.Infrastructure.CimInstance#DnsClientPolicyConfiguration - - - - - - 25 - - - - 6 - - - - 30 - - - - 6 - - - - 35 - - - - 20 - - - - - - - Namespace - - - DirectAccessEnabled - - - DirectAccessDnsServers - - - DnsSecValidationRequired - - - NameServers - - - NameEncoding - - - - - - - - DnsClientPolicyConfiguration_WideView - - Microsoft.Management.Infrastructure.CimInstance#DnsClientPolicyConfiguration - - - - - - Namespace - - - - - - - diff --git a/newton-cn/bin/Modules/DnsClient/DnsClientPSProvider.Types.ps1xml b/newton-cn/bin/Modules/DnsClient/DnsClientPSProvider.Types.ps1xml deleted file mode 100644 index 7f844e2..0000000 --- a/newton-cn/bin/Modules/DnsClient/DnsClientPSProvider.Types.ps1xml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule - - - DA - DirectAccessEnabled - - - DADnsServers - DirectAccessDnsServers - - - DnsSec - DnsSecEnabled - - - DirectAccessDnsServers - - [OutputType([System.Net.IPAddress[]])] - param() - [System.Net.IPAddress[]]($this.PSBase.CimInstanceProperties['DirectAccessDnsServers'].Value) - - - param([System.Net.IPAddress[]]$value) - $this.PSBase.CimInstanceProperties['DirectAccessDnsServers'].Value = [System.String[]]$value - - - - NameServers - - [OutputType([System.Net.IPAddress[]])] - param() - [System.Net.IPAddress[]]($this.PSBase.CimInstanceProperties['NameServers'].Value) - - - param([System.Net.IPAddress[]]$value) - $this.PSBase.CimInstanceProperties['NameServers'].Value = [System.String[]]$value - - - - - - Microsoft.Management.Infrastructure.CimInstance#DnsClientPolicyConfiguration - - - DA - DirectAccessEnabled - - - DADnsServers - DirectAccessDnsServers - - - DnsSec - DnsSecValidationRequired - - - DirectAccessDnsServers - - [OutputType([System.Net.IPAddress[]])] - param() - [System.Net.IPAddress[]]($this.PSBase.CimInstanceProperties['DirectAccessDnsServers'].Value) - - - param([System.Net.IPAddress[]]$value) - $this.PSBase.CimInstanceProperties['DirectAccessDnsServers'].Value = [System.String[]]$value - - - - NameServers - - [OutputType([System.Net.IPAddress[]])] - param() - [System.Net.IPAddress[]]($this.PSBase.CimInstanceProperties['NameServers'].Value) - - - param([System.Net.IPAddress[]]$value) - $this.PSBase.CimInstanceProperties['NameServers'].Value = [System.String[]]$value - - - - - diff --git a/newton-cn/bin/Modules/DnsClient/DnsCmdlets.Format.ps1xml b/newton-cn/bin/Modules/DnsClient/DnsCmdlets.Format.ps1xml deleted file mode 100644 index b9da15f..0000000 --- a/newton-cn/bin/Modules/DnsClient/DnsCmdlets.Format.ps1xml +++ /dev/null @@ -1,1748 +0,0 @@ - - - - - - Microsoft.DnsClient.Commands.DnsRecord - - Microsoft.DnsClient.Commands.DnsRecord - - - - - - - left - - - - 6 - left - - - - 5 - left - - - - 10 - left - - - - - - - - Name - - - Type - - - TTL - - - Section - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord - - Microsoft.DnsClient.Commands.DnsRecord - - - - - - - Name - - - - Type - - - TTL - - - DataLength - - - Section - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_A_AAAA - - Microsoft.DnsClient.Commands.DnsRecord_A - Microsoft.DnsClient.Commands.DnsRecord_AAAA - - - - - - - 46 - left - - - - 6 - left - - - - 5 - left - - - - 10 - left - - - - 41 - left - - - - - - - - Name - - - Type - - - TTL - - - Section - - - IPAddress - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_A_AAAA - - Microsoft.DnsClient.Commands.DnsRecord_A - Microsoft.DnsClient.Commands.DnsRecord_AAAA - - - - - - - Name - - - - Type - - - TTL - - - DataLength - - - Section - - - IPAddress - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_PTR - - Microsoft.DnsClient.Commands.DnsRecord_PTR - - - - - - 30 - left - - - - 6 - left - - - - 5 - left - - - - 10 - left - - - - - left - - - - - - - - Name - - - Type - - - TTL - - - Section - - - NameHost - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_PTR - - Microsoft.DnsClient.Commands.DnsRecord_PTR - - - - - - - Name - - - - Type - - - TTL - - - Section - - - NameHost - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_MX - - Microsoft.DnsClient.Commands.DnsRecord_MX - - - - - - 40 - left - - - - 6 - left - - - - 5 - left - - - - 10 - left - - - - 41 - left - - - - 41 - left - - - - - - - - Name - - - Type - - - TTL - - - Section - - - NameExchange - - - Preference - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_MX - - Microsoft.DnsClient.Commands.DnsRecord_MX - - - - - - - Name - - - - Type - - - TTL - - - NameExchange - - - Preference - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_SOA - - Microsoft.DnsClient.Commands.DnsRecord_SOA - - - - - - 27 - left - - - - 4 - left - - - - 5 - left - - - - 10 - left - - - - 27 - left - - - - 27 - left - - - - 12 - left - - - - - - - - Name - - - Type - - - TTL - - - Section - - - PrimaryServer - - - NameAdministrator - - - SerialNumber - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_SOA - - Microsoft.DnsClient.Commands.DnsRecord_SOA - - - - - - - Name - - - - Type - - - TTL - - - PrimaryServer - - - NameAdministrator - - - SerialNumber - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_MINFO - - Microsoft.DnsClient.Commands.DnsRecord_MINFO - - - - - - 40 - left - - - - 6 - left - - - - 5 - left - - - - 10 - left - - - - 20 - left - - - - 20 - left - - - - - - - - Name - - - Type - - - TTL - - - Section - - - NameMailbox - - - NameErrorsMailbox - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_MINFO - - Microsoft.DnsClient.Commands.DnsRecord_MINFO - - - - - - - Name - - - - Type - - - TTL - - - NameMailbox - - - NameErrorsMailbox - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_TXT - - Microsoft.DnsClient.Commands.DnsRecord_TXT - - - - - - 40 - left - - - - 6 - left - - - - 5 - left - - - - 10 - left - - - - 41 - left - - - - - - - - Name - - - Type - - - TTL - - - Section - - - Strings - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_TXT - - Microsoft.DnsClient.Commands.DnsRecord_TXT - - - - - - - Name - - - - Type - - - TTL - - - Strings - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_NULL - - Microsoft.DnsClient.Commands.DnsRecord_NULL - - - - - - 40 - left - - - - 6 - left - - - - 5 - left - - - - 10 - left - - - - 41 - left - - - - - - - - Name - - - Type - - - TTL - - - Section - - - Data - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_NULL - - Microsoft.DnsClient.Commands.DnsRecord_NULL - - - - - - - Name - - - - Type - - - TTL - - - Data - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_WKS - - Microsoft.DnsClient.Commands.DnsRecord_WKS - - - - - - 40 - left - - - - 6 - left - - - - 5 - left - - - - 10 - left - - - - 16 - left - - - - 8 - left - - - - left - - - - - - - - Name - - - Type - - - TTL - - - Section - - - IP4Address - - - Protocol - - - Bitmask - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_WKS - - Microsoft.DnsClient.Commands.DnsRecord_WKS - - - - - - - Name - - - - Type - - - TTL - - - IP4Address - - - Protocol - - - - - $output = "{" - $_.Bitmask | foreach { $output = $output + $_ + ", " } - $output = $output.TrimEnd(", ") + "}" - echo $output - - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_SRV - - Microsoft.DnsClient.Commands.DnsRecord_SRV - - - - - - 40 - left - - - - 6 - left - - - - 5 - left - - - - 10 - left - - - - 30 - left - - - - 8 - left - - - - 6 - left - - - - 4 - left - - - - - - - - Name - - - Type - - - TTL - - - Section - - - NameTarget - - - Priority - - - Weight - - - Port - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_SRV - - Microsoft.DnsClient.Commands.DnsRecord_SRV - - - - - - - Name - - - - Type - - - TTL - - - NameTarget - - - Priority - - - Weight - - - Port - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_DS - - Microsoft.DnsClient.Commands.DnsRecord_DS - - - - - - 40 - left - - - - 6 - left - - - - 5 - left - - - - 10 - left - - - - 5 - left - - - - 14 - left - - - - 4 - left - - - - left - - - - - - - Name - - - Type - - - TTL - - - Section - - - KeyTag - - - Algorithm - - - DType - - - Digest - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_DS - - Microsoft.DnsClient.Commands.DnsRecord_DS - - - - - - - Name - - - - Type - - - TTL - - - Section - - - KeyTag - - - Algorithm - - - DType - - - Digest - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_WINS - - Microsoft.DnsClient.Commands.DnsRecord_WINS - - - - - - 40 - left - - - - 6 - left - - - - 5 - left - - - - 10 - left - - - - 11 - left - - - - left - - - - - - - - Name - - - Type - - - TTL - - - Section - - - MappingFlag - - - IP4Addresses - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_WINS - - Microsoft.DnsClient.Commands.DnsRecord_WINS - - - - - - - Name - - - - Type - - - TTL - - - MappingFlag - - - LookupTimeout - - - CacheTimeout - - - - - $output = "{" - $_.IP4Addresses | foreach { $output = $output + $_ + ", " } - $output = $output.TrimEnd(", ") + "}" - echo $output - - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_DNSKEY - - Microsoft.DnsClient.Commands.DnsRecord_DNSKEY - - - - - - 40 - left - - - - 6 - left - - - - 5 - left - - - - 10 - left - - - - 6 - left - - - - 8 - left - - - - 14 - left - - - - 20 - left - - - - - - - - Name - - - Type - - - TTL - - - Section - - - Flags - - - Protocol - - - Algorithm - - - Key - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_DNSKEY - - Microsoft.DnsClient.Commands.DnsRecord_DNSKEY - - - - - - - Name - - - - Type - - - TTL - - - Section - - - Flags - - - Protocol - - - Algorithm - - - - - $output = "{" - $_.Key | foreach { $output = $output + $_ + ", " } - $output = $output.TrimEnd(", ") + "}" - echo $output - - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_RRSIG - - Microsoft.DnsClient.Commands.DnsRecord_RRSIG - - - - - - - Name - - - - Type - - - TTL - - - TypeCovered - - - Algorithm - - - LabelCount - - - OriginalTtl - - - Expiration - - - Signed - - - KeyTag - - - Signer - - - - - $output = "{" - $_.Signature | foreach { $output = $output + $_ + ", " } - $output = $output.TrimEnd(", ") + "}" - echo $output - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_RRSIG - - Microsoft.DnsClient.Commands.DnsRecord_RRSIG - - - - - - 30 - left - - - - 5 - left - - - - 4 - left - - - - 8 - left - - - - 14 - left - - - - 10 - left - - - - 10 - left - - - - 20 - left - - - - left - - - - - - - - Name - - - Type - - - TTL - - - TypeCovered - - - Algorithm - - - Expiration - - - Signed - - - Signer - - - Signature - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_NSEC - - Microsoft.DnsClient.Commands.DnsRecord_NSEC - - - - - - 40 - left - - - - 6 - left - - - - 5 - left - - - - 10 - left - - - - 41 - left - - - - left - - - - - - - - Name - - - Type - - - TTL - - - Section - - - NextDomainName - - - TypeBitMap - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_NSEC - - Microsoft.DnsClient.Commands.DnsRecord_NSEC - - - - - - - Name - - - - Type - - - TTL - - - Section - - - NextDomainName - - - - - $output = "{" - $_.TypeBitMap | foreach { $output = $output + $_ + ", " } - $output = $output.TrimEnd(", ") + "}" - echo $output - - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_DHCID - - Microsoft.DnsClient.Commands.DnsRecord_DHCID - - - - - - 40 - left - - - - 6 - left - - - - 5 - left - - - - 10 - left - - - - left - - - - - - - - Name - - - Type - - - TTL - - - Section - - - Dhcid - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_DHCID - - Microsoft.DnsClient.Commands.DnsRecord_DHCID - - - - - - - Name - - - - Type - - - TTL - - - Section - - - Dhcid - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_OPT - - Microsoft.DnsClient.Commands.DnsRecord_Default - Microsoft.DnsClient.Commands.DnsRecord_OPT - - - - - - 40 - left - - - - 6 - left - - - - 5 - left - - - - 10 - left - - - - left - - - - - - - - Name - - - Type - - - TTL - - - Section - - - Data - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_OPT - - Microsoft.DnsClient.Commands.DnsRecord_OPT - - - - - - - Name - - - - Type - - - TTL - - - Section - - - Protocol - - - Data - - - - - - - - - diff --git a/newton-cn/bin/Modules/DnsClient/DnsCmdlets.Types.ps1xml b/newton-cn/bin/Modules/DnsClient/DnsCmdlets.Types.ps1xml deleted file mode 100644 index 784b0ce..0000000 --- a/newton-cn/bin/Modules/DnsClient/DnsCmdlets.Types.ps1xml +++ /dev/null @@ -1,699 +0,0 @@ - - - - - Microsoft.DnsClient.Commands.DnsRecord - - - QueryType - Type - - - PsStandardMembers - - - DefaultDisplayPropertySet - - Name - QueryType - TTL - Section - - - - DefaultDisplayProperty - Name - - - DefaultKeyPropertySet - - Name - QueryType - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_A - - - Address - IP4Address - - - IPAddress - IP4Address - - - QueryType - Type - - - PsStandardMembers - - - DefaultDisplayPropertySet - - Name - QueryType - TTL - Section - IP4Address - - - - DefaultDisplayProperty - PrimaryDomainSuffix - - - DefaultKeyPropertySet - - IP4Address - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_AAAA - - - Address - IP6Address - - - IPAddress - IP6Address - - - QueryType - Type - - - PsStandardMembers - - - DefaultDisplayPropertySet - - Name - QueryType - TTL - Section - IP6Address - - - - DefaultDisplayProperty - IP6Address - - - DefaultKeyPropertySet - - IP6Address - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_TXT - - - Text - Strings - - - PsStandardMembers - - - DefaultDisplayPropertySet - - Name - QueryType - TTL - Section - Strings - - - - DefaultDisplayProperty - Strings - - - DefaultKeyPropertySet - - Strings - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_MX - - - Exchange - NameExchange - - - PsStandardMembers - - - DefaultDisplayPropertySet - - Name - QueryType - TTL - Section - NameExchange - Preference - - - - DefaultDisplayProperty - NameExchange - - - DefaultKeyPropertySet - - NameExchange - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_PTR - - - Server - NameHost - - - PsStandardMembers - - - DefaultDisplayPropertySet - - Name - QueryType - TTL - Section - NameHost - - - - DefaultDisplayProperty - NameHost - - - DefaultKeyPropertySet - - NameHost - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_SOA - - - Administrator - NameAdministrator - - - PsStandardMembers - - - DefaultDisplayPropertySet - - Name - QueryType - TTL - Section - NameAdministrator - SerialNumber - TimeToZoneRefresh - TimeToZoneFailureRetry - TimeToExpiration - DefaultTTL - - - - DefaultDisplayProperty - SerialNumber - - - DefaultKeyPropertySet - - SerialNumber - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_MINFO - - - Mailbox - NameMailbox - - - ErrorsMailbox - NameErrorsMailbox - - - PsStandardMembers - - - DefaultDisplayPropertySet - - Name - QueryType - TTL - Section - NameMailbox - NameErrorsMailbox - - - - DefaultDisplayProperty - NameMailbox - - - DefaultKeyPropertySet - - NameMailbox - NameErrorsMailbox - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_NULL - - - PsStandardMembers - - - DefaultDisplayPropertySet - - Name - QueryType - TTL - Section - Data - - - - DefaultDisplayProperty - Data - - - DefaultKeyPropertySet - - Data - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_WKS - - - PsStandardMembers - - - DefaultDisplayPropertySet - - Name - QueryType - TTL - Section - IP4Address - Protocol - Bitmask - - - - DefaultDisplayProperty - IP4Address - - - DefaultKeyPropertySet - - IP4Address - Protocol - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_SRV - - - Target - NameTarget - - - PsStandardMembers - - - DefaultDisplayPropertySet - - Name - QueryType - TTL - Section - NameTarget - Priority - Weight - Port - - - - DefaultDisplayProperty - NameTarget - - - DefaultKeyPropertySet - - NameTarget - Priority - Port - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_DS - - - Key - KeyTag - - - DigestType - DType - - - PsStandardMembers - - - DefaultDisplayPropertySet - - Name - QueryType - TTL - Section - KeyTag - Algorithm - DigestType - Digest - - - - DefaultDisplayProperty - KeyTag - - - DefaultKeyPropertySet - - KeyTag - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_RRSIG - - - Key - KeyTag - - - PsStandardMembers - - - DefaultDisplayPropertySet - - Name - QueryType - TTL - Section - TypeCovered - Algorithm - LabelCount - OriginalTtl - Expiration - Signed - Signer - Signature - - - - DefaultDisplayProperty - Signer - - - DefaultKeyPropertySet - - KeyTag - Signer - Signature - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_DNSKEY - - - PsStandardMembers - - - DefaultDisplayPropertySet - - Name - QueryType - TTL - Section - Protocol - Flags - Algorithm - Key - - - - DefaultDisplayProperty - Key - - - DefaultKeyPropertySet - - Algorithm - Key - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_NSEC - - - BitMap - TypeBitMap - - - PsStandardMembers - - - DefaultDisplayPropertySet - - Name - QueryType - TTL - Section - NextDomainName - TypeBitMap - - - - DefaultDisplayProperty - NextDomainName - - - DefaultKeyPropertySet - - NextDomainName - TypeBitMap - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_WINS - - - PsStandardMembers - - - DefaultDisplayPropertySet - - Name - QueryType - TTL - Section - MappingFlag - IP4Addresses - - - - DefaultDisplayProperty - IP4Addresses - - - DefaultKeyPropertySet - - IP4Addresses - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_DHCID - - - PsStandardMembers - - - DefaultDisplayPropertySet - - Name - QueryType - TTL - Section - Dhcid - - - - DefaultDisplayProperty - Dhcid - - - DefaultKeyPropertySet - - Dhcid - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_OPT - - - PsStandardMembers - - - DefaultDisplayPropertySet - - Name - QueryType - TTL - Section - Data - - - - DefaultDisplayProperty - Data - - - DefaultKeyPropertySet - - Data - - - - - - - - - Microsoft.DnsClient.Commands.DnsRecord_Default - - - PsStandardMembers - - - DefaultDisplayPropertySet - - Name - QueryType - TTL - Section - Data - - - - DefaultDisplayProperty - Data - - - DefaultKeyPropertySet - - Data - - - - - - - diff --git a/newton-cn/bin/Modules/DnsClient/DnsConfig.Format.ps1xml b/newton-cn/bin/Modules/DnsClient/DnsConfig.Format.ps1xml deleted file mode 100644 index d13add9..0000000 --- a/newton-cn/bin/Modules/DnsClient/DnsConfig.Format.ps1xml +++ /dev/null @@ -1,566 +0,0 @@ - - - - - - DnsClientTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClient - - - - - - 28 - - - - 9 - Left - - - - 24 - - - - 24 - - - - 16 - - - - 13 - - - - - - - - - $alias = $_.InterfaceAlias - $width = 28 - $out = $alias - if ($alias.Length -gt $width) - { - $idpresent = $alias -match "(\d+$)" - if ($idpresent -and ($width -gt ($matches[0].length + 3))) - { - $base = $alias.substring(0, $width - ($matches[0].length + 3)) - $out = $base + "..." + $matches[0] - } - } - return $out - - - - InterfaceIndex - Right - - - ConnectionSpecificSuffix - - - ConnectionSpecificSuffixSearchList - - - RegisterThisConnectionsAddress - - - UseSuffixWhenRegistering - - - - - - - - DnsClientListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClient - - - - - - - - InterfaceAlias - - - - InterfaceIndex - - - - ConnectionSpecificSuffix - - - - ConnectionSpecificSuffixSearchList - - - - RegisterThisConnectionsAddress - - - - UseSuffixWhenRegistering - - - - - - - - - DnsClientCacheTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientCache - - - - - - 25 - - - - 25 - - - - 6 - Left - - - - 9 - - - - 7 - - - - 6 - Left - - - - 6 - Left - - - - - - - - - - Entry - - - Name - - - - $type = $_.Type - $typefmt = switch ($type) - { - 0 {"ZERO"} - 1 {"A"} - 2 {"NS"} - 5 {"CNAME"} - 6 {"SOA"} - 12 {"PTR"} - 15 {"MX"} - 16 {"TEXT"} - 24 {"SIG"} - 25 {"KEY"} - 28 {"AAAA"} - 30 {"NXT"} - 33 {"SRV"} - 35 {"NAPTR"} - 37 {"CERT"} - 39 {"DNAME"} - 41 {"OPT"} - 43 {"DS"} - 46 {"RRSIG"} - 47 {"NSEC"} - 48 {"DNSKEY"} - 49 {"DHCID"} - 50 {"NSEC3"} - 51 {"NSEC3PARAM"} - 255 {""} - default {$type} - } - return $typefmt - - - - - $status = $_.Status - $statusfmt = switch ($status) - { - 0 {"Success"} - 1460 {"Timeout"} - 9002 {"ServFail"} - 9003 {"NotExist"} - 9501 {"NoRecords"} - default {$status} - } - return $statusfmt - - - - - $section = $_.Section - $sectionfmt = switch ($section) - { - 0 {""} - 1 {"Answer"} - 2 {"Authority"} - 3 {"Additional"} - default {$section} - } - return $sectionfmt - - - - - $ttl = $_.TimeToLive - $ttlfmt = switch ($ttl) - { - 0 {""} - default {$ttl} - } - return $ttlfmt - - Right - - - - $length = $_.DataLength - $lengthfmt = switch ($length) - { - 0 {""} - default {$length} - } - return $lengthfmt - - Right - - - Data - - - - - - - - DnsClientCacheListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientCache - - - - - - - - Entry - - - - Name - - - - - $type = $_.Type - $typefmt = switch ($type) - { - 0 {"ZERO"} - 1 {"A"} - 2 {"NS"} - 5 {"CNAME"} - 6 {"SOA"} - 12 {"PTR"} - 15 {"MX"} - 16 {"TEXT"} - 24 {"SIG"} - 25 {"KEY"} - 28 {"AAAA"} - 30 {"NXT"} - 33 {"SRV"} - 35 {"NAPTR"} - 37 {"CERT"} - 39 {"DNAME"} - 41 {"OPT"} - 43 {"DS"} - 46 {"RRSIG"} - 47 {"NSEC"} - 48 {"DNSKEY"} - 49 {"DHCID"} - 50 {"NSEC3"} - 51 {"NSEC3PARAM"} - 255 {""} - default {$type} - } - return $typefmt - - - - - - $status = $_.Status - $statusfmt = switch ($status) - { - 0 {"Success"} - 1460 {"Timeout"} - 9002 {"ServFail"} - 9003 {"NotExist"} - 9501 {"NoRecords"} - default {$status} - } - return $statusfmt - - - - - - $section = $_.Section - $sectionfmt = switch ($section) - { - 0 {""} - 1 {"Answer"} - 2 {"Authority"} - 3 {"Additional"} - default {$section} - } - return $sectionfmt - - - - - - $ttl = $_.TimeToLive - $ttlfmt = switch ($ttl) - { - 0 {""} - default {$ttl} - } - return $ttlfmt - - - - - - $length = $_.DataLength - $lengthfmt = switch ($length) - { - 0 {""} - default {$length} - } - return $lengthfmt - - - - - Data - - - - - - - - - DnsClientGlobalSettingListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientGlobalSetting - - - - - - - - UseSuffixSearchList - - - - SuffixSearchList - - - - UseDevolution - - - - DevolutionLevel - - - - - - - - DnsClientGlobalSettingTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientGlobalSetting - - - - - - - - - - - - - - - - - - - - - UseSuffixSearchList - - - SuffixSearchList - - - UseDevolution - - - DevolutionLevel - - - - - - - - - DnsClientServerAddressTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientServerAddress - - - - - - 28 - - - - 9 - Left - - - - 7 - Left - - - - - - - - - - - - $alias = $_.InterfaceAlias - $width = 28 - $out = $alias - if ($alias.Length -gt $width) - { - $idpresent = $alias -match "(\d+$)" - if ($idpresent -and ($width -gt ($matches[0].length + 3))) - { - $base = $alias.substring(0, $width - ($matches[0].length + 3)) - $out = $base + "..." + $matches[0] - } - } - return $out - - - - InterfaceIndex - Right - - - - $family = $_.AddressFamily - $familyfmt = switch ($family) - { - 2 {"IPv4"} - 23 {"IPv6"} - default {$family} - } - return $familyfmt - - - - ServerAddresses - - - - - - - - DnsClientServerAddressListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientServerAddress - - - - - - - - InterfaceAlias - - - - InterfaceIndex - - - - - $family = $_.AddressFamily - $familyfmt = switch ($family) - { - 2 {"IPv4"} - 23 {"IPv6"} - default {$family} - } - return $familyfmt - - - - - ServerAddresses - - - - - - - - - diff --git a/newton-cn/bin/Modules/DnsClient/DnsConfig.Types.ps1xml b/newton-cn/bin/Modules/DnsClient/DnsConfig.Types.ps1xml deleted file mode 100644 index 3703662..0000000 --- a/newton-cn/bin/Modules/DnsClient/DnsConfig.Types.ps1xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClient - - - Suffix - ConnectionSpecificSuffix - - - SuffixSearchList - ConnectionSpecificSuffixSearchList - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientCache - - - TTL - TimeToLive - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientServerAddress - - - Address - ServerAddresses - - - - - diff --git a/newton-cn/bin/Modules/DnsClient/MSFT_DnsClient.cdxml b/newton-cn/bin/Modules/DnsClient/MSFT_DnsClient.cdxml deleted file mode 100644 index a3eab88..0000000 --- a/newton-cn/bin/Modules/DnsClient/MSFT_DnsClient.cdxml +++ /dev/null @@ -1,95 +0,0 @@ - - - - 1.0.0 - DnsClient - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/DnsClient/MSFT_DnsClientCache.cdxml b/newton-cn/bin/Modules/DnsClient/MSFT_DnsClientCache.cdxml deleted file mode 100644 index 9f9960f..0000000 --- a/newton-cn/bin/Modules/DnsClient/MSFT_DnsClientCache.cdxml +++ /dev/null @@ -1,96 +0,0 @@ - - - - 1.0.0 - DnsClientCache - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/DnsClient/MSFT_DnsClientGlobalSetting.cdxml b/newton-cn/bin/Modules/DnsClient/MSFT_DnsClientGlobalSetting.cdxml deleted file mode 100644 index 80335fe..0000000 --- a/newton-cn/bin/Modules/DnsClient/MSFT_DnsClientGlobalSetting.cdxml +++ /dev/null @@ -1,31 +0,0 @@ - - - - 1.0.0 - DnsClientGlobalSetting - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/DnsClient/MSFT_DnsClientServerAddress.cdxml b/newton-cn/bin/Modules/DnsClient/MSFT_DnsClientServerAddress.cdxml deleted file mode 100644 index 2c327a8..0000000 --- a/newton-cn/bin/Modules/DnsClient/MSFT_DnsClientServerAddress.cdxml +++ /dev/null @@ -1,72 +0,0 @@ - - - - 1.0.0 - DnsClientServerAddress - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/DnsClient/PS_DnsClientNRPTGlobal_v1.0.0.cdxml b/newton-cn/bin/Modules/DnsClient/PS_DnsClientNRPTGlobal_v1.0.0.cdxml deleted file mode 100644 index db55738..0000000 --- a/newton-cn/bin/Modules/DnsClient/PS_DnsClientNRPTGlobal_v1.0.0.cdxml +++ /dev/null @@ -1,116 +0,0 @@ - - - - 1.0.0 - DnsClientNrptGlobal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EnableOnNetworkID - EnableAlways - Disable - DisableDA - - - - - - - - - - - - - - - - - Disable - FallbackSecure - FallbackUnsecure - FallbackPrivate - - - - - - - - - - Disable - QueryIPv6Only - QueryBoth - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/DnsClient/PS_DnsClientNRPTRule_v1.0.0.cdxml b/newton-cn/bin/Modules/DnsClient/PS_DnsClientNRPTRule_v1.0.0.cdxml deleted file mode 100644 index de6f322..0000000 --- a/newton-cn/bin/Modules/DnsClient/PS_DnsClientNRPTRule_v1.0.0.cdxml +++ /dev/null @@ -1,382 +0,0 @@ - - - - 1.0.0 - DnsClientNrptRule - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - None - Low - Medium - High - - - - - - - - - - - - - - - - - - - - - - - None - Low - Medium - High - - - - - - - - - - - - Disable - Utf8WithMapping - Utf8WithoutMapping - Punycode - - - - - - - - - - - - - - - - - - - - - - NoProxy - UseDefault - UseProxyName - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - None - Low - Medium - High - - - - - - - - - - - - - - - - - - - - - - - NoProxy - UseDefault - UseProxyName - - - - - - - - - - - - - - - - - - - None - Low - Medium - High - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Disable - Utf8WithMapping - Utf8WithoutMapping - Punycode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/DnsClient/PS_DnsClientNrptPolicy_v1.0.0.cdxml b/newton-cn/bin/Modules/DnsClient/PS_DnsClientNrptPolicy_v1.0.0.cdxml deleted file mode 100644 index 5b7b6a9..0000000 --- a/newton-cn/bin/Modules/DnsClient/PS_DnsClientNrptPolicy_v1.0.0.cdxml +++ /dev/null @@ -1,40 +0,0 @@ - - - - 1.0.0 - DnsClientNrptPolicy - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/DnsClient/dnslookup.dll b/newton-cn/bin/Modules/DnsClient/dnslookup.dll deleted file mode 100644 index 7c62cc1..0000000 Binary files a/newton-cn/bin/Modules/DnsClient/dnslookup.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/EventTracingManagement/EventTracingManagement.Types.ps1xml b/newton-cn/bin/Modules/EventTracingManagement/EventTracingManagement.Types.ps1xml deleted file mode 100644 index 0282648..0000000 --- a/newton-cn/bin/Modules/EventTracingManagement/EventTracingManagement.Types.ps1xml +++ /dev/null @@ -1,185 +0,0 @@ - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/EventTracingManagement/MSFT_EtwTraceProvider - - - Level - - $this.PSBase.CimInstanceProperties['Level'].Value - - - - LevelName - - $constants = @{ - 0 = "WINEVENT_LEVEL_LOG_ALWAYS"; - 1 = "WINEVENT_LEVEL_CRITICAL"; - 2 = "WINEVENT_LEVEL_ERROR"; - 3 = "WINEVENT_LEVEL_WARNING"; - 4 = "WINEVENT_LEVEL_INFO"; - 5 = "WINEVENT_LEVEL_VERBOSE";} - - $level = $this.PSBase.CimInstanceProperties['Level'].Value - - $namedLevel = $constants[[Convert]::ToInt32($level)] - - if ($namedLevel) - { - "{0} ({1})" -f $level, $namedLevel - } - else - { - $level.ToString() - } - - - - MatchAnyKeyword - - "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAnyKeyword'].Value - - - - MatchAllKeyword - - "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAllKeyword'].Value - - - - Property - - $this.PSBase.CimInstanceProperties['Property'].Value - - - - EnableProperty - - $constants = @{ - 0x00000001 = "EVENT_ENABLE_PROPERTY_SID"; - 0x00000002 = "EVENT_ENABLE_PROPERTY_TS_ID"; - 0x00000004 = "EVENT_ENABLE_PROPERTY_STACK_TRACE"; - 0x00000008 = "EVENT_ENABLE_PROPERTY_PSM_KEY"; - 0x00000010 = "EVENT_ENABLE_PROPERTY_IGNORE_KEYWORD_0"; - 0x00000020 = "EVENT_ENABLE_PROPERTY_PROVIDER_GROUP"; - 0x00000040 = "EVENT_ENABLE_PROPERTY_ENABLE_KEYWORD_0"; - 0x00000080 = "EVENT_ENABLE_PROPERTY_PROCESS_START_KEY"; - 0x00000100 = "EVENT_ENABLE_PROPERTY_EVENT_KEY"; - 0x00000200 = "EVENT_ENABLE_PROPERTY_EXCLUDE_INPRIVATE";} - - $enableProperty = $this.PSBase.CimInstanceProperties['Property'].Value - - $constants.Keys | where { $_ -band $enableProperty } | foreach { $constants.Get_Item($_) } - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/EventTracingManagement/MSFT_EtwTraceSession - - - LogFileMode - - "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['LogFileMode'].Value - - - - LoggingModeNames - - $constants = @{ - 0x00000000 = "EVENT_TRACE_FILE_MODE_NONE"; - 0x00000001 = "EVENT_TRACE_FILE_MODE_SEQUENTIAL"; - 0x00000002 = "EVENT_TRACE_FILE_MODE_CIRCULAR"; - 0x00000004 = "EVENT_TRACE_FILE_MODE_APPEND"; - 0x00000100 = "EVENT_TRACE_REAL_TIME_MODE"; - 0x00000200 = "EVENT_TRACE_DELAY_OPEN_FILE_MODE"; - 0x00000400 = "EVENT_TRACE_BUFFERING_MODE"; - 0x00000800 = "EVENT_TRACE_PRIVATE_LOGGER_MODE"; - 0x00001000 = "EVENT_TRACE_ADD_HEADER_MODE"; - 0x00004000 = "EVENT_TRACE_USE_GLOBAL_SEQUENCE"; - 0x00008000 = "EVENT_TRACE_USE_LOCAL_SEQUENCE"; - 0x00010000 = "EVENT_TRACE_RELOG_MODE"; - 0x01000000 = "EVENT_TRACE_USE_PAGED_MEMORY"; - 0x00000008 = "EVENT_TRACE_FILE_MODE_NEWFILE"; - 0x00000020 = "EVENT_TRACE_FILE_MODE_PREALLOCATE"; - 0x00000040 = "EVENT_TRACE_NONSTOPPABLE_MODE"; - 0x00000080 = "EVENT_TRACE_SECURE_MODE"; - 0x00002000 = "EVENT_TRACE_USE_KBYTES_FOR_SIZE"; - 0x00020000 = "EVENT_TRACE_PRIVATE_IN_PROC"; - 0x00100000 = "EVENT_TRACE_MODE_RESERVED"; - 0x10000000 = "EVENT_TRACE_NO_PER_PROCESSOR_BUFFERING"; - 0x02000000 = "EVENT_TRACE_SYSTEM_LOGGER_MODE"; - 0x80000000 = "EVENT_TRACE_ADDTO_TRIAGE_DUMP"; - 0x00400000 = "EVENT_TRACE_STOP_ON_HYBRID_SHUTDOWN"; - 0x00800000 = "EVENT_TRACE_PERSIST_ON_HYBRID_SHUTDOWN"; - 0x08000000 = "EVENT_TRACE_INDEPENDENT_SESSION_MODE"; - 0x04000000 = "EVENT_TRACE_COMPRESSED_MODE"} - - $logfilemode = $this.PSBase.CimInstanceProperties['LogFileMode'].Value - - $constants.Keys | where { $_ -band $logfilemode } | foreach { $constants.Get_Item($_) } - - - - ClockType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.EtwTraceSession.ClockType]($this.PSBase.CimInstanceProperties['ClockType'].Value) - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/EventTracingManagement/MSFT_AutologgerConfig - - - LogFileMode - - "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['LogFileMode'].Value - - - - LoggingModeNames - - $constants = @{ - 0x00000000 = "EVENT_TRACE_FILE_MODE_NONE"; - 0x00000001 = "EVENT_TRACE_FILE_MODE_SEQUENTIAL"; - 0x00000002 = "EVENT_TRACE_FILE_MODE_CIRCULAR"; - 0x00000004 = "EVENT_TRACE_FILE_MODE_APPEND"; - 0x00000100 = "EVENT_TRACE_REAL_TIME_MODE"; - 0x00000200 = "EVENT_TRACE_DELAY_OPEN_FILE_MODE"; - 0x00000400 = "EVENT_TRACE_BUFFERING_MODE"; - 0x00000800 = "EVENT_TRACE_PRIVATE_LOGGER_MODE"; - 0x00001000 = "EVENT_TRACE_ADD_HEADER_MODE"; - 0x00004000 = "EVENT_TRACE_USE_GLOBAL_SEQUENCE"; - 0x00008000 = "EVENT_TRACE_USE_LOCAL_SEQUENCE"; - 0x00010000 = "EVENT_TRACE_RELOG_MODE"; - 0x01000000 = "EVENT_TRACE_USE_PAGED_MEMORY"; - 0x00000008 = "EVENT_TRACE_FILE_MODE_NEWFILE"; - 0x00000020 = "EVENT_TRACE_FILE_MODE_PREALLOCATE"; - 0x00000040 = "EVENT_TRACE_NONSTOPPABLE_MODE"; - 0x00000080 = "EVENT_TRACE_SECURE_MODE"; - 0x00002000 = "EVENT_TRACE_USE_KBYTES_FOR_SIZE"; - 0x00020000 = "EVENT_TRACE_PRIVATE_IN_PROC"; - 0x00100000 = "EVENT_TRACE_MODE_RESERVED"; - 0x10000000 = "EVENT_TRACE_NO_PER_PROCESSOR_BUFFERING"; - 0x02000000 = "EVENT_TRACE_SYSTEM_LOGGER_MODE"; - 0x80000000 = "EVENT_TRACE_ADDTO_TRIAGE_DUMP"; - 0x00400000 = "EVENT_TRACE_STOP_ON_HYBRID_SHUTDOWN"; - 0x00800000 = "EVENT_TRACE_PERSIST_ON_HYBRID_SHUTDOWN"; - 0x08000000 = "EVENT_TRACE_INDEPENDENT_SESSION_MODE"; - 0x04000000 = "EVENT_TRACE_COMPRESSED_MODE"} - - $logfilemode = $this.PSBase.CimInstanceProperties['LogFileMode'].Value - - $constants.Keys | where { $_ -band $logfilemode } | foreach { $constants.Get_Item($_) } - - - - ClockType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.AutologgerConfig.ClockType]($this.PSBase.CimInstanceProperties['ClockType'].Value) - - - - - diff --git a/newton-cn/bin/Modules/EventTracingManagement/EventTracingManagement.psd1 b/newton-cn/bin/Modules/EventTracingManagement/EventTracingManagement.psd1 deleted file mode 100644 index 796b508..0000000 --- a/newton-cn/bin/Modules/EventTracingManagement/EventTracingManagement.psd1 +++ /dev/null @@ -1,45 +0,0 @@ -@{ - GUID = "80CB11CF-96B5-4D48-84BD-F85F65DE78AE" - Author = "Microsoft Corporation" - CompanyName = "Microsoft Corporation" - Copyright = "© Microsoft Corporation. All rights reserved." - ModuleVersion = "1.0.0.0" - PowerShellVersion = '5.1' - HelpInfoUri = "http://go.microsoft.com/fwlink/?linkid=524348" - - NestedModules = @( - 'MSFT_EtwTraceSession_v1.0.cdxml', - 'MSFT_EtwTraceProvider_v1.0.cdxml', - 'MSFT_AutologgerConfig_v1.0.cdxml', - 'EventTracingManagement.psm1') - - FormatsToProcess = @( - 'MSFT_AutologgerConfig_v1.0.format.ps1xml', - 'MSFT_EtwTraceProvider_v1.0.format.ps1xml', - 'MSFT_EtwTraceSession_v1.0.format.ps1xml') - - TypesToProcess = @('EventTracingManagement.Types.ps1xml') - - FunctionsToExport = @( - 'Start-EtwTraceSession', - 'New-EtwTraceSession', - 'Get-EtwTraceSession', - 'Update-EtwTraceSession', - 'Set-EtwTraceSession', - 'Send-EtwTraceSession', - 'Save-EtwTraceSession', - 'Flush-EtwTraceSession', - 'Stop-EtwTraceSession', - 'Remove-EtwTraceSession', - 'Add-EtwTraceProvider', - 'Get-EtwTraceProvider', - 'Set-EtwTraceProvider', - 'Remove-EtwTraceProvider', - 'New-AutologgerConfig', - 'Get-AutologgerConfig', - 'Update-AutologgerConfig', - 'Set-AutologgerConfig', - 'Start-AutologgerConfig', - 'Remove-AutologgerConfig') - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/EventTracingManagement/EventTracingManagement.psm1 b/newton-cn/bin/Modules/EventTracingManagement/EventTracingManagement.psm1 deleted file mode 100644 index 46c8f6a..0000000 --- a/newton-cn/bin/Modules/EventTracingManagement/EventTracingManagement.psm1 +++ /dev/null @@ -1,228 +0,0 @@ -function Start-EtwTraceSession -{ - [CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')] - - param( - [Parameter(Position=0, - Mandatory=$true)] - [System.String]$Name, - - [Parameter()] - [System.UInt32]$LogFileMode = 0x09000000, - - [Parameter()] - [System.String]$LocalFilePath, - - [Parameter()] - [System.UInt32]$MaximumFileSize, - - [Parameter()] - [System.UInt32]$BufferSize, - - [Parameter()] - [System.UInt32]$MinimumBuffers, - - [Parameter()] - [System.UInt32]$MaximumBuffers, - - [Parameter()] - [System.UInt32]$FlushTimer, - - [Parameter()] - [ValidateSet('Performance','System', 'Cycle')] - [System.String]$ClockType, - - [Parameter()] - [ValidateSet('File','Buffering', 'Sequential', 'Circular')] - [System.String]$FileMode, - - [Parameter()] - [Switch] - $Compress, - - [Parameter()] - [Switch] - $RealTime, - - [Parameter()] - [Switch] - $NonPaged, - - [Parameter()] - [Microsoft.Management.Infrastructure.CimSession]$CimSession - ) - - $mode = $LogFileMode - - if ($FileMode.Length -gt 0) - { - switch($FileMode.ToLowerInvariant()) - { - {($_ -eq "file")} {} - {($_ -eq "buffering")} { $mode = $mode -bor 0x400} - {($_ -eq "sequential")} { $mode = $mode -bor 0x1} - {($_ -eq "circular")} { $mode = $mode -bor 0x2} - } - - $x = $PSBoundParameters.Remove("FileMode") - } - - if ($NonPaged -eq $true) - { - $mode = $mode -bxor 0x01000000 - $x = $PSBoundParameters.Remove("NonPaged") - } - - if ($RealTime -eq $true) - { - $mode = $mode -bor 0x00000100 - $x = $PSBoundParameters.Remove("RealTime") - } - - if ($Compress -eq $true) - { - $mode = $mode -bor 0x04000000 - $x = $PSBoundParameters.Remove("Compress") - } - - if ($mode -ne 0) - { - $PSBoundParameters["LogFileMode"] = $mode - } - - New-EtwTraceSession @PSBoundParameters -} - -function Save-EtwTraceSession -{ - [CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')] - - param( - [Parameter(Position=0, - Mandatory=$true)] - [System.String]$Name, - - [Parameter(ValueFromPipeLine=$True)] - [System.IO.FileInfo]$OutputFile, - - [Parameter(ValueFromPipeLine=$True)] - [System.IO.DirectoryInfo]$OutputFolder, - - [Parameter()] - [Switch] - $Stop, - - [Parameter()] - [Switch] - $Overwrite, - - [Parameter()] - [Microsoft.Management.Infrastructure.CimSession]$CimSession - ) - - if ($PSBoundParameters.ContainsKey("DeleteAfterSend") -eq $true) - { - $x = $PSBoundParameters.Remove("DeleteAfterSend") - } - - if ($PSBoundParameters.ContainsKey("DestinationFolder") -eq $true) - { - $x = $PSBoundParameters.Remove("DestinationFolder") - } - - $file = "$Name.etl" - $pathSet = 0 - - if ($PSBoundParameters.ContainsKey("CimSession") -eq $true) - { - $session = Get-EtwTraceSession $Name -CimSession $CimSession - } - else - { - $session = Get-EtwTraceSession $Name - } - - if ($session -eq $null) - { - # Error message would have already come from Get-EtwTraceSession - return $null - } - - if ($PSBoundParameters.ContainsKey("OutputFile") -eq $true) - { - $file = $OutputFile.FullName - $pathSet = $pathSet + 1 - $x = $PSBoundParameters.Remove("OutputFile") - } - - if ($PSBoundParameters.ContainsKey("OutputFolder") -eq $true) - { - if (($session.LocalFilePath -ne $null) -and (test-path $session.LocalFilePath)) - { - $existingTrace = get-item $session.LocalFilePath - $file = $existingTrace.Name - } - - $file = join-path $OutputFolder.FullName $file - $pathSet = $pathSet + 1 - $x = $PSBoundParameters.Remove("OutputFolder") - } - - if ($PSBoundParameters.ContainsKey("Overwrite") -eq $true) - { - $x = $PSBoundParameters.Remove("Overwrite") - } - - if ($pathSet -gt 1) - { - throw "Only 1 file parameter can be set" - # TODO: Localize - } - - if ($PSBoundParameters.ContainsKey("CimSession") -eq $true) - { - $exists = get-ciminstance -classname CIM_DataFile -filter ("Name='$file'".replace("\", "\\")) -CimSession $CimSession - if ($exists -ne $null -and $Overwrite -eq $false) - { - throw "Output file already exists. Use -Overwrite to overwrite." - # TODO: Localize - } - } - else - { - $exists = test-path $file - if ($exists -eq $true -and $Overwrite -eq $false) - { - throw "Output file already exists. Use -Overwrite to overwrite." - # TODO: Localize - } - } - - $result = Send-EtwTraceSession -DestinationFolder $file @PSBoundParameters - - if ($result -ne $null -and $result.ReturnValue -ne $null -and ($result.ReturnValue.ToString() -eq "Success")) - { - if ($PSBoundParameters.ContainsKey("CimSession") -eq $true) - { - if ($Stop -eq $true) - { - Remove-EtwTraceSession $Name -CimSession $CimSession - } - - return get-ciminstance -classname CIM_DataFile -filter ("Name='$file'".replace("\", "\\")) -CimSession $CimSession - } - else - { - if ($Stop -eq $true) - { - Remove-EtwTraceSession $Name - } - - return get-item $file - } - } - else - { - return $null - } -} diff --git a/newton-cn/bin/Modules/EventTracingManagement/MSFT_AutologgerConfig_v1.0.cdxml b/newton-cn/bin/Modules/EventTracingManagement/MSFT_AutologgerConfig_v1.0.cdxml deleted file mode 100644 index 0d3c4c0..0000000 --- a/newton-cn/bin/Modules/EventTracingManagement/MSFT_AutologgerConfig_v1.0.cdxml +++ /dev/null @@ -1,187 +0,0 @@ - - - - 1.1.0.0 - AutologgerConfig - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/EventTracingManagement/MSFT_AutologgerConfig_v1.0.format.ps1xml b/newton-cn/bin/Modules/EventTracingManagement/MSFT_AutologgerConfig_v1.0.format.ps1xml deleted file mode 100644 index 885b203..0000000 --- a/newton-cn/bin/Modules/EventTracingManagement/MSFT_AutologgerConfig_v1.0.format.ps1xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - MSFT_AutologgerConfig_ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_AutologgerConfig - - - - - - - Name - - - BufferSize - - - ClockType - - - DisableRealtimePersistence - - - FileCount - - - LocalFilePath - - - FileMax - - - FlushTimer - - - Guid - - - LoggingModeNames - - - MaximumFileSize - - - MaximumBuffers - - - MinimumBuffers - - - Start - - - InitStatus - - - - - - - - MSFT_AutologgerConfig_TableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_AutologgerConfig - - - - - 15 - - - 15 - - - 15 - - - 15 - - - 15 - - - 15 - - - 15 - - - 15 - - - 15 - - - 15 - - - 15 - - - 15 - - - 15 - - - 15 - - - 15 - - - - - - - Name - - - BufferSize - - - ClockType - - - DisableRealtimePersistence - - - FileCount - - - LocalFilePath - - - FileMax - - - FlushTimer - - - Guid - - - LoggingModeNames - - - MaximumFileSize - - - MaximumBuffers - - - MinimumBuffers - - - Start - - - InitStatus - - - - - - - - diff --git a/newton-cn/bin/Modules/EventTracingManagement/MSFT_EtwTraceProvider_v1.0.cdxml b/newton-cn/bin/Modules/EventTracingManagement/MSFT_EtwTraceProvider_v1.0.cdxml deleted file mode 100644 index 7303a1e..0000000 --- a/newton-cn/bin/Modules/EventTracingManagement/MSFT_EtwTraceProvider_v1.0.cdxml +++ /dev/null @@ -1,137 +0,0 @@ - - - - 1.0.0.0 - EtwTraceProvider - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/EventTracingManagement/MSFT_EtwTraceProvider_v1.0.format.ps1xml b/newton-cn/bin/Modules/EventTracingManagement/MSFT_EtwTraceProvider_v1.0.format.ps1xml deleted file mode 100644 index 4559f8c..0000000 --- a/newton-cn/bin/Modules/EventTracingManagement/MSFT_EtwTraceProvider_v1.0.format.ps1xml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - MSFT_EtwTraceProvider_ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_EtwTraceProvider - - - - - - - SessionName - - -not [System.String]::IsNullOrEmpty($_.SessionName) - - - - AutologgerName - - -not [System.String]::IsNullOrEmpty($_.AutologgerName) - - - - Guid - - - LevelName - - - - MatchAnyKeyword - - - MatchAllKeyword - - - EnableProperty - - - - - - - - MSFT_EtwTraceProvider_TableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_EtwTraceProvider - - - - - 10 - - - 15 - - - 15 - - - 10 - - - - 15 - - - 15 - - - - - - - Guid - - - SessionName - - - AutologgerName - - - LevelName - - - MatchAnyKeyword - - - MatchAllKeyword - - - - - - - - diff --git a/newton-cn/bin/Modules/EventTracingManagement/MSFT_EtwTraceSession_v1.0.cdxml b/newton-cn/bin/Modules/EventTracingManagement/MSFT_EtwTraceSession_v1.0.cdxml deleted file mode 100644 index 28fb5c7..0000000 --- a/newton-cn/bin/Modules/EventTracingManagement/MSFT_EtwTraceSession_v1.0.cdxml +++ /dev/null @@ -1,156 +0,0 @@ - - - - 1.1.0.0 - EtwTraceSession - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/EventTracingManagement/MSFT_EtwTraceSession_v1.0.format.ps1xml b/newton-cn/bin/Modules/EventTracingManagement/MSFT_EtwTraceSession_v1.0.format.ps1xml deleted file mode 100644 index a55eda9..0000000 --- a/newton-cn/bin/Modules/EventTracingManagement/MSFT_EtwTraceSession_v1.0.format.ps1xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - MSFT_EtwTraceSession_ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_EtwTraceSession - - - - - - - Name - - - LoggingModeNames - - - LocalFilePath - - - MaximumFileSize - - - MinimumBuffers - - - MaximumBuffers - - - FlushTimer - - - ClockType - - - - - - - - MSFT_EtwTraceSession_TableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_EtwTraceSession - - - - - 10 - - - 15 - - - 15 - - - 14 - - - 14 - - - 10 - - - 9 - - - 16 - - - - - - - Name - - - LocalFilePath - - - MaximumFileSize - - - MinimumBuffers - - - MaximumBuffers - - - FlushTimer - - - ClockType - - - LoggingModeNames - - - - - - - - diff --git a/newton-cn/bin/Modules/ISE/ise.psd1 b/newton-cn/bin/Modules/ISE/ise.psd1 deleted file mode 100644 index 95765f8..0000000 --- a/newton-cn/bin/Modules/ISE/ise.psd1 +++ /dev/null @@ -1,16 +0,0 @@ -@{ -GUID = 'bae93d8e-782c-4a23-b87f-8699bfc17ee0' -Author = 'Microsoft Corporation' -CompanyName = 'Microsoft Corporation' -Copyright = '(c) Microsoft Corporation. All rights reserved.' -ModuleVersion = '1.0.0.0' -PowerShellVersion = '5.1' -CLRVersion='4.0' -RootModule='ISE.psm1' -FunctionsToExport='New-IseSnippet', 'Import-IseSnippet', 'Get-IseSnippet' -CmdletsToExport = @() -AliasesToExport = @() -HelpInfoUri='https://go.microsoft.com/fwlink/?linkid=390780' -PowerShellHostName = 'Windows PowerShell ISE Host' -CompatiblePSEditions = @('Desktop') -} diff --git a/newton-cn/bin/Modules/ISE/ise.psm1 b/newton-cn/bin/Modules/ISE/ise.psm1 deleted file mode 100644 index d957d77..0000000 --- a/newton-cn/bin/Modules/ISE/ise.psm1 +++ /dev/null @@ -1,185 +0,0 @@ -# .Link -# https://go.microsoft.com/fwlink/?LinkID=225298 -# .ExternalHelp ISE.psm1-help.xml -function New-IseSnippet -{ - [CmdletBinding()] - param( - - [Parameter(Mandatory=$true, Position=0)] - [String] - $Title, - - [Parameter(Mandatory=$true, Position=1)] - [String] - $Description, - - [Parameter(Mandatory=$true, Position=2)] - [String] - $Text, - - [String] - $Author, - - [Int32] - [ValidateRange(0, [Int32]::MaxValue)] - $CaretOffset = 0, - - [Switch] - $Force - ) - - Begin - { - $snippetPath = Join-Path (Split-Path $profile.CurrentUserCurrentHost) "Snippets" - - if($Text.IndexOf("]]>") -ne -1) - { - throw [Microsoft.PowerShell.Host.ISE.SnippetStrings]::SnippetsNoCloseCData -f "Text","]]>" - } - - if (-not (Test-Path $snippetPath)) - { - $null = mkdir $snippetPath - } - } - - End - { - $snippet = @" - - - -
- $([System.Security.SecurityElement]::Escape($Title)) - $([System.Security.SecurityElement]::Escape($Description)) - $([System.Security.SecurityElement]::Escape($Author)) - - Expansion - -
- - - - - -
-
- -"@ - - $pathCharacters = '/\`*?[]:><"|.'; - $fileName=new-object text.stringBuilder - for($ix=0; $ix -lt $Title.Length; $ix++) - { - $titleChar=$Title[$ix] - if($pathCharacters.IndexOf($titleChar) -ne -1) - { - $titleChar = "_" - } - - $null = $fileName.Append($titleChar) - } - - $params = @{ - FilePath = "$snippetPath\$fileName.snippets.ps1xml"; - Encoding = "UTF8" - } - - if ($Force) - { - $params["Force"] = $true - } - else - { - $params["NoClobber"] = $true - } - - $snippet | Out-File @params - - $psise.CurrentPowerShellTab.Snippets.Load($params["FilePath"]) - } -} - -# .Link -# https://go.microsoft.com/fwlink/?LinkId=242050 -# .ExternalHelp ISE.psm1-help.xml -function Import-IseSnippet -{ - [CmdletBinding(DefaultParameterSetName="FromFolder")] - param( - - [Parameter(Mandatory=$true, Position=0, ParameterSetName="FromFolder")] - [String] - $Path, - - [Parameter()] - [Switch] - $Recurse, - - [Parameter(Mandatory=$true, ParameterSetName="FromModule")] - [String] - $Module, - - [Parameter(ParameterSetName="FromModule")] - [Switch] - $ListAvailable - ) - - End - { - if ($Path) - { - dir "$Path\*.snippets.ps1xml" -Recurse:$Recurse | - % {$psise.CurrentPowerShellTab.Snippets.Load($_)} - } - elseif ($Module) - { - if($ListAvailable) - { - $m = Get-Module $module -ListAvailable - } - else - { - $m = Get-Module $module - } - - if (-not $m) - { - Write-Error ([Microsoft.PowerShell.Host.ISE.SnippetStrings]::ModuleNotFound) - } - - foreach ($x in $m) - { - # Get the module path and validate that there is a Snippets folder - $snipPath = Split-Path ($x.Path) -Parent - if (Test-Path "$snipPath\Snippets") - { - dir "$snipPath\Snippets\*.snippets.ps1xml" -Recurse:$Recurse | - % {$psise.CurrentPowerShellTab.Snippets.Load($_)} - } - else - { - Write-Verbose ([Microsoft.PowerShell.Host.ISE.SnippetStrings]::NoSnippetsInModule -f $x.Name,"Snippets") - } - } - } - } -} - -# .Link -# https://go.microsoft.com/fwlink/?LinkID=238787 -# .ExternalHelp ISE.psm1-help.xml -function Get-IseSnippet -{ - [CmdletBinding()] - [OutputType([System.IO.FileInfo])] - param() - $snippetPath = Join-Path (Split-Path $profile.CurrentUserCurrentHost) "Snippets" - if (Test-Path $snippetPath) - { - dir $snippetPath - } -} diff --git a/newton-cn/bin/Modules/International/International.psd1 b/newton-cn/bin/Modules/International/International.psd1 deleted file mode 100644 index b444c92..0000000 --- a/newton-cn/bin/Modules/International/International.psd1 +++ /dev/null @@ -1,13 +0,0 @@ -@{ -GUID="{561544E6-3A83-4D24-B140-78AD771EAF10}" -Author="Microsoft Corporation" -CompanyName="Microsoft Corporation" -Copyright="© Microsoft Corporation. All rights reserved." -ModuleVersion="2.0.0.0" -PowerShellVersion="5.1" -CLRVersion="4.0" -NestedModules="Microsoft.InternationalSettings.Commands" -HelpInfoUri= "https://go.microsoft.com/fwlink/?linkid=285548" -CmdletsToExport="Get-WinDefaultInputMethodOverride","Set-WinDefaultInputMethodOverride","Get-WinHomeLocation","Set-WinHomeLocation","Get-WinLanguageBarOption","Set-WinLanguageBarOption","Get-WinSystemLocale","Set-WinSystemLocale","Get-WinUILanguageOverride","Set-WinUILanguageOverride","Get-WinUserLanguageList","Set-WinUserLanguageList","New-WinUserLanguageList","Set-Culture","Get-WinAcceptLanguageFromLanguageListOptOut","Set-WinAcceptLanguageFromLanguageListOptOut","Get-WinCultureFromLanguageListOptOut","Set-WinCultureFromLanguageListOptOut" -CompatiblePSEditions=@("Core","Desktop") -} diff --git a/newton-cn/bin/Modules/Kds/Kds.psd1 b/newton-cn/bin/Modules/Kds/Kds.psd1 deleted file mode 100644 index 967f3f4..0000000 --- a/newton-cn/bin/Modules/Kds/Kds.psd1 +++ /dev/null @@ -1,21 +0,0 @@ -@{ -GUID="{176542F6-2A6B-11E0-AB18-D010E0D72085}" -Author="Microsoft Corporation" -CompanyName="Microsoft Corporation" -Copyright="© Microsoft Corporation. All rights reserved." -ModuleVersion="1.0.0.0" -PowerShellVersion="5.1" -CLRVersion="4.0" -ModuleToProcess="Microsoft.KeyDistributionService.Cmdlets" -HelpInfoUri="http://go.microsoft.com/fwlink/?linkid=390781" -CmdletsToExport= - "Add-KdsRootKey", - "Get-KdsRootKey", - "Test-KdsRootKey", - "Set-KdsConfiguration", - "Get-KdsConfiguration", - "Clear-KdsCache" -CompatiblePSEditions= - "Core", - "Desktop" -} diff --git a/newton-cn/bin/Modules/LanguagePackManagement/LanguagePackManagement.psd1 b/newton-cn/bin/Modules/LanguagePackManagement/LanguagePackManagement.psd1 deleted file mode 100644 index 0c111e5..0000000 --- a/newton-cn/bin/Modules/LanguagePackManagement/LanguagePackManagement.psd1 +++ /dev/null @@ -1,131 +0,0 @@ -# -# Module manifest for module 'LanguagePackManagement' -# -# Generated on: 10/11/2021 -# - -@{ - -# Script module or binary module file associated with this manifest. -#RootModule = '' - -# Version number of this module. -ModuleVersion = '1.0' - -# Supported PSEditions -CompatiblePSEditions = @('Desktop', 'Core') - -# ID used to uniquely identify this module -GUID = 'f42dbdd4-4358-4067-8155-a4567a0aaee5' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '© Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -Description = "This module allows for programmatic management of a device's languages. Users can install and uninstall language packs and features, as well as manage and query the language settings on the device." - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '5.1' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -FormatsToProcess = @("LanguagePackManagementViews.ps1xml") - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -NestedModules = @('Microsoft.LanguagePackManagement.Powershell.Commands') - -# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. -FunctionsToExport = @() - -# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. -CmdletsToExport = @('Install-Language', - 'Uninstall-Language', - 'Get-InstalledLanguage', - 'Set-SystemPreferredUILanguage', - 'Get-SystemPreferredUILanguage' - ) - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. -AliasesToExport = @("Get-Language", - "Get-PreferredLanguage", - "Get-SystemLanguage", - "Set-PreferredLanguage", - "Set-SystemLanguage" - ) - -# DSC resources to export from this module -# DscResourcesToExport = @() - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @("Language", "LanguagePacks", "LXP", "LanguageManagement", "LanguageSettings", "International", "InternationalSettings") - - # A URL to the license for this module. - # LicenseUri = '' - - # A URL to the main website for this project. - # ProjectUri = '' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - # ReleaseNotes = '' - - } # End of PSData hashtable - -} # End of PrivateData hashtable - -# HelpInfo URI of this module -HelpInfoURI = 'https://aka.ms/winsvr-2022-pshelp' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -} - diff --git a/newton-cn/bin/Modules/LanguagePackManagement/LanguagePackManagementViews.ps1xml b/newton-cn/bin/Modules/LanguagePackManagement/LanguagePackManagementViews.ps1xml deleted file mode 100644 index d2c94a4..0000000 --- a/newton-cn/bin/Modules/LanguagePackManagement/LanguagePackManagementViews.ps1xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - InstalledLanguage - - Microsoft.LanguagePackManagement.Powershell.Commands.InstalledLanguage - - - - - 8 - - Left - - - 15 - - Left - - - 70 - - Left - - - - - - - LanguageId - - - LanguagePacks - - - LanguageFeatures - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/LanguagePackManagement/Microsoft.LanguagePackManagement.Powershell.Commands.dll b/newton-cn/bin/Modules/LanguagePackManagement/Microsoft.LanguagePackManagement.Powershell.Commands.dll deleted file mode 100644 index 68b79b3..0000000 Binary files a/newton-cn/bin/Modules/LanguagePackManagement/Microsoft.LanguagePackManagement.Powershell.Commands.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/LanguagePackManagement/en/Microsoft.LanguagePackManagement.Powershell.Commands.Resources.dll b/newton-cn/bin/Modules/LanguagePackManagement/en/Microsoft.LanguagePackManagement.Powershell.Commands.Resources.dll deleted file mode 100644 index eee4323..0000000 Binary files a/newton-cn/bin/Modules/LanguagePackManagement/en/Microsoft.LanguagePackManagement.Powershell.Commands.Resources.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/MMAgent/MMAgent.psd1 b/newton-cn/bin/Modules/MMAgent/MMAgent.psd1 deleted file mode 100644 index 87f380e..0000000 --- a/newton-cn/bin/Modules/MMAgent/MMAgent.psd1 +++ /dev/null @@ -1,21 +0,0 @@ -@{ - GUID = 'e1383a06-d48b-45e0-81e4-5ead146e81a8' - - NestedModules = @('ps_mmagent_v1.0.cdxml') - - Author = "Microsoft Corporation" - CompanyName = "Microsoft Corporation" - Copyright = "© Microsoft Corporation. All rights reserved." - PowerShellVersion = '5.1' - HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=285551" - - FormatsToProcess = @() - TypesToProcess = @() - - ModuleVersion = '1.0' - - AliasesToExport = @() - CmdletsToExport = @() - FunctionsToExport = @('Disable-MMAgent', 'Enable-MMAgent', 'Set-MMAgent', 'Get-MMAgent', 'Debug-MMAppPrelaunch') - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/MMAgent/ps_mmagent_v1.0.cdxml b/newton-cn/bin/Modules/MMAgent/ps_mmagent_v1.0.cdxml deleted file mode 100644 index 48becbc..0000000 --- a/newton-cn/bin/Modules/MMAgent/ps_mmagent_v1.0.cdxml +++ /dev/null @@ -1,165 +0,0 @@ - - - - 1.0 - MMAgent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psd1 b/newton-cn/bin/Modules/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psd1 deleted file mode 100644 index acc0910..0000000 --- a/newton-cn/bin/Modules/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psd1 +++ /dev/null @@ -1,13 +0,0 @@ -@{ -GUID="eb74e8da-9ae2-482a-a648-e96550fb8733" -Author="Microsoft Corporation" -CompanyName="Microsoft Corporation" -Copyright="© Microsoft Corporation. All rights reserved." -ModuleVersion="1.0.1.0" -FunctionsToExport = @('Compress-Archive', 'Expand-Archive') -DotNetFrameworkVersion = 4.5 -CmdletsToExport = @() -AliasesToExport = @() -NestedModules="Microsoft.PowerShell.Archive.psm1" -HelpInfoURI = 'https://go.microsoft.com/fwlink/?LinkId=393254' -} diff --git a/newton-cn/bin/Modules/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psm1 b/newton-cn/bin/Modules/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psm1 deleted file mode 100644 index b76a89b..0000000 Binary files a/newton-cn/bin/Modules/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psm1 and /dev/null differ diff --git a/newton-cn/bin/Modules/Microsoft.PowerShell.Archive/ko-KR/ArchiveResources.psd1 b/newton-cn/bin/Modules/Microsoft.PowerShell.Archive/ko-KR/ArchiveResources.psd1 deleted file mode 100644 index eee2b4e..0000000 Binary files a/newton-cn/bin/Modules/Microsoft.PowerShell.Archive/ko-KR/ArchiveResources.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/Microsoft.PowerShell.Diagnostics/Microsoft.PowerShell.Diagnostics.psd1 b/newton-cn/bin/Modules/Microsoft.PowerShell.Diagnostics/Microsoft.PowerShell.Diagnostics.psd1 deleted file mode 100644 index 6867cc0..0000000 --- a/newton-cn/bin/Modules/Microsoft.PowerShell.Diagnostics/Microsoft.PowerShell.Diagnostics.psd1 +++ /dev/null @@ -1,17 +0,0 @@ -@{ -GUID="CA046F10-CA64-4740-8FF9-2565DBA61A4F" -Author="Microsoft Corporation" -CompanyName="Microsoft Corporation" -Copyright="© Microsoft Corporation. All rights reserved." -ModuleVersion="3.0.0.0" -PowerShellVersion = '5.1' -CLRVersion="4.0" -AliasesToExport = @() -FunctionsToExport = @() -CmdletsToExport="Get-WinEvent", "Get-Counter", "Import-Counter", "Export-Counter", "New-WinEvent" -NestedModules="Microsoft.PowerShell.Commands.Diagnostics.dll" -TypesToProcess="..\..\GetEvent.types.ps1xml" -FormatsToProcess="..\..\Event.format.ps1xml","..\..\Diagnostics.format.ps1xml" -HelpInfoURI = 'https://go.microsoft.com/fwlink/?linkid=390783' -CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/Microsoft.PowerShell.Host/Microsoft.PowerShell.Host.psd1 b/newton-cn/bin/Modules/Microsoft.PowerShell.Host/Microsoft.PowerShell.Host.psd1 deleted file mode 100644 index 8ad693d..0000000 --- a/newton-cn/bin/Modules/Microsoft.PowerShell.Host/Microsoft.PowerShell.Host.psd1 +++ /dev/null @@ -1,14 +0,0 @@ -@{ -GUID="56D66100-99A0-4FFC-A12D-EEE9A6718AEF" -Author="Microsoft Corporation" -CompanyName="Microsoft Corporation" -Copyright="© Microsoft Corporation. All rights reserved." -ModuleVersion="3.0.0.0" -PowerShellVersion="3.0" -CLRVersion="4.0" -AliasesToExport = @() -FunctionsToExport = @() -CmdletsToExport="Start-Transcript", "Stop-Transcript" -NestedModules="Microsoft.PowerShell.ConsoleHost.dll" -HelpInfoURI = 'https://go.microsoft.com/fwlink/?linkid=390784' -} diff --git a/newton-cn/bin/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/LocalAccounts.format.ps1xml b/newton-cn/bin/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/LocalAccounts.format.ps1xml deleted file mode 100644 index 91b3b35..0000000 --- a/newton-cn/bin/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/LocalAccounts.format.ps1xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - Microsoft.PowerShell.Commands.LocalUser - - Microsoft.PowerShell.Commands.LocalUser - - - - - - - - - - - - - - - Name - - - Enabled - - - Description - - - - - - - - Microsoft.PowerShell.Commands.LocalGroup - - Microsoft.PowerShell.Commands.LocalGroup - - - - - - - - - - - - - Name - - - Description - - - - - - - - Microsoft.PowerShell.Commands.LocalPrincipal - - Microsoft.PowerShell.Commands.LocalPrincipal - - - - - - - - - - - - - - - ObjectClass - - - Name - - - PrincipalSource - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/Microsoft.PowerShell.LocalAccounts.dll b/newton-cn/bin/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/Microsoft.PowerShell.LocalAccounts.dll deleted file mode 100644 index 22fd512..0000000 Binary files a/newton-cn/bin/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/Microsoft.PowerShell.LocalAccounts.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/Microsoft.PowerShell.LocalAccounts.psd1 b/newton-cn/bin/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/Microsoft.PowerShell.LocalAccounts.psd1 deleted file mode 100644 index 4c5f249..0000000 --- a/newton-cn/bin/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/Microsoft.PowerShell.LocalAccounts.psd1 +++ /dev/null @@ -1,32 +0,0 @@ -@{ -RootModule = 'Microsoft.Powershell.LocalAccounts' -ModuleVersion = '1.0.0.0' -GUID = '8e362604-2c0b-448f-a414-a6a690a644e2' -Author = 'Microsoft Corporation' -CompanyName = 'Microsoft Corporation' -Copyright = '© Microsoft Corporation. All rights reserved.' -Description = 'Provides cmdlets to work with local users and local groups' -PowerShellVersion = '5.1' -CLRVersion = '4.0' -FormatsToProcess = @('LocalAccounts.format.ps1xml') -CmdletsToExport = @( - 'Add-LocalGroupMember', - 'Disable-LocalUser', - 'Enable-LocalUser', - 'Get-LocalGroup', - 'Get-LocalGroupMember', - 'Get-LocalUser', - 'New-LocalGroup', - 'New-LocalUser', - 'Remove-LocalGroup', - 'Remove-LocalGroupMember', - 'Remove-LocalUser', - 'Rename-LocalGroup', - 'Rename-LocalUser', - 'Set-LocalGroup', - 'Set-LocalUser' - ) -AliasesToExport= @( "algm", "dlu", "elu", "glg", "glgm", "glu", "nlg", "nlu", "rlg", "rlgm", "rlu", "rnlg", "rnlu", "slg", "slu") -HelpInfoURI = 'https://go.microsoft.com/fwlink/?LinkId=717973' -CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/ko/Microsoft.PowerShell.LocalAccounts.Resources.dll b/newton-cn/bin/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/ko/Microsoft.PowerShell.LocalAccounts.Resources.dll deleted file mode 100644 index 203512c..0000000 Binary files a/newton-cn/bin/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/ko/Microsoft.PowerShell.LocalAccounts.Resources.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1 b/newton-cn/bin/Modules/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1 deleted file mode 100644 index 0b09587..0000000 --- a/newton-cn/bin/Modules/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1 +++ /dev/null @@ -1,103 +0,0 @@ -@{ -GUID="EEFCB906-B326-4E99-9F54-8B4BB6EF3C6D" -Author="Microsoft Corporation" -CompanyName="Microsoft Corporation" -Copyright="© Microsoft Corporation. All rights reserved." -ModuleVersion="3.1.0.0" -PowerShellVersion="5.1" -CLRVersion="4.0" -NestedModules="Microsoft.PowerShell.Commands.Management.dll" -HelpInfoURI = 'https://go.microsoft.com/fwlink/?linkid=390785' -AliasesToExport = @("gcb", "scb", "gin", "gtz", "stz") -FunctionsToExport = @() -CmdletsToExport=@("Add-Content", - "Clear-Content", - "Clear-ItemProperty", - "Join-Path", - "Convert-Path", - "Copy-ItemProperty", - "Get-EventLog", - "Clear-EventLog", - "Write-EventLog", - "Limit-EventLog", - "Show-EventLog", - "New-EventLog", - "Remove-EventLog", - "Get-ChildItem", - "Get-Content", - "Get-ItemProperty", - "Get-ItemPropertyValue", - "Get-WmiObject", - "Invoke-WmiMethod", - "Move-ItemProperty", - "Get-Location", - "Set-Location", - "Push-Location", - "Pop-Location", - "New-PSDrive", - "Remove-PSDrive", - "Get-PSDrive", - "Get-Item", - "New-Item", - "Set-Item", - "Remove-Item", - "Move-Item", - "Rename-Item", - "Copy-Item", - "Clear-Item", - "Invoke-Item", - "Get-PSProvider", - "New-ItemProperty", - "Split-Path", - "Test-Path", - "Get-Process", - "Stop-Process", - "Wait-Process", - "Debug-Process", - "Start-Process", - "Remove-ItemProperty", - "Remove-WmiObject", - "Rename-ItemProperty", - "Register-WmiEvent", - "Resolve-Path", - "Get-Service", - "Stop-Service", - "Start-Service", - "Suspend-Service", - "Resume-Service", - "Restart-Service", - "Set-Service", - "New-Service", - "Set-Content", - "Set-ItemProperty", - "Set-WmiInstance", - "Get-Transaction", - "Start-Transaction", - "Complete-Transaction", - "Undo-Transaction", - "Use-Transaction", - "New-WebServiceProxy", - "Get-HotFix", - "Test-Connection", - "Enable-ComputerRestore", - "Disable-ComputerRestore", - "Checkpoint-Computer", - "Get-ComputerRestorePoint", - "Restart-Computer", - "Stop-Computer", - "Restore-Computer", - "Add-Computer", - "Remove-Computer", - "Test-ComputerSecureChannel", - "Reset-ComputerMachinePassword", - "Rename-Computer", - "Get-ControlPanelItem", - "Show-ControlPanelItem", - "Clear-Recyclebin", - "Get-Clipboard", - "Set-Clipboard", - "Get-ComputerInfo", - "Get-TimeZone", - "Set-TimeZone") -CompatiblePSEditions = @('Desktop','Core') -} diff --git a/newton-cn/bin/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataAdapter.ps1 b/newton-cn/bin/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataAdapter.ps1 deleted file mode 100644 index 00b21e6..0000000 Binary files a/newton-cn/bin/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataAdapter.ps1 and /dev/null differ diff --git a/newton-cn/bin/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtils.psd1 b/newton-cn/bin/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtils.psd1 deleted file mode 100644 index 842177f..0000000 Binary files a/newton-cn/bin/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtils.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtils.psm1 b/newton-cn/bin/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtils.psm1 deleted file mode 100644 index 27fa9fb..0000000 Binary files a/newton-cn/bin/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtils.psm1 and /dev/null differ diff --git a/newton-cn/bin/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtilsHelper.ps1 b/newton-cn/bin/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtilsHelper.ps1 deleted file mode 100644 index 9a258a3..0000000 Binary files a/newton-cn/bin/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtilsHelper.ps1 and /dev/null differ diff --git a/newton-cn/bin/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataV4Adapter.ps1 b/newton-cn/bin/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataV4Adapter.ps1 deleted file mode 100644 index 7ee88ff..0000000 --- a/newton-cn/bin/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataV4Adapter.ps1 +++ /dev/null @@ -1,2668 +0,0 @@ -Import-LocalizedData LocalizedData -FileName Microsoft.PowerShell.ODataUtilsStrings.psd1 - -# Add .NET classes used by the module -Add-Type -TypeDefinition $script:BaseClassDefinitions - -######################################################### -# Generates PowerShell module containing client side -# proxy cmdlets that can be used to interact with an -# OData based server side endpoint. -######################################################### -function ExportODataEndpointProxy -{ - param - ( - [string] $Uri, - [string] $OutputModule, - [string] $MetadataUri, - [PSCredential] $Credential, - [string] $CreateRequestMethod, - [string] $UpdateRequestMethod, - [string] $CmdletAdapter, - [Hashtable] $ResourceNameMapping, - [switch] $Force, - [Hashtable] $CustomData, - [switch] $AllowClobber, - [switch] $AllowUnsecureConnection, - [Hashtable] $Headers, - [string] $ProgressBarStatus, - [System.Management.Automation.PSCmdlet] $PSCmdlet - ) - - # Record of all metadata XML files which have been opened for parsing - # used to avoid parsing the same file twice, if referenced in multiple - # metadata files - $script:processedFiles = @() - - # Record of all referenced and parsed metadata files (including entry point metadata) - $script:GlobalMetadata = New-Object System.Collections.ArrayList - - # The namespace name might have invalid characters or might be conflicting with class names in inheritance scenarios - # We will be normalizing these namespaces and saving them into $normalizedNamespaces, where key is the original namespace and value is normalized namespace - $script:normalizedNamespaces = @{} - - # This information will be used during recursive referenced metadata files loading - $ODataEndpointProxyParameters = [ODataUtils.ODataEndpointProxyParameters] @{ - "MetadataUri" = $MetadataUri; - "Uri" = $Uri; - "Credential" = $Credential; - "OutputModule" = $OutputModule; - "Force" = $Force; - "AllowClobber" = $AllowClobber; - "AllowUnsecureConnection" = $AllowUnsecureConnection; - } - - # Recursively fetch all metadatas (referenced by entry point metadata) - $GlobalMetadata = GetTypeInfo -callerPSCmdlet $pscmdlet -MetadataUri $MetadataUri -ODataEndpointProxyParameters $ODataEndpointProxyParameters -Headers $Headers - # Now that we are done with recursive metadata references parsing we can get rid of this variable - $script:GlobalMetadata = $null - - VerifyMetadata $GlobalMetadata $AllowClobber.IsPresent $PSCmdlet $ProgressBarStatus - - # Get Uri Resource path key format. It can be either 'EmbeddedKey' or 'SeparateKey'. - # If not provided, deault value will be set to 'EmbeddedKey'. - $UriResourcePathKeyFormat = 'EmbeddedKey' - if ($CustomData -and $CustomData.ContainsKey("UriResourcePathKeyFormat")) - { - $UriResourcePathKeyFormat = $CustomData."UriResourcePathKeyFormat" - } - - GenerateClientSideProxyModule $GlobalMetadata $ODataEndpointProxyParameters $OutputModule $CreateRequestMethod $UpdateRequestMethod $CmdletAdapter $ResourceNameMapping $CustomData $UriResourcePathKeyFormat $ProgressBarStatus $script:normalizedNamespaces -} - -######################################################### -# GetTypeInfo is a helper method used to get all the types -# from metadata files in a recursive manner -######################################################### -function GetTypeInfo -{ - param - ( - [System.Management.Automation.PSCmdlet] $callerPSCmdlet, - [string] $MetadataUri, - [ODataUtils.ODataEndpointProxyParameters] $ODataEndpointProxyParameters, - [Hashtable] $Headers - ) - - if($callerPSCmdlet -eq $null) { throw ($LocalizedData.ArguementNullError -f "callerPSCmdlet", "GetTypeInfo") } - - $metadataSet = New-Object System.Collections.ArrayList - $metadataXML = GetMetaData $MetadataUri $callerPSCmdlet $ODataEndpointProxyParameters.Credential $Headers $ODataEndpointProxyParameters.AllowUnsecureConnection - $script:processedFiles += $MetadataUri - - # parses all referenced metadata XML files recursively - foreach ($reference in $metadataXML.Edmx.Reference) - { - if (-not $script:processedFiles.Contains($reference.Uri)) - { - $tmpMetadataSet = $null - $tmpMetadataSet = GetTypeInfo -callerPSCmdlet $callerPSCmdlet -MetadataUri $reference.Uri -ODataEndpointProxyParameters $ODataEndpointProxyParameters - AddMetadataToMetadataSet -Metadatas $metadataSet -NewMetadata $tmpMetadataSet - } - } - - $metadatas = ParseMetadata -MetadataXML $metadataXML -ODataVersion $metadataXML.Edmx.Version -MetadataUri $MetadataUri -Uri $ODataEndpointProxyParameters.Uri -MetadataSet $script:GlobalMetadata - AddMetadataToMetadataSet -Metadatas $script:GlobalMetadata -NewMetadata $metadatas - AddMetadataToMetadataSet -Metadatas $metadataSet -NewMetadata $metadatas - - return $metadataSet -} - -function AddMetadataToMetadataSet -{ - param - ( - [System.Collections.ArrayList] $Metadatas, - $NewMetadata - ) - - if($NewMetadata -eq $null) { throw ($LocalizedData.ArguementNullError -f "NewMetadata", "AddMetadataToMetadataSet") } - - if ($NewMetadata.GetType().Name -eq 'MetadataV4') - { - $Metadatas.Add($NewMetadata) | Out-Null - } - else - { - $Metadatas.AddRange($NewMetadata) | Out-Null - } -} - -######################################################### -# Normalization of Namespace name will be required in following scenarios: -# 1. Namespace name contains combination of dots and numbers -# 2. Namespace name collides with Class name (EntityType, EntitySet, etc.) -# If normalization is needed, all dots will be replaced with underscores and Ns suffix added -# User will receive warning notifying her about the namespace name change -######################################################### -function NormalizeNamespace -{ - param - ( - [string] $MetadataNamespace, - [string] $MetadataUri, - [Hashtable] $NormalizedNamespaces, - [boolean] $DoesNamespaceConflictsWithClassName - ) - - $doesNamespaceContainsInvalidChars = $false - - # Check if namespace name contains invalid combination if dots and numbers - if ($MetadataNamespace -match '\.[0-9]' -or $MetadataNamespace -match '[0-9]\.') - { - # Normalization needed - $doesNamespaceContainsInvalidChars = $true - } - - # Normalize if needed - if ($doesNamespaceContainsInvalidChars -or $DoesNamespaceConflictsWithClassName) - { - if ($NormalizedNamespaces.ContainsKey($MetadataNamespace)) - { - # It's possible we've already attemted to normalize that namespace. In that case we'll update normalized name. - $NormalizedNamespaces[$MetadataNamespace] = NormalizeNamespaceHelper $NormalizedNamespaces[$MetadataNamespace] $doesNamespaceContainsInvalidChars $DoesNamespaceConflictsWithClassName - } - else - { - $NormalizedNamespaces.Add($MetadataNamespace, (NormalizeNamespaceHelper $MetadataNamespace $doesNamespaceContainsInvalidChars $DoesNamespaceConflictsWithClassName)) - } - } - - # Print warning - if ($doesNamespaceContainsInvalidChars) - { - # Normalization needed - $warningMessage = ($LocalizedData.InValidSchemaNamespaceContainsInvalidChars -f $MetadataUri, $MetadataNamespace, $NormalizedNamespaces[$MetadataNamespace]) - Write-Warning $warningMessage - } - if ($DoesNamespaceConflictsWithClassName) - { - # Collision between namespace name and type name detected (example: namespace TaskService { class Service : Service.BasicService { ... } ... }) - # Normalization needed - $warningMessage = ($LocalizedData.InValidSchemaNamespaceConflictWithClassName -f $MetadataUri, $MetadataNamespace, $NormalizedNamespaces[$MetadataNamespace]) - Write-Warning $warningMessage - } -} - -function NormalizeNamespaceCollisionWithClassName -{ - param - ( - [string] $InheritingType, - [string] $BaseTypeName, - [string] $MetadataUri - ) - - if (![string]::IsNullOrEmpty($BaseTypeName)) - { - $dotNetNamespace = '' - if ($BaseTypeName.LastIndexOf(".") -gt 0) - { - # BaseTypeStr contains Namespace and TypeName. Extract Namespace name. - $dotNetNamespace = $BaseTypeName.SubString(0, $BaseTypeName.LastIndexOf(".")) - } - - if (![string]::IsNullOrEmpty($dotNetNamespace) -and $InheritingType -eq $dotNetNamespace) - { - # Collision between namespace name and type name detected (example: namespace TaskService { class Service : Service.BasicService { ... } ... }) - # Normalization needed - NormalizeNamespace $dotNetNamespace $MetadataUri $script:normalizedNamespaces $true - break - } - } -} - -######################################################### -# This helper method is used by functions, -# writing directly to CDXML files or to .Net namespace/class definitions CompplexTypes file -######################################################### -function GetNamespace -{ - param - ( - [string] $Namespace, - $NormalizedNamespaces, - [boolean] $isClassNameIncluded = $false - ) - - $dotNetNamespace = $Namespace - $dotNetClassName = '' - - # Extract only namespace name - if ($isClassNameIncluded) - { - if ($Namespace.LastIndexOf(".") -gt 0) - { - # For example, from following namespace (Namespace.TypeName) Service.1.0.0.Service we'll extract only namespace name, which is Service.1.0.0 - $dotNetNamespace = $Namespace.SubString(0, $Namespace.LastIndexOf(".")) - $dotNetClassName = $Namespace.SubString($Namespace.LastIndexOf(".") + 1, $Namespace.Length - $Namespace.LastIndexOf(".") - 1) - } - } - - # Check if the namespace has to be normalized. - if ($NormalizedNamespaces.ContainsKey($dotNetNamespace)) - { - $dotNetNamespace = $NormalizedNamespaces.Get_Item($dotNetNamespace) - } - - if (![string]::IsNullOrEmpty($dotNetClassName)) - { - return ($dotNetNamespace + "." + $dotNetClassName) - } - else - { - return $dotNetNamespace - } -} - -function NormalizeNamespaceHelper -{ - param - ( - [string] $Namespace, - [boolean] $DoesNamespaceContainsInvalidChars, - [boolean] $DoesNamespaceConflictsWithClassName - ) - - # For example, following namespace: Service.1.0.0 - # Will change to: Service_1_0_0 - # Ns postfix in Namespace name will allow to diffirintiate between this namespace - # and a colliding type name from different namespace - $updatedNs = $Namespace - if ($DoesNamespaceContainsInvalidChars) - { - $updatedNs = $updatedNs.Replace('.', '_') - } - if ($DoesNamespaceConflictsWithClassName) - { - $updatedNs = $updatedNs + "Ns" - } - - $updatedNs -} - -######################################################### -# Processes EntityTypes (OData V4 schema) from plain text -# xml metadata into our custom structure -######################################################### -function ParseEntityTypes -{ - param - ( - [System.Xml.XmlElement] $SchemaXML, - [ODataUtils.MetadataV4] $Metadata, - [System.Collections.ArrayList] $GlobalMetadata, - [hashtable] $EntityAndComplexTypesQueue, - [string] $CustomNamespace, - [AllowEmptyString()] - [string] $Alias - ) - - if($SchemaXML -eq $null) { throw ($LocalizedData.ArguementNullError -f "SchemaXML", "ParseEntityTypes") } - - foreach ($entityType in $SchemaXML.EntityType) - { - $baseType = $null - - if ($entityType.BaseType -ne $null) - { - # add it to the processing queue - $baseType = GetBaseType $entityType $Metadata $SchemaXML.Namespace $GlobalMetadata - if ($baseType -eq $null) - { - $EntityAndComplexTypesQueue[$entityType.BaseType] += @(@{type='EntityType'; value=$entityType}) - } - - # Check if Namespace has to be normalized because of the collision with the inheriting Class name - NormalizeNamespaceCollisionWithClassName -InheritingType $entityType.Name -BaseTypeName $entityType.BaseType -MetadataUri $Metadata.Uri - } - - [ODataUtils.EntityTypeV4] $newType = ParseMetadataTypeDefinition $entityType $baseType $Metadata $schema.Namespace $Alias $true $entityType.BaseType - $Metadata.EntityTypes += $newType - AddDerivedTypes $newType $entityAndComplexTypesQueue $Metadata $SchemaXML.Namespace - } -} - -######################################################### -# Processes ComplexTypes from plain text xml metadata -# into our custom structure -######################################################### -function ParseComplexTypes -{ - param - ( - [System.Xml.XmlElement] $SchemaXML, - [ODataUtils.MetadataV4] $Metadata, - [System.Collections.ArrayList] $GlobalMetadata, - [hashtable] $EntityAndComplexTypesQueue, - [string] $CustomNamespace, - [AllowEmptyString()] - [string] $Alias - ) - - if($SchemaXML -eq $null) { throw ($LocalizedData.ArguementNullError -f "SchemaXML", "ParseComplexTypes") } - - foreach ($complexType in $SchemaXML.ComplexType) - { - $baseType = $null - - if ($complexType.BaseType -ne $null) - { - # add it to the processing queue - $baseType = GetBaseType $complexType $metadata $SchemaXML.Namespace $GlobalMetadata - if ($baseType -eq $null -and $entityAndComplexTypesQueue -ne $null -and $entityAndComplexTypesQueue.ContainsKey($complexType.BaseType)) - { - $entityAndComplexTypesQueue[$complexType.BaseType] += @(@{type='ComplexType'; value=$complexType}) - continue - } - - # Check if Namespace has to be normalized because of the collision with the inheriting Class name - NormalizeNamespaceCollisionWithClassName -InheritingType $complexType.Name -BaseTypeName $complexType.BaseType -MetadataUri $Metadata.Uri - } - - [ODataUtils.EntityTypeV4] $newType = ParseMetadataTypeDefinition $complexType $baseType $Metadata $schema.Namespace -Alias $Alias $false $complexType.BaseType - $Metadata.ComplexTypes += $newType - AddDerivedTypes $newType $entityAndComplexTypesQueue $metadata $schema.Namespace - } -} - -######################################################### -# Processes TypeDefinition from plain text xml metadata -# into our custom structure -######################################################### -function ParseTypeDefinitions -{ - param - ( - [System.Xml.XmlElement] $SchemaXML, - [ODataUtils.MetadataV4] $Metadata, - [System.Collections.ArrayList] $GlobalMetadata, - [string] $CustomNamespace, - [AllowEmptyString()] - [string] $Alias - ) - - if($SchemaXML -eq $null) { throw ($LocalizedData.ArguementNullError -f "SchemaXML", "ParseTypeDefinitions") } - - - foreach ($typeDefinition in $SchemaXML.TypeDefinition) - { - $newType = [ODataUtils.EntityTypeV4] @{ - "Namespace" = $Metadata.Namespace; - "Alias" = $Metadata.Alias; - "Name" = $typeDefinition.Name; - "BaseTypeStr" = $typeDefinition.UnderlyingType; - } - $Metadata.TypeDefinitions += $newType - } -} - -######################################################### -# Processes EnumTypes from plain text xml metadata -# into our custom structure -######################################################### -function ParseEnumTypes -{ - param - ( - [System.Xml.XmlElement] $SchemaXML, - [ODataUtils.MetadataV4] $Metadata - ) - - if($SchemaXML -eq $null) { throw ($LocalizedData.ArguementNullError -f "SchemaXML", "ParseEnumTypes") } - - foreach ($enum in $SchemaXML.EnumType) - { - $newEnumType = [ODataUtils.EnumType] @{ - "Namespace" = $Metadata.Namespace; - "Alias" = $Metadata.Alias; - "Name" = $enum.Name; - "UnderlyingType" = $enum.UnderlyingType; - "IsFlags" = $enum.IsFlags; - "Members" = @() - } - - if (!$newEnumType.UnderlyingType) - { - # If no type specified set the default type which is Edm.Int32 - $newEnumType.UnderlyingType = "Edm.Int32" - } - - if ($newEnumType.IsFlags -eq $null) - { - # If no value is specified for IsFlags, its value defaults to false. - $newEnumType.IsFlags = $false - } - - $enumValue = 0 - $currentEnumValue = 0 - - # Now parse EnumType elements - foreach ($element in $enum.Member) - { - - if ($element.Value -eq "" -and $newEnumType.IsFlags -eq $true) - { - # When IsFlags set to true each edm:Member element MUST specify a non-negative integer Value in the value attribute - $errorMessage = ($LocalizedData.InValidMetadata) - $detailedErrorMessage = "When IsFlags set to true each edm:Member element MUST specify a non-negative integer Value in the value attribute in " + $newEnumType.Name + " EnumType" - $exception = [System.InvalidOperationException]::new($errorMessage, $detailedErrorMessage) - $errorRecord = CreateErrorRecordHelper "InValidMetadata" $null ([System.Management.Automation.ErrorCategory]::InvalidData) $detailedErrorMessage nu - $PSCmdlet.ThrowTerminatingError($errorRecord) - } - elseif (($element.Value -eq $null) -or ($element.Value.GetType().Name -eq "Int32" -and $element.Value -eq "")) - { - # If no values are specified, the members are assigned consecutive integer values in the order of their appearance, - # starting with zero for the first member. - $currentEnumValue = $enumValue - } - else - { - $currentEnumValue = $element.Value - } - - $tmp = [ODataUtils.EnumMember] @{ - "Name" = $element.Name; - "Value" = $currentEnumValue; - } - - $newEnumType.Members += $tmp - $enumValue++ - } - - $Metadata.EnumTypes += $newEnumType - } -} - -######################################################### -# Processes SingletonTypes from plain text xml metadata -# into our custom structure -######################################################### -function ParseSingletonTypes -{ - param - ( - [System.Xml.XmlElement] $SchemaEntityContainerXML, - [ODataUtils.MetadataV4] $Metadata - ) - - if($SchemaEntityContainerXML -eq $null) { throw ($LocalizedData.ArguementNullError -f "SchemaEntityContainerXML", "ParseSingletonTypes") } - - foreach ($singleton in $SchemaEntityContainerXML.Singleton) - { - $navigationPropertyBindings = @() - - foreach ($navigationPropertyBinding in $singleton.NavigationPropertyBinding) - { - $tmp = [ODataUtils.NavigationPropertyBinding] @{ - "Path" = $navigationPropertyBinding.Path; - "Target" = $navigationPropertyBinding.Target; - } - - $navigationPropertyBindings += $tmp - } - - $newSingletonType = [ODataUtils.SingletonType] @{ - "Namespace" = $Metadata.Namespace; - "Alias" = $Metadata.Alias; - "Name" = $singleton.Name; - "Type" = $singleton.Type; - "NavigationPropertyBindings" = $navigationPropertyBindings; - } - - $Metadata.SingletonTypes += $newSingletonType - } -} - -######################################################### -# Processes EntitySets from plain text xml metadata -# into our custom structure -######################################################### -function ParseEntitySets -{ - param - ( - [System.Xml.XmlElement] $SchemaEntityContainerXML, - [ODataUtils.MetadataV4] $Metadata, - [string] $Namespace, - [AllowEmptyString()] - [string] $Alias - ) - - if($SchemaEntityContainerXML -eq $null) { throw ($LocalizedData.ArguementNullError -f "SchemaEntityContainerXML", "ParseEntitySets") } - - $entityTypeToEntitySetMapping = @{}; - foreach ($entitySet in $SchemaEntityContainerXML.EntitySet) - { - $entityType = $metadata.EntityTypes | Where-Object { $_.Name -eq $entitySet.EntityType.Split('.')[-1] } - $entityTypeName = $entityType.Name - - if($entityTypeToEntitySetMapping.ContainsKey($entityTypeName)) - { - $existingEntitySetName = $entityTypeToEntitySetMapping[$entityTypeName] - throw ($LocalizedData.EntityNameConflictError -f $entityTypeName, $existingEntitySetName, $entitySet.Name, $entityTypeName ) - } - else - { - $entityTypeToEntitySetMapping.Add($entityTypeName, $entitySet.Name) - } - - $newEntitySet = [ODataUtils.EntitySetV4] @{ - "Namespace" = $Namespace; - "Alias" = $Alias; - "Name" = $entitySet.Name; - "Type" = $entityType; - } - - $Metadata.EntitySets += $newEntitySet - } -} - -######################################################### -# Processes Actions from plain text xml metadata -# into our custom structure -######################################################### -function ParseActions -{ - param - ( - [System.Object[]] $SchemaActionsXML, - [ODataUtils.MetadataV4] $Metadata - ) - - if($SchemaActionsXML -eq $null) { throw ($LocalizedData.ArguementNullError -f "SchemaActionsXML", "ParseActions") } - - foreach ($action in $SchemaActionsXML) - { - # HttpMethod is only used for legacy Service Operations - if ($action.HttpMethod -eq $null) - { - $newAction = [ODataUtils.ActionV4] @{ - "Namespace" = $Metadata.Namespace; - "Alias" = $Metadata.Alias; - "Name" = $action.Name; - "Action" = $Metadata.Namespace + '.' + $action.Name; - } - - # Actions are always SideEffecting, otherwise it's an OData function - foreach ($parameter in $action.Parameter) - { - if ($parameter.Nullable -ne $null) - { - $parameterIsNullable = [System.Convert]::ToBoolean($parameter.Nullable); - } - else - { - $parameterIsNullable = $true - } - - $newParameter = [ODataUtils.TypeProperty] @{ - "Name" = $parameter.Name; - "TypeName" = $parameter.Type; - "IsNullable" = $parameterIsNullable; - } - - $newAction.Parameters += $newParameter - } - - if ($action.EntitySet -ne $null) - { - $newAction.EntitySet = $metadata.EntitySets | Where-Object { $_.Name -eq $action.EntitySet } - } - - $Metadata.Actions += $newAction - } - } -} - -######################################################### -# Processes Functions from plain text xml metadata -# into our custom structure -######################################################### -function ParseFunctions -{ - param - ( - [System.Object[]] $SchemaFunctionsXML, - [ODataUtils.MetadataV4] $Metadata - ) - - if($SchemaFunctionsXML -eq $null) { throw ($LocalizedData.ArguementNullError -f "SchemaFunctionsXML", "ParseFunctions") } - - foreach ($function in $SchemaFunctionsXML) - { - # HttpMethod is only used for legacy Service Operations - if ($function.HttpMethod -eq $null) - { - $newFunction = [ODataUtils.FunctionV4] @{ - "Namespace" = $Metadata.Namespace; - "Alias" = $Metadata.Alias; - "Name" = $function.Name; - "Function" = $Metadata.Namespace + '.' + $function.Name; - "EntitySet" = $function.EntitySetPath; - "ReturnType" = $function.ReturnType; - } - - # Future TODO - consider removing this hack once all the service we run against fix this issue - # Hack - sometimes service does not return ReturnType, however this information can be found in InnerXml - if ($newFunction.ReturnType -eq '' -or $newFunction.ReturnType -eq 'System.Xml.XmlElement') - { - try - { - [xml] $innerXML = '' + $function.InnerXml + '' - $newFunction.Returntype = $innerXML.Params.ReturnType.Type - } - catch - { - # Do nothing - } - } - - # Keep only EntityType name - $newFunction.ReturnType = $newFunction.ReturnType.Replace('Collection(', '') - $newFunction.ReturnType = $newFunction.ReturnType.Replace(')', '') - - # Actions are always SideEffecting, otherwise it's an OData function - foreach ($parameter in $function.Parameter) - { - if ($parameter.Nullable -ne $null) - { - $parameterIsNullable = [System.Convert]::ToBoolean($parameter.Nullable); - } - - $newParameter = [ODataUtils.Parameter] @{ - "Name" = $parameter.Name; - "Type" = $parameter.Type; - "Nullable" = $parameterIsNullable; - } - - $newFunction.Parameters += $newParameter - } - - $Metadata.Functions += $newFunction - } - } -} - -######################################################### -# Processes plain text xml metadata (OData V4 schema version) into our custom structure -# MetadataSet contains all parsed so far referenced Metadatas (for base class lookup) -######################################################### -function ParseMetadata -{ - param - ( - [xml] $MetadataXML, - [string] $ODataVersion, - [string] $MetadataUri, - [string] $Uri, - [System.Collections.ArrayList] $MetadataSet - ) - - if($MetadataXML -eq $null) { throw ($LocalizedData.ArguementNullError -f "MetadataXML", "ParseMetadata") } - - # This is a processing queue for those types that require base types that haven't been defined yet - $entityAndComplexTypesQueue = @{} - [System.Collections.ArrayList] $metadatas = [System.Collections.ArrayList]::new() - - foreach ($schema in $MetadataXML.Edmx.DataServices.Schema) - { - if ($schema -eq $null) - { - Write-Error $LocalizedData.EmptySchema - continue - } - - [ODataUtils.MetadataV4] $metadata = [ODataUtils.MetadataV4]::new() - $metadata.ODataVersion = $ODataVersion - $metadata.MetadataUri = $MetadataUri - $metadata.Uri = $Uri - $metadata.Namespace = $schema.Namespace - $metadata.Alias = $schema.Alias - - ParseEntityTypes -SchemaXML $schema -metadata $metadata -GlobalMetadata $MetadataSet -EntityAndComplexTypesQueue $entityAndComplexTypesQueue -CustomNamespace $CustomNamespace -Alias $metadata.Alias - ParseComplexTypes -SchemaXML $schema -metadata $metadata -GlobalMetadata $MetadataSet -EntityAndComplexTypesQueue $entityAndComplexTypesQueue -CustomNamespace $CustomNamespace -Alias $metadata.Alias - ParseTypeDefinitions -SchemaXML $schema -metadata $metadata -GlobalMetadata $MetadataSet -CustomNamespace $CustomNamespace -Alias $metadata.Alias - ParseEnumTypes -SchemaXML $schema -metadata $metadata - - foreach ($entityContainer in $schema.EntityContainer) - { - if ($entityContainer.IsDefaultEntityContainer) - { - $metadata.DefaultEntityContainerName = $entityContainer.Name - } - - ParseSingletonTypes -SchemaEntityContainerXML $entityContainer -Metadata $metadata - ParseEntitySets -SchemaEntityContainerXML $entityContainer -Metadata $metadata -Namespace $schema.Namespace -Alias $schema.Alias - } - - if ($schema.Action) - { - ParseActions -SchemaActionsXML $schema.Action -Metadata $metadata - } - - if ($schema.Function) - { - ParseFunctions -SchemaFunctionsXML $schema.Function -Metadata $metadata - } - - # In this call we check if the Namespace or Alias have to be normalized because it has invalid combination of dots and numbers. - # Note: In ParseEntityTypes and ParseComplexTypes we check for scenario where namespace/alias collide with inheriting class name. - NormalizeNamespace $metadata.Namespace $metadata.Uri $script:normalizedNamespaces $false - NormalizeNamespace $metadata.Alias $metadata.Uri $script:normalizedNamespaces $false - - $metadatas.Add($metadata) | Out-Null - } - - $metadatas -} - -######################################################### -# Verifies processed metadata for correctness -######################################################### -function VerifyMetadata -{ - param - ( - [System.Collections.ArrayList] $metadataSet, - [boolean] $allowClobber, - $callerPSCmdlet, - [string] $progressBarStatus - ) - - if($callerPSCmdlet -eq $null) { throw ($LocalizedData.ArguementNullError -f "PSCmdlet", "VerifyMetaData") } - if($progressBarStatus -eq $null) { throw ($LocalizedData.ArguementNullError -f "ProgressBarStatus", "VerifyMetaData") } - - Write-Verbose $LocalizedData.VerboseVerifyingMetadata - - $reservedProperties = @("Filter", "OrderBy", "Skip", "Top", "ConnectionUri", "CertificateThumbPrint", "Credential") - $validEntitySets = @() - $sessionCommands = Get-Command -All - - - foreach ($metadata in $metadataSet) - { - foreach ($entitySet in $metadata.EntitySets) - { - if ($entitySet.Type -eq $null) - { - $errorMessage = ($LocalizedData.EntitySetUndefinedType -f $metadata.MetadataUri, $entitySet.Name) - $exception = [System.InvalidOperationException]::new($errorMessage) - $errorRecord = CreateErrorRecordHelper "ODataEndpointProxyInvalidMetaDataUri" $null ([System.Management.Automation.ErrorCategory]::InvalidArgument) $exception $metadata.MetadataUri - $callerPSCmdlet.ThrowTerminatingError($errorRecord) - } - - $hasConflictingProperty = $false - $hasConflictingCommand = $false - $entityAndNavigationProperties = $entitySet.Type.EntityProperties + $entitySet.Type.NavigationProperties - foreach($entityProperty in $entityAndNavigationProperties) - { - if($reservedProperties.Contains($entityProperty.Name)) - { - $hasConflictingProperty = $true - if(!$allowClobber) - { - # Write Error message and skip current Entity Set. - $errorMessage = ($LocalizedData.SkipEntitySetProxyCreation -f $entitySet.Name, $entitySet.Type.Name, $entityProperty.Name) - $exception = [System.InvalidOperationException]::new($errorMessage) - $errorRecord = CreateErrorRecordHelper "ODataEndpointDefaultPropertyCollision" $null ([System.Management.Automation.ErrorCategory]::InvalidOperation) $exception $metadata.MetadataUri - $callerPSCmdlet.WriteError($errorRecord) - } - else - { - $warningMessage = ($LocalizedData.EntitySetProxyCreationWithWarning -f $entitySet.Name, $entityProperty.Name, $entitySet.Type.Name) - $callerPSCmdlet.WriteWarning($warningMessage) - } - } - } - - foreach($currentCommand in $sessionCommands) - { - if(($null -ne $currentCommand.Noun -and $currentCommand.Noun -eq $entitySet.Name) -and - ($currentCommand.Verb -eq "Get" -or - $currentCommand.Verb -eq "Set" -or - $currentCommand.Verb -eq "New" -or - $currentCommand.Verb -eq "Remove")) - { - $hasConflictingCommand = $true - VerifyMetadataHelper $LocalizedData.SkipEntitySetConflictCommandCreation ` - $LocalizedData.EntitySetConflictCommandCreationWithWarning ` - $entitySet.Name $currentCommand.Name $metadata.MetadataUri $allowClobber $callerPSCmdlet - } - } - - foreach($currentAction in $metadata.Actions) - { - $actionCommand = "Invoke-" + "$($entitySet.Name)$($currentAction.Verb)" - - foreach($currentCommand in $sessionCommands) - { - if($actionCommand -eq $currentCommand.Name) - { - $hasConflictingCommand = $true - VerifyMetadataHelper $LocalizedData.SkipEntitySetConflictCommandCreation ` - $LocalizedData.EntitySetConflictCommandCreationWithWarning $entitySet.Name ` - $currentCommand.Name $metadata.MetadataUri $allowClobber $callerPSCmdlet - } - } - } - - if(!($hasConflictingProperty -or $hasConflictingCommand)-or $allowClobber) - { - $validEntitySets += $entitySet - } - } - - $metadata.EntitySets = $validEntitySets - - $validServiceActions = @() - $hasConflictingServiceActionCommand - foreach($currentAction in $metadata.Actions) - { - $serviceActionCommand = "Invoke-" + "$($currentAction.Verb)" - - foreach($currentCommand in $sessionCommands) - { - if($serviceActionCommand -eq $currentCommand.Name) - { - $hasConflictingServiceActionCommand = $true - VerifyMetadataHelper $LocalizedData.SkipConflictServiceActionCommandCreation ` - $LocalizedData.ConflictServiceActionCommandCreationWithWarning $entitySet.Name ` - $currentCommand.Name $metadata.MetadataUri $allowClobber $callerPSCmdlet - } - } - - if(!$hasConflictingServiceActionCommand -or $allowClobber) - { - $validServiceActions += $currentAction - } - } - - $metadata.Actions = $validServiceActions - } - - # Update Progress bar. - ProgressBarHelper "Export-ODataEndpointProxy" $progressBarStatus 5 20 1 1 -} - -######################################################### -# Takes xml definition of a class from metadata document, -# plus existing metadata structure and finds its base class -######################################################### -function GetBaseType -{ - param - ( - [System.Xml.XmlElement] $MetadataEntityDefinition, - [ODataUtils.MetadataV4] $Metadata, - [string] $Namespace, - [System.Collections.ArrayList] $GlobalMetadata - ) - - if ($metadataEntityDefinition -ne $null -and - $metaData -ne $null -and - $MetadataEntityDefinition.BaseType -ne $null) - { - $baseType = $Metadata.EntityTypes | Where { $_.Namespace + "." + $_.Name -eq $MetadataEntityDefinition.BaseType -or $_.Alias + "." + $_.Name -eq $MetadataEntityDefinition.BaseType } - if ($baseType -eq $null) - { - $baseType = $Metadata.ComplexTypes | Where { $_.Namespace + "." + $_.Name -eq $MetadataEntityDefinition.BaseType -or $_.Alias + "." + $_.Name -eq $MetadataEntityDefinition.BaseType } - } - - if ($baseType -eq $null) - { - # Look in other metadatas, since the class can be defined in referenced metadata - foreach ($referencedMetadata in $GlobalMetadata) - { - if (($baseType = $referencedMetadata.EntityTypes | Where { $_.Namespace + "." + $_.Name -eq $MetadataEntityDefinition.BaseType -or $_.Alias + "." + $_.Name -eq $MetadataEntityDefinition.BaseType }) -ne $null -or - ($baseType = $referencedMetadata.ComplexTypes | Where { $_.Namespace + "." + $_.Name -eq $MetadataEntityDefinition.BaseType -or $_.Alias + "." + $_.Name -eq $MetadataEntityDefinition.BaseType }) -ne $null) - { - # Found base class - break - } - } - } - } - - if ($baseType -ne $null) - { - $baseType[0] - } -} - -######################################################### -# Takes base class name and global metadata structure -# and finds its base class -######################################################### -function GetBaseTypeByName -{ - param - ( - [String] $BaseTypeStr, - [System.Collections.ArrayList] $GlobalMetadata - ) - - if ($BaseTypeStr -ne $null) - { - - # Look for base class definition in all referenced metadatas (including entry point) - foreach ($referencedMetadata in $GlobalMetadata) - { - if (($baseType = $referencedMetadata.EntityTypes | Where { $_.Namespace + "." + $_.Name -eq $BaseTypeStr -or $_.Alias + "." + $_.Name -eq $BaseTypeStr }) -ne $null -or - ($baseType = $referencedMetadata.ComplexTypes | Where { $_.Namespace + "." + $_.Name -eq $BaseTypeStr -or $_.Alias + "." + $_.Name -eq $BaseTypeStr }) -ne $null) - { - # Found base class - break - } - } - } - - if ($baseType -ne $null) - { - $baseType[0] - } - else - { - $null - } -} - -######################################################### -# Processes derived types of a newly added type, -# that were previously waiting in the queue -######################################################### -function AddDerivedTypes { - param( - [ODataUtils.EntityTypeV4] $baseType, - $entityAndComplexTypesQueue, - [ODataUtils.MetadataV4] $metadata, - [string] $namespace - ) - - if($baseType -eq $null) { throw ($LocalizedData.ArguementNullError -f "BaseType", "AddDerivedTypes") } - if($entityAndComplexTypesQueue -eq $null) { throw ($LocalizedData.ArguementNullError -f "EntityAndComplexTypesQueue", "AddDerivedTypes") } - if($namespace -eq $null) { throw ($LocalizedData.ArguementNullError -f "Namespace", "AddDerivedTypes") } - - $baseTypeFullName = $baseType.Namespace + '.' + $baseType.Name - $baseTypeShortName = $baseType.Alias + '.' + $baseType.Name - - if ($entityAndComplexTypesQueue.ContainsKey($baseTypeFullName) -or $entityAndComplexTypesQueue.ContainsKey($baseTypeShortName)) - { - $types = $entityAndComplexTypesQueue[$baseTypeFullName] + $entityAndComplexTypesQueue[$baseTypeShortName] - - foreach ($type in $types) - { - if ($type.type -eq 'EntityType') - { - $newType = ParseMetadataTypeDefinition ($type.value) $baseType $metadata $namespace $true - $metadata.EntityTypes += $newType - } - else - { - $newType = ParseMetadataTypeDefinition ($type.value) $baseType $metadata $namespace $false - $metadata.ComplexTypes += $newType - } - - AddDerivedTypes $newType $entityAndComplexTypesQueue $metadata $namespace - } - } -} - -######################################################### -# Parses types definitions element of metadata xml -######################################################### -function ParseMetadataTypeDefinitionHelper -{ - param - ( - [System.Xml.XmlElement] $metadataEntityDefinition, - [ODataUtils.EntityTypeV4] $baseType, - [string] $baseTypeStr, - [ODataUtils.MetadataV4] $metadata, - [string] $namespace, - [AllowEmptyString()] - [string] $alias, - [bool] $isEntity - ) - - if($metadataEntityDefinition -eq $null) { throw ($LocalizedData.ArguementNullError -f "MetadataEntityDefinition", "ParseMetadataTypeDefinition") } - if($namespace -eq $null) { throw ($LocalizedData.ArguementNullError -f "Namespace", "ParseMetadataTypeDefinition") } - - [ODataUtils.EntityTypeV4] $newEntityType = CreateNewEntityType -metadataEntityDefinition $metadataEntityDefinition -baseType $baseType -baseTypeStr $baseTypeStr -namespace $namespace -alias $alias -isEntity $isEntity - - if ($baseType -ne $null) - { - # Add properties inherited from BaseType - ParseMetadataBaseTypeDefinitionHelper $newEntityType $baseType - } - - # properties defined on EntityType - $newEntityType.EntityProperties += $metadataEntityDefinition.Property | % { - if ($_ -ne $null) - { - if ($_.Nullable -ne $null) - { - $newPropertyIsNullable = [System.Convert]::ToBoolean($_.Nullable) - } - else - { - $newPropertyIsNullable = $true - } - - [ODataUtils.TypeProperty] @{ - "Name" = $_.Name; - "TypeName" = $_.Type; - "IsNullable" = $newPropertyIsNullable; - } - } - } - - # odataId property will be inherited from base type, if it exists. - # Otherwise, it should be added to current type - if ($baseType -eq $null) - { - # @odata.Id property (renamed to odataId) is required for dynamic Uri creation - # This property is only available when user executes auto-generated cmdlet with -AllowAdditionalData, - # but ODataAdapter needs it to construct Uri to access navigation properties. - # Thus, we need to fetch this info for scenario when -AllowAdditionalData isn't used. - $newEntityType.EntityProperties += [ODataUtils.TypeProperty] @{ - "Name" = "odataId"; - "TypeName" = "Edm.String"; - "IsNullable" = $True; - } - } - - # Property name can't be identical to entity type name. - # If such property exists, "Property" suffix will be added to its name. - foreach ($property in $newEntityType.EntityProperties) - { - if ($property.Name -eq $newEntityType.Name) - { - $property.Name += "Property" - } - } - - if ($metadataEntityDefinition -ne $null -and $metadataEntityDefinition.Key -ne $null) - { - foreach ($entityTypeKey in $metadataEntityDefinition.Key.PropertyRef) - { - ($newEntityType.EntityProperties | Where-Object { $_.Name -eq $entityTypeKey.Name }).IsKey = $true - } - } - - $newEntityType -} - -######################################################### -# Add base class entity and navigation properties to inheriting class -######################################################### -function ParseMetadataBaseTypeDefinitionHelper -{ - param - ( - [ODataUtils.EntityTypeV4] $EntityType, - [ODataUtils.EntityTypeV4] $BaseType - ) - - if ($EntityType -ne $null -and $BaseType -ne $null) - { - # Add properties inherited from BaseType - $EntityType.EntityProperties += $BaseType.EntityProperties - $EntityType.NavigationProperties += $BaseType.NavigationProperties - } -} - -######################################################### -# Create new EntityType object -######################################################### -function CreateNewEntityType -{ - param - ( - [System.Xml.XmlElement] $metadataEntityDefinition, - [ODataUtils.EntityTypeV4] $baseType, - [string] $baseTypeStr, - [string] $namespace, - [AllowEmptyString()] - [string] $alias, - [bool] $isEntity - ) - $newEntityType = [ODataUtils.EntityTypeV4] @{ - "Namespace" = $namespace; - "Alias" = $alias; - "Name" = $metadataEntityDefinition.Name; - "IsEntity" = $isEntity; - "BaseType" = $baseType; - "BaseTypeStr" = $baseTypeStr; - } - - $newEntityType -} - -######################################################### -# Parses navigation properties from metadata xml -######################################################### -function ParseMetadataTypeDefinitionNavigationProperties -{ - param - ( - [System.Xml.XmlElement] $metadataEntityDefinition, - [ODataUtils.EntityTypeV4] $entityType - ) - - # navigation properties defined on EntityType - $newEntityType.NavigationProperties = @{} - $newEntityType.NavigationProperties.Clear() - - foreach ($navigationProperty in $metadataEntityDefinition.NavigationProperty) - { - $tmp = [ODataUtils.NavigationPropertyV4] @{ - "Name" = $navigationProperty.Name; - "Type" = $navigationProperty.Type; - "Nullable" = $navigationProperty.Nullable; - "Partner" = $navigationProperty.Partner; - "ContainsTarget" = $navigationProperty.ContainsTarget; - "OnDelete" = $navigationProperty.OnDelete; - } - - $referentialConstraints = @{} - foreach ($constraint in $navigationProperty.ReferentialConstraints) - { - $tmp = [ODataUtils.ReferencedConstraint] @{ - "Property" = $constraint.Property; - "ReferencedProperty" = $constraint.ReferencedProperty; - } - } - - $newEntityType.NavigationProperties += $tmp - } -} - -######################################################### -# Parses types definitions element of metadata xml for OData V4 schema -######################################################### -function ParseMetadataTypeDefinition -{ - param - ( - [System.Xml.XmlElement] $metadataEntityDefinition, - [ODataUtils.EntityTypeV4] $baseType, - [ODataUtils.MetadataV4] $metadata, - [string] $namespace, - [AllowEmptyString()] - [string] $alias, - [bool] $isEntity, - [string] $baseTypeStr - ) - - if($metadataEntityDefinition -eq $null) { throw ($LocalizedData.ArguementNullError -f "MetadataEntityDefinition", "ParseMetadataTypeDefinition") } - if($namespace -eq $null) { throw ($LocalizedData.ArguementNullError -f "Namespace", "ParseMetadataTypeDefinition") } - - [ODataUtils.EntityTypeV4] $newEntityType = ParseMetadataTypeDefinitionHelper -metadataEntityDefinition $metadataEntityDefinition -baseType $baseType -baseTypeStr $baseTypeStr -metadata $metadata -namespace $namespace -alias $alias -isEntity $isEntity - ParseMetadataTypeDefinitionNavigationProperties -metadataEntityDefinition $metadataEntityDefinition -entityType $newEntityType - - $newEntityType -} - -######################################################### -# Create psd1 and cdxml files required to auto-generate -# cmdlets for given service. -######################################################### -function GenerateClientSideProxyModule -{ - param - ( - [System.Collections.ArrayList] $GlobalMetadata, - [ODataUtils.ODataEndpointProxyParameters] $ODataEndpointProxyParameters, - [string] $OutputModule, - [string] $CreateRequestMethod, - [string] $UpdateRequestMethod, - [string] $CmdletAdapter, - [Hashtable] $resourceNameMappings, - [Hashtable] $CustomData, - [string] $UriResourcePathKeyFormat, - [string] $progressBarStatus, - $NormalizedNamespaces - ) - - if($progressBarStatus -eq $null) { throw ($LocalizedData.ArguementNullError -f "ProgressBarStatus", "GenerateClientSideProxyModule") } - - Write-Verbose ($LocalizedData.VerboseSavingModule -f $OutputModule) - - # Save ComplexTypes for all metadata schemas in single file - $typeDefinationFileName = "ComplexTypeDefinitions.psm1" - $complexTypeMapping = GenerateComplexTypeDefinition $GlobalMetadata $OutputModule $typeDefinationFileName $NormalizedNamespaces - - ProgressBarHelper "Export-ODataEndpointProxy" $progressBarStatus 20 20 1 1 - - $actions = @() - $functions = @() - - $currentEntryCount = 0 - foreach ($Metadata in $GlobalMetadata) - { - foreach ($entitySet in $Metadata.EntitySets) - { - $currentEntryCount += 1 - SaveCDXML $entitySet $Metadata $GlobalMetadata $Metadata.Uri $OutputModule $CreateRequestMethod $UpdateRequestMethod $CmdletAdapter $resourceNameMappings $CustomData $complexTypeMapping $UriResourcePathKeyFormat $NormalizedNamespaces - - ProgressBarHelper "Export-ODataEndpointProxy" $progressBarStatus 40 20 $Metadata.EntitySets.Count $currentEntryCount - } - - $currentEntryCount = 0 - foreach ($singleton in $Metadata.SingletonTypes) - { - $currentEntryCount += 1 - SaveCDXMLSingletonCmdlets $singleton $Metadata $GlobalMetadata $Metadata.Uri $OutputModule $CreateRequestMethod $UpdateRequestMethod $CmdletAdapter $resourceNameMappings $CustomData $complexTypeMapping $NormalizedNamespaces - - ProgressBarHelper "Export-ODataEndpointProxy" $progressBarStatus 40 20 $Metadata.Singletons.Count $currentEntryCount - } - - $actions += $Metadata.Actions | Where-Object { $_.EntitySet -eq '' -or $_.EntitySet -eq $null } - $functions += $Metadata.Functions | Where-Object { $_.EntitySet -eq '' -or $_.EntitySet -eq $null } - } - - if ($actions.Count -gt 0 -or $functions.Count -gt 0) - { - # Save Service Actions for all metadata schemas in single file - SaveServiceActionsCDXML $GlobalMetadata $ODataEndpointProxyParameters "$OutputModule\ServiceActions.cdxml" $complexTypeMapping $progressBarStatus $CmdletAdapter - } - - $moduleDirInfo = [System.IO.DirectoryInfo]::new($OutputModule) - $moduleManifestName = $moduleDirInfo.Name + ".psd1" - - if ($actions.Count -gt 0 -or $functions.Count -gt 0) - { - $additionalModules = @($typeDefinationFileName, 'ServiceActions.cdxml') - } - else - { - $additionalModules = @($typeDefinationFileName) - } - - GenerateModuleManifest $GlobalMetadata $OutputModule\$moduleManifestName $additionalModules $resourceNameMappings $progressBarStatus -} - -######################################################### -# Generates CDXML module for a specific OData EntitySet -######################################################### -function SaveCDXML -{ - param - ( - [ODataUtils.EntitySetV4] $EntitySet, - [ODataUtils.MetadataV4] $Metadata, - [System.Collections.ArrayList] $GlobalMetadata, - [string] $Uri, - [string] $OutputModule, - [string] $CreateRequestMethod, - [string] $UpdateRequestMethod, - [string] $CmdletAdapter, - [Hashtable] $resourceNameMappings, - [Hashtable] $CustomData, - [Hashtable] $compexTypeMapping, - [string] $UriResourcePathKeyFormat, - $normalizedNamespaces - ) - - if($EntitySet -eq $null) { throw ($LocalizedData.ArguementNullError -f "EntitySet", "GenerateClientSideProxyModule") } - if($Metadata -eq $null) { throw ($LocalizedData.ArguementNullError -f "metadata", "GenerateClientSideProxyModule") } - - $entitySetName = $EntitySet.Name - if(($null -ne $resourceNameMappings) -and - $resourceNameMappings.ContainsKey($entitySetName)) - { - $entitySetName = $resourceNameMappings[$entitySetName] - } - else - { - $entitySetName = $EntitySet.Type.Name - } - - $Path = "$OutputModule\$entitySetName.cdxml" - - $xmlWriter = New-Object System.XMl.XmlTextWriter($Path,$Null) - - if ($xmlWriter -eq $null) - { - throw ($LocalizedData.XmlWriterInitializationError -f $EntitySet.Name) - } - - $xmlWriter = SaveCDXMLHeader $xmlWriter $Uri $EntitySet.Name $entitySetName $CmdletAdapter - - # Get the keys - $keys = $EntitySet.Type.EntityProperties | Where-Object { $_.IsKey } - - $navigationProperties = $EntitySet.Type.NavigationProperties - - SaveCDXMLInstanceCmdlets $xmlWriter $Metadata $GlobalMetadata $EntitySet.Type $keys $navigationProperties $CmdletAdapter $compexTypeMapping $false - - $nonKeyProperties = $EntitySet.Type.EntityProperties | ? { -not $_.isKey } - $nullableProperties = $nonKeyProperties | ? { $_.isNullable } - $nonNullableProperties = $nonKeyProperties | ? { -not $_.isNullable } - - $xmlWriter.WriteStartElement('StaticCmdlets') - - $keyProperties = $keys - - SaveCDXMLNewCmdlet $xmlWriter $Metadata $GlobalMetadata $keyProperties $nonNullableProperties $nullableProperties $navigationProperties $CmdletAdapter $compexTypeMapping - - GenerateSetProxyCmdlet $xmlWriter $keyProperties $nonKeyProperties $compexTypeMapping - - SaveCDXMLRemoveCmdlet $xmlWriter $Metadata $GlobalMetadata $keyProperties $navigationProperties $CmdletAdapter $compexTypeMapping - - $entityActions = $Metadata.Actions | Where-Object { ($_.EntitySet.Namespace -eq $EntitySet.Namespace) -and ($_.EntitySet.Name -eq $EntitySet.Name) } - - if ($entityActions.Length -gt 0) - { - foreach($action in $entityActions) - { - $xmlWriter = SaveCDXMLAction $xmlWriter $Metadata $action $EntitySet.Name $true $keys $complexTypeMapping - } - } - - $entityFunctions = $Metadata.Functions | Where-Object { ($_.EntitySet.Namespace -eq $EntitySet.Namespace) -and ($_.EntitySet.Name -eq $EntitySet.Name) } - - if ($entityFunctions.Length -gt 0) - { - foreach($function in $entityFunctions) - { - $xmlWriter = SaveCDXMLFunction $xmlWriter $Metadata $function $EntitySet.Name $true $keys $complexTypeMapping - } - } - - $xmlWriter.WriteEndElement() - - $normalizedDotNetNamespace = GetNamespace $EntitySet.Type.Namespace $normalizedNamespaces - $normalizedDotNetAlias = GetNamespace $EntitySet.Alias $normalizedNamespaces - $normalizedDotNetEntitySetNamespace = $normalizedDotNetNamespace - - $xmlWriter.WriteStartElement('CmdletAdapterPrivateData') - - $xmlWriter.WriteStartElement('Data') - $xmlWriter.WriteAttributeString('Name', 'EntityTypeName') - $xmlWriter.WriteString("$($normalizedDotNetNamespace).$($EntitySet.Type.Name)") - $xmlWriter.WriteEndElement() - $xmlWriter.WriteStartElement('Data') - $xmlWriter.WriteAttributeString('Name', 'EntityTypeAliasName') - if (!$EntitySet.Alias) - { - $xmlWriter.WriteString("") - } - else - { - $xmlWriter.WriteString("$($normalizedDotNetAlias).$($EntitySet.Type.Name)") - } - $xmlWriter.WriteEndElement() - $xmlWriter.WriteStartElement('Data') - $xmlWriter.WriteAttributeString('Name', 'EntitySetName') - $xmlWriter.WriteString("$($normalizedDotNetEntitySetNamespace).$($EntitySet.Name)") - $xmlWriter.WriteEndElement() - - # Add URI resource path format (webservice.svc/ResourceName/ResourceId vs webservice.svc/ResourceName(QueryKeyName=ResourceId)) - if ($UriResourcePathKeyFormat -ne $null -and $UriResourcePathKeyFormat -ne '') - { - $xmlWriter.WriteStartElement('Data') - $xmlWriter.WriteAttributeString('Name', 'UriResourcePathKeyFormat') - $xmlWriter.WriteString("$UriResourcePathKeyFormat") - $xmlWriter.WriteEndElement() - } - - # Add information about navigation properties and their types - # Used in scenario where user requests navigation property in -Select query - foreach ($navProperty in $navigationProperties) - { - if ($navProperty) - { - $xmlWriter.WriteStartElement('Data') - $xmlWriter.WriteAttributeString('Name', $navProperty.Name + 'NavigationProperty') - $xmlWriter.WriteString($navProperty.Type) - $xmlWriter.WriteEndElement() - } - } - - # Add CreateRequestMethod and UpdateRequestMethod to privateData - $xmlWriter.WriteStartElement('Data') - $xmlWriter.WriteAttributeString('Name', 'CreateRequestMethod') - $xmlWriter.WriteString("$CreateRequestMethod") - $xmlWriter.WriteEndElement() - - $xmlWriter.WriteStartElement('Data') - $xmlWriter.WriteAttributeString('Name', 'UpdateRequestMethod') - $xmlWriter.WriteString("$UpdateRequestMethod") - $xmlWriter.WriteEndElement() - - $xmlWriter.WriteEndElement() - - SaveCDXMLFooter $xmlWriter - - Write-Verbose ($LocalizedData.VerboseSavedCDXML -f $($entitySetName), $Path) -} - -######################################################### -# Save Singleton Cmdlets to CDXML -######################################################### -function SaveCDXMLSingletonCmdlets -{ - param - ( - [ODataUtils.SingletonType] $Singleton, - [ODataUtils.MetadataV4] $Metadata, - [System.Collections.ArrayList] $GlobalMetadata, - [string] $Uri, - [string] $OutputModule, - [string] $CreateRequestMethod, - [string] $UpdateRequestMethod, - [string] $CmdletAdapter, - [Hashtable] $resourceNameMappings, - [Hashtable] $CustomData, - [Hashtable] $compexTypeMapping, - $normalizedNamespaces - ) - - if($Singleton -eq $null) { throw ($LocalizedData.ArguementNullError -f "Singleton", "SaveCDXMLSingletonCmdlets") } - if($Metadata -eq $null) { throw ($LocalizedData.ArguementNullError -f "Metadata", "SaveCDXMLSingletonCmdlets") } - - $singletonName = $singleton.Name - $singletonType = $singleton.Type - - $Path = "$OutputModule\$singletonName" + "Singleton" + ".cdxml" - - $xmlWriter = New-Object System.XMl.XmlTextWriter($Path,$Null) - - if ($xmlWriter -eq $null) - { - throw ($LocalizedData.XmlWriterInitializationError -f $singletonName) - } - - # Get associated EntityType - $associatedEntityType = $Metadata.EntityTypes | Where-Object { $_.Namespace + "." + $_.Name -eq $singletonType -or $_.Alias + "." + $_.Name -eq $singletonType} - - if ($associatedEntityType -eq $null) - { - # Look in other metadatas, since the class can be defined in referenced metadata - foreach ($referencedMetadata in $GlobalMetadata) - { - if (($associatedEntityType = $referencedMetadata.EntityTypes | Where { $_.Namespace + "." + $_.Name -eq $singletonType -or $_.Alias + "." + $_.Name -eq $singletonType }) -ne $null) - { - # Found associated class - break - } - } - } - - if ($associatedEntityType -ne $null) - { - $xmlWriter = SaveCDXMLHeader $xmlWriter $Uri $singletonName $singletonName $CmdletAdapter - - if ($associatedEntityType.BaseType -eq $null -and $associatedEntityType.BaseTypeStr -ne $null -and $associatedEntityType.BaseTypeStr -ne '') - { - $associatedEntitybaseType = GetBaseTypeByName $associatedEntityType.BaseTypeStr $GlobalMetadata - - # Make another pass on base class to make sure its properties were added to associated entity type - ParseMetadataBaseTypeDefinitionHelper $associatedEntityType $associatedEntitybaseType - } - - # Get the keys depending on whether the url contains variables or not - $keys = $associatedEntityType.EntityProperties | Where-Object { $_.IsKey } - - $navigationProperties = $associatedEntityType.NavigationProperties - - SaveCDXMLInstanceCmdlets $xmlWriter $Metadata $GlobalMetadata $associatedEntityType $keys $navigationProperties $CmdletAdapter $compexTypeMapping $true - - $nonKeyProperties = $associatedEntityType.EntityProperties | ? { -not $_.isKey } - $nullableProperties = $nonKeyProperties | ? { $_.isNullable } - $nonNullableProperties = $nonKeyProperties | ? { -not $_.isNullable } - - $xmlWriter.WriteStartElement('StaticCmdlets') - - $keyProperties = $keys - - GenerateSetProxyCmdlet $xmlWriter $keyProperties $nonKeyProperties $compexTypeMapping - - $entityActions = $Metadata.Actions | Where-Object { $_.EntitySet.Name -eq $associatedEntityType.Name } - - if ($entityActions.Length -gt 0) - { - foreach($action in $entityActions) - { - $xmlWriter = SaveCDXMLAction $xmlWriter $Metadata $action $EntitySet.Name $true $keys $complexTypeMapping - } - } - - $entityFunctions = $Metadata.Functions | Where-Object { $_.EntitySet.Name -eq $associatedEntityType.Name } - - if ($entityFunctions.Length -gt 0) - { - foreach($function in $entityFunctions) - { - $xmlWriter = SaveCDXMLFunction $xmlWriter $Metadata $function $associatedEntityType.Name $true $keys $complexTypeMapping - } - } - - $xmlWriter.WriteEndElement() - - $normalizedDotNetNamespace = GetNamespace $associatedEntityType.Namespace $normalizedNamespaces - $normalizedDotNetAlias = GetNamespace $associatedEntityType.Alias $normalizedNamespaces - - $xmlWriter.WriteStartElement('CmdletAdapterPrivateData') - - $xmlWriter.WriteStartElement('Data') - $xmlWriter.WriteAttributeString('Name', 'EntityTypeAliasName') - if (!$associatedEntityType.Alias) - { - $xmlWriter.WriteString("") - } - else - { - $xmlWriter.WriteString("$($normalizedDotNetAlias).$($associatedEntityType.Name)") - } - $xmlWriter.WriteEndElement() - $xmlWriter.WriteStartElement('Data') - $xmlWriter.WriteAttributeString('Name', 'EntityTypeName') - $xmlWriter.WriteString("$($normalizedDotNetNamespace).$($associatedEntityType.Name)") - $xmlWriter.WriteEndElement() - $xmlWriter.WriteStartElement('Data') - $xmlWriter.WriteAttributeString('Name', 'IsSingleton') - $xmlWriter.WriteString("True") - $xmlWriter.WriteEndElement() - - # Add information about navigation properties and their types - # Used in scenario where user requests navigation property in -Select query - foreach ($navProperty in $navigationProperties) - { - if ($navProperty) - { - $xmlWriter.WriteStartElement('Data') - $xmlWriter.WriteAttributeString('Name', $navProperty.Name + 'NavigationProperty') - $xmlWriter.WriteString($navProperty.Type) - $xmlWriter.WriteEndElement() - } - } - - # Add UpdateRequestMethod to privateData - $xmlWriter.WriteStartElement('Data') - $xmlWriter.WriteAttributeString('Name', 'UpdateRequestMethod') - $xmlWriter.WriteString("$UpdateRequestMethod") - $xmlWriter.WriteEndElement() - - $xmlWriter.WriteEndElement() - - SaveCDXMLFooter $xmlWriter - - Write-Verbose ($LocalizedData.VerboseSavedCDXML -f $($associatedEntityType.Name), $Path) - } -} - -######################################################### -# Saves InstanceCmdlets node to CDXML -######################################################### -function SaveCDXMLInstanceCmdlets -{ - param - ( - [System.XMl.XmlTextWriter] $xmlWriter, - [ODataUtils.MetadataV4] $Metadata, - [System.Collections.ArrayList] $GlobalMetadata, - [ODataUtils.EntityTypeV4] $EntityType, - $keys, - $navigationProperties, - $CmdletAdapter, - [Hashtable] $complexTypeMapping, - [bool] $isSingleton - ) - - if($xmlWriter -eq $null) { throw ($LocalizedData.ArguementNullError -f "xmlWriter", "SaveCDXMLInstanceCmdlets") } - if($Metadata -eq $null) { throw ($LocalizedData.ArguementNullError -f "Metadata", "SaveCDXMLInstanceCmdlets") } - - $xmlWriter.WriteStartElement('InstanceCmdlets') - $xmlWriter.WriteStartElement('GetCmdletParameters') - # adding key parameters and association parameters to QueryableProperties, each in a different parameter set - # to be used by GET cmdlet - if (($keys.Length -gt 0) -or ($navigationProperties.Length -gt 0)) - { - $querableNavProperties = @{} - - if ($isSingleton -eq $false) - { - foreach ($navProperty in $navigationProperties) - { - if ($navProperty -ne $null) - { - $associatedType = GetAssociatedType $Metadata $GlobalMetadata $navProperty - $associatedTypeKeyProperties = $associatedType.EntityProperties | ? { $_.IsKey } - - # Make sure associated parameter (based on navigation property) has EntitySet or Singleton, which makes it accessible from the service root - # Otherwise the Uri for associated navigation property won't be valid - if ($associatedTypeKeyProperties.Length -gt 0 -and (ShouldBeAssociatedParameter $GlobalMetadata $EntityType $associatedType $isSingleton)) - { - $querableNavProperties.Add($navProperty, $associatedTypeKeyProperties) - } - } - } - } - - $defaultCmdletParameterSet = 'Default' - if ($isSingleton -eq $true -and $querableNavProperties.Count -gt 0) - { - foreach($item in $querableNavProperties.GetEnumerator()) - { - $defaultCmdletParameterSet = $item.Key.Name - break - } - } - $xmlWriter.WriteAttributeString('DefaultCmdletParameterSet', $defaultCmdletParameterSet) - - - $xmlWriter.WriteStartElement('QueryableProperties') - - $position = 0 - - if ($isSingleton -eq $false) - { - $keys | ? { $_ -ne $null } | % { - $xmlWriter.WriteStartElement('Property') - $xmlWriter.WriteAttributeString('PropertyName', $_.Name) - - $xmlWriter.WriteStartElement('Type') - $PSTypeName = Convert-ODataTypeToCLRType $_.TypeName $complexTypeMapping - $xmlWriter.WriteAttributeString('PSType', $PSTypeName) - $xmlWriter.WriteEndElement() - - $xmlWriter.WriteStartElement('RegularQuery') - $xmlWriter.WriteStartElement('CmdletParameterMetadata') - $xmlWriter.WriteAttributeString('PSName', $_.Name) - $xmlWriter.WriteAttributeString('CmdletParameterSets', 'Default') - $xmlWriter.WriteAttributeString('IsMandatory', $_.IsMandatory.ToString().ToLower()) - $xmlWriter.WriteAttributeString('Position', $position) - $xmlWriter.WriteEndElement() - $xmlWriter.WriteEndElement() - $xmlWriter.WriteEndElement() - - $position++ - } - } - - if ($querableNavProperties.Count -gt 0) - { - foreach($item in $querableNavProperties.GetEnumerator()) - { - $xmlWriter.WriteStartElement('Property') - $xmlWriter.WriteAttributeString('PropertyName', $item.Key.Name + ':' + $item.Value.Name + ':Key') - - $xmlWriter.WriteStartElement('Type') - $PSTypeName = Convert-ODataTypeToCLRType $item.Value.TypeName $complexTypeMapping - $xmlWriter.WriteAttributeString('PSType', $PSTypeName) - $xmlWriter.WriteEndElement() - - $xmlWriter.WriteStartElement('RegularQuery') - $xmlWriter.WriteStartElement('CmdletParameterMetadata') - $xmlWriter.WriteAttributeString('PSName', 'Associated' + $item.Key.Name + $item.Value.Name) - $xmlWriter.WriteAttributeString('CmdletParameterSets', $item.Key.Name) - $xmlWriter.WriteAttributeString('IsMandatory', 'false') - $xmlWriter.WriteEndElement() - $xmlWriter.WriteEndElement() - $xmlWriter.WriteEndElement() - } - } - - if ($isSingleton -eq $false) - { - # Add Query Parameters (i.e., Top, Skip, OrderBy, Filter) to the generated Get-* cmdlets. - $queryParameters = - @{ - "Filter" = "Edm.String"; - "IncludeTotalResponseCount" = "switch"; - "OrderBy" = "Edm.String"; - "Select" = "Edm.String"; - "Skip" = "Edm.Int32"; - "Top" = "Edm.Int32"; - } - } - else - { - $queryParameters = - @{ - "Select" = "Edm.String"; - } - } - - foreach($currentQueryParameter in $queryParameters.Keys) - { - $xmlWriter.WriteStartElement('Property') - $xmlWriter.WriteAttributeString('PropertyName', "QueryOption:" + $currentQueryParameter) - $xmlWriter.WriteStartElement('Type') - $PSTypeName = Convert-ODataTypeToCLRType $queryParameters[$currentQueryParameter] - $xmlWriter.WriteAttributeString('PSType', $PSTypeName) - $xmlWriter.WriteEndElement() - $xmlWriter.WriteStartElement('RegularQuery') - $xmlWriter.WriteStartElement('CmdletParameterMetadata') - $xmlWriter.WriteAttributeString('PSName', $currentQueryParameter) - - if($queryParameters[$currentQueryParameter] -eq "Edm.String") - { - $xmlWriter.WriteStartElement('ValidateNotNullOrEmpty') - $xmlWriter.WriteEndElement() - } - - if($queryParameters[$currentQueryParameter] -eq "Edm.Int32") - { - $xmlWriter.WriteStartElement('ValidateRange') - $xmlWriter.WriteAttributeString('Min', "1") - $xmlWriter.WriteAttributeString('Max', [int]::MaxValue) - $xmlWriter.WriteEndElement() - } - - $xmlWriter.WriteEndElement() - $xmlWriter.WriteEndElement() - $xmlWriter.WriteEndElement() - } - - - $xmlWriter.WriteEndElement() - } - - $xmlWriter.WriteEndElement() - - $xmlWriter.WriteStartElement('GetCmdlet') - $xmlWriter.WriteStartElement('CmdletMetadata') - $xmlWriter.WriteAttributeString('Verb', 'Get') - $xmlWriter.WriteEndElement() - $xmlWriter.WriteEndElement() - - $xmlWriter.WriteEndElement() -} - -# Helper Method -# Returns true if navigation property of $AssociatedType has coresponding EntitySet or Singleton -# If yes, then it should become an associated parameter in CDXML -function ShouldBeAssociatedParameter -{ - param - ( - [System.Collections.ArrayList] $GlobalMetadata, - [ODataUtils.EntityTypeV4] $EntityType, - [ODataUtils.EntityTypeV4] $AssociatedType - ) - - # Check if associated type has navigation property, which links back to current type - $associatedTypeNavProperties = $AssociatedType.NavigationProperties | ? { - $_.Type -eq ($EntityType.Namespace + "." + $EntityType.Name) -or - $_.Type -eq ($EntityType.Alias + "." + $EntityType.Name) -or - $_.Type -eq ("Collection(" + $EntityType.Namespace + "." + $EntityType.Name + ")") -or - $_.Type -eq ("Collection(" + $EntityType.Alias + "." + $EntityType.Name + ")") - } - - if ($associatedTypeNavProperties.Length -lt 1) - { - return $false - } - - # Now check if associated parameter type (i.e, type of navigation property) has corresponding EntitySet or Singleton, - # which makes it accessible from the service root. - # Otherwise the Uri for associated navigation property won't be valid - foreach ($currentMetadata in $GlobalMetadata) - { - # Look for EntitySet with given type - foreach ($currentEntitySet in $currentMetadata.EntitySets) - { - if ($currentEntitySet.Type.Namespace -eq $EntityType.Namespace -and - $currentEntitySet.Type.Name -eq $EntityType.Name) - { - return $true - } - } - - # Look for Singleton with given type - foreach ($currentSingleton in $currentMetadata.Singletons) - { - if ($currentSingleton.Type.Namespace -eq $EntityType.Namespace -and - $currentSingleton.Type.Name -eq $EntityType.Name) - { - return $true - } - } - } - - return $false -} - -######################################################### -# Saves NewCmdlet node to CDXML -######################################################### -function SaveCDXMLNewCmdlet -{ - param - ( - [System.XMl.XmlTextWriter] $xmlWriter, - [ODataUtils.MetadataV4] $Metadata, - [System.Collections.ArrayList] $GlobalMetadata, - $keyProperties, - $nonNullableProperties, - $nullableProperties, - $navigationProperties, - $CmdletAdapter, - $complexTypeMapping - ) - - if($xmlWriter -eq $null) { throw ($LocalizedData.ArguementNullError -f "xmlWriter", "SaveCDXMLNewCmdlet") } - if($Metadata -eq $null) { throw ($LocalizedData.ArguementNullError -f "Metadata", "SaveCDXMLNewCmdlet") } - - $xmlWriter.WriteStartElement('Cmdlet') - $xmlWriter.WriteStartElement('CmdletMetadata') - $xmlWriter.WriteAttributeString('Verb', 'New') - $xmlWriter.WriteAttributeString('DefaultCmdletParameterSet', 'Default') - $xmlWriter.WriteAttributeString('ConfirmImpact', 'Medium') - $xmlWriter.WriteEndElement() - - $xmlWriter.WriteStartElement('Method') - $xmlWriter.WriteAttributeString('MethodName', 'Create') - $xmlWriter.WriteAttributeString('CmdletParameterSet', 'Default') - - AddParametersNode $xmlWriter $keyProperties $nonNullableProperties $nullableProperties $null $true $true $complexTypeMapping - - $xmlWriter.WriteEndElement() - - $navigationProperties | ? { $_ -ne $null } | % { - $associatedType = GetAssociatedType $Metadata $GlobalMetadata $_ - $associatedEntitySet = GetEntitySetForEntityType $Metadata $associatedType - - $xmlWriter.WriteStartElement('Method') - $xmlWriter.WriteAttributeString('MethodName', "Association:Create:$($associatedEntitySet.Name)") - $xmlWriter.WriteAttributeString('CmdletParameterSet', $_.Name) - - $associatedKeys = ($associatedType.EntityProperties | ? { $_.isKey }) - - AddParametersNode $xmlWriter $associatedKeys $keyProperties $null "Associated$($_.Name)" $true $true $complexTypeMapping - - $xmlWriter.WriteEndElement() - } - - $xmlWriter.WriteEndElement() -} - -######################################################### -# Get corresponding EntityType for given EntitySet -######################################################### -function GetEntitySetForEntityType { - param( - [ODataUtils.MetadataV4] $Metadata, - [ODataUtils.EntityTypeV4] $entityType - ) - - if($entityType -eq $null) { throw ($LocalizedData.ArguementNullError -f "EntityType", "GetEntitySetForEntityType") } - - $result = $Metadata.EntitySets | ? { ($_.Type.Namespace -eq $entityType.Namespace) -and ($_.Type.Name -eq $entityType.Name) } - - if (($result.Count -eq 0) -and ($entityType.BaseType -ne $null)) - { - GetEntitySetForEntityType $Metadata $entityType.BaseType - } - elseif ($result.Count -gt 1) - { - throw ($LocalizedData.WrongCountEntitySet -f (($entityType.Namespace + "." + $entityType.Name), $result.Count)) - } - - $result -} - -######################################################### -# Saves RemoveCmdlet node to CDXML -######################################################### -function SaveCDXMLRemoveCmdlet -{ - param - ( - [System.XMl.XmlTextWriter] $xmlWriter, - [ODataUtils.MetadataV4] $Metadata, - [System.Collections.ArrayList] $GlobalMetadata, - $keyProperties, - $navigationProperties, - $CmdletAdapter, - $complexTypeMapping - ) - - if($xmlWriter -eq $null) { throw ($LocalizedData.ArguementNullError -f "xmlWriter", "SaveCDXMLRemoveCmdlet") } - if($Metadata -eq $null) { throw ($LocalizedData.ArguementNullError -f "Metadata", "SaveCDXMLRemoveCmdlet") } - - $xmlWriter.WriteStartElement('Cmdlet') - $xmlWriter.WriteStartElement('CmdletMetadata') - $xmlWriter.WriteAttributeString('Verb', 'Remove') - $xmlWriter.WriteAttributeString('DefaultCmdletParameterSet', 'Default') - $xmlWriter.WriteAttributeString('ConfirmImpact', 'Medium') - $xmlWriter.WriteEndElement() - - $xmlWriter.WriteStartElement('Method') - $xmlWriter.WriteAttributeString('MethodName', 'Delete') - $xmlWriter.WriteAttributeString('CmdletParameterSet', 'Default') - - AddParametersNode $xmlWriter $keyProperties $nul $null $null $true $true $complexTypeMapping - - $xmlWriter.WriteEndElement() - - $navigationPrperties | ? { $_ -ne $null } | % { - - $associatedType = GetAssociatedType $Metadata $GlobalMetadata $_ - $associatedEntitySet = GetEntitySetForEntityType $Metadata $associatedType - - $xmlWriter.WriteStartElement('Method') - $xmlWriter.WriteAttributeString('MethodName', "Association:Delete:$($associatedEntitySet.Name)") - $xmlWriter.WriteAttributeString('CmdletParameterSet', $_.Name) - - $associatedType = GetAssociatedType $Metadata $GlobalMetadata $_ - $associatedKeys = ($associatedType.EntityProperties | ? { $_.isKey }) - - AddParametersNode $xmlWriter $associatedKeys $keyProperties $null "Associated$($_.Name)" $true $true $complexTypeMapping - - $xmlWriter.WriteEndElement() - } - $xmlWriter.WriteEndElement() -} - -######################################################### -# Gets associated instance's EntityType for a given navigation property -######################################################### -function GetAssociatedType { - param( - [ODataUtils.MetadataV4] $Metadata, - [System.Collections.ArrayList] $GlobalMetadata, - [ODataUtils.NavigationPropertyV4] $navProperty - ) - - $associationType = $navProperty.Type - $associationType = $associationType.Replace($Metadata.Namespace + ".", "") - $associationType = $associationType.Replace($Metadata.Alias + ".", "") - $associationType = $associationType.Replace("Collection(", "") - $associationType = $associationType.Replace(")", "") - - $associatedType = $Metadata.EntityTypes | ? { $_.Name -eq $associationType } - - if (!$associatedType -and $GlobalMetadata -ne $null) - { - $associationFullTypeName = $navProperty.Type.Replace("Collection(", "").Replace(")", "") - - foreach ($referencedMetadata in $GlobalMetadata) - { - if (($associatedType = $referencedMetadata.EntityTypes | Where { $_.Namespace + "." + $_.Name -eq $associationFullTypeName -or $_.Alias + "." + $_.Name -eq $associationFullTypeName }) -ne $null -or - ($associatedType = $referencedMetadata.ComplexTypes | Where { $_.Namespace + "." + $_.Name -eq $associationFullTypeName -or $_.Alias + "." + $_.Name -eq $associationFullTypeName }) -ne $null -or - ($associatedType = $referencedMetadata.EnumTypes | Where { $_.Namespace + "." + $_.Name -eq $associationFullTypeName -or $_.Alias + "." + $_.Name -eq $associationFullTypeName }) -ne $null) - { - # Found associated class - break - } - } - } - - if ($associatedType.Count -lt 1) - { - throw ($LocalizedData.AssociationNotFound -f $associationType) - } - elseif ($associatedType.Count -gt 1) - { - throw ($LocalizedData.TooManyMatchingAssociationTypes -f $associatedType.Count, $associationType) - } - - # return associated EntityType - $associatedType -} - -######################################################### -# Saves CDXML for Instance/Service level actions -######################################################### -function SaveCDXMLAction -{ - param - ( - [System.Xml.XmlWriter] $xmlWriter, - [ODataUtils.ActionV4] $action, - [AllowEmptyString()] - [string] $noun, - [bool] $isInstanceAction, - [ODataUtils.TypeProperty] $keys, - [Hashtable] $complexTypeMapping - ) - - if($xmlWriter -eq $null) { throw ($LocalizedData.ArguementNullError -f "xmlWriter", "SaveCDXMLAction") } - if($action -eq $null) { throw ($LocalizedData.ArguementNullError -f "action", "SaveCDXMLAction") } - - $xmlWriter.WriteStartElement('Cmdlet') - - $xmlWriter.WriteStartElement('CmdletMetadata') - $xmlWriter.WriteAttributeString('Verb', 'Invoke') - $xmlWriter.WriteAttributeString('Noun', "$($noun)$($action.Name)") - $xmlWriter.WriteAttributeString('ConfirmImpact', 'Medium') - $xmlWriter.WriteEndElement() - - $xmlWriter.WriteStartElement('Method') - $xmlWriter.WriteAttributeString('MethodName', "Action:$($action.Name):$($action.EntitySet.Name)") - - $xmlWriter.WriteStartElement('Parameters') - - $keys | ? { $_ -ne $null } | % { - $xmlWriter.WriteStartElement('Parameter') - $xmlWriter.WriteAttributeString('ParameterName', $_.Name + ':Key') - - $xmlWriter.WriteStartElement('Type') - $PSTypeName = Convert-ODataTypeToCLRType $_.TypeName $complexTypeMapping - $xmlWriter.WriteAttributeString('PSType', $PSTypeName) - $xmlWriter.WriteEndElement() - - $xmlWriter.WriteStartElement('CmdletParameterMetadata') - $xmlWriter.WriteAttributeString('PSName', $_.Name) - $xmlWriter.WriteAttributeString('IsMandatory', 'true') - $xmlWriter.WriteEndElement() - $xmlWriter.WriteEndElement() - } - - $i = -1 - foreach ($parameter in $action.Parameters) - { - $i++ - - # for Instance actions, first parameter is Entity Set which we refer to using keys - if ($isInstanceAction -and ($i -eq 0)) - { - continue - } - - $xmlWriter.WriteStartElement('Parameter') - $xmlWriter.WriteAttributeString('ParameterName', $parameter.Name) - - $xmlWriter.WriteStartElement('Type') - $PSTypeName = Convert-ODataTypeToCLRType $parameter.TypeName - $xmlWriter.WriteAttributeString('PSType', $PSTypeName) - $xmlWriter.WriteEndElement() - - $xmlWriter.WriteStartElement('CmdletParameterMetadata') - $xmlWriter.WriteAttributeString('PSName', $parameter.Name) - if (-not $parameter.IsNullable) - { - $xmlWriter.WriteAttributeString('IsMandatory', 'true') - } - $xmlWriter.WriteEndElement() - $xmlWriter.WriteEndElement() - } - - # Add -Force parameter to Service Action cmdlets. - AddParametersNode $xmlWriter $null $null $null $null $true $false $complexTypeMapping - - $xmlWriter.WriteEndElement() - $xmlWriter.WriteEndElement() - - $xmlWriter.WriteEndElement() - - $xmlWriter -} - -######################################################### -# Saves CDXML for Instance/Service level functions -######################################################### -function SaveCDXMLFunction -{ - param - ( - [System.Xml.XmlWriter] $xmlWriter, - [ODataUtils.FunctionV4] $function, - [AllowEmptyString()] - [string] $noun, - [bool] $isInstanceAction, - [ODataUtils.TypeProperty] $keys, - [Hashtable] $complexTypeMapping - ) - - if($xmlWriter -eq $null) { throw ($LocalizedData.ArguementNullError -f "xmlWriter", "SaveCDXMLFunction") } - if($function -eq $null) { throw ($LocalizedData.ArguementNullError -f "function", "SaveCDXMLFunction") } - - $xmlWriter.WriteStartElement('Cmdlet') - - $xmlWriter.WriteStartElement('CmdletMetadata') - $xmlWriter.WriteAttributeString('Verb', 'Invoke') - $xmlWriter.WriteAttributeString('Noun', "$($noun)$($function.Name)") - $xmlWriter.WriteAttributeString('ConfirmImpact', 'Medium') - $xmlWriter.WriteEndElement() - - $xmlWriter.WriteStartElement('Method') - if (!$function.EntitySet) - { - $xmlWriter.WriteAttributeString('MethodName', "Action:$($function.Name):$($function.ReturnType)") - } - else - { - $xmlWriter.WriteAttributeString('MethodName', "Action:$($function.Name):$($function.EntitySet)") - } - - $xmlWriter.WriteStartElement('Parameters') - - $keys | ? { $_ -ne $null } | % { - $xmlWriter.WriteStartElement('Parameter') - $xmlWriter.WriteAttributeString('ParameterName', $_.Name + ':Key') - - $xmlWriter.WriteStartElement('Type') - $PSTypeName = Convert-ODataTypeToCLRType $_.TypeName $complexTypeMapping - $xmlWriter.WriteAttributeString('PSType', $PSTypeName) - $xmlWriter.WriteEndElement() - - $xmlWriter.WriteStartElement('CmdletParameterMetadata') - $xmlWriter.WriteAttributeString('PSName', $_.Name) - $xmlWriter.WriteAttributeString('IsMandatory', 'true') - $xmlWriter.WriteEndElement() - $xmlWriter.WriteEndElement() - } - - $i = -1 - foreach ($parameter in $function.Parameters) - { - $i++ - - # for Instance actions, first parameter is Entity Set which we refer to using keys - if ($isInstanceAction -and ($i -eq 0)) - { - continue - } - - $xmlWriter.WriteStartElement('Parameter') - $xmlWriter.WriteAttributeString('ParameterName', $parameter.Name) - - $xmlWriter.WriteStartElement('Type') - $PSTypeName = Convert-ODataTypeToCLRType $parameter.Type - $xmlWriter.WriteAttributeString('PSType', $PSTypeName) - $xmlWriter.WriteEndElement() - - $xmlWriter.WriteStartElement('CmdletParameterMetadata') - $xmlWriter.WriteAttributeString('PSName', $parameter.Name) - if (-not $parameter.IsNullable) - { - $xmlWriter.WriteAttributeString('IsMandatory', 'true') - } - $xmlWriter.WriteEndElement() - $xmlWriter.WriteEndElement() - } - - # Add -Force parameter to Service Function cmdlets. - AddParametersNode $xmlWriter $null $null $null $null $true $false $complexTypeMapping - - $xmlWriter.WriteEndElement() - $xmlWriter.WriteEndElement() - - $xmlWriter.WriteEndElement() - - $xmlWriter -} - -######################################################### -# Saves CDXML for Service-level actions and functions -######################################################### -function SaveServiceActionsCDXML -{ - param - ( - [System.Collections.ArrayList] $GlobalMetadata, - [ODataUtils.ODataEndpointProxyParameters] $ODataEndpointProxyParameters, - [string] $Path, - [Hashtable] $complexTypeMapping, - [string] $progressBarStatus, - [string] $CmdletAdapter - ) - - $xmlWriter = New-Object System.XMl.XmlTextWriter($Path,$Null) - - if ($xmlWriter -eq $null) - { - throw $LocalizedData.XmlWriterInitializationError -f "ServiceActions" - } - - $xmlWriter = SaveCDXMLHeader $xmlWriter $ODataEndpointProxyParameters.Uri 'ServiceActions' 'ServiceActions' -CmdletAdapter $CmdletAdapter - - $actions = @() - $functions = @() - - foreach ($Metadata in $GlobalMetadata) - { - $actions += $Metadata.Actions | Where-Object { $_.EntitySet -eq '' -or $_.EntitySet -eq $null } - $functions += $Metadata.Functions | Where-Object { $_.EntitySet -eq '' -or $_.EntitySet -eq $null } - } - - if ($actions.Length -gt 0 -or $functions.Length -gt 0) - { - $xmlWriter.WriteStartElement('StaticCmdlets') - } - - # Save actions - if ($actions.Length -gt 0) - { - foreach ($action in $actions) - { - if ($action -ne $null) - { - $xmlWriter = SaveCDXMLAction $xmlWriter $action '' $false $null $complexTypeMapping - } - } - } - - # Save functions - if ($functions.Length -gt 0) - { - foreach ($function in $functions) - { - if ($function -ne $null) - { - $xmlWriter = SaveCDXMLFunction $xmlWriter $function '' $false $null $complexTypeMapping - } - } - } - - if ($actions.Length -gt 0 -or $functions.Length -gt 0) - { - $xmlWriter.WriteEndElement() - } - - $xmlWriter.WriteStartElement('CmdletAdapterPrivateData') - $xmlWriter.WriteStartElement('Data') - $xmlWriter.WriteAttributeString('Name', 'Namespace') - $xmlWriter.WriteString("$($EntitySet.Namespace)") - $xmlWriter.WriteEndElement() - $xmlWriter.WriteStartElement('Data') - $xmlWriter.WriteAttributeString('Name', 'Alias') - if (!$EntitySet.Alias) - { - $xmlWriter.WriteString("") - } - else - { - $xmlWriter.WriteString("$($EntitySet.Alias)") - } - $xmlWriter.WriteEndElement() - - $xmlWriter.WriteStartElement('Data') - $xmlWriter.WriteAttributeString('Name', 'CreateRequestMethod') - $xmlWriter.WriteString("Post") - $xmlWriter.WriteEndElement() - $xmlWriter.WriteEndElement() - - SaveCDXMLFooter $xmlWriter - - Write-Verbose ($LocalizedData.VerboseSavedServiceActions -f $Path) - - # Write progress bar message - ProgressBarHelper "Export-ODataEndpointProxy" $progressBarStatus 60 20 1 1 -} - -######################################################### -# GenerateModuleManifest is a helper function used -# to generate a wrapper module manifest file. The -# generated module manifest is persisted to the disk at -# the specified OutputModule path. When the module -# manifest is imported, the following comands will -# be imported: -# 1. Get, Set, New & Remove proxy cmdlets for entity -# sets and singletons. -# 2. If the server side Odata endpoint exposes complex -# types, enum types, type definitions, then the corresponding -# client side proxy types imported. -# 3. Service Action/Function proxy cmdlets. -######################################################### -function GenerateModuleManifest -{ - param - ( - [System.Collections.ArrayList] $GlobalMetadata, - [String] $ModulePath, - [string[]] $AdditionalModules, - [Hashtable] $resourceNameMappings, - [string] $progressBarStatus - ) - - if($progressBarStatus -eq $null) { throw ($LocalizedData.ArguementNullError -f "progressBarStatus", "GenerateModuleManifest") } - - $NestedModules = @() - - foreach ($Metadata in $GlobalMetadata) - { - foreach ($entitySet in $Metadata.EntitySets) - { - $entitySetName = $entitySet.Name - if(($null -ne $resourceNameMappings) -and - $resourceNameMappings.ContainsKey($entitySetName)) - { - $entitySetName = $resourceNameMappings[$entitySetName] - } - else - { - $entitySetName = $entitySet.Type.Name - } - - $NestedModules += "$OutputModule\$($entitySetName).cdxml" - } - - foreach ($singleton in $Metadata.SingletonTypes) - { - $singletonName = $singleton.Name - $NestedModules += "$OutputModule\$($singletonName)" + "Singleton" + ".cdxml" - } - } - - New-ModuleManifest -Path $ModulePath -NestedModules ($AdditionalModules + $NestedModules) - - Write-Verbose ($LocalizedData.VerboseSavedModuleManifest -f $ModulePath) - - # Update the Progress Bar. - ProgressBarHelper "Export-ODataEndpointProxy" $progressBarStatus 80 20 1 1 -} - -######################################################### -# This is a helper function used to generate comlplex -# type defination from the metadata. -######################################################### -function GenerateComplexTypeDefinition -{ - param - ( - [System.Collections.ArrayList] $GlobalMetadata, - [string] $OutputModule, - [string] $typeDefinationFileName, - $normalizedNamespaces - ) - - $Path = "$OutputModule\$typeDefinationFileName" - $date = Get-Date - - $output = @" -# This module was generated by PSODataUtils on $date. - -`$typeDefinitions = @" -using System; -using System.Management.Automation; -using System.ComponentModel; - -"@ - # We are currently generating classes for EntityType & ComplexType - # defination exposed in the metadata. - - $complexTypeMapping = @{} - - # First, create complex type mappings for all metadata files at once - foreach ($metadata in $GlobalMetadata) - { - $typesToBeGenerated = $metadata.EntityTypes+$metadata.ComplexTypes - $enumTypesToBeGenerated = $metadata.EnumTypes - $typeDefinitionsToBeGenerated = $metadata.TypeDefinitions - - foreach ($entityType in $typesToBeGenerated) - { - if ($entityType -ne $null) - { - $entityTypeFullName = $entityType.Namespace + '.' + $entityType.Name - if(!$complexTypeMapping.ContainsKey($entityTypeFullName)) - { - $complexTypeMapping.Add($entityTypeFullName, $entityType.Name) - } - - # In short name we use Alias instead of Namespace - # We will add short name to $complexTypeMapping to enable Alias based search - if ($entityType.Alias -ne $null -and $entityType.Alias -ne "") - { - $entityTypeShortName = $entityType.Alias + '.' + $entityType.Name - if(!$complexTypeMapping.ContainsKey($entityTypeShortName)) - { - $complexTypeMapping.Add($entityTypeShortName, $entityType.Name) - } - } - } - } - - foreach ($enumType in $enumTypesToBeGenerated) - { - if ($enumType -ne $null) - { - $enumTypeFullName = $enumType.Namespace + '.' + $enumType.Name - if(!$complexTypeMapping.ContainsKey($enumTypeFullName)) - { - $complexTypeMapping.Add($enumTypeFullName, $enumType.Name) - } - - if (($enumType.Alias -ne $null -and $enumType.Alias -ne "") -or ($metadata.Alias -ne $null -and $metadata.Alias -ne "")) - { - if ($enumType.Alias -ne $null -and $enumType.Alias -ne "") - { - $alias = $enumType.Alias - } - else - { - $alias = $metadata.Alias - } - - $enumTypeShortName = $alias + '.' + $enumType.Name - if(!$complexTypeMapping.ContainsKey($enumTypeShortName)) - { - $complexTypeMapping.Add($enumTypeShortName, $enumType.Name) - } - } - } - } - - foreach ($typeDefinition in $typeDefinitionsToBeGenerated) - { - if ($typeDefinition -ne $null) - { - $typeDefinitionFullName = $typeDefinition.Namespace + '.' + $typeDefinition.Name - if(!$complexTypeMapping.ContainsKey($typeDefinitionFullName)) - { - $complexTypeMapping.Add($typeDefinitionFullName, $typeDefinition.Name) - } - - # In short name we use Alias instead of Namespace - # We will add short name to $complexTypeMapping to enable Alias based search - if ($typeDefinition.Alias) - { - $typeDefinitionShortName = $typeDefinition.Alias + '.' + $typeDefinition.Name - if(!$complexTypeMapping.ContainsKey($typeDefinitionShortName)) - { - $complexTypeMapping.Add($typeDefinitionShortName, $typeDefinition.Name) - } - } - } - } - } - - # Now classes definitions will be generated - foreach ($metadata in $GlobalMetadata) - { - $typesToBeGenerated = $metadata.EntityTypes+$metadata.ComplexTypes - $enumTypesToBeGenerated = $metadata.EnumTypes - $typeDefinitionsToBeGenerated = $metadata.TypeDefinitions - - if($typesToBeGenerated.Count -gt 0 -or $enumTypesToBeGenerated.Count -gt 0) - { - if ($metadata.Alias -ne $null -and $metadata.Alias -ne "") - { - # Check if this namespace has to be normalized in the .Net namespace/class definitions file. - $dotNetAlias = GetNamespace $metadata.Alias $normalizedNamespaces - - $output += @" - -namespace $($dotNetAlias) -{ -"@ - } - else - { - # Check if this namespace has to be normalized in the .Net namespace/class definitions file. - $dotNetNamespace = GetNamespace $metadata.Namespace $normalizedNamespaces - - $output += @" - -namespace $($dotNetNamespace) -{ -"@ - } - - foreach ($typeDefinition in $typeDefinitionsToBeGenerated) - { - if ($typeDefinition -ne $null) - { - Write-Verbose ($LocalizedData.VerboseAddingTypeDefinationToGeneratedModule -f $typeDefinitionFullName, "$OutputModule\$typeDefinationFileName") - - $output += "`n public class $($typeDefinition.Name)`n {" - $typeName = Convert-ODataTypeToCLRType $typeDefinition.BaseTypeStr $complexTypeMapping - $dotNetPropertyNamespace = GetNamespace $typeName $normalizedNamespaces $true - $output += "`n public $dotNetPropertyNamespace value;" - $output += @" -`n } -"@ - } - } - - $DotNETKeywords = ("abstract", "as", "base", "bool", "break", "byte", "case", "catch", "char", "checked", "class", "const", "continue", "decimal", "default", "delegate", "do", "double", "else", "enum", "event", "explicit", "extern", "false", "finally", "fixed", "float", "for", "foreach", "goto", "if", "implicit", "in", "in", "int", "interface", "internal", "is", "lock", "long", "namespace", "new", "null", "object", "operator", "out", "out", "override", "params", "private", "protected", "public", "readonly", "ref", "return", "sbyte", "sealed", "short", "sizeof", "stackalloc", "static", "string", "struct", "switch", "this", "throw", "true", "try", "typeof", "uint", "ulong", "unchecked", "unsafe", "ushort", "using", "virtual", "void", "volatile", "while", "add", "alias", "ascending", "async", "await", "descending", "dynamic", "from", "get", "global", "group", "into", "join", "let", "orderby", "partial", "partial", "remove", "select", "set", "value", "var", "where", "yield") - - foreach ($enumType in $enumTypesToBeGenerated) - { - if ($enumType -ne $null) - { - $enumTypeFullName = $enumType.Namespace + '.' + $enumType.Name - - Write-Verbose ($LocalizedData.VerboseAddingTypeDefinationToGeneratedModule -f $enumTypeFullName, "$OutputModule\$typeDefinationFileName") - - $output += "`n public enum $($enumType.Name)`n {" - - $properties = $null - - for($index = 0; $index -lt $enumType.Members.Count; $index++) - { - $memberName = $enumType.Members[$index].Name - $formattedMemberName = [System.Text.RegularExpressions.Regex]::Replace($memberName, "[^0-9a-zA-Z]", "_"); - $memberValue = $enumType.Members[$index].Value - - if ($DotNETKeywords -contains $formattedMemberName) - { - # If member name is a known keyword in .Net, add '@' prefix - $formattedMemberName = '@' + $formattedMemberName - } - - if ($formattedMemberName -match "^[0-9]*$") - { - # If member name is a numeric value, add 'm_' prefix - $formattedMemberName = 'm_' + $formattedMemberName - } - - if ($memberName -ne $formattedMemberName -or $formattedMemberName -like '@*' -or $formattedMemberName -like 'm_*') - { - # Add Description attribute to preserve original value - $properties += "`n [Description(`"$($memberName)`")]$formattedMemberName" - } - else - { - $properties += "`n $memberName" - } - - if ($memberValue) - { - $properties += " = $memberValue," - } - else - { - $properties += "," - } - } - - $output += $properties - $output += @" -`n } -"@ - } - } - - foreach ($entityType in $typesToBeGenerated) - { - if ($entityType -ne $null) - { - $entityTypeFullName = $entityType.Namespace + '.' + $entityType.Name - - Write-Verbose ($LocalizedData.VerboseAddingTypeDefinationToGeneratedModule -f $entityTypeFullName, "$OutputModule\$typeDefinationFileName") - - if ($entityType.BaseTypeStr -ne $null -and $entityType.BaseTypeStr -ne '' -and $entityType.BaseType -eq $null) - { - # This class inherits from another class, but we were not able to find base class during Parsing. - # We'll make another attempt. - foreach ($referencedMetadata in $GlobalMetadata) - { - if (($baseType = $referencedMetadata.EntityTypes | Where { $_.Namespace + "." + $_.Name -eq $entityType.BaseTypeStr -or $_.Alias + "." + $_.Name -eq $entityType.BaseTypeStr }) -ne $null -or - ($baseType = $referencedMetadata.ComplexTypes | Where { $_.Namespace + "." + $_.Name -eq $entityType.BaseTypeStr -or $_.Alias + "." + $_.Name -eq $entityType.BaseTypeStr }) -ne $null) - { - # Found base class - $entityType.BaseType = $baseType - break - } - } - } - - if($null -ne $entityType.BaseType) - { - if ((![string]::IsNullOrEmpty($entityType.BaseType.Alias) -and $entityType.BaseType.Alias -eq $entityType.Alias) -or - (![string]::IsNullOrEmpty($entityType.BaseType.Namespace) -and $entityType.BaseType.Namespace -eq $entityType.Namespace)) - { - $fullBaseTypeName = $entityType.BaseType.Name - } - else - { - # Base type can be defined in different namespace. For that reason we include namespace or alias. - if (![string]::IsNullOrEmpty($entityType.BaseType.Alias)) - { - # Check if derived alias has to be normalized. - $normalizedDotNetAlias = GetNamespace $entityType.BaseType.Alias $normalizedNamespaces - $fullBaseTypeName = $normalizedDotNetAlias + "." + $entityType.BaseType.Name - } - else - { - # Check if derived namespace has to be normalized. - $normalizedDotNetNamespace = GetNamespace $entityType.BaseType.Namespace $normalizedNamespaces - $fullBaseTypeName = $normalizedDotNetNamespace + "." + $entityType.BaseType.Name - } - } - - $output += "`n public class $($entityType.Name) : $($fullBaseTypeName)`n {" - } - else - { - $output += "`n public class $($entityType.Name)`n {" - } - - $properties = $null - - for($index = 0; $index -lt $entityType.EntityProperties.Count; $index++) - { - $property = $entityType.EntityProperties[$index] - $typeName = Convert-ODataTypeToCLRType $property.TypeName $complexTypeMapping - - if ($typeName.StartsWith($metadata.Namespace + ".")) - { - $dotNetPropertyNamespace = $typeName.Replace($metadata.Namespace + ".", "") - } - elseif ($typeName.StartsWith($metadata.Alias + ".")) - { - $dotNetPropertyNamespace = $typeName.Replace($metadata.Alias + ".", "") - } - else - { - $dotNetPropertyNamespace = GetNamespace $typeName $normalizedNamespaces $true - } - - $properties += "`n public $dotNetPropertyNamespace $($property.Name);" - } - - $output += $properties - $output += @" -`n } -"@ - } - } - - $output += "`n}`n" - } - } - $output += """@`n" - $output += "Add-Type -TypeDefinition `$typeDefinitions -IgnoreWarnings`n" - $output | Out-File -FilePath $Path - Write-Verbose ($LocalizedData.VerboseSavedTypeDefinationModule -f $typeDefinationFileName, $OutputModule) - - return $complexTypeMapping -} \ No newline at end of file diff --git a/newton-cn/bin/Modules/Microsoft.PowerShell.ODataUtils/ko-KR/Microsoft.PowerShell.ODataUtilsStrings.psd1 b/newton-cn/bin/Modules/Microsoft.PowerShell.ODataUtils/ko-KR/Microsoft.PowerShell.ODataUtilsStrings.psd1 deleted file mode 100644 index 82cadd4..0000000 Binary files a/newton-cn/bin/Modules/Microsoft.PowerShell.ODataUtils/ko-KR/Microsoft.PowerShell.ODataUtilsStrings.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1 b/newton-cn/bin/Modules/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1 deleted file mode 100644 index 72f97b4..0000000 --- a/newton-cn/bin/Modules/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1 +++ /dev/null @@ -1,15 +0,0 @@ -@{ -GUID="A94C8C7E-9810-47C0-B8AF-65089C13A35A" -Author="Microsoft Corporation" -CompanyName="Microsoft Corporation" -Copyright="© Microsoft Corporation. All rights reserved." -ModuleVersion="3.0.0.0" -PowerShellVersion = '5.1' -CLRVersion="4.0" -AliasesToExport = @() -FunctionsToExport = @() -CmdletsToExport="Get-Acl", "Set-Acl", "Get-PfxCertificate", "Get-Credential", "Get-ExecutionPolicy", "Set-ExecutionPolicy", "Get-AuthenticodeSignature", "Set-AuthenticodeSignature", "ConvertFrom-SecureString", "ConvertTo-SecureString", "Get-CmsMessage", "Unprotect-CmsMessage", "Protect-CmsMessage" , "New-FileCatalog" , "Test-FileCatalog" -NestedModules="Microsoft.PowerShell.Security.dll" -HelpInfoURI = 'https://go.microsoft.com/fwlink/?linkid=390786' -CompatiblePSEditions = @('Desktop') -} diff --git a/newton-cn/bin/Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1 b/newton-cn/bin/Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1 deleted file mode 100644 index ab00f7a..0000000 --- a/newton-cn/bin/Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1 +++ /dev/null @@ -1,34 +0,0 @@ -@{ -GUID="1DA87E53-152B-403E-98DC-74D7B4D63D59" -Author="Microsoft Corporation" -CompanyName="Microsoft Corporation" -Copyright="© Microsoft Corporation. All rights reserved." -ModuleVersion="3.1.0.0" -PowerShellVersion = '5.1' -CLRVersion="4.0" -CmdletsToExport= "Format-List", "Format-Custom", "Format-Table", "Format-Wide", - "Out-File", "Out-Printer", "Out-String", - "Out-GridView", "Get-FormatData", "Export-FormatData", "ConvertFrom-Json", "ConvertTo-Json", - "Invoke-RestMethod", "Invoke-WebRequest", "Register-ObjectEvent", "Register-EngineEvent", - "Wait-Event", "Get-Event", "Remove-Event", "Get-EventSubscriber", "Unregister-Event", - "New-Event", "Add-Member", "Add-Type", "Compare-Object", "ConvertTo-Html", "ConvertFrom-StringData", - "Export-Csv", "Import-Csv", "ConvertTo-Csv", "ConvertFrom-Csv", "Export-Alias", "Invoke-Expression", - "Get-Alias", "Get-Culture", "Get-Date", "Get-Host", "Get-Member", "Get-Random", "Get-UICulture", - "Get-Unique", "Export-PSSession", "Import-PSSession", "Import-Alias", "Import-LocalizedData", - "Select-String", "Measure-Object", "New-Alias", "New-TimeSpan", "Read-Host", "Set-Alias", "Set-Date", - "Start-Sleep", "Tee-Object", "Measure-Command", "Update-List", "Update-TypeData", "Update-FormatData", - "Remove-TypeData", "Get-TypeData", "Write-Host", "Write-Progress", "New-Object", "Select-Object", - "Group-Object", "Sort-Object", "Get-Variable", "New-Variable", "Set-Variable", "Remove-Variable", - "Clear-Variable", "Export-Clixml", "Import-Clixml", "ConvertTo-Xml", "Select-Xml", "Write-Debug", - "Write-Verbose", "Write-Warning", "Write-Error", "Write-Information", "Write-Output", "Set-PSBreakpoint", "Get-PSBreakpoint", - "Remove-PSBreakpoint", "Enable-PSBreakpoint", "Disable-PSBreakpoint", "Get-PSCallStack", - "Send-MailMessage", "Get-TraceSource", "Set-TraceSource", "Trace-Command", "Show-Command", "Unblock-File", - "Get-Runspace", "Debug-Runspace", "Enable-RunspaceDebug", "Disable-RunspaceDebug", "Get-RunspaceDebug", "Wait-Debugger", - "ConvertFrom-String", "Convert-String" -FunctionsToExport= "Get-FileHash", "New-TemporaryFile", "New-Guid", "Format-Hex", "Import-PowerShellDataFile", - "ConvertFrom-SddlString" -AliasesToExport= "CFS", "fhx" -NestedModules="Microsoft.PowerShell.Commands.Utility.dll","Microsoft.PowerShell.Utility.psm1" -HelpInfoURI = 'https://go.microsoft.com/fwlink/?linkid=390787' -CompatiblePSEditions = @('Desktop') -} diff --git a/newton-cn/bin/Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psm1 b/newton-cn/bin/Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psm1 deleted file mode 100644 index d702a30..0000000 --- a/newton-cn/bin/Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psm1 +++ /dev/null @@ -1,740 +0,0 @@ -function Get-FileHash -{ - [CmdletBinding(DefaultParameterSetName = "Path", HelpURI = "https://go.microsoft.com/fwlink/?LinkId=517145")] - param( - [Parameter(Mandatory, ParameterSetName="Path", Position = 0)] - [System.String[]] - $Path, - - [Parameter(Mandatory, ParameterSetName="LiteralPath", ValueFromPipelineByPropertyName = $true)] - [Alias("PSPath")] - [System.String[]] - $LiteralPath, - - [Parameter(Mandatory, ParameterSetName="Stream")] - [System.IO.Stream] - $InputStream, - - [ValidateSet("SHA1", "SHA256", "SHA384", "SHA512", "MACTripleDES", "MD5", "RIPEMD160")] - [System.String] - $Algorithm="SHA256" - ) - - begin - { - # Construct the strongly-typed crypto object - - # First see if it has a FIPS algorithm - $hasherType = "System.Security.Cryptography.${Algorithm}CryptoServiceProvider" -as [Type] - if ($hasherType) - { - $hasher = $hasherType::New() - } - else - { - # Check if the type is supported in the current system - $algorithmType = "System.Security.Cryptography.${Algorithm}" -as [Type] - if ($algorithmType) - { - if ($Algorithm -eq "MACTripleDES") - { - $hasher = $algorithmType::New() - } - else - { - $hasher = $algorithmType::Create() - } - } - else - { - $errorId = "AlgorithmTypeNotSupported" - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errorMessage = [Microsoft.PowerShell.Commands.UtilityResources]::AlgorithmTypeNotSupported -f $Algorithm - $exception = [System.InvalidOperationException]::New($errorMessage) - $errorRecord = [System.Management.Automation.ErrorRecord]::New($exception, $errorId, $errorCategory, $null) - $PSCmdlet.ThrowTerminatingError($errorRecord) - } - } - - function GetStreamHash - { - param( - [System.IO.Stream] - $InputStream, - - [System.String] - $RelatedPath, - - [System.Security.Cryptography.HashAlgorithm] - $Hasher) - - # Compute file-hash using the crypto object - [Byte[]] $computedHash = $Hasher.ComputeHash($InputStream) - [string] $hash = [BitConverter]::ToString($computedHash) -replace '-','' - - if ($RelatedPath -eq $null) - { - $retVal = [PSCustomObject] @{ - Algorithm = $Algorithm.ToUpperInvariant() - Hash = $hash - } - } - else - { - $retVal = [PSCustomObject] @{ - Algorithm = $Algorithm.ToUpperInvariant() - Hash = $hash - Path = $RelatedPath - } - } - $retVal.psobject.TypeNames.Insert(0, "Microsoft.Powershell.Utility.FileHash") - $retVal - } - } - - process - { - if($PSCmdlet.ParameterSetName -eq "Stream") - { - GetStreamHash -InputStream $InputStream -RelatedPath $null -Hasher $hasher - } - else - { - $pathsToProcess = @() - if($PSCmdlet.ParameterSetName -eq "LiteralPath") - { - $pathsToProcess += Resolve-Path -LiteralPath $LiteralPath | Foreach-Object ProviderPath - } - if($PSCmdlet.ParameterSetName -eq "Path") - { - $pathsToProcess += Resolve-Path $Path | Foreach-Object ProviderPath - } - - foreach($filePath in $pathsToProcess) - { - if(Test-Path -LiteralPath $filePath -PathType Container) - { - continue - } - - try - { - # Read the file specified in $FilePath as a Byte array - [system.io.stream]$stream = [system.io.file]::OpenRead($filePath) - GetStreamHash -InputStream $stream -RelatedPath $filePath -Hasher $hasher - } - catch [Exception] - { - $errorMessage = [Microsoft.PowerShell.Commands.UtilityResources]::FileReadError -f $FilePath, $_ - Write-Error -Message $errorMessage -Category ReadError -ErrorId "FileReadError" -TargetObject $FilePath - return - } - finally - { - if($stream) - { - $stream.Dispose() - } - } - } - } - } -} - -<# This cmdlet is used to create a new temporary file in $env:temp #> -function New-TemporaryFile -{ - [CmdletBinding( - HelpURI='https://go.microsoft.com/fwlink/?LinkId=526726', - SupportsShouldProcess=$true)] - [OutputType([System.IO.FileInfo])] - Param() - - Begin - { - try - { - if($PSCmdlet.ShouldProcess($env:TEMP)) - { - $tempFilePath = [System.IO.Path]::GetTempFileName() - } - } - catch - { - $errorRecord = [System.Management.Automation.ErrorRecord]::new($_.Exception,"NewTemporaryFileWriteError", "WriteError", $env:TEMP) - Write-Error -ErrorRecord $errorRecord - return - } - - if($tempFilePath) - { - Get-Item $tempFilePath - } - } -} - -<# This cmdlet is used to generate a new guid #> -function New-Guid -{ - [CmdletBinding(HelpURI='https://go.microsoft.com/fwlink/?LinkId=526920')] - [OutputType([System.Guid])] - Param() - - Begin - { - [Guid]::NewGuid() - } -} - -<############################################################################################ -# Format-Hex cmdlet helps in displaying the Hexadecimal equivalent of the input data. -############################################################################################> -function Format-Hex -{ - [CmdletBinding( - DefaultParameterSetName="Path", - HelpUri="https://go.microsoft.com/fwlink/?LinkId=526919")] - [Alias("fhx")] - [OutputType("Microsoft.PowerShell.Commands.ByteCollection")] - param - ( - [Parameter (Mandatory=$true, Position=0, ParameterSetName="Path")] - [ValidateNotNullOrEmpty()] - [string[]] $Path, - - [Parameter (Mandatory=$true, ParameterSetName="LiteralPath")] - [ValidateNotNullOrEmpty()] - [Alias("PSPath")] - [string[]] $LiteralPath, - - [Parameter(Mandatory=$true, ParameterSetName="ByInputObject", ValueFromPipeline=$true)] - [Object] $InputObject, - - [Parameter (ParameterSetName="ByInputObject")] - [ValidateSet("Ascii", "UTF32", "UTF7", "UTF8", "BigEndianUnicode", "Unicode")] - [string] $Encoding = "Ascii", - - [Parameter(ParameterSetName="ByInputObject")] - [switch]$Raw - ) - - begin - { - $bufferSize = 16 - $inputStreamArray = [System.Collections.ArrayList]::New() - <############################################################################################ - # The ConvertToHexadecimalHelper is a helper method used to fetch unicode bytes from the - # input data and display the hexadecimial representaion of the of the input data in bytes. - ############################################################################################> - function ConvertToHexadecimalHelper - { - param - ( - [Byte[]] $inputBytes, - [string] $path, - [Uint32] $offset - ) - - # This section is used to display the hexadecimal - # representaion of the of the input data in bytes. - if($inputBytes -ne $null) - { - $byteCollectionObject = [Microsoft.PowerShell.Commands.ByteCollection]::new($offset, $inputBytes, $path) - Write-Output -InputObject $byteCollectionObject - } - } - - <############################################################################################ - # The ProcessFileContent is a helper method used to fetch file contents in blocks and - # process it to support displaying hexadecimal formating of the fetched content. - ############################################################################################> - function ProcessFileContent - { - param - ( - [string] $filePath, - [boolean] $isLiteralPath - ) - - if($isLiteralPath) - { - $resolvedPaths = Resolve-Path -LiteralPath $filePath - } - else - { - $resolvedPaths = Resolve-Path -Path $filePath - } - - # If Path resolution has failed then a corresponding non-terminating error is - # written to the pipeline. We continue processing any remaining files. - if($resolvedPaths -eq $null) - { - return - } - - if($resolvedPaths.Count -gt 1) - { - # write a non-terminating error message indicating that path specified is resolving to multiple file system paths. - $errorMessage = [Microsoft.PowerShell.Commands.UtilityResources]::FormatHexResolvePathError -f $filePath - Write-Error -Message $errorMessage -Category ([System.Management.Automation.ErrorCategory]::InvalidData) -ErrorId "FormatHexResolvePathError" - } - - $targetFilePath = $resolvedPaths.ProviderPath - - - if($targetFilePath -ne $null) - { - $buffer = [byte[]]::new($bufferSize) - - try - { - try - { - $currentFileStream = [System.IO.File]::Open($targetFilePath, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read) - } - catch - { - # Failed to access the file. Write a non terminating error to the pipeline - # and move on with the remaining files. - $exception = $_.Exception - if($null -ne $_.Exception -and - $null -ne $_.Exception.InnerException) - { - $exception = $_.Exception.InnerException - } - - $errorRecord = [System.Management.Automation.ErrorRecord]::new($exception,"FormatHexFileAccessError", ([System.Management.Automation.ErrorCategory]::ReadError), $targetFilePath) - $PSCmdlet.WriteError($errorRecord) - } - - if($null -ne $currentFileStream) - { - $srcStream = [System.IO.BinaryReader]::new($currentFileStream) - $displayHeader = $true - $offset = 0 - $blockCounter = 0 - while($numberOfBytesRead = $srcStream.Read($buffer, 0, $bufferSize)) - { - # send only the bytes that have been read - # if we send the whole buffer, we'll have extraneous bytes - # at the end of an incomplete group of 16 bytes - if ( $numberOfBytesRead -eq $bufferSize ) - { - # under some circumstances if we don't copy the buffer - # and the results are stored to a variable, the results are not - # correct and one object replicated in all the output objects - ConvertToHexadecimalHelper ($buffer.Clone()) $targetFilePath $offset - } - else - { - # handle the case of the partial (and probably last) buffer - $bytesReadBuffer = [byte[]]::New($numberOfBytesRead) - [Array]::Copy($buffer,0, $bytesReadBuffer,0,$numberOfBytesRead) - ConvertToHexadecimalHelper $bytesReadBuffer $targetFilePath $offset - } - $displayHeader = $false - $blockCounter++; - - # Updating the offset value. - $offset = $blockCounter*0x10 - } - } - } - finally - { - If($null -ne $currentFileStream) - { - $currentFileStream.Dispose() - } - If($null -ne $srcStream) - { - $srcStream.Dispose() - } - } - } - } - } - - process - { - switch($PSCmdlet.ParameterSetName) - { - "Path" - { - ProcessFileContent $Path $false - } - "LiteralPath" - { - ProcessFileContent $LiteralPath $true - } - "ByInputObject" - { - # If it's an actual byte array, then we directly use it for hexadecimal formatting. - if($InputObject -is [Byte[]]) - { - ConvertToHexadecimalHelper $InputObject $null - return - } - # if it's a single byte, we'll assume streaming - elseif($InputObject -is [byte]) - { - $null = $inputStreamArray.Add($InputObject) - } - # If the input data is of string type then directly get bytes out of it. - elseif($InputObject -is [string]) - { - # The ValidateSet arribute on the Encoding paramter makes sure that only - # valid values (supported on all paltforms where Format-Hex is avaliable) - # are allowed through user input. - $inputBytes = [Text.Encoding]::$Encoding.GetBytes($InputObject) - ConvertToHexadecimalHelper $inputBytes $null - return - } - elseif($InputObject -is [System.IO.FileSystemInfo]) - { - # If file path is provided as an input, use the file contents to show the hexadecimal format. - $filePath = ([System.IO.FileSystemInfo]$InputObject).FullName - ProcessFileContent $filePath $false - return - } - elseif($InputObject -is [int64]) - { - $inputBytes = [BitConverter]::GetBytes($InputObject) - $null = $inputStreamArray.AddRange($inputBytes) - } - elseif($InputObject -is [int64[]]) - { - foreach($i64 in $InputObject) - { - $inputBytes = [BitConverter]::GetBytes($i64) - $null = $inputStreamArray.AddRange($inputBytes) - } - } - elseif($InputObject -is [int]) - { - # If we get what appears as ints, it may not be what the user really wants. - # for example, if the user types a small set of numbers just to get their - # character representations, as follows: - # - # 170..180 | format-hex - # Path: - # 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - #00000000 AA AB AC AD AE AF B0 B1 B2 B3 B4 ª«¬­®¯°±²³´ - # - # any integer padding is likely to be more confusing than this - # fairly compact representation. - # - # However, some might like to see the results with the raw data, - # -Raw exists to provide that behavior: - # PS# 170..180 | format-hex -Raw - # - # Path: - # - # 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F - # - # 00000000 AA 00 00 00 AB 00 00 00 AC 00 00 00 AD 00 00 00 ª...«...¬...­... - # 00000010 AE 00 00 00 AF 00 00 00 B0 00 00 00 B1 00 00 00 ®...¯...°...±... - # 00000020 B2 00 00 00 B3 00 00 00 B4 00 00 00 ²...³...´... - # - # this provides a representation of the piped numbers which includes all - # of the bytes which are in an int32 - if ( $Raw ) - { - $inputBytes = [BitConverter]::GetBytes($InputObject) - $null = $inputStreamArray.AddRange($inputBytes) - } - else - { - # first determine whether we can represent this as a byte - $possibleByte = $InputObject -as [byte] - # first determine whether we can represent this as a int16 - $possibleInt16 = $InputObject -as [int16] - if ( $possibleByte -ne $null ) - { - $null = $inputStreamArray.Add($possibleByte) - } - elseif ( $possibleint16 -ne $null ) - { - $inputBytes = [BitConverter]::GetBytes($possibleInt16) - $null = $inputStreamArray.AddRange($inputBytes) - } - else - { - # now int - $inputBytes = [BitConverter]::GetBytes($InputObject) - $null = $inputStreamArray.AddRange($inputBytes) - } - } - } - else - { - # Otherwise, write a non-terminating error message indicating that input object type is not supported. - $errorMessage = [Microsoft.PowerShell.Commands.UtilityResources]::FormatHexTypeNotSupported -f $InputObject.GetType() - Write-Error -Message $errorMessage -Category ([System.Management.Automation.ErrorCategory]::ParserError) -ErrorId "FormatHexFailureTypeNotSupported" - } - # Handle streaming case here - # during this process we may not have enough characters to create a ByteCollection - # if we do, create as many ByteCollections as necessary, each being 16 bytes in length - if ( $inputStreamArray.Count -ge $bufferSize ) - { - $rowCount = [math]::Floor($inputStreamArray.Count/$bufferSize) - $arrayLength = $bufferSize * $rowCount - for($i = 0; $i -lt $rowCount; $i++) - { - $rowOffset = $i * $bufferSize - ConvertToHexadecimalHelper -inputBytes $inputStreamArray.GetRange($rowOffset, $bufferSize) -path ' ' -offset $offset - $offset += $bufferSize - } - # We use RemoveRange because of the pathological case of having - # streamed combination of bytes, int16, int32, int64 which are greater - # than 16 bytes. Consider the case: - # $i = [int16]::MaxValue + 3 - # $i64=[int64]::MaxValue -5 - # .{ $i;$i;$i;$i64 } | format-hex - # which create an arraylist 20 bytes - # we need to remove only the bytes from the array which we emitted - $inputStreamArray.RemoveRange(0,$arrayLength) - } - } - } - } - end - { - # now manage any left over bytes in the $inputStreamArray - if ( $PSCmdlet.ParameterSetName -eq "ByInputObject" ) - { - ConvertToHexadecimalHelper $inputStreamArray $null -path ' ' -offset $offset - } - } - -} - -## Imports a PowerShell Data File - a PowerShell hashtable defined in -## a file (such as a Module manifest, session configuration file) -function Import-PowerShellDataFile -{ - [CmdletBinding(DefaultParameterSetName = "ByPath", HelpUri = "https://go.microsoft.com/fwlink/?LinkID=623621")] - [OutputType("System.Collections.Hashtable")] - param( - [Parameter(ParameterSetName = "ByPath", Position = 0)] - [String[]] $Path, - - [Parameter(ParameterSetName = "ByLiteralPath", ValueFromPipelineByPropertyName = $true)] - [Alias("PSPath")] - [String[]] $LiteralPath - ) - - begin - { - function ThrowInvalidDataFile - { - param($resolvedPath, $extraError) - - $errorId = "CouldNotParseAsPowerShellDataFile$extraError" - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidData - $errorMessage = [Microsoft.PowerShell.Commands.UtilityResources]::CouldNotParseAsPowerShellDataFile -f $resolvedPath - $exception = [System.InvalidOperationException]::New($errorMessage) - $errorRecord = [System.Management.Automation.ErrorRecord]::New($exception, $errorId, $errorCategory, $null) - $PSCmdlet.WriteError($errorRecord) - } - } - - process - { - foreach($resolvedPath in (Resolve-Path @PSBoundParameters)) - { - $parseErrors = $null - $ast = [System.Management.Automation.Language.Parser]::ParseFile(($resolvedPath.ProviderPath), [ref] $null, [ref] $parseErrors) - if ($parseErrors.Length -gt 0) - { - ThrowInvalidDataFile $resolvedPath - } - else - { - $data = $ast.Find( { $args[0] -is [System.Management.Automation.Language.HashtableAst] }, $false ) - if($data) - { - $data.SafeGetValue() - } - else - { - ThrowInvalidDataFile $resolvedPath "NoHashtableRoot" - } - } - } - } -} - -## Converts a SDDL string into an object-based representation of a security -## descriptor -function ConvertFrom-SddlString -{ - [CmdletBinding(HelpUri = "https://go.microsoft.com/fwlink/?LinkId=623636")] - param( - ## The string representing the security descriptor in SDDL syntax - [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] - [String] $Sddl, - - ## The type of rights that this SDDL string represents, if any. - [Parameter()] - [ValidateSet( - "FileSystemRights", "RegistryRights", "ActiveDirectoryRights", - "MutexRights", "SemaphoreRights", "CryptoKeyRights", - "EventWaitHandleRights")] - $Type - ) - - Begin - { - # On CoreCLR CryptoKeyRights and ActiveDirectoryRights are not supported. - if ($PSEdition -eq "Core" -and ($Type -eq "CryptoKeyRights" -or $Type -eq "ActiveDirectoryRights")) - { - $errorId = "TypeNotSupported" - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidArgument - $errorMessage = [Microsoft.PowerShell.Commands.UtilityResources]::TypeNotSupported -f $Type - $exception = [System.ArgumentException]::New($errorMessage) - $errorRecord = [System.Management.Automation.ErrorRecord]::New($exception, $errorId, $errorCategory, $null) - $PSCmdlet.ThrowTerminatingError($errorRecord) - } - - ## Translates a SID into a NT Account - function ConvertTo-NtAccount - { - param($Sid) - - if($Sid) - { - $securityIdentifier = [System.Security.Principal.SecurityIdentifier] $Sid - - try - { - $ntAccount = $securityIdentifier.Translate([System.Security.Principal.NTAccount]).ToString() - } - catch{} - - $ntAccount - } - } - - ## Gets the access rights that apply to an access mask, preferring right types - ## of 'Type' if specified. - function Get-AccessRights - { - param($AccessMask, $Type) - - if ($PSEdition -eq "Core") - { - ## All the types of access rights understood by .NET Core - $rightTypes = [Ordered] @{ - "FileSystemRights" = [System.Security.AccessControl.FileSystemRights] - "RegistryRights" = [System.Security.AccessControl.RegistryRights] - "MutexRights" = [System.Security.AccessControl.MutexRights] - "SemaphoreRights" = [System.Security.AccessControl.SemaphoreRights] - "EventWaitHandleRights" = [System.Security.AccessControl.EventWaitHandleRights] - } - } - else - { - ## All the types of access rights understood by .NET - $rightTypes = [Ordered] @{ - "FileSystemRights" = [System.Security.AccessControl.FileSystemRights] - "RegistryRights" = [System.Security.AccessControl.RegistryRights] - "ActiveDirectoryRights" = [System.DirectoryServices.ActiveDirectoryRights] - "MutexRights" = [System.Security.AccessControl.MutexRights] - "SemaphoreRights" = [System.Security.AccessControl.SemaphoreRights] - "CryptoKeyRights" = [System.Security.AccessControl.CryptoKeyRights] - "EventWaitHandleRights" = [System.Security.AccessControl.EventWaitHandleRights] - } - } - $typesToExamine = $rightTypes.Values - - ## If they know the access mask represents a certain type, prefer its names - ## (i.e.: CreateLink for the registry over CreateDirectories for the filesystem) - if($Type) - { - $typesToExamine = @($rightTypes[$Type]) + $typesToExamine - } - - - ## Stores the access types we've found that apply - $foundAccess = @() - - ## Store the access types we've already seen, so that we don't report access - ## flags that are essentially duplicate. Many of the access values in the different - ## enumerations have the same value but with different names. - $foundValues = @{} - - ## Go through the entries in the different right types, and see if they apply to the - ## provided access mask. If they do, then add that to the result. - foreach($rightType in $typesToExamine) - { - foreach($accessFlag in [Enum]::GetNames($rightType)) - { - $longKeyValue = [long] $rightType::$accessFlag - if(-not $foundValues.ContainsKey($longKeyValue)) - { - $foundValues[$longKeyValue] = $true - if(($AccessMask -band $longKeyValue) -eq ($longKeyValue)) - { - $foundAccess += $accessFlag - } - } - } - } - - $foundAccess | Sort-Object - } - - ## Converts an ACE into a string representation - function ConvertTo-AceString - { - param( - [Parameter(ValueFromPipeline)] - $Ace, - $Type - ) - - process - { - foreach($aceEntry in $Ace) - { - $AceString = (ConvertTo-NtAccount $aceEntry.SecurityIdentifier) + ": " + $aceEntry.AceQualifier - if($aceEntry.AceFlags -ne "None") - { - $AceString += " " + $aceEntry.AceFlags - } - - if($aceEntry.AccessMask) - { - $foundAccess = Get-AccessRights $aceEntry.AccessMask $Type - - if($foundAccess) - { - $AceString += " ({0})" -f ($foundAccess -join ", ") - } - } - - $AceString - } - } - } - } - - Process - { - $rawSecurityDescriptor = [Security.AccessControl.CommonSecurityDescriptor]::new($false,$false,$Sddl) - - $owner = ConvertTo-NtAccount $rawSecurityDescriptor.Owner - $group = ConvertTo-NtAccount $rawSecurityDescriptor.Group - $discretionaryAcl = ConvertTo-AceString $rawSecurityDescriptor.DiscretionaryAcl $Type - $systemAcl = ConvertTo-AceString $rawSecurityDescriptor.SystemAcl $Type - - [PSCustomObject] @{ - Owner = $owner - Group = $group - DiscretionaryAcl = @($discretionaryAcl) - SystemAcl = @($systemAcl) - RawDescriptor = $rawSecurityDescriptor - } - } -} diff --git a/newton-cn/bin/Modules/Microsoft.WSMan.Management/Microsoft.WSMan.Management.psd1 b/newton-cn/bin/Modules/Microsoft.WSMan.Management/Microsoft.WSMan.Management.psd1 deleted file mode 100644 index 56bca97..0000000 --- a/newton-cn/bin/Modules/Microsoft.WSMan.Management/Microsoft.WSMan.Management.psd1 +++ /dev/null @@ -1,16 +0,0 @@ -@{ -GUID="766204A6-330E-4263-A7AB-46C87AFC366C" -Author="Microsoft Corporation" -CompanyName="Microsoft Corporation" -Copyright="© Microsoft Corporation. All rights reserved." -ModuleVersion="3.0.0.0" -PowerShellVersion = '5.1' -CLRVersion="4.0" -AliasesToExport = @() -FunctionsToExport = @() -CmdletsToExport="Disable-WSManCredSSP", "Enable-WSManCredSSP", "Get-WSManCredSSP", "Set-WSManQuickConfig", "Test-WSMan", "Invoke-WSManAction", "Connect-WSMan", "Disconnect-WSMan", "Get-WSManInstance", "Set-WSManInstance", "Remove-WSManInstance", "New-WSManInstance", "New-WSManSessionOption" -NestedModules="Microsoft.WSMan.Management.dll" -FormatsToProcess="..\..\WSMan.format.ps1xml" -HelpInfoURI = 'https://go.microsoft.com/fwlink/?linkid=390788' -CompatiblePSEditions = @('Desktop') -} diff --git a/newton-cn/bin/Modules/MsDtc/MSFT_DtcAdvancedHostSettingTask_v1.0.cdxml b/newton-cn/bin/Modules/MsDtc/MSFT_DtcAdvancedHostSettingTask_v1.0.cdxml deleted file mode 100644 index a40f80d..0000000 --- a/newton-cn/bin/Modules/MsDtc/MSFT_DtcAdvancedHostSettingTask_v1.0.cdxml +++ /dev/null @@ -1,86 +0,0 @@ - - - - 1.0 - DtcAdvancedHostSetting - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - String - DWORD - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/MsDtc/MSFT_DtcAdvancedSettingTask_v1.0.cdxml b/newton-cn/bin/Modules/MsDtc/MSFT_DtcAdvancedSettingTask_v1.0.cdxml deleted file mode 100644 index 2be0a63..0000000 --- a/newton-cn/bin/Modules/MsDtc/MSFT_DtcAdvancedSettingTask_v1.0.cdxml +++ /dev/null @@ -1,100 +0,0 @@ - - - - 1.0 - DtcAdvancedSetting - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - String - DWORD - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/MsDtc/MSFT_DtcClusterDefaultTask_v1.0.cdxml b/newton-cn/bin/Modules/MsDtc/MSFT_DtcClusterDefaultTask_v1.0.cdxml deleted file mode 100644 index 035572f..0000000 --- a/newton-cn/bin/Modules/MsDtc/MSFT_DtcClusterDefaultTask_v1.0.cdxml +++ /dev/null @@ -1,46 +0,0 @@ - - - - 1.0 - DtcClusterDefault - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/MsDtc/MSFT_DtcClusterTMMappingTask_v1.0.cdxml b/newton-cn/bin/Modules/MsDtc/MSFT_DtcClusterTMMappingTask_v1.0.cdxml deleted file mode 100644 index ea48f2b..0000000 --- a/newton-cn/bin/Modules/MsDtc/MSFT_DtcClusterTMMappingTask_v1.0.cdxml +++ /dev/null @@ -1,372 +0,0 @@ - - - - 1.0 - DtcClusterTMMapping - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/MsDtc/MSFT_DtcDefaultTask_v1.0.cdxml b/newton-cn/bin/Modules/MsDtc/MSFT_DtcDefaultTask_v1.0.cdxml deleted file mode 100644 index e6b9926..0000000 --- a/newton-cn/bin/Modules/MsDtc/MSFT_DtcDefaultTask_v1.0.cdxml +++ /dev/null @@ -1,46 +0,0 @@ - - - - 1.0 - DtcDefault - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/MsDtc/MSFT_DtcLogTask_v1.0.cdxml b/newton-cn/bin/Modules/MsDtc/MSFT_DtcLogTask_v1.0.cdxml deleted file mode 100644 index bc14331..0000000 --- a/newton-cn/bin/Modules/MsDtc/MSFT_DtcLogTask_v1.0.cdxml +++ /dev/null @@ -1,94 +0,0 @@ - - - - 1.0 - DtcLog - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/MsDtc/MSFT_DtcNetworkSettingTask_v1.0.cdxml b/newton-cn/bin/Modules/MsDtc/MSFT_DtcNetworkSettingTask_v1.0.cdxml deleted file mode 100644 index 1ccbe4e..0000000 --- a/newton-cn/bin/Modules/MsDtc/MSFT_DtcNetworkSettingTask_v1.0.cdxml +++ /dev/null @@ -1,130 +0,0 @@ - - - - 1.0 - DtcNetworkSetting - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - NoAuth - Incoming - Mutual - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/MsDtc/MSFT_DtcTask_v1.0.cdxml b/newton-cn/bin/Modules/MsDtc/MSFT_DtcTask_v1.0.cdxml deleted file mode 100644 index 2f6132c..0000000 --- a/newton-cn/bin/Modules/MsDtc/MSFT_DtcTask_v1.0.cdxml +++ /dev/null @@ -1,125 +0,0 @@ - - - - 1.0 - Dtc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BootStart - SystemStart - AutoStart - DemandStart - Disabled - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/MsDtc/MSFT_DtcTransactionTask_v1.0.cdxml b/newton-cn/bin/Modules/MsDtc/MSFT_DtcTransactionTask_v1.0.cdxml deleted file mode 100644 index 00c2a1b..0000000 --- a/newton-cn/bin/Modules/MsDtc/MSFT_DtcTransactionTask_v1.0.cdxml +++ /dev/null @@ -1,148 +0,0 @@ - - - - 1.0 - DtcTransaction - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/MsDtc/MSFT_DtcTransactionsStatisticsTask_v1.0.cdxml b/newton-cn/bin/Modules/MsDtc/MSFT_DtcTransactionsStatisticsTask_v1.0.cdxml deleted file mode 100644 index 65ff3c7..0000000 --- a/newton-cn/bin/Modules/MsDtc/MSFT_DtcTransactionsStatisticsTask_v1.0.cdxml +++ /dev/null @@ -1,33 +0,0 @@ - - - - 1.0 - DtcTransactionsStatistics - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/MsDtc/MSFT_DtcTransactionsTraceSessionTask_v1.0.cdxml b/newton-cn/bin/Modules/MsDtc/MSFT_DtcTransactionsTraceSessionTask_v1.0.cdxml deleted file mode 100644 index d3d0a32..0000000 --- a/newton-cn/bin/Modules/MsDtc/MSFT_DtcTransactionsTraceSessionTask_v1.0.cdxml +++ /dev/null @@ -1,80 +0,0 @@ - - - - 1.0 - DtcTransactionsTraceSession - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/MsDtc/MSFT_DtcTransactionsTraceSettingTask_v1.0.cdxml b/newton-cn/bin/Modules/MsDtc/MSFT_DtcTransactionsTraceSettingTask_v1.0.cdxml deleted file mode 100644 index df42497..0000000 --- a/newton-cn/bin/Modules/MsDtc/MSFT_DtcTransactionsTraceSettingTask_v1.0.cdxml +++ /dev/null @@ -1,70 +0,0 @@ - - - - 1.0 - DtcTransactionsTraceSetting - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/MsDtc/MsDtc.Formats.ps1xml b/newton-cn/bin/Modules/MsDtc/MsDtc.Formats.ps1xml deleted file mode 100644 index 9f1026d..0000000 --- a/newton-cn/bin/Modules/MsDtc/MsDtc.Formats.ps1xml +++ /dev/null @@ -1,207 +0,0 @@ - - - - - Dtc - - Microsoft.Management.Infrastructure.CimInstance#DtcInstance - - - - - - - DtcName - - - VirtualServerName - - - Status - - - OleTxEndpointCid - - - XAEndpointCid - - - UisEndpointCid - - - KtmRmEndpointCid - - - - - - - - DtcClusterTMMapping - - Microsoft.Management.Infrastructure.CimInstance#DtcClusterTMMapping - - - - - - - Name - - - ApplicationType - - - Application - - - Local - - - ClusterResourceName - - - - - - - - DtcTransactionsStatistics - - Microsoft.Management.Infrastructure.CimInstance#DtcTransactionsStatistics - - - - - - - Open - - - Committed - - - Aborted - - - ForcedAbort - - - InDoubt - - - Heuristic - - - SinglePhaseInDoubt - - - OpenMax - - - CommittedMax - - - AbortedMax - - - InDoubtMax - - - HeuristicMax - - - - - - - - DtcNetworkSetting - - Microsoft.Management.Infrastructure.CimInstance#DtcNetworkSettings - - - - - - - AuthenticationLevel - - - InboundTransactionsEnabled - - - OutboundTransactionsEnabled - - - RemoteClientAccessEnabled - - - RemoteAdministrationAccessEnabled - - - XATransactionsEnabled - - - LUTransactionsEnabled - - - - - - - - DtcTransactionInfo - - Microsoft.Management.Infrastructure.CimInstance#DtcTransactionInfo - - - - - - - TransactionId - - - Description - - - State - - - IsolationLevel - - - Parent - - - - - - - - DtcLog - - Microsoft.Management.Infrastructure.CimInstance#DtcLogFileSettings - - - - - - - Path - - - SizeInMB - - - MaxSizeInMB - - - - - - - - - diff --git a/newton-cn/bin/Modules/MsDtc/MsDtc.Types.ps1xml b/newton-cn/bin/Modules/MsDtc/MsDtc.Types.ps1xml deleted file mode 100644 index e0cac8c..0000000 --- a/newton-cn/bin/Modules/MsDtc/MsDtc.Types.ps1xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - Microsoft.Dtc.PowerShell.Diagnostics.DtcDiagnosticTransaction - - - PsStandardMembers - - - DefaultDisplayProperty - Id - - - DefaultDisplayPropertySet - - Id - - - - DefaultKeyPropertySet - - Id - - - - - - - - Microsoft.Dtc.PowerShell.Diagnostics.DtcDiagnosticResourceManagerJob - - - PsStandardMembers - - - DefaultDisplayProperty - Name - - - DefaultDisplayPropertySet - - Name - InstanceId - - - - DefaultKeyPropertySet - - Name - InstanceId - State - Location - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/MsDtc/MsDtc.psd1 b/newton-cn/bin/Modules/MsDtc/MsDtc.psd1 deleted file mode 100644 index 4459632..0000000 Binary files a/newton-cn/bin/Modules/MsDtc/MsDtc.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/MsDtc/TestDtc.psm1 b/newton-cn/bin/Modules/MsDtc/TestDtc.psm1 deleted file mode 100644 index 066b3d7..0000000 --- a/newton-cn/bin/Modules/MsDtc/TestDtc.psm1 +++ /dev/null @@ -1,752 +0,0 @@ -Import-Module netsecurity - -$Strings = DATA { - @{ - FirewallRuleEnabled = "{0}: Firewall rule for {1} is enabled." - FirewallRuleDisabled = "{0}: Firewall rule for {1} is disabled. This computer cannot participate in network transactions." - CmdletFailed = "The {0} cmdlet failed. Please make sure the {1} module is installed." - InvalidLocalComputer = "{0} is not a valid local computer name." - RPCEndpointMapper = "RPC Endpoint Mapper" - DtcIncomingConnection = "DTC incoming connections" - DtcOutgoingConnection = "DTC outgoing connections" - MatchingDtcNotFound = "A DTC instance with VirtualServerName {0} does not exist." - InboundDisabled = "{0}: Inbound transactions are not allowed and this computer cannot participate in network transactions." - OutboundDisabled = "{0}: Outbound transactions are not allowed and this computer cannot participate in network transactions." - OSVersion = "{0} Operating System Version: {1}." - OSQueryFailed = "Failed to query operating system of {0}." - VersionNotSupported = "Testing DTC on Windows versions below {0} is not supported with this cmdlet." - FailedToCreateCimSession = "Failed to create a CIM Session to {0}." - NotARemoteComputer = "{0} is not a remote computer." - PingingSucceeded = "Pinging computer {0} from {1} succeeded. " - PingingFailed = "Pinging computer {0} from {1} failed." - SameCids = "The {0} CID on {1} and {2} is the same. The CID should be unique to each computer." - DiagnosticTestPrompt = "This diagnostic test will attempt to carry out a transaction propagation between {0} and {1}. It requires that a TCP port is opened on {0} so that a Test Resource Manager can participate in network transactions." - DefaultPortDescription = "The default port is {0} and you can change it using the 'ResourceManagerPort' parameter and rerunning the test. " - PortDescription = "You have specified {0} as the 'ResourceManagerPort'." - FirewallRequest = "Please open port {0} in the firewall to proceed with the test." - QueryText = "Do you want to proceed with the test?" - InvalidDefaultCluster = "{0} is not the Virtual Server Name of the default DTC configured on this computer. You can use 'Set-DtcClusterDefault' cmdlet configure the default DTC on this computer." - InvalidDefault = "{0} is not the Virtual Server Name of the default DTC configured on this computer. You can use 'Set-DtcDefault' cmdlet to configure the default DTC on this computer." - NeedDtcSecurityFix = "DTC security settings and firewall settings should be fixed in order to complete the transactions propagation test." - StartResourceManagerFailed = "Test resource manager creation failed." - ResourceManagerStarted = "Test resource manager started." - PSSessionCreated = "A new PSSession to {0} created." - TransactionPropagated = "Transaction propagated from {0} to {1} using {2} propagation." - TransactionPropagationFailed = "Transaction propagation {0} to {1} failed using {2} propagation." - TestRMVerboseLog = "Test Resource Manager Verbose Log:" - TestRMWarningLog = "Test Resource Manager Warning Log:" - InvalidParameters = "At least one of LocalComputerName or RemoteComputerName parameters should be specified." - } -} - - -function IsLocalComputer -{ - param( - $computerName = $null - ) - PROCESS - { - $found = $false - $dtcs = Get-Dtc - if ($dtcs -eq $null) - { - throw - } - else - { - if ($dtcs.GetType().IsArray) - { - foreach ($dtc in $dtcs) - { - if ([string]::Compare($dtc.VirtualServerName, $computerName, $true) -eq 0) - { - $found = $true - break - } - } - } - else - { - if ([string]::Compare($dtcs.VirtualServerName, $computerName, $true) -eq 0) - { - $found = $true - } - } - } - return $found - } -} - -function CheckFirewallRule -{ - param( - $computerName = $null, - $ruleId = $null, - $ruleDesription = $null - ) - PROCESS - { - $success = $false - $errorVariable = $null - if ($computerName -eq $null) - { - $rule = Get-NetFirewallRule -ID $ruleId -ErrorVariable errorVariable - } - else - { - $rule = Get-NetFirewallRule -ID $ruleId -CimSession $computerName -ErrorVariable errorVariable - } - - if ($rule -eq $null) - { - if ($errorVariable -ne $null) - { - throw $errorVariable - } - else - { - throw ([string]::Format($Strings.CmdletFailed, "Get-NetFirewallRule", "networksecurity")) - } - - } - else - { - if ($rule.Enabled -eq 1) - { - Write-Verbose ([string]::Format($Strings.FirewallRuleEnabled, $computerName, $ruleDesription)) - $success = $true - } - else - { - Write-Warning ([string]::Format($Strings.FirewallRuleDisabled, $computerName, $ruleDesription)) - } - } - return $success - } -} - -function CheckFirewallRules -{ - param( - $ComputerName = $null - ) - $rpcEPRuleId = "MSDTC-RPCSS-In-TCP" - $dtcOutRule = "MSDTC-Out-TCP" - $dtcInRule = "MSDTC-In-TCP" - - $rpcOutcss = CheckFirewallRule $ComputerName $rpcEPRuleId $Strings.RPCEndpointMapper - $dtcIn = CheckFirewallRule $ComputerName $dtcInRule $Strings.DtcIncomingConnection - $dtcOut = CheckFirewallRule $ComputerName $dtcOutRule $Strings.DtcOutgoingConnection - - return ($rpcOutcss -and $dtcOutRule -and $dtcInRule) -} - -function FindDtc -{ - param( - $ComputerName = $null, - $CimSession = $null - ) - - $matchedDtc = $null - $errorVariable = $null - if ($cimsession -eq $null) - { - $dtcs = Get-Dtc -ErrorVariable $errorVariable - } - else - { - $dtcs = Get-Dtc -CimSession $CimSession -ErrorVariable errorVariable - } - - if ($dtcs -eq $null) - { - if ($errorVariable -ne $null) - { - throw $errorVariable - } - else - { - throw ([string]::Format($Strings.CmdletFailed, "Get-Dtc", "MSDTC")) - } - } - else - { - if ($dtcs.GetType().IsArray -eq $true) - { - foreach ($dtc in $dtcs) - { - if ($dtc.VirtualServerName -eq $computerName) - { - $matchedDtc = $dtc - break - } - } - } - else - { - $matchedDtc = $dtcs - } - } - - if ($matchedDtc -eq $null) - { - throw ([string]::Format($Strings.MatchingDtcNotFound, $computerName)) - } - - return $matchedDtc -} - -function CheckDtcSecurity -{ - param( - $DtcNetworkSetting = $null, - $ComputerName = $nul - ) - PROCESS - { - Write-Verbose ([string]::Format("{0}: AuthenticationLevel: {1}", $ComputerName, $DtcNetworkSetting.AuthenticationLevel)) - Write-Verbose ([string]::Format("{0}: InboundTransactionsEnabled: {1}", $ComputerName, $DtcNetworkSetting.InboundTransactionsEnabled)) - if ($DtcNetworkSetting.InboundTransactionsEnabled -eq $false) - { - Write-Warning ([string]::Format($Strings.InboundDisabled, $ComputerName)) - } - - Write-Verbose ([string]::Format("{0}: OutboundTransactionsEnabled: {1}", $ComputerName, $DtcNetworkSetting.OutboundTransactionsEnabled)) - if ($DtcNetworkSetting.OutboundTransactionsEnabled -eq $false) - { - Write-Warning ([string]::Format($Strings.OutboundDisabled, $ComputerName)) - } - - Write-Verbose ([string]::Format("{0}: RemoteClientAccessEnabled: {1}", $ComputerName, $DtcNetworkSetting.RemoteClientAccessEnabled)) - Write-Verbose ([string]::Format("{0}: RemoteAdministrationAccessEnabled: {1}", $ComputerName, $DtcNetworkSetting.RemoteAdministrationAccessEnabled)) - Write-Verbose ([string]::Format("{0}: XATransactionsEnabled: {1}", $ComputerName, $DtcNetworkSetting.XATransactionsEnabled)) - Write-Verbose ([string]::Format("{0}: LUTransactionsEnabled: {1}", $ComputerName, $DtcNetworkSetting.LUTransactionsEnabled)) - - return $DtcNetworkSetting.InboundTransactionsEnabled -and $DtcNetworkSetting.OutboundTransactionsEnabled - } -} - - -function DoPingTest -{ - param( - $ToComputerName = $null, - $FromComputerName = $null - ) - - - $filter = "Address='$ToComputerName'" - $pingingResult = Get-WmiObject -Class Win32_PingStatus -Filter $filter -ComputerName $FromComputerName - - if ($pingingResult.StatusCode -eq 0) - { - Write-Verbose ([string]::Format($Strings.PingingSucceeded, $ToComputerName, $FromComputerName)) - return $true; - } - else - { - Write-Warning ([string]::Format($Strings.PingingFailed, $ToComputerName, $FromComputerName)) - return $false; - } -} - -function CompareCids -{ - param( - $LocalDtc = $null, - $RemoteDtc = $null - ) - - Write-Verbose ([string]::Format("{0}: OleTx: {1}", $LocalDtc.VirtualServerName, $LocalDtc.OleTxEndpointCid)) - Write-Verbose ([string]::Format("{0}: OleTx: {1}", $RemoteDtc.VirtualServerName, $RemoteDtc.OleTxEndpointCid)) - if ([string]::Compare($LocalDtc.OleTxEndpointCid, $RemoteDtc.OleTxEndpointCid, $true) -eq 0) - { - throw ([string]::Format($Strings.SameCids, "OleTx", $LocalDtc.VirtualServerName, $RemoteDtc.VirtualServerName)) - } - Write-Verbose ([string]::Format("{0}: XA: {1}", $LocalDtc.VirtualServerName, $LocalDtc.XAEndpointCid)) - Write-Verbose ([string]::Format("{0}: XA: {1}", $RemoteDtc.VirtualServerName, $RemoteDtc.XAEndpointCid)) - if ([string]::Compare($LocalDtc.XAEndpointCid, $RemoteDtc.XAEndpointCid, $true) -eq 0) - { - throw ([string]::Format($Strings.SameCids, "XA", $LocalDtc.VirtualServerName, $RemoteDtc.VirtualServerName)) - } - Write-Verbose ([string]::Format("{0}: UIS: {1}", $LocalDtc.VirtualServerName, $LocalDtc.UisEndpointCid)) - Write-Verbose ([string]::Format("{0}: UIS: {1}", $RemoteDtc.VirtualServerName, $RemoteDtc.UisEndpointCid)) - if ([string]::Compare($LocalDtc.UisEndpointCid, $RemoteDtc.UisEndpointCid, $true) -eq 0) - { - throw ([string]::Format($Strings.SameCids, "UIS", $LocalDtc.VirtualServerName, $RemoteDtc.VirtualServerName)) - } -} - -function CheckIfDefaultDtcConfigured -{ - param( - $ComputerName = $null, - $Cimsession = $null - ) - - $errorVariable = $null - $cluster = $false - if ($Cimsession -eq $null) - { - $dtcs = Get-Dtc -ErrorVariable errorVariable - } - else - { - $dtcs = Get-Dtc -ErrorVariable errorVariable -CimSession $Cimsession - } - - if ($dtcs -eq $null) - { - if ($errorvariable -ne $null) - { - throw $errorVariable - } - else - { - throw ([string]::Format($Strings.CmdletFailed, "Get-Dtc","MSDTC")) - } - } - $errorVariable = $null - if ($dtcs.GetType().IsArray) - { - $cluster = $true - if ($Cimsession -eq $null) - { - $defaultDtc = Get-DtcClusterDefault -ErrorVariable errorVariable - } - else - { - $defaultDtcResource = Get-DtcClusterDefault -ErrorVariable errorVariable -CimSession $Cimsession - } - - foreach ($dtc in $dtcs) - { - if ([string]::Compare($dtc.DtcName, $defaultDtcResource, $true) -eq 0) - { - $defaultDtc = $dtc.VirtualServerName - } - } - - } - elseif ([string]::Compare($dtcs.DtcName, "Local", $true) -ne 0) - { - $cluster = $true - #there is only one dtc instance and it is clustered - $defaultDtc = $dtc.VirtualServerName - } - else - { - - if ($Cimsession -eq $null) - { - $defaultDtc = Get-DtcDefault -ErrorVariable errorVariable - } - else - { - $defaultDtc = Get-DtcDefault -ErrorVariable errorVariable -CimSession $Cimsession - } - - } - - if ($defaultDtc -eq $null) - { - if ($errorvariable -ne $null) - { - throw $errorVariable - } - else - { - if ($cluster -eq $true) - { - throw ([string]::Format($Strings.CmdletFailed, "Get-DtcClusterDefault", "MSDTC")) - } - else - { - throw ([string]::Format($Strings.CmdletFailed, "Get-DtcDefault", "MSDTC")) - } - } - } - else - { - if ([string]::Compare($defaultDtc, $ComputerName, $true) -ne 0) - { - if ($cluster -eq $true) - { - throw ([string]::Format($Strings.InvalidDefaultCluster, $ComputerName)) - } - else - { - throw ([string]::Format($Strings.InvalidDefault, $ComputerName)) - } - } - } -} - -function DoPingTest -{ - param( - $ToComputerName = $null, - $FromComputerName = $null - ) - - $filter = "Address='$ToComputerName'" - $pingingResult = Get-WmiObject -Class Win32_PingStatus -Filter $filter -ComputerName $FromComputerName - - if ($pingingResult.StatusCode -eq 0) - { - Write-Verbose ([string]::Format($Strings.PingingSucceeded, $ToComputerName, $FromComputerName)) - return $true; - } - else - { - Write-Warning ([string]::Format($Strings.PingingFailed, $ToComputerName, $FromComputerName)) - return $false; - } -} - -function IsVersionSupported -{ - param( - $ComputerName = $null - ) - - $minSupportedVersion = New-Object -TypeName System.Version -ArgumentList "6.2" - $errorVariable = $null - $operatngSystem = Get-WmiObject -ComputerName $ComputerName -Class WIn32_OperatingSystem -ErrorVariable errorVariable - if ($operatngSystem -eq $null) - { - if ($errorVariable -ne $null) - { - throw $errorVariable - } - else - { - throw ([string]::Format($Strings.OSQueryFailed, $ComputerName)) - } - } - else - { - $version = New-Object -TypeName System.Version -ArgumentList $operatngSystem.Version - Write-Verbose ([string]::Format($Strings.OSVersion, $ComputerName, $version)) - if ($version -ge $minSupportedVersion) - { - return $true; - } - else - { - return $false; - } - } -} - -function TestLocalComputer -{ - param( - $ComputerName = $null - ) - PROCESS - { - $errorVariable = $null - $firewallOK = CheckFirewallRules $null - $dtc = FindDtc $ComputerName $null - $networkSetting = Get-DtcNetworkSetting -DtcName $dtc.DtcName -ErrorVariable errorVariable - if ($networkSetting -eq $null) - { - if ($errorVariable -ne $null) - { - throw $errorVariable - } - else - { - throw ([string]::Format($Strings.CmdletFailed, "Get-DtcNetworkSetting", "MSDTC")) - } - } - $networkOk = CheckDtcSecurity $networkSetting $ComputerName - return $networkOk -and $firewallOK - } -} - -function TestRemoteComputer -{ - param( - $ComputerName = $null, - $CimSession = $null - ) - PROCESS - { - if ((IsVersionSupported $ComputerName) -eq $false) - { - throw ([string]::Format($Strings.VersionNotSupported, "6.2")) - } - - $firewallOK = CheckFirewallRules $ComputerName - $dtc = FindDtc $ComputerName $CimSession - $networkSetting = Get-DtcNetworkSetting -DtcName $dtc.DtcName -CimSession $CimSession -ErrorVariable errorVariable - if ($networkSetting -eq $null) - { - if ($errorVariable -ne $null) - { - throw $errorVariable - } - else - { - throw ([string]::Format($Strings.CmdletFailed, "Get-DtcNetworkSetting", "MSDTC")) - } - } - - $networkOk = CheckDtcSecurity $networkSetting $ComputerName - return $networkOk -and $firewallOK - - } -} - -function TestTransactionsPropagation -{ - param( - $LocalComputerName = $null, - $RemoteComputerName = $null, - $ResourceManagerPort = $null - ) - - $rm = $null; - $pssession = $null; - try - { - $errorVariable - $rm = Start-DtcDiagnosticResourceManager -Port $ResourceManagerPort -ErrorVariable errorVariable - if ($rm -eq $null) - { - if ($errorVariable -ne $null) - { - throw $errorVariable - } - else - { - throw ([string]::Format($Strings.StartResourceManagerFailed)) - } - } - - Write-Verbose $Strings.ResourceManagerStarted - - $pssession = New-PSSession -ComputerName $RemoteComputerName - Write-Verbose ([string]::Format($Strings.PSSessionCreated, $RemoteComputerName)) - - - Invoke-Command -Session $pssession -ScriptBlock {Import-Module msdtc} -ErrorVariable errorVariable - if ($errorVariable -ne $null) - { - throw $errorVariable - } - - $errorVariable = $null - $tx = Invoke-Command -Session $pssession -ScriptBlock {Receive-DtcDiagnosticTransaction -ComputerName $args[0] -Port $args[1] -PropagationMethod Pull} -args $LocalComputerName,$ResourceManagerPort -ErrorVariable errorVariable - - if ($tx -eq $null) - { - if ($errorVariable -ne $null) - { - throw $errorVariable - } - else - { - throw ([string]::Format($Strings.TransactionPropagationFailed, $LocalComputerName, $RemoteComputerName, "PULL")) - } - } - - Write-Verbose ([string]::Format($Strings.TransactionPropagated, $LocalComputerName, $RemoteComputerName, "PULL")) - - $tx = $null - $tx=Invoke-Command -Session $pssession -ScriptBlock {Receive-DtcDiagnosticTransaction -ComputerName $args[0] -Port $args[1] -PropagationMethod Push} -args $LocalComputerName,$ResourceManagerPort -ErrorVariable errorVariable - if ($tx -eq $null) - { - if ($errorVariable -ne $null) - { - throw $errorVariable - } - else - { - throw ([string]::Format($Strings.TransactionPropagationFailed, $LocalComputerName, $RemoteComputerName, "PUSH")) - } - } - - Write-Verbose ([string]::Format($Strings.TransactionPropagated, $LocalComputerName, $RemoteComputerName, "PUSH")) - } - finally - { - if ($rm -ne $null) - { - Write-Verbose $Strings.TestRMVerboseLog - foreach ( $verbose in $rm.Verbose) - { - Write-Verbose $verbose - } - - if ($rm.Warning -ne $null) - { - Write-Warning $Strings.TestRMWarningLog - foreach ( $warning in $rm.Warning) - { - Write-Warning $warning - } - } - Stop-DtcDiagnosticResourceManager -Job $rm - } - - if ($pssession -ne $null) - { - Remove-PSSession $pssession - } - } -} - -# .Link -# http://go.microsoft.com/fwlink/?LinkID=253754 -# .ExternalHelp TestDtc.psm1-help.xml -function Test-Dtc { - [CmdletBinding( - SupportsShouldProcess=$true, - ConfirmImpact="Low" - )] - [cmdletbinding(PositionalBinding=$false)] - - param( - [ValidateNotNullOrEmpty()] - [string] - $LocalComputerName = $null, - - [ValidateNotNullOrEmpty()] - [string] - $RemoteComputerName = $null, - - [ValidateNotNullOrEmpty()] - [int] - [ValidateRange(0, 65535)] - $ResourceManagerPort = $null - ) - BEGIN { - } - PROCESS { - Import-LocalizedData -bindingVariable Strings -ErrorAction SilentlyContinue - - if ([string]::IsNullOrEmpty($LocalComputerName)) - { - if ([string]::IsNullOrEmpty($RemoteComputerName)) - { - throw $Strings.InvalidParameters - } - else - { - if (IsLocalComputer $RemoteComputerName) - { - throw ([string]::Format($Strings.NotARemoteComputer, $RemoteComputerName)) - } - - $errorvariabe = $null - $cimSession = New-CimSession -ComputerName $RemoteComputerName - if ($cimSession -eq $null) - { - throw ([string]::Format($Strings.FailedToCreateCimSession, $ComputerName)) - } - try - { - $remoteTest = TestRemoteComputer $RemoteComputerName $cimSession - } - finally - { - Remove-CimSession -CimSession $cimSession - } - } - } - else - { - if ([string]::IsNullOrEmpty($RemoteComputerName)) - { - if (IsLocalComputer $LocalComputerName) - { - $localTest = TestLocalComputer $LocalComputerName - } - else - { - throw ([string]::Format($Strings.InvalidLocalComputer, $LocalComputerName)) - } - } - else - { - if ((IsLocalComputer $LocalComputerName) -eq $false) - { - throw ([string]::Format($Strings.InvalidLocalComputer, $LocalComputerName)) - } - - $DefaultResourceManagerPort = 3002 - $remoteComputerTestable = $false - $localToRemotePinging = $false - $remoteToLocalPinging = $false - $localComputerTestable = $false - $port = $DefaultResourceManagerPort - - $localComputerTestable = TestLocalComputer $LocalComputerName - - if (IsLocalComputer $RemoteComputerName) - { - throw ([string]::Format($Strings.NotARemoteComputer, $RemoteComputerName)) - } - - $errorvariabe = $null - $cimSession = New-CimSession -ComputerName $RemoteComputerName - if ($cimSession -eq $null) - { - throw ([string]::Format($Strings.FailedToCreateCimSession, $RemoteComputerName)) - } - - try - { - $remoteComputerTestable = TestRemoteComputer $RemoteComputerName $cimSession - - $localToRemotePinging = DoPingTest $LocalComputerName $RemoteComputerName - $remoteToLocalPinging = DoPingTest $RemoteComputerName $LocalComputerName - $localDtc = FindDtc $LocalComputerName $null - $remoteDtc = FindDtc $RemoteComputerName $cimSession - CompareCids $localDtc $remoteDtc - - if (($localComputerTestable -and $remoteComputerTestable -and $localToRemotePinging -and $remoteToLocalPinging) -eq $false) - { - throw $Strings.NeedDtcSecurityFix - } - - $diagnosticTestPrompt = ([string]::Format($Strings.DiagnosticTestPrompt, $LocalComputerName, $RemoteComputerName)) - $portDescription = $null - if ($ResourceManagerPort -eq $null) - { - $portDescription = ([string]::Format($Strings.DefaultPortDescription, $port)) - } - else - { - $port = $ResourceManagerPort - $portDescription = ([string]::Format($Strings.PortDescription, $port)) - } - - $firewallRequest = ([string]::Format($Strings.FirewallRequest, $port)) - $completePrompt = ([string]::Format("{0} {1} {2}", $diagnosticTestPrompt, $portDescription, $firewallRequest)) - - if ($pscmdlet.ShouldProcess($completePrompt, $Strings.QueryText, $completePrompt)) - { - CheckIfDefaultDtcConfigured $LocalComputerName $null - CheckIfDefaultDtcConfigured $RemoteComputerName $cimSession - TestTransactionsPropagation $LocalComputerName $RemoteComputerName $port - } - - - } - finally - { - Remove-CimSession -CimSession $cimSession - } - - } - } - } - END { - } -} \ No newline at end of file diff --git a/newton-cn/bin/Modules/MsDtc/ko-KR/TestDtc.psd1 b/newton-cn/bin/Modules/MsDtc/ko-KR/TestDtc.psd1 deleted file mode 100644 index a6bc527..0000000 Binary files a/newton-cn/bin/Modules/MsDtc/ko-KR/TestDtc.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/MsDtc/ko/Microsoft.Dtc.PowerShell.Resources.dll b/newton-cn/bin/Modules/MsDtc/ko/Microsoft.Dtc.PowerShell.Resources.dll deleted file mode 100644 index 26e5061..0000000 Binary files a/newton-cn/bin/Modules/MsDtc/ko/Microsoft.Dtc.PowerShell.Resources.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapter.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapter.Format.ps1xml deleted file mode 100644 index 9b080da..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapter.Format.ps1xml +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - Default - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter - - - - - - 25 - - - - 39 - - - - 7 - Left - - - - 12 - - - - 17 - - - - 14 - - - - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterName $_.Name 25 - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterInstanceID $_.InterfaceDescription 39 - - - - InterfaceIndex - Right - - - Status - - - MacAddress - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-LinkSpeed $_.TransmitLinkSpeed - - Right - - - - - - - - MSFT_NetAdapter_Listview - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter - - - - - - - - Name - - - - InterfaceDescription - - - - InterfaceIndex - - - - MacAddress - - - - MediaType - - - - PhysicalMediaType - - - - ifOperStatus - - - - AdminStatus - - - - - $_.TransmitLinkSpeed -lt 1000000000 - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - $val = $_.TransmitLinkSpeed / 1000000 - Format-LinkSpeed $val 1 $false - - - - - $_.TransmitLinkSpeed -ge 1000000000 - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - $val = $_.TransmitLinkSpeed / 1000000000 - Format-LinkSpeed $val 1 $false - - - - - MediaConnectionState - - - - ConnectorPresent - - - - $_.VlanID -ne $null - - VlanID - - - - DriverInformation - - - - - - - - Names - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter - - - - - - 25 - - - - 35 - - - - 7 - - - - 15 - - - - 33 - - - - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterName $_.Name 25 - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterInstanceID $_.InterfaceDescription 35 - - - - ifIndex - {0,7} - - - NetLuid - 0x{0:X} - - - DeviceID - - - - - - - - Driver - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter - - - - - - 25 - - - - 40 - - - - 15 - - - - 10 - - - - 13 - - - - 11 - - - - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterName $_.Name 25 - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterInstanceID $_.InterfaceDescription 40 - - - - DriverFileName - - - DriverDate - - - DriverVersion - - - NdisVersion - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapter.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapter.cmdletDefinition.cdxml deleted file mode 100644 index 3847758..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapter.cmdletDefinition.cdxml +++ /dev/null @@ -1,258 +0,0 @@ - - - - 1.0 - NetAdapter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterAdvancedProperty.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterAdvancedProperty.Format.ps1xml deleted file mode 100644 index 6992ff3..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterAdvancedProperty.Format.ps1xml +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - MSFT_NetAsapterAdvProperty_TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterAdvancedPropertySettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterAdvancedPropertySettingData - - - - - - 25 - - - - 30 - - - - 30 - - - - 15 - - - - 15 - - - - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterName $_.Name 25 - - - - - if ($_.DisplayName -ne $null) - { - $out = $_.DisplayName - } - else - { - $out = "--" - } - $out - - - - - - if ($_.DisplayValue -ne $null) - { - $out = $_.DisplayValue - } - else - { - $out = "--" - } - $out - - - - RegistryKeyword - - - - if (($_.RegistryValue) -and ($_.RegistryValue.length -ge 1)) - { - if ($_.RegistryValue.length -eq 1) - { - $out = "{$($_.RegistryValue[0])}" - } - else - { - $out = "{'"+($_.RegistryValue -join "', '")+"'}" - } - } - else - { - $out = "{--}" - } - $out; - - - - - - - - - Advanced - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterAdvancedPropertySettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterAdvancedPropertySettingData - - - - - - 25 - - - - 25 - - - - 20 - - - - 26 - - - - 20 - - - - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterName $_.Name 25 - - - - DisplayName - - - DisplayValue - - - - $out = if ($_.DisplayParameterType -eq 5) - { - $_.ValidDisplayValues - } - if (($_.DisplayParameterType -eq 1) -or - ($_.DisplayParameterType -eq 2) -or - ($_.DisplayParameterType -eq 3) -or - ($_.DisplayParameterType -eq 4)) - { - "Min $($_.NumericParameterMinValue), Max $($_.NumericParameterMaxValue), " - "Step $($_.NumericParameterStepValue)" - - } - if ($_.DisplayParameterType -eq 6) - { - "" - } - $out - - - - DefaultDisplayValue - - - - - - - - MSFT_NetAsapterAdvProperty_ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterAdvancedPropertySettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterAdvancedPropertySettingData - - - - - - - - Name - - - - InterfaceDescription - - - - DisplayName - - - - DisplayValue - - - - DefaultDisplayValue - - - - ValidDisplayValues - - - - RegistryKeyword - - - - RegistryValue - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterAdvancedProperty.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterAdvancedProperty.cmdletDefinition.cdxml deleted file mode 100644 index c8b64d8..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterAdvancedProperty.cmdletDefinition.cdxml +++ /dev/null @@ -1,287 +0,0 @@ - - - - 1.0 - NetAdapterAdvancedProperty - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterBinding.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterBinding.Format.ps1xml deleted file mode 100644 index 6795664..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterBinding.Format.ps1xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - MSFT_NetAsapterBinding_TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterBindingSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterBindingSettingData - - - - - - 30 - - - - 50 - - - - 20 - - - - 12 - - - - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterName $_.Name 25 - - - - DisplayName - - - ComponentID - - - - $out="" - $out = if($_.Enabled -eq $true) {"True"} else {"False"} - $out - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterBinding.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterBinding.cmdletDefinition.cdxml deleted file mode 100644 index c898d58..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterBinding.cmdletDefinition.cdxml +++ /dev/null @@ -1,197 +0,0 @@ - - - - 1.0 - NetAdapterBinding - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterChecksumOffload.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterChecksumOffload.Format.ps1xml deleted file mode 100644 index 3e383f5..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterChecksumOffload.Format.ps1xml +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - MSFT_NetAsapterChecksumOffload_TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterChecksumOffloadSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterChecksumOffloadSettingData - - - - - 30 - - - 15 - - - 15 - - - 15 - - - 15 - - - 15 - - - - - - - Name - - - IpIPv4Enabled - - - TcpIPv4Enabled - - - TcpIPv6Enabled - - - UdpIPv4Enabled - - - UdpIPv6Enabled - - - - - - - - MSFT_NetAsapterChecksumOffload_ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterChecksumOffloadSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterChecksumOffloadSettingData - - - - - - - Name - - - InterfaceDescription - - - IpIPv4Enabled - - - TcpIPv4Enabled - - - TcpIPv6Enabled - - - UdpIPv4Enabled - - - UdpIPv6Enabled - - - - $_.ChecksumOffloadHardwareCapabilities.IPv4TransmitIpOptionsSupported - - - - $_.ChecksumOffloadHardwareCapabilities.IPv4TransmitTcpOptionsSupported - - - - $_.ChecksumOffloadHardwareCapabilities.IPv4TransmitTcpChecksumSupported - - - - $_.ChecksumOffloadHardwareCapabilities.IPv4TransmitUdpChecksumSupported - - - - $_.ChecksumOffloadHardwareCapabilities.IPv4TransmitIpChecksumSupported - - - - $_.ChecksumOffloadHardwareCapabilities.IPv4ReceiveIpOptionsSupported - - - - $_.ChecksumOffloadHardwareCapabilities.IPv4ReceiveTcpOptionsSupported - - - - $_.ChecksumOffloadHardwareCapabilities.IPv4ReceiveTcpChecksumSupported - - - - $_.ChecksumOffloadHardwareCapabilities.IPv4ReceiveUdpChecksumSupported - - - - $_.ChecksumOffloadHardwareCapabilities.IPv4ReceiveIpChecksumSupported - - - - $_.ChecksumOffloadHardwareCapabilities.IPv6TransmitIpExtensionHeadersSupported - - - - $_.ChecksumOffloadHardwareCapabilities.IPv6TransmitTcpOptionsSupported - - - - $_.ChecksumOffloadHardwareCapabilities.IPv6TransmitTcpChecksumSupported - - - - $_.ChecksumOffloadHardwareCapabilities.IPv6TransmitUdpChecksumSupported - - - - $_.ChecksumOffloadHardwareCapabilities.IPv6ReceiveIpExtensionHeadersSupported - - - - $_.ChecksumOffloadHardwareCapabilities.IPv6ReceiveTcpOptionsSupported - - - - $_.ChecksumOffloadHardwareCapabilities.IPv6ReceiveTcpChecksumSupported - - - - $_.ChecksumOffloadHardwareCapabilities.IPv6ReceiveUdpChecksumSupported - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterChecksumOffload.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterChecksumOffload.cdxml deleted file mode 100644 index 5598506..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterChecksumOffload.cdxml +++ /dev/null @@ -1,258 +0,0 @@ - - - - 1.0 - NetAdapterChecksumOffload - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterEncapsulatedPacketTaskOffload.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterEncapsulatedPacketTaskOffload.Format.ps1xml deleted file mode 100644 index 3a96ad8..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterEncapsulatedPacketTaskOffload.Format.ps1xml +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - MSFT_NetAsapterEncapsulatedPacketTaskOffload_TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData - - - - - 30 - - - - 20 - - - - 20 - - - - - - - Name - - - NvgreEncapsulatedPacketTaskOffloadEnabled - - - VxlanEncapsulatedPacketTaskOffloadEnabled - - - - - - - - MSFT_NetAsapterEncapsulatedPacketTaskOffload_ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData - - - - - - - Name - - - InterfaceDescription - - - - NvgreEncapsulatedPacketTaskOffloadEnabled - - - - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesNvgre.TransmitChecksumOffloadSupported - - - - - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesNvgre.ReceiveChecksumOffloadSupported - - - - - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesNvgre.LsoV2Supported - - - - - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesNvgre.RssSupported - - - - - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesNvgre.VmqSupported - - - - - VxlanEncapsulatedPacketTaskOffloadEnabled - - - - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesVxlan.TransmitChecksumOffloadSupported - - - - - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesVxlan.ReceiveChecksumOffloadSupported - - - - - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesVxlan.LsoV2Supported - - - - - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesVxlan.RssSupported - - - - - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesVxlan.VmqSupported - - - - - - [System.Boolean]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesVxlan.IsVxlanUDPPortConfigurable - - - - - - [System.UInt16]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesVxlan.VxlanUDPPortNumber - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterEncapsulatedPacketTaskOffload.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterEncapsulatedPacketTaskOffload.cdxml deleted file mode 100644 index 172f358..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterEncapsulatedPacketTaskOffload.cdxml +++ /dev/null @@ -1,180 +0,0 @@ - - - - 1.0 - NetAdapterEncapsulatedPacketTaskOffload - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterHardwareInfo.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterHardwareInfo.Format.ps1xml deleted file mode 100644 index 406127e..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterHardwareInfo.Format.ps1xml +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - MSFT_NetAsapterHardwareInfo_TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterHardwareInfoSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterHardwareInfoSettingData - - - - - - 30 - - - - 7 - Left - - - - 3 - Left - - - - 6 - Left - - - - 8 - Left - - - - 4 - Left - - - - 8 - Left - - - - 13 - Left - - - - 13 - Left - - - - 7 - - - - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterName $_.Name 30 - - - - SegmentNumber - Right - - - BusNumber - Right - - - DeviceNumber - Right - - - FunctionNumber - Right - - - SlotNumber - Right - - - NumaNode - Right - - - PcieLinkSpeed - Right - - - PciExpressCurrentLinkWidth - Right - - - Version - - - - - - - - MSFT_NetAsapterHardwareInfo_ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterHardwareInfoSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterHardwareInfoSettingData - - - - - - - - Name - - - - InterfaceDescription - - - - DeviceType - - - - SegmentNumber - - - - BusNumber - - - - DeviceNumber - - - - FunctionNumber - - - - SlotNumber - - - - NumaNode - - - - PciCurrentSpeedAndMode - - - - PcieLinkSpeed - - - - PciExpressCurrentLinkWidth - - - - PcieMaxLinkSpeed - - - - PciExpressMaxLinkWidth - - - - Version - - - - LineBasedInterruptSupported - - - - MsiInterruptSupported - - - - MsiXInterruptSupported - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterHardwareInfo.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterHardwareInfo.cmdletDefinition.cdxml deleted file mode 100644 index f6c02c6..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterHardwareInfo.cmdletDefinition.cdxml +++ /dev/null @@ -1,30 +0,0 @@ - - - - 1.0 - NetAdapterHardwareInfo - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterIPsecOffload.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterIPsecOffload.Format.ps1xml deleted file mode 100644 index df0e930..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterIPsecOffload.Format.ps1xml +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - MSFT_NetAdapterIPsecOffload_TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterIPsecOffloadV2SettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterIPsecOffloadV2SettingData - - - - - 30 - - - 15 - - - 25 - - - - - - - Name - - - Enabled - - - SaOffloadCapacityEnabled - - - - - - - - MSFT_NetAdapterIPsecOffload_ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterIPsecOffloadV2SettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterIPsecOffloadV2SettingData - - - - - - - Name - - - InterfaceDescription - - - Source - - - AhEnabled - - - AhEspCombinedEnabled - - - AhEspCombinedSupported - - - AhSupported - - - AuthenticationAlgorithmsEnabled - - - AuthenticationAlgorithmsSupported - - - Enabled - - - EncryptionAlgorithmsEnabled - - - EncryptionAlgorithmsSupported - - - EspEnabled - - - EspSupported - - - IPv4OptionsEnabled - - - IPv4OptionsSupported - - - IPv6Enabled - - - IPv6NonIPsecExtensionHeadersEnabled - - - IPv6NonIPsecExtensionHeadersSupported - - - IPv6Supported - - - LsoEnabled - - - LsoSupported - - - SaOffloadCapacityEnabled - - - SaOffloadCapacitySupported - - - TransportEnabled - - - TransportSupported - - - TunnelEnabled - - - TunnelSupported - - - UdpEspEnabled - - - UdpEspSupported - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterIPsecOffload.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterIPsecOffload.cdxml deleted file mode 100644 index 49cea8b..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterIPsecOffload.cdxml +++ /dev/null @@ -1,196 +0,0 @@ - - - - 1.0 - NetAdapterIPsecOffload - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterLso.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterLso.Format.ps1xml deleted file mode 100644 index ff2af1c..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterLso.Format.ps1xml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - MSFT_NetAsapterLso_TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterLsoSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterLsoSettingData - - - - - 30 - - - - 15 - - - 14 - - - 12 - - - 12 - - - - - - - Name - - - - $out="" - if ($_.MaximumLsoVersionSupported -ge 2) {$out+="LSO Version 2"} else { if ($_.MaximumLsoVersionSupported -eq 1) {$out+="LSO Version 1"} else {$out+="None"} } - $out - - - - V1IPv4Enabled - - - IPv4Enabled - - - IPv6Enabled - - - - - - - - MSFT_NetAsapterLso_ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterLsoSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterLsoSettingData - - - - - - - Name - - - InterfaceDescription - - - - - $out="" - if ($_.MaximumLsoVersionSupported -ge 2) {$out+="LSO Version 2"} else { if ($_.MaximumLsoVersionSupported -eq 1) {$out+="LSO Version 1"} else {$out+="None"} } - $out - - - - V1IPv4Enabled - - - IPv4Enabled - - - IPv6Enabled - - - - $_.LargeSendOffloadV1HardwareCapabilities.IPv4MaxOffloadSizeSupported - - - - $_.LargeSendOffloadV1HardwareCapabilities.IPv4MinSegmentCountSupported - - - - $_.LargeSendOffloadV1HardwareCapabilities.IPv4TcpOptionsSupported - - - - $_.LargeSendOffloadV1HardwareCapabilities.IPv4IpOptionsSupported - - - - $_.LargeSendOffloadV2HardwareCapabilities.IPv4MaxOffloadSizeSupported - - - - $_.LargeSendOffloadV2HardwareCapabilities.IPv4MinSegmentCountSupported - - - - $_.LargeSendOffloadV2HardwareCapabilities.IPv6MaxOffLoadSizeSupported - - - - $_.LargeSendOffloadV2HardwareCapabilities.IPv6MinSegmentCountSupported - - - - $_.LargeSendOffloadV2HardwareCapabilities.IPv6IpExtensionHeadersSupported - - - - $_.LargeSendOffloadV2HardwareCapabilities.IPv6TcpOptionsSupported - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterLso.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterLso.cdxml deleted file mode 100644 index 9011f42..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterLso.cdxml +++ /dev/null @@ -1,191 +0,0 @@ - - - - 1.0 - NetAdapterLso - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterPacketDirect.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterPacketDirect.Format.ps1xml deleted file mode 100644 index 21037f8..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterPacketDirect.Format.ps1xml +++ /dev/null @@ -1,188 +0,0 @@ - - - - - - - MSFT_NetAdapterPacketDirectSettingData_TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT\StandardCimv2\MSFT_NetAdapterPacketDirectSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPacketDirectSettingData - - - - - - 12 - - - - 20 - - - - 8 - - - - 12 - - - - 10 - - - - 15 - - - - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterName $_.Name 12 - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterInstanceID $_.InterfaceDescription 20 - - - - Enabled - - - Operational - - - DomainId - - - - [Convert]::ToString($_.DiagnosticCode, 16) - - - - - - - - - - MSFT_NetAdapterPacketDirectSettingData_ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPacketDirectSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPacketDirectSettingData - - - - - - - Name - - - Enabled - - - Operational - - - DomainId - - - - - [Convert]::ToString($_.DiagnosticCode, 16) - - - - - - ($_.Capabilities|fl|out-string).Trim() - - - - - - - - - - MSFT_NetAdapter_PacketDirectCapabilities - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter_PacketDirectCapabilities - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter_PacketDirectCapabilities - - - - - - - DrainNotificationSupported - - - ModerationByIntervalSupported - - - ModerationByCountSupported - - - MinimumModerationInterval - - - MaximumModerationInterval - - - ModerationIntervalGranularity - - - MaximumTxPartialBufferCount - - - MaximumRxPartialBufferCount - - - MaximumNumberOfRxQueues - - - MaximumNumberOfTxQueues - - - MaximumNumberOfRxQueuesForDefaultVPort - - - MaximumNumberOfTxQueuesForDefaultVPort - - - MaximumNumberOfRxQueuesPerNonDefaultVPort - - - MaximumNumberOfTxQueuesPerNonDefaultVPort - - - MaximumRxQueueSize - - - MaximumTxQueueSize - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterPacketDirect.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterPacketDirect.cdxml deleted file mode 100644 index 6cee482..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterPacketDirect.cdxml +++ /dev/null @@ -1,161 +0,0 @@ - - - - 1.0 - NetAdapterPacketDirect - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterPowerManagement.Format.Helper.psm1 b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterPowerManagement.Format.Helper.psm1 deleted file mode 100644 index 1d281ce..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterPowerManagement.Format.Helper.psm1 +++ /dev/null @@ -1,166 +0,0 @@ -<# - -Copyright (c) 2011 Microsoft Corporation. All Rights Reserved. - -Module Name: - - MSFT_NetAdapterPowerManagement.Format.Helper.psm1 - -Description: - - Provides helper routines for formatting the output of - NetAdapterPowerManagement CmdLets. - -#> - -function Format-NdisConfigurationValue() - -<# - -Function Description: - - Converts an enumerated configuration value into human readable text. - -Arguments: - - $ConfigurationValue - Supplies the configuration value to format. - -Return Value: - - Returns a string corresponding to the integer configuration value. - -#> - -{ - param ($ConfigurationValue) - - switch ($ConfigurationValue) - { - 0 { $temp = "Unsupported" } - 1 { $temp = "Disabled" } - 2 { $temp = "Enabled" } - 3 { $temp = "Inactive" } - default { $temp = "Invalid ($($ConfigurationValue))" } - } - - return $temp -} - -function Format-WakePatternType() - -<# - -Function Description: - - Converts a wake pattern type into a friendly name. - -Arguments: - - $WakePatternType - Supplies an NDIS_PM_WOL_PACKET enumeration value. - -Return Value: - - Returns a friendly string representation of the wake pattern type. - -#> - -{ - param ($WakePatternType) - - switch ($WakePatternType) - { - 1 { $temp = "Bitmap Pattern" } - 2 { $temp = "Magic Packet" } - 3 { $temp = "IPv4 TCP SYN" } - 4 { $temp = "IPv6 TCP SYN" } - 5 { $temp = "EAPOL Request Id Message" } - 6 { $temp = "Wildcard" } - 7 { $temp = "WFD Invitation Request" } - default { $temp = "Invalid ($($ConfigurationValue))" } - } - - return $temp -} - -function Format-BitmapWakePattern() - -<# - -Function Description: - - Converts a Pattern and Mask array to a string. - -Arguments: - - $Pattern - Supplies an array of bytes defining a pattern match. - - $Mask - Supplies an array of bytes masking the pattern. The nth bit of the - $Mask array indicates whether the nth byte in the Pattern should be - matched (1) or ignored (0). - -Return Value: - - Returns a string containing the bytes of the pattern match. Bytes that are - ignored are represented by "--". - -#> - -{ - param( - [byte[]] ${Pattern}, - [byte[]] ${Mask} - ) - - $Width = 16 - $out = "" - - $PatternLength = $Pattern.Length - $Bit = 1 - $MaskIndex = 0 - for ($i = 0; $i -lt $PatternLength; $i++) - { - # - # Print offset at the beginning of each line - # - - if (($i % $Width) -eq 0) - { - $out += "{0:x2} : " -f $i - } - - # - # Check whether the pattern byte is masked - # - - if ($Mask[$MaskIndex] -band $Bit) - { - $out += "{0:x2} " -f $Pattern[$i] - } - else - { - $out += "-- " -f $Pattern[$i] - } - - # - # Newline if this is the last element on the line. - # - - if (($i % $Width) -eq ($Width - 1)) - { - $out += "`n" - } - - # - # Walk through the mask bits. - # - - $Bit = $Bit * 2 - if ($Bit -gt 128) - { - $MaskIndex++ - $Bit = 1 - } - } - - $out -} diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterPowerManagement.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterPowerManagement.Format.ps1xml deleted file mode 100644 index bd6f3c7..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterPowerManagement.Format.ps1xml +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - - - NetAdapterPowerManagement ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagementSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagementSettingData - - - - - - - InterfaceDescription - - - Name - - - ArpOffload - - - NSOffload - - - RsnRekeyOffload - - - D0PacketCoalescing - - - SelectiveSuspend - - - DeviceSleepOnDisconnect - - - WakeOnMagicPacket - - - WakeOnPattern - - - - - - - - NetAdapterPowerManagement_WakePattern Default ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagement_WakePattern - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagement_WakePattern - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagement_WakePattern_MagicPacket - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagement_WakePattern_MagicPacket - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagement_WakePattern_EapolRequestId - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagement_WakePattern_EapolRequestId - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagement_WakePattern_WildCard - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagement_WakePattern_WildCard - - - - - - - - - Import-Module NetAdapter\MSFT_NetAdapterPowerManagement.Format.Helper.psm1 - Format-WakePatternType $_.WakePacketType - - - - ID - - - - - "{0:x8}" -f ($_.Priority) - - - - FriendlyName - - - - - - - - NetAdapterPowerManagement_WakePattern_TcpSyn ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagement_WakePattern_TcpSyn - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagement_WakePattern_TcpSyn - - - - - - - - - Import-Module NetAdapter\MSFT_NetAdapterPowerManagement.Format.Helper.psm1 - Format-WakePatternType $_.WakePacketType - - - - ID - - - - - "{0:x8}" -f ($_.Priority) - - - - FriendlyName - - - SourceAddress - - - SourcePort - - - DestinationAddress - - - DestinationPort - - - - - - - - NetAdapterPowerManagement_WakePattern_Bitmap ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagement_WakePattern_Bitmap - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagement_WakePattern_Bitmap - - - - - - - - - Import-Module NetAdapter\MSFT_NetAdapterPowerManagement.Format.Helper.psm1 - Format-WakePatternType $_.WakePacketType - - - - ID - - - - - "{0:x8}" -f ($_.Priority) - - - - FriendlyName - - - - - Import-Module NetAdapter\MSFT_NetAdapterPowerManagement.Format.Helper.psm1 - Format-BitmapWakePattern $_.Pattern $_.Mask - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterPowerManagement.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterPowerManagement.cmdletDefinition.cdxml deleted file mode 100644 index 1a99a04..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterPowerManagement.cmdletDefinition.cdxml +++ /dev/null @@ -1,304 +0,0 @@ - - - - 1.0 - NetAdapterPowerManagement - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Enabled - Disabled - - - - - - - - - - Enabled - Disabled - - - - - - - - - - Enabled - Disabled - - - - - - - - - - Enabled - Disabled - - - - - - - - - - Enabled - Disabled - - - - - - - - - - Enabled - Disabled - - - - - - - - - - Enabled - Disabled - - - - - - - - - - Enabled - Disabled - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterQos.Format.Helper.psm1 b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterQos.Format.Helper.psm1 deleted file mode 100644 index 9aefcc2..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterQos.Format.Helper.psm1 +++ /dev/null @@ -1,179 +0,0 @@ -<# - -Copyright (c) 2011 Microsoft Corporation. All Rights Reserved. - -Module Name: - - MSFT_NetAdapterQos.Format.Helper.psm1 - -Description: - - Provides helper routines for formatting the output of NetAdapterQos cmdlets. - -#> - -# -# This function accepts a PRE-SORTED array of integers and returns a formatted -# string that groups these numbers as follows: -# -# In: {0,1,2,4,6,7} -# Out: "0-2, 4, 6-7" -# -function Format-NetAdapterQosIntegerArray( - $array -) -{ - $out = "" - $first = $array[0] - $previous = $array[0] - - for ($i = 1; $i -le $array.count; $i++) - { - $previous++ - - if ($i -eq $array.count -or $array[$i] -ne $previous) - { - if ($out[0]) { $out += "," } - - if ($previous - $first -gt 1) - { - $out += "$($first)-$($previous - 1)" - } - else - { - $out += "$($first)" - } - - if ($i -ne $array.count) - { - $first = $array[$i] - $previous = $array[$i] - } - } - } - - return $out -} - -# -# This function accepts an MSFT_NetAdapter_QosSettings and generates formatted -# output using the information from the PriorityAssignmentTable, -# BandwidthAssignmentTable, and TsaAssignmentTable fields. -# -function Format-NetAdapterQosTrafficClass( - $settings -) -{ - $template = "{0,2} {1,-6} {2,-9} {3}`n" - - $out = "" - $out += $template -f "TC", "TSA", "Bandwidth", "Priorities" - $out += $template -f "--", "---", "---------", "----------" - - $tcprimap = @(@(),@(),@(),@(),@(),@(),@(),@()) - for ($tc = 0; $tc -lt $tcprimap.count; $tc++) - { - $tcprimap[$tc] = @() - } - - for ($pri = 0; $pri -lt $settings.PriorityAssignmentTable.count; $pri++) - { - $tc = $settings.PriorityAssignmentTable[$pri] - $tcprimap[$tc] += @($pri) - } - - $actual_cnt = 0 - - for ($tc = 0; $tc -lt $settings.TsaAssignmentTable.count; $tc++) - { - if ($tcprimap[$tc].count -eq 0) { continue } - - $actual_cnt++ - - $tsa = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterQos.Tsa]$settings.TsaAssignmentTable[$tc] - $temp = Format-NetAdapterQosIntegerArray $tcprimap[$tc] - - $bw_str = "" - if ($tsa -eq [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterQos.Tsa]::ETS) - { - $bw = $settings.BandwidthAssignmentTable[$tc] - $bw_str = "$($bw)%" - } - - $out += $template -f $tc, $tsa, $bw_str, $temp - } - - if ($actual_cnt -eq 0) - { - $out = "" - } - - return $out -} - -# -# This function accepts an MSFT_NetAdapter_QosSettings and generates formatted -# output using the information from the PriorityFlowControlEnableArray field. -# -function Format-NetAdapterQosFlowControl( - $settings -) -{ - $enablecnt = 0 - $enablearray = @() - - for ($pri = 0; $pri -lt $settings.PriorityFlowControlEnableArray.count; $pri++) - { - if ($settings.PriorityFlowControlEnableArray[$pri]) - { - $enablecnt++ - $enablearray += @($pri) - } - } - - if ($enablecnt -eq $settings.PriorityFlowControlEnableArray.count) { $out = "All Priorities Enabled" } - elseif ($enablecnt -eq 0) { $out = "All Priorities Disabled" } - elseif ($enablecnt -eq 1) { $out = "Priority $($enablearray[0]) Enabled" } - else { $out = "Priorities $(Format-NetAdapterQosIntegerArray $enablearray) Enabled" } - - return $out -} - -# -# This function accepts an MSFT_NetAdapter_QosSettings and generates formatted -# output using the information from the ClassificationTable field. -# -function Format-NetAdapterQosClassification( - $settings -) -{ - if ($settings.ClassificationTable.count -eq 0) - { - return "" - } - - $template = "{0,-9} {1,-9} {2}`n" - - $out = "" - $out += $template -f "Protocol", "Port/Type", "Priority" - $out += $template -f "--------", "---------", "--------" - - foreach ($element in $settings.ClassificationTable) - { - switch ($element.ProtocolSelector) - { - 0 { $protocol_str = "Reserved"; $port_str = "" } - 1 { $protocol_str = "Default"; $port_str = "" } - 2 { $protocol_str = "TCP"; $port_str = "$($element.ProtocolSpecificValue)" } - 3 { $protocol_str = "UDP"; $port_str = "$($element.ProtocolSpecificValue)" } - 4 { $protocol_str = "TCP/UDP"; $port_str = "$($element.ProtocolSpecificValue)" } - 5 { $protocol_str = "Ethertype"; $port_str = "0x{0:X0}" -f $element.ProtocolSpecificValue } - 6 { $protocol_str = "NetDirect"; $port_str = "$($element.ProtocolSpecificValue)" } - default { $protocol_str = "($($element.ProtocolSelector))"; $port_str = "0x{0:X0}" -f $element.ProtocolSpecificValue } - } - - $out += $template -f $protocol_str, $port_str, $element.Priority - } - - return $out -} diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterQos.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterQos.Format.ps1xml deleted file mode 100644 index d0cf409..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterQos.Format.ps1xml +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - MSFT_NetAdapterQosSettingData - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterQosSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterQosSettingData - - - - - - - Name - - - Enabled - - - - $_.HardwareCapabilities -and $_.CurrentCapabilities - - Capabilities - - - - $_.OperationalSettings - - OperationalTrafficClasses - - - - $_.OperationalSettings - - OperationalFlowControl - - - - $_.OperationalSettings - - OperationalClassifications - - - - $_.RemoteSettings - - RemoteTrafficClasses - - - - $_.RemoteSettings - - RemoteFlowControl - - - - $_.RemoteSettings - - RemoteClassifications - - - - - - - - - MSFT_NetAdapter_QosSettings - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter_QosSettings - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter_QosSettings - - - - - - - TransmissionSelectionEnabled - - - PriorityAssignmentTable - - - TsaAssignmentTable - - - BandwidthAssignmentTable - - - FlowControlEnabled - - - PriorityFlowControlEnableArray - - - ClassificationEnabled - - - NumberOfClassificationElements - - - ClassificationTable - - - - - - - - - MSFT_NetAdapter_QosClassificationElement - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter_QosClassificationElement - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter_QosClassificationElement - - - - - - - ProtocolSelector - - - ProtocolSpecificValue - - - Priority - - - - - - - - - MSFT_NetAdapter_QosCapabilities - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter_QosCapabilities - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter_QosCapabilities - - - - - - - MacSecBypass - - - DcbxSupport - - - - NumTCs - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterQos.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterQos.cdxml deleted file mode 100644 index 127e61f..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterQos.cdxml +++ /dev/null @@ -1,173 +0,0 @@ - - - - 1.0 - NetAdapterQos - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterRdma.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterRdma.Format.ps1xml deleted file mode 100644 index 3babab4..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterRdma.Format.ps1xml +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - Default - - Microsoft.Management.Infrastructure.CimInstance#ROOT\StandardCimv2\MSFT_NetAdapterRdmaSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRdmaSettingData - - - - - - 25 - - - - 40 - - - - 11 - - - - 10 - - - - 10 - - - - - - - Name - - - InterfaceDescription - - - Enabled - - - PFC - - - ETS - - - - - - - - MSFT_NetAdapterRdma_AdapterInfo_Listview - - Microsoft.Management.Infrastructure.CimInstance#ROOT\StandardCimv2\MSFT_NetAdapter_RdmaAdapterInfo - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter_RdmaAdapterInfo - - - - - - - MajorVersionNumber - - - MinorVersionNumber - - - VendorId - - - DeviceId - - - MaxRegistrationSize - - - MaxWindowSize - - - FRMRPageCount - - - MaxInitiatorRequestSge - - - MaxReceiveRequestSge - - - MaxReadRequestSge - - - MaxTransferLength - - - MaxInlineDataSize - - - MaxInboundReadLimit - - - MaxOutboundReadLimit - - - MaxReceiveQueueDepth - - - MaxInitiatorQueueDepth - - - MaxSharedReceiveQueueDepth - - - MaxCompletionQueueDepth - - - LargeRequestThreshold - - - MaxCallerData - - - MaxCalleeData - - - InOrderDMA - - - SupportsCompletionQueueResize - - - SupportsLoopbackConnections - - - RdmaReadSinkFlagNotRequired - - - SupportsCompletionQueueInterruptModeration - - - SupportsMultiEngine - - - RdmaTechnology - - - - - - - - MSFT_NetAdapterRdma_MissingCounterInfo_Listview - - Microsoft.Management.Infrastructure.CimInstance#ROOT\StandardCimv2\MSFT_NetAdapter_RdmaMissingCounterInfo - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter_RdmaMissingCounterInfo - - - - - - - $_.ConnectPerformanceCounterMissing - ConnectPerformanceCounterMissing - - - $_.AcceptPerformanceCounterMissing - AcceptPerformanceCounterMissing - - - $_.ConnectFailurePerformanceCounterMissing - ConnectFailurePerformanceCounterMissing - - - $_.ConnectionErrorPerformanceCounterMissing - ConnectionErrorPerformanceCounterMissing - - - $_.ActiveConnectionPerformanceCounterMissing - ActiveConnectionPerformanceCounterMissing - - - $_.CompletionQueueErrorPerformanceCounterMissing - CompletionQueueErrorPerformanceCounterMissing - - - $_.RDMAInOctetsPerformanceCounterMissing - RDMAInOctetsPerformanceCounterMissing - - - $_.RDMAOutOctetsPerformanceCounterMissing - RDMAOutOctetsPerformanceCounterMissing - - - $_.RDMAInFramesPerformanceCounterMissing - RDMAInFramesPerformanceCounterMissing - - - $_.RDMAOutFramesPerformanceCounterMissing - RDMAOutFramesPerformanceCounterMissing - - - - - - - - MSFT_NetAdapterRdma_Listview - - Microsoft.Management.Infrastructure.CimInstance#ROOT\StandardCimv2\MSFT_NetAdapterRdmaSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRdmaSettingData - - - - - - - Name - - - InterfaceDescription - - - Enabled - - - MaxQueuePairCount - - - MaxCompletionQueueCount - - - MaxMemoryRegionCount - - - MaxProtectionDomainCount - - - MaxInboundReadLimit - - - MaxOutboundReadLimit - - - MaxMemoryWindowCount - - - MaxSharedReceiveQueueCount - - - PFC - - - ETS - - - - - ($_.RdmaAdapterInfo|fl|out-string).Trim() - - - - - - ($_.RdmaMissingCounterInfo|fl|out-string).Trim() - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterRdma.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterRdma.cdxml deleted file mode 100644 index 77a71df..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterRdma.cdxml +++ /dev/null @@ -1,165 +0,0 @@ - - - - 1.0 - NetAdapterRdma - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterRsc.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterRsc.Format.ps1xml deleted file mode 100644 index 08d09a4..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterRsc.Format.ps1xml +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - MSFT_NetAsapterRsc_TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRscSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRscSettingData - - - - - 30 - - - 12 - - - 12 - - - 15 - - - 15 - - - 17 - - - 17 - - - - - - - Name - - - IPv4Enabled - - - IPv6Enabled - - - IPv4OperationalState - - - IPv6OperationalState - - - IPv4FailureReason - - - IPv6FailureReason - - - - - - - - MSFT_NetAsapterRsc_ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRscSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRscSettingData - - - - - - - Name - - - InterfaceDescription - - - IPv4Enabled - - - IPv6Enabled - - - - $_.RscHardwareCapabilities.IPv4Supported - - - - $_.RscHardwareCapabilities.IPv6Supported - - - IPv4OperationalState - - - IPv6OperationalState - - - IPv4FailureReason - - - IPv6FailureReason - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterRsc.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterRsc.cdxml deleted file mode 100644 index 1d72c71..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterRsc.cdxml +++ /dev/null @@ -1,222 +0,0 @@ - - - - 1.0 - NetAdapterRsc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterRss.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterRss.Format.ps1xml deleted file mode 100644 index 51868c6..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterRss.Format.ps1xml +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - MSFT_NetAsapterRss_ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRssSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRssSettingData - - - - - - - - Name - - - - InterfaceDescription - - - - Enabled - - - - NumberOfReceiveQueues - - - - Profile - - - - - "$($_.BaseProcessorGroup):$($_.BaseProcessorNumber)" - - - - - - "$($_.MaxProcessorGroup):$($_.MaxProcessorNumber)" - - - - - MaxProcessors - - - - - $out="" - for ($i = 0; $i -lt $_.RssProcessorArraySize;) - { - $out+="$($_.RssProcessorArray[$i].ProcessorGroup):$($_.RssProcessorArray[$i].ProcessorNumber)/" - $out+="$($_.RssProcessorArray[$i].PreferenceIndex)" - $i++; - if (($i % 8) -eq 0) {if($i -ne $_.RssProcessorArraySize){$out+="`n"}} else {$out+=" "} - } - $out - - - - - - $out="" - for ($i = 0; $i -lt $_.IndirectionTableEntryCount;) - { - $out+="$($_.IndirectionTable[$i].ProcessorGroup):$($_.IndirectionTable[$i].ProcessorNumber)`t" - $i++; - if ((($i % 8) -eq 0) -and ($i -ne $_.IndirectionTableEntryCount)) {$out+="`n"} - } - $out - - - - - - - - - MSFT_NetAsapterRss_TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRssSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRssSettingData - - - - - - 30 - - - - 7 - - - - 24 - - - - 13 - - - - 12 - - - - 13 - - - - 6 - - - - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterName $_.Name 30 - - - - Enabled - - - Profile - - - - $out = "$($_.BaseProcessorGroup):$($_.BaseProcessorNumber)" - $out - - - - - $out = "$($_.MaxProcessorGroup):$($_.MaxProcessorNumber)" - $out - - - - MaxProcessors - - - NumberOfReceiveQueues - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterRss.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterRss.cmdletDefinition.cdxml deleted file mode 100644 index 12d320b..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterRss.cmdletDefinition.cdxml +++ /dev/null @@ -1,214 +0,0 @@ - - - - 1.0 - NetAdapterRss - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterSriov.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterSriov.Format.ps1xml deleted file mode 100644 index 394aa50..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterSriov.Format.ps1xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - MSFT_NetAdapterSriov_ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterSriovSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterSriovSettingData - - - - - - - - Name - - - - InterfaceDescription - - - - Enabled - - - - SriovSupport - - - - SwitchName - - - - NumVFs - - - - - - - - MSFT_NetAdapterSriov_TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterSriovSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterSriovSettingData - - - - - - 30 - - - - 20 - - - - 20 - - - - 10 - - - - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterName $_.Name 30 - - - - SwitchName - - - SriovSupport - - - NumVFs - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterSriov.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterSriov.cdxml deleted file mode 100644 index ffd637c..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterSriov.cdxml +++ /dev/null @@ -1,168 +0,0 @@ - - - - 1.0 - NetAdapterSriov - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterSriovVf.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterSriovVf.Format.ps1xml deleted file mode 100644 index 71147f3..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterSriovVf.Format.ps1xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - MSFT_NetAsapterVPort_TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterSriovVfSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterSriovVfSettingData - - - - - - 30 - - - - 10 - - - - 7 - - - - 17 - - - - 30 - - - - 20 - - - - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterName $_.Name 30 - - - - FunctionID - - - VPortID - - - - $out="" - if ($_.CurrentMacAddress) - { - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - $out = Format-MacAddress $_.CurrentMacAddress - } - $out - - - - VmID - - - VmFriendlyName - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterSriovVf.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterSriovVf.cmdletDefinition.cdxml deleted file mode 100644 index ebf1285..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterSriovVf.cmdletDefinition.cdxml +++ /dev/null @@ -1,42 +0,0 @@ - - - - 1.0 - NetAdapterSriovVf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterStatistics.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterStatistics.Format.ps1xml deleted file mode 100644 index 97216e2..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterStatistics.Format.ps1xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - MSFT_NetAsapterStatistics_TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterStatisticsSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterStatisticsSettingData - - - - - - 30 - - - - 15 - Right - - - - 22 - Right - - - - 15 - Right - - - - 18 - Right - - - - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterName $_.Name 25 - - - - ReceivedBytes - - - ReceivedUnicastPackets - - - SentBytes - - - SentUnicastPackets - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterStatistics.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterStatistics.cmdletDefinition.cdxml deleted file mode 100644 index ca71d42..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterStatistics.cmdletDefinition.cdxml +++ /dev/null @@ -1,30 +0,0 @@ - - - - 1.0 - NetAdapterStatistics - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterUso.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterUso.Format.ps1xml deleted file mode 100644 index 8515eec..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterUso.Format.ps1xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - MSFT_NetAsapterUso_TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterUsoSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterUsoSettingData - - - - - 30 - - - 12 - - - 12 - - - - - - - Name - - - IPv4Enabled - - - IPv6Enabled - - - - - - - - MSFT_NetAsapterUso_ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterUsoSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterUsoSettingData - - - - - - - Name - - - InterfaceDescription - - - IPv4Enabled - - - IPv6Enabled - - - - $_.UdpSegmentationOffloadHardwareCapabilities.IPv4MaxOffloadSizeSupported - - - - $_.UdpSegmentationOffloadHardwareCapabilities.IPv4MinSegmentCountSupported - - - - $_.UdpSegmentationOffloadHardwareCapabilities.IPv4SubMssFinalSegmentSupported - - - - $_.UdpSegmentationOffloadHardwareCapabilities.IPv6MaxOffLoadSizeSupported - - - - $_.UdpSegmentationOffloadHardwareCapabilities.IPv6MinSegmentCountSupported - - - - $_.UdpSegmentationOffloadHardwareCapabilities.IPv6SubMssFinalSegmentSupported - - - - $_.UdpSegmentationOffloadHardwareCapabilities.IPv6IpExtensionHeadersSupported - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterUso.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterUso.cdxml deleted file mode 100644 index edeaef2..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterUso.cdxml +++ /dev/null @@ -1,184 +0,0 @@ - - - - 1.0 - NetAdapterUso - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterVPort.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterVPort.Format.ps1xml deleted file mode 100644 index f43b091..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterVPort.Format.ps1xml +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - MSFT_NetAsapterVPort_TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVPortSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterVPortSettingData - - - - - - 25 - - - - 6 - - - - 25 - - - - 5 - - - - 10 - - - - 9 - - - - 11 - - - - 9 - - - - 6 - - - - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterName $_.Name 25 - - - - VPortID - - - - $out="" - if ($_.FilterList -and ($_.FilterList.Length -ge 1)) - { - $MacAddress=$_.FilterList[0].MacAddress - if ($MacAddress) - { - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - $out = Format-MacAddress $MacAddress - } - } - $out - - - - - $out="" - if ($_.FilterList -and ($_.FilterList.Length -ge 1)) - { - if ($_.FilterList[0].VlanID -ne $null) - { - $out = "$($_.FilterList[0].VlanID)" - } - } - $out - - - - - $out="" - if($_.ProcessorAffinityMask -ne $null) - { - $affinity = $_.ProcessorAffinityMask - $ProcNumber = 0 - while($affinity -and !($affinity%2)){$affinity=$affinity/2;$ProcNumber++} - $out="$($_.ProcessorGroup):$ProcNumber" - } - $out - - - - - $out = "" - if ($_.FunctionID -ne $null) - { - if($_.FunctionID -eq 65535) - { - $out="PF" - } - else - { - $out=$_.FunctionID - } - } - $out - - - - - $out=switch ($_.VPortState) - { - 0 {"Unknown"} - 1 {"Activated"} - 2 {"DeActivated"} - default {"Unknown"} - } - $out - - - - - $out=switch ($_.InterruptModeration) - { - 0 {"Unknown"} - 1 {"Adaptive"} - 2 {"Off"} - 100 {"Low"} - 200 {"Medium"} - 300 {"High"} - default {"Unknown"} - } - $out - - - - NumQueuePairs - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterVPort.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterVPort.cmdletDefinition.cdxml deleted file mode 100644 index 54fa29a..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterVPort.cmdletDefinition.cdxml +++ /dev/null @@ -1,52 +0,0 @@ - - - - 1.0 - NetAdapterVPort - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterVmq.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterVmq.Format.ps1xml deleted file mode 100644 index c764e33..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterVmq.Format.ps1xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - MSFT_NetAsapterVmq_TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVmqSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterVmqSettingData - - - - - - 30 - - - - 33 - - - - 7 - - - - 16 - - - - 13 - - - - 16 - - - - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterName $_.Name 30 - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterInstanceID $_.InterfaceDescription 33 - - - - Enabled - - - - $out = "$($_.BaseProcessorGroup):$($_.BaseProcessorNumber)" - $out - - - - MaxProcessors - - - NumberOfReceiveQueues - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterVmq.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterVmq.cmdletDefinition.cdxml deleted file mode 100644 index 4ce4f8c..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterVmq.cmdletDefinition.cdxml +++ /dev/null @@ -1,184 +0,0 @@ - - - - 1.0 - NetAdapterVmq - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterVmqQueue.Format.ps1xml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterVmqQueue.Format.ps1xml deleted file mode 100644 index ae4dd67..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterVmqQueue.Format.ps1xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - MSFT_NetAsapterVmqQueue_TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVmqQueueSettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterVmqQueueSettingData - - - - - - 30 - - - - 7 - - - - 17 - - - - 6 - - - - 9 - - - - 38 - - - - - - - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-AdapterName $_.Name 30 - - - - QueueID - - - - $out="" - if ($_.FilterList -and ($_.FilterList.Length -ge 1)) - { - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - $out = Format-MacAddress $_.FilterList[0].MacAddress - } - $out - - - - - $out="" - if ($_.FilterList -and ($_.FilterList.Length -ge 1)) - { - if ($_.FilterList[0].VlanID -ne $null) - { - $out = "$($_.FilterList[0].VlanID)" - } - } - $out - - - - - $out="" - if($_.ProcessorAffinityMask -ne $null) - { - $affinity = $_.ProcessorAffinityMask - $ProcNumber = 0 - while($affinity -and !($affinity%2)){$affinity=$affinity/2;$ProcNumber++} - $out="$($_.ProcessorGroup):$ProcNumber" - } - $out - - - - VmFriendlyName - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterVmqQueue.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterVmqQueue.cmdletDefinition.cdxml deleted file mode 100644 index f7ab043..0000000 --- a/newton-cn/bin/Modules/NetAdapter/MSFT_NetAdapterVmqQueue.cmdletDefinition.cdxml +++ /dev/null @@ -1,36 +0,0 @@ - - - - 1.0 - NetAdapterVmqQueue - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/NetAdapter.Format.Helper.psm1 b/newton-cn/bin/Modules/NetAdapter/NetAdapter.Format.Helper.psm1 deleted file mode 100644 index 92f0dca..0000000 --- a/newton-cn/bin/Modules/NetAdapter/NetAdapter.Format.Helper.psm1 +++ /dev/null @@ -1,137 +0,0 @@ -<# - -Copyright (c) 2011 Microsoft Corporation. All Rights Reserved. - -Module Name: - - NetAdapter.Format.Helper.psm1 - -Description: - - Provides helper routines for formatting the output of - NetAdapter CmdLets. - -#> - -function Format-MacAddress($MacAddress) -<# -Function Description: - This function formats a MAC address - -Arguments: - $MacAddress - -Return Value: - Formatted MAC address -#> -{ - $out = "" - if($MacAddress -ne $null) - { - for($i = 0; $i -lt $MacAddress.Length; ) - { - $out += $MacAddress[$i++]; - if($i -eq $MacAddress.Length) - { - break; - } - $out += $MacAddress[$i++]; - if ($i -lt $MacAddress.Length) - { - $out += '-'; - } - } - } - return $out -} - -function Format-AdapterName($Name, $Width) -<# -Function Description: - This function formats a network adapter name (ifAlias) - by fitting the name in specified column width. - If the name contains a number at the end, this function - makes sure that the number is preserved. - -Arguments: - $Name - $Width - -Return Value: - Formatted name -#> -{ - $out = $Name - if ($Name.length -gt $width) - { - $idpresent = $Name -match "(\d+$)" - if ($idpresent -and ($width -gt ($matches[0].length+3))) - { - $base = $Name.substring(0, $width - ($matches[0].length+3)) - $out=$base+"..."+$matches[0] - } - } - - return $out -} - -function Format-AdapterInstanceID($InstanceID, $Width) -<# -Function Description: - This function formats a network adapter InstanceID (ifDeesc) - by fitting the InstanceID in specified column width. - If the InstanceID contains a number at the end, this function - makes sure that the number is preserved. - -Arguments: - $InstanceID - $Width - -Return Value: - Formatted InstanceID -#> -{ - $out = $InstanceID - if ($InstanceID.length -gt $width) - { - $idpresent = $InstanceID -match "(#\d+$)" - if ($idpresent -and ($width -gt ($matches[0].length+3))) - { - $base = $InstanceID.substring(0, $width - ($matches[0].length+3)) - $out=$base+"..."+$matches[0] - } - } - return $out -} - -function Format-LinkSpeed([Decimal]$LinkSpeed, $Precision = 1, $AutoFormat = $true) -<# -Function Description: - This function returns the link speed of a network adapter - -Arguments: - $LinkSpeed - LinkSpeed - $Precision - Precision to use when rounding - $AutoFormat - Automatically format the number and display units after - -Return Value: - Formatted link speed -#> -{ - if ($LinkSpeed -eq $null) { - return "Unknown" - } - - if ($AutoFormat -eq $true) { - $Postfixes = @("", "K", "M", "G", "T") - for ($i = 0; $LinkSpeed -ge 1000 -and $i -lt $Postfixes.Length - 1; $i++) { - $LinkSpeed /= 1000 - } - $ps = " " + $Postfixes[$i] + "bps" - } else { - $ps = $null - } - - $LinkSpeed = [Math]::Round([Decimal]$LinkSpeed, $Precision) - return "$LinkSpeed" + $ps -} diff --git a/newton-cn/bin/Modules/NetAdapter/NetAdapter.Types.ps1xml b/newton-cn/bin/Modules/NetAdapter/NetAdapter.Types.ps1xml deleted file mode 100644 index 150feb6..0000000 --- a/newton-cn/bin/Modules/NetAdapter/NetAdapter.Types.ps1xml +++ /dev/null @@ -1,1267 +0,0 @@ - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter - - - MacAddress - - $out = "" - if (($this.NetworkAddresses -ne $null) -and - ($this.NetworkAddresses.length -ge 1)) - { - $MacAddress = $this.NetworkAddresses[0]; - } - if($MacAddress -ne $null) - { - for($i = 0; $i -lt $MacAddress.Length; ) - { - $out += $MacAddress[$i++]; - if($i -eq $MacAddress.Length) - { - break; - } - $out += $MacAddress[$i++]; - if ($i -lt $MacAddress.Length) - { - $out += '-'; - } - } - } - $out - - - param($newValue) - $MacAddress = $newValue -replace '(:|-)' - $this.NetworkAddresses = $MacAddress - - - - Status - - $NetAdapter = $this; - $out = switch ($NetAdapter.InterfaceOperationalStatus) - { - 1 {"Up"} - 3 {"Testing"} - 4 {"Unknown"} - 5 {"Dormant"} - 6 {"Not Present"} - 7 {"Lower Layer Down"} - } - if ($NetAdapter.InterfaceOperationalStatus -eq 2) - { - if ($NetAdapter.InterfaceAdminStatus -eq 2) - { - $out = "Disabled" - } - else - { - $first = $true; - if ($NetAdapter.OperationalStatusDownDefaultPortNotAuthenticated) - { - $out = "Not Authenticated" - $first = $false; - } - if ($NetAdapter.OperationalStatusDownMediaDisconnected) - { - if (-not $first) {$out += ", "} - $out += "Disconnected" - $first = $false; - } - - if ($NetAdapter.OperationalStatusDownLowPowerState) - { - if (-not $first) {$out += ", "} - $out += "Low Power State" - $first = $false; - } - } - } - $out - - - - LinkSpeed - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-LinkSpeed $this.TransmitLinkSpeed - - - - MediaType - - $out = switch ($this.NdisMedium) - { - 0 {"802.3"} - 3 {"WAN"} - 9 {"Wireless WAN"} - 12 {"Connection Oriented WAN"} - 15 {"Tunnel"} - 16 {"Native 802.11"} - 17 {"Loopback"} - 18 {"WiMAX"} - 19 {"IP"} - default {"Unknown"} - } - $out - - - - PhysicalMediaType - - $out = switch ($this.NdisPhysicalMedium) - { - 0 {"Unspecified"} - 1 {"Wireless LAN"} - 2 {"Cable Modem"} - 8 {"Wireless WAN"} - 9 {"Native 802.11"} - 10 {"BlueTooth"} - 11 {"Infiniband"} - 12 {"WiMAX"} - 13 {"UWB"} - 14 {"802.3"} - 16 {"IRDA"} - 17 {"Wired WAN"} - 18 {"Wired Connection Oriented WAN"} - 19 {"Other"} - default {"Unknown"} - } - $out - - - - AdminStatus - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapter.NET_IF_ADMIN_STATUS][System.UInt32]$this.InterfaceAdminStatus - - - - MediaConnectionState - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapter.NET_IF_MEDIA_CONNECT_STATE][System.UInt32]$this.MediaConnectState - - - - DriverInformation - - $out="Driver Date $($this.DriverDate) Version $($this.DriverVersionString)" - if ($this.DriverMajorNdisVersion -ne $null) - { - $out +=" NDIS $($this.DriverMajorNdisVersion).$($this.DriverMinorNdisVersion)" - } - $out - - - - DriverFileName - - (Split-Path $this.DriverName -Leaf) - - - - NdisVersion - - $out = if ($this.DriverMajorNdisVersion) - { - "$($this.DriverMajorNdisVersion).$($this.DriverMinorNdisVersion)" - } - else - { - $out = "Unknown" - } - $out - - - - ifOperStatus - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapter.IF_OPER_STATUS][System.UInt32]$this.InterfaceOperationalStatus - - - - ifAlias - Name - - - InterfaceAlias - Name - - - ifIndex - InterfaceIndex - - - ifDesc - InterfaceDescription - - - ifName - InterfaceName - - - DriverVersion - DriverVersionString - - - LinkLayerAddress - MacAddress - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterHardwareInfoSettingData - - - SriovSupport - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterSriov.SriovSupport]($this.PSBase.CimInstanceProperties['SriovSupport'].Value) - - - - PcieLinkSpeed - - $out = switch ($this.PciExpressCurrentLinkSpeedEncoded) - { - 1 {"2.5 GT/s"} - 2 {"5.0 GT/s"} - 3 {"8.0 GT/s"} - default {"Unknown"} - } - $out - - - - PcieMaxLinkSpeed - - $out = switch ($this.PciExpressMaxLinkSpeedEncoded) - { - 1 {"2.5 GT/s"} - 2 {"5.0 GT/s"} - 3 {"8.0 GT/s"} - default {"Unknown"} - } - $out - - - - Version - - $out= switch ($this.PciExpressVersion) - { - 1 {"1.0"} - 2 {"1.1"} - } - $out - - - - DeviceType - - $out= switch ($this.PciDeviceType) - { - 0 {"Conventional PCI"} - 1 {"PCI-X"} - 2 {"PCI Express endpoint"} - 3 {"PCI Express legacy endpoint"} - 4 {"PCI Express Root Complex integrated endpoint"} - 5 {"PCI Express treated as PCI"} - default {"Unknown"} - } - $out - - - - CurrentSpeedAndMode - - $out = if ($this.PciDeviceType -eq 0) - { - switch ($this.PciCurrentSpeedAndMode) - { - 0 {"Conventional PCI 33MHz"} - 1 {"Conventional PCI 66MHz"} - default {"Unknown"} - } - } - else - { - if ($this.PciDeviceType -eq 1) - { - switch ($this.PciXCurrentSpeedAndMode) - { - 0 {"PCI-X Mode conventional PCI"} - 1 {"PCI-X Mode1 66MHz"} - 2 {"PCI-X Mode1 100MHz"} - 3 {"PCI-X Mode1 133MHz"} - 5 {"PCI-X Mode1 ECC 66MHz"} - 6 {"PCI-X Mode1 ECC 100MHz"} - 7 {"PCI-X Mode1 ECC 133MHz"} - 9 {"PCI-X Mode2 266 66MHz"} - 10 {"PCI-X Mode2 266 100MHz"} - 11 {"PCI-X Mode2 266 133MHz"} - 13 {"PCI-X Mode2 533 66MHz"} - 14 {"PCI-X Mode2 533 100MHz"} - 15 {"PCI-X Mode2 533 133MHz"} - default {"Unknown"} - } - - } - else - { - "NA" - } - } - $out - - - - ifAlias - Name - - - InterfaceAlias - Name - - - ifDesc - InterfaceDescription - - - Segment - SegmentNumber - - - Bus - BusNumber - - - Device - DeviceNumber - - - Function - FunctionNumber - - - Slot - SlotNumber - - - PcieLinkWidth - PciExpressCurrentLinkWidth - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterAdvancedPropertySettingData - - - ValueName - RegistryKeyword - - - ValueData - RegistryValue - - - ifAlias - Name - - - InterfaceAlias - Name - - - ifDesc - InterfaceDescription - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterBindingSettingData - - - ifAlias - Name - - - InterfaceAlias - Name - - - ifDesc - InterfaceDescription - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRssSettingData - - - Profile - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRss.Profile]($this.PSBase.CimInstanceProperties['Profile'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Profile'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRss.Profile]$newValue - - - - ifAlias - Name - - - InterfaceAlias - Name - - - ifDesc - InterfaceDescription - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVmqSettingData - - - ifAlias - Name - - - InterfaceAlias - Name - - - ifDesc - InterfaceDescription - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVmqQueueSettingData - - - ifAlias - Name - - - InterfaceAlias - Name - - - ifDesc - InterfaceDescription - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterSriovSettingData - - - SriovSupport - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterSriov.SriovSupport]($this.PSBase.CimInstanceProperties['SriovSupport'].Value) - - - - ifAlias - Name - - - InterfaceAlias - Name - - - ifDesc - InterfaceDescription - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterSriovVfSettingData - - - ifAlias - Name - - - InterfaceAlias - Name - - - ifDesc - InterfaceDescription - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVPortSettingData - - - ifAlias - Name - - - InterfaceAlias - Name - - - ifDesc - InterfaceDescription - - - QPairs - NumQueuePairs - - - ITR - InterruptModeration - - - FID - FunctionID - - - ProcMask - ProcessorAffinityMask - - - State - VPortState - - - ID - VPortID - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterStatisticsSettingData - - - ifAlias - Name - - - InterfaceAlias - Name - - - ifDesc - InterfaceDescription - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterLsoSettingData - - - ifAlias - Name - - - InterfaceAlias - Name - - - ifDesc - InterfaceDescription - - - Version - MaximumLsoVersionSupported - - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterChecksumOffloadSettingData - - - IpIPv4Enabled - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]($this.PSBase.CimInstanceProperties['IpIPv4Enabled'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['IpIPv4Enabled'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]$newValue - - - - TcpIPv4Enabled - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]($this.PSBase.CimInstanceProperties['TcpIPv4Enabled'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['TcpIPv4Enabled'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]$newValue - - - - TcpIPv6Enabled - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]($this.PSBase.CimInstanceProperties['TcpIPv6Enabled'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['TcpIPv6Enabled'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]$newValue - - - - UdpIPv4Enabled - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]($this.PSBase.CimInstanceProperties['UdpIPv4Enabled'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['UdpIPv4Enabled'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]$newValue - - - - UdpIPv6Enabled - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]($this.PSBase.CimInstanceProperties['UdpIPv6Enabled'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['UdpIPv6Enabled'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]$newValue - - - - ifAlias - Name - - - InterfaceAlias - Name - - - ifDesc - InterfaceDescription - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterQosSettingData - - - Name - - [System.String]($this.PSBase.CimInstanceProperties['Name'].Value) - - - - Enabled - - [System.Boolean]($this.PSBase.CimInstanceProperties['Enabled'].Value) - - - - Capabilities - - $hwCaps = $this.PSBase.CimInstanceProperties['HardwareCapabilities'].Value - $curCaps = $this.PSBase.CimInstanceProperties['CurrentCapabilities'].Value - - $template = "{0,-21} {1,-12} {2,-12}`n" - $out = "" - $out += $template -f "", "Hardware", "Current" - $out += $template -f "", "--------", "-------" - - $template = "{0,-19} : {1,-12} {2,-12}`n" - $out += $template -f "MacSecBypass", $hwCaps.MacSecBypass, $curCaps.MacSecBypass - $out += $template -f "DcbxSupport", $hwCaps.DcbxSupport, $curCaps.DcbxSupport - $out += $template -f "NumTCs(Max/ETS/PFC)", $hwCaps.NumTCs, $curCaps.NumTCs - $out - - - - HardwareCapabilities - - $this.PSBase.CimInstanceProperties['HardwareCapabilities'].Value - - - - CurrentCapabilities - - $this.PSBase.CimInstanceProperties['CurrentCapabilities'].Value - - - - OperationalTrafficClasses - - import-module netadapter\msft_netadapterqos.format.helper.psm1 - - $settings = $this.PSBase.CimInstanceProperties['OperationalSettings'].Value - $out = "" - - if ($settings -and $settings.TransmissionSelectionEnabled) { - $out = Format-NetAdapterQosTrafficClass $settings - } - - if (!$out[0]) { - $out = "Not Available" - } - - $out - - - - OperationalFlowControl - - import-module netadapter\msft_netadapterqos.format.helper.psm1 - - $settings = $this.PSBase.CimInstanceProperties['OperationalSettings'].Value - $out = "" - - if ($settings -and $settings.FlowControlEnabled) { - $out = Format-NetAdapterQosFlowControl $settings - } - - if (!$out[0]) { - $out = "Not Available" - } - - $out - - - - OperationalClassifications - - import-module netadapter\msft_netadapterqos.format.helper.psm1 - - $settings = $this.PSBase.CimInstanceProperties['OperationalSettings'].Value - $out = "" - - if ($settings -and $settings.ClassificationEnabled) { - $out = Format-NetAdapterQosClassification $settings - } - - if (!$out[0]) { - $out = "Not Available" - } - - $out - - - - RemoteTrafficClasses - - import-module netadapter\msft_netadapterqos.format.helper.psm1 - - $settings = $this.PSBase.CimInstanceProperties['RemoteSettings'].Value - $out = "" - - if ($settings -and $settings.TransmissionSelectionEnabled) { - $out = Format-NetAdapterQosTrafficClass $settings - } - - if (!$out[0]) { - $out = "Not Available" - } - - $out - - - - RemoteFlowControl - - import-module netadapter\msft_netadapterqos.format.helper.psm1 - - $settings = $this.PSBase.CimInstanceProperties['RemoteSettings'].Value - $out = "" - - if ($settings -and $settings.FlowControlEnabled) { - $out = Format-NetAdapterQosFlowControl $settings - } - - if (!$out[0]) { - $out = "Not Available" - } - - $out - - - - RemoteClassifications - - import-module netadapter\msft_netadapterqos.format.helper.psm1 - - $settings = $this.PSBase.CimInstanceProperties['RemoteSettings'].Value - $out = "" - - if ($settings -and $settings.ClassificationEnabled) { - $out = Format-NetAdapterQosClassification $settings - } - - if (!$out[0]) { - $out = "Not Available" - } - - $out - - - - OperationalSettings - - $this.PSBase.CimInstanceProperties['OperationalSettings'].Value - - - - RemoteSettings - - $this.PSBase.CimInstanceProperties['RemoteSettings'].Value - - - - AdminStatus - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterQos.AdminStatus]($this.PSBase.CimInstanceProperties['AdminStatus'].Value) - - - - ifAlias - Name - - - InterfaceAlias - Name - - - ifDesc - InterfaceDescription - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter_QosCapabilities - - - MacSecBypassSupported - - [System.Boolean]($this.PSBase.CimInstanceProperties['MacSecBypassSupported'].Value) - - - - MacSecBypass - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterQos.Supported][System.UInt32]($this.PSBase.CimInstanceProperties['MacSecBypassSupported'].Value) - - - - CeeDcbxSupported - - [System.Boolean]($this.PSBase.CimInstanceProperties['CeeDcbxSupported'].Value) - - - - IeeeDcbxSupported - - [System.Boolean]($this.PSBase.CimInstanceProperties['IeeeDcbxSupported'].Value) - - - - DcbxSupport - - $Flags = 0 - if ($this.PSBase.CimInstanceProperties['CeeDcbxSupported'].Value -ne 0) { - $Flags += 1 - } - if ($this.PSBase.CimInstanceProperties['IeeeDcbxSupported'].Value -ne 0) { - $Flags += 2 - } - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterQos.DcbxSupport]$Flags - - - - NumberOfTrafficClasses - - [System.Byte]($this.PSBase.CimInstanceProperties['NumberOfTrafficClasses'].Value) - - - - NumberOfEtsCapableTrafficClasses - - [System.Byte]($this.PSBase.CimInstanceProperties['NumberOfEtsCapableTrafficClasses'].Value) - - - - NumberOfPfcEnabledTrafficClasses - - [System.Byte]($this.PSBase.CimInstanceProperties['NumberOfPfcEnabledTrafficClasses'].Value) - - - - NumTCs - - $tcMax = $this.PSBase.CimInstanceProperties['NumberOfTrafficClasses'].Value - $tcEts = $this.PSBase.CimInstanceProperties['NumberOfEtsCapableTrafficClasses'].Value - $tcPfc = $this.PSBase.CimInstanceProperties['NumberOfPfcEnabledTrafficClasses'].Value - "$($tcMax)/$($tcEts)/$($tcPfc)" - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter_QosSettings - - - TransmissionSelectionEnabled - - [System.Boolean]($this.PSBase.CimInstanceProperties['TransmissionSelectionEnabled'].Value) - - - - PriorityAssignmentTable - - $this.PSBase.CimInstanceProperties['PriorityAssignmentTable'].Value - - - - TsaAssignmentTable - - $this.PSBase.CimInstanceProperties['TsaAssignmentTable'].Value - - - - BandwidthAssignmentTable - - $this.PSBase.CimInstanceProperties['BandwidthAssignmentTable'].Value - - - - FlowControlEnabled - - [System.Boolean]($this.PSBase.CimInstanceProperties['FlowControlEnabled'].Value) - - - - PriorityFlowControlEnableArray - - $this.PSBase.CimInstanceProperties['PriorityFlowControlEnableArray'].Value - - - - ClassificationEnabled - - [System.Boolean]($this.PSBase.CimInstanceProperties['ClassificationEnabled'].Value) - - - - NumberOfClassificationElements - - [System.UInt32]($this.PSBase.CimInstanceProperties['NumberOfClassificationElements'].Value) - - - - ClassificationTable - - $this.PSBase.CimInstanceProperties['ClassificationTable'].Value - - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagementSettingData - - - - AllowComputerToTurnOffDevice - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]($this.PSBase.CimInstanceProperties['AllowComputerToTurnOffDevice'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['AllowComputerToTurnOffDevice'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]$newValue - - - - - D0PacketCoalescing - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]($this.PSBase.CimInstanceProperties['D0PacketCoalescing'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['D0PacketCoalescing'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]$newValue - - - - - DeviceSleepOnDisconnect - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]($this.PSBase.CimInstanceProperties['DeviceSleepOnDisconnect'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['DeviceSleepOnDisconnect'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]$newValue - - - - - ArpOffload - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]($this.PSBase.CimInstanceProperties['ArpOffload'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['ArpOffload'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]$newValue - - - - - NSOffload - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]($this.PSBase.CimInstanceProperties['NSOffload'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['NSOffload'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]$newValue - - - - - RsnRekeyOffload - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]($this.PSBase.CimInstanceProperties['RsnRekeyOffload'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['RsnRekeyOffload'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]$newValue - - - - - SelectiveSuspend - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]($this.PSBase.CimInstanceProperties['SelectiveSuspend'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['SelectiveSuspend'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]$newValue - - - - - WakeOnMagicPacket - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]($this.PSBase.CimInstanceProperties['WakeOnMagicPacket'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['WakeOnMagicPacket'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]$newValue - - - - - WakeOnPattern - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]($this.PSBase.CimInstanceProperties['WakeOnPattern'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['WakeOnPattern'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]$newValue - - - - - ifAlias - Name - - - - InterfaceAlias - Name - - - - ifDesc - InterfaceDescription - - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRscSettingData - - - IPv4FailureReason - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRsc.FailureReason]($this.PSBase.CimInstanceProperties['IPv4FailureReason'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['IPv4FailureReason'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRsc.FailureReason]$newValue - - - - IPv6FailureReason - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRsc.FailureReason]($this.PSBase.CimInstanceProperties['IPv6FailureReason'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['IPv6FailureReason'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRsc.FailureReason]$newValue - - - - ifAlias - Name - - - InterfaceAlias - Name - - - ifDesc - InterfaceDescription - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterIPsecOffloadV2SettingData - - - AuthenticationAlgorithmsEnabled - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterIPsecOffloadV2.AuthenticationAlgos]($this.PSBase.CimInstanceProperties['AuthenticationAlgorithmsEnabled'].Value) - - - - AuthenticationAlgorithmsSupported - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterIPsecOffloadV2.AuthenticationAlgos]($this.PSBase.CimInstanceProperties['AuthenticationAlgorithmsSupported'].Value) - - - - EncryptionAlgorithmsEnabled - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterIPsecOffloadV2.EncryptionAlgos]($this.PSBase.CimInstanceProperties['EncryptionAlgorithmsEnabled'].Value) - - - - EncryptionAlgorithmsSupported - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterIPsecOffloadV2.EncryptionAlgos]($this.PSBase.CimInstanceProperties['EncryptionAlgorithmsSupported'].Value) - - - - ifAlias - Name - - - InterfaceAlias - Name - - - ifDesc - InterfaceDescription - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRdmaSettingData - - - ifAlias - Name - - - InterfaceAlias - Name - - - ifDesc - InterfaceDescription - - - PFC - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRdma.QosConfiguration]($this.PSBase.CimInstanceProperties['PFC'].Value) - - - - ETS - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRdma.QosConfiguration]($this.PSBase.CimInstanceProperties['ETS'].Value) - - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter_RdmaAdapterInfo - - - RdmaTechnology - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRdma.Technology]($this.PSBase.CimInstanceProperties['RdmaTechnology'].Value) - - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData - - - ifAlias - Name - - - InterfaceAlias - Name - - - ifDesc - InterfaceDescription - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterUsoSettingData - - - ifAlias - Name - - - InterfaceAlias - Name - - - ifDesc - InterfaceDescription - - - - - diff --git a/newton-cn/bin/Modules/NetAdapter/NetAdapter.psd1 b/newton-cn/bin/Modules/NetAdapter/NetAdapter.psd1 deleted file mode 100644 index 34b545f..0000000 --- a/newton-cn/bin/Modules/NetAdapter/NetAdapter.psd1 +++ /dev/null @@ -1,153 +0,0 @@ -<#++ - -Copyright (c) 2011 Microsoft Corporation - -Module Name: - - NetAdapter.psd1 - -Abstract: - - This module is the container module definition for the MSFT_NetAdapter* CIM - object CmdLets. - ---#> - -@{ - GUID = '1042b422-63a8-4016-a6d6-293e19e8f8a6' - Author = "Microsoft Corporation" - CompanyName = "Microsoft Corporation" - Copyright = "© Microsoft Corporation. All rights reserved." - HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=390794" - ModuleVersion = "2.0.0.0" - PowerShellVersion = '5.1' - NestedModules = @( - 'MSFT_NetAdapter.cmdletDefinition.cdxml', - 'MSFT_NetAdapterAdvancedProperty.cmdletDefinition.cdxml', - 'MSFT_NetAdapterBinding.cmdletDefinition.cdxml', - 'MSFT_NetAdapterChecksumOffload.cdxml', - 'MSFT_NetAdapterEncapsulatedPacketTaskOffload.cdxml', - 'MSFT_NetAdapterHardwareInfo.cmdletDefinition.cdxml', - 'MSFT_NetAdapterIPsecOffload.cdxml', - 'MSFT_NetAdapterLso.cdxml', - 'MSFT_NetAdapterPowerManagement.cmdletDefinition.cdxml', - 'MSFT_NetAdapterQos.cdxml', - 'MSFT_NetAdapterRdma.cdxml', - 'MSFT_NetAdapterRsc.cdxml', - 'MSFT_NetAdapterRss.cmdletDefinition.cdxml', - 'MSFT_NetAdapterSriov.cdxml', - 'MSFT_NetAdapterSriovVf.cmdletDefinition.cdxml', - 'MSFT_NetAdapterStatistics.cmdletDefinition.cdxml', - 'MSFT_NetAdapterVmq.cmdletDefinition.cdxml', - 'MSFT_NetAdapterVmqQueue.cmdletDefinition.cdxml', - 'MSFT_NetAdapterVPort.cmdletDefinition.cdxml', - 'MSFT_NetAdapterPacketDirect.cdxml', - 'MSFT_NetAdapterUso.cdxml' - ) - - TypesToProcess = @('NetAdapter.Types.ps1xml') - - FormatsToProcess = @( - 'MSFT_NetAdapter.Format.ps1xml', - 'MSFT_NetAdapterAdvancedProperty.Format.ps1xml', - 'MSFT_NetAdapterBinding.Format.ps1xml', - 'MSFT_NetAdapterChecksumOffload.Format.ps1xml', - 'MSFT_NetAdapterEncapsulatedPacketTaskOffload.Format.ps1xml', - 'MSFT_NetAdapterHardwareInfo.Format.ps1xml', - 'MSFT_NetAdapterIPsecOffload.Format.ps1xml', - 'MSFT_NetAdapterLso.Format.ps1xml', - 'MSFT_NetAdapterPowerManagement.Format.ps1xml', - 'MSFT_NetAdapterQos.Format.ps1xml', - 'MSFT_NetAdapterRdma.Format.ps1xml', - 'MSFT_NetAdapterRsc.Format.ps1xml', - 'MSFT_NetAdapterRss.Format.ps1xml', - 'MSFT_NetAdapterSriov.Format.ps1xml', - 'MSFT_NetAdapterSriovVf.Format.ps1xml', - 'MSFT_NetAdapterStatistics.Format.ps1xml', - 'MSFT_NetAdapterVmq.Format.ps1xml', - 'MSFT_NetAdapterVmqQueue.Format.ps1xml', - 'MSFT_NetAdapterVPort.Format.ps1xml', - 'MSFT_NetAdapterPacketDirect.Format.ps1xml', - 'MSFT_NetAdapterUso.Format.ps1xml' - ) - - FunctionsToExport = @( - 'Disable-NetAdapter', - 'Disable-NetAdapterBinding', - 'Disable-NetAdapterChecksumOffload', - 'Disable-NetAdapterEncapsulatedPacketTaskOffload', - 'Disable-NetAdapterIPsecOffload', - 'Disable-NetAdapterLso', - 'Disable-NetAdapterPowerManagement', - 'Disable-NetAdapterQos', - 'Disable-NetAdapterRdma', - 'Disable-NetAdapterRsc', - 'Disable-NetAdapterRss', - 'Disable-NetAdapterSriov', - 'Disable-NetAdapterVmq', - 'Disable-NetAdapterPacketDirect', - 'Disable-NetAdapterUso', - 'Enable-NetAdapter', - 'Enable-NetAdapterBinding', - 'Enable-NetAdapterChecksumOffload', - 'Enable-NetAdapterEncapsulatedPacketTaskOffload', - 'Enable-NetAdapterIPsecOffload', - 'Enable-NetAdapterLso', - 'Enable-NetAdapterPowerManagement', - 'Enable-NetAdapterQos', - 'Enable-NetAdapterRdma', - 'Enable-NetAdapterRsc', - 'Enable-NetAdapterRss', - 'Enable-NetAdapterSriov', - 'Enable-NetAdapterVmq', - 'Enable-NetAdapterPacketDirect', - 'Enable-NetAdapterUso', - 'Get-NetAdapter', - 'Get-NetAdapterAdvancedProperty', - 'Get-NetAdapterBinding', - 'Get-NetAdapterChecksumOffload', - 'Get-NetAdapterEncapsulatedPacketTaskOffload', - 'Get-NetAdapterHardwareInfo', - 'Get-NetAdapterIPsecOffload', - 'Get-NetAdapterLso', - 'Get-NetAdapterPowerManagement', - 'Get-NetAdapterQos', - 'Get-NetAdapterRdma', - 'Get-NetAdapterRsc', - 'Get-NetAdapterRss', - 'Get-NetAdapterSriov', - 'Get-NetAdapterSriovVf', - 'Get-NetAdapterStatistics', - 'Get-NetAdapterVmq', - 'Get-NetAdapterVMQQueue', - 'Get-NetAdapterVPort', - 'Get-NetAdapterPacketDirect', - 'Get-NetAdapterUso', - 'New-NetAdapterAdvancedProperty', - 'Remove-NetAdapterAdvancedProperty', - 'Rename-NetAdapter', - 'Reset-NetAdapterAdvancedProperty', - 'Restart-NetAdapter', - 'Set-NetAdapter', - 'Set-NetAdapterAdvancedProperty', - 'Set-NetAdapterBinding', - 'Set-NetAdapterChecksumOffload', - 'Set-NetAdapterEncapsulatedPacketTaskOffload', - 'Set-NetAdapterIPsecOffload', - 'Set-NetAdapterLso', - 'Set-NetAdapterPowerManagement', - 'Set-NetAdapterQos', - 'Set-NetAdapterRdma', - 'Set-NetAdapterRsc', - 'Set-NetAdapterRss', - 'Set-NetAdapterSriov', - 'Set-NetAdapterVmq', - 'Set-NetAdapterPacketDirect', - 'Set-NetAdapterUso' - ) - - CmdletsToExport = @() - - AliasesToExport = @() - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/NetConnection/MSFT_NetConnectionProfile.cdxml b/newton-cn/bin/Modules/NetConnection/MSFT_NetConnectionProfile.cdxml deleted file mode 100644 index 2ed6921..0000000 --- a/newton-cn/bin/Modules/NetConnection/MSFT_NetConnectionProfile.cdxml +++ /dev/null @@ -1,129 +0,0 @@ - - - - - 1.0 - NetConnectionProfile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetConnection/MSFT_NetConnectionProfile.format.ps1xml b/newton-cn/bin/Modules/NetConnection/MSFT_NetConnectionProfile.format.ps1xml deleted file mode 100644 index df752b1..0000000 --- a/newton-cn/bin/Modules/NetConnection/MSFT_NetConnectionProfile.format.ps1xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - MSFT_NetConnectionProfile - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetConnectionProfile - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetConnectionProfile - - - - - - - Name - - - InterfaceAlias - - - InterfaceIndex - - - NetworkCategory - - - IPv4Connectivity - - - IPv6Connectivity - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetConnection/MSFT_NetConnectionProfile.types.ps1xml b/newton-cn/bin/Modules/NetConnection/MSFT_NetConnectionProfile.types.ps1xml deleted file mode 100644 index 2102fea..0000000 --- a/newton-cn/bin/Modules/NetConnection/MSFT_NetConnectionProfile.types.ps1xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetConnectionProfile - - - NetworkCategory - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetConnectionProfile.NetworkCategory]($this.PSBase.CimInstanceProperties['NetworkCategory'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['NetworkCategory'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetConnectionProfile.NetworkCategory]$newValue - - - - IPv4Connectivity - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetConnectionProfile.IPv4Connectivity]($this.PSBase.CimInstanceProperties['IPv4Connectivity'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['IPv4Connectivity'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetConnectionProfile.IPv4Connectivity]$newValue - - - - IPv6Connectivity - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetConnectionProfile.IPv6Connectivity]($this.PSBase.CimInstanceProperties['IPv6Connectivity'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['IPv6Connectivity'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetConnectionProfile.IPv6Connectivity]$newValue - - - - - diff --git a/newton-cn/bin/Modules/NetConnection/NetConnection.psd1 b/newton-cn/bin/Modules/NetConnection/NetConnection.psd1 deleted file mode 100644 index a8ebec4..0000000 --- a/newton-cn/bin/Modules/NetConnection/NetConnection.psd1 +++ /dev/null @@ -1,15 +0,0 @@ - -@{ - ModuleVersion = '1.0.0.0' - NestedModules = @("MSFT_NetConnectionProfile.cdxml") - FormatsToProcess = @("MSFT_NetConnectionProfile.format.ps1xml") - TypesToProcess = @("MSFT_NetConnectionProfile.types.ps1xml") - HelpInfoUri = "http://go.microsoft.com/fwlink/?linkid=390795" - GUID = '{CE4FF86E-9416-4f2d-A869-C860AC543B5E}' - Author = 'Microsoft Corporation' - CompanyName = 'Microsoft Corporation' - PowerShellVersion = '5.1' - Copyright = '© Microsoft Corporation. All rights reserved.' - FunctionsToExport = @("Get-NetConnectionProfile", "Set-NetConnectionProfile") - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/NetDiagnostics/Get-NetView.psm1 b/newton-cn/bin/Modules/NetDiagnostics/Get-NetView.psm1 deleted file mode 100644 index 95b4a58..0000000 --- a/newton-cn/bin/Modules/NetDiagnostics/Get-NetView.psm1 +++ /dev/null @@ -1,2500 +0,0 @@ -<# -.SYNOPSIS - Collects data on system and network configuration for diagnosing Microsoft Networking. -.DESCRIPTION - Collects comprehensive configuration data to aid in troubleshooting Microsoft Network issues. - Data is collected from the following sources: - - Get-NetView metadata (path, args, etc.) - - Environment (OS, hardware, etc.) - - Physical, virtual, Container, NICs - - Virtual Machine configuration - - Virtual Switches, Bridges, NATs - - Device Drivers - - Performance Counters - - Logs, Traces, etc. - - The data is collected in a folder on the Desktop (by default), which is zipped - on completion. Send only the .zip file to Microsoft. - - The output is most easily viewed with Visual Studio Code or similar editor with a navigation panel. - - This module is a stable snapshot that's updated with each Windows feature update. - The latest changes can be found on GitHub at https://github.com/Microsoft/SDN/ -.PARAMETER OutputDirectory - Optional path to the directory where the output should be saved. Can be either a relative or an absolute path. - If unspecified, the current user's Desktop will be used by default. -.PARAMETER ExtraCommands - List of additional commands to run, formatted as Strings. Output is saved to the CustomModule directory. You can - use {0} as a placeholder for the CustomModule directory location, and it will be formatted in. This allows you to - copy or save additional files to the final output. - For example, 'echo "Hello, World!" > {0}\MyFile.txt' will save to \CustomModule\MyFile.txt -.PARAMETER SkipAdminCheck - If this switch is present, then the check for administrator privileges will be skipped. - Note that less data may be collected and the results may be of limited use. -.EXAMPLE - Get-NetView -OutputDirectory ".\" - Runs Get-NetView and outputs to the current working directory. -.EXAMPLE - Get-NetView -SkipAdminCheck - Runs Get-NetView without verifying administrator privileges and outputs to the Desktop. -.NOTES - Feature Request List - - Get-WinEvent and system logs: https://technet.microsoft.com/en-us/library/dd367894.aspx?f=255&MSPPError=-2147217396 - - Convert NetSH to NetEvent PS calls. - - Perf Profile acqusition - - Remote powershell support - - Cluster member execution support via remote powershell - - See this command to get VFs on vSwitch (see text in below functions) - > Get-NetAdapterSriovVf -SwitchId 2 -.LINK - https://github.com/Microsoft/SDN -#> - -# -# Common Functions -# - -$ExecFunctions = { - # Global vars - $columns = 4096 - - function ExecCommandText { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String] $Command, - [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String] $Output - ) - - # Mirror command execution context - $context = "$env:USERNAME @ ${env:COMPUTERNAME}:" - Write-Output $context | Out-File -Encoding ascii -Append $Output - - # Mirror command to execute - $cmdMirror = "$(prompt)$Command" - Write-Output $cmdMirror | Out-File -Encoding ascii -Append $Output - } # ExecCommandText() - - function ExecCommandPrivate { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String] $Command, - [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String] $Output - ) - - ExecCommandText -Command ($Command) -Output $Output - - # Execute Command and redirect to file. Useful so users know what to run!!! - Invoke-Expression $Command | Out-File -Encoding ascii -Append $Output - } #ExecCommandPrivate() - - enum CommandStatus { - NotTested # Indicates problem with TestCommand - Unavailable # [Part of] the command doesn't exist - Failed # An error prevented successful execution - Succeeded # No errors or exceptions - } - - function TestCommand { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String] $Command - ) - - $oldGlobalErrorActionPreference = $Global:ErrorActionPreference - $result = [CommandStatus]::NotTested - $failure = $null - - try { - # pre-execution cleanup - $error.clear() - - # Instrument the validate command for silent output - #$tmp = "$Command -ErrorAction 'SilentlyContinue' | Out-Null" - $tmp = "$Command | Out-Null" - - # ErrorAction MUST be Stop for try catch to work. - $Global:ErrorActionPreference = "Stop" - - # Redirect all error output to $null to encompass all possible errors - #Write-Host $tmp -ForegroundColor Yellow - Invoke-Expression $tmp 2> $null - if ($error -ne $null) { - # Some PS commands are incorrectly implemented in return code - # and require detecting SilentlyContinue - if (-not ($tmp -like "*SilentlyContinue*")) { - throw $error[0] - } - } - - # This is only reachable in success case - $result = [CommandStatus]::Succeeded - } catch [Management.Automation.CommandNotFoundException] { - $result = [CommandStatus]::Unavailable - } catch { - $result = [CommandStatus]::Failed - $failure = $error[0] | Out-String - } finally { - # post-execution cleanup to avoid false positives - $Global:ErrorActionPreference = $oldGlobalErrorActionPreference - $error.clear() - } - - return $result, $failure - } # TestCommand() - - # Powershell cmdlets have inconsistent implementations in command error handling. This function - # performs a validation of the command prior to formal execution and will log any failures. - function ExecCommand { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String] $Command, - [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String] $Output, - [parameter(Mandatory=$false)] [Switch] $Trusted - ) - - if ($Trusted) { - # Skip command validation - Write-Host -ForegroundColor Cyan "$Command" - ExecCommandPrivate -Command $Command -Output $Output - } else { - $result, $failure = TestCommand -Command $Command - - if ($result -eq [CommandStatus]::Succeeded) { - Write-Host -ForegroundColor Green "$Command" - ExecCommandPrivate -Command $Command -Output $Output - } else { - Write-Warning "[Command $result] $Command" - - Write-Output "[Command $result]" | Out-File -Encoding ascii -Append $Output - Write-Output "$Command" | Out-File -Encoding ascii -Append $Output - Write-Output "$failure" | Out-File -Encoding ascii -Append $Output - Write-Output "`n`n" | Out-File -Encoding ascii -Append $Output - } - } - } # ExecCommand() - - function TryCmd { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [ScriptBlock] $ScriptBlock - ) - - try { - $out = &$ScriptBlock - } catch { - $out = $null - } - - # Returning $null will cause foreach to iterate once - # unless TryCmd call is in parentheses. - if ($out -eq $null) { - $out = @() - } - - return $out - } -} # $ExecFunctions - -. $ExecFunctions # import into script context - -function Start-Thread { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [ScriptBlock] $ScriptBlock, - [parameter(Mandatory=$false)] [ValidateScript({Test-Path $_ -PathType Container})] [String] $StartPath = ".", - [parameter(Mandatory=$false)] [Hashtable] $Params = @{} - ) - - $ps = [PowerShell]::Create() - - $ps.Runspace = [RunspaceFactory]::CreateRunspace() - $ps.Runspace.Open() - $null = $ps.AddScript("Set-Location ""$(Resolve-Path $StartPath)""") - $null = $ps.AddScript($ExecFunctions) # import into thread context - $null = $ps.AddScript($ScriptBlock).AddParameters($Params) - - $async = $ps.BeginInvoke() - - return @{Name=$ScriptBlock.Ast.Name; AsyncResult=$async; PowerShell=$ps} -} # Start-Thread() - -function Remove-Thread { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [Hashtable] $Thread - ) - Write-Host "Stopping thread $($Thread.Name)..." - $Thread.PowerShell.Stop() - $Thread.PowerShell.Dispose() - $Thread.PowerShell.Runspace.Close() -} # Remove-Thread - -function StreamThread { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [Hashtable] $Thread - ) - - Write-Host "`nOn thread: $($Thread.Name)" - Write-Host "----------------------------------------------" - - do { - Start-Sleep -Milliseconds 50 - # TODO output errors/other streams - $Thread.PowerShell.Streams.Information | Out-Host - $Thread.PowerShell.Streams.Information.Clear() - } until ($Thread.AsyncResult.IsCompleted) - - $Thread.PowerShell.EndInvoke($Thread.AsyncResult) -} # StreamThread() - -# -# Data Collection Functions -# - -function NetIpNicWorker { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $NicName, - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $name = $NicName - $dir = $OutDir - - $file = "Get-NetIpAddress.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetIpAddress -InterfaceAlias ""$name"" | Format-Table -AutoSize | Out-String -Width $columns", - "Get-NetIpAddress -InterfaceAlias ""$name"" | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetIpAddress -InterfaceAlias ""$name"" | Format-List", - "Get-NetIpAddress -InterfaceAlias ""$name"" | Format-List -Property *", - "Get-NetIpAddress | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetIPInterface.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetIPInterface -InterfaceAlias ""$name"" | Out-String -Width $columns", - "Get-NetIPInterface -InterfaceAlias ""$name"" | Format-Table -AutoSize", - "Get-NetIPInterface -InterfaceAlias ""$name"" | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetIPInterface | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetNeighbor.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetNeighbor -InterfaceAlias ""$name"" | Out-String -Width $columns", - "Get-NetNeighbor -InterfaceAlias ""$name"" | Format-Table -AutoSiz | Out-String -Width $columns", - "Get-NetNeighbor -InterfaceAlias ""$name"" | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetNeighbor | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetRoute.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetRoute -InterfaceAlias ""$name"" | Format-Table -AutoSize | Out-String -Width $columns", - "Get-NetRoute -InterfaceAlias ""$name"" | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetRoute | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } -} # NetIpNicWorker() - -function NetIpNic { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $NicName, - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $name = $NicName - - $dir = (Join-Path -Path $OutDir -ChildPath ("NetIp")) - New-Item -ItemType directory -Path $dir | Out-Null - NetIpNicWorker -NicName $name -OutDir $dir -} # NetIpNic() - -function NetIpWorker { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $dir = $OutDir - - $file = "Get-NetIpAddress.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetIpAddress | Format-Table -AutoSize | Out-String -Width $columns", - "Get-NetIpAddress | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetIpAddress | Format-List", - "Get-NetIpAddress | Format-List -Property *", - "Get-NetIpAddress | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetIPInterface.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetIPInterface | Out-String -Width $columns", - "Get-NetIPInterface | Format-Table -AutoSize | Out-String -Width $columns", - "Get-NetIPInterface | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetIPInterface | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetNeighbor.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetNeighbor | Format-Table -AutoSize | Out-String -Width $columns", - "Get-NetNeighbor | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetNeighbor | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetIPv4Protocol.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetIPv4Protocol | Out-String -Width $columns", - "Get-NetIPv4Protocol | Format-List -Property *", - "Get-NetIPv4Protocol | Format-Table -Property * -AutoSize", - "Get-NetIPv4Protocol | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetIPv4Protocol | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetIPv6Protocol.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetIPv6Protocol | Out-String -Width $columns", - "Get-NetIPv6Protocol | Format-List -Property *", - "Get-NetIPv6Protocol | Format-Table -Property * -AutoSize", - "Get-NetIPv6Protocol | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetIPv6Protocol | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetOffloadGlobalSetting.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetOffloadGlobalSetting | Out-String -Width $columns", - "Get-NetOffloadGlobalSetting | Format-List -Property *", - "Get-NetOffloadGlobalSetting | Format-Table -AutoSize", - "Get-NetOffloadGlobalSetting | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetOffloadGlobalSetting | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetPrefixPolicy.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetPrefixPolicy | Format-Table -AutoSize", - "Get-NetPrefixPolicy | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetPrefixPolicy | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetRoute.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetRoute | Format-Table -AutoSize", - "Get-NetRoute | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetRoute | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetTCPConnection.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetTCPConnection | Format-Table -AutoSize", - "Get-NetTCPConnection | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetTCPConnection | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Trusted -Command ($cmd) -Output $out - } - - $file = "Get-NetTcpSetting.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetTcpSetting | Format-Table -AutoSize", - "Get-NetTcpSetting | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetTcpSetting | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Trusted -Command ($cmd) -Output $out - } - - $file = "Get-NetTransportFilter.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetTransportFilter | Format-Table -AutoSize", - "Get-NetTransportFilter | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetTransportFilter | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetUDPEndpoint.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetUDPEndpoint | Format-Table -AutoSize", - "Get-NetUDPEndpoint | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetUDPEndpoint | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetUDPSetting.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetUDPSetting | Format-Table -AutoSize", - "Get-NetUDPSetting | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetUDPSetting | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } -} # NetIpWorker() - -function NetIp { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $dir = (Join-Path -Path $OutDir -ChildPath ("NetIp")) - New-Item -ItemType directory -Path $dir | Out-Null - NetIpWorker -OutDir $dir -} # NetIp() - -function NetNatWorker { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $dir = $OutDir - - $file = "Get-NetNat.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetNat | Format-Table -AutoSize | Out-String -Width $columns", - "Get-NetNat | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetNat | Format-List", - "Get-NetNat | Format-List -Property *", - "Get-NetNat | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetNatExternalAddress.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetNatExternalAddress | Format-Table -AutoSize | Out-String -Width $columns", - "Get-NetNatExternalAddress | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetNatExternalAddress | Format-List", - "Get-NetNatExternalAddress | Format-List -Property *", - "Get-NetNatExternalAddress | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetNatGlobal.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetNatGlobal | Format-Table -AutoSize | Out-String -Width $columns", - "Get-NetNatGlobal | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetNatGlobal | Format-List", - "Get-NetNatGlobal | Format-List -Property *", - "Get-NetNatGlobal | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetNatSession.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetNatSession | Format-Table -AutoSize | Out-String -Width $columns", - "Get-NetNatSession | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetNatSession | Format-List", - "Get-NetNatSession | Format-List -Property *", - "Get-NetNatSession | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetNatStaticMapping.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetNatStaticMapping | Format-Table -AutoSize | Out-String -Width $columns", - "Get-NetNatStaticMapping | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetNatStaticMapping | Format-List", - "Get-NetNatStaticMapping | Format-List -Property *", - "Get-NetNatStaticMapping | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - -} # NetNatWorker - -function NetNat { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $dir = (Join-Path -Path $OutDir -ChildPath ("NetNat")) - New-Item -ItemType directory -Path $dir | Out-Null - NetNatWorker -OutDir $dir -} # NetNat() - -function NetAdapterWorker { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $NicName, - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $name = $NicName - $dir = $OutDir - - $file = "Get-NetAdapter.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapter -Name ""$name"" -IncludeHidden | Out-String -Width $columns", - "Get-NetAdapter -Name ""$name"" -IncludeHidden | Format-List -Property *", - "Get-NetAdapter | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetAdapterAdvancedProperty.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterAdvancedProperty -Name ""$name"" -AllProperties | Sort-Object RegistryKeyword | Format-Table -AutoSize | Out-String -Width $columns", - "Get-NetAdapterAdvancedProperty -Name ""$name"" -AllProperties -IncludeHidden | Sort-Object RegistryKeyword | Format-Table -AutoSize | Out-String -Width $columns", - "Get-NetAdapterAdvancedProperty -Name ""$name"" -AllProperties -IncludeHidden | Format-List -Property *", - "Get-NetAdapterAdvancedProperty -Name ""$name"" -AllProperties -IncludeHidden | Format-Table -Property * | Out-String -Width $columns", - "Get-NetAdapterAdvancedProperty | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetAdapterBinding.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterBinding -Name ""$name"" -AllBindings -IncludeHidden | Sort-Object ComponentID | Out-String -Width $columns", - "Get-NetAdapterBinding -Name ""$name"" -AllBindings -IncludeHidden | Format-List -Property *", - "Get-NetAdapterBinding | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetAdapterChecksumOffload.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterChecksumOffload -Name ""$name"" -IncludeHidden | Out-String -Width $columns", - "Get-NetAdapterChecksumOffload -Name ""$name"" -IncludeHidden | Format-List -Property *", - "Get-NetAdapterChecksumOffload | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetAdapterLso.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterLso -Name ""$name"" -IncludeHidden | Out-String -Width $columns", - "Get-NetAdapterLso -Name ""$name"" -IncludeHidden | Format-List -Property *", - "Get-NetAdapterLso | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetAdapterRss.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterRss -Name ""$name"" -IncludeHidden | Out-String -Width $columns", - "Get-NetAdapterRss -Name ""$name"" -IncludeHidden | Format-List -Property *", - "Get-NetAdapterRss | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetAdapterStatistics.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterStatistics -Name ""$name"" -IncludeHidden | Out-String -Width $columns", - "Get-NetAdapterStatistics -Name ""$name"" -IncludeHidden | Format-List -Property *", - "Get-NetAdapterStatistics | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetAdapterEncapsulatedPacketTaskOffload.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterEncapsulatedPacketTaskOffload -Name ""$name"" -IncludeHidden | Out-String -Width $columns", - "Get-NetAdapterEncapsulatedPacketTaskOffload -Name ""$name"" -IncludeHidden | Format-List -Property *", - "Get-NetAdapterEncapsulatedPacketTaskOffload | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetAdapterHardwareInfo.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterHardwareInfo -Name ""$name"" -IncludeHidden | Out-String -Width $columns", - "Get-NetAdapterHardwareInfo -Name ""$name"" -IncludeHidden | Format-List -Property *", - "Get-NetAdapterHardwareInfo | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetAdapterIPsecOffload.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterIPsecOffload -Name ""$name"" -IncludeHidden | Out-String -Width $columns", - "Get-NetAdapterIPsecOffload -Name ""$name"" -IncludeHidden | Format-List -Property *", - "Get-NetAdapterIPsecOffload | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetAdapterPowerManagement.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterPowerManagement -Name ""$name"" -IncludeHidden | Out-String -Width $columns", - "Get-NetAdapterPowerManagement -Name ""$name"" -IncludeHidden | Format-List -Property *", - "Get-NetAdapterPowerManagement | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetAdapterQos.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterQos -Name ""$name"" -IncludeHidden -ErrorAction SilentlyContinue | Out-String -Width $columns", - "Get-NetAdapterQos -Name ""$name"" -IncludeHidden -ErrorAction SilentlyContinue | Format-List -Property *", - "Get-NetAdapterQos | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetAdapterRdma.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterRdma -Name ""$name"" -IncludeHidden | Out-String -Width $columns", - "Get-NetAdapterRdma -Name ""$name"" -IncludeHidden | Format-List -Property *", - "Get-NetAdapterRdma | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetAdapterPacketDirect.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterPacketDirect -Name ""$name"" -IncludeHidden | Out-String -Width $columns", - "Get-NetAdapterPacketDirect -Name ""$name"" -IncludeHidden | Format-List -Property *", - "Get-NetAdapterPacketDirect | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetAdapterRsc.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterRsc -Name ""$name"" -IncludeHidden | Out-String -Width $columns", - "Get-NetAdapterRsc -Name ""$name"" -IncludeHidden | Format-List -Property *", - "Get-NetAdapterRsc | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetAdapterSriov.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterSriov -Name ""$name"" -IncludeHidden | Out-String -Width $columns", - "Get-NetAdapterSriov -Name ""$name"" -IncludeHidden | Format-List -Property *", - "Get-NetAdapterSriov | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetAdapterSriovVf.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterSriovVf -Name ""$name"" -IncludeHidden | Out-String -Width $columns", - "Get-NetAdapterSriovVf -Name ""$name"" -IncludeHidden | Format-List -Property *", - "Get-NetAdapterSriovVf | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetAdapterVmq.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterVmq -Name ""$name"" -IncludeHidden | Out-String -Width $columns", - "Get-NetAdapterVmq -Name ""$name"" -IncludeHidden | Format-List -Property *", - "Get-NetAdapterVmq | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetAdapterVmqQueue.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterVmqQueue -Name ""$name"" -IncludeHidden | Out-String -Width $columns", - "Get-NetAdapterVmqQueue -Name ""$name"" -IncludeHidden | Format-List -Property *", - "Get-NetAdapterVmqQueue | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetAdapterVPort.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterVPort -Name ""$name"" -IncludeHidden | Out-String -Width $columns", - "Get-NetAdapterVPort -Name ""$name"" -IncludeHidden | Format-List -Property *", - "Get-NetAdapterVPort | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } -} # NetAdapterWorker() - -function NetAdapterWorkerPrepare { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $NicDesc, - [parameter(Mandatory=$true)] [String] $OutDir - ) - - # Normalize Variables - $out = $OutDir - $desc = $NicDesc - - # Create dir for each NIC - $nic = Get-NetAdapter -InterfaceDescription $desc - $idx = $nic.IfIndex - $name = $nic.Name - $desc = $NicDesc - $nictype = "pNic" - $title = "$nictype.$idx.$name.$desc" - $dir = (Join-Path -Path $out -ChildPath "$title") - New-Item -ItemType directory -Path $dir | Out-Null - - Write-Host "" - Write-Host "Processing: $title" - Write-Host "----------------------------------------------" - NetIpNic -NicName $name -OutDir $dir - NetAdapterWorker -NicName $name -OutDir $dir - NicVendor -NicName $name -OutDir $dir -} # NetAdapterWorkerPrepare() - - -function LbfoWorker { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $LbfoName, - [parameter(Mandatory=$true)] [String] $OutDir - ) - - # Normalize Names - $name = $LbfoName - $out = $OutDir - - $file = "Get-NetLbfoTeam.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetLbfoTeam -Name ""$name""", - "Get-NetLbfoTeam -Name ""$name"" | Format-List -Property *", - "Get-NetLbfoTeam | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetLbfoTeamNic.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetLbfoTeamNic -Team ""$name""", - "Get-NetLbfoTeamNic -Team ""$name"" | Format-List -Property *", - "Get-NetLbfoTeamNic | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-NetLbfoTeamMember.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetLbfoTeamMember -Team ""$name""", - "Get-NetLbfoTeamMember -Team ""$name"" | Format-List -Property *", - "Get-NetLbfoTeamMember | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - # Report the TNIC(S) - foreach ($tnic in TryCmd {Get-NetLbfoTeamNic -Team $name}) { - NetAdapterWorkerPrepare -NicDesc $tnic.InterfaceDescription -OutDir $OutDir - } - - # Report the NIC Members - foreach ($mnic in TryCmd {Get-NetLbfoTeamMember -Team $name}) { - NetAdapterWorkerPrepare -NicDesc $mnic.InterfaceDescription -OutDir $OutDir - } -} # LbfoWorker() - -function LbfoWorkerPrepare { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $LbfoName, - [parameter(Mandatory=$true)] [String] $OutDir - ) - - # Normalize Variable - $name = $LbfoName - - $dir = (Join-Path -Path $OutDir -ChildPath ("LBFO.$name")) - New-Item -ItemType directory -Path $dir | Out-Null - - Write-Host "Processing: $name" - Write-Host "----------------------------------------------" - LbfoWorker -LbfoName $name -OutDir $dir -} # LbfoWorkerPrepare() - -function LbfoDetail { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - # Normalize variables - $out = $OutDir - - foreach ($lbfo in TryCmd {Get-NetLbfoTeam}) { - $name = $lbfo.Name - - # Skip all vSwitch Protocol NICs since the LBFO and member reporting will occur as part of - # vSwitch reporting. - $match = $false - - foreach ($vms in TryCmd {Get-VMSwitch | where {$_.SwitchType -ne "Internal"}}) { - if ($vms.NetAdapterInterfaceDescriptions -contains (Get-NetAdapter -Name $name).InterfaceDescription) { - $match = $true - break - } - } - - if (-not $match) { - LbfoWorkerPrepare -LbfoName $name -OutDir $out - } - } -} # LbfoDetail() - -function ProtocolNicDetail { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $VMSwitchName, - [parameter(Mandatory=$true)] [String] $OutDir - ) - - # Normalize Variables - $out = $OutDir - - # Distinguish between LBFO from standard PTNICs and create the hierarchies accordingly - foreach ($desc in TryCmd {(Get-VMSwitch -Name "$VMSwitchName").NetAdapterInterfaceDescriptions}) { - $nic = Get-NetAdapter -InterfaceDescription $desc - if ($nic.DriverFileName -like "NdisImPlatform.sys") { - LbfoWorkerPrepare -LbfoName $nic.Name -OutDir $out - } else { - NetAdapterWorkerPrepare -NicDesc $desc -OutDir $out - } - } -} # ProtocolNicDetail() - -function NativeNicDetail { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - # Normalize Variables - $out = $OutDir - - foreach ($nic in Get-NetAdapter) { - $native = $true - - # Skip vSwitch Host vNICs by checking the driver - if ($nic.DriverFileName -like "vmswitch.sys") { - continue - } - - # Skip LBFO TNICs by checking the driver - if ($nic.DriverFileName -like "NdisImPlatform.sys") { - continue - } - - # Skip all vSwitch Protocol NICs - foreach ($vms in TryCmd {Get-VMSwitch | where {$_.SwitchType -ne "Internal"}}) { - if ($vms.NetAdapterInterfaceDescriptions -contains $nic.InterfaceDescription) { - $native = $false - break - } - } - - # Skip LBFO Team Member Adapters - foreach ($lbfonic in TryCmd {Get-NetLbfoTeamMember}) { - if ($nic.InterfaceDescription -eq $lbfonic.InterfaceDescription) { - $native = $false - break - } - } - - if ($native) { - NetAdapterWorkerPrepare -NicDesc $nic.InterfaceDescription -OutDir $out - } - } -} # NativeNicDetail() - -function ChelsioDetail { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $NicName, - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $dir = (Join-Path -Path $OutDir -ChildPath "ChelsioDetail") - New-Item -ItemType Directory -Path $dir | Out-Null - - # Collect Chelsio related event logs and miscellaneous details - $file = "ChelsioDetail-Eventlog-BusDevice.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-EventLog -LogName System -Source ""*chvbd*"" -ErrorAction SilentlyContinue | Format-List", - "Get-EventLog -LogName System -Source ""*cht4vbd*"" -ErrorAction SilentlyContinue | Format-List" - foreach ($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "ChelsioDetail-Eventlog-NetDevice.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-EventLog -LogName System -Source ""*chndis*"" -ErrorAction SilentlyContinue | Format-List", - "Get-EventLog -LogName System -Source ""*chnet*"" -ErrorAction SilentlyContinue | Format-List", - "Get-EventLog -LogName System -Source ""*cht4ndis*"" -ErrorAction SilentlyContinue | Format-List" - foreach ($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "ChelsioDetail-Misc.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "verifier /query", - "Get-PnpDevice -FriendlyName ""*Chelsio*Enumerator*"" | Get-PnpDeviceProperty -KeyName DEVPKEY_Device_DriverVersion | Format-Table -Autosize" - foreach ($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - # Basic sanity check. Most of Chelsio related logs are collected using cxgbtool.exe. - # So if cxgbtool.exe is not there in System32 forlder, then exit from the function. - $cxgbtool = Get-Item "$env:windir\System32\cxgbtool.exe" -ErrorAction SilentlyContinue - if ($cxgbtool.Exists -eq $null) { - Write-Warning "Unable to collect Chelsio debug logs as cxgbtool is not present in $env:windir\system32" - return $null - } - - $ifName = $NicName - $ifIndex = (Get-NetAdapter $NicName).ifIndex - $ifHwInfo = Get-NetAdapterHardwareInfo -Name "$ifName" - $dirBusName = "BusDev_$($ifHwInfo.Bus)_$($ifHwInfo.Device)_$($ifHwInfo.Function)" - $dirBus = (Join-Path -Path $dir -ChildPath $dirBusName) - - if ($Global:ChelsioOncePerASIC -notcontains $dirBusName) { - $Global:ChelsioOncePerASIC += @($dirBusName) # expensive, avoid duplicate effort - New-Item -ItemType Directory -Path $dirBus | Out-Null - - # Enumerate VBD - [String] $ifNameVbd = $null - [Array] $PnPDevices = Get-PnpDevice -FriendlyName "*Chelsio*Enumerator*" | where {$_.Status -eq "OK"} - for ($i = 0; $i -lt $PnPDevices.Count; $i++) { - $instanceId = $PnPDevices[$i].InstanceId - $locationInfo = (Get-PnpDeviceProperty -InstanceId "$instanceId" -KeyName "DEVPKEY_Device_LocationInfo").Data - if ($ifHwInfo.LocationInformationString -eq $locationInfo) { - $ifNameVbd = "vbd$i" - break - } - } - - if ([String]::IsNullOrEmpty($ifNameVbd)) { - Write-Warning "Couldn't resolve interface name for bus device" - return $null - } - - $file = "ChelsioDetail-Cudbg.txt" - $CollectFile = "Cudbg-Collect.dmp" - $ReadFlashFile = "Cudbg-Readflash.dmp" - $out = (Join-Path -Path $dirBus -ChildPath $file) - $OutCollect = (Join-Path -Path $dirBus -ChildPath $CollectFile) - $OutReadFlash = (Join-Path -Path $dirBus -ChildPath $ReadFlashFile) - [String []] $cmds = "cxgbtool.exe $ifNameVbd cudbg collect all ""$OutCollect""", - "cxgbtool.exe $ifNameVbd cudbg readflash ""$OutReadFlash""" - foreach ($cmd in $cmds) { - ExecCommand -Trusted -Command $cmd -Output $out - } - - $file = "ChelsioDetail-Firmware-BusDevice$i.txt" - $out = (Join-Path -Path $dirBus -ChildPath $file) - [String []] $cmds = "cxgbtool.exe $ifNameVbd firmware mbox 1", - "cxgbtool.exe $ifNameVbd firmware mbox 2", - "cxgbtool.exe $ifNameVbd firmware mbox 3", - "cxgbtool.exe $ifNameVbd firmware mbox 4", - "cxgbtool.exe $ifNameVbd firmware mbox 5", - "cxgbtool.exe $ifNameVbd firmware mbox 6", - "cxgbtool.exe $ifNameVbd firmware mbox 7" - foreach ($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "ChelsioDetail-Hardware-BusDevice$i.txt" - $flashFile = "Hardware-BusDevice$i-flash.dmp" - $out = (Join-Path -Path $dirBus -ChildPath $file) - $OutFlash = (Join-Path -Path $dirBus -ChildPath $flashFile) - [String []] $cmds = "cxgbtool.exe $ifNameVbd hardware sgedbg", - "cxgbtool.exe $ifNameVbd hardware flash ""$OutFlash""" - foreach ($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - } # $Global:ChelsioOncePerASIC - - $dirNetName = "NetDev_$ifIndex" - $dirNet = (Join-Path -Path $dir -ChildPath $dirNetName) - New-Item -ItemType Directory -Path $dirNet | Out-Null - - # Enumerate NIC - [Array] $NetDevices = Get-NetAdapter -InterfaceDescription "*Chelsio*" | where {$_.Status -eq "Up"} | Sort-Object -Property MacAddress - $ifNameNic = $null - for ($i = 0; $i -lt $NetDevices.Count; $i++) { - if ($ifName -eq $NetDevices[$i].Name) { - $ifNameNic = "nic$i" - break - } - } - - if ([String]::IsNullOrEmpty($ifNameNic)) { - Write-Warning "Couldn't resolve interface name for Network device(ifIndex:$ifIndex)" - return $null - } - - $file = "ChelsioDetail-Debug.txt" - $out = (Join-Path -Path $dirNet -ChildPath $file) - [String []] $cmds = "cxgbtool.exe $ifNameNic debug filter", - "cxgbtool.exe $ifNameNic debug qsets", - "cxgbtool.exe $ifNameNic debug qstats txeth rxeth txvirt rxvirt txrdma rxrdma txnvgre rxnvgre", - "cxgbtool.exe $ifNameNic debug dumpctx", - "cxgbtool.exe $ifNameNic debug version", - "cxgbtool.exe $ifNameNic debug eps", - "cxgbtool.exe $ifNameNic debug qps", - "cxgbtool.exe $ifNameNic debug rdma_stats", - "cxgbtool.exe $ifNameNic debug stags", - "cxgbtool.exe $ifNameNic debug l2t" - foreach ($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "ChelsioDetail-Hardware.txt" - $out = (Join-Path -Path $dirNet -ChildPath $file) - [String []] $cmds = "cxgbtool.exe $ifNameNic hardware tid_info", - "cxgbtool.exe $ifNameNic hardware fec", - "cxgbtool.exe $ifNameNic hardware link_cfg", - "cxgbtool.exe $ifNameNic hardware pktfilter", - "cxgbtool.exe $ifNameNic hardware sensor" - foreach ($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } -} # ChelsioDetail() - -# ======================================================================== -# function stub for extension by IHV -# Copy and rename it, add your commands, and call it in NicVendor() below -# ======================================================================== -function MyVendorDetail { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $NicName, - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $dir = Join-Path -Path $OutDir -ChildPath "MyVendorDetail" - - # Try to keep the layout of this block of code - # Feel free to copy it or wrap it in other control structures - # See other functions in this file for examples - $file = "$NicName.MyVendor.txt" - $out = Join-Path $dir $file - [String []] $cmds = "Command 1", - "Command 2", - "Command 3", - "etc." - foreach ($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } -} # MyVendorDetail() - -function NicVendor { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $NicName, # Get-NetAdapter output - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $dir = $OutDir - - # Call appropriate vendor specific function - $pciId = (Get-NetAdapterAdvancedProperty -Name $NicName -AllProperties -RegistryKeyword "ComponentID").RegistryValue - switch -Wildcard($pciId) { - "CHT*BUS\chnet*" { - ChelsioDetail $NicName $dir - } - # Not implemented. See MyVendorDetail() for examples. - # - #"PCI\VEN_15B3*" { - # MellanoxDetail $Nic $dir - # - #} - #"PCI\VEN_8086*" { - # IntelDetail $Nic $dir - #} - default { - # Not implemented, not native, or N/A - } - } -} # NicVendor() - -function HostVNicWorker { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $HostVNicName, - [parameter(Mandatory=$true)] [String] $OutDir - ) - - # Normalize Names - $name = $HostVNicName - $dir = $OutDir - - $file = "Get-VMNetworkAdapter.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMNetworkAdapter -ManagementOS -VMNetworkAdapterName ""$name"" | Out-String -Width $columns", - "Get-VMNetworkAdapter -ManagementOS -VMNetworkAdapterName ""$name"" | Format-List -Property *", - "Get-VMNetworkAdapter -ManagementOS| Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMNetworkAdapterAcl.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMNetworkAdapterAcl -ManagementOS -VMNetworkAdapterName ""$name"" | Out-String -Width $columns", - "Get-VMNetworkAdapterAcl -ManagementOS -VMNetworkAdapterName ""$name"" | Format-List -Property *", - "Get-VMNetworkAdapterAcl -ManagementOS | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMNetworkAdapterExtendedAcl.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMNetworkAdapterExtendedAcl -ManagementOS -VMNetworkAdapterName ""$name"" | Out-String -Width $columns", - "Get-VMNetworkAdapterExtendedAcl -ManagementOS -VMNetworkAdapterName ""$name"" | Format-List -Property *", - "Get-VMNetworkAdapterExtendedAcl -ManagementOS | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMNetworkAdapterFailoverConfiguration.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMNetworkAdapterFailoverConfiguration -ManagementOS -VMNetworkAdapterName ""$name"" | Out-String -Width $columns", - "Get-VMNetworkAdapterFailoverConfiguration -ManagementOS -VMNetworkAdapterName ""$name"" | Format-List -Property *", - "Get-VMNetworkAdapterFailoverConfiguration -ManagementOS | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMNetworkAdapterIsolation.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMNetworkAdapterIsolation -ManagementOS -VMNetworkAdapterName ""$name"" | Out-String -Width $columns", - "Get-VMNetworkAdapterIsolation -ManagementOS -VMNetworkAdapterName ""$name"" | Format-List -Property *", - "Get-VMNetworkAdapterIsolation -ManagementOS | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMNetworkAdapterRoutingDomainMapping.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMNetworkAdapterRoutingDomainMapping -ManagementOS -VMNetworkAdapterName ""$name"" | Out-String -Width $columns", - "Get-VMNetworkAdapterRoutingDomainMapping -ManagementOS -VMNetworkAdapterName ""$name"" | Format-List -Property *", - "Get-VMNetworkAdapterRoutingDomainMapping -ManagementOS | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMNetworkAdapterTeamMapping.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMNetworkAdapterTeamMapping -ManagementOS -VMNetworkAdapterName ""$name"" | Out-String -Width $columns", - "Get-VMNetworkAdapterTeamMapping -ManagementOS -VMNetworkAdapterName ""$name"" | Format-List -Property *", - "Get-VMNetworkAdapterTeamMapping -ManagementOS | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMNetworkAdapterVlan.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName ""$name"" | Out-String -Width $columns", - "Get-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName ""$name"" | Format-List -Property *", - "Get-VMNetworkAdapterVlan -ManagementOS | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } -} # HostVNicWorker() - -function HostVNicDetail { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $VMSwitchName, - [parameter(Mandatory=$true)] [String] $OutDir - ) - - foreach ($nic in TryCmd {Get-VMNetworkAdapter -ManagementOS -SwitchName $VMSwitchName}) { - <# - Correlate to VMNic instance to NetAdapter instance view - Physical to Virtual Mapping. - ----------------------------- - Get-NetAdapter uses: - Name : vEthernet (VMS-Ext-Public) 2 - Get-VMNetworkAdapter uses: - Name : VMS-Ext-Public - - Thus we need to match the corresponding devices via DeviceID such that - we can execute VMNetworkAdapter and NetAdapter information for this hNIC - #> - $idx = 0 - foreach($pnic in (Get-NetAdapter -IncludeHidden)) { - if ($pnic.DeviceID -eq $nic.DeviceId) { - $pnicname = $pnic.Name - $idx = $pnic.IfIndex - } - } - - # Create dir for each NIC - $name = $nic.Name - $nictype = "hNic" - $title = "$nictype.$idx.$name" - $dir = (Join-Path -Path $OutDir -ChildPath "$title") - New-Item -ItemType directory -Path $dir | Out-Null - - Write-Host "Processing: $title" - Write-Host "----------------------------------------------" - NetIpNic -NicName $pnicname -OutDir $dir - HostVNicWorker -HostVNicName $name -OutDir $dir - NetAdapterWorker -NicName $pnicname -OutDir $dir - } -} # HostVNicDetail() - - -function VMNetworkAdapterWorker { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $VMName, - [parameter(Mandatory=$true)] [String] $VMNicName, - [parameter(Mandatory=$true)] [String] $OutDir - ) - - # Normalize Names - $name = $VMNicName - $dir = $OutDir - - $file = "Get-VMNetworkAdapter.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMNetworkAdapter -Name ""$name"" -VMName ""$VMName"" | Out-String -Width $columns", - "Get-VMNetworkAdapter -Name ""$name"" -VMName ""$VMName"" | Format-List -Property *", - "Get-VMNetworkAdapter * | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMNetworkAdapterAcl.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMNetworkAdapterAcl -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Out-String -Width $columns", - "Get-VMNetworkAdapterAcl -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Format-List -Property *", - "Get-VMNetworkAdapterAcl | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMNetworkAdapterExtendedAcl.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMNetworkAdapterExtendedAcl -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Out-String -Width $columns", - "Get-VMNetworkAdapterExtendedAcl -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Format-List -Property *", - "Get-VMNetworkAdapterExtendedAcl | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMNetworkAdapterFailoverConfiguration.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMNetworkAdapterFailoverConfiguration -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Out-String -Width $columns", - "Get-VMNetworkAdapterFailoverConfiguration -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Format-List -Property *", - "Get-VMNetworkAdapterFailoverConfiguration -VMName * | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMNetworkAdapterIsolation.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMNetworkAdapterIsolation -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Out-String -Width $columns", - "Get-VMNetworkAdapterIsolation -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Format-List -Property *", - "Get-VMNetworkAdapterIsolation | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMNetworkAdapterRoutingDomainMapping.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMNetworkAdapterRoutingDomainMapping -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Out-String -Width $columns", - "Get-VMNetworkAdapterRoutingDomainMapping -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Format-List -Property *", - "Get-VMNetworkAdapterRoutingDomainMapping | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMNetworkAdapterTeamMapping.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMNetworkAdapterTeamMapping -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Out-String -Width $columns", - "Get-VMNetworkAdapterTeamMapping -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Format-List -Property *", - "Get-VMNetworkAdapterTeamMapping -VMName * | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMNetworkAdapterVlan.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMNetworkAdapterVlan -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Out-String -Width $columns", - "Get-VMNetworkAdapterVlan -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Format-List -Property *", - "Get-VMNetworkAdapterVlan | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } -} # VMNetworkAdapterWorker() - -function VmNetworkAdapterDetail { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $VMName, - [parameter(Mandatory=$true)] [String] $VmNicName, - [parameter(Mandatory=$true)] [String] $VmNicMac, - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $dir = (Join-Path -Path $OutDir -ChildPath ("VMNic.$VmNicName.$VmNicMac")) - New-Item -ItemType directory -Path $dir | Out-Null - - Write-Host "Processing: VMNic.$VmNicName.$VmNicMac" - Write-Host "--------------------------------------" - VMNetworkAdapterWorker -VMName $VMName -VMNicName $VmNicName -OutDir $dir -} # VmNetworkAdapterDetail() - -function VmWorker { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $VMName, - [parameter(Mandatory=$true)] [String] $OutDir - ) - - # Normalize Names - $dir = $OutDir - - $file = "Get-VM.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VM -VMName ""$VMName"" | Out-String -Width $columns", - "Get-VM -VMName ""$VMName"" | Format-List -Property *", - "Get-VM | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMBios.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMBios -VMName ""$VMName"" | Out-String -Width $columns", - "Get-VMBios -VMName ""$VMName"" | Format-List -Property *" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMFirmware.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMFirmware -VMName ""$VMName"" | Out-String -Width $columns", - "Get-VMFirmware -VMName ""$VMName"" | Format-List -Property *" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMProcessor.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMProcessor -VMName ""$VMName"" | Out-String -Width $columns", - "Get-VMProcessor -VMName ""$VMName"" | Format-List -Property *" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMMemory.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMMemory -VMName ""$VMName"" | Out-String -Width $columns", - "Get-VMMemory -VMName ""$VMName"" | Format-List -Property *" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMVideo.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMVideo -VMName ""$VMName"" | Out-String -Width $columns", - "Get-VMVideo -VMName ""$VMName"" | Format-List -Property *" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMHardDiskDrive.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMHardDiskDrive -VMName ""$VMName"" | Out-String -Width $columns", - "Get-VMHardDiskDrive -VMName ""$VMName"" | Format-List -Property *" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMComPort.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMComPort -VMName ""$VMName"" | Out-String -Width $columns", - "Get-VMComPort -VMName ""$VMName"" | Format-List -Property *" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMSecurity.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMSecurity -VMName ""$VMName"" | Out-String -Width $columns", - "Get-VMSecurity -VMName ""$VMName"" | Format-List -Property *" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - -} # VmWorker() - -function VMNetworkAdapterPerVM { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $VMSwitchName, - [parameter(Mandatory=$true)] [String] $OutDir - ) - - foreach ($vm in TryCmd {Get-VM}) { - $vmname = $vm.Name - $vmid = $vm.VMId - - Write-Host "Processing: VM.$vmname.$vmid" - Write-Host "--------------------------------------" - foreach ($nic in TryCmd {Get-VMNetworkAdapter -VMName $vmname}) { - if ($nic.SwitchName -eq $VMSwitchName) { - $vmquery = 0 - $dir = (Join-Path -Path $OutDir -ChildPath ("VM.$vmname")) - if (-not (Test-Path $dir)) { - New-Item -ItemType directory -Path $dir | Out-Null - $vmquery = 1 - } - - if ($vmquery) { - VmWorker -VMName $vmname -OutDir $dir - } - VmNetworkAdapterDetail -VMName $vmname -VmNicName $nic.Name -VmNicMac $nic.MacAddress -OutDir $dir - } - } - } -} # VMNetworkAdapterPerVM() - -function VMSwitchWorker { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $VMSwitchName, - [parameter(Mandatory=$true)] [String] $OutDir - ) - - # Normalize Names - $name = $VMSwitchName - $dir = $OutDir - - $file = "Get-VMSwitch.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMSwitch -Name ""$name""", - "Get-VMSwitch -Name ""$name"" | Format-List -Property *", - "Get-VMSwitch -Name ""$name"" | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMSwitchExtension.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMSwitch -Name ""$name"" | Get-VMSwitchExtension | Format-List -Property *", - "Get-VMSwitch -Name ""$name"" | Get-VMSwitchExtension | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMSwitchExtensionSwitchData.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMSwitchExtensionSwitchData -SwitchName ""$name"" | Format-List -Property *", - "Get-VMSwitchExtensionSwitchData -SwitchName ""$name"" | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMSwitchExtensionSwitchFeature.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMSwitchExtensionSwitchFeature -SwitchName ""$name"" | Format-List -Property *" - #"Get-VMSwitchExtensionSwitchFeature -SwitchName ""$name"" | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMSwitchTeam.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMSwitchTeam -SwitchName ""$name"" | Format-List -Property *", - "Get-VMSwitchTeam -SwitchName ""$name"" | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMSystemSwitchExtension.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMSystemSwitchExtension | Format-List -Property *", - "Get-VMSystemSwitchExtension | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMSwitchExtensionPortFeature.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMSwitchExtensionPortFeature * | Format-List -Property *", - "Get-VMSwitchExtensionPortFeature * | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMSystemSwitchExtensionSwitchFeature.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMSystemSwitchExtensionSwitchFeature", - "Get-VMSystemSwitchExtensionSwitchFeature | Format-List -Property *", - "Get-VMSystemSwitchExtensionSwitchFeature | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - <# - #Get-VMSwitchExtensionPortData -ComputerName $env:computername * - # Execute command list - $file = "Get-VMSwitchExtensionPortData.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-VMSwitchExtensionPortData -SwitchName ""$name"" | Format-List -Property *", - "Get-VMSwitchExtensionPortData -SwitchName ""$name"" | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - #> -} # VMSwitchWorker() - -function VfpExtensionWorker { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $VMSwitchName, - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $name = $VMSwitchName - $out = $OutDir - - $dir = (Join-Path -Path $out -ChildPath ("VFP")) - New-Item -ItemType directory -Path $dir | Out-Null - - $file = "VfpCtrl.help.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "vfpctrl.exe /h" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - - $switches = Get-WmiObject -Namespace root\virtualization\v2 -Class Msvm_VirtualEthernetSwitch - foreach ($switch in $switches) { - if ($switch.ElementName -eq $name) { - $currswitch = $switch - break - } - } - $ports = $currswitch.GetRelated("Msvm_EthernetSwitchPort", "Msvm_SystemDevice", $null, $null, $null, $null, $false, $null) - foreach ($port in $ports) { - $portGuid = $port.Name - $file = "VfpCtrl.PortGuid.$portGuid.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "vfpctrl.exe /list-space /port $portGuid", - "vfpctrl.exe /list-mapping /port $portGuid", - "vfpctrl.exe /list-rule /port $portGuid", - "vfpctrl.exe /port $portGuid /get-port-state" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - } - -} # VfpExtensionWorker() - -function VfpExtensionDetail { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $VMSwitchName, - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $name = $VMSwitchName - $out = $OutDir - - foreach ($ext in TryCmd {Get-VMSwitch -Name $name | Get-VMSwitchExtension}) { - if (($ext.Name -like "Microsoft Azure VFP Switch Extension") -and ($ext.Enabled -like "True")) { - VfpExtensionWorker -VMSwitchName $name -OutDir $out - } - } - -} # VfpExtensionDetail() - -function VMSwitchDetail { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - # FIXME!!! - ##See this command to get VFs on vSwitch - #Get-NetAdapterSriovVf -SwitchId 2 - - foreach ($switch in TryCmd {Get-VMSwitch}) { - $name = $switch.Name - $type = $switch.SwitchType - - $dir = (Join-Path -Path $OutDir -ChildPath ("VMSwitch.$type.$name")) - New-Item -ItemType directory -Path $dir | Out-Null - - Write-Host "Processing: $name" - Write-Host "----------------------------------------------" - VfpExtensionDetail -VMSwitchName $name -OutDir $dir - VMSwitchWorker -VMSwitchName $name -OutDir $dir - ProtocolNicDetail -VMSwitchName $name -OutDir $dir - HostVNicDetail -VMSwitchName $name -OutDir $dir - VMNetworkAdapterPerVM -VMSwitchName $name -OutDir $dir - } -} # VMSwitchDetail() - -function NetworkSummary { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $file = "Get-VMSwitch.txt" - $out = (Join-Path -Path $OutDir -ChildPath $file) - [String []] $cmds = "Get-VMSwitch | Sort-Object Name", - "Get-VMSwitch | Sort-Object Name | Format-Table -Property * -AutoSize | Out-String -Width $columns" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "Get-VMNetworkAdapter.txt" - $out = (Join-Path -Path $OutDir -ChildPath $file) - [String []] $cmds = "Get-VMNetworkAdapter -All | Sort-Object Name | Format-Table -AutoSize", - "Get-VMNetworkAdapter -All | Sort-Object Name | Format-Table -Property * -AutoSize | Out-String -Width $columns" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "Get-NetAdapter.txt" - $out = (Join-Path -Path $OutDir -ChildPath $file) - [String []] $cmds = "Get-NetAdapter -IncludeHidden | Sort-Object InterfaceDescription | Format-Table -AutoSize", - "Get-NetAdapter -IncludeHidden | Sort-Object InterfaceDescription | Format-Table -Property * -AutoSize | Out-String -Width $columns" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "Get-NetAdapterStatistics.txt" - $out = (Join-Path -Path $OutDir -ChildPath $file) - [String []] $cmds = "Get-NetAdapterStatistics -IncludeHidden | Sort-Object InterfaceDescription | Format-Table -Autosize | Out-String -Width $columns", - "Get-NetAdapterStatistics -IncludeHidden | Sort-Object InterfaceDescription | Format-Table -Property * -Autosize | Out-String -Width $columns" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "Get-NetLbfoTeam.txt" - $out = (Join-Path -Path $OutDir -ChildPath $file) - [String []] $cmds = "Get-NetLbfoTeam | Sort-Object InterfaceDescription", - "Get-NetLbfoTeam | Sort-Object InterfaceDescription | Format-Table -Property * -AutoSize | Out-String -Width $columns" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "Get-NetIpAddress.txt" - $out = (Join-Path -Path $OutDir -ChildPath $file) - [String []] $cmds = "Get-NetIpAddress | Format-Table -Autosize", - "Get-NetIpAddress | Format-Table -Property * -AutoSize | Out-String -Width $columns" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "ipconfig.txt" - $out = (Join-Path -Path $OutDir -ChildPath $file) - [String []] $cmds = "ipconfig", - "ipconfig /allcompartments /all" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } -} # NetworkSummary() - -function SMBDetail { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $dir = (Join-Path -Path $OutDir -ChildPath ("SMB")) - New-Item -ItemType directory -Path $dir | Out-Null - - $file = "Get-SmbClientNetworkInterface.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-SmbClientNetworkInterface | Sort-Object FriendlyName | Format-Table -AutoSize | Out-String -Width $columns", - "Get-SmbClientNetworkInterface | Format-List -Property *", - "Get-SmbClientNetworkInterface | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-SmbServerNetworkInterface.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-SmbServerNetworkInterface | Sort-Object FriendlyName | Format-Table -AutoSize | Out-String -Width $columns", - "Get-SmbServerNetworkInterface | Format-List -Property *", - "Get-SmbServerNetworkInterface | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-SmbClientConfiguration.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-SmbClientConfiguration", - "Get-SmbClientConfiguration | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-SmbMultichannelConnection.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-SmbMultichannelConnection | Sort-Object Name | Format-Table -AutoSize | Out-String -Width $columns", - "Get-SmbMultichannelConnection -IncludeNotSelected | Format-List -Property *", - "Get-SmbMultichannelConnection -SmbInstance CSV -IncludeNotSelected | Format-List -Property *", - "Get-SmbMultichannelConnection -SmbInstance SBL -IncludeNotSelected | Format-List -Property *", - "Get-SmbMultichannelConnection | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-SmbMultichannelConstraint.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-SmbMultichannelConstraint", - "Get-SmbMultichannelConstraint | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Smb-WindowsEvents.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-WinEvent -ListLog ""*SMB*"" | Format-List -Property *", - "Get-WinEvent -ListLog ""*SMB*"" | Get-WinEvent | ? Message -like ""*RDMA*"" | Format-List -Property *" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } -} # SMBDetail() - -function NetSetupDetail { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $dir = (Join-Path -Path $OutDir -ChildPath ("NetSetup")) - New-Item -ItemType directory -Path $dir | Out-Null - - $file = "NetSetup.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Test-Path $env:SystemRoot\System32\NetSetupMig.log", - "Test-Path $env:SystemRoot\Panther\setupact.log", - "Test-Path $env:SystemRoot\INF\setupapi.*", - "Test-Path $env:SystemRoot\logs\NetSetup" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - # Copy over the logs - [String []] $cmds = "$env:SystemRoot\System32\NetSetupMig.log", - "$env:SystemRoot\Panther\setupact.log", - "$env:SystemRoot\INF\setupapi.*", - "$env:SystemRoot\logs\NetSetup" - ForEach($cmd in $cmds) { - if (Test-Path $cmd) { - $tcmd = "Copy-Item $cmd $dir -recurse -verbose 4>&1" - ExecCommand -Trusted -Command ($tcmd) -Output $out - } - } -} # NetSetupDetail() - -function HNSDetail { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $dir = (Join-Path -Path $OutDir -ChildPath "HNS") - New-Item -ItemType Directory -Path $dir | Out-Null - - $file = "HNSRegistry-1.txt" - $out = (Join-Path $dir $file) - [String []] $cmds = "Get-ChildItem HKLM:\SYSTEM\CurrentControlSet\Services\hns -Recurse", - "Get-ChildItem HKLM:\SYSTEM\CurrentControlSet\Services\vmsmp -Recurse" - foreach ($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-HNSNetwork-1.txt" - $out = (Join-Path $dir $file) - [String []] $cmds = "Get-HNSNetwork | ConvertTo-Json -Depth 10", - "Get-HNSNetwork | Get-Member" - foreach ($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-HNSEndpoint-1.txt" - $out = (Join-Path $dir $file) - [String []] $cmds = "Get-HNSEndpoint | ConvertTo-Json -Depth 10", - "Get-HNSEndpoint | Get-Member" - foreach ($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - # HNS service stop -> start occurs after capturing the current HNS state info. - $hnsRunning = (Get-Service hns).Status -eq "Running" - try { - if ($hnsRunning) { - # Force stop to avoid command line prompt - net stop hns /y - } - - $file = "HNSData.txt" - $out = (Join-Path $dir $file) - [String []] $cmds = "Copy-Item ""$env:ProgramData\Microsoft\Windows\HNS\HNS.data"" $dir 4>&1" - foreach ($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - } finally { - if ($hnsRunning) { - net start hns - } - } - - - # Acquire all settings again after stop -> start services - $file = "HNSRegistry-2.txt" - $out = (Join-Path $dir $file) - [String []] $cmds = "Get-ChildItem HKLM:\SYSTEM\CurrentControlSet\Services\hns -Recurse", - "Get-ChildItem HKLM:\SYSTEM\CurrentControlSet\Services\vmsmp -Recurse" - foreach ($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-HNSNetwork-2.txt" - $out = (Join-Path $dir $file) - [String []] $cmds = "Get-HNSNetwork | ConvertTo-Json -Depth 10", - "Get-HNSNetwork | Get-Member" - foreach ($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-HNSEndpoint-2.txt" - $out = (Join-Path $dir $file) - [String []] $cmds = "Get-HNSEndpoint | ConvertTo-Json -Depth 10", - "Get-HNSEndpoint | Get-Member" - foreach ($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - - #netsh trace start scenario=Virtualization provider=Microsoft-Windows-tcpip provider=Microsoft-Windows-winnat capture=yes captureMultilayer=yes capturetype=both report=disabled tracefile=$dir\server.etl overwrite=yes - #Start-Sleep 120 - #netsh trace stop -} # HNSDetail() - -function QosDetail { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $dir = (Join-Path -Path $OutDir -ChildPath ("NetQoS")) - New-Item -ItemType directory -Path $dir | Out-Null - - $file = "Get-NetQosDcbxSetting.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetQosDcbxSetting", - "Get-NetQosDcbxSetting | Format-List -Property *", - "Get-NetQosDcbxSetting | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetQosDcbxSetting | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "Get-NetQosFlowControl.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetQosFlowControl", - "Get-NetQosFlowControl | Format-List -Property *", - "Get-NetQosFlowControl | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetQosFlowControl | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "Get-NetQosPolicy.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetQosPolicy", - "Get-NetQosPolicy | Format-List -Property *", - "Get-NetQosPolicy | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetQosPolicy | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "Get-NetQosTrafficClass.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-NetQosTrafficClass", - "Get-NetQosTrafficClass | Format-List -Property *", - "Get-NetQosTrafficClass | Format-Table -Property * -AutoSize | Out-String -Width $columns", - "Get-NetQosTrafficClass | Get-Member" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } -} # QosDetail() - -function ServicesDrivers { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $dir = (Join-Path -Path $OutDir -ChildPath ("ServicesDrivers")) - New-Item -ItemType directory -Path $dir | Out-Null - - $file = "sc.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "sc.exe queryex vmsp", - "sc.exe queryex vmsproxy" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "Get-Service.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-Service ""*"" | Sort-Object Name | Format-Table -AutoSize", - "Get-Service ""*"" | Sort-Object Name | Format-Table -Property * -AutoSize" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "Get-WindowsDriver.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-WindowsDriver -Online -All" # very slow, -Trusted to skip validation - ForEach($cmd in $cmds) { - ExecCommand -Trusted -Command $cmd -Output $out - } - - $file = "Get-WindowsEdition.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-WindowsEdition -Online" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "Get-WmiObject.Win32_PnPSignedDriver.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-WmiObject Win32_PnPSignedDriver| select devicename, driverversion" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } -} # ServicesDrivers() - -function NetshTrace { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $dir = (Join-Path -Path $OutDir -ChildPath ("Netsh")) - New-Item -ItemType directory -Path $dir | Out-Null - - <# Deprecated / DELETEME - #Figure out how to get this netsh rundown command executing under Powershell with logging... - $ndiswpp = "{DD7A21E6-A651-46D4-B7C2-66543067B869}" - $vmswpp = "{1F387CBC-6818-4530-9DB6-5F1058CD7E86}" - netsh trace start provider=$vmswpp level=1 keywords=0x00010000 provider=$ndiswpp level=1 keywords=0x02 correlation=disabled report=disabled overwrite=yes tracefile=$dir\NetRundown.etl - netsh trace stop - #> - - #$wpp_vswitch = "{1F387CBC-6818-4530-9DB6-5F1058CD7E86}" - #$wpp_ndis = "{DD7A21E6-A651-46D4-B7C2-66543067B869}" - - - # The sequence below triggers the ETW providers to dump their internal traces when the session starts. Thus allowing for capturing a - # snapshot of their logs/traces. - # - # NOTE: This does not cover IFR (in-memory) traces. More work needed to address said traces. - $file = "NetRundown.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "New-NetEventSession NetRundown -CaptureMode SaveToFile -LocalFilePath $dir\NetRundown.etl", - "Add-NetEventProvider ""{1F387CBC-6818-4530-9DB6-5F1058CD7E86}"" -SessionName NetRundown -Level 1 -MatchAnyKeyword 0x10000", - "Add-NetEventProvider ""{DD7A21E6-A651-46D4-B7C2-66543067B869}"" -SessionName NetRundown -Level 1 -MatchAnyKeyword 0x2", - "Start-NetEventSession NetRundown", - "Stop-NetEventSession NetRundown", - "Remove-NetEventSession NetRundown" - ForEach($cmd in $cmds) { - ExecCommand -Trusted -Command $cmd -Output $out - } - - # - # The ETL file can be converted to text using the following command: - # netsh trace convert NetRundown.etl tmfpath=\\winbuilds\release\RS_ONECORE_STACK_SDN_DEV1\15014.1001.170117-1700\amd64fre\symbols.pri\TraceFormat - # Specifying a path to the TMF symbols. Output is attached. - - $file = "NetshDump.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "netsh dump" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "NetshStatistics.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "netsh interface ipv4 show icmpstats", - "netsh interface ipv4 show ipstats", - "netsh interface ipv4 show tcpstats", - "netsh interface ipv4 show udpstats", - "netsh interface ipv6 show ipstats", - "netsh interface ipv6 show tcpstats", - "netsh interface ipv6 show udpstats" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - #NetSetup, binding map, setupact logs amongst other things needed by NDIS folks. - Write-Host "`n" - Write-Host "Processing..." - $file = "NetshTrace.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "netsh -?", - "netsh trace show scenarios", - "netsh trace show providers", - "netsh trace diagnose scenario=NetworkSnapshot mode=Telemetry saveSessionTrace=yes report=yes ReportFile=$dir\Snapshot.cab" - ForEach($cmd in $cmds) { - ExecCommand -Trusted -Command $cmd -Output $out - } -} # NetshTrace() - -function OneX { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $dir = (Join-Path -Path $OutDir -ChildPath ("OneX")) - New-Item -ItemType directory -Path $dir | Out-Null - - $file = "OneX.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "netsh lan show interface", - "netsh lan show profile" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } -} - -function Counters { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $dir = (Join-Path -Path $OutDir -ChildPath ("Counters")) - New-Item -ItemType directory -Path $dir | Out-Null - - $file = "CounterSetName.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-Counter -ListSet * | Sort-Object CounterSetName | Select-Object CounterSetName | Out-String -Width $columns" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "CounterSetName.Paths.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "(Get-Counter -ListSet * | Sort-Object CounterSetName).Paths | Out-String -Width $columns" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "CounterSetName.PathsWithInstances.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "(Get-Counter -ListSet * | Sort-Object CounterSetName).PathsWithInstances | Out-String -Width $columns" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "CounterSet.Property.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "(Get-Counter -ListSet * | Sort-Object CounterSetName) | Format-List -Property * | Out-String -Width $columns", - "(Get-Counter -ListSet * | Sort-Object CounterSetName) | Format-Table -Property * | Out-String -Width $columns" - ForEach($cmd in $cmds) { - ExecCommand -Command $cmd -Output $out - } - - $file = "CounterDetail" # used with 2 different extensions - $out = (Join-Path -Path $dir -ChildPath $file) - # Get paths for counters of interest - $cntrList = @("*Hyper*", "*vfp*", "*ip*", "*udp*", "*tcp*", "*icmp*", "*nat*", "*network*", "*rdma*", "*smb*", "*wfp*", "*Mellanox*", "*intel*") - $cntrPaths = Get-Counter -ListSet $cntrList -ErrorAction SilentlyContinue | Sort-Object CounterSetName | ForEach-Object { $_.Paths } - - Write-Host "Querying Perf Counters..." - # TODO should keep taking samples until all other jobs complete - $cntrReadings = Get-Counter -Counter $cntrPaths -MaxSamples 5 -SampleInterval 10 -ErrorAction SilentlyContinue - Write-Host "Exporting Results..." - $cntrReadings | Export-Counter -Path "$out.blg" -FileFormat BLG - $cntrReadings | Export-Counter -Path "$out.csv" -FileFormat CSV -} # Counters() - -function HwErrorReport { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $file = "WER.txt" - $out = (Join-Path -Path $OutDir -ChildPath $file) - [String []] $cmds = "copy-item $env:ProgramData\Microsoft\Windows\WER $outdir -recurse -verbose 4>&1" - ForEach($cmd in $cmds) { - ExecCommand -Trusted -Command ($cmd) -Output $out - } -} # HwErrorReport() - -function LogsReport { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $file = "WinEVT.txt" - $out = (Join-Path -Path $OutDir -ChildPath $file) - [String []] $cmds = "Copy-Item $env:SystemRoot\System32\winevt $outdir -Recurse -Verbose 4>&1" - ForEach($cmd in $cmds) { - ExecCommand -Trusted -Command ($cmd) -Output $out - } -} # LogsReport() - -function Metadata { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir, - [parameter(Mandatory=$true)] [Hashtable] $Params - ) - - $paramStr = if ($Params.Count -eq 0) {"None"} else {Write-Output @Params} - - $file = "Metadata.txt" - $out = (Join-Path -Path $OutDir -ChildPath $file) - [String []] $cmds = "Write-Output ""Version: $version"", ""Parameters: $paramStr"" | Out-String -Width $columns", - "Get-FileHash -Path $PSCommandPath -Algorithm ""SHA256"" | Format-List -Property * | Out-String -Width $columns" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } -} # Metadata() - -function Environment { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $file = "Environment.txt" - $out = (Join-Path -Path $OutDir -ChildPath $file) - [String []] $cmds = "Get-ItemProperty -Path ""HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion""", - "date", - #"Get-WinEvent -ProviderName eventlog | Where-Object {$_.Id -eq 6005 -or $_.Id -eq 6006}", - "wmic os get lastbootuptime", - "wmic cpu get name", - "systeminfo" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Verifier.txt" - $out = (Join-Path -Path $OutDir -ChildPath $file) - [String []] $cmds = "verifier /querysettings" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } -} # Environment() - -function HostInfo { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $file = "Get-HotFix.txt" - $out = (Join-Path -Path $OutDir -ChildPath $file) - [String []] $cmds = "get-hotfix | Sort-Object InstalledOn | Format-Table -AutoSize | Out-String -Width $columns", - "get-hotfix | Sort-Object InstalledOn | Format-Table -Property * -AutoSize | Out-String -Width $columns" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMHostSupportedVersion.txt" - $out = (Join-Path -Path $OutDir -ChildPath $file) - [String []] $cmds = "Get-VMHostSupportedVersion | Format-Table -AutoSize | Out-String -Width $columns", - "Get-VMHostSupportedVersion | Format-List -Property *" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - $file = "Get-VMHostNumaNode.txt" - $out = (Join-Path -Path $OutDir -ChildPath $file) - [String []] $cmds = "Get-VMHostNumaNode" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - - <# - $file = "Get-VMHostNumaNodeStatus.txt" - $out = (Join-Path -Path $OutDir -ChildPath $file) - [String []] $cmds = "Get-VMHostNumaNodeStatus" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - #> -} # HostInfo() - -function CustomModule { - [CmdletBinding()] - Param( - [parameter(Mandatory=$false)] [String[]] $Commands, - [parameter(Mandatory=$true)] [String] $OutDir - ) - - if ($Commands.Count -eq 0) { - return - } - - $dir = (Join-Path $OutDir "CustomModule") - New-Item -ItemType Directory -Path $dir | Out-Null - - $file = "ExtraCommands.txt" - $out = (Join-Path $dir $file) - foreach ($cmd in $Commands) { - ExecCommand -Command ($cmd -f $dir) -Output $out - } -} # CustomModule() - -# -# Setup & Validation Functions -# - -function CheckAdminPrivileges { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [Bool] $SkipAdminCheck - ) - - if (-not $SkipAdminCheck) { - # Yep, this is the easiest way to do this. - $isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") - if (-not $isAdmin) { - throw "Get-NetView : You do not have the required permission to complete this task. Please run this command in an Administrator PowerShell window or specify the -SkipAdminCheck option." - } - } -} # CheckAdminPrivileges() - -function NormalizeWorkDir { - [CmdletBinding()] - Param( - [parameter(Mandatory=$false)] [String] $OutputDirectory - ) - - # Output dir priority - $OutputDirectory, Desktop, Temp - $baseDir = if ($OutputDirectory) { - if (Test-Path $OutputDirectory) { - (Resolve-Path $OutputDirectory).Path # full path - } else { - throw "Get-NetView : The directory ""$OutputDirectory"" does not exist." - } - } elseif (($desktop = [Environment]::GetFolderPath("Desktop"))) { - $desktop - } else { - $env:TEMP - } - $workDirName = "msdbg.$env:COMPUTERNAME" - - return (Join-Path $baseDir $workDirName).TrimEnd("\") -} # NormalizeWorkDir() - -function EnvDestroy { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - If (Test-Path $OutDir) { - Remove-Item $OutDir -Recurse # Careful - Deletes $OurDir and all its contents - } -} # EnvDestroy() - -function EnvCreate { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - # Attempt to create working directory, fail gracefully otherwise - try { - New-Item -ItemType directory -Path $OutDir -ErrorAction Stop | Out-Null - } catch { - throw "Get-NetView : Failed to create directory ""$OutDir"" because " + $error[0] - } -} # EnvCreate() - -function EnvSetup { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - EnvDestroy $OutDir - EnvCreate $OutDir -} # EnvSetup() - -function CreateZip { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $Src, - [parameter(Mandatory=$true)] [String] $Out - ) - - If(Test-path $Out) { - Remove-item $Out - } - - Add-Type -assembly "system.io.compression.filesystem" - [io.compression.zipfile]::CreateFromDirectory($Src, $Out) -} # CreateZip() - - -function Sanity { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $OutDir - ) - - $dir = (Join-Path -Path $OutDir -ChildPath ("Sanity")) - New-Item -ItemType directory -Path $dir | Out-Null - - $file = "Get-ChildItem.txt" - $out = (Join-Path -Path $dir -ChildPath $file) - [String []] $cmds = "Get-ChildItem -Path $OutDir -Exclude $file -Recurse | Get-FileHash | Format-Table -AutoSize | Out-String -Width $columns" - ForEach($cmd in $cmds) { - ExecCommand -Command ($cmd) -Output $out - } - -} # Sanity() - -function Completion { - [CmdletBinding()] - Param( - [parameter(Mandatory=$true)] [String] $Src - ) - - $timestamp = $start | Get-Date -f yyyy.MM.dd_hh.mm.ss - - # Zip output folder - $outzip = "$Src-$timestamp.zip" - CreateZip -Src $Src -Out $outzip - - $dirs = (Get-ChildItem $Src -Recurse | Measure-Object -Property length -Sum) # out folder size - $hash = (Get-FileHash -Path $MyInvocation.PSCommandPath -Algorithm "SHA256").Hash # script hash - - # Display version and file save location - Write-Host "`n" - Write-Host "Diagnostics Data:" - Write-Host "-----------------" - Write-Host "Get-NetView" - Write-Host "Version: $version" - Write-Host "SHA256: $(if ($hash) {$hash} else {"N/A"})" - Write-Host "" - Write-Host $outzip - Write-Host "Size: $("{0:N2} MB" -f ((Get-Item $outzip).Length / 1MB))" - Write-Host "" - Write-Host $Src - Write-Host "Size: $("{0:N2} MB" -f ($dirs.sum / 1MB))" - Write-Host "Dirs: $((Get-ChildItem $Src -Directory -Recurse | Measure-Object).Count)" - Write-Host "Files: $((Get-ChildItem $Src -File -Recurse | Measure-Object).Count)" - Write-Host "" - Write-Host "Execution Time:" - Write-Host "---------------" - $delta = (Get-Date) - $Start - Write-Host "$($delta.Minutes) Min $($delta.Seconds) Sec" - Write-Host "`n" -} # Completion() - - -#=============================================== -# Main Program -#=============================================== -function Get-NetView { - [CmdletBinding()] - Param( - [parameter(Mandatory=$false)] - [ValidateScript({Test-Path $_ -PathType Container})] - [String] $OutputDirectory, - - [parameter(Mandatory=$false)] - [String[]] $ExtraCommands, - - [parameter(Mandatory=$false)] - [Switch] $SkipAdminCheck - ) - - $start = Get-Date - $version = "2018.05.03.0m" # Version within date context - - # Input Validation - CheckAdminPrivileges $SkipAdminCheck - $workDir = NormalizeWorkDir -OutputDirectory $OutputDirectory - - EnvSetup $workDir - Clear-Host - - # Start Run - try { - CustomModule -OutDir $workDir -Commands $ExtraCommands - - # concurrent execution of slow commands - $threads = if ($true) { - Start-Thread ${function:ServicesDrivers} -Params @{OutDir=$workDir} - Start-Thread ${function:NetshTrace} -Params @{OutDir=$workDir} - Start-Thread ${function:Counters} -Params @{OutDir=$workDir} - } - - Metadata -OutDir $workDir -Params $PSBoundParameters - Environment -OutDir $workDir - - NetworkSummary -OutDir $workDir - HwErrorReport -OutDir $workDir - LogsReport -OutDir $workDir - - NetSetupDetail -OutDir $workDir - VMSwitchDetail -OutDir $workDir - LbfoDetail -OutDir $workDir - NativeNicDetail -OutDir $workDir - OneX -OutDir $workDir - - QosDetail -OutDir $workDir - SMBDetail -OutDir $workDir - NetIp -OutDir $workDir - NetNat -OutDir $workDir - HNSDetail -OutDir $workDir - - # show thread output - $threads | foreach {StreamThread $_} - - # Tamper Detection - Sanity -OutDir $workDir - } catch { - throw $error[0] # try finally obfuscates error - } finally { - Write-Host "Removing background threads..." - $threads | foreach {Remove-Thread $_} - } - - Completion -Src $workDir -} # Get-NetView() diff --git a/newton-cn/bin/Modules/NetDiagnostics/NetDiagnostics.psd1 b/newton-cn/bin/Modules/NetDiagnostics/NetDiagnostics.psd1 deleted file mode 100644 index afa3069..0000000 --- a/newton-cn/bin/Modules/NetDiagnostics/NetDiagnostics.psd1 +++ /dev/null @@ -1,122 +0,0 @@ -# -# Module manifest for module 'Get-NetView' -# -# Generated by: Microsoft Corporation -# -# Generated on: 12/11/2017 -# - -@{ - -# Script module or binary module file associated with this manifest. -# RootModule = '' - -# Version number of this module. -ModuleVersion = '1.0.0.0' - -# Supported PSEditions -CompatiblePSEditions = @('Desktop') - -# ID used to uniquely identify this module -GUID = 'dfe3b632-99cf-4998-b06c-fdc71b4f2db3' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '© Microsoft Corporation. All rights reserved.' - -# Description of the functionality provided by this module -# Description = '' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '5.1' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the Windows PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. -# CLRVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -NestedModules = @('Get-NetView.psm1') - -# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. -FunctionsToExport = @('Get-NetView') - -# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. -CmdletsToExport = @() - -# Variables to export from this module -VariablesToExport = '' - -# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. -AliasesToExport = @() - -# DSC resources to export from this module -# DscResourcesToExport = @() - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -# FileList = @() - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - # Tags = @() - - # A URL to the license for this module. - # LicenseUri = '' - - # A URL to the main website for this project. - # ProjectUri = '' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - # ReleaseNotes = '' - - } # End of PSData hashtable - -} # End of PrivateData hashtable - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -} diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventNetworkAdapter.cdxml b/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventNetworkAdapter.cdxml deleted file mode 100644 index 04d6ad3..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventNetworkAdapter.cdxml +++ /dev/null @@ -1,96 +0,0 @@ - - - - 1.1 - NetEventNetworkAdapter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventNetworkAdapter.format.ps1xml b/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventNetworkAdapter.format.ps1xml deleted file mode 100644 index b0f64f9..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventNetworkAdapter.format.ps1xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - MSFT_NetEventNetworkAdapter_ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventNetworkAdapter - - - - - - - Name - - - InterfaceDescription - - - ProviderName - - - CaptureStatus - - - - - - - - MSFT_NetEventNetworkAdapter_TableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventNetworkAdapter - - - - - 10 - - - 15 - - - 15 - - - 10 - - - - - - - Name - - - InterfaceDescription - - - ProviderName - - - CaptureStatus - - - - - - - - diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventPacketCaptureProvider.cdxml b/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventPacketCaptureProvider.cdxml deleted file mode 100644 index b3bdcdd..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventPacketCaptureProvider.cdxml +++ /dev/null @@ -1,199 +0,0 @@ - - - - 1.0 - NetEventPacketCaptureProvider - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventPacketCaptureProvider.format.ps1xml b/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventPacketCaptureProvider.format.ps1xml deleted file mode 100644 index 4974b5c..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventPacketCaptureProvider.format.ps1xml +++ /dev/null @@ -1,152 +0,0 @@ - - - - - MSFT_NetEventPacketCaptureProvider_ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventPacketCaptureProvider - - - - - - - Name - - - SessionName - - - Level - - - MatchAnyKeyword - - - MatchAllKeyword - - - CaptureType - - - VmCaptureDirection - - - MultiLayer - - - LinkLayerAddress - - - EtherType - - - IpAddresses - - - IpProtocols - - - TruncationLength - - - - - - - - MSFT_NetEventPacketCaptureProvider_TableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventPacketCaptureProvider - - - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - - - - - Name - - - SessionName - - - Level - - - MatchAnyKeyword - - - MatchAllKeyword - - - CaptureType - - - VmCaptureDirection - - - MultiLayer - - - LinkLayerAddress - - - EtherType - - - IpAddresses - - - IpProtocols - - - TruncationLength - - - - - - - - diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventProvider.cdxml b/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventProvider.cdxml deleted file mode 100644 index 61f3aba..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventProvider.cdxml +++ /dev/null @@ -1,144 +0,0 @@ - - - - 1.0 - NetEventProvider - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventProvider.format.ps1xml b/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventProvider.format.ps1xml deleted file mode 100644 index 263b32e..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventProvider.format.ps1xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - MSFT_NetEventProvider_ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventProvider - - - - - - - Name - - - SessionName - - - Level - - - MatchAnyKeyword - - - MatchAllKeyword - - - - - - - - MSFT_NetEventProvider_TableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventProvider - - - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - - - - - Name - - - SessionName - - - Level - - - MatchAnyKeyword - - - MatchAllKeyword - - - - - - - - diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventSession.cdxml b/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventSession.cdxml deleted file mode 100644 index 9de435a..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventSession.cdxml +++ /dev/null @@ -1,163 +0,0 @@ - - - - 1.0 - NetEventSession - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventSession.format.ps1xml b/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventSession.format.ps1xml deleted file mode 100644 index 65342cc..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventSession.format.ps1xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - MSFT_NetEventSession_ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventSession - - - - - - - Name - - - CaptureMode - - - LocalFilePath - - - MaxFileSize - - - TraceBufferSize - - - MaxNumberOfBuffers - - - SessionStatus - - - - - - - - MSFT_NetEventSession_TableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventSession - - - - - 10 - - - 15 - - - 15 - - - 17 - - - 14 - - - 8 - - - 10 - - - - - - - Name - - - CaptureMode - - - LocalFilePath - - - MaxFileSize - - - TraceBufferSize - - - MaxNumberOfBuffers - - - SessionStatus - - - - - - - - diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVFPProvider.cdxml b/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVFPProvider.cdxml deleted file mode 100644 index e32b38e..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVFPProvider.cdxml +++ /dev/null @@ -1,294 +0,0 @@ - - - - 1.0 - NetEventVFPProvider - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVFPProvider.format.ps1xml b/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVFPProvider.format.ps1xml deleted file mode 100644 index 7e7ee55..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVFPProvider.format.ps1xml +++ /dev/null @@ -1,194 +0,0 @@ - - - - - MSFT_NetEventVFPProvider_ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventVFPProvider - - - - - - - SessionName - - - Level - - - MatchAnyKeyword - - - MatchAllKeyword - - - DestinationMACAddresses - - - SourceMACAddresses - - - VLANIds - - - GREKeys - - - TenantIds - - - SourceIPAddresses - - - DestinationIPAddresses - - - IPProtocols - - - TCPPorts - - - UDPPorts - - - VFPFlowDirection - - - SwitchName - - - PortIds - - - - - - - - MSFT_NetEventVFPProvider_TableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventVFPProvider - - - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - - - - - Name - - - SessionName - - - Level - - - MatchAnyKeyword - - - MatchAllKeyword - - - DestinationMACAddresses - - - SourceMACAddresses - - - VLANIds - - - GREKeys - - - TenantIds - - - SourceIPAddresses - - - DestinationIPAddresses - - - IPProtocols - - - TCPPorts - - - UDPPorts - - - VFPFlowDirection - - - SwitchName - - - PortIds - - - - - - - - diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVmNetworkAdatper.cdxml b/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVmNetworkAdatper.cdxml deleted file mode 100644 index d5d5538..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVmNetworkAdatper.cdxml +++ /dev/null @@ -1,85 +0,0 @@ - - - - 1.0 - NetEventVmNetworkAdapter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVmNetworkAdatper.format.ps1xml b/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVmNetworkAdatper.format.ps1xml deleted file mode 100644 index 4979229..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVmNetworkAdatper.format.ps1xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - MSFT_NetEventVmNetworkAdapter_ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventVmNetworkAdapter - - - - - - - Name - - - ProviderName - - - MacAddress - - - SwitchName - - - PortName - - - VMName - - - CaptureStatus - - - - - - - - MSFT_NetEventVmNetworkAdapter_TableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventVmNetworkAdapter - - - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - - - - - Name - - - ProviderName - - - MacAddress - - - SwitchName - - - PortName - - - VMName - - - CaptureStatus - - - - - - - - diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitch.cdxml b/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitch.cdxml deleted file mode 100644 index c28520a..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitch.cdxml +++ /dev/null @@ -1,85 +0,0 @@ - - - - 1.0 - NetEventVmSwitch - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitch.format.ps1xml b/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitch.format.ps1xml deleted file mode 100644 index d58ca7d..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitch.format.ps1xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - MSFT_NetEventVmSwitch_ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventVmSwitch - - - - - - - Name - - - ProviderName - - - CaptureStatus - - - - - - - - MSFT_NetEventVmSwitch_TableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventVmSwitch - - - - - 10 - - - 15 - - - 10 - - - - - - - Name - - - ProviderName - - - CaptureStatus - - - - - - - - diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitchProvider.cdxml b/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitchProvider.cdxml deleted file mode 100644 index 18c4a67..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitchProvider.cdxml +++ /dev/null @@ -1,133 +0,0 @@ - - - - 1.0 - NetEventVmSwitchProvider - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitchProvider.format.ps1xml b/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitchProvider.format.ps1xml deleted file mode 100644 index 7199a29..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitchProvider.format.ps1xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - MSFT_NetEventVmSwitchProvider_ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventVmSwitchProvider - - - - - - - SessionName - - - Level - - - MatchAnyKeyword - - - MatchAllKeyword - - - SwitchName - - - PortIds - - - - - - - - MSFT_NetEventVmSwitchProvider_TableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventVmSwitchProvider - - - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - - - - - Name - - - SessionName - - - Level - - - MatchAnyKeyword - - - MatchAllKeyword - - - SwitchName - - - PortIds - - - - - - - - diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventWFPCaptureProvider.cdxml b/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventWFPCaptureProvider.cdxml deleted file mode 100644 index 862d051..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventWFPCaptureProvider.cdxml +++ /dev/null @@ -1,147 +0,0 @@ - - - - 1.0 - NetEventWFPCaptureProvider - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventWFPCaptureProvider.format.ps1xml b/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventWFPCaptureProvider.format.ps1xml deleted file mode 100644 index c059bfd..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/MSFT_NetEventWFPCaptureProvider.format.ps1xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - MSFT_NetEventWFPCaptureProvider_ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventWFPCaptureProvider - - - - - - - Name - - - SessionName - - - Level - - - MatchAnyKeyword - - - MatchAllKeyword - - - CaptureLayerSet - - - IPAddresses - - - TCPPorts - - - UDPPorts - - - - - - - MSFT_NetEventWFPCaptureProvider_TableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventWFPCaptureProvider - - - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - 10 - - - - - - - Name - - - SessionName - - - Level - - - MatchAnyKeyword - - - MatchAllKeyword - - - CaptureLayerSet - - - IPAddresses - - - TCPPorts - - - UDPPorts - - - - - - - - diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/NetEventPacketCapture.Types.ps1xml b/newton-cn/bin/Modules/NetEventPacketCapture/NetEventPacketCapture.Types.ps1xml deleted file mode 100644 index b6faac8..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/NetEventPacketCapture.Types.ps1xml +++ /dev/null @@ -1,140 +0,0 @@ - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetEventSession - - - CaptureMode - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetEventPacketCapture.CaptureModes]($this.PSBase.CimInstanceProperties['CaptureMode'].Value) - - - param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetEventPacketCapture.CaptureModes]$value) - $this.PSBase.CimInstanceProperties['CaptureMode'].Value = [System.Byte]$value - - - - MaxFileSize - - "" + $this.PSBase.CimInstanceProperties['MaxFileSize'].Value + " MB" - - - - TraceBufferSize - - "" + $this.PSBase.CimInstanceProperties['TraceBufferSize'].Value + " KB" - - - - MaxNumberOfBuffers - - $this.PSBase.CimInstanceProperties['MaxNumberOfBuffers'].Value - - - - SessionStatus - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetEventPacketCapture.ESessionStatus]($this.PSBase.CimInstanceProperties['SessionStatus'].Value) - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetEventProvider - - - MatchAnyKeyword - - "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAnyKeyword'].Value - - - - MatchAllKeyword - - "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAllKeyword'].Value - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetEventPacketCaptureProvider - - - MatchAnyKeyword - - "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAnyKeyword'].Value - - - - MatchAllKeyword - - "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAllKeyword'].Value - - - - CaptureType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetEventPacketCapture.CaptureType]($this.PSBase.CimInstanceProperties['CaptureType'].Value) - - - param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetEventPacketCapture.CaptureType]$value) - $this.PSBase.CimInstanceProperties['CaptureType'].Value = [System.Byte]$value - - - - VmCaptureDirection - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetEventPacketCapture.VmCaptureDirection]($this.PSBase.CimInstanceProperties['VmCaptureDirection'].Value) - - - param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetEventPacketCapture.VmCaptureDirection]$value) - $this.PSBase.CimInstanceProperties['VmCaptureDirection'].Value = [System.Byte]$value - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetEventVFPProvider - - - MatchAnyKeyword - - "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAnyKeyword'].Value - - - - MatchAllKeyword - - "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAllKeyword'].Value - - - - VFPFlowDirection - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetEventPacketCapture.VFPFlowDirection]($this.PSBase.CimInstanceProperties['VFPFlowDirection'].Value) - - - param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetEventPacketCapture.VFPFlowDirection]$value) - $this.PSBase.CimInstanceProperties['VFPFlowDirection'].Value = [System.UInt32]$value - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetEventVmSwitchProvider - - - MatchAnyKeyword - - "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAnyKeyword'].Value - - - - MatchAllKeyword - - "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAllKeyword'].Value - - - - - diff --git a/newton-cn/bin/Modules/NetEventPacketCapture/NetEventPacketCapture.psd1 b/newton-cn/bin/Modules/NetEventPacketCapture/NetEventPacketCapture.psd1 deleted file mode 100644 index e417155..0000000 --- a/newton-cn/bin/Modules/NetEventPacketCapture/NetEventPacketCapture.psd1 +++ /dev/null @@ -1,74 +0,0 @@ -@{ - GUID = "7E984F2F-35DA-48A2-A3C1-40CE59930A7C" - Author = "Microsoft Corporation" - CompanyName = "Microsoft Corporation" - Copyright = "© Microsoft Corporation. All rights reserved." - ModuleVersion = "1.0.0.0" - PowerShellVersion = '5.1' - HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=532774" - - NestedModules = @( - 'MSFT_NetEventSession.cdxml', - 'MSFT_NetEventProvider.cdxml', - 'MSFT_NetEventPacketCaptureProvider.cdxml', - 'MSFT_NetEventNetworkAdapter.cdxml', - 'MSFT_NetEventVmSwitch.cdxml', - 'MSFT_NetEventVmNetworkAdatper.cdxml', - 'MSFT_NetEventWFPCaptureProvider.cdxml', - 'MSFT_NetEventVFPProvider.cdxml', - 'MSFT_NetEventVmSwitchProvider.cdxml') - - FormatsToProcess = @( - 'MSFT_NetEventSession.format.ps1xml', - 'MSFT_NetEventProvider.format.ps1xml', - 'MSFT_NetEventPacketCaptureProvider.format.ps1xml', - 'MSFT_NetEventNetworkAdapter.format.ps1xml', - 'MSFT_NetEventVmSwitch.format.ps1xml', - 'MSFT_NetEventVmNetworkAdatper.format.ps1xml', - 'MSFT_NetEventVFPProvider.format.ps1xml', - 'MSFT_NetEventVmSwitchProvider.format.ps1xml') - - TypesToProcess = @('NetEventPacketCapture.Types.ps1xml') - - FunctionsToExport = @( - 'New-NetEventSession', - 'Remove-NetEventSession', - 'Get-NetEventSession', - 'Set-NetEventSession', - 'Start-NetEventSession', - 'Stop-NetEventSession', - 'Add-NetEventProvider', - 'Remove-NetEventProvider', - 'Get-NetEventProvider', - 'Set-NetEventProvider', - 'Add-NetEventPacketCaptureProvider', - 'Remove-NetEventPacketCaptureProvider', - 'Get-NetEventPacketCaptureProvider', - 'Set-NetEventPacketCaptureProvider', - 'Add-NetEventNetworkAdapter', - 'Remove-NetEventNetworkAdapter', - 'Get-NetEventNetworkAdapter', - 'Add-NetEventVmNetworkAdapter', - 'Remove-NetEventVmNetworkAdapter', - 'Get-NetEventVmNetworkAdapter', - 'Add-NetEventVmSwitch', - 'Remove-NetEventVmSwitch', - 'Get-NetEventVmSwitch', - 'Add-NetEventWFPCaptureProvider', - 'Remove-NetEventWFPCaptureProvider', - 'Get-NetEventWFPCaptureProvider', - 'Set-NetEventWFPCaptureProvider', - 'Add-NetEventVFPProvider', - 'Remove-NetEventVFPProvider', - 'Get-NetEventVFPProvider', - 'Set-NetEventVFPProvider', - 'Add-NetEventVmSwitchProvider', - 'Remove-NetEventVmSwitchProvider', - 'Get-NetEventVmSwitchProvider', - 'Set-NetEventVmSwitchProvider') - - CmdletsToExport = @() - - AliasesToExport = @() - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/NetLbfo/MSFT_NetLbfoTeam.cdxml b/newton-cn/bin/Modules/NetLbfo/MSFT_NetLbfoTeam.cdxml deleted file mode 100644 index 08588b1..0000000 --- a/newton-cn/bin/Modules/NetLbfo/MSFT_NetLbfoTeam.cdxml +++ /dev/null @@ -1,161 +0,0 @@ - - - - 1.0 - NetLbfoTeam - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetLbfo/MSFT_NetLbfoTeam.format.ps1xml b/newton-cn/bin/Modules/NetLbfo/MSFT_NetLbfoTeam.format.ps1xml deleted file mode 100644 index 3079479..0000000 --- a/newton-cn/bin/Modules/NetLbfo/MSFT_NetLbfoTeam.format.ps1xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - MSFT_NetLbfoTeam_ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetLbfoTeam - - - - - - - Name - - - Members - - - TeamNics - - - TeamingMode - - - LoadBalancingAlgorithm - - - - ($_.LacpTimer -ne $null) - - LacpTimer - - - Status - - - - - - - - MSFT_NetLbfoTeam_TableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetLbfoTeam - - - - - 10 - - - 15 - - - 15 - - - 17 - - - 14 - - - 8 - - - - - - - Name - - - Members - - - TeamNics - - - TeamingMode - - - LoadBalancingAlgorithm - - - Status - - - - - - - - diff --git a/newton-cn/bin/Modules/NetLbfo/MSFT_NetLbfoTeamMember.cdxml b/newton-cn/bin/Modules/NetLbfo/MSFT_NetLbfoTeamMember.cdxml deleted file mode 100644 index 877aaf3..0000000 --- a/newton-cn/bin/Modules/NetLbfo/MSFT_NetLbfoTeamMember.cdxml +++ /dev/null @@ -1,120 +0,0 @@ - - - - 1.0 - NetLbfoTeamMember - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetLbfo/MSFT_NetLbfoTeamMember.format.ps1xml b/newton-cn/bin/Modules/NetLbfo/MSFT_NetLbfoTeamMember.format.ps1xml deleted file mode 100644 index 6829773..0000000 --- a/newton-cn/bin/Modules/NetLbfo/MSFT_NetLbfoTeamMember.format.ps1xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - - MSFT_NetLbfoTeamMember_ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetLbfoTeamMember - - - - - - - Name - - - InterfaceDescription - - - Team - - - AdministrativeMode - - - OperationalStatus - - - - $_.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value -lt 1000000000 - - TransmitLinkSpeed(Mbps) - - - - $_.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value -ge 1000000000 - - TransmitLinkSpeed(Gbps) - - - - $_.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value -lt 1000000000 - - ReceiveLinkSpeed(Mbps) - - - - $_.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value -ge 1000000000 - - ReceiveLinkSpeed(Gbps) - - - FailureReason - - - - - - - - MSFT_NetLbfoTeamMember_TableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetLbfoTeamMember - - - - - 12 - - - 15 - - - 10 - - - 7 - - - 7 - - - 11 - - - 11 - - - 12 - - - - - - - Name - - - InterfaceDescription - - - Team - - - AdministrativeMode - - - OperationalStatus - - - TransmitLinkSpeed - - - ReceiveLinkSpeed - - - FailureReason - - - - - - - - diff --git a/newton-cn/bin/Modules/NetLbfo/MSFT_NetLbfoTeamNic.cdxml b/newton-cn/bin/Modules/NetLbfo/MSFT_NetLbfoTeamNic.cdxml deleted file mode 100644 index 2b4c168..0000000 --- a/newton-cn/bin/Modules/NetLbfo/MSFT_NetLbfoTeamNic.cdxml +++ /dev/null @@ -1,101 +0,0 @@ - - - - 1.0 - NetLbfoTeamNic - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetLbfo/MSFT_NetLbfoTeamNic.format.ps1xml b/newton-cn/bin/Modules/NetLbfo/MSFT_NetLbfoTeamNic.format.ps1xml deleted file mode 100644 index 9ab962d..0000000 --- a/newton-cn/bin/Modules/NetLbfo/MSFT_NetLbfoTeamNic.format.ps1xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - - MSFT_NetLbfoTeamNic_ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetLbfoTeamNic - - - - - - - Name - - - InterfaceDescription - - - Team - - - VlanID - - - Primary - - - Default - - - - $_.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value -lt 1000000000 - - TransmitLinkSpeed(Mbps) - - - - $_.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value -ge 1000000000 - - TransmitLinkSpeed(Gbps) - - - - $_.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value -lt 1000000000 - - ReceiveLinkSpeed(Mbps) - - - - $_.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value -ge 1000000000 - - ReceiveLinkSpeed(Gbps) - - - - - - - - MSFT_NetLbfoTeamNic_TableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetLbfoTeamNic - - - - - 12 - - - 15 - - - 10 - - - 6 - - - 7 - - - 7 - - - 11 - - - 11 - - - - - - - Name - - - InterfaceDescription - - - Team - - - VlanID - - - Primary - - - Default - - - TransmitLinkSpeed - - - ReceiveLinkSpeed - - - - - - - - diff --git a/newton-cn/bin/Modules/NetLbfo/NetLbfo.Types.ps1xml b/newton-cn/bin/Modules/NetLbfo/NetLbfo.Types.ps1xml deleted file mode 100644 index a000a87..0000000 --- a/newton-cn/bin/Modules/NetLbfo/NetLbfo.Types.ps1xml +++ /dev/null @@ -1,247 +0,0 @@ - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetLbfoTeam - - - Members - - $members = Get-NetLbfoTeamMember -TeamOfTheMember $this - $mnames= @() - foreach($m in @($members)){$mnames += $m.Name} - $mnames - - - - - TeamNics - - $tnics = Get-NetLbfoTeamNic -TeamOfTheTeamNic $this - $tnames= @() - foreach($t in @($tnics)){$tnames += $t.Name} - $tnames - - - - - TeamingMode - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.TeamingModes]($this.PSBase.CimInstanceProperties['TeamingMode'].Value) - - - param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.TeamingModes]$value) - $this.PSBase.CimInstanceProperties['TeamingMode'].Value = [System.UInt32]$value - - - - - LoadBalancingAlgorithm - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.LBAlgos]($this.PSBase.CimInstanceProperties['LoadBalancingAlgorithm'].Value) - - - param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.LBAlgos]$value) - $this.PSBase.CimInstanceProperties['LoadBalancingAlgorithm'].Value = [System.UInt32]$value - - - - - LacpTimer - - $lacpTimer = $this.PSBase.CimInstanceProperties['LacpTimer'].Value - if($lacpTimer -ne $null) - { - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.LacpTimers]$lacpTimer - } - else - { - $null - } - - - param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.LacpTimers]$value) - $this.PSBase.CimInstanceProperties['LacpTimer'].Value = [System.UInt32]$value - - - - - Status - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.TeamStatus]($this.PSBase.CimInstanceProperties['Status'].Value) - - - - - tm - TeamingMode - - - - lba - LoadBalancingAlgorithm - - - - lt - LacpTimer - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetLbfoTeamMember - - - AdministrativeMode - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.AdminModes]($this.PSBase.CimInstanceProperties['AdministrativeMode'].Value) - - - param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.AdminModes]$value) - $this.PSBase.CimInstanceProperties['AdministrativeMode'].Value = [System.UInt32]$value - - - - - OperationalStatus - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.OperationalModes]($this.PSBase.CimInstanceProperties['OperationalMode'].Value) - - - - - FailureReason - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.FailureReasons]($this.PSBase.CimInstanceProperties['FailureReason'].Value) - - - - - TransmitLinkSpeed - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-LinkSpeed $this.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value - - - - - TransmitLinkSpeed(Mbps) - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - $val = $this.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value / 1000000 - Format-LinkSpeed $val 1 $false - - - - - TransmitLinkSpeed(Gbps) - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - $val = $this.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value / 1000000000 - Format-LinkSpeed $val 1 $false - - - - - ReceiveLinkSpeed - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-LinkSpeed $this.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value - - - - - ReceiveLinkSpeed(Mbps) - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - $val = $this.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value / 1000000 - Format-LinkSpeed $val 1 $false - - - - - ReceiveLinkSpeed(Gbps) - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - $val = $this.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value / 1000000000 - Format-LinkSpeed $val 1 $false - - - - - am - AdministrativeMode - - - ifAlias - Name - - - InterfaceAlias - Name - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetLbfoTeamNic - - - TransmitLinkSpeed - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-LinkSpeed $this.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value - - - - TransmitLinkSpeed(Mbps) - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - $val = $this.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value / 1000000 - Format-LinkSpeed $val 1 $false - - - - TransmitLinkSpeed(Gbps) - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - $val = $this.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value / 1000000000 - Format-LinkSpeed $val 1 $false - - - - ReceiveLinkSpeed - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - Format-LinkSpeed $this.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value - - - - ReceiveLinkSpeed(Mbps) - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - $val = $this.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value / 1000000 - Format-LinkSpeed $val 1 $false - - - - ReceiveLinkSpeed(Gbps) - - Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 - $val = $this.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value / 1000000000 - Format-LinkSpeed $val 1 $false - - - - - ifAlias - Name - - - - InterfaceAlias - Name - - - - diff --git a/newton-cn/bin/Modules/NetLbfo/NetLbfo.psd1 b/newton-cn/bin/Modules/NetLbfo/NetLbfo.psd1 deleted file mode 100644 index 239cca8..0000000 --- a/newton-cn/bin/Modules/NetLbfo/NetLbfo.psd1 +++ /dev/null @@ -1,30 +0,0 @@ -@{ - GUID = "80cf4c6d-30b7-4b0f-a035-dbb23a65ef1d" - Author = "Microsoft Corporation" - CompanyName = "Microsoft Corporation" - Copyright = "© Microsoft Corporation. All rights reserved." - HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=285763" - ModuleVersion = "2.0.0.0" - PowerShellVersion = '5.1' - NestedModules = @('MSFT_NetLbfoTeam.cdxml', 'MSFT_NetLbfoTeamMember.cdxml', 'MSFT_NetLbfoTeamNic.cdxml') - FormatsToProcess = @('MSFT_NetLbfoTeam.format.ps1xml', 'MSFT_NetLbfoTeamMember.format.ps1xml', 'MSFT_NetLbfoTeamNic.format.ps1xml') - TypesToProcess = @('NetLbfo.Types.ps1xml') - FunctionsToExport = @( - 'Add-NetLbfoTeamMember', - 'Add-NetLbfoTeamNic', - 'Get-NetLbfoTeam', - 'Get-NetLbfoTeamMember', - 'Get-NetLbfoTeamNic', - 'New-NetLbfoTeam', - 'Remove-NetLbfoTeam', - 'Remove-NetLbfoTeamMember', - 'Remove-NetLbfoTeamNic', - 'Rename-NetLbfoTeam', - 'Set-NetLbfoTeam', - 'Set-NetLbfoTeamMember', - 'Set-NetLbfoTeamNic' - ) - CmdletsToExport = @() - AliasesToExport = @() - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/NetNat/MSFT_NetNat.Format.ps1xml b/newton-cn/bin/Modules/NetNat/MSFT_NetNat.Format.ps1xml deleted file mode 100644 index c0d417b..0000000 --- a/newton-cn/bin/Modules/NetNat/MSFT_NetNat.Format.ps1xml +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - MSFT_NetNat_Listview - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNat - - - - - - - Name - - - ExternalIPInterfaceAddressPrefix - - - InternalIPInterfaceAddressPrefix - - - IcmpQueryTimeout - - - TcpEstablishedConnectionTimeout - - - TcpTransientConnectionTimeout - - - TcpFilteringBehavior - - - UdpFilteringBehavior - - - UdpIdleSessionTimeout - - - UdpInboundRefresh - - - Store - - - Active - - - - - - - - - MSFT_NetNatExternalIPAddress_Listview - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNatExternalAddress - - - - - - - ExternalAddressID - - - NatName - - - IPAddress - - - PortStart - - - PortEnd - - - Active - - - - - - - - - MSFT_NetNatExternalIPAddressMapping_Listview - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNatStaticMapping - - - - - - - StaticMappingID - - - NatName - - - Protocol - - - RemoteExternalIPAddressPrefix - - - ExternalIPAddress - - - ExternalPort - - - InternalIPAddress - - - InternalPort - - - InternalRoutingDomainId - - - Active - - - - - - - - - MSFT_NetNatSession_Listview - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNatSession - - - - - - - NatName - - - InternalRoutingDomainId - - - CreationTime - - - Protocol - - - InternalSourceAddress - - - InternalSourcePort - - - InternalDestinationAddress - - - InternalDestinationPort - - - ExternalSourceAddress - - - ExternalSourcePort - - - ExternalDestinationAddress - - - ExternalDestinationPort - - - - - - - - - MSFT_NetNatGlobal_Listview - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNatGlobal - - - - - - - InterRoutingDomainHairpinningMode - - - - - - - - diff --git a/newton-cn/bin/Modules/NetNat/MSFT_NetNat.Types.ps1xml b/newton-cn/bin/Modules/NetNat/MSFT_NetNat.Types.ps1xml deleted file mode 100644 index ec71cd8..0000000 --- a/newton-cn/bin/Modules/NetNat/MSFT_NetNat.Types.ps1xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNat - - - Store - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.PolicyStore]($this.PSBase.CimInstanceProperties['Store'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Store'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.PolicyStore]$newValue - - - - TcpFilteringBehavior - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.FilteringBehaviorType]($this.PSBase.CimInstanceProperties['TcpFilteringBehavior'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['TcpFilteringBehavior'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.FilteringBehaviorType]$newValue - - - - UdpFilteringBehavior - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.FilteringBehaviorType]($this.PSBase.CimInstanceProperties['UdpFilteringBehavior'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['UdpFilteringBehavior'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.FilteringBehaviorType]$newValue - - - - UdpInboundRefresh - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.Boolean]($this.PSBase.CimInstanceProperties['UdpInboundRefresh'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['UdpInboundRefresh'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.Boolean]$newValue - - - - Active - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.Boolean]($this.PSBase.CimInstanceProperties['Active'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Active'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.Boolean]$newValue - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNatStaticMapping - - - Protocol - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNatStaticMapping.Protocol]($this.PSBase.CimInstanceProperties['Protocol'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Protocol'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNatStaticMapping.Protocol]$newValue - - - - Active - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.Boolean]($this.PSBase.CimInstanceProperties['Active'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Active'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.Boolean]$newValue - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNatExternalAddress - - - Active - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.Boolean]($this.PSBase.CimInstanceProperties['Active'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Active'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.Boolean]$newValue - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNatGlobal - - - InterRoutingDomainHairpinningMode - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNatGlobal.InterRoutingDomainHairpinningMode]($this.PSBase.CimInstanceProperties['InterRoutingDomainHairpinningMode'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['InterRoutingDomainHairpinningMode'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNatGlobal.InterRoutingDomainHairpinningMode]$newValue - - - - - diff --git a/newton-cn/bin/Modules/NetNat/MSFT_NetNat.cdxml b/newton-cn/bin/Modules/NetNat/MSFT_NetNat.cdxml deleted file mode 100644 index 179442b..0000000 --- a/newton-cn/bin/Modules/NetNat/MSFT_NetNat.cdxml +++ /dev/null @@ -1,131 +0,0 @@ - - - - 1.0 - NetNat - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetNat/MSFT_NetNatExternalAddress.cdxml b/newton-cn/bin/Modules/NetNat/MSFT_NetNatExternalAddress.cdxml deleted file mode 100644 index 7624655..0000000 --- a/newton-cn/bin/Modules/NetNat/MSFT_NetNatExternalAddress.cdxml +++ /dev/null @@ -1,77 +0,0 @@ - - - - 1.0 - NetNatExternalAddress - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetNat/MSFT_NetNatGlobal.cdxml b/newton-cn/bin/Modules/NetNat/MSFT_NetNatGlobal.cdxml deleted file mode 100644 index 27d6a3f..0000000 --- a/newton-cn/bin/Modules/NetNat/MSFT_NetNatGlobal.cdxml +++ /dev/null @@ -1,34 +0,0 @@ - - - - 1.0 - NetNatGlobal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetNat/MSFT_NetNatSession.cdxml b/newton-cn/bin/Modules/NetNat/MSFT_NetNatSession.cdxml deleted file mode 100644 index e9b8dde..0000000 --- a/newton-cn/bin/Modules/NetNat/MSFT_NetNatSession.cdxml +++ /dev/null @@ -1,15 +0,0 @@ - - - - 1.0 - NetNatSession - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetNat/MSFT_NetNatStaticMapping.cdxml b/newton-cn/bin/Modules/NetNat/MSFT_NetNatStaticMapping.cdxml deleted file mode 100644 index 72d50a2..0000000 --- a/newton-cn/bin/Modules/NetNat/MSFT_NetNatStaticMapping.cdxml +++ /dev/null @@ -1,99 +0,0 @@ - - - - 1.0 - NetNatStaticMapping - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetNat/NetNat.psd1 b/newton-cn/bin/Modules/NetNat/NetNat.psd1 deleted file mode 100644 index e568d15..0000000 --- a/newton-cn/bin/Modules/NetNat/NetNat.psd1 +++ /dev/null @@ -1,34 +0,0 @@ -@{ - GUID = 'E5439F56-42AA-4FDF-8705-50C782A89345' - Author = "Microsoft Corporation" - CompanyName = "Microsoft Corporation" - Copyright = "© Microsoft Corporation. All rights reserved." - ModuleVersion = '1.0.0.0' - PowerShellVersion = '5.1' - NestedModules = @( - 'MSFT_NetNat.cdxml', - 'MSFT_NetNatExternalAddress.cdxml', - 'MSFT_NetNatStaticMapping.cdxml', - 'MSFT_NetNatSession.cdxml' - 'MSFT_NetNatGlobal.cdxml' - ) - FormatsToProcess = @('MSFT_NetNat.Format.ps1xml') - TypesToProcess = @('MSFT_NetNat.Types.ps1xml') - HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=285219" - FunctionsToExport = @( - 'Get-NetNat', - 'Get-NetNatExternalAddress', - 'Get-NetNatStaticMapping', - 'Get-NetNatSession', - 'Get-NetNatGlobal', - 'Set-NetNat', - 'Set-NetNatGlobal', - 'New-NetNat', - 'Add-NetNatExternalAddress', - 'Add-NetNatStaticMapping', - 'Remove-NetNat', - 'Remove-NetNatExternalAddress', - 'Remove-NetNatStaticMapping' - ) - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/NetQos/MSFT_NetQosPolicy.Format.Helper.psm1 b/newton-cn/bin/Modules/NetQos/MSFT_NetQosPolicy.Format.Helper.psm1 deleted file mode 100644 index 9879fff..0000000 --- a/newton-cn/bin/Modules/NetQos/MSFT_NetQosPolicy.Format.Helper.psm1 +++ /dev/null @@ -1,25 +0,0 @@ -<# - -Copyright (c) 2011 Microsoft Corporation. All Rights Reserved. - -Module Name: - - MSFT_NetQosPolicy.Format.Helper.psm1 - -Description: - - Provides helper routines for formatting the output of NetQosPolicy cmdlets. - -#> - -function Format-NetQosPolicySpeed( - $Value, $Precision = 0 -) -{ - $Postfixes = @("Bits", "KBits", "MBits", "GBits", "TBits") - for ($i = 0; $Value -ge 1000 -and $i -lt $Postfixes.Length - 1; $i++) { - $Value /= 1000 - } - $Value = [Math]::Round([Decimal]$Value, $Precision) - return "$($Value) $($Postfixes[$i])/sec" -} diff --git a/newton-cn/bin/Modules/NetQos/MSFT_NetQosPolicy.Format.ps1xml b/newton-cn/bin/Modules/NetQos/MSFT_NetQosPolicy.Format.ps1xml deleted file mode 100644 index 7bc35af..0000000 --- a/newton-cn/bin/Modules/NetQos/MSFT_NetQosPolicy.Format.ps1xml +++ /dev/null @@ -1,149 +0,0 @@ - - - - - MSFT_NetQosPolicy ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetQosPolicySettingData - - - - - - - Name - - - Owner - - - NetworkProfile - - - Precedence - - - - $_.UserMatchCondition -ne $null - - User - - - - ($_.AppPathNameMatchCondition -ne $null) -and $_.AppPathNameMatchCondition[0] - - AppPathName - - - - ($_.TemplateMatchCondition -ne $null) -and ($_.TemplateMatchCondition -ne 0) - - Template - - - - ($_.JobObjectMatchCondition -ne $null) -and ($_.JobObjectMatchCondition -ne 0) - - JobObject - - - - ($_.NetDirectPortMatchCondition -ne $null) -and ($_.NetDirectPortMatchCondition -ne 0) - - NetDirectPort - - - - ($_.IPProtocolMatchCondition -ne $null) -and ($_.IPProtocolMatchCondition -ne 0) - - IPProtocol - - - - ($_.IPPortMatchCondition -ne $null) -and ($_.IPPortMatchCondition -ne 0) - - IPPort - - - - ($_.IPSrcPrefixMatchCondition -ne $null) -and $_.IPSrcPrefixMatchCondition[0] - - IPSrcPrefix - - - - ($_.IPSrcPortStartMatchCondition -ne $null) -and ($_.IPSrcPortStartMatchCondition -ne 0) - - IPSrcPortStart - - - - ($_.IPSrcPortStartMatchCondition -ne $null) -and ($_.IPSrcPortStartMatchCondition -ne 0) - - IPSrcPortEnd - - - - ($_.IPDstPrefixMatchCondition -ne $null) -and $_.IPDstPrefixMatchCondition[0] - - IPDstPrefix - - - - ($_.IPDstPortStartMatchCondition -ne $null) -and ($_.IPDstPortStartMatchCondition -ne 0) - - IPDstPortStart - - - - ($_.IPDstPortStartMatchCondition -ne $null) -and ($_.IPDstPortStartMatchCondition -ne 0) - - IPDstPortEnd - - - - $_.URIMatchCondition -ne $null - - URI - - - - $_.URIMatchCondition -ne $null - - URIRecursive - - - - ($_.PriorityValue8021Action -ne $null) -and ($_.PriorityValue8021Action -ne -1) - - PriorityValue - - - - ($_.DSCPAction -ne $null) -and ($_.DSCPAction -ne -1) - - DSCPValue - - - - ($_.MinBandwidthWeightAction -ne $null) -and ($_.MinBandwidthWeightAction -ne 0) - - MinBandwidthWeight - - - - ($_.ThrottleRateAction -ne $null) -and ($_.ThrottleRateAction -ne 0) - - - - Import-Module NetQos\MSFT_NetQosPolicy.Format.Helper.psm1 - Format-NetQosPolicySpeed $_.ThrottleRateAction 3 - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetQos/MSFT_NetQosPolicy.Types.ps1xml b/newton-cn/bin/Modules/NetQos/MSFT_NetQosPolicy.Types.ps1xml deleted file mode 100644 index 807e0c4..0000000 --- a/newton-cn/bin/Modules/NetQos/MSFT_NetQosPolicy.Types.ps1xml +++ /dev/null @@ -1,290 +0,0 @@ - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetQosPolicySettingData - - - NetworkProfile - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetQosPolicy.NetworkProfile]($this.PSBase.CimInstanceProperties['NetworkProfile'].Value) - - - param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetQosPolicy.NetworkProfile]$value) - $this.PSBase.CimInstanceProperties['NetworkProfile'].Value = [System.UInt32]$value - - - - TemplateMatchCondition - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetQosPolicy.Template]($this.PSBase.CimInstanceProperties['TemplateMatchCondition'].Value) - - - param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetQosPolicy.Template]$value) - $this.PSBase.CimInstanceProperties['TemplateMatchCondition'].Value = [System.UInt32]$value - - - - UserMatchCondition - - $user = $this.PSBase.CimInstanceProperties['UserMatchCondition'].Value - if ($user -ne $null -and $user[0]) { - [System.Security.Principal.NTAccount]$user - } else { - $null - } - - - param([System.Security.Principal.NTAccount]$value) - $this.PSBase.CimInstanceProperties['UserMatchCondition'].Value = [System.String]$value - - - - AppPathNameMatchCondition - - [System.String]($this.PSBase.CimInstanceProperties['AppPathNameMatchCondition'].Value) - - - param([System.String]$value) - $this.PSBase.CimInstanceProperties['AppPathNameMatchCondition'].Value = $value - - - - JobObjectMatchCondition - - [System.String]($this.PSBase.CimInstanceProperties['JobObjectMatchCondition'].Value) - - - - NetDirectPortMatchCondition - - [System.UInt16]($this.PSBase.CimInstanceProperties['NetDirectPortMatchCondition'].Value) - - - param([System.UInt16]$value) - $this.PSBase.CimInstanceProperties['NetDirectPortMatchCondition'].Value = $value - - - - IPProtocolMatchCondition - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetQosPolicy.Protocol]($this.PSBase.CimInstanceProperties['IPProtocolMatchCondition'].Value) - - - param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetQosPolicy.Protocol]$value) - $this.PSBase.CimInstanceProperties['IPProtocolMatchCondition'].Value = [System.UInt32]$value - - - - IPPortMatchCondition - - [System.UInt16]($this.PSBase.CimInstanceProperties['IPPortMatchCondition'].Value) - - - param([System.UInt16]$value) - $this.PSBase.CimInstanceProperties['IPPortMatchCondition'].Value = $value - - - - IPSrcPrefixMatchCondition - - [System.String]($this.PSBase.CimInstanceProperties['IPSrcPrefixMatchCondition'].Value) - - - param([System.String]$value) - $this.PSBase.CimInstanceProperties['IPSrcPrefixMatchCondition'].Value = $value - - - - IPSrcPortStartMatchCondition - - [System.UInt16]($this.PSBase.CimInstanceProperties['IPSrcPortStartMatchCondition'].Value) - - - param([System.UInt16]$value) - $this.PSBase.CimInstanceProperties['IPSrcPortStartMatchCondition'].Value = $value - - - - IPSrcPortEndMatchCondition - - [System.UInt16]($this.PSBase.CimInstanceProperties['IPSrcPortEndMatchCondition'].Value) - - - param([System.UInt16]$value) - $this.PSBase.CimInstanceProperties['IPSrcPortEndMatchCondition'].Value = $value - - - - IPDstPrefixMatchCondition - - [System.String]($this.PSBase.CimInstanceProperties['IPDstPrefixMatchCondition'].Value) - - - param([System.String]$value) - $this.PSBase.CimInstanceProperties['IPDstPrefixMatchCondition'].Value = $value - - - - IPDstPortStartMatchCondition - - [System.UInt16]($this.PSBase.CimInstanceProperties['IPDstPortStartMatchCondition'].Value) - - - param([System.UInt16]$value) - $this.PSBase.CimInstanceProperties['IPDstPortStartMatchCondition'].Value = $value - - - - IPDstPortEndMatchCondition - - [System.UInt16]($this.PSBase.CimInstanceProperties['IPDstPortEndMatchCondition'].Value) - - - param([System.UInt16]$value) - $this.PSBase.CimInstanceProperties['IPDstPortEndMatchCondition'].Value = $value - - - - URIMatchCondition - - $uri = $this.PSBase.CimInstanceProperties['URIMatchCondition'].Value - if ($uri -ne $null -and $uri[0]) { - [System.Uri]$uri - } else { - $null - } - - - param([System.Uri]$value) - $this.PSBase.CimInstanceProperties['URIMatchCondition'].Value = [System.String]$value - - - - URIRecursiveMatchCondition - - [System.Boolean]($this.PSBase.CimInstanceProperties['URIRecursiveMatchCondition'].Value) - - - param([System.Boolean]$value) - $this.PSBase.CimInstanceProperties['URIRecursiveMatchCondition'].Value = $value - - - - PriorityValue8021Action - - [System.SByte]($this.PSBase.CimInstanceProperties['PriorityValue8021Action'].Value) - - - param([System.SByte]$value) - $this.PSBase.CimInstanceProperties['PriorityValue8021Action'].Value = $value - - - - DSCPAction - - [System.SByte]($this.PSBase.CimInstanceProperties['DSCPAction'].Value) - - - param([System.SByte]$value) - $this.PSBase.CimInstanceProperties['DSCPAction'].Value = $value - - - - MinBandwidthWeightAction - - [System.Byte]($this.PSBase.CimInstanceProperties['MinBandwidthWeightAction'].Value) - - - param([System.Byte]$value) - $this.PSBase.CimInstanceProperties['MinBandwidthWeightAction'].Value = $value - - - - ThrottleRateAction - - [System.UInt64]($this.PSBase.CimInstanceProperties['ThrottleRateAction'].Value) - - - param([System.UInt64]$value) - $this.PSBase.CimInstanceProperties['ThrottleRateAction'].Value = $value - - - - User - UserMatchCondition - - - AppPathName - AppPathNameMatchCondition - - - Template - TemplateMatchCondition - - - JobObject - JobObjectMatchCondition - - - NetDirectPort - NetDirectPortMatchCondition - - - IPProtocol - IPProtocolMatchCondition - - - IPPort - IPPortMatchCondition - - - IPSrcPrefix - IPSrcPrefixMatchCondition - - - IPSrcPortStart - IPSrcPortStartMatchCondition - - - IPSrcPortEnd - IPSrcPortEndMatchCondition - - - IPDstPrefix - IPDstPrefixMatchCondition - - - IPDstPortStart - IPDstPortStartMatchCondition - - - IPDstPortEnd - IPDstPortEndMatchCondition - - - URI - URIMatchCondition - - - URIRecursive - URIRecursiveMatchCondition - - - PriorityValue - PriorityValue8021Action - - - DSCPValue - DSCPAction - - - MinBandwidthWeight - MinBandwidthWeightAction - - - ThrottleRate - ThrottleRateAction - - - - diff --git a/newton-cn/bin/Modules/NetQos/MSFT_NetQosPolicy.cdxml b/newton-cn/bin/Modules/NetQos/MSFT_NetQosPolicy.cdxml deleted file mode 100644 index 8df079a..0000000 --- a/newton-cn/bin/Modules/NetQos/MSFT_NetQosPolicy.cdxml +++ /dev/null @@ -1,1181 +0,0 @@ - - - - 1.0 - NetQosPolicy - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetQos/NetQos.psd1 b/newton-cn/bin/Modules/NetQos/NetQos.psd1 deleted file mode 100644 index 3f435ec..0000000 --- a/newton-cn/bin/Modules/NetQos/NetQos.psd1 +++ /dev/null @@ -1,18 +0,0 @@ -@{ - GUID = '743692b7-a227-4389-b082-2b47de1d0d2d' - Author = "Microsoft Corporation" - CompanyName = "Microsoft Corporation" - Copyright = "© Microsoft Corporation. All rights reserved." - ModuleVersion = '2.0.0.0' - PowerShellVersion = '5.1' - NestedModules = @('MSFT_NetQosPolicy.cdxml') - FormatsToProcess = @('MSFT_NetQosPolicy.format.ps1xml') - TypesToProcess = @('MSFT_NetQosPolicy.types.ps1xml') - HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=285555" - FunctionsToExport = @( - 'Get-NetQosPolicy', - 'Set-NetQosPolicy', - 'Remove-NetQosPolicy', - 'New-NetQosPolicy') - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/NetSecurity/Microsoft.Windows.Firewall.Commands.dll b/newton-cn/bin/Modules/NetSecurity/Microsoft.Windows.Firewall.Commands.dll deleted file mode 100644 index 9e5ac84..0000000 Binary files a/newton-cn/bin/Modules/NetSecurity/Microsoft.Windows.Firewall.Commands.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/NetSecurity/NetFirewallAddressFilter.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetFirewallAddressFilter.cmdletDefinition.cdxml deleted file mode 100644 index d01a9ac..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetFirewallAddressFilter.cmdletDefinition.cdxml +++ /dev/null @@ -1,72 +0,0 @@ - - - - 1.0.0.0 - NetFirewallAddressFilter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetFirewallApplicationFilter.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetFirewallApplicationFilter.cmdletDefinition.cdxml deleted file mode 100644 index cd1cbf2..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetFirewallApplicationFilter.cmdletDefinition.cdxml +++ /dev/null @@ -1,74 +0,0 @@ - - - - 1.0.0.0 - NetFirewallApplicationFilter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetFirewallDynamicKeywordAddress.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetFirewallDynamicKeywordAddress.cmdletDefinition.cdxml deleted file mode 100644 index 9e06cdf..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetFirewallDynamicKeywordAddress.cmdletDefinition.cdxml +++ /dev/null @@ -1,102 +0,0 @@ - - - - 1.0.0.0 - NetFirewallDynamicKeywordAddress - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/NetSecurity/NetFirewallInterfaceFilter.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetFirewallInterfaceFilter.cmdletDefinition.cdxml deleted file mode 100644 index 8872632..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetFirewallInterfaceFilter.cmdletDefinition.cdxml +++ /dev/null @@ -1,62 +0,0 @@ - - - - 1.0.0.0 - NetFirewallInterfaceFilter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetFirewallInterfaceTypeFilter.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetFirewallInterfaceTypeFilter.cmdletDefinition.cdxml deleted file mode 100644 index f0e3996..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetFirewallInterfaceTypeFilter.cmdletDefinition.cdxml +++ /dev/null @@ -1,78 +0,0 @@ - - - - 1.0.0.0 - NetFirewallInterfaceTypeFilter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetFirewallPortFilter.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetFirewallPortFilter.cmdletDefinition.cdxml deleted file mode 100644 index c0c2e4f..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetFirewallPortFilter.cmdletDefinition.cdxml +++ /dev/null @@ -1,102 +0,0 @@ - - - - 1.0.0.0 - NetFirewallPortFilter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetFirewallProfile.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetFirewallProfile.cmdletDefinition.cdxml deleted file mode 100644 index 443ea4d..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetFirewallProfile.cmdletDefinition.cdxml +++ /dev/null @@ -1,164 +0,0 @@ - - - - 1.0.0.0 - NetFirewallProfile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetFirewallRule.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetFirewallRule.cmdletDefinition.cdxml deleted file mode 100644 index 1ce77f6..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetFirewallRule.cmdletDefinition.cdxml +++ /dev/null @@ -1,646 +0,0 @@ - - - - 1.0.0.0 - NetFirewallRule - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetFirewallSecurityFilter.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetFirewallSecurityFilter.cmdletDefinition.cdxml deleted file mode 100644 index 5beb9e0..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetFirewallSecurityFilter.cmdletDefinition.cdxml +++ /dev/null @@ -1,126 +0,0 @@ - - - - 1.0.0.0 - NetFirewallSecurityFilter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetFirewallServiceFilter.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetFirewallServiceFilter.cmdletDefinition.cdxml deleted file mode 100644 index a556616..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetFirewallServiceFilter.cmdletDefinition.cdxml +++ /dev/null @@ -1,64 +0,0 @@ - - - - 1.0.0.0 - NetFirewallServiceFilter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetFirewallSetting.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetFirewallSetting.cmdletDefinition.cdxml deleted file mode 100644 index 8737882..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetFirewallSetting.cmdletDefinition.cdxml +++ /dev/null @@ -1,141 +0,0 @@ - - - - 1.0.0.0 - NetFirewallSetting - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetGPO.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetGPO.cmdletDefinition.cdxml deleted file mode 100644 index 98bfc5e..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetGPO.cmdletDefinition.cdxml +++ /dev/null @@ -1,51 +0,0 @@ - - - - 1.0.0.0 - NetGPO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetIPsecDospSetting.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetIPsecDospSetting.cmdletDefinition.cdxml deleted file mode 100644 index 5d0a930..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetIPsecDospSetting.cmdletDefinition.cdxml +++ /dev/null @@ -1,246 +0,0 @@ - - - - 1.0.0.0 - NetIPsecDospSetting - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetIPsecIdentity.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetIPsecIdentity.cmdletDefinition.cdxml deleted file mode 100644 index fedcc7f..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetIPsecIdentity.cmdletDefinition.cdxml +++ /dev/null @@ -1,31 +0,0 @@ - - - - 1.0.0.0 - NetIPsecIdentity - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetIPsecMainModeCryptoSet.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetIPsecMainModeCryptoSet.cmdletDefinition.cdxml deleted file mode 100644 index 55ee4db..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetIPsecMainModeCryptoSet.cmdletDefinition.cdxml +++ /dev/null @@ -1,295 +0,0 @@ - - - - 1.0.0.0 - NetIPsecMainModeCryptoSet - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetIPsecMainModeRule.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetIPsecMainModeRule.cmdletDefinition.cdxml deleted file mode 100644 index 1512511..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetIPsecMainModeRule.cmdletDefinition.cdxml +++ /dev/null @@ -1,366 +0,0 @@ - - - - 1.0.0.0 - NetIPsecMainModeRule - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetIPsecMainModeSA.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetIPsecMainModeSA.cmdletDefinition.cdxml deleted file mode 100644 index 65f9ffb..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetIPsecMainModeSA.cmdletDefinition.cdxml +++ /dev/null @@ -1,44 +0,0 @@ - - - - 1.0.0.0 - NetIPsecMainModeSA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetIPsecPhase1AuthSet.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetIPsecPhase1AuthSet.cmdletDefinition.cdxml deleted file mode 100644 index 6c89259..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetIPsecPhase1AuthSet.cmdletDefinition.cdxml +++ /dev/null @@ -1,259 +0,0 @@ - - - - 1.0.0.0 - NetIPsecPhase1AuthSet - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetIPsecPhase2AuthSet.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetIPsecPhase2AuthSet.cmdletDefinition.cdxml deleted file mode 100644 index 4be6d87..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetIPsecPhase2AuthSet.cmdletDefinition.cdxml +++ /dev/null @@ -1,253 +0,0 @@ - - - - 1.0.0.0 - NetIPsecPhase2AuthSet - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetIPsecPolicyChange.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetIPsecPolicyChange.cmdletDefinition.cdxml deleted file mode 100644 index 739aa1f..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetIPsecPolicyChange.cmdletDefinition.cdxml +++ /dev/null @@ -1,17 +0,0 @@ - - - - 1.0.0.0 - NetIPsecPolicyChange - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetIPsecQuickModeCryptoSet.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetIPsecQuickModeCryptoSet.cmdletDefinition.cdxml deleted file mode 100644 index 8514f0b..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetIPsecQuickModeCryptoSet.cmdletDefinition.cdxml +++ /dev/null @@ -1,267 +0,0 @@ - - - - 1.0.0.0 - NetIPsecQuickModeCryptoSet - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetIPsecQuickModeSA.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetIPsecQuickModeSA.cmdletDefinition.cdxml deleted file mode 100644 index 475bae3..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetIPsecQuickModeSA.cmdletDefinition.cdxml +++ /dev/null @@ -1,76 +0,0 @@ - - - - 1.0.0.0 - NetIPsecQuickModeSA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetIPsecRule.cmdletDefinition.cdxml b/newton-cn/bin/Modules/NetSecurity/NetIPsecRule.cmdletDefinition.cdxml deleted file mode 100644 index df19f83..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetIPsecRule.cmdletDefinition.cdxml +++ /dev/null @@ -1,825 +0,0 @@ - - - - 1.0.0.0 - NetIPsecRule - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetSecurity.formats.ps1xml b/newton-cn/bin/Modules/NetSecurity/NetSecurity.formats.ps1xml deleted file mode 100644 index f6481a2..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetSecurity.formats.ps1xml +++ /dev/null @@ -1,3316 +0,0 @@ - - - - - NetFirewallRule_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetFirewallRule - - - - - - - Name - - - DisplayName - - - Description - - - DisplayGroup - - - Group - - - Enabled - - - Profile - - - Platform - - - Direction - - - Action - - - EdgeTraversalPolicy - - - LooseSourceMapping - - - LocalOnlyMapping - - - Owner - - - PrimaryStatus - - - Status - - - EnforcementStatus - - - PolicyStoreSource - - - PolicyStoreSourceType - - - RemoteDynamicKeywordAddresses - - - - - - - - NetFirewallRule_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetFirewallRule - - - - - - - - - - - - - - - 5 - - - - 10 - - - - - - - - - - - - - - - - Name - - - DisplayName - - - DisplayGroup - - - Enabled - - - Profile - - - Direction - - - Action - - - RemoteDynamicKeywordAddresses - - - - - - - - NetIPsecRule_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetConSecRule - - - - - - - IPsecRuleName - - - DisplayName - - - Description - - - DisplayGroup - - - Group - - - Enabled - - - Profile - - - Platform - - - Mode - - - InboundSecurity - - - OutboundSecurity - - - QuickModeCryptoSet - - - Phase1AuthSet - - - Phase2AuthSet - - - KeyModule - - - AllowWatchKey - - - AllowSetKey - - - LocalTunnelEndpoint - - - RemoteTunnelEndpoint - - - RemoteTunnelHostname - - - ForwardPathLifetime - - - EncryptedTunnelBypass - - - RequireAuthorization - - - User - - - Machine - - - PrimaryStatus - - - Status - - - EnforcementStatus - - - PolicyStoreSource - - - PolicyStoreSourceType - - - - - - - - NetIPsecRule_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetConSecRule - - - - - - - - - - - - - - - 5 - - - - 10 - - - - - - - - - - - - - - - - IPsecRuleName - - - DisplayName - - - DisplayGroup - - - Enabled - - - Profile - - - Mode - - - InboundSecurity - - - OutboundSecurity - - - - - - - - NetIPsecMainModeRule_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetMainModeRule - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetMainModeRule - - - - - - - Name - - - DisplayName - - - Description - - - DisplayGroup - - - Group - - - Enabled - - - Profile - - - Platform - - - MainModeCryptoSet - - - Phase1AuthSet - - - PrimaryStatus - - - Status - - - EnforcementStatus - - - PolicyStoreSource - - - PolicyStoreSourceType - - - - - - - - NetIPsecMainModeRule_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetMainModeRule - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetMainModeRule - - - - - - - - - - - - - - - 5 - - - - 10 - - - - - - - Name - - - DisplayName - - - DisplayGroup - - - Enabled - - - Profile - - - - - - - - NetFirewallAddressFilter_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetAddressFilter - - - - - - - LocalAddress - - - RemoteAddress - - - - - - - - NetFirewallAddressFilter_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetAddressFilter - - - - - - - - - - - - - - - LocalAddress - - - RemoteAddress - - - - - - - - - NetFirewallApplicationFilter_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetApplicationFilter - - - - - - - Program - - - Package - - - - - - - - NetFirewallApplicationFilter_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetApplicationFilter - - - - - - - - - - - - - - - Program - - - Package - - - - - - - - - NetFirewallInterfaceFilter_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetInterfaceFilter - - - - - - - InterfaceAlias - - - - - - - - NetFirewallInterfaceFilter_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetInterfaceFilter - - - - - - - - - - - - InterfaceAlias - - - - - - - - - NetFirewallInterfaceTypeFilter_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetInterfaceTypeFilter - - - - - - - InterfaceType - - - - - - - - NetFirewallInterfaceTypeFilter_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetInterfaceTypeFilter - - - - - - - - - - - - InterfaceType - - - - - - - - - NetFirewallSecurityFilter_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetNetworkLayerSecurityFilter - - - - - - - Authentication - - - Encryption - - - OverrideBlockRules - - - LocalUser - - - RemoteUser - - - RemoteMachine - - - - - - - - NetFirewallSecurityFilter_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetNetworkLayerSecurityFilter - - - - - - - - - - - - - - - - - - - - - - - - - - - Authentication - - - Encryption - - - OverrideBlockRules - - - LocalUser - - - RemoteUser - - - RemoteMachine - - - - - - - - - NetFirewallPortFilter_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetProtocolPortFilter - - - - - - - Protocol - - - LocalPort - - - RemotePort - - - IcmpType - - - DynamicTarget - - - - - - - - NetFirewallPortFilter_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetProtocolPortFilter - - - - - - - - - - - - - - - - - - - - - - - - Protocol - - - LocalPort - - - RemotePort - - - IcmpType - - - DynamicTarget - - - - - - - - - NetFirewallServiceFilter_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetServiceFilter - - - - - - - Service - - - - - - - - NetFirewallServiceFilter_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetServiceFilter - - - - - - - - - - - - Service - - - - - - - - - NetIPsecPhase1AuthSet_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEP1AuthSet - - - - - - - Name - - - DisplayName - - - Description - - - DisplayGroup - - - Group - - - - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatAuthenticationProposals($_.Proposals) - - - PrimaryStatus - - - Status - - - EnforcementStatus - - - PolicyStoreSource - - - PolicyStoreSourceType - - - - - - - - NetIPsecPhase1AuthSet_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEP1AuthSet - - - - - - - - - - - - - - - - - - - - - Name - - - DisplayName - - - DisplayGroup - - - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatAuthenticationSummary($_.Proposals) - - - - - - - - - NetIPsecPhase2AuthSet_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEP2AuthSet - - - - - - - Name - - - DisplayName - - - Description - - - DisplayGroup - - - Group - - - - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatAuthenticationProposals($_.Proposals) - - - PrimaryStatus - - - Status - - - EnforcementStatus - - - PolicyStoreSource - - - PolicyStoreSourceType - - - - - - - - NetIPsecPhase2AuthSet_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEP2AuthSet - - - - - - - - - - - - - - - - - - - - - Name - - - DisplayName - - - DisplayGroup - - - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatAuthenticationSummary($_.Proposals) - - - - - - - - - NetIPsecAuthProposal_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEBasicAuthProposal - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEBasicAuthProposal - - - - - - - AuthenticationMethod - - - - - - - - NetIPsecAuthProposal_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEBasicAuthProposal - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEBasicAuthProposal - - - - - - - - - - - - AuthenticationMethod - - - - - - - - - NetIPsecKerbAuthProposal_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEKerbAuthProposal - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEKerbAuthProposal - - - - - - - AuthenticationMethod - - - Proxy - - - - - - - - NetIPsecKerbAuthProposal_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEKerbAuthProposal - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEKerbAuthProposal - - - - - - - - - - - - - - - AuthenticationMethod - - - Proxy - - - - - - - - - NetIPsecPskAuthProposal_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEPSKAuthProposal - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEPSKAuthProposal - - - - - - - AuthenticationMethod - - - PreSharedKey - - - - - - - - NetIPsecPskAuthProposal_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEPSKAuthProposal - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEPSKAuthProposal - - - - - - - - - - - - - - - AuthenticationMethod - - - PreSharedKey - - - - - - - - - NetIPsecCertAuthProposal_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKECertAuthProposal - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKECertAuthProposal - - - - - - - AuthenticationMethod - - - Authority - - - AuthorityType - - - ExcludeCAName - - - AccountMapping - - - Signing - - - SubjectName - - - SubjectNameType - - - ExtendedKeyUsage - - - Thumbprint - - - FollowRenewal - - - SelectionCriteria - - - ValidationCriteria - - - - - - - - NetIPsecCertAuthProposal_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKECertAuthProposal - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKECertAuthProposal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AuthenticationMethod - - - Authority - - - AuthorityType - - - ExcludeCAName - - - AccountMapping - - - Signing - - - SubjectName - - - SubjectNameType - - - ExtendedKeyUsage - - - Thumbprint - - - FollowRenewal - - - SelectionCriteria - - - ValidationCriteria - - - - - - - - - NetIPsecMainModeCryptoSet_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEMMCryptoSet - - - - - - - Name - - - DisplayName - - - Description - - - DisplayGroup - - - Group - - - - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatMainModeCryptoProposals($_.Proposals) - - - MaxMinutes - - - MaxSessions - - - ForceDiffieHellman - - - PrimaryStatus - - - Status - - - EnforcementStatus - - - PolicyStoreSource - - - PolicyStoreSourceType - - - - - - - - NetIPsecMainModeCryptoSet_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEMMCryptoSet - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name - - - DisplayName - - - DisplayGroup - - - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatMainModeCryptoProposals($_.Proposals) - - - MaxMinutes - - - MaxSessions - - - ForceDiffieHellman - - - - - - - - - NetIPsecQuickModeCryptoSet_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEQMCryptoSet - - - - - - - Name - - - DisplayName - - - Description - - - DisplayGroup - - - Group - - - - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatQuickModeCryptoProposals($_.Proposals) - - - PfsGroup - - - PrimaryStatus - - - Status - - - EnforcementStatus - - - PolicyStoreSource - - - PolicyStoreSourceType - - - - - - - - NetIPsecQuickModeCryptoSet_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEQMCryptoSet - - - - - - - - - - - - - - - - - - - - - - - - Name - - - DisplayName - - - DisplayGroup - - - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatQuickModeCryptoProposals($_.Proposals) - - - PfsGroup - - - - - - - - - NetIPsecMainModeCryptoProposal_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEMMCryptoProposal - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEMMCryptoProposal - - - - - - - Encryption - - - Hash - - - KeyExchange - - - - - - - - NetIPsecMainModeCryptoProposal_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEMMCryptoProposal - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEMMCryptoProposal - - - - - - - - - - - - - - - - - - Encryption - - - Hash - - - KeyExchange - - - - - - - - - NetIPsecQuickModeCryptoProposal_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEQMCryptoProposal - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEQMCryptoProposal - - - - - - - Encapsulation - - - AhHash - - - EspHash - - - Encryption - - - MaxKilobytes - - - MaxMinutes - - - - - - - - NetIPsecQuickModeCryptoProposal_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEQMCryptoProposal - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEQMCryptoProposal - - - - - - - - - - - - - - - - - - - - - - - - - - - Encapsulation - - - AhHash - - - EspHash - - - Encryption - - - MaxKilobytes - - - MaxMinutes - - - - - - - - - NetFirewallProfile_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetFirewallProfile - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetFirewallProfile - - - - - - - Name - - - Enabled - - - DefaultInboundAction - - - DefaultOutboundAction - - - AllowInboundRules - - - AllowLocalFirewallRules - - - AllowLocalIPsecRules - - - AllowUserApps - - - AllowUserPorts - - - AllowUnicastResponseToMulticast - - - NotifyOnListen - - - EnableStealthModeForIPsec - - - LogFileName - - - LogMaxSizeKilobytes - - - LogAllowed - - - LogBlocked - - - LogIgnored - - - DisabledInterfaceAliases - - - - - - - - NetFirewallProfile_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetFirewallProfile - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetFirewallProfile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name - - - Enabled - - - DefaultInboundAction - - - DefaultOutboundAction - - - AllowInboundRules - - - AllowLocalFirewallRules - - - AllowLocalIPsecRules - - - AllowUserApps - - - AllowUserPorts - - - AllowUnicastResponseToMulticast - - - NotifyOnListen - - - EnableStealthModeForIPsec - - - LogFileName - - - LogMaxSizeKilobytes - - - LogAllowed - - - LogBlocked - - - LogIgnored - - - DisabledInterfaceAliases - - - - - - - - - NetIPsecPolicyChange_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetSecDeltaCollection - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSecDeltaCollection - - - - - - - Action - - - EndpointType - - - PolicyStore - - - IPsecRuleDisplayName - - - IPv4Addresses - - - IPv6Addresses - - - NameResolutionFailures - - - - - - - - NetIPsecPolicyChange_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetSecDeltaCollection - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSecDeltaCollection - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Action - - - EndpointType - - - PolicyStore - - - IPsecRuleDisplayName - - - IPv4Addresses - - - IPv6Addresses - - - NameResolutionFailures - - - - - - - - - NetIPsecDospSetting_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIPsecDoSPSetting - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPsecDoSPSetting - - - - - - - Name - - - StateIdleTimeoutSeconds - - - PerIPRateLimitQueueIdleTimeoutSeconds - - - IpV6IPsecUnauthDscp - - - IpV6IPsecUnauthRateLimitBytesPerSec - - - IpV6IPsecUnauthPerIPRateLimitBytesPerSec - - - IpV6IPsecAuthDscp - - - IpV6IPsecAuthRateLimitBytesPerSec - - - IcmpV6Dscp - - - IcmpV6RateLimitBytesPerSec - - - IpV6FilterExemptDscp - - - IpV6FilterExemptRateLimitBytesPerSec - - - DefBlockExemptDscp - - - DefBlockExemptRateLimitBytesPerSec - - - MaxStateEntries - - - MaxPerIPRateLimitQueues - - - EnabledKeyingModules - - - FilteringFlags - - - PublicInterfaceAliases - - - PrivateInterfaceAliases - - - PublicV6Address - - - PrivateV6Address - - - EffectiveAddressFamily - - - - - - - - NetIPsecDospSetting_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIPsecDoSPSetting - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPsecDoSPSetting - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name - - - StateIdleTimeoutSeconds - - - PerIPRateLimitQueueIdleTimeoutSeconds - - - IpV6IPsecUnauthDscp - - - IpV6IPsecUnauthRateLimitBytesPerSec - - - IpV6IPsecUnauthPerIPRateLimitBytesPerSec - - - IpV6IPsecAuthDscp - - - IpV6IPsecAuthRateLimitBytesPerSec - - - IcmpV6Dscp - - - IcmpV6RateLimitBytesPerSec - - - IpV6FilterExemptDscp - - - IpV6FilterExemptRateLimitBytesPerSec - - - DefBlockExemptDscp - - - DefBlockExemptRateLimitBytesPerSec - - - MaxStateEntries - - - MaxPerIPRateLimitQueues - - - EnabledKeyingModules - - - FilteringFlags - - - PublicInterfaceAliases - - - PrivateInterfaceAliases - - - PublicV6Address - - - PrivateV6Address - - - EffectiveAddressFamily - - - - - - - - - NetIPsecIdentity_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIPsecIdentity - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPsecIdentity - - - - - - - ImpersonationType - - - AuthenticationMethod - - - Flags - - - - - - - - NetIPsecIdentity_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIPsecIdentity - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPsecIdentity - - - - - - - - - - - - - - - - - - ImpersonationType - - - AuthenticationMethod - - - Flags - - - - - - - - - NetIPsecMainModeSA_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetMainModeSA - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetMainModeSA - - - - - - - Name - - - LocalEndpoint - - - RemoteEndpoint - - - - $_.LocalFirstId.Identity - - - - $_.LocalFirstId.ImpersonationType - - - - $_.LocalFirstId.AuthenticationMethod - - - - $_.LocalFirstId.Flags - - - - $_.RemoteFirstId.Identity - - - - $_.RemoteFirstId.ImpersonationType - - - - $_.RemoteFirstId.AuthenticationMethod - - - - $_.RemoteFirstId.Flags - - - - $_.LocalSecondId.Identity - - - - $_.LocalSecondId.ImpersonationType - - - - $_.LocalSecondId.AuthenticationMethod - - - - $_.LocalSecondId.Flags - - - - $_.RemoteSecondId.Identity - - - - $_.RemoteSecondId.ImpersonationType - - - - $_.RemoteSecondId.AuthenticationMethod - - - - $_.RemoteSecondId.Flags - - - CipherAlgorithm - - - HashAlgorithm - - - GroupId - - - KeyModule - - - MaxQMSAs - - - LifetimeSeconds - - - LocalUdpEncapsulationPort - - - RemoteUdpEncapsulationPort - - - ExtendedFilterId - - - - - - - - NetIPsecMainModeSA_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetMainModeSA - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetMainModeSA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name - - - LocalEndpoint - - - RemoteEndpoint - - - $_.LocalFirstId.Identity - - - $_.LocalFirstId.ImpersonationType - - - $_.LocalFirstId.AuthenticationMethod - - - $_.LocalFirstId.Flags - - - $_.RemoteFirstId.Identity - - - $_.RemoteFirstId.ImpersonationType - - - $_.RemoteFirstId.AuthenticationMethod - - - $_.RemoteFirstId.Flags - - - $_.LocalSecondId.Identity - - - $_.LocalSecondId.ImpersonationType - - - $_.LocalSecondId.AuthenticationMethod - - - $_.LocalSecondId.Flags - - - $_.RemoteSecondId.Identity - - - $_.RemoteSecondId.ImpersonationType - - - $_.RemoteSecondId.AuthenticationMethod - - - $_.RemoteSecondId.Flags - - - CipherAlgorithm - - - HashAlgorithm - - - GroupId - - - KeyModule - - - MaxQMSAs - - - LifetimeSeconds - - - LocalUdpEncapsulationPort - - - RemoteUdpEncapsulationPort - - - ExtendedFilterId - - - - - - - - - NetIPsecQuickModeSA_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetQuickModeSA - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetQuickModeSA - - - - - - - Name - - - LocalEndpoint - - - RemoteEndpoint - - - TransportLayerFilterName - - - EncapsulationMode - - - Direction - - - LocalPort - - - RemotePort - - - IpProtocol - - - InterfaceAlias - - - RealIfProfileId - - - LocalUdpEncapsulationPort - - - RemoteUdpEncapsulationPort - - - SPI - - - FirstTransformType - - - FirstIntegrityAlgorithm - - - FirstCipherAlgorithm - - - SecondSpi - - - SecondTransformType - - - SecondIntegrityAlgorithm - - - SecondCipherAlgorithm - - - Flags - - - MmSaId - - - PfsGroupId - - - PeerV4PrivateAddress - - - QuickModeFilterid - - - LifetimeSeconds - - - LifetimeKilobytes - - - LifetimePackets - - - IdleDurationSeconds - - - NdAllowClearTimeoutSeconds - - - NapContext - - - QmSaId - - - VirtualIfTunnelId - - - TrafficSelectorId - - - MmTargetName - - - EmTargetName - - - ExplicitCredentials - - - - - - - - NetIPsecQuickModeSA_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetQuickModeSA - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetQuickModeSA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name - - - LocalEndpoint - - - RemoteEndpoint - - - TransportLayerFilterName - - - EncapsulationMode - - - Direction - - - LocalPort - - - RemotePort - - - IpProtocol - - - InterfaceAlias - - - RealIfProfileId - - - LocalUdpEncapsulationPort - - - RemoteUdpEncapsulationPort - - - SPI - - - FirstTransformType - - - FirstIntegrityAlgorithm - - - FirstCipherAlgorithm - - - SecondSpi - - - SecondTransformType - - - SecondIntegrityAlgorithm - - - SecondCipherAlgorithm - - - Flags - - - MmSaId - - - PfsGroupId - - - PeerV4PrivateAddress - - - QuickModeFilterid - - - LifetimeSeconds - - - LifetimeKilobytes - - - LifetimePackets - - - IdleDurationSeconds - - - NdAllowClearTimeoutSeconds - - - NapContext - - - QmSaId - - - VirtualIfTunnelId - - - TrafficSelectorId - - - MmTargetName - - - EmTargetName - - - ExplicitCredentials - - - - - - - - - NetFirewallSetting_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetSecuritySettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSecuritySettingData - - - - - - - Name - - - Exemptions - - - EnableStatefulFtp - - - EnableStatefulPptp - - - ActiveProfile - - - RemoteMachineTransportAuthorizationList - - - RemoteMachineTunnelAuthorizationList - - - RemoteUserTransportAuthorizationList - - - RemoteUserTunnelAuthorizationList - - - RequireFullAuthSupport - - - CertValidationLevel - - - AllowIPsecThroughNAT - - - MaxSAIdleTimeSeconds - - - KeyEncoding - - - EnablePacketQueuing - - - - - - - - NetFirewallSetting_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetSecuritySettingData - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSecuritySettingData - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name - - - Exemptions - - - EnableStatefulFtp - - - EnableStatefulPptp - - - ActiveProfile - - - RemoteMachineTransportAuthorizationList - - - RemoteMachineTunnelAuthorizationList - - - RemoteUserTransportAuthorizationList - - - RemoteUserTunnelAuthorizationList - - - RequireFullAuthSupport - - - CertValidationLevel - - - AllowIPsecThroughNAT - - - MaxSAIdleTimeSeconds - - - KeyEncoding - - - EnablePacketQueuing - - - - - - - - - NetFirewallDynamicKeywordAddress_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetFirewallDynamicKeywordAddress - - - - - - - Id - - - Keyword - - - Addresses - - - AutoResolve - - - PolicyStoreSource - - - PolicyStoreSourceType - - - - - - - - NetFirewallDynamicKeywordAddress_Tableview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetFirewallDynamicKeywordAddress - - - - - - - - - - - - - - - - - - - - - Id - - - Keyword - - - Addresses - - - AutoResolve - - - - - - - - - MSFT_NetRuleDeep_Listview - - Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/NetSecurityDeepEnumElement - - - - - - - - - if ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetFirewallRule") -{( - (New-Object -TypeName System.String '-',((Get-Host).ui.rawui.windowsize.width - 1)) + "`r`n" + - "`r`n`r`n`r`n" + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Name, "Name", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayName, "DisplayName", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Description, "Description", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayGroup, "DisplayGroup", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Group, "Group", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Enabled, "Enabled", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Profile, "Profile", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.Platform), "Platform", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Direction, "Direction", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Action, "Action", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.EdgeTraversalPolicy, "EdgeTraversalPolicy", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.LooseSourceMapping, "LooseSourceMapping", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.LocalOnlyMapping, "LocalOnlyMapping", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Owner, "Owner", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PrimaryStatus, "PrimaryStatus", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Status, "Status", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.EnforcementStatus), "EnforcementStatus", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSource, "PolicyStoreSource", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSourceType, "PolicyStoreSourceType", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.RemoteDynamicKeywordAddresses), "RemoteDynamicKeywordAddresses", 29, (Get-Host).ui.rawui.windowsize.width) -).TrimEnd()} -elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAddressFilter") -{( - "`r`n`$_ | Get-NetFirewallAddressFilter`r`n" + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.LocalAddress), " LocalAddress", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.RemoteAddress), " RemoteAddress", 29, (Get-Host).ui.rawui.windowsize.width) -).TrimEnd()} -elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetApplicationFilter") -{( - "`r`n`$_ | Get-NetFirewallApplicationFilter`r`n" + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Program, " Program", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Package, " Package", 29, (Get-Host).ui.rawui.windowsize.width) -).TrimEnd()} -elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetServiceFilter") -{( - "`r`n`$_ | Get-NetFirewallServiceFilter`r`n" + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Service, " Service", 29, (Get-Host).ui.rawui.windowsize.width) -).TrimEnd()} -elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetInterfaceFilter") -{( - "`r`n`$_ | Get-NetFirewallInterfaceFilter`r`n" + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.InterfaceAlias), " InterfaceAlias", 29, (Get-Host).ui.rawui.windowsize.width) -).TrimEnd()} -elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetInterfaceTypeFilter") -{( - "`r`n`$_ | Get-NetFirewallInterfaceTypeFilter`r`n" + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.InterfaceType, " InterfaceType", 29, (Get-Host).ui.rawui.windowsize.width) -).TrimEnd()} -elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetProtocolPortFilter") -{( - "`r`n`$_ | Get-NetFirewallPortFilter`r`n" + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Protocol, " Protocol", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.LocalPort), " LocalPort", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.RemotePort), " RemotePort", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.IcmpType), " IcmpType", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DynamicTarget, " DynamicTarget", 29, (Get-Host).ui.rawui.windowsize.width) -).TrimEnd()} -elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetNetworkLayerSecurityFilter") -{( - "`r`n`$_ | Get-NetFirewallSecurityFilter`r`n" + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Authentication, " Authentication", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Encryption, " Encryption", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.OverrideBlockRules, " OverrideBlockRules", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.LocalUser, " LocalUser", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.RemoteUser, " RemoteUser", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.RemoteMachine, " RemoteMachine", 29, (Get-Host).ui.rawui.windowsize.width) -).TrimEnd()} -elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetConSecRule") -{( - (New-Object -TypeName System.String '-',((Get-Host).ui.rawui.windowsize.width - 1)) + "`r`n" + - "`r`n`r`n`r`n" + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.IPsecRuleName, "IPsecRuleName", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayName, "DisplayName", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Description, "Description", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayGroup, "DisplayGroup", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Group, "Group", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Enabled, "Enabled", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Profile, "Profile", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.Platform), "Platform", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Mode, "Mode", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.InboundSecurity, "InboundSecurity", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.OutboundSecurity, "OutboundSecurity", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.QuickModeCryptoSet, "QuickModeCryptoSet", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Phase1AuthSet, "Phase1AuthSet", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Phase2AuthSet, "Phase2AuthSet", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.KeyModule, "KeyModule", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.AllowWatchKey, "AllowWatchKey", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.AllowSetKey, "AllowSetKey", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.LocalTunnelEndpoint), "LocalTunnelEndpoint", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.RemoteTunnelEndpoint), "RemoteTunnelEndpoint", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.RemoteTunnelHostname, "RemoteTunnelHostname", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.ForwardPathLifetime, "ForwardPathLifetime", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.EncryptedTunnelBypass, "EncryptedTunnelBypass", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.RequireAuthorization, "RequireAuthorization", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.User, "User", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Machine, "Machine", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PrimaryStatus, "PrimaryStatus", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Status, "Status", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.EnforcementStatus), "EnforcementStatus", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSource, "PolicyStoreSource", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSourceType, "PolicyStoreSourceType", 29, (Get-Host).ui.rawui.windowsize.width) -).TrimEnd()} -elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEQMCryptoSet") -{( - "`r`n`$_ | Get-NetQuickModeCryptoSet`r`n" + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Name, " Name", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayName, " DisplayName", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Description, " Description", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayGroup, " DisplayGroup", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Group, " Group", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock([Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatQuickModeCryptoProposals($_.Proposals), " Proposal", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PerfectForwardSecrecyGroup, " PfsGroup", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PrimaryStatus, " PrimaryStatus", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Status, " Status", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.EnforcementStatus), " EnforcementStatus", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSource, " PolicyStoreSource", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSourceType, " PolicyStoreSourceType", 29, (Get-Host).ui.rawui.windowsize.width) -).TrimEnd()} -elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEP1AuthSet") -{( - "`r`n`$_ | Get-NetIPsecPhase1AuthSet`r`n" + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Name, " Name", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayName, " DisplayName", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Description, " Description", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayGroup, " DisplayGroup", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Group, " Group", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock([Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatAuthenticationProposals($_.Proposals), " Proposal", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PrimaryStatus, " PrimaryStatus", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Status, " Status", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.EnforcementStatus), " EnforcementStatus", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSource, " PolicyStoreSource", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSourceType, " PolicyStoreSourceType", 29, (Get-Host).ui.rawui.windowsize.width) -).TrimEnd()} -elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEP2AuthSet") -{( - "`r`n`$_ | Get-NetIPsecPhase2AuthSet`r`n" + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Name, " Name", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayName, " DisplayName", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Description, " Description", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayGroup, " DisplayGroup", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Group, " Group", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock([Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatAuthenticationProposals($_.Proposals), " Proposal", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PrimaryStatus, " PrimaryStatus", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Status, " Status", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.EnforcementStatus), " EnforcementStatus", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSource, " PolicyStoreSource", 29, (Get-Host).ui.rawui.windowsize.width) + - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSourceType, " PolicyStoreSourceType", 29, (Get-Host).ui.rawui.windowsize.width) -).TrimEnd()} - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/NetSecurity.psd1 b/newton-cn/bin/Modules/NetSecurity/NetSecurity.psd1 deleted file mode 100644 index 501ad22..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetSecurity.psd1 +++ /dev/null @@ -1,136 +0,0 @@ -@{ - ModuleVersion = '2.0.0.0' - FormatsToProcess = 'NetSecurity.formats.ps1xml' - TypesToProcess = 'NetSecurity.types.ps1xml' - NestedModules = @( - "Microsoft.Windows.Firewall.Commands.dll", - "NetFirewallRule.cmdletDefinition.cdxml", - "NetIPsecRule.cmdletDefinition.cdxml", - "NetIPsecMainModeRule.cmdletDefinition.cdxml", - "NetFirewallAddressFilter.cmdletDefinition.cdxml", - "NetFirewallApplicationFilter.cmdletDefinition.cdxml", - "NetFirewallInterfaceFilter.cmdletDefinition.cdxml", - "NetFirewallInterfaceTypeFilter.cmdletDefinition.cdxml", - "NetFirewallSecurityFilter.cmdletDefinition.cdxml", - "NetFirewallPortFilter.cmdletDefinition.cdxml", - "NetFirewallServiceFilter.cmdletDefinition.cdxml", - "NetIPsecPhase1AuthSet.cmdletDefinition.cdxml", - "NetIPsecPhase2AuthSet.cmdletDefinition.cdxml", - "NetIPsecMainModeCryptoSet.cmdletDefinition.cdxml", - "NetIPsecQuickModeCryptoSet.cmdletDefinition.cdxml", - "NetFirewallProfile.cmdletDefinition.cdxml", - "NetIPsecPolicyChange.cmdletDefinition.cdxml", - "NetIPsecDospSetting.cmdletDefinition.cdxml", - "NetIPsecIdentity.cmdletDefinition.cdxml", - "NetIPsecMainModeSA.cmdletDefinition.cdxml", - "NetIPsecQuickModeSA.cmdletDefinition.cdxml", - "NetFirewallSetting.cmdletDefinition.cdxml", - "NetFirewallDynamicKeywordAddress.cmdletDefinition.cdxml", - "NetGPO.cmdletDefinition.cdxml" - ) - GUID = '{4B26FF51-7AEE-4731-9CF7-508B82532CBF}' - Author = 'Microsoft Corporation' - CompanyName = 'Microsoft Corporation' - PowerShellVersion = '3.0' - ClrVersion = '4.0' - Copyright = '(c) Microsoft Corporation. All rights reserved.' - HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=285764" - CompatiblePSEditions = 'Desktop', 'Core' - - FunctionsToExport = @( - "Copy-NetFirewallRule", - "Copy-NetIPsecMainModeCryptoSet", - "Copy-NetIPsecMainModeRule", - "Copy-NetIPsecPhase1AuthSet", - "Copy-NetIPsecPhase2AuthSet", - "Copy-NetIPsecQuickModeCryptoSet", - "Copy-NetIPsecRule", - "Disable-NetFirewallRule", - "Disable-NetIPsecMainModeRule", - "Disable-NetIPsecRule", - "Enable-NetFirewallRule", - "Enable-NetIPsecMainModeRule", - "Enable-NetIPsecRule", - "Get-NetFirewallAddressFilter", - "Get-NetFirewallApplicationFilter", - "Get-NetFirewallDynamicKeywordAddress", - "Get-NetFirewallInterfaceFilter", - "Get-NetFirewallInterfaceTypeFilter", - "Get-NetFirewallPortFilter", - "Get-NetFirewallProfile", - "Get-NetFirewallRule", - "Get-NetFirewallSecurityFilter", - "Get-NetFirewallServiceFilter", - "Get-NetFirewallSetting", - "Get-NetIPsecDospSetting", - "Get-NetIPsecMainModeCryptoSet", - "Get-NetIPsecMainModeRule", - "Get-NetIPsecMainModeSA", - "Get-NetIPsecPhase1AuthSet", - "Get-NetIPsecPhase2AuthSet", - "Get-NetIPsecQuickModeCryptoSet", - "Get-NetIPsecQuickModeSA", - "Get-NetIPsecRule", - "New-NetFirewallRule", - "New-NetFirewallDynamicKeywordAddress", - "New-NetIPsecDospSetting", - "New-NetIPsecMainModeCryptoSet", - "New-NetIPsecMainModeRule", - "New-NetIPsecPhase1AuthSet", - "New-NetIPsecPhase2AuthSet", - "New-NetIPsecQuickModeCryptoSet", - "New-NetIPsecRule", - "Open-NetGPO", - "Remove-NetFirewallRule", - "Remove-NetFirewallDynamicKeywordAddress", - "Remove-NetIPsecDospSetting", - "Remove-NetIPsecMainModeCryptoSet", - "Remove-NetIPsecMainModeRule", - "Remove-NetIPsecMainModeSA", - "Remove-NetIPsecPhase1AuthSet", - "Remove-NetIPsecPhase2AuthSet", - "Remove-NetIPsecQuickModeCryptoSet", - "Remove-NetIPsecQuickModeSA", - "Remove-NetIPsecRule", - "Rename-NetFirewallRule", - "Rename-NetIPsecMainModeCryptoSet", - "Rename-NetIPsecMainModeRule", - "Rename-NetIPsecPhase1AuthSet", - "Rename-NetIPsecPhase2AuthSet", - "Rename-NetIPsecQuickModeCryptoSet", - "Rename-NetIPsecRule", - "Save-NetGPO", - "Find-NetIPsecRule", - "Set-NetFirewallAddressFilter", - "Set-NetFirewallApplicationFilter", - "Set-NetFirewallInterfaceFilter", - "Set-NetFirewallInterfaceTypeFilter", - "Set-NetFirewallPortFilter", - "Set-NetFirewallProfile", - "Set-NetFirewallRule", - "Set-NetFirewallSecurityFilter", - "Set-NetFirewallServiceFilter", - "Set-NetFirewallSetting", - "Set-NetIPsecDospSetting", - "Set-NetIPsecMainModeCryptoSet", - "Set-NetIPsecMainModeRule", - "Set-NetIPsecPhase1AuthSet", - "Set-NetIPsecPhase2AuthSet", - "Set-NetIPsecQuickModeCryptoSet", - "Set-NetIPsecRule", - "Show-NetFirewallRule", - "Show-NetIPsecRule", - "Sync-NetIPsecRule", - "Update-NetIPsecRule", - "Update-NetFirewallDynamicKeywordAddress" - ) - CmdletsToExport = @( - "Get-DAPolicyChange", - "New-NetIPsecAuthProposal", - "New-NetIPsecMainModeCryptoProposal", - "New-NetIPsecQuickModeCryptoProposal" - ) - AliasesToExport = @( - ) -} - diff --git a/newton-cn/bin/Modules/NetSecurity/NetSecurity.types.ps1xml b/newton-cn/bin/Modules/NetSecurity/NetSecurity.types.ps1xml deleted file mode 100644 index 9edcf8c..0000000 --- a/newton-cn/bin/Modules/NetSecurity/NetSecurity.types.ps1xml +++ /dev/null @@ -1,1085 +0,0 @@ - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetFirewallRule - - - Name - InstanceID - - - ID - Name - - - DisplayName - $this.PSBase.CimInstanceProperties["DisplayName"].Value - param($x) ; $this.PSBase.CimInstanceProperties["DisplayName"].Value = $x ; $this.PSBase.CimInstanceProperties["ElementName"].Value = $x - - - Group - RuleGroup - - - Enabled - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Enabled]($this.PSBase.CimInstanceProperties['Enabled'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['Enabled'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Enabled]$x - - - Profile - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Profile]($this.PSBase.CimInstanceProperties['Profiles'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['Profiles'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Profile]$x - - - Platform - Platforms - - - Direction - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Direction]($this.PSBase.CimInstanceProperties['Direction'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['Direction'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Direction]$x - - - Action - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Action]($this.PSBase.CimInstanceProperties['Action'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['Action'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Action]$x - - - EdgeTraversalPolicy - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.EdgeTraversal]($this.PSBase.CimInstanceProperties['EdgeTraversalPolicy'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['EdgeTraversalPolicy'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.EdgeTraversal]$x - - - LSM - LooseSourceMapping - - - PrimaryStatus - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]($this.PSBase.CimInstanceProperties['PrimaryStatus'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['PrimaryStatus'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]$x - - - Status - $this.PSBase.CimInstanceProperties["Status"].Value + " (" + ($this.PSBase.CimInstanceProperties["StatusCode"].Value + 0) + ")" - - - EnforcementStatus - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatEnforcementStatus($this.PSBase.CimInstanceProperties["EnforcementStatus"].Value) - - - PolicyStoreSourceType - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]($this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]$x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetConSecRule - - - IPsecRuleName - InstanceID - - - ID - IPsecRuleName - - - Name - IPsecRuleName - - - DisplayName - $this.PSBase.CimInstanceProperties["DisplayName"].Value - param($x) ; $this.PSBase.CimInstanceProperties["DisplayName"].Value = $x ; $this.PSBase.CimInstanceProperties["ElementName"].Value = $x - - - Group - RuleGroup - - - Enabled - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Enabled]($this.PSBase.CimInstanceProperties['Enabled'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['Enabled'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Enabled]$x - - - Profile - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Profile]($this.PSBase.CimInstanceProperties['Profiles'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['Profiles'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Profile]$x - - - Platform - Platforms - - - Mode - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.IPsecMode]($this.PSBase.CimInstanceProperties['Mode'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['Mode'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.IPsecMode]$x - - - InboundSecurity - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.SecurityPolicy]($this.PSBase.CimInstanceProperties['InboundSecurity'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['InboundSecurity'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.SecurityPolicy]$x - - - SecIn - InboundSecurity - - - OutboundSecurity - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.SecurityPolicy]($this.PSBase.CimInstanceProperties['OutboundSecurity'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['OutboundSecurity'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.SecurityPolicy]$x - - - SecOut - OutboundSecurity - - - QuickModeCryptoSet - $x = $this.PSBase.CimInstanceProperties["QuickModeCryptoSet"].Value; if ($x -ne $null -and $x.ToUpperInvariant().Equals("{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE2}")) { "Default"; } else { $x } - param($x) -if ($x.PSTypeNames.Contains("Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEQMCryptoSet")) { - $this.PSBase.CimInstanceProperties["QuickModeCryptoSet"].Value = $x.ID; -} elseif ($x.ToUpperInvariant().Equals("DEFAULT")) { - $this.PSBase.CimInstanceProperties["QuickModeCryptoSet"].Value = "{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE2}"; -} else { - $this.PSBase.CimInstanceProperties["QuickModeCryptoSet"].Value = $x; -} - - - Phase1AuthSet - $x = $this.PSBase.CimInstanceProperties["Phase1AuthSet"].Value; if ($x -ne $null -and $x.ToUpperInvariant().Equals("{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE3}")) { "Default"; } else { $x } - param($x) -if ($x.PSTypeNames.Contains("Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEMMAuthSet")) { - $this.PSBase.CimInstanceProperties["Phase1AuthSet"].Value = $x.ID; -} elseif ($x.ToUpperInvariant().Equals("DEFAULT")) { - $this.PSBase.CimInstanceProperties["Phase1AuthSet"].Value = "{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE3}"; -} else { - $this.PSBase.CimInstanceProperties["Phase1AuthSet"].Value = $x; -} - - - Phase2AuthSet - $x = $this.PSBase.CimInstanceProperties["Phase2AuthSet"].Value; if ($x -ne $null -and $x.ToUpperInvariant().Equals("{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE4}")) { "Default"; } else { $x } - param($x) -if ($x.PSTypeNames.Contains("Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEEMAuthSet")) { - $this.PSBase.CimInstanceProperties["Phase2AuthSet"].Value = $x.ID; -} elseif ($x.ToUpperInvariant().Equals("DEFAULT")) { - $this.PSBase.CimInstanceProperties["Phase2AuthSet"].Value = "{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE4}"; -} else { - $this.PSBase.CimInstanceProperties["Phase2AuthSet"].Value = $x; -} - - - KeyModule - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.KeyModule]($this.PSBase.CimInstanceProperties['KeyModule'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['KeyModule'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.KeyModule]$x - - - RemoteTunnelHostname - RemoteTunnelEndpointDNSName - - - ForwardPathLifetime - MaxReturnPathLifetimeSeconds - - - EncryptedTunnelBypass - BypassTunnelIfEncrypted - - - User - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableString($this.PSBase.CimInstanceProperties["Users"].Value) - param($x) ; $this.PSBase.CimInstanceProperties["Users"].Value = $x - - - Machine - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableString($this.PSBase.CimInstanceProperties["Machines"].Value) - param($x) ; $this.PSBase.CimInstanceProperties["Machines"].Value = $x - - - PrimaryStatus - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]($this.PSBase.CimInstanceProperties['PrimaryStatus'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['PrimaryStatus'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]$x - - - Status - $this.PSBase.CimInstanceProperties["Status"].Value + " (" + ($this.PSBase.CimInstanceProperties["StatusCode"].Value + 0) + ")" - - - EnforcementStatus - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatEnforcementStatus($this.PSBase.CimInstanceProperties["EnforcementStatus"].Value) - - - PolicyStoreSourceType - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]($this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]$x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetMainModeRule - - - Name - InstanceID - - - ID - Name - - - DisplayName - $this.PSBase.CimInstanceProperties["DisplayName"].Value - param($x) ; $this.PSBase.CimInstanceProperties["DisplayName"].Value = $x ; $this.PSBase.CimInstanceProperties["ElementName"].Value = $x - - - Group - RuleGroup - - - Enabled - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Enabled]($this.PSBase.CimInstanceProperties['Enabled'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['Enabled'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Enabled]$x - - - Profile - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Profile]($this.PSBase.CimInstanceProperties['Profiles'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['Profiles'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Profile]$x - - - Platform - Platforms - - - MainModeCryptoSet - $x = $this.PSBase.CimInstanceProperties["MainModeCryptoSet"].Value; if ($x -ne $null -and $x.ToUpperInvariant().Equals("{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE1}")) { "Default"; } else { $x } - param($x) -if ($x.PSTypeNames.Contains("Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEMMCryptoSet")) { - $this.PSBase.CimInstanceProperties["MainModeCryptoSet"].Value = $x.ID; -} elseif ($x.ToUpperInvariant().Equals("DEFAULT")) { - $this.PSBase.CimInstanceProperties["MainModeCryptoSet"].Value = "{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE1}"; -} else { - $this.PSBase.CimInstanceProperties["MainModeCryptoSet"].Value = $x; -} - - - Phase1AuthSet - $x = $this.PSBase.CimInstanceProperties["Phase1AuthSet"].Value; if ($x -ne $null -and $x.ToUpperInvariant().Equals("{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE3}")) { "Default"; } else { $x } - param($x) -if ($x.PSTypeNames.Contains("Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEMMAuthSet")) { - $this.PSBase.CimInstanceProperties["Phase1AuthSet"].Value = $x.ID; -} elseif ($x.ToUpperInvariant().Equals("DEFAULT")) { - $this.PSBase.CimInstanceProperties["Phase1AuthSet"].Value = "{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE3}"; -} else { - $this.PSBase.CimInstanceProperties["Phase1AuthSet"].Value = $x; -} - - - PrimaryStatus - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]($this.PSBase.CimInstanceProperties['PrimaryStatus'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['PrimaryStatus'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]$x - - - Status - $this.PSBase.CimInstanceProperties["Status"].Value + " (" + ($this.PSBase.CimInstanceProperties["StatusCode"].Value + 0) + ")" - - - EnforcementStatus - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatEnforcementStatus($this.PSBase.CimInstanceProperties["EnforcementStatus"].Value) - - - PolicyStoreSourceType - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]($this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]$x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAddressFilter - - - LocalAddress - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableStringArray($this.PSBase.CimInstanceProperties["LocalAddress"].Value) - param($x) ; $this.PSBase.CimInstanceProperties["LocalAddress"].Value = $x - - - LocalIP - LocalAddress - - - RemoteAddress - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableStringArray($this.PSBase.CimInstanceProperties["RemoteAddress"].Value) - param($x) ; $this.PSBase.CimInstanceProperties["RemoteAddress"].Value = $x - - - RemoteIP - RemoteAddress - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetApplicationFilter - - - Program - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableString($this.PSBase.CimInstanceProperties["AppPath"].Value) - param($x) ; $this.PSBase.CimInstanceProperties["AppPath"].Value = $x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetInterfaceFilter - - - InterfaceAlias - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableStringArray($this.PSBase.CimInstanceProperties["InterfaceAlias"].Value) - param($x) ; $this.PSBase.CimInstanceProperties["InterfaceAlias"].Value = $x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetInterfaceTypeFilter - - - InterfaceType - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.InterfaceType]($this.PSBase.CimInstanceProperties['InterfaceType'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['InterfaceType'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.InterfaceType]$x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetNetworkLayerSecurityFilter - - - Authentication - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Authentication]($this.PSBase.CimInstanceProperties['Authentication'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['Authentication'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Authentication]$x - - - Encryption - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Encryption]($this.PSBase.CimInstanceProperties['Encryption'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['Encryption'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Encryption]$x - - - LocalUser - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableString($this.PSBase.CimInstanceProperties["LocalUsers"].Value) - param($x) ; $this.PSBase.CimInstanceProperties["LocalUsers"].Value = $x - - - RemoteUser - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableString($this.PSBase.CimInstanceProperties["RemoteUsers"].Value) - param($x) ; $this.PSBase.CimInstanceProperties["RemoteUsers"].Value = $x - - - RemoteMachine - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableString($this.PSBase.CimInstanceProperties["RemoteMachines"].Value) - param($x) ; $this.PSBase.CimInstanceProperties["RemoteMachines"].Value = $x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetProtocolPortFilter - - - Protocol - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableString($this.PSBase.CimInstanceProperties["Protocol"].Value) - param($x) ; $this.PSBase.CimInstanceProperties["Protocol"].Value = $x - - - LocalPort - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableStringArray($this.PSBase.CimInstanceProperties["LocalPort"].Value) - param($x) ; $this.PSBase.CimInstanceProperties["LocalPort"].Value = $x - - - RemotePort - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableStringArray($this.PSBase.CimInstanceProperties["RemotePort"].Value) - param($x) ; $this.PSBase.CimInstanceProperties["RemotePort"].Value = $x - - - IcmpType - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableStringArray($this.PSBase.CimInstanceProperties["IcmpType"].Value) - param($x) ; $this.PSBase.CimInstanceProperties["IcmpType"].Value = $x - - - DynamicTarget - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.DynamicTransport]($this.PSBase.CimInstanceProperties['DynamicTransport'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['DynamicTransport'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.DynamicTransport]$x - - - DynamicTransport - DynamicTarget - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetServiceFilter - - - Service - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableString($this.PSBase.CimInstanceProperties["ServiceName"].Value) - param($x) ; $this.PSBase.CimInstanceProperties["ServiceName"].Value = $x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEP1AuthSet - - - Name - InstanceID - - - ID - Name - - - DisplayName - $this.PSBase.CimInstanceProperties["DisplayName"].Value - param($x) ; $this.PSBase.CimInstanceProperties["DisplayName"].Value = $x ; $this.PSBase.CimInstanceProperties["ElementName"].Value = $x - - - Group - RuleGroup - - - Proposal - Proposals - - - PrimaryStatus - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]($this.PSBase.CimInstanceProperties['PrimaryStatus'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['PrimaryStatus'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]$x - - - Status - $this.PSBase.CimInstanceProperties["Status"].Value + " (" + ($this.PSBase.CimInstanceProperties["StatusCode"].Value + 0) + ")" - - - EnforcementStatus - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatEnforcementStatus($this.PSBase.CimInstanceProperties["EnforcementStatus"].Value) - - - PolicyStoreSourceType - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]($this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]$x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEP2AuthSet - - - Name - InstanceID - - - ID - Name - - - DisplayName - $this.PSBase.CimInstanceProperties["DisplayName"].Value - param($x) ; $this.PSBase.CimInstanceProperties["DisplayName"].Value = $x ; $this.PSBase.CimInstanceProperties["ElementName"].Value = $x - - - Group - RuleGroup - - - Proposal - Proposals - - - PrimaryStatus - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]($this.PSBase.CimInstanceProperties['PrimaryStatus'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['PrimaryStatus'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]$x - - - Status - $this.PSBase.CimInstanceProperties["Status"].Value + " (" + ($this.PSBase.CimInstanceProperties["StatusCode"].Value + 0) + ")" - - - EnforcementStatus - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatEnforcementStatus($this.PSBase.CimInstanceProperties["EnforcementStatus"].Value) - - - PolicyStoreSourceType - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]($this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]$x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEBasicAuthProposal - - - AuthenticationMethod - [Microsoft.Windows.Firewall.Commands.AuthenticationMethod]($this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.AuthenticationMethod]$x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEKerbAuthProposal - - - AuthenticationMethod - [Microsoft.Windows.Firewall.Commands.AuthenticationMethod]($this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.AuthenticationMethod]$x - - - Proxy - KerbProxy - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEPSKAuthProposal - - - AuthenticationMethod - [Microsoft.Windows.Firewall.Commands.AuthenticationMethod]($this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.AuthenticationMethod]$x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKECertAuthProposal - - - AuthenticationMethod - [Microsoft.Windows.Firewall.Commands.AuthenticationMethod]($this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.AuthenticationMethod]$x - - - Authority - TrustedCA - - - AuthorityType - [Microsoft.Windows.Firewall.Commands.CertificateAuthorityType]($this.PSBase.CimInstanceProperties['TrustedCAType'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['TrustedCAType'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.CertificateAuthorityType]$x - - - AccountMapping - MapToAccount - - - Signing - [Microsoft.Windows.Firewall.Commands.CertificateSigningAlgorithm]($this.PSBase.CimInstanceProperties['SigningAlgorithm'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['SigningAlgorithm'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.CertificateSigningAlgorithm]$x - - - SubjectName - CertName - - - SubjectNameType - [Microsoft.Windows.Firewall.Commands.CertificateSubjectType]($this.PSBase.CimInstanceProperties['CertNameType'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['CertNameType'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.CertificateSubjectType]$x - - - ExtendedKeyUsage - EKUs - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEMMCryptoSet - - - Name - InstanceID - - - ID - Name - - - DisplayName - $this.PSBase.CimInstanceProperties["DisplayName"].Value - param($x) ; $this.PSBase.CimInstanceProperties["DisplayName"].Value = $x ; $this.PSBase.CimInstanceProperties["ElementName"].Value = $x - - - Group - RuleGroup - - - Proposal - Proposals - - - MaxMinutes - MaxLifetimeMinutes - - - MaxSessions - MaxLifetimeSessions - - - PrimaryStatus - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]($this.PSBase.CimInstanceProperties['PrimaryStatus'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['PrimaryStatus'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]$x - - - Status - $this.PSBase.CimInstanceProperties["Status"].Value + " (" + ($this.PSBase.CimInstanceProperties["StatusCode"].Value + 0) + ")" - - - EnforcementStatus - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatEnforcementStatus($this.PSBase.CimInstanceProperties["EnforcementStatus"].Value) - - - PolicyStoreSourceType - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]($this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]$x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEQMCryptoSet - - - Name - InstanceID - - - ID - Name - - - DisplayName - $this.PSBase.CimInstanceProperties["DisplayName"].Value - param($x) ; $this.PSBase.CimInstanceProperties["DisplayName"].Value = $x ; $this.PSBase.CimInstanceProperties["ElementName"].Value = $x - - - Group - RuleGroup - - - Proposal - Proposals - - - PerfectForwardSecrecyGroup - [Microsoft.Windows.Firewall.Commands.DiffieHellmanGroup]($this.PSBase.CimInstanceProperties['PfsGroupID'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['PfsGroupID'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.DiffieHellmanGroup]$x - - - PfsGroup - PerfectForwardSecrecyGroup - - - PrimaryStatus - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]($this.PSBase.CimInstanceProperties['PrimaryStatus'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['PrimaryStatus'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]$x - - - Status - $this.PSBase.CimInstanceProperties["Status"].Value + " (" + ($this.PSBase.CimInstanceProperties["StatusCode"].Value + 0) + ")" - - - EnforcementStatus - [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatEnforcementStatus($this.PSBase.CimInstanceProperties["EnforcementStatus"].Value) - - - PolicyStoreSourceType - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]($this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]$x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEMMCryptoProposal - - - Encryption - [Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]($this.PSBase.CimInstanceProperties['CipherAlgorithm'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['CipherAlgorithm'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]$x - - - Hash - [Microsoft.Windows.Firewall.Commands.HashAlgorithm]($this.PSBase.CimInstanceProperties['HashAlgorithm'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['HashAlgorithm'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.HashAlgorithm]$x - - - KeyExchange - [Microsoft.Windows.Firewall.Commands.DiffieHellmanGroup]($this.PSBase.CimInstanceProperties['GroupID'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['GroupID'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.DiffieHellmanGroup]$x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEQMCryptoProposal - - - Encapsulation - [Microsoft.Windows.Firewall.Commands.IPsecEncapsulation]($this.PSBase.CimInstanceProperties['Encapsulation'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['Encapsulation'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.IPsecEncapsulation]$x - - - AhHash - [Microsoft.Windows.Firewall.Commands.HashAlgorithm]($this.PSBase.CimInstanceProperties['HashAlgorithmAH'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['HashAlgorithmAH'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.HashAlgorithm]$x - - - EspHash - [Microsoft.Windows.Firewall.Commands.HashAlgorithm]($this.PSBase.CimInstanceProperties['HashAlgorithmESP'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['HashAlgorithmESP'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.HashAlgorithm]$x - - - Encryption - [Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]($this.PSBase.CimInstanceProperties['CipherAlgorithm'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['CipherAlgorithm'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]$x - - - MaxKilobytes - MaxLifetimeKilobytes - - - MaxMinutes - MaxLifetimeMinutes - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetFirewallProfile - - - Profile - Name - - - Enabled - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['Enabled'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['Enabled'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x - - - DefaultInboundAction - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Action]($this.PSBase.CimInstanceProperties['DefaultInboundAction'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['DefaultInboundAction'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Action]$x - - - DefaultOutboundAction - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Action]($this.PSBase.CimInstanceProperties['DefaultOutboundAction'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['DefaultOutboundAction'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Action]$x - - - AllowInboundRules - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['AllowInboundRules'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['AllowInboundRules'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x - - - AllowLocalFirewallRules - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['AllowLocalFirewallRules'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['AllowLocalFirewallRules'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x - - - AllowLocalIPsecRules - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['AllowLocalIPsecRules'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['AllowLocalIPsecRules'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x - - - AllowUserApps - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['AllowUserApps'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['AllowUserApps'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x - - - AllowUserPorts - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['AllowUserPorts'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['AllowUserPorts'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x - - - AllowUnicastResponseToMulticast - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['AllowUnicastResponseToMulticast'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['AllowUnicastResponseToMulticast'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x - - - NotifyOnListen - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['NotifyOnListen'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['NotifyOnListen'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x - - - EnableStealthModeForIPsec - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['EnableStealthModeForIPsec'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['EnableStealthModeForIPsec'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x - - - LogMaxSizeKilobytes - $x = $this.PSBase.CimInstanceProperties["LogMaxSizeKilobytes"]; if ($x -ne $null -and $x.Value -ne $null -and $x.Value.ToString().ToUpperInvariant().Equals("4294967296")) { "NotConfigured"; } else { $x.Value } - param($x) - if ($x.ToUpperInvariant().Equals("NOTCONFIGURED")) { $this.PSBase.CimInstanceProperties["LogMaxSizeKilobytes"].Value = 4294967296; } else { $this.PSBase.CimInstanceProperties["LogMaxSizeKilobytes"].Value = [uint32]$x; } - - - LogAllowed - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['LogAllowed'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['LogAllowed'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x - - - LogBlocked - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['LogBlocked'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['LogBlocked'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x - - - LogIgnored - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['LogIgnored'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['LogIgnored'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSecDeltaCollection - - - Action - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.ChangeAction]($this.PSBase.CimInstanceProperties['Action'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['Action'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.ChangeAction]$x - - - EndpointType - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.EndpointType]($this.PSBase.CimInstanceProperties['EndpointType'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['EndpointType'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.EndpointType]$x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPsecDoSPSetting - - - Name - ElementName - - - IpV6IPsecUnauthDscp - $x = $this.PSBase.CimInstanceProperties["IpV6IPsecUnauthDscp"]; if ($x -ne $null -and $x.Value -ne $null -and $x.Value.ToString().ToUpperInvariant().Equals("255")) { "Disabled"; } else { $x.Value } - param($x) - if ($x.ToUpperInvariant().Equals("DISABLED")) { $this.PSBase.CimInstanceProperties["IpV6IPsecUnauthDscp"].Value = 255; } else { $this.PSBase.CimInstanceProperties["IpV6IPsecUnauthDscp"].Value = [uint32]$x; } - - - IpV6IPsecAuthDscp - $x = $this.PSBase.CimInstanceProperties["IpV6IPsecAuthDscp"]; if ($x -ne $null -and $x.Value -ne $null -and $x.Value.ToString().ToUpperInvariant().Equals("255")) { "Disabled"; } else { $x.Value } - param($x) - if ($x.ToUpperInvariant().Equals("DISABLED")) { $this.PSBase.CimInstanceProperties["IpV6IPsecAuthDscp"].Value = 255; } else { $this.PSBase.CimInstanceProperties["IpV6IPsecAuthDscp"].Value = [uint32]$x; } - - - IcmpV6Dscp - $x = $this.PSBase.CimInstanceProperties["IcmpV6Dscp"]; if ($x -ne $null -and $x.Value -ne $null -and $x.Value.ToString().ToUpperInvariant().Equals("255")) { "Disabled"; } else { $x.Value } - param($x) - if ($x.ToUpperInvariant().Equals("DISABLED")) { $this.PSBase.CimInstanceProperties["IcmpV6Dscp"].Value = 255; } else { $this.PSBase.CimInstanceProperties["IcmpV6Dscp"].Value = [uint32]$x; } - - - IpV6FilterExemptDscp - $x = $this.PSBase.CimInstanceProperties["IpV6FilterExemptDscp"]; if ($x -ne $null -and $x.Value -ne $null -and $x.Value.ToString().ToUpperInvariant().Equals("255")) { "Disabled"; } else { $x.Value } - param($x) - if ($x.ToUpperInvariant().Equals("DISABLED")) { $this.PSBase.CimInstanceProperties["IpV6FilterExemptDscp"].Value = 255; } else { $this.PSBase.CimInstanceProperties["IpV6FilterExemptDscp"].Value = [uint32]$x; } - - - DefBlockExemptDscp - $x = $this.PSBase.CimInstanceProperties["DefBlockExemptDscp"]; if ($x -ne $null -and $x.Value -ne $null -and $x.Value.ToString().ToUpperInvariant().Equals("255")) { "Disabled"; } else { $x.Value } - param($x) - if ($x.ToUpperInvariant().Equals("DISABLED")) { $this.PSBase.CimInstanceProperties["DefBlockExemptDscp"].Value = 255; } else { $this.PSBase.CimInstanceProperties["DefBlockExemptDscp"].Value = [uint32]$x; } - - - EnabledKeyingModules - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.DospKeyModules]($this.PSBase.CimInstanceProperties['EnabledKeyingModules'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['EnabledKeyingModules'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.DospKeyModules]$x - - - FilteringFlags - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.DospFlags]($this.PSBase.CimInstanceProperties['FilteringFlags'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['FilteringFlags'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.DospFlags]$x - - - EffectiveAddressFamily - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.AddressVersion]($this.PSBase.CimInstanceProperties['EffectiveAddressFamily'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['EffectiveAddressFamily'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.AddressVersion]$x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPsecIdentity - - - ImpersonationType - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.ImpersonationType]($this.PSBase.CimInstanceProperties['ImpersonationType'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['ImpersonationType'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.ImpersonationType]$x - - - AuthenticationMethod - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.EffectiveAuthenticationMethod]($this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.EffectiveAuthenticationMethod]$x - - - Flags - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.IdFlags]($this.PSBase.CimInstanceProperties['Flags'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['Flags'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.IdFlags]$x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetMainModeSA - - - ID - Name - - - CipherAlgorithm - [Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]($this.PSBase.CimInstanceProperties['CipherAlgorithm'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['CipherAlgorithm'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]$x - - - HashAlgorithm - [Microsoft.Windows.Firewall.Commands.HashAlgorithm]($this.PSBase.CimInstanceProperties['HashAlgorithm'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['HashAlgorithm'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.HashAlgorithm]$x - - - GroupId - [Microsoft.Windows.Firewall.Commands.DiffieHellmanGroup]($this.PSBase.CimInstanceProperties['GroupId'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['GroupId'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.DiffieHellmanGroup]$x - - - KeyModule - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.EffectiveKeyModule]($this.PSBase.CimInstanceProperties['KeyModule'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['KeyModule'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.EffectiveKeyModule]$x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetQuickModeSA - - - Name - InstanceID - - - ID - Name - - - EncapsulationMode - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.IPsecMode]($this.PSBase.CimInstanceProperties['EncapsulationMode'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['EncapsulationMode'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.IPsecMode]$x - - - Direction - $dir = $this.PSBase.CimInstanceProperties["InboundDirection"]; if ($dir -ne $null -and $dir.Value -ne $null -and $dir.Value.Equals($true)) { [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Direction]::Inbound } else { [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Direction]::Outbound } - - - FirstTransformType - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.QmSATransformType]($this.PSBase.CimInstanceProperties['FirstTransformType'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['FirstTransformType'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.QmSATransformType]$x - - - FirstIntegrityAlgorithm - [Microsoft.Windows.Firewall.Commands.HashAlgorithm]($this.PSBase.CimInstanceProperties['FirstIntegrityAlgorithm'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['FirstIntegrityAlgorithm'].Value = [System.Uint32][Microsoft.Windows.Firewall.Commands.HashAlgorithm]$x - - - FirstCipherAlgorithm - [Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]($this.PSBase.CimInstanceProperties['FirstCipherAlgorithm'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['FirstCipherAlgorithm'].Value = [System.Uint32][Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]$x - - - SecondTransformType - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.QmSATransformType]($this.PSBase.CimInstanceProperties['SecondTransformType'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['SecondTransformType'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.QmSATransformType]$x - - - SecondIntegrityAlgorithm - [Microsoft.Windows.Firewall.Commands.HashAlgorithm]($this.PSBase.CimInstanceProperties['SecondIntegrityAlgorithm'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['SecondIntegrityAlgorithm'].Value = [System.Uint32][Microsoft.Windows.Firewall.Commands.HashAlgorithm]$x - - - SecondCipherAlgorithm - [Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]($this.PSBase.CimInstanceProperties['SecondCipherAlgorithm'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['SecondCipherAlgorithm'].Value = [System.Uint32][Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]$x - - - Flags - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.QmBundleFlags]($this.PSBase.CimInstanceProperties['Flags'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['Flags'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.QmBundleFlags]$x - - - PfsGroupId - [Microsoft.Windows.Firewall.Commands.DiffieHellmanGroup]($this.PSBase.CimInstanceProperties['PfsGroupId'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['PfsGroupId'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.DiffieHellmanGroup]$x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSecuritySettingData - - - Name - ElementName - - - Exemptions - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.TrafficExemption]($this.PSBase.CimInstanceProperties['Exemptions'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['Exemptions'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.TrafficExemption]$x - - - EnableStatefulFtp - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['EnableStatefulFtp'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['EnableStatefulFtp'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x - - - EnableStatefulPptp - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['EnableStatefulPptp'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['EnableStatefulPptp'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x - - - ActiveProfile - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Profile]($this.PSBase.CimInstanceProperties['Profile'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['Profile'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Profile]$x - - - RequireFullAuthSupport - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['RequireFullAuthSupport'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['RequireFullAuthSupport'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x - - - CertValidationLevel - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.CRLCheck]($this.PSBase.CimInstanceProperties['CertValidationLevel'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['CertValidationLevel'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.CRLCheck]$x - - - AllowIPsecThroughNAT - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.IPsecThroughNAT]($this.PSBase.CimInstanceProperties['AllowIPsecThroughNAT'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['AllowIPsecThroughNAT'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.IPsecThroughNAT]$x - - - MaxSAIdleTimeSeconds - $x = $this.PSBase.CimInstanceProperties["MaxSAIdleTimeSeconds"]; if ($x -ne $null -and $x.Value -ne $null -and $x.Value.ToString().Equals("0")) { "NotConfigured"; } else { $x.Value } - param($x) - if ($x.ToUpperInvariant().Equals("NOTCONFIGURED")) { $this.PSBase.CimInstanceProperties["MaxSAIdleTimeSeconds"].Value = 0; } else { $this.PSBase.CimInstanceProperties["MaxSAIdleTimeSeconds"].Value = [uint32]$x; } - - - KeyEncoding - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.KeyEncoding]($this.PSBase.CimInstanceProperties['KeyEncoding'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['KeyEncoding'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.KeyEncoding]$x - - - EnablePacketQueuing - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PacketQueuing]($this.PSBase.CimInstanceProperties['EnablePacketQueuing'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['EnablePacketQueuing'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PacketQueuing]$x - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetGPO - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetFirewallDynamicKeywordAddress - - - PolicyStoreSourceType - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]($this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value + 0) - param($x); $this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]$x - - - - diff --git a/newton-cn/bin/Modules/NetSecurity/ko/Microsoft.Windows.Firewall.Commands.Resources.dll b/newton-cn/bin/Modules/NetSecurity/ko/Microsoft.Windows.Firewall.Commands.Resources.dll deleted file mode 100644 index bab060c..0000000 Binary files a/newton-cn/bin/Modules/NetSecurity/ko/Microsoft.Windows.Firewall.Commands.Resources.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/NetSwitchTeam/MSFT_NetSwitchTeam.cdxml b/newton-cn/bin/Modules/NetSwitchTeam/MSFT_NetSwitchTeam.cdxml deleted file mode 100644 index fe18d98..0000000 --- a/newton-cn/bin/Modules/NetSwitchTeam/MSFT_NetSwitchTeam.cdxml +++ /dev/null @@ -1,146 +0,0 @@ - - - - 1.0 - NetSwitchTeam - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSwitchTeam/MSFT_NetSwitchTeam.format.ps1xml b/newton-cn/bin/Modules/NetSwitchTeam/MSFT_NetSwitchTeam.format.ps1xml deleted file mode 100644 index aa64e0b..0000000 --- a/newton-cn/bin/Modules/NetSwitchTeam/MSFT_NetSwitchTeam.format.ps1xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - MSFT_NetSwitchTeam_ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT\StandardCimV2\MSFT_NetSwitchTeam - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSwitchTeam - - - - - - - - Name - - - - $members = Get-NetSwitchTeamMember * $_.Name - $mnames= @() - foreach($m in @($members)){$mnames += $m.Name} - $mnames - - - - - - - - - - MSFT_NetSwitchTeam_TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT\StandardCimV2\MSFT_NetSwitchTeam - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSwitchTeam - - - - - - 10 - - - - 15 - - - - - - - Name - - - - $members = $_ | Get-NetSwitchTeamMember - $mnames = @() - foreach($m in @($members)){$mnames += $m.Name} - $mnames - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSwitchTeam/MSFT_NetSwitchTeamMember.cdxml b/newton-cn/bin/Modules/NetSwitchTeam/MSFT_NetSwitchTeamMember.cdxml deleted file mode 100644 index 6e87fa3..0000000 --- a/newton-cn/bin/Modules/NetSwitchTeam/MSFT_NetSwitchTeamMember.cdxml +++ /dev/null @@ -1,25 +0,0 @@ - - - - 1.0 - NetSwitchTeamMember - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSwitchTeam/MSFT_NetSwitchTeamMember.format.ps1xml b/newton-cn/bin/Modules/NetSwitchTeam/MSFT_NetSwitchTeamMember.format.ps1xml deleted file mode 100644 index 725009c..0000000 --- a/newton-cn/bin/Modules/NetSwitchTeam/MSFT_NetSwitchTeamMember.format.ps1xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - MSFT_NetSwitchTeamMember_ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT\StandardCimV2\MSFT_NetSwitchTeamMember - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSwitchTeamMember - - - - - - - - Name - - - - InterfaceDescription - - - - Team - - - - TransmitLinkSpeed - - - - ReceiveLinkSpeed - - - - - - - - MSFT_NetSwitchTeamMember_TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT\StandardCimV2\MSFT_NetSwitchTeamMember - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSwitchTeamMember - - - - - - 12 - - - - 15 - - - - 10 - - - - 10 - - - - 10 - - - - - - - Name - - - InterfaceDescription - - - Team - - - TransmitLinkSpeed - - - ReceiveLinkSpeed - - - - - - - - diff --git a/newton-cn/bin/Modules/NetSwitchTeam/NetSwitchTeam.psd1 b/newton-cn/bin/Modules/NetSwitchTeam/NetSwitchTeam.psd1 deleted file mode 100644 index b8930a7..0000000 --- a/newton-cn/bin/Modules/NetSwitchTeam/NetSwitchTeam.psd1 +++ /dev/null @@ -1,44 +0,0 @@ -<#++ - -Copyright (c) Microsoft Corporation - -Module Name: - - NetSwitchTeam.psd1 - -Abstract: - - This module is the container schema for the NetSwitchTeam* CIM object - CmdLets. - ---#> - -@{ - GUID = 'E83097B1-4470-4F37-8CE3-A6B0AC5ED8F5' - Author = "Microsoft Corporation" - CompanyName = "Microsoft Corporation" - Copyright = "� Microsoft Corporation. All rights reserved." - HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=285556" - ModuleVersion = '1.0.0.0' - PowerShellVersion = '5.1' - NestedModules = @( - 'MSFT_NetSwitchTeam.cdxml', - 'MSFT_NetSwitchTeamMember.cdxml' - ) - FormatsToProcess = @( - 'MSFT_NetSwitchTeam.format.ps1xml', - 'MSFT_NetSwitchTeamMember.format.ps1xml' - ) - FunctionsToExport = @( - 'New-NetSwitchTeam', - 'Remove-NetSwitchTeam', - 'Get-NetSwitchTeam', - 'Rename-NetSwitchTeam', - 'Add-NetSwitchTeamMember', - 'Remove-NetSwitchTeamMember', - 'Get-NetSwitchTeamMember' - ) - CmdletsToExport = @() - AliasesToExport = @() - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetCompartment.cdxml b/newton-cn/bin/Modules/NetTCPIP/MSFT_NetCompartment.cdxml deleted file mode 100644 index 9300a8e..0000000 --- a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetCompartment.cdxml +++ /dev/null @@ -1,29 +0,0 @@ - - - - 1.0 - NetCompartment - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetIPAddress.cdxml b/newton-cn/bin/Modules/NetTCPIP/MSFT_NetIPAddress.cdxml deleted file mode 100644 index 22303eb..0000000 --- a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetIPAddress.cdxml +++ /dev/null @@ -1,436 +0,0 @@ - - - - 1.0.0 - NetIPAddress - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetIPInterface.cdxml b/newton-cn/bin/Modules/NetTCPIP/MSFT_NetIPInterface.cdxml deleted file mode 100644 index eb03145..0000000 --- a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetIPInterface.cdxml +++ /dev/null @@ -1,479 +0,0 @@ - - - - 1.0.0 - - NetIPInterface - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetIPv4Protocol.cdxml b/newton-cn/bin/Modules/NetTCPIP/MSFT_NetIPv4Protocol.cdxml deleted file mode 100644 index 2fed106..0000000 --- a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetIPv4Protocol.cdxml +++ /dev/null @@ -1,239 +0,0 @@ - - - - 1.0.0 - NetIPv4Protocol - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetIPv6Protocol.cdxml b/newton-cn/bin/Modules/NetTCPIP/MSFT_NetIPv6Protocol.cdxml deleted file mode 100644 index 23f8d78..0000000 --- a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetIPv6Protocol.cdxml +++ /dev/null @@ -1,292 +0,0 @@ - - - - 1.0.0 - NetIPv6Protocol - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetNeighbor.cdxml b/newton-cn/bin/Modules/NetTCPIP/MSFT_NetNeighbor.cdxml deleted file mode 100644 index d867b42..0000000 --- a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetNeighbor.cdxml +++ /dev/null @@ -1,234 +0,0 @@ - - - - 1.0.0 - NetNeighbor - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetOffloadGlobalSetting.cdxml b/newton-cn/bin/Modules/NetTCPIP/MSFT_NetOffloadGlobalSetting.cdxml deleted file mode 100644 index 1eca6cc..0000000 --- a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetOffloadGlobalSetting.cdxml +++ /dev/null @@ -1,109 +0,0 @@ - - - - 1.0.0 - NetOffloadGlobalSetting - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetPrefixPolicy.cdxml b/newton-cn/bin/Modules/NetTCPIP/MSFT_NetPrefixPolicy.cdxml deleted file mode 100644 index 184fbeb..0000000 --- a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetPrefixPolicy.cdxml +++ /dev/null @@ -1,33 +0,0 @@ - - - - 1.0.0 - NetPrefixPolicy - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetRoute.cdxml b/newton-cn/bin/Modules/NetTCPIP/MSFT_NetRoute.cdxml deleted file mode 100644 index fe8ffe5..0000000 --- a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetRoute.cdxml +++ /dev/null @@ -1,376 +0,0 @@ - - - - 1.0.0 - NetRoute - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetTCPConnection.cdxml b/newton-cn/bin/Modules/NetTCPIP/MSFT_NetTCPConnection.cdxml deleted file mode 100644 index 2af7fcc..0000000 --- a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetTCPConnection.cdxml +++ /dev/null @@ -1,100 +0,0 @@ - - - - 1.0.0 - NetTCPConnection - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetTCPSetting.cdxml b/newton-cn/bin/Modules/NetTCPIP/MSFT_NetTCPSetting.cdxml deleted file mode 100644 index 233829d..0000000 --- a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetTCPSetting.cdxml +++ /dev/null @@ -1,324 +0,0 @@ - - - - 1.0.0 - NetTCPSetting - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetTransportFilter.cdxml b/newton-cn/bin/Modules/NetTCPIP/MSFT_NetTransportFilter.cdxml deleted file mode 100644 index 88369a7..0000000 --- a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetTransportFilter.cdxml +++ /dev/null @@ -1,126 +0,0 @@ - - - - 1.0.0 - NetTransportFilter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetUDPEndpoint.cdxml b/newton-cn/bin/Modules/NetTCPIP/MSFT_NetUDPEndpoint.cdxml deleted file mode 100644 index 245b8a0..0000000 --- a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetUDPEndpoint.cdxml +++ /dev/null @@ -1,39 +0,0 @@ - - - - 1.0.0 - NetUDPEndpoint - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetUDPSetting.cdxml b/newton-cn/bin/Modules/NetTCPIP/MSFT_NetUDPSetting.cdxml deleted file mode 100644 index 279ceb5..0000000 --- a/newton-cn/bin/Modules/NetTCPIP/MSFT_NetUDPSetting.cdxml +++ /dev/null @@ -1,46 +0,0 @@ - - - - 1.0.0 - NetUDPSetting - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/NetTCPIP/NetIPConfiguration.psm1 b/newton-cn/bin/Modules/NetTCPIP/NetIPConfiguration.psm1 deleted file mode 100644 index 289a33b..0000000 --- a/newton-cn/bin/Modules/NetTCPIP/NetIPConfiguration.psm1 +++ /dev/null @@ -1,300 +0,0 @@ -class NetIPConfiguration -{ - [string] $ComputerName - [string] $InterfaceAlias - [int] $InterfaceIndex - [string] $InterfaceDescription - [int] $CompartmentId - [Microsoft.Management.Infrastructure.CimInstance] $NetAdapter - [Microsoft.Management.Infrastructure.CimInstance] $NetCompartment - [Microsoft.Management.Infrastructure.CimInstance] $NetIPv6Interface - [Microsoft.Management.Infrastructure.CimInstance] $NetIPv4Interface - [Microsoft.Management.Infrastructure.CimInstance] $NetProfile - [Microsoft.Management.Infrastructure.CimInstance[]] $AllIPAddresses - [Microsoft.Management.Infrastructure.CimInstance[]] $IPv6Address - [Microsoft.Management.Infrastructure.CimInstance[]] $IPv6TemporaryAddress - [Microsoft.Management.Infrastructure.CimInstance[]] $IPv6LinkLocalAddress - [Microsoft.Management.Infrastructure.CimInstance[]] $IPv4Address - [Microsoft.Management.Infrastructure.CimInstance[]] $IPv6DefaultGateway - [Microsoft.Management.Infrastructure.CimInstance[]] $IPv4DefaultGateway - [Microsoft.Management.Infrastructure.CimInstance[]] $DNSServer - [bool] $Detailed = $false -} - -# .Link -# http://go.microsoft.com/fwlink/?LinkId=253567 -# .ExternalHelp NetIPConfiguration.psm1-help.xml -function Get-NetIPConfiguration -{ - [CmdletBinding(DefaultParametersetName="Alias" )] - Param( - [Parameter(ParameterSetName = "Alias", Mandatory = $false, ValueFromPipelineByPropertyName = $true, Position = 0)] [Alias('ifAlias')] [string]$InterfaceAlias = "*", - [Parameter(ParameterSetName = "Index", Mandatory = $true, ValueFromPipelineByPropertyName = $true)] [Alias('ifIndex')] [int]$InterfaceIndex = -1, - [Parameter(ParameterSetName = "All", Mandatory = $true)] [Alias('IncludeAllInterfaces')] [switch]$All = $false, - [Parameter(Mandatory = $false)] [Alias('IncludeAllCompartments')] [switch]$AllCompartments = $false, - [Parameter(Mandatory = $false, ValueFromPipelineByPropertyName = $true)] [int]$CompartmentId = -1, - [Parameter(Mandatory = $false)] [switch]$Detailed = $false, - [Parameter(Mandatory = $false, ValueFromPipelineByPropertyName = $true)] [Alias('PSComputerName','ComputerName')] [Microsoft.Management.Infrastructure.CimSession]$CimSession = $null - ) - Process - { - # - # Session defaults to localhost. - # - if ($CimSession -eq $null) - { - $CimSession = New-CimSession - $ComputerName = (Get-CimInstance win32_ComputerSystem).name - } - else - { - $ComputerName = $CimSession.ComputerName - } - - # - # Return hidden interfaces if the user query is for a specific interface. - # - if (($InterfaceAlias -ne "*") -or ($InterfaceIndex -ne -1)) - { - $All = $true - } - - # - # CompartmentId requires the AllCompartments switch. - # - if ($CompartmentId -ne -1) - { - $AllCompartments = $true; - $Compartments = Get-NetCompartment -CompartmentId $CompartmentId -CimSession $CimSession - } - else - { - $Compartments = Get-NetCompartment -CimSession $CimSession - } - - # - # Retrieve NetAdapters and NetIPInterfaces matching the user query. - # - if ($InterfaceIndex -ne -1) - { - $Adapters = Get-NetAdapter -InterfaceIndex $InterfaceIndex -IncludeHidden -CimSession $CimSession -ErrorAction SilentlyContinue - $IPInterfaces = Get-NetIPInterface -InterfaceIndex $InterfaceIndex -IncludeAllCompartments:$AllCompartments -PolicyStore ActiveStore -CimSession $CimSession - } - elseif ($InterfaceAlias -ne "*") - { - $Adapters = Get-NetAdapter -Name $InterfaceAlias -IncludeHidden -CimSession $CimSession -ErrorAction SilentlyContinue - $IPInterfaces = Get-NetIPInterface -InterfaceAlias $InterfaceAlias -IncludeAllCompartments:$AllCompartments -PolicyStore ActiveStore -CimSession $CimSession - } - else - { - $Adapters = Get-NetAdapter -IncludeHidden -CimSession $CimSession - $IPInterfaces = Get-NetIPInterface -IncludeAllCompartments:$AllCompartments -PolicyStore ActiveStore -CimSession $CimSession - } - - # - # Filter out other compartments if the user query is for a specific compartment. - # - if ($CompartmentId -ne -1) - { - $IPInterfaces = $IPInterfaces | where CompartmentId -eq $CompartmentId; - } - - # - # Get the indices of all interfaces that are bound to IP. - # - $IfIndices = $IPInterfaces | select -ExpandProperty ifIndex -Unique - - # - # Create a NetIPConfiguration for each interface index. - # - $IPConfigs = @() - - # - # Check if the Get-NetConnectionProfile cmdlet is available. - # - $NetConnectionCmdletExists = Get-Command Get-NetConnectionProfile -ErrorAction SilentlyContinue - - # - # Check if the Get-DnsClientServerAddress cmdlet is available. - # - $DNSClientCmdletExists = Get-Command Get-DnsClientServerAddress -ErrorAction SilentlyContinue - - foreach ($IfIndex in $IfIndices) - { - $IPConfig = [NetIPConfiguration]::New() - $IPConfig.ComputerName = $ComputerName - $IPConfig.InterfaceIndex = $IfIndex - $IPConfig.Detailed = $Detailed - - # - # Link up the NetAdapter and NetIPInterface objects. - # - $IPConfig.NetAdapter = $Adapters | where InterfaceIndex -eq $IfIndex - $IPConfig.NetIPv4Interface = $IPInterfaces | where {($_.InterfaceIndex -eq $IfIndex ) -and ($_.AddressFamily -eq "IPv4")} - $IPConfig.NetIPv6Interface = $IPInterfaces | where {($_.InterfaceIndex -eq $IfIndex ) -and ($_.AddressFamily -eq "IPv6")} - - # - # Filter out hidden objects if necessary. - # - if ((-not $All) -and ($IPConfig.NetAdapter.Hidden)) - { - continue - } - - # - # Filter out objects with no underlying NetAdapter, with two exceptions: - # - VPN interfaces have a LowestIfNetLuid, but should not be linked to a NetAdapter. - # - Isolation interfaces also have an IsolationId and should be linked to a NetAdapter. - # - if ($IPConfig.NetAdapter -eq $null) - { - if ($IPConfig.NetIPv6Interface.LowestIfNetLuid -ne 0) - { - if ($IPConfig.NetIPv6Interface.IsolationId -ne 0) - { - $IPConfig.NetAdapter = $Adapters | where NetLuid -eq $IPConfig.NetIPv6Interface.LowestIfNetLuid - } - } - elseif ($IPConfig.NetIPv4Interface.LowestIfNetLuid -ne 0) - { - if ($IPConfig.NetIPv4Interface.IsolationId -ne 0) - { - $IPConfig.NetAdapter = $Adapters | where NetLuid -eq $IPConfig.NetIPv4Interface.LowestIfNetLuid - } - } - else - { - continue - } - } - - # - # Find the best object to source the interface alias and compartment ID. - # - if ($IPConfig.NetIPv6Interface -ne $null) - { - $IPConfig.InterfaceAlias = $IPConfig.NetIPv6Interface.InterfaceAlias - $IPConfig.CompartmentId = $IPConfig.NetIPv6Interface.CompartmentId - } - elseif ($IPConfig.NetIPv4Interface -ne $null) - { - $IPConfig.InterfaceAlias = $IPConfig.NetIPv4Interface.InterfaceAlias - $IPConfig.CompartmentId = $IPConfig.NetIPv4Interface.CompartmentId - } - - # - # Escape wilcard characters in interface alias. - # - $IfAlias = [System.Management.Automation.WildcardPattern]::Escape($IPConfig.InterfaceAlias) - - # - # Get NetAdapter properties. - # - if ($IPConfig.NetAdapter -ne $null) - { - $IPConfig.InterfaceDescription = $IPConfig.NetAdapter.InterfaceDescription - } - - $IPConfig.NetCompartment = $Compartments | where CompartmentId -eq $IPConfig.CompartmentId - if ($NetConnectionCmdletExists) - { - $IPConfig.NetProfile = Get-NetConnectionProfile -InterfaceAlias $IfAlias -CimSession $CimSession -ErrorAction SilentlyContinue - } - - # Begin Verbose Section - write-verbose "----------------------------------------" - write-verbose "Interface $IfAlias" - write-verbose "----------------------------------------" - write-verbose "InterfaceAlias: Get-NetAdapter -Name '$IfAlias' -CimSession $ComputerName | select InterfaceAlias" - write-verbose "InterfaceIndex: Get-NetAdapter -Name '$IfAlias' -CimSession $ComputerName | select InterfaceIndex" - write-verbose "InterfaceDescription: Get-NetAdapter -Name '$IfAlias' -CimSession $ComputerName | select InterfaceDescription" - write-verbose "NetCompartment: Get-NetCompartment -CompartmentId '$CompartmentId' -CimSession $ComputerName" - if ($NetConnectionCmdletExists) - { - write-verbose "NetProfile: Get-NetConnectionProfile -InterfaceAlias '$IfAlias' -CimSession $ComputerName" - } - write-verbose "NetIPv6Interface: Get-NetIPInterface -InterfaceAlias '$IfAlias' -AddressFamily IPv6 -PolicyStore ActiveStore -CimSession $ComputerName" - write-verbose "NetIPv4Interface: Get-NetIPInterface -InterfaceAlias '$IfAlias' -AddressFamily IPv4 -PolicyStore ActiveStore -CimSession $ComputerName" - # End Verbose Section - - # - # Get IPv6 addresses. - # - $Addresses = Get-NetIPAddress -InterfaceAlias $IfAlias -AddressFamily IPv6 -IncludeAllCompartments:$AllCompartments -PolicyStore ActiveStore -CimSession $CimSession -ErrorAction SilentlyContinue - write-verbose "IPv6Address: Get-NetIPAddress -InterfaceAlias '$IfAlias' -AddressFamily IPv6 -PolicyStore ActiveStore -CimSession $ComputerName" - - $IPv6Addresses = @() - $IPv6LinkLocalAddresses = @() - $IPv6TemporaryAddresses = @() - - foreach ($Address in $Addresses) - { - if (($Address.PrefixOrigin -eq "RouterAdvertisement") -and ($Address.SuffixOrigin -eq "Random")) - { - $IPv6TemporaryAddresses += $Address - } - elseif (($Address.PrefixOrigin -eq "WellKnown") -and ($Address.SuffixOrigin -eq "Link")) - { - $IPv6LinkLocalAddresses += $Address - } - else - { - $IPv6Addresses += $Address - } - } - - $IPConfig.IPv6Address = $IPv6Addresses - $IPConfig.IPv6TemporaryAddress = $IPv6TemporaryAddresses - $IPConfig.IPv6LinkLocalAddress = $IPv6LinkLocalAddresses - - # - # Get IPv4 addresses. - # - $IPConfig.IPv4Address = Get-NetIPAddress -InterfaceAlias $IfAlias -AddressFamily IPv4 -IncludeAllCompartments:$AllCompartments -PolicyStore ActiveStore -CimSession $CimSession -ErrorAction SilentlyContinue - write-verbose "IPv4Address: Get-NetIPAddress -InterfaceAlias '$IfAlias' -AddressFamily IPv4 -PolicyStore ActiveStore -CimSession $ComputerName" - - $IPConfig.AllIPAddresses = $IPConfig.IPv4Address + $IPv6Addresses + $IPv6TemporaryAddresses + $IPv6LinkLocalAddresses - - # - # Get default gateway. - # - $IPConfig.IPv6DefaultGateway = Get-NetRoute -DestinationPrefix "::/0" -InterfaceAlias $IfAlias -IncludeAllCompartments:$AllCompartments -PolicyStore ActiveStore -CimSession $CimSession -ErrorAction SilentlyContinue - $IPConfig.IPv4DefaultGateway = Get-NetRoute -DestinationPrefix "0.0.0.0/0" -InterfaceAlias $IfAlias -IncludeAllCompartments:$AllCompartments -PolicyStore ActiveStore -CimSession $CimSession -ErrorAction SilentlyContinue - write-verbose "IPv6DefaultGateway: Get-NetRoute -DestinationPrefix '::/0' -InterfaceAlias '$IfAlias' -PolicyStore ActiveStore -CimSession $ComputerName | select NextHop" - write-verbose "IPv4DefaultGateway: Get-NetRoute -DestinationPrefix '0.0.0.0/0' -InterfaceAlias '$IfAlias' -PolicyStore ActiveStore -CimSession $ComputerName | select NextHop" - - # - # Get DNS servers. - # - if ($DNSClientCmdletExists) - { - $IPConfig.DNSServer = Get-DnsClientServerAddress -InterfaceAlias $IfAlias -CimSession $CimSession -ErrorAction SilentlyContinue | Sort AddressFamily -Descending - write-verbose "DNSServer: Get-DnsClientServerAddress -InterfaceAlias '$IfAlias' -CimSession $ComputerName | select ServerAddresses" - } - - $IPConfigs += $IPConfig - } - - # - # Group the results by compartment, where each group is sorted as: - # - first the interfaces with connected NetAdapters sorted by media type, - # - then the interfaces without a NetAdapter, - # - then the interfaces with disconnected NetAdapters sorted by media type. - # - $Return = @() - $CompartmentIds = $IPInterfaces | select -ExpandProperty CompartmentId -Unique | sort {$_.CompartmentId} - - foreach ($CompartmentId in $CompartmentIds) - { - $IPConfigsInCompartment = $IPConfigs | where {$_.CompartmentId -eq $CompartmentId} - $Return += $IPConfigsInCompartment | where {$_.NetAdapter.Status -eq "Up" } | sort {$_.NetAdapter.MediaType, $_.InterfaceIndex} - $Return += $IPConfigsInCompartment | where {$_.NetAdapter -eq $null} | sort {$_.InterfaceIndex} - $Return += $IPConfigsInCompartment | where {($_.NetAdapter -ne $null) -and ($_.NetAdapter.Status -ne "Up")} | sort {$_.NetAdapter.MediaType} | sort {$_.NetAdapter.Status} -Descending - } - - return $Return - } -} - -New-Alias gip Get-NetIPConfiguration -Export-ModuleMember -Alias gip -Function Get-NetIPConfiguration diff --git a/newton-cn/bin/Modules/NetTCPIP/NetTCPIP.psd1 b/newton-cn/bin/Modules/NetTCPIP/NetTCPIP.psd1 deleted file mode 100644 index 5950847..0000000 --- a/newton-cn/bin/Modules/NetTCPIP/NetTCPIP.psd1 +++ /dev/null @@ -1,78 +0,0 @@ -@{ - GUID = "{2d0b6c7f-16a0-4185-843f-ae47b6db4551}" - Author = "Microsoft Corporation" - CompanyName = "Microsoft Corporation" - Copyright = "© Microsoft Corporation. All rights reserved." - HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=390802" - ModuleVersion = "1.0.0.0" - - PowerShellVersion = "5.1" - # Supported PSEditions - CompatiblePSEditions = @('Desktop', 'Core') - - NestedModules = @( - "MSFT_NetCompartment", - "MSFT_NetIPAddress", - "MSFT_NetIPInterface", - "MSFT_NetIPv4Protocol", - "MSFT_NetIPv6Protocol", - "MSFT_NetNeighbor", - "MSFT_NetOffloadGlobalSetting", - "MSFT_NetPrefixPolicy", - "MSFT_NetRoute", - "MSFT_NetTCPConnection", - "MSFT_NetTCPSetting", - "MSFT_NetTransportFilter", - "MSFT_NetUDPEndpoint", - "MSFT_NetUDPSetting", - "NetIPConfiguration", - "Test-NetConnection" - ) - - FormatsToProcess = @('Tcpip.Format.ps1xml') - TypesToProcess = @('Tcpip.Types.ps1xml') - - FunctionsToExport = @( - "Get-NetIPAddress", - "Get-NetIPInterface", - "Get-NetIPv4Protocol", - "Get-NetIPv6Protocol", - "Get-NetNeighbor", - "Get-NetOffloadGlobalSetting", - "Get-NetPrefixPolicy", - "Get-NetRoute", - "Get-NetTCPConnection", - "Get-NetTCPSetting", - "Get-NetTransportFilter", - "Get-NetUDPEndpoint", - "Get-NetUDPSetting", - "Get-NetCompartment", - "Get-NetIPConfiguration" - "New-NetIPAddress", - "New-NetNeighbor", - "New-NetRoute", - "New-NetTransportFilter", - "Remove-NetIPAddress", - "Remove-NetNeighbor", - "Remove-NetRoute", - "Remove-NetTransportFilter", - "Find-NetRoute", - "Set-NetIPAddress", - "Set-NetIPInterface", - "Set-NetIPv4Protocol", - "Set-NetIPv6Protocol", - "Set-NetNeighbor", - "Set-NetOffloadGlobalSetting", - "Set-NetRoute", - "Set-NetTCPSetting", - "Set-NetUDPSetting", - "Test-NetConnection" - ) - - AliasesToExport = @( - "gip", - "TNC" - ) - - CmdletsToExport = @() -} diff --git a/newton-cn/bin/Modules/NetTCPIP/Tcpip.Format.ps1xml b/newton-cn/bin/Modules/NetTCPIP/Tcpip.Format.ps1xml deleted file mode 100644 index 6fab2b6..0000000 --- a/newton-cn/bin/Modules/NetTCPIP/Tcpip.Format.ps1xml +++ /dev/null @@ -1,2043 +0,0 @@ - - - - - - - DefaultView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetRoute - - - - - - 7 - - - 46 - - - 40 - - - 11 - - - - 8 - - - - 11 - - - - - - - InterfaceIndex - - - DestinationPrefix - - - NextHop - - - RouteMetric - Right - - - InterfaceMetric - - - Store - - - - - - - - - ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetRoute - - - - - - - DestinationPrefix - - - InterfaceIndex - - - InterfaceAlias - - - CompartmentId - - - AddressFamily - - - NextHop - - - Publish - - - State - - - RouteMetric - - - InterfaceMetric - - - Protocol - - - - - if ($_.ValidLifetime.Days -eq 10675199 -and - $_.ValidLifetime.Hours -eq 2 -and - $_.ValidLifetime.Minutes -eq 48 -and - $_.ValidLifetime.Seconds -eq 5 -and - $_.ValidLifetime.Milliseconds -eq 477) { - “Infinite ([TimeSpan]::MaxValue)” - } else { - $_.ValidLifetime.ToString() - } - - - - - - - if ($_.PreferredLifetime.Days -eq 10675199 -and - $_.PreferredLifetime.Hours -eq 2 -and - $_.PreferredLifetime.Minutes -eq 48 -and - $_.PreferredLifetime.Seconds -eq 5 -and - $_.PreferredLifetime.Milliseconds -eq 477) { - “Infinite ([TimeSpan]::MaxValue)” - } else { - $_.PreferredLifetime.ToString() - } - - - - - - Store - - - - - - - - - DefaultView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPAddress - - - - - - - IPAddress - - - InterfaceIndex - - - InterfaceAlias - - - AddressFamily - - - Type - - - PrefixLength - - - PrefixOrigin - - - SuffixOrigin - - - AddressState - - - - - if ($_.ValidLifetime.Days -eq 10675199 -and - $_.ValidLifetime.Hours -eq 2 -and - $_.ValidLifetime.Minutes -eq 48 -and - $_.ValidLifetime.Seconds -eq 5 -and - $_.ValidLifetime.Milliseconds -eq 477) { - “Infinite ([TimeSpan]::MaxValue)” - } else { - $_.ValidLifetime.ToString() - } - - - - - - - if ($_.PreferredLifetime.Days -eq 10675199 -and - $_.PreferredLifetime.Hours -eq 2 -and - $_.PreferredLifetime.Minutes -eq 48 -and - $_.PreferredLifetime.Seconds -eq 5 -and - $_.PreferredLifetime.Milliseconds -eq 477) { - “Infinite ([TimeSpan]::MaxValue)” - } else { - $_.PreferredLifetime.ToString() - } - - - - - SkipAsSource - - - - Store - - - - - - - - - TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPAddress - - - - - - 7 - - - 47 - - - 12 - - - 12 - - - 12 - - - 12 - - - - 11 - - - - - - - InterfaceIndex - - - IPAddress - - - PrefixLength - Right - - - PrefixOrigin - - - SuffixOrigin - - - AddressState - - - Store - - - - - - - - - DefaultView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNeighbor - - - - - - 7 - - - 50 - - - 21 - - - 11 - - - - 15 - - - - - - - InterfaceIndex - - - IPAddress - - - LinkLayerAddress - - - State - - - Store - - - - - - - - - ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNeighbor - - - - - - - IPAddress - - - InterfaceIndex - - - InterfaceAlias - - - AddressFamily - - - LinkLayerAddress - - - State - - - - Store - - - - - - - - - DefaultView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPInterface - - - - - - 7 - - - 31 - - - 13 - - - - 12 - - - 15 - - - 8 - - - 15 - - - - 11 - - - - - - - InterfaceIndex - - - InterfaceAlias - - - AddressFamily - - - NlMtu - Right - - - InterfaceMetric - Right - - - Dhcp - - - ConnectionState - - - Store - - - - - - - - - ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPInterface - - - - - - - InterfaceIndex - - - InterfaceAlias - - - CompartmentId - - - AddressFamily - - - Forwarding - - - ClampMss - - - Advertising - - - NlMtu - - - - AutomaticMetric - - - InterfaceMetric - - - NeighborDiscoverySupported - - - NeighborUnreachabilityDetection - - - BaseReachableTime - - - - ReachableTime - - - - RetransmitTime - - - - DadTransmits - - - DadRetransmitTime - - - - RouterDiscovery - - - ManagedAddressConfiguration - - - OtherStatefulConfiguration - - - WeakHostSend - - - WeakHostReceive - - - IgnoreDefaultRoutes - - - - - if ($_.AdvertisedRouterLifetime.Days -eq 10675199 -and - $_.AdvertisedRouterLifetime.Hours -eq 2 -and - $_.AdvertisedRouterLifetime.Minutes -eq 48 -and - $_.AdvertisedRouterLifetime.Seconds -eq 5 -and - $_.AdvertisedRouterLifetime.Milliseconds -eq 477) { - "Infinite ([TimeSpan]::MaxValue)" - } else { - $_.AdvertisedRouterLifetime.ToString() - } - - - - - AdvertiseDefaultRoute - - - CurrentHopLimit - - - ForceArpNdWolPattern - - - DirectedMacWolPattern - - - EcnMarking - - - Dhcp - - - ConnectionState - - - - Store - - - - - - - - - DefaultView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetPrefixPolicy - - - - - 60 - - - 10 - - - 10 - - - - - - - Prefix - - - Precedence - Right - - - Label - Right - - - - - - - - - ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetPrefixPolicy - - - - - - - Prefix - - - Precedence - - - Label - - - - - - - - - DefaultView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPv6Protocol - - - - - - - DefaultHopLimit - - - NeighborCacheLimit - - - - RouteCacheLimit - - - - ReassemblyLimit - - - - IcmpRedirects - - - SourceRoutingBehavior - - - DhcpMediaSense - - - MediaSenseEventLog - - - MldLevel - - - MldVersion - - - MulticastForwarding - - - GroupForwardedFragments - - - RandomizeIdentifiers - - - AddressMaskReply - - - UseTemporaryAddresses - - - MaxDadAttempts - - - - - - if ($_.MaxValidLifetime.Days -eq 10675199 -and - $_.MaxValidLifetime.Hours -eq 2 -and - $_.MaxValidLifetime.Minutes -eq 48 -and - $_.MaxValidLifetime.Seconds -eq 5 -and - $_.MaxValidLifetime.Milliseconds -eq 477) { - “Infinite ([TimeSpan]::MaxValue)” - } else { - $_.MaxValidLifetime.ToString() - } - - - - - - - if ($_.MaxPreferredLifetime.Days -eq 10675199 -and - $_.MaxPreferredLifetime.Hours -eq 2 -and - $_.MaxPreferredLifetime.Minutes -eq 48 -and - $_.MaxPreferredLifetime.Seconds -eq 5 -and - $_.MaxPreferredLifetime.Milliseconds -eq 477) { - “Infinite ([TimeSpan]::MaxValue)” - } else { - $_.MaxPreferredLifetime.ToString() - } - - - - - - - if ($_.RegenerateTime.Days -eq 10675199 -and - $_.RegenerateTime.Hours -eq 2 -and - $_.RegenerateTime.Minutes -eq 48 -and - $_.RegenerateTime.Seconds -eq 5 -and - $_.RegenerateTime.Milliseconds -eq 477) { - “Infinite ([TimeSpan]::MaxValue)” - } else { - $_.RegenerateTime.ToString() - } - - - - - - - if ($_.MaxRandomTime.Days -eq 10675199 -and - $_.MaxRandomTime.Hours -eq 2 -and - $_.MaxRandomTime.Minutes -eq 48 -and - $_.MaxRandomTime.Seconds -eq 5 -and - $_.MaxRandomTime.Milliseconds -eq 477) { - “Infinite ([TimeSpan]::MaxValue)” - } else { - $_.MaxRandomTime.ToString() - } - - - - - DeadGatewayDetection - - - - - - - - - TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPv6Protocol - - - - - 15 - - - 13 - - - 14 - - - 11 - - - 20 - - - 21 - - - 14 - - - - - - - DefaultHopLimit - - - IcmpRedirects - - - DhcpMediaSense - - - MldVersion - - - RandomizeIdentifiers - - - UseTemporaryAddresses - - - MaxDadAttempts - - - - - - - - - DefaultView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPv4Protocol - - - - - - - DefaultHopLimit - - - NeighborCacheLimit - - - - RouteCacheLimit - - - - ReassemblyLimit - - - - IcmpRedirects - - - SourceRoutingBehavior - - - DhcpMediaSense - - - MediaSenseEventLog - - - IGMPLevel - - - IGMPVersion - - - MulticastForwarding - - - GroupForwardedFragments - - - RandomizeIdentifiers - - - AddressMaskReply - - - MinimumMtu - - - - DeadGatewayDetection - - - - - - - - - TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPv4Protocol - - - - - 15 - - - 13 - - - 14 - - - 11 - - - 20 - - - - - - - DefaultHopLimit - - - IcmpRedirects - - - DhcpMediaSense - - - IGMPVersion - - - RandomizeIdentifiers - - - - - - - - - - DefaultView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTCPSetting - - - - - - - SettingName - - - MinRto - - - - InitialCongestionWindow - - - - CongestionProvider - - - CwndRestart - - - DelayedAckTimeout - - - - DelayedAckFrequency - - - MemoryPressureProtection - - - AutoTuningLevelLocal - - - AutoTuningLevelGroupPolicy - - - AutoTuningLevelEffective - - - EcnCapability - - - Timestamps - - - InitialRto - - - - ScalingHeuristics - - - DynamicPortRangeStartPort - - - DynamicPortRangeNumberOfPorts - - - AutomaticUseCustom - - - NonSackRttResiliency - - - ForceWS - - - MaxSynRetransmissions - - - AutoReusePortRangeStartPort - - - AutoReusePortRangeNumberOfPorts - - - - - - - - - TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTCPSetting - - - - - 11 - - - 18 - - - - 10 - - - - 14 - - - 11 - - - 17 - - - 17 - - - 24 - - - - - - - SettingName - - - CongestionProvider - - - MinRto - Right - - - InitialRto - Right - - - CwndRestart - - - DelayedAckTimeout - Right - - - DelayedAckFrequency - Right - - - AutoTuningLevelEffective - - - - - - - - - DefaultView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetUDPSetting - - - - - - - DynamicPortRangeStartPort - - - DynamicPortRangeNumberOfPorts - - - - - - - - - TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetUDPSetting - - - - - 25 - - - 30 - - - - - - - DynamicPortRangeStartPort - - - DynamicPortRangeNumberOfPorts - - - - - - - - - - DefaultView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTransportFilter - - - - - - - SettingName - - - Protocol - - - LocalPortStart - - - LocalPortEnd - - - RemotePortStart - - - RemotePortEnd - - - DestinationPrefix - - - - - - - - - TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTransportFilter - - - - - 12 - - - 8 - - - 14 - - - 12 - - - 15 - - - 13 - - - 39 - - - - - - - SettingName - - - Protocol - - - LocalPortStart - - - LocalPortEnd - - - RemotePortStart - - - RemotePortEnd - - - DestinationPrefix - - - - - - - - - DefaultView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTCPConnection - - - - - 35 - - - 9 - - - 35 - - - 10 - - - 11 - - - 14 - - - 14 - - - - - - - LocalAddress - - - LocalPort - - - RemoteAddress - - - RemotePort - - - State - - - AppliedSetting - - - OwningProcess - - - - - - - - - ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTCPConnection - - - - - - - LocalAddress - - - LocalPort - - - RemoteAddress - - - RemotePort - - - State - - - AppliedSetting - - - OwningProcess - - - - - if ($_.CreationTime.Year -eq 1600) { - "N/A" - } else { - $_.CreationTime.ToString() - } - - - - - OffloadState - - - - - - - - - DefaultView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetUDPEndpoint - - - - - 40 - - - 15 - - - - - - - LocalAddress - - - LocalPort - - - - - - - - - ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetUDPEndpoint - - - - - - - LocalAddress - - - LocalPort - - - OwningProcess - - - - - if ($_.CreationTime.Year -eq 1600) { - "N/A" - } else { - $_.CreationTime.ToString() - } - - - - - - - - - - - ListView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetCompartment - - - - - - - CompartmentId - - - CompartmentDescription - - - CompartmentGuid - - - - - - - - DefaultView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetOffloadGlobalSetting - - - - - - - ReceiveSideScaling - - - ReceiveSegmentCoalescing - - - Chimney - - - TaskOffload - - - NetworkDirect - - - NetworkDirectAcrossIPSubnets - - - PacketCoalescingFilter - - - - - - - - - NetIPConfiguration - - NetIPConfiguration - - - - - - - - - - Detailed - - ComputerName - - - - InterfaceAlias - - - - InterfaceIndex - - - - InterfaceDescription - - - - - - Detailed - - $_.NetCompartment.CompartmentId - - - - - - Detailed - - $_.NetCompartment.CompartmentDescription - - - - - - ($_.NetAdapter -ne $null) -and ($_.Detailed) - - $_.NetAdapter.LinkLayerAddress - - - - - - ($_.NetAdapter -ne $null) -and (($_.NetAdapter.Status -ne "Up") -or ($_.Detailed)) - - $_.NetAdapter.Status - - - - - - $_.NetProfile - - $_.NetProfile.Name - - - - - - ($_.NetProfile) -and ($_.Detailed) - - $_.NetProfile.NetworkCategory - - - - - - ($_.NetProfile) -and ($_.Detailed) - - $_.NetProfile.IPv6Connectivity - - - - - - ($_.NetProfile) -and ($_.Detailed) - - $_.NetProfile.IPv4Connectivity - - - - - - - ($_.NetIPv6Interface.ConnectionState -eq "Connected") -and - ($_.IPv6Address.Count -ne 0) - - - - $output = ""; - foreach($Address in $_.IPv6Address) { - $output += $Address.IPv6Address + "`n"; - } - $output.Trim("`n"); - - - - - - - - ($_.NetIPv6Interface.ConnectionState -eq "Connected") -and - ($_.IPv6TemporaryAddress.Count -ne 0) -and - ($_.Detailed) - - - - $output = ""; - foreach($Address in $_.IPv6TemporaryAddress) { - $output += $Address.IPv6Address + "`n"; - } - $output.Trim("`n"); - - - - - - - - ($_.NetIPv6Interface.ConnectionState -eq "Connected") -and - ($_.IPv6LinkLocalAddress.Count -ne 0) -and - ($_.Detailed) - - - - $output = ""; - foreach($Address in $_.IPv6LinkLocalAddress) { - $output += $Address.IPv6Address + "`n"; - } - $output.Trim("`n"); - - - - - - - - ($_.NetIPv4Interface.ConnectionState -eq "Connected") -and - ($_.IPv4Address.Count -ne 0) - - - - $output = ""; - foreach($Address in $_.IPv4Address) { - $output += $Address.IPv4Address + "`n"; - } - $output.Trim("`n"); - - - - - - - ($_.NetIPv6Interface.ConnectionState -eq "Connected") - - - $output = @(); - foreach($Route in $_.IPv6DefaultGateway) { - $output += $Route.NextHop; - } - $output; - - - - - - - ($_.NetIPv4Interface.ConnectionState -eq "Connected") - - - $output = @(); - foreach($Route in $_.IPv4DefaultGateway) { - $output += $Route.NextHop; - } - $output; - - - - - - - ($_.NetIPv6Interface.ConnectionState -eq "Connected") -and ($_.Detailed) -and ($_.NetIPv6Interface.IsolationId -ne 0) - - $_.NetIPv6Interface.IsolationId - - - - - - ($_.NetIPv4Interface.ConnectionState -eq "Connected") -and ($_.Detailed) -and ($_.NetIPv4Interface.IsolationId -ne 0) - - $_.NetIPv4Interface.IsolationId - - - - - - ($_.NetIPv6Interface.ConnectionState -eq "Connected") -and ($_.Detailed) - - $_.NetIPv6Interface.NlMTU - - - - - - ($_.NetIPv4Interface.ConnectionState -eq "Connected") -and ($_.Detailed) - - $_.NetIPv4Interface.NlMTU - - - - - - ($_.NetIPv6Interface.ConnectionState -eq "Connected") -and ($_.Detailed) - - $_.NetIPv6Interface.DHCP - - - - - - ($_.NetIPv4Interface.ConnectionState -eq "Connected") -and ($_.Detailed) - - $_.NetIPv4Interface.DHCP - - - - - - - ($_.DNSServer.Count -ne 0) -and - (($_.NetIPv4Interface.ConnectionState -eq "Connected") -or - ($_.NetIPv6Interface.ConnectionState -eq "Connected")) - - - - $output = ""; - foreach($Server in $_.DNSServer) { - foreach($Address in $Server.ServerAddresses) { - $output += $Address + "`n"; - } - }; - $output.Trim("`n"); - - - - - - - - - - - DefaultView - - TestNetConnectionResult - - - - - - - ComputerName - - - RemoteAddress - - - - - - ($_.RemotePort) -ne 0 - - - RemotePort - - - - - - ($_.Detailed) - - - - $output = ""; - foreach($Address in $_.ResolvedAddresses) { - $output += $Address.IPAddressToString + "`n"; - }; - foreach($PTRRecord in $($_.BasicNameResolution | where-object {$_.QueryType -eq "PTR"})) { - $output += $PTRRecord.NameHost + "`n"; - }; - $output.Trim("`n"); - - - - - - - (($_.RemotePort -ne 0) -and ($_.Detailed)) - - - - $output = ""; - foreach($Result in $_.MatchingIPsecRules) { - $output += $Result.DisplayName + "`n"; - }; - $output.Trim("`n"); - - - - - - (($_.RemotePort -ne 0) -and ($_.Detailed)) - - - NetworkIsolationContext - - - - - ((($_.RemotePort -ne 0) -and ($_.Detailed)) -and (!$_.IsAdmin)) - - - IsAdmin - - - InterfaceAlias - - - SourceAddress - - - - - - $_.Detailed - - - - $_.NetRoute.NextHop - - - - - - (($_.RemotePort -eq 0) -or (!$_.TcpTestSucceeded)) - - - PingSucceeded - - - - - - ($_.PingReplyDetails -ne $null) - - - - $_.PingReplyDetails.RoundTripTime.ToString() + " ms"; - - - - - - - ($_.RemotePort) -ne 0 - - - TcpTestSucceeded - - - - - - ($_.TraceRoute -ne $null) - - - - $output = ""; - foreach($Result in $_.TraceRoute) { - $output += $Result + "`n"; - }; - $output.Trim("`n"); - - - - - - - - - TableView - - TestNetConnectionResult - - - - - 15 - - - 10 - - - 30 - - - 20 - - - - 25 - - - 35 - - - - - - - ComputerName - - - RemotePort - - - RemoteAddress - - - PingSucceeded - - - - $_.PingReplyDetails.RoundTripTime.ToString() + " ms"; - - - - TcpTestSucceeded - - - - - - - - DefaultView - - NetRouteDiagnostics - - - - - - - ComputerName - - - RemoteAddress - - - - - - (($_.ConstrainSourceAddress -ne [System.Net.IPAddress]::IPv6Any) -and - ($_.ConstrainSourceAddress -ne [System.Net.IPAddress]::Any)) - - - ConstrainSourceAddress - - - - - - ($_.ConstrainInterfaceIndex -ne 0) - - - ConstrainInterfaceIndex - - - SelectedSourceAddress - - - OutgoingInterfaceIndex - - - - - $output = "DestinationPrefix: "; - $output += $_.SelectedNetRoute.DestinationPrefix + "`n"; - $output += "NextHop: "; - $output += $_.SelectedNetRoute.NextHop; - $output; - - - - - - - ($_.Detailed) - - - - $output = ""; - foreach($Event in $_.DestinationAddressSelectionEvents) { - $output += $Event + "`n`n"; - }; - $output.Trim("`n`n"); - - - - - - - ($_.Detailed) - - - - $output = ""; - foreach($Event in $_.RouteSelectionEvents) { - $output += $Event + "`n`n"; - }; - $output.Trim("`n`n"); - - - - - - - ($_.Detailed) - - - - $output = ""; - foreach($Event in $_.SourceAddressSelectionEvents) { - $output += $Event + "`n`n"; - }; - $output.Trim("`n`n"); - - - - RouteDiagnosticsSucceeded - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetTCPIP/Tcpip.Types.ps1xml b/newton-cn/bin/Modules/NetTCPIP/Tcpip.Types.ps1xml deleted file mode 100644 index b0700fb..0000000 --- a/newton-cn/bin/Modules/NetTCPIP/Tcpip.Types.ps1xml +++ /dev/null @@ -1,925 +0,0 @@ - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetRoute - - - Publish - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Publish]($this.PSBase.CimInstanceProperties['Publish'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Publish'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Publish]$newValue - - - - Protocol - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Protocol]($this.PSBase.CimInstanceProperties['Protocol'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Protocol'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Protocol]$newValue - - - - Store - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Store]($this.PSBase.CimInstanceProperties['Store'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Store'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Store]$newValue - - - - AddressFamily - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.AddressFamily]($this.PSBase.CimInstanceProperties['AddressFamily'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['AddressFamily'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.AddressFamily]$newValue - - - - State - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.State]($this.PSBase.CimInstanceProperties['State'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['State'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.State]$newValue - - - - ifIndex - InterfaceIndex - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPAddress - - - PrefixOrigin - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.PrefixOrigin]($this.PSBase.CimInstanceProperties['PrefixOrigin'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['PrefixOrigin'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.PrefixOrigin]$newValue - - - - SuffixOrigin - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.SuffixOrigin]($this.PSBase.CimInstanceProperties['SuffixOrigin'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['SuffixOrigin'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.SuffixOrigin]$newValue - - - - Type - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.Type]($this.PSBase.CimInstanceProperties['Type'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Type'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.Type]$newValue - - - - Store - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.Store]($this.PSBase.CimInstanceProperties['Store'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Store'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.Store]$newValue - - - - AddressFamily - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.AddressFamily]($this.PSBase.CimInstanceProperties['AddressFamily'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['AddressFamily'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.AddressFamily]$newValue - - - - AddressState - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.AddressState]($this.PSBase.CimInstanceProperties['AddressState'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['AddressState'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.AddressState]$newValue - - - - ToString - - - - ifIndex - InterfaceIndex - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNeighbor - - - State - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.State]($this.PSBase.CimInstanceProperties['State'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['State'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.State]$newValue - - - - Store - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.Store]($this.PSBase.CimInstanceProperties['Store'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Store'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.Store]$newValue - - - - AddressFamily - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.AddressFamily]($this.PSBase.CimInstanceProperties['AddressFamily'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['AddressFamily'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.AddressFamily]$newValue - - - - ifIndex - InterfaceIndex - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetCompartment - - - CompartmentType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetCompartment.CompartmentType]($this.PSBase.CimInstanceProperties['CompartmentType'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['CompartmentType'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetCompartment.CompartmentType]$newValue - - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPInterface - - - Store - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Store]($this.PSBase.CimInstanceProperties['Store'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Store'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Store]$newValue - - - - AddressFamily - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AddressFamily]($this.PSBase.CimInstanceProperties['AddressFamily'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['AddressFamily'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AddressFamily]$newValue - - - - Forwarding - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Forwarding]($this.PSBase.CimInstanceProperties['Forwarding'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Forwarding'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Forwarding]$newValue - - - - ClampMss - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ClampMss]($this.PSBase.CimInstanceProperties['ClampMss'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['ClampMss'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ClampMss]$newValue - - - - Advertising - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Advertising]($this.PSBase.CimInstanceProperties['Advertising'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Advertising'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Advertising]$newValue - - - - NeighborUnreachabilityDetection - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.NeighborUnreachabilityDetection]($this.PSBase.CimInstanceProperties['NeighborUnreachabilityDetection'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['NeighborUnreachabilityDetection'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.NeighborUnreachabilityDetection]$newValue - - - - RouterDiscovery - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.RouterDiscovery]($this.PSBase.CimInstanceProperties['RouterDiscovery'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['RouterDiscovery'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.RouterDiscovery]$newValue - - - - NeighborDiscoverySupported - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.NeighborDiscoverySupported]($this.PSBase.CimInstanceProperties['NeighborDiscoverySupported'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['NeighborDiscoverySupported'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.NeighborDiscoverySupported]$newValue - - - - ManagedAddressConfiguration - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ManagedAddressConfiguration]($this.PSBase.CimInstanceProperties['ManagedAddressConfiguration'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['ManagedAddressConfiguration'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ManagedAddressConfiguration]$newValue - - - - OtherStatefulConfiguration - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.OtherStatefulConfiguration]($this.PSBase.CimInstanceProperties['OtherStatefulConfiguration'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['OtherStatefulConfiguration'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.OtherStatefulConfiguration]$newValue - - - - WeakHostSend - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.WeakHostSend]($this.PSBase.CimInstanceProperties['WeakHostSend'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['WeakHostSend'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.WeakHostSend]$newValue - - - - WeakHostReceive - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.WeakHostReceive]($this.PSBase.CimInstanceProperties['WeakHostReceive'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['WeakHostReceive'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.WeakHostReceive]$newValue - - - - IgnoreDefaultRoutes - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.IgnoreDefaultRoutes]($this.PSBase.CimInstanceProperties['IgnoreDefaultRoutes'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['IgnoreDefaultRoutes'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.IgnoreDefaultRoutes]$newValue - - - - AdvertiseDefaultRoute - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AdvertiseDefaultRoute]($this.PSBase.CimInstanceProperties['AdvertiseDefaultRoute'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['AdvertiseDefaultRoute'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AdvertiseDefaultRoute]$newValue - - - - ForceArpNdWolPattern - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ForceArpNdWolPattern]($this.PSBase.CimInstanceProperties['ForceArpNdWolPattern'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['ForceArpNdWolPattern'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ForceArpNdWolPattern]$newValue - - - - DirectedMacWolPattern - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.DirectedMacWolPattern]($this.PSBase.CimInstanceProperties['DirectedMacWolPattern'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['DirectedMacWolPattern'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.DirectedMacWolPattern]$newValue - - - - EcnMarking - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.EcnMarking]($this.PSBase.CimInstanceProperties['EcnMarking'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['EcnMarking'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.EcnMarking]$newValue - - - - Dhcp - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Dhcp]($this.PSBase.CimInstanceProperties['Dhcp'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Dhcp'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Dhcp]$newValue - - - - ConnectionState - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ConnectionState]($this.PSBase.CimInstanceProperties['ConnectionState'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['ConnectionState'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ConnectionState]$newValue - - - - AutomaticMetric - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AutomaticMetric]($this.PSBase.CimInstanceProperties['AutomaticMetric'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['AutomaticMetric'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AutomaticMetric]$newValue - - - - ifIndex - InterfaceIndex - - - ifAlias - InterfaceAlias - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPv4Protocol - - - IcmpRedirects - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.IcmpRedirects]($this.PSBase.CimInstanceProperties['IcmpRedirects'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['IcmpRedirects'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.IcmpRedirects]$newValue - - - - SourceRoutingBehavior - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.SourceRoutingBehavior]($this.PSBase.CimInstanceProperties['SourceRoutingBehavior'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['SourceRoutingBehavior'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.SourceRoutingBehavior]$newValue - - - - DhcpMediaSense - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.DhcpMediaSense]($this.PSBase.CimInstanceProperties['DhcpMediaSense'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['DhcpMediaSense'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.DhcpMediaSense]$newValue - - - - MediaSenseEventLog - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MediaSenseEventLog]($this.PSBase.CimInstanceProperties['MediaSenseEventLog'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['MediaSenseEventLog'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MediaSenseEventLog]$newValue - - - - MldLevel - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MldLevel]($this.PSBase.CimInstanceProperties['MldLevel'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['MldLevel'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MldLevel]$newValue - - - - MldVersion - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MldVersion]($this.PSBase.CimInstanceProperties['MldVersion'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['MldVersion'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MldVersion]$newValue - - - - MulticastForwarding - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MulticastForwarding]($this.PSBase.CimInstanceProperties['MulticastForwarding'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['MulticastForwarding'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MulticastForwarding]$newValue - - - - GroupForwardedFragments - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.GroupForwardedFragments]($this.PSBase.CimInstanceProperties['GroupForwardedFragments'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['GroupForwardedFragments'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.GroupForwardedFragments]$newValue - - - - RandomizeIdentifiers - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.RandomizeIdentifiers]($this.PSBase.CimInstanceProperties['RandomizeIdentifiers'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['RandomizeIdentifiers'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.RandomizeIdentifiers]$newValue - - - - AddressMaskReply - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.AddressMaskReply]($this.PSBase.CimInstanceProperties['AddressMaskReply'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['AddressMaskReply'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.AddressMaskReply]$newValue - - - - DeadGatewayDetection - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.DeadGatewayDetection]($this.PSBase.CimInstanceProperties['DeadGatewayDetection'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['DeadGatewayDetection'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.DeadGatewayDetection]$newValue - - - - IGMPLevel - MldLevel - - - IGMPVersion - MldVersion - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPv6Protocol - - - IcmpRedirects - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.IcmpRedirects]($this.PSBase.CimInstanceProperties['IcmpRedirects'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['IcmpRedirects'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.IcmpRedirects]$newValue - - - - SourceRoutingBehavior - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.SourceRoutingBehavior]($this.PSBase.CimInstanceProperties['SourceRoutingBehavior'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['SourceRoutingBehavior'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.SourceRoutingBehavior]$newValue - - - - DhcpMediaSense - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.DhcpMediaSense]($this.PSBase.CimInstanceProperties['DhcpMediaSense'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['DhcpMediaSense'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.DhcpMediaSense]$newValue - - - - MediaSenseEventLog - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MediaSenseEventLog]($this.PSBase.CimInstanceProperties['MediaSenseEventLog'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['MediaSenseEventLog'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MediaSenseEventLog]$newValue - - - - MldLevel - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MldLevel]($this.PSBase.CimInstanceProperties['MldLevel'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['MldLevel'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MldLevel]$newValue - - - - MldVersion - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MldVersion]($this.PSBase.CimInstanceProperties['MldVersion'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['MldVersion'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MldVersion]$newValue - - - - MulticastForwarding - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MulticastForwarding]($this.PSBase.CimInstanceProperties['MulticastForwarding'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['MulticastForwarding'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MulticastForwarding]$newValue - - - - GroupForwardedFragments - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.GroupForwardedFragments]($this.PSBase.CimInstanceProperties['GroupForwardedFragments'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['GroupForwardedFragments'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.GroupForwardedFragments]$newValue - - - - RandomizeIdentifiers - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.RandomizeIdentifiers]($this.PSBase.CimInstanceProperties['RandomizeIdentifiers'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['RandomizeIdentifiers'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.RandomizeIdentifiers]$newValue - - - - AddressMaskReply - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.AddressMaskReply]($this.PSBase.CimInstanceProperties['AddressMaskReply'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['AddressMaskReply'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.AddressMaskReply]$newValue - - - - UseTemporaryAddresses - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.UseTemporaryAddresses]($this.PSBase.CimInstanceProperties['UseTemporaryAddresses'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['UseTemporaryAddresses'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.UseTemporaryAddresses]$newValue - - - - DeadGatewayDetection - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.DeadGatewayDetection]($this.PSBase.CimInstanceProperties['DeadGatewayDetection'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['DeadGatewayDetection'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.DeadGatewayDetection]$newValue - - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTCPConnection - - - State - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPConnection.State]($this.PSBase.CimInstanceProperties['State'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['State'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPConnection.State]$newValue - - - - AppliedSetting - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPConnection.AppliedSetting]($this.PSBase.CimInstanceProperties['AppliedSetting'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['AppliedSetting'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPConnection.AppliedSetting]$newValue - - - - OffloadState - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPConnection.OffloadState]($this.PSBase.CimInstanceProperties['OffloadState'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['OffloadState'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPConnection.OffloadState]$newValue - - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTransportFilter - - - Protocol - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTransportFilter.Protocol]($this.PSBase.CimInstanceProperties['Protocol'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Protocol'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTransportFilter.Protocol]$newValue - - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTCPSetting - - - CwndRestart - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.CwndRestart]($this.PSBase.CimInstanceProperties['CwndRestart'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['CwndRestart'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.CwndRestart]$newValue - - - - MemoryPressureProtection - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.MemoryPressureProtection]($this.PSBase.CimInstanceProperties['MemoryPressureProtection'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['MemoryPressureProtection'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.MemoryPressureProtection]$newValue - - - - CongestionProvider - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.CongestionProvider]($this.PSBase.CimInstanceProperties['CongestionProvider'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['CongestionProvider'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.CongestionProvider]$newValue - - - - AutoTuningLevelLocal - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutoTuningLevelLocal]($this.PSBase.CimInstanceProperties['AutoTuningLevelLocal'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['AutoTuningLevelLocal'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutoTuningLevelLocal]$newValue - - - - EcnCapability - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.EcnCapability]($this.PSBase.CimInstanceProperties['EcnCapability'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['EcnCapability'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.EcnCapability]$newValue - - - - Timestamps - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.Timestamps]($this.PSBase.CimInstanceProperties['Timestamps'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Timestamps'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.Timestamps]$newValue - - - - ScalingHeuristics - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.ScalingHeuristics]($this.PSBase.CimInstanceProperties['ScalingHeuristics'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['ScalingHeuristics'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.ScalingHeuristics]$newValue - - - - AutoTuningLevelGroupPolicy - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutoTuningLevelGroupPolicy]($this.PSBase.CimInstanceProperties['AutoTuningLevelGroupPolicy'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['AutoTuningLevelGroupPolicy'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutoTuningLevelGroupPolicy]$newValue - - - - AutoTuningLevelEffective - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutoTuningLevelEffective]($this.PSBase.CimInstanceProperties['AutoTuningLevelEffective'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['AutoTuningLevelEffective'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutoTuningLevelEffective]$newValue - - - - AutomaticUseCustom - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutomaticUseCustom]($this.PSBase.CimInstanceProperties['AutomaticUseCustom'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['AutomaticUseCustom'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutomaticUseCustom]$newValue - - - - NonSackRttResiliency - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.NonSackRttResiliency]($this.PSBase.CimInstanceProperties['NonSackRttResiliency'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['NonSackRttResiliency'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.NonSackRttResiliency]$newValue - - - - ForceWS - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.ForceWS]($this.PSBase.CimInstanceProperties['ForceWS'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['ForceWS'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.ForceWS]$newValue - - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetOffloadGlobalSetting - - - ReceiveSideScaling - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]($this.PSBase.CimInstanceProperties['ReceiveSideScaling'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['ReceiveSideScaling'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]$newValue - - - - ReceiveSegmentCoalescing - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]($this.PSBase.CimInstanceProperties['ReceiveSegmentCoalescing'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['ReceiveSegmentCoalescing'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]$newValue - - - - Chimney - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.ChimneyEnum]($this.PSBase.CimInstanceProperties['Chimney'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Chimney'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.ChimneyEnum]$newValue - - - - TaskOffload - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]($this.PSBase.CimInstanceProperties['TaskOffload'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['TaskOffload'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]$newValue - - - - NetworkDirect - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]($this.PSBase.CimInstanceProperties['NetworkDirect'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['NetworkDirect'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]$newValue - - - - NetworkDirectAcrossIPSubnets - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.AllowedBlockedEnum]($this.PSBase.CimInstanceProperties['NetworkDirectAcrossIPSubnets'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['NetworkDirectAcrossIPSubnets'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.AllowedBlockedEnum]$newValue - - - - PacketCoalescingFilter - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]($this.PSBase.CimInstanceProperties['PacketCoalescingFilter'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['PacketCoalescingFilter'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]$newValue - - - - - diff --git a/newton-cn/bin/Modules/NetTCPIP/Test-NetConnection.psm1 b/newton-cn/bin/Modules/NetTCPIP/Test-NetConnection.psm1 deleted file mode 100644 index bf2e522..0000000 --- a/newton-cn/bin/Modules/NetTCPIP/Test-NetConnection.psm1 +++ /dev/null @@ -1,643 +0,0 @@ -class NetRouteDiagnostics -{ - #Remote hostname used for routing - [String] $ComputerName - - #Remote IP address used for routing - [System.Net.IPAddress] $RemoteAddress - - #Resolved IP addresses for ComputerName - [System.Net.IPAddress[]] $ResolvedAddresses - - #SourceAddress constraint used for routing - [System.Net.IPAddress] $ConstrainSourceAddress - - #Interface constraint used for routing - [UInt32] $ConstrainInterfaceIndex - - #SourceAddress selected for routing - [Microsoft.Management.Infrastructure.CimInstance] $SelectedSourceAddress - - #Outgoing interface information selected for routing - [String] $OutgoingInterfaceAlias - [UInt32] $OutgoingInterfaceIndex - [String] $OutgoingInterfaceDescription - [Microsoft.Management.Infrastructure.CimInstance] $OutgoingNetAdapter - - #NetRoute selected for routing - [Microsoft.Management.Infrastructure.CimInstance] $SelectedNetRoute - - #Log file used for logging route events - [String] $LogFile - - #Events logged during routing - [String[]] $RouteSelectionEvents - [String[]] $SourceAddressSelectionEvents - [String[]] $DestinationAddressSelectionEvents - - #An indicator to the formatter that details should be shown - [Bool] $Detailed - - #If diagnostics succeeded - [Bool] $RouteDiagnosticsSucceeded -} - -class TestNetConnectionResult -{ - [String] $ComputerName - - #The Remote IP address used for connectivity - [System.Net.IPAddress] $RemoteAddress - - #Resolved IP addresses for ComputerName - [System.Net.IPAddress[]] $ResolvedAddresses - - #Indicates if the Ping was successful - [Bool] $PingSucceeded - - #Details of the ping - [System.Net.NetworkInformation.PingReply] $PingReplyDetails - - #The TCP socket - [System.Net.Sockets.Socket] $TcpClientSocket - - #If the test succeeded - [Bool] $TcpTestSucceeded - - #Remote port used - [UInt32] $RemotePort - - #The results of the traceroute - [String[]] $TraceRoute - - #An indicator to the formatter that details should be shown - [Bool] $Detailed - - #Information on the interface used for connectivity - [String] $InterfaceAlias - [UInt32] $InterfaceIndex - [String] $InterfaceDescription - [Microsoft.Management.Infrastructure.CimInstance] $NetAdapter - [Microsoft.Management.Infrastructure.CimInstance] $NetRoute - - #Source IP address - [Microsoft.Management.Infrastructure.CimInstance] $SourceAddress - - #DNS information - [Bool] $NameResolutionSucceeded - [Object] $BasicNameResolution - [Object] $LLMNRNetbiosRecords - [Object] $DNSOnlyRecords - [Object] $AllNameResolutionResults - - #NetSec Info - [Bool] $IsAdmin #If the test succeeded - [String] $NetworkIsolationContext - [Microsoft.Management.Infrastructure.CimInstance[]] $MatchingIPsecRules -} - -function Test-NetConnection -{ - [CmdletBinding( )] - Param( - [Parameter(Mandatory = $false, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Position = 0)] - [Alias('RemoteAddress','cn')] - [String] $ComputerName = "internetbeacon.msedge.net", - - [Parameter(ParameterSetName = "ICMP", Mandatory = $False)] - [Switch] $TraceRoute, - - [Parameter(ParameterSetName = "ICMP", Mandatory = $False)] - [ValidateRange(1,120)] - [Int] $Hops = 30, - - [Parameter(ParameterSetName = "CommonTCPPort", Mandatory = $True, Position = 1)] - [ValidateSet("HTTP", "RDP", "SMB", "WINRM")] - [String] $CommonTCPPort = "", - - [Parameter(ParameterSetName = "RemotePort", Mandatory = $True, ValueFromPipelineByPropertyName = $true)] - [Alias('RemotePort')] [ValidateRange(1,65535)] - [Int] $Port = 0, - - [Parameter(ParameterSetName = "NetRouteDiagnostics", Mandatory = $True)] - [Switch] $DiagnoseRouting, - - [Parameter(ParameterSetName = "NetRouteDiagnostics", Mandatory = $False)] - [String] $ConstrainSourceAddress = "", - - [Parameter(ParameterSetName = "NetRouteDiagnostics", Mandatory = $False)] - [UInt32] $ConstrainInterface = 0, - - [ValidateSet("Quiet", "Detailed")] - [String] $InformationLevel = "Standard" - ) - - Begin - { - - ##Description: Checks if the local execution context is elevated - ##Input: None - ##Output: Boolean. True if the local execution context is elevated. - function CheckIfAdmin - { - $CurrentIdentity = [System.Security.Principal.WindowsIdentity]::GetCurrent() - $CurrentSecurityPrincipal = [System.Security.Principal.WindowsPrincipal]::new($CurrentIdentity) - $AdminPrincipal = [System.Security.Principal.WindowsBuiltInRole]::Administrator - return $CurrentSecurityPrincipal.IsInRole($AdminPrincipal) - } - - ##Description: Resolves a hostname. - ##Input: The user-provided computername that will be pinged/tested - ##Output: The resolved IP addresses for computername - function ResolveTargetName - { - param ($TargetName) - - $Addresses = $null - try - { - $Addresses = [System.Net.Dns]::GetHostAddressesAsync($TargetName).GetAwaiter().GetResult() - } - catch - { - Write-Debug "Name resolution of $TargetName threw exception: $($_.Exception.Message)" - } - - if ($Addresses -eq $null) - { - Write-Warning "Name resolution of $TargetName failed" - } - - return $Addresses - } - - ##Description: Pings a specified host - ##Input: IP address to ping - ##Output: PingReplyDetails for the ping attempt to host - function PingTest - { - param ($TargetIPAddress) - - $Ping = [System.Net.NetworkInformation.Ping]::new() - $PingReplyDetails = $null - - ##Indeterminate progress indication - Write-Progress -Activity "Test-NetConnection :: $TargetIPAddress" -Status "Ping/ICMP Test" -CurrentOperation "Waiting for echo reply" -SecondsRemaining -1 -PercentComplete -1 - - try - { - $PingReplyDetails = $Ping.SendPingAsync($TargetIPAddress).GetAwaiter().Getresult() - } - catch - { - Write-Debug "Ping to $TargetIPAddress threw exception: $($_.Exception.Message)" - } - finally - { - $Ping.Dispose() - } - - return $PingReplyDetails - } - - ##Description: Traces a route to a specified IP address using repetitive echo requests - ##Input: IP address to trace against - ##Output: Array of IP addresses representing the traced route. The message from the ping reply status is emmited, if there is no response. - function TraceRoute - { - param ($TargetIPAddress,$Hops) - - $Ping = [System.Net.NetworkInformation.Ping]::new() - $PingOptions = [System.Net.NetworkInformation.PingOptions]::new() - $PingOptions.Ttl = 1 - [Byte[]]$DataBuffer = @() - 1..10 | foreach {$DataBuffer += [Byte]0} - $ReturnTrace = @() - - do - { - try - { - $CurrentHop = [int] $PingOptions.Ttl - write-progress -CurrentOperation "TTL = $CurrentHop" -Status "ICMP Echo Request (Max TTL = $Hops)" -Activity "TraceRoute" -PercentComplete -1 -SecondsRemaining -1 - $PingReplyDetails = $Ping.SendPingAsync($TargetIPAddress, 4000, $DataBuffer, $PingOptions).GetAwaiter().Getresult() - - if ($PingReplyDetails.Address -eq $null) - { - $ReturnTrace += $PingReplyDetails.Status.ToString() - } - else - { - $ReturnTrace += $PingReplyDetails.Address.IPAddressToString - } - } - catch - { - Write-Debug "Ping to $TargetIPAddress threw exception: $($_.Exception.Message)" - $ReturnTrace += "..." - } - $PingOptions.Ttl++ - } - while (($PingReplyDetails.Status -ne 'Success') -and ($PingOptions.Ttl -le $Hops)) - - ##If the last entry in the trace does not equal the target, then the trace did not successfully complete - if ($ReturnTrace[-1] -ne $TargetIPAddress) - { - $OutputString = "Trace route to destination " + $TargetIPAddress + " did not complete. Trace terminated :: " + $ReturnTrace[-1] - Write-Warning $OutputString - } - - $Ping.Dispose() - return $ReturnTrace - } - - ##Description: Attempts a TCP connection against a specified IP address - ##Input: IP address and port to connect to - ##Output: If the connection succeeded (as a boolean) - function TestTCP - { - param ($TargetIPAddress,$TargetPort) - - $ProgressString = "Test-NetConnection - " + $TargetIPAddress + ":" + $TargetPort - Write-Progress -Activity $ProgressString -Status "Attempting TCP connect" -CurrentOperation "Waiting for response" -SecondsRemaining -1 -PercentComplete -1 - - $Success = $False - $TCPClient = [System.Net.Sockets.TcpClient]::new($TargetIPAddress.AddressFamily) - try - { - $null = $TCPClient.ConnectAsync($TargetIPAddress, $TargetPort).GetAwaiter().Getresult() - $Success = $TCPClient.Connected; - } - catch - { - Write-Debug "TCP connect to ($TargetIPAddress : $TargetPort) threw exception: $($_.Exception.Message)" - } - finally - { - $TCPClient.Dispose() - } - - return $Success - } - - ##Description: Modifies the provided object with the correct local connectivty information - ##Input: TestNetConnectionResults object that will be modified - ##Output: Modified TestNetConnectionResult object - function ResolveRoutingandAdapterWMIObjects - { - param ($TestNetConnectionResult) - - try - { - $TestNetConnectionResult.SourceAddress, $TestNetConnectionResult.NetRoute = Find-NetRoute -RemoteIPAddress $TestNetConnectionResult.RemoteAddress -ErrorAction SilentlyContinue - $TestNetConnectionResult.NetAdapter = $TestNetConnectionResult.NetRoute | Get-NetAdapter -IncludeHidden -ErrorAction SilentlyContinue - - $TestNetConnectionResult.InterfaceAlias = $TestNetConnectionResult.NetRoute.InterfaceAlias - $TestNetConnectionResult.InterfaceIndex = $TestNetConnectionResult.NetRoute.InterfaceIndex - $TestNetConnectionResult.InterfaceDescription = $TestNetConnectionResult.NetAdapter.InterfaceDescription - } - catch - { - Write-Debug "ResolveRoutingandAdapterWMIObjects threw exception: $($_.Exception.Message)" - } - return $TestNetConnectionResult - } - - ##Description: Resolves the DNS details for the computername - ##Input: The TestNetConnectionResults object that will be "filled in" with DNS information - ##Output: The modified TestNetConnectionResults object - function ResolveDNSDetails - { - param ($TestNetConnectionResult) - - $TestNetConnectionResult.DNSOnlyRecords = @( Resolve-DnsName $ComputerName -DnsOnly -NoHostsFile -Type A_AAAA -ErrorAction SilentlyContinue | where-object {($_.QueryType -eq "A") -or ($_.QueryType -eq "AAAA") -or ($_.QueryType -eq "PTR")} ) - $TestNetConnectionResult.LLMNRNetbiosRecords = @( Resolve-DnsName $ComputerName -LlmnrNetbiosOnly -NoHostsFile -ErrorAction SilentlyContinue | where-object {($_.QueryType -eq "A") -or ($_.QueryType -eq "AAAA") } ) - $TestNetConnectionResult.BasicNameResolution = @(Resolve-DnsName $ComputerName -ErrorAction SilentlyContinue | where-object {($_.QueryType -eq "A") -or ($_.QueryType -eq "AAAA") -or ($_.QueryType -eq "PTR")} ) - - $TestNetConnectionResult.AllNameResolutionResults = $Return.BasicNameResolution + $Return.DNSOnlyRecords + $Return.LLMNRNetbiosRecords | Sort-Object -Unique -Property Address - return $TestNetConnectionResult - } - - ##Description: Resolves the network security details for the computername - ##Input: The TestNetConnectionResults object that will be "filled in" with network security information - ##Output: Teh modified TestNetConnectionResults object - function ResolveNetworkSecurityDetails - { - param ($TestNetConnectionResult) - - $TestNetConnectionResult.IsAdmin = CheckIfAdmin - $NetworkIsolationInfo = Invoke-CimMethod -Namespace root\standardcimv2 -ClassName MSFT_NetAddressFilter -MethodName QueryIsolationType -Arguments @{InterfaceIndex = [uint32]$TestNetConnectionResult.InterfaceIndex; RemoteAddress = [string]$TestNetConnectionResult.RemoteAddress} -ErrorAction SilentlyContinue - - switch ($NetworkIsolationInfo.IsolationType) - { - 1 {$TestNetConnectionResult.NetworkIsolationContext = "Private Network";} - 0 {$TestNetConnectionResult.NetworkIsolationContext = "Loopback";} - 2 {$TestNetConnectionResult.NetworkIsolationContext = "Internet";} - } - - ##Elevation is required to read IPsec information for the connection. - if ($TestNetConnectionResult.IsAdmin) - { - $TestNetConnectionResult.MatchingIPsecRules = Find-NetIPsecRule -RemoteAddress $TestNetConnectionResult.RemoteAddress -RemotePort $TestNetConnectionResult.RemotePort -Protocol TCP -ErrorAction SilentlyContinue - } - - return $TestNetConnectionResult - } - - ##Description: Diagnose route selection for a destination - ##Input: RouteDiagnosticsResults object that will be filled on with route diagnostics information. - ##Output: None - function DiagnoseRouteSelection - { - param ([NetRouteDiagnostics] $RouteDiagnostics) - - $RouteDiagnostics.RouteDiagnosticsSucceeded = $False - - if ($RouteDiagnostics.Detailed) - { - Write-Progress -Activity "Test-NetConnection :: $($RouteDiagnostics.RemoteAddress)" -Status "RouteDiagnostics" -CurrentOperation "Starting Route Event Tracing" -SecondsRemaining -1 -PercentComplete -1 - - $LogFile = "" - do - { - $LogFile = [System.IO.Path]::GetTempFileName().split(".")[0] + "Test-NetConnection.etl" - } - while (Test-Path -Path $LogFile -ErrorAction SilentlyContinue) - - $TraceResults = netsh trace start tracefile=$LogFile provider=Microsoft-Windows-TCPIP keywords=ut:TcpipRoute report=di perfmerge=no correlation=di - } - - Write-Progress -Activity "Test-NetConnection :: $($RouteDiagnostics.ComputerName)" -Status "RouteDiagnostics" -CurrentOperation "Resolving name" -SecondsRemaining -1 -PercentComplete -1 - - $RouteDiagnostics.ResolvedAddresses = ResolveTargetName -TargetName $RouteDiagnostics.ComputerName - if ($RouteDiagnostics.ResolvedAddresses -eq $null) - { - netsh trace stop | out-null - return - } - - $RouteDiagnostics.RemoteAddress = $RouteDiagnostics.ResolvedAddresses[0] - - if ($RouteDiagnostics.ConstrainSourceAddress -eq $null) - { - if ($RouteDiagnostics.RemoteAddress.AddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetwork) - { - $RouteDiagnostics.ConstrainSourceAddress = [System.Net.IPAddress]::Any - } - else - { - $RouteDiagnostics.ConstrainSourceAddress = [System.Net.IPAddress]::IPv6Any - } - } - - if ($RouteDiagnostics.Detailed -and (Test-Path -Path $LogFile)) - { - ##Flush the destination cache to trigger a new route route lookup - if ($RouteDiagnostics.RemoteAddress.AddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetwork) - { - netsh int ipv4 delete destinationcache | out-null - } - else - { - netsh int ipv6 delete destinationcache | out-null - } - } - - Write-Progress -Activity "Test-NetConnection :: $($RouteDiagnostics.RemoteAddress)" -Status "RouteDiagnostics" -CurrentOperation "Finding route" -SecondsRemaining -1 -PercentComplete -1 - - try - { - $RouteDiagnostics.SelectedSourceAddress, $RouteDiagnostics.SelectedNetRoute = ` - Find-NetRoute -RemoteIPAddress $RouteDiagnostics.RemoteAddress -LocalIPAddress $RouteDiagnostics.ConstrainSourceAddress -InterfaceIndex $RouteDiagnostics.ConstrainInterfaceIndex -ErrorAction SilentlyContinue - - $RouteDiagnostics.OutgoingNetAdapter = $RouteDiagnostics.SelectedNetRoute | Get-NetAdapter -IncludeHidden -ErrorAction SilentlyContinue - - $RouteDiagnostics.OutgoingInterfaceAlias = $RouteDiagnostics.SelectedNetRoute.InterfaceAlias - $RouteDiagnostics.OutgoingInterfaceIndex = $RouteDiagnostics.SelectedNetRoute.InterfaceIndex - $RouteDiagnostics.OutgoingInterfaceDescription = $RouteDiagnostics.OutgoingNetAdapter.InterfaceDescription - } - catch - { - Write-Debug "Error occured while finding route information. Exception: $($_.Exception.Message)" - netsh trace stop | out-null - return - } - - if ($RouteDiagnostics.Detailed) - { - Write-Progress -Activity "Test-NetConnection :: $($RouteDiagnostics.RemoteAddress)" -Status "RouteDiagnostics" -CurrentOperation "Parsing Route Events" -SecondsRemaining -1 -PercentComplete -1 - - $TraceResults += netsh trace stop - - if (-not (Test-Path -Path $LogFile)) - { - $Message = "Error occured while collection routing events. Error: " + $TraceResults - Write-Warning $Message - return - } - - ##Get route selection events: [IpRouteSelection (task:1378) and IpRouteBlocked (task:1379)] containing the remote IP - $RouteEvents = Get-WinEvent -Path $LogFile -Oldest | Where-Object {(($_.task -eq "1379") -or ($_.task -eq "1378")) -and (($_.Message -ne $null) -and $_.Message.Contains("$($RouteDiagnostics.RemoteAddress) "))} - foreach ($event in $RouteEvents) - { - if ($RouteDiagnostics.RouteSelectionEvents -notcontains $($event.Message)) - { - $RouteDiagnostics.RouteSelectionEvents += "$($event.Message)" - } - } - - ##Get source address selection events: [IpSourceAddressSelection (task:1326)] containing the remote IP - $SrcAddrEvents = Get-WinEvent -Path $LogFile -Oldest | Where-Object {($_.task -eq "1326") -and (($_.Message -ne $null) -and $_.Message.Contains("$($RouteDiagnostics.RemoteAddress) "))} - foreach ($event in $SrcAddrEvents) - { - if ($RouteDiagnostics.SourceAddressSelectionEvents -notcontains $($event.Message)) - { - $RouteDiagnostics.SourceAddressSelectionEvents += "$($event.Message)" - } - } - - ##Get destination address selection events: [IpSortedAddressPairs (task:1327)] containing the resolved IPs - $DstAddrEvents = Get-WinEvent -Path $LogFile -Oldest | Where-Object {($_.task -eq "1327") -and ((($Message = $_.Message) -ne $null) -and (@(($RouteDiagnostics.ResolvedAddresses | ForEach-Object {$_.IPAddressToString}) | where {$Message.Contains("$_)")}) -ne $null))} - foreach ($event in $DstAddrEvents) - { - if ($RouteDiagnostics.DestinationAddressSelectionEvents -notcontains $($event.Message)) - { - $RouteDiagnostics.DestinationAddressSelectionEvents += "$($event.Message)" - } - } - - $RouteDiagnostics.LogFile = $LogFile - } - - $RouteDiagnostics.RouteDiagnosticsSucceeded = $True - - return - } - } - - Process - { - switch ($PSCmdlet.ParameterSetName) - { - - ##Route diagnostics parameterset - "NetRouteDiagnostics" - { - $Return = [NetRouteDiagnostics]::new() - $Return.ComputerName = $ComputerName - - if ($ConstrainSourceAddress -ne "") - { - $Return.ConstrainSourceAddress = $ConstrainSourceAddress - } - - $Return.ConstrainInterfaceIndex = $ConstrainInterface - - $Return.Detailed = ($InformationLevel -eq "Detailed") - if ($Return.Detailed -and (-not (CheckIfAdmin))) { - Write-Warning "'-InformationLevel Detailed' requires elevation (Run as administrator)." - $Return.Detailed = $False - } - - DiagnoseRouteSelection -RouteDiagnostics $Return - - return $Return - } - - ##Test connection parametersets - default - { - ##Construct the return object and fill basic details - $Return = [TestNetConnectionResult]::new() - $Return.ComputerName = $ComputerName - $Return.Detailed = ($InformationLevel -eq "Detailed") - - #### Begin Name Resolution #### - - $Return.ResolvedAddresses = ResolveTargetName -TargetName $ComputerName - if ($Return.ResolvedAddresses -eq $null) - { - if ($InformationLevel -eq "Quiet") - { - return $False - } - - $Return.NameResolutionSucceeded = $False - return $Return - } - - $Return.RemoteAddress = $Return.ResolvedAddresses[0] - $Return.NameResolutionSucceeded = $True - #### End of Name Resolution #### - - #### Begin TCP test #### - - ##Attempt TCP test only if Port or CommonTCPPort is specified - $AttemptTcpTest = ($PSCmdlet.ParameterSetName -eq "CommonTCPPort") -or ($PSCmdlet.ParameterSetName -eq "RemotePort") - if ($AttemptTcpTest) - { - $Return.TcpTestSucceeded = $False - - switch ($CommonTCPPort) - { - "" {$Return.RemotePort = $Port} - "HTTP" {$Return.RemotePort = 80} - "RDP" {$Return.RemotePort = 3389} - "SMB" {$Return.RemotePort = 445} - "WINRM" {$Return.RemotePort = 5985} - } - - ##Try TCP connect using all resolved addresses until it succeeds - $Iter = 0 - while (($Iter -lt $Return.ResolvedAddresses.Count) -and (-not $Return.TcpTestSucceeded)) - { - $Return.TcpTestSucceeded = TestTCP -TargetIPAddress $Return.ResolvedAddresses[$Iter] -TargetPort $Return.RemotePort - ##Output a warning message if the TCP test didn't succeed - if (-not $Return.TcpTestSucceeded) - { - Write-Warning "TCP connect to ($($Return.ResolvedAddresses[$Iter]) : $($Return.RemotePort)) failed" - } - $Iter++ - } - - if ($Return.TcpTestSucceeded) - { - ##Get the remote address that was actually used for connection - $Return.RemoteAddress = $Return.ResolvedAddresses[$Iter - 1] - } - - ##If the user specified "quiet" then we should only return a boolean - if ($InformationLevel -eq "Quiet") - { - return $Return.TcpTestSucceeded - } - } - #### End of TCP test #### - - #### Begin Ping test #### - - ##Attempt Ping test only if TCP test is not attempted or TCP test failed - $AttemptPingTest = (-not $AttemptTcpTest) -or (-not $Return.TcpTestSucceeded) - if ($AttemptPingTest) - { - $Return.PingSucceeded = $False - - ##Try Ping using all resolved addresses until it succeeds - $Iter = 0 - while (($Iter -lt $Return.ResolvedAddresses.Count) -and (-not $Return.PingSucceeded)) - { - $Return.PingReplyDetails = PingTest -TargetIPAddress $Return.ResolvedAddresses[$Iter] - if ($Return.PingReplyDetails -ne $null) - { - $Return.PingSucceeded = ($Return.PingReplyDetails.Status -eq [System.Net.NetworkInformation.IPStatus]::Success) - } - - ##Output a warning message if Ping didn't succeed - if (-not $Return.PingSucceeded) - { - $WarningString = "Ping to $($Return.ResolvedAddresses[$Iter]) failed" - if ($Return.PingReplyDetails -ne $null) - { - $WarningString += " with status: $($Return.PingReplyDetails.Status)" - } - Write-Warning $WarningString - } - $Iter++ - } - - if ($Return.PingSucceeded) - { - ##Get the remote address that was actually used for Ping - $Return.RemoteAddress = $Return.ResolvedAddresses[$Iter - 1] - } - - ##If the user specified "quiet" then we should only return a boolean - if ($InformationLevel -eq "Quiet") - { - return $Return.PingSucceeded - } - } - #### End of Ping test #### - - #### Begin TraceRoute #### - - ##TraceRoute, only occurs if switched by the user - if ($TraceRoute -eq $True) - { - $Return.TraceRoute = TraceRoute -TargetIPAddress $Return.RemoteAddress -Hops $Hops - } - #### End of TraceRoute #### - - $Return = ResolveDNSDetails -TestNetConnectionResult $Return - $Return = ResolveNetworkSecurityDetails -TestNetConnectionResult $Return - $Return = ResolveRoutingandAdapterWMIObjects -TestNetConnectionResult $Return - - return $Return - } - } - } -} - -##Export cmdlet and alias to module -New-Alias TNC Test-NetConnection -Export-ModuleMember -Alias TNC -Function Test-NetConnection diff --git a/newton-cn/bin/Modules/NetworkConnectivityStatus/MSFT_DAConnectionStatus.cdxml b/newton-cn/bin/Modules/NetworkConnectivityStatus/MSFT_DAConnectionStatus.cdxml deleted file mode 100644 index f829844..0000000 --- a/newton-cn/bin/Modules/NetworkConnectivityStatus/MSFT_DAConnectionStatus.cdxml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - 1.0 - DAConnectionStatus - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkConnectivityStatus/MSFT_DAConnectionStatus.format.ps1xml b/newton-cn/bin/Modules/NetworkConnectivityStatus/MSFT_DAConnectionStatus.format.ps1xml deleted file mode 100644 index 0e43865..0000000 --- a/newton-cn/bin/Modules/NetworkConnectivityStatus/MSFT_DAConnectionStatus.format.ps1xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - MSFT_DAConnectionStatus - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_DAConnectionStatus - Microsoft.Management.Infrastructure.CimInstance#MSFT_DAConnectionStatus - - - - - - - Status - - - SubStatus - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkConnectivityStatus/MSFT_DAConnectionStatus.types.ps1xml b/newton-cn/bin/Modules/NetworkConnectivityStatus/MSFT_DAConnectionStatus.types.ps1xml deleted file mode 100644 index 2e20806..0000000 --- a/newton-cn/bin/Modules/NetworkConnectivityStatus/MSFT_DAConnectionStatus.types.ps1xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_DAConnectionStatus - - - Status - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.DAConnectionStatus.Status]($this.PSBase.CimInstanceProperties['Status'].Value) - - - $this.PSBase.CimInstanceProperties['Status'].Value = [System.UInt32]$_ - - - - Substatus - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.DAConnectionStatus.Substatus]($this.PSBase.CimInstanceProperties['Substatus'].Value) - - - $this.PSBase.CimInstanceProperties['Substatus'].Value = [System.UInt32]$_ - - - - - diff --git a/newton-cn/bin/Modules/NetworkConnectivityStatus/MSFT_NCSIPolicyConfiguration.cdxml b/newton-cn/bin/Modules/NetworkConnectivityStatus/MSFT_NCSIPolicyConfiguration.cdxml deleted file mode 100644 index 520379c..0000000 --- a/newton-cn/bin/Modules/NetworkConnectivityStatus/MSFT_NCSIPolicyConfiguration.cdxml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - 1.0 - NCSIPolicyConfiguration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkConnectivityStatus/MSFT_NCSIPolicyConfiguration.format.ps1xml b/newton-cn/bin/Modules/NetworkConnectivityStatus/MSFT_NCSIPolicyConfiguration.format.ps1xml deleted file mode 100644 index 13867d6..0000000 --- a/newton-cn/bin/Modules/NetworkConnectivityStatus/MSFT_NCSIPolicyConfiguration.format.ps1xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - MSFT_NCSIPolicyConfiguration - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NCSIPolicyConfiguration - Microsoft.Management.Infrastructure.CimInstance#MSFT_NCSIPolicyConfiguration - - - - - - - Description - - - CorporateDNSProbeHostAddress - - - CorporateDNSProbeHostName - - - CorporateSitePrefixList - - - CorporateWebsiteProbeURL - - - DomainLocationDeterminationURL - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkConnectivityStatus/NetworkConnectivityStatus.psd1 b/newton-cn/bin/Modules/NetworkConnectivityStatus/NetworkConnectivityStatus.psd1 deleted file mode 100644 index 986ebb5..0000000 --- a/newton-cn/bin/Modules/NetworkConnectivityStatus/NetworkConnectivityStatus.psd1 +++ /dev/null @@ -1,17 +0,0 @@ - -@{ - ModuleVersion = '1.0.0.0' - NestedModules = @("MSFT_DAConnectionStatus.cdxml", "MSFT_NCSIPolicyConfiguration.cdxml") - FormatsToProcess = @("MSFT_DAConnectionStatus.format.ps1xml", "MSFT_NCSIPolicyConfiguration.format.ps1xml") - TypesToProcess = @("MSFT_DAConnectionStatus.types.ps1xml") - HelpInfoUri = "http://go.microsoft.com/fwlink/?LinkId=285557" - GUID = '{6C9A449B-B0C6-4386-B139-EE0A55638803}' - Author = 'Microsoft Corporation' - CompanyName = 'Microsoft Corporation' - PowerShellVersion = '5.1' - Copyright = '© Microsoft Corporation. All rights reserved.' - FunctionsToExport = @("Get-DAConnectionStatus", "Get-NCSIPolicyConfiguration", "Reset-NCSIPolicyConfiguration", "Set-NCSIPolicyConfiguration") - CmdletsToExport = @() - AliasesToExport = @() - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/NetworkSwitchManager/CmdletHelpers.psm1 b/newton-cn/bin/Modules/NetworkSwitchManager/CmdletHelpers.psm1 deleted file mode 100644 index 4696e57..0000000 --- a/newton-cn/bin/Modules/NetworkSwitchManager/CmdletHelpers.psm1 +++ /dev/null @@ -1,379 +0,0 @@ -########################################################################### -# # -# Module Name: CmdletHelpers.psm1 # -# # -# Description: Wrappers for common functions used by all cmdlets. # -# # -# Copyright (c) Microsoft Corporation. All rights reserved. # -# # -########################################################################### - -function CmdletShouldProcess() { -param( - [Parameter(Mandatory=$true, Position=0)] - [System.Management.Automation.PSCmdlet] $PSCmdlet, - - [Parameter(Mandatory=$true, Position=1)] - [object] $Object - ) - - $PSCmdlet.ShouldProcess($Object) -} - -function Get-NetworkSwitchRegisteredProfileFromNamespace() { -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession]$cimSession, - - [Parameter(Mandatory=$true)] - [string] $Namespace - ) - - Get-CimInstance -classname CIM_RegisteredProfile -Namespace $Namespace -CimSession $cimSession -ErrorAction Ignore | ? {$_.RegisteredName -ieq 'Ethernet Switch Profile' -and $_.RegisteredOrganization -ieq '1' -and ($_.RegisteredVersion).StartsWith("1.")} -} - -# cmdlets should use this, since it will be mocked in unit tests -function Get-NetworkSwitchImplementationNamespace() { -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession - ) - - Get-NetworkSwitchImplementationNamespace_Internal -CimSession $CimSession -} - -function New-LocalCimInstance() { -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimClass] $CimClass, - - [Parameter(Mandatory=$true)] - [HashTable] $Property - ) - - New-CimInstance -ClientOnly -CimClass $CimClass -Property $Property -} - - -# fallback localization data in case it fails to load properly -data networkSwitchLocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' - ErrorMessageNoTarget={0} encountered an error. Ensure that you are using a valid CIM session and that the Ethernet Switch Profile is correctly registered. If you are passing input objects, ensure these are valid instances of the appropriate type. See the Exception member of this error record for more details on the underlying issue. - ErrorMessageTarget={0} encountered an error while processing {1}. Ensure that you are using a valid CIM session and that the Ethernet Switch Profile is correctly registered. If you are passing input objects, ensure these are valid instances of the appropriate type. See the Exception member of this error record for more details on the underlying issue. - WarningMessageNoTarget={0} encountered a warning: {1}. - WarningMessageTarget={0} encountered a warning while processing {1}: {2}. - UnknownError=An unknown error has occured - error code {0}. - NoValidAssociatedSwitch=The registered Ethernet Switch Profile is not associated with a conforming switch. Please register your switch as conforming to the Ethernet Switch Profile. - NoValidAssociatedNamespace=The switch registered as conforming to the Ethernet Switch Profile is not associated with a valid namespace. Please verify your switch implementation and registration. - NoValidRegisteredProfile=The Ethernet Switch Profile was not registered in root/interop, interop, /root/interop or /interop. Please register the Ethernet Switch Profile in one of these namespaces. - NoMatchingInstance=Did not find any instances matching search criteria: {0} = {1}. -'@ -} - -# load localized strings for the locale -Import-LocalizedData networkSwitchLocalizedData -filename NetworkSwitchManager.Resource.psd1 - -$script:nsLocalizedData = $networkSwitchLocalizedData - -function NetworkSwitchExceptionHandler( - [System.Collections.ArrayList] $ErrorObjects, - [System.Collections.ArrayList] $WarningObjects, - [string] $CmdletName, - [object] $TargetObject) { - - foreach ($ErrorObject in $ErrorObjects) { - - if ($TargetObject) { - $torExceptionMessage = $script:nsLocalizedData.ErrorMessageTarget -f $CmdletName, $TargetObject - } - else { - $torExceptionMessage = $script:nsLocalizedData.ErrorMessageNoTarget -f $CmdletName - } - - $baseErrorId = $ErrorObject.FullyQualifiedErrorId - $errorId = "NetworkSwitchManager : $CmdletName : $baseErrorId" - - $torException = New-Object -TypeName System.Exception -ArgumentList @($torExceptionMessage, $ErrorObject.Exception) - - $torErrorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList @($TorException, ` - $errorId, ` - [System.Management.Automation.ErrorCategory] "NotSpecified", ` - $TargetObject) - - Write-Error -ErrorRecord $torErrorRecord - } - - foreach ($WarningObject in $WarningObjects) { - - if ($TargetObject) { - $warningMessage = $script:nsLocalizedData.WarningMessageTarget -f $CmdletName, $TargetObject, $WarningObject.Message - } - else { - $warningMessage = $script:nsLocalizedData.WarningMessageNoTarget -f $CmdletName, $WarningObject.Message - } - - Write-Warning $warningMessage - - } -} - -$global:NETWORK_SWITCH_UNKNOWN_ERROR = 0 -$global:NETWORK_SWITCH_NO_VALID_ASSOCIATED_SWITCH = 1 -$global:NETWORK_SWITCH_NO_VALID_ASSOCIATED_NAMESPACE = 2 -$global:NETWORK_SWITCH_NO_VALID_REGISTERED_PROFILE = 3 -$global:NETWORK_SWITCH_NO_MATCHING_INSTANCE = 4 - -$script:nsCustomErrorMessages = @( - $script:nsLocalizedData.UnknownError, - $script:nsLocalizedData.NoValidAssociatedSwitch, - $script:nsLocalizedData.NoValidAssociatedNamespace, - $script:nsLocalizedData.NoValidRegisteredProfile, - $script:nsLocalizedData.NoMatchingInstance - ) - -function NetworkSwitchErrorHandler( - [int] $ErrorCode, - [string] $CmdletName, - [object] $TargetObject, - [object] $ExtraData1, - [object] $ExtraData2) { - - $baseMessage = $script:nsCustomErrorMessages[$ErrorCode] - - if (($ErrorCode -ne 0) -and $baseMessage) { - $message = $baseMessage -f $ExtraData1, $ExtraData2 - } - else { - $message = $script:nsCustomErrorMessages[$global:NETWORK_SWITCH_UNKNOWN_ERROR] -f $ErrorCode - } - - $nsErrorId = "Error_$ErrorCode" - $nsException = New-Object -TypeName System.Exception -ArgumentList @($message) - $nsErrorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` - -ArgumentList @($nsException, ` - $nsErrorId, ` - [System.Management.Automation.ErrorCategory] "NotSpecified", ` - $TargetObject) - - NetworkSwitchExceptionHandler -ErrorObjects @($nsErrorRecord) ` - -CmdletName $CmdletName ` - -TargetObject $TargetObject -} - - - -function Get-NetworkSwitchService( - [string] $Namespace, - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - [string] $CmdletName) { - - $switchService = Get-CimInstance -ClassName MSFT_SwitchService ` - -Namespace $Namespace ` - -CimSession $CimSession ` - -ErrorVariable cimError ` - -WarningVariable cimWarning ` - -ErrorAction SilentlyContinue ` - -WarningAction SilentlyContinue ` - - NetworkSwitchExceptionHandler -ErrorObject $cimError ` - -WarningObject $cimWarning ` - -CmdletName $cmdletName ` - -TargetObject $port - - $switchService -} - - -function Get-NetworkSwitchAssociatedInstance( - [Microsoft.Management.Infrastructure.CimInstance] $InputObject, - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - [string] $CmdletName, - [string] $ResultClassName - ) { - - $instances = Get-CimAssociatedInstance -InputObject $InputObject ` - -ResultClassName $ResultClassName ` - -CimSession $CimSession ` - -ErrorVariable cimError ` - -WarningVariable cimWarning ` - -ErrorAction SilentlyContinue ` - -WarningAction SilentlyContinue - - NetworkSwitchExceptionHandler -ErrorObject $cimError ` - -WarningObject $cimWarning ` - -CmdletName $cmdletName ` - -TargetObject $InputObject - $instances -} - -function Get-NetworkSwitchClass( - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - [string] $ClassName, - [string] $Namespace, - [string] $CmdletName) { - - $classDef = Get-CimClass -Namespace $Namespace ` - -ClassName $ClassName ` - -CimSession $CimSession ` - -ErrorVariable cimError ` - -WarningVariable cimWarning ` - -ErrorAction SilentlyContinue ` - -WarningAction SilentlyContinue - - NetworkSwitchExceptionHandler -ErrorObject $cimError ` - -WarningObject $cimWarning ` - -CmdletName $cmdletName ` - -TargetObject $InputObject - - $classDef -} - -function Set-NetworkSwitchInstance( - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - [Microsoft.Management.Infrastructure.CimInstance] $InputObject, - [HashTable] $Property, - [string] $CmdletName) { - - Set-CimInstance -InputObject $InputObject ` - -Property $Property ` - -CimSession $CimSession ` - -Confirm:$false ` - -ErrorVariable cimError ` - -WarningVariable cimWarning ` - -ErrorAction SilentlyContinue ` - -WarningAction SilentlyContinue ` - 1>$null - - NetworkSwitchExceptionHandler -ErrorObject $cimError ` - -WarningObject $cimWarning ` - -CmdletName $cmdletName ` - -TargetObject $InputObject -} - -function Get-NetworkSwitchInstanceNoFilter( - [string] $Namespace, - [string] $ClassName, - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - [string] $CmdletName) { - - $insts = Get-CimInstance -NameSpace $Namespace ` - -ClassName $ClassName ` - -CimSession $CimSession ` - -ErrorVariable cimError ` - -WarningVariable cimWarning ` - -ErrorAction SilentlyContinue ` - -WarningAction SilentlyContinue - - NetworkSwitchExceptionHandler -ErrorObject $cimError ` - -WarningObject $cimWarning ` - -CmdletName $CmdletName - $insts -} - -function Filter-NetworkSwitchInstance( - [Microsoft.Management.Infrastructure.CimInstance[]] $Instances, - [string] $Property, - [object] $Value, - [switch] $UseLike, - [switch] $UseContains, - [switch] $AssertNonEmpty, - [string] $CmdletName) { - - $insts = $null - if ($Instances) { - if ($UseLike) { - $insts = $Instances | where {$_.CimInstanceProperties[$Property].Value -like $Value} - } - elseif ($UseContains) { - $insts = $Instances | where {$Value -contains $_.CimInstanceProperties[$Property].Value} - } - else { - $insts = $Instances | where {$_.CimInstanceProperties[$Property].Value -eq $Value} - } - } - - if ($AssertNonEmpty -and (-not $insts)) { - NetworkSwitchErrorHandler -ErrorCode $global:NETWORK_SWITCH_NO_MATCHING_INSTANCE ` - -CmdletName $CmdletName ` - -ExtraData1 $Property ` - -ExtraData2 $Value - } - - $insts -} - -function Invoke-NetworkSwitchMethod( - [Microsoft.Management.Infrastructure.CimInstance] $Instance, - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - [string] $MethodName, - [HashTable] $Arguments, - [string] $CmdletName) { - - Invoke-CimMethod -InputObject $Instance ` - -MethodName $MethodName ` - -Arguments $Arguments ` - -CimSession $CimSession ` - -Confirm:$false ` - -ErrorVariable cimError ` - -WarningVariable cimWarning ` - -ErrorAction SilentlyContinue ` - -WarningAction SilentlyContinue ` - 1>$null - - NetworkSwitchExceptionHandler -ErrorObject $cimError ` - -WarningObject $cimWarning ` - -CmdletName $cmdletName ` - -TargetObject $Instance -} - -#cmdlets should never use this; it will be unit-tested. -function Get-NetworkSwitchImplementationNamespace_Internal() { -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession]$cimSession - ) - - $cmdletName = "Get-NetworkSwitchImplementationNamespace" - $ethernetSwitchProfile = Get-NetworkSwitchRegisteredProfileFromNamespace -CimSession $CimSession -Namespace root/interop - - if (-not $ethernetSwitchProfile) { - $ethernetSwitchProfile = Get-NetworkSwitchRegisteredProfileFromNamespace -CimSession $CimSession -Namespace interop - } - - if (-not $ethernetSwitchProfile) { - $ethernetSwitchProfile = Get-NetworkSwitchRegisteredProfileFromNamespace -CimSession $CimSession -Namespace /root/interop - } - - if (-not $ethernetSwitchProfile) { - $ethernetSwitchProfile = Get-NetworkSwitchRegisteredProfileFromNamespace -CimSession $CimSession -Namespace /interop - } - - if (-not $ethernetSwitchProfile) { - NetworkSwitchErrorHandler -ErrorCode $global:NETWORK_SWITCH_NO_VALID_REGISTERED_PROFILE ` - -CmdletName $cmdletName - return - } - - $computerSystem = Get-CimAssociatedInstance -InputObject $ethernetSwitchProfile -ResultClassName CIM_ComputerSystem -CimSession $CimSession - - if(-not $computerSystem) { - NetworkSwitchErrorHandler -ErrorCode $global:NETWORK_SWITCH_NO_VALID_ASSOCIATED_SWITCH ` - -CmdletName $cmdletName - return - } - - $namespace = $computerSystem.CimSystemProperties.Namespace - - if(-not $namespace) { - NetworkSwitchErrorHandler -ErrorCode $global:NETWORK_SWITCH_NO_VALID_ASSOCIATED_NAMESPACE ` - -CmdletName $cmdletName - return - } - - $namespace -} - -Export-ModuleMember -Function * \ No newline at end of file diff --git a/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchConfiguration.psm1 b/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchConfiguration.psm1 deleted file mode 100644 index defbe0d..0000000 --- a/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchConfiguration.psm1 +++ /dev/null @@ -1,71 +0,0 @@ -########################################################################### -# # -# Module Name: NetworkSwitchConfiguration.psm1 # -# # -# Description: Cmdlets for saving and restoring the switch state # -# # -# Copyright (c) Microsoft Corporation. All rights reserved. # -# # -########################################################################### - -import-module "$PSScriptRoot\CmdletHelpers.psm1" -Force -DisableNameChecking - -function Restore-NetworkSwitchConfiguration() { -[CmdletBinding(SupportsShouldProcess=$true)] -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession - ) - - Begin { - $cmdletName = "Restore-NetworkSwitchConfiguration" - $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession - } - - Process { - if (-not $nsNamespace) { return } - - $ss = Get-NetworkSwitchService -Namespace $nsNamespace ` - -CimSession $cimSession ` - -CmdletName $cmdletName - - if ($(CmdletShouldProcess $PSCmdlet $ss)) { - Invoke-NetworkSwitchMethod -Instance $ss[0] ` - -CimSession $CimSession ` - -MethodName "CopyStartupToCurrent" ` - -CmdletName $cmdletName - } - } - - End {} -} - -function Save-NetworkSwitchConfiguration() { -[CmdletBinding(SupportsShouldProcess=$true)] -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession - ) - - Begin { - $cmdletName = "Save-NetworkSwitchConfiguration" - $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession - } - - Process { - if (-not $nsNamespace) { return } - - $ss = Get-NetworkSwitchService -Namespace $nsNamespace ` - -CimSession $cimSession ` - -CmdletName $cmdletName - - if ($(CmdletShouldProcess $PSCmdlet $ss)) { - Invoke-NetworkSwitchMethod -Instance $ss[0] ` - -CimSession $CimSession ` - -MethodName "CopyCurrentToStartup" ` - -CmdletName $cmdletName - } - } - - End {} -} diff --git a/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchEthernetPort.psm1 b/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchEthernetPort.psm1 deleted file mode 100644 index abdc6a8..0000000 --- a/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchEthernetPort.psm1 +++ /dev/null @@ -1,573 +0,0 @@ -########################################################################### -# # -# Module Name: NetworkSwitchEthernetPort.psm1 # -# # -# Description: Cmdlets to manage Ethernet ports # -# # -# Copyright (c) Microsoft Corporation. All rights reserved. # -# # -########################################################################### - -import-module "$PSScriptRoot\CmdletHelpers.psm1" -Force -DisableNameChecking - -function Disable-NetworkSwitchEthernetPort() { -[CmdletBinding(SupportsShouldProcess=$true)] -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - - [Parameter(Mandatory=$true, ParameterSetName="DeviceIdSet")] - [string] $DeviceID, - - [Parameter(Mandatory=$true, ParameterSetName="PortNumberSet")] - [int] $PortNumber, - - [Parameter(Mandatory=$true, - ParameterSetName="InputObjectSet", - ValueFromPipeline=$true)] - [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject - ) - - Begin { - $cmdletName = "Disable-NetworkSwitchEthernetPort" - $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession - } - - Process { - if (-not $nsNamespace) { return } - - if ($InputObject) { - if ($input) { - $ports = $input[0] - } - else { - $ports = $InputObject - } - } - else { - - $ports = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` - -ClassName CIM_EthernetPort ` - -CimSession $CimSession ` - -CmdletName $cmdletName - if ($DeviceID) { - $ports = Filter-NetworkSwitchInstance -Instances $ports ` - -Property DeviceId ` - -Value $DeviceId ` - -CmdletName $cmdletName ` - -AssertNonEmpty - } - elseif ($PortNumber) { - $ports = Filter-NetworkSwitchInstance -Instances $ports ` - -Property PortNumber ` - -Value $PortNumber ` - -CmdletName $cmdletName ` - -AssertNonEmpty - } - } - - foreach ($port in $ports) { - if ($(CmdletShouldProcess $PSCmdlet $port)) { - Invoke-NetworkSwitchMethod -Instance $port ` - -CimSession $CimSession ` - -MethodName "RequestStateChange" ` - -Arguments @{RequestedState = 3} ` - -CmdletName $cmdletName - } - } - } - - End {} -} - -function Enable-NetworkSwitchEthernetPort() { -[CmdletBinding(SupportsShouldProcess=$true)] -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - - [Parameter(Mandatory=$true, ParameterSetName="DeviceIdSet")] - [string] $DeviceID, - - [Parameter(Mandatory=$true, ParameterSetName="PortNumberSet")] - [int] $PortNumber, - - [Parameter(Mandatory=$true, - ParameterSetName="InputObjectSet", - ValueFromPipeline=$true)] - [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject - ) - - Begin { - $cmdletName = "Enable-NetworkSwitchEthernetPort" - $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession - } - - Process { - if (-not $nsNamespace) { return } - - if ($InputObject) { - if ($input) { - $ports = $input[0] - } - else { - $ports = $InputObject - } - } - else { - $ports = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` - -ClassName CIM_EthernetPort ` - -CimSession $CimSession ` - -CmdletName $cmdletName - if ($DeviceID) { - $ports = Filter-NetworkSwitchInstance -Instances $ports ` - -Property DeviceId ` - -Value $DeviceId ` - -CmdletName $cmdletName ` - -AssertNonEmpty - } - elseif ($PortNumber) { - $ports = Filter-NetworkSwitchInstance -Instances $ports ` - -Property PortNumber ` - -Value $PortNumber ` - -CmdletName $cmdletName ` - -AssertNonEmpty - } - } - - foreach ($port in $ports) { - if ($(CmdletShouldProcess $PSCmdlet $port)) { - Invoke-NetworkSwitchMethod -Instance $port ` - -CimSession $CimSession ` - -MethodName "RequestStateChange" ` - -Arguments @{RequestedState = 2} ` - -CmdletName $cmdletName - } - } - } - - End {} -} - -function Get-NetworkSwitchEthernetPort() { -[CmdletBinding(DefaultParameterSetName="DeviceIDSet")] -[OutputType([Microsoft.Management.Infrastructure.CimInstance])] -[OutputType('Microsoft.Management.Infrastructure.CimInstance#CIM_EthernetPort')] -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - - [Parameter(Mandatory=$false, ParameterSetName="DeviceIDSet")] - [string] $DeviceId, - - [Parameter(Mandatory=$true, ParameterSetName="FullDuplexEnabledSet")] - [switch] $FullDuplexEnabled, - - [Parameter(Mandatory=$true, ParameterSetName="FullDuplexDisabledSet")] - [switch] $FullDuplexDisabled, - - [Parameter(Mandatory=$true, ParameterSetName="PortNumberSet")] - [int] $PortNumber - ) - - Begin { - $cmdletName = "Get-NetworkSwitchEthernetPort" - $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession - } - - Process { - if (-not $nsNamespace) { return } - - $ports = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` - -ClassName CIM_EthernetPort ` - -CimSession $CimSession ` - -CmdletName $cmdletName - if ($DeviceId) { - $ports = Filter-NetworkSwitchInstance -Instances $ports ` - -Property DeviceId ` - -Value $DeviceId ` - -CmdletName $cmdletName ` - -AssertNonEmpty - } - elseif ($FullDuplexEnabled) { - $ports = Filter-NetworkSwitchInstance -Instances $ports ` - -Property FullDuplex ` - -Value $true ` - -CmdletName $cmdletName ` - } - elseif ($FullDuplexDisabled) { - $ports = Filter-NetworkSwitchInstance -Instances $ports ` - -Property FullDuplex ` - -Value $false ` - -CmdletName $cmdletName ` - } - elseif ($PortNumber) { - $ports = Filter-NetworkSwitchInstance -Instances $ports ` - -Property PortNumber ` - -Value $PortNumber ` - -CmdletName $cmdletName ` - -AssertNonEmpty - } - - foreach ($port in $ports) { - $lanep = Get-NetworkSwitchAssociatedInstance -InputObject $port ` - -ResultClassName Cim_LanEndpoint ` - -CimSession $CimSession ` - -CmdletName $cmdletName - if ($lanep) { - $ippe = @(Get-NetworkSwitchAssociatedInstance -InputObject $lanep ` - -ResultClassName CIM_IPProtocolEndpoint ` - -CimSession $CimSession ` - -CmdletName $cmdletName) - } - - if ($lanep) { - $vlanep = Get-NetworkSwitchAssociatedInstance -InputObject $lanep ` - -ResultClassName Cim_VLanEndpoint ` - -CimSession $CimSession ` - -CmdletName $cmdletName - } - - if ($vlanep) { - $vlanepsd = Get-NetworkSwitchAssociatedInstance -InputObject $vlanep ` - -ResultClassName Cim_VLanEndpointSettingData ` - -CimSession $CimSession ` - -CmdletName $cmdletName - } - - $port.PSObject.Members.Remove("IPAddress") - Add-Member -InputObject $port ` - -MemberType NoteProperty ` - -Name IPAddress ` - -Value $ippe - - $port.PSObject.Members.Remove("PortMode") - Add-Member -InputObject $port ` - -MemberType NoteProperty ` - -Name PortMode ` - -Value $vlanep.DesiredEndpointMode - - $port.PSObject.Members.Remove("AccessVLAN") - Add-Member -InputObject $port ` - -MemberType NoteProperty ` - -Name AccessVLAN ` - -Value $vlanepsd.AccessVLAN - - $port.PSObject.Members.Remove("TrunkedVLANList") - Add-Member -InputObject $port ` - -MemberType NoteProperty ` - -Name TrunkedVLANList ` - -Value $vlanepsd.TrunkedVLANList - - $port - } - } - - End {} -} - -function Remove-NetworkSwitchEthernetPortIPAddress() { -[CmdletBinding(SupportsShouldProcess=$true)] -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - - [Parameter(Mandatory=$true, ParameterSetName="PortNumberSet")] - [int] $PortNumber, - - [Parameter(Mandatory=$true, - ParameterSetName="InputObjectSet", - ValueFromPipeline=$true)] - [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject - ) - - Begin { - $cmdletName = "Remove-NetworkSwitchEthernetPortIPAddress" - $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession - } - - Process { - if (-not $nsNamespace) { return } - - if ($InputObject) { - if ($input) { - $ports = $input[0] - } - else { - $ports = $InputObject - } - } - else { - $ports = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` - -ClassName CIM_EthernetPort ` - -CimSession $CimSession ` - -CmdletName $cmdletName - if ($PortNumber) { - $ports = Filter-NetworkSwitchInstance -Instances $ports ` - -Property PortNumber ` - -Value $PortNumber ` - -CmdletName $cmdletName ` - -AssertNonEmpty - } - } - - $switchService = Get-NetworkSwitchService -Namespace $nsNamespace ` - -CimSession $cimSession ` - -CmdletName $cmdletName - foreach ($port in $ports) { - if ($(CmdletShouldProcess $PSCmdlet $port)) { - $lanEndpoints = Get-NetworkSwitchAssociatedInstance -InputObject $port ` - -CimSession $CimSession ` - -ResultClassName CIM_LANEndpoint ` - -CmdletName $cmdletName - foreach ($lep in $lanEndpoints) { - $protocolEndpoints = Get-NetworkSwitchAssociatedInstance -InputObject $lep ` - -CimSession $CimSession ` - -ResultClassName CIM_IPProtocolEndpoint ` - -CmdletName $cmdletName - foreach($pep in $protocolEndpoints) { - - Invoke-NetworkSwitchMethod -Instance $switchService[0] ` - -CimSession $CimSession ` - -MethodName "RemoveProtocolEndpoint" ` - -Arguments @{Endpoint = $pep} ` - -CmdletName $cmdletName - } - } - } - } - } - - End {} -} - -function Set-NetworkSwitchEthernetPortIPAddress() { -[CmdletBinding(SupportsShouldProcess=$true)] -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - - [Parameter(Mandatory=$true)] - [string] $IpAddress, - - [Parameter(Mandatory=$true)] - [string] $SubnetAddress, - - [Parameter(Mandatory=$true, ParameterSetName="PortNumberSet")] - [int] $PortNumber, - - [Parameter(Mandatory=$true, - ParameterSetName="InputObjectSet", - ValueFromPipeline=$true)] - [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject - ) - - Begin { - $cmdletName = "Set-NetworkSwitchEthernetPortIPAddress" - $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession - } - - Process { - if (-not $nsNamespace) { return } - - if ($InputObject) { - if ($input) { - $ports = $input[0] - } - else { - $ports = $InputObject - } - } - else { - $ports = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` - -ClassName CIM_EthernetPort ` - -CimSession $CimSession ` - -CmdletName $cmdletName - if ($PortNumber) { - $ports = Filter-NetworkSwitchInstance -Instances $ports ` - -Property PortNumber ` - -Value $PortNumber ` - -CmdletName $cmdletName ` - -AssertNonEmpty - } - } - - $switchService = Get-NetworkSwitchService -Namespace $nsNamespace ` - -CimSession $cimSession ` - -CmdletName $cmdletName - - $ippeCls = Get-NetworkSwitchClass -Namespace $nsNamespace ` - -ClassName CIM_IPProtocolEndpoint ` - -CimSession $CimSession ` - -CmdletName $cmdletName - - $protocolEndpoint = New-LocalCimInstance -CimClass $ippeCls ` - -Property @{IPV4Address = $ipAddress; ` - SubnetMask = $SubnetAddress} - foreach ($port in $ports) { - if ($(CmdletShouldProcess $PSCmdlet $port)) { - Invoke-NetworkSwitchMethod -Instance $switchService[0] ` - -CimSession $CimSession ` - -MethodName "AddProtocolEndpoint" ` - -Arguments @{TargetInterface = $port; ` - ProtocolEndpoint = [ciminstance[]]@($protocolEndpoint)} ` - -CmdletName $cmdletName - } - } - } - - End {} -} - -function Set-NetworkSwitchPortMode() { -[CmdletBinding(SupportsShouldProcess=$true)] -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - - [Parameter(Mandatory=$true, ParameterSetName="AccessSet")] - [switch] $AccessMode, - - [Parameter(Mandatory=$true, ParameterSetName="AccessSet")] - [int] $VlanID, - - [Parameter(Mandatory=$true, ParameterSetName="RouteSet")] - [switch] $RouteMode, - - [Parameter(Mandatory=$true, ParameterSetName="RouteSet")] - [string] $IpAddress, - - [Parameter(Mandatory=$true, ParameterSetName="RouteSet")] - [string] $SubnetAddress, - - [Parameter(Mandatory=$true, ParameterSetName="TrunkSet")] - [switch] $TrunkMode, - - [Parameter(Mandatory=$true, ParameterSetName="TrunkSet")] - [uint16[]] $VlanIDs, - - [Parameter(Mandatory=$true, ValueFromPipeline=$true)] - [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject - ) - - Begin { - $cmdletName = "Set-NetworkSwitchPortMode" - $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession - } - - Process { - if (-not $nsNamespace) { return } - - if ($input) { - $ports = $input[0] - } - else { - $ports = $InputObject - } - - if ($RouteMode) { - $switchService = Get-NetworkSwitchService -Namespace $nsNamespace ` - -CimSession $cimSession ` - -CmdletName $cmdletName - - $ippeCls = Get-NetworkSwitchClass -Namespace $nsNamespace ` - -ClassName CIM_IPProtocolEndpoint ` - -CimSession $CimSession ` - -CmdletName $cmdletName - - $protocolEndpoint = New-LocalCimInstance -CimClass $ippeCls ` - -Property @{IPV4Address = $ipAddress; ` - SubnetMask = $SubnetAddress} - } - - foreach ($port in $ports) { - if ($(CmdletShouldProcess $PSCmdlet $port)) { - if ($RouteMode) { - Invoke-NetworkSwitchMethod -Instance $switchService[0] ` - -CimSession $CimSession ` - -MethodName "AddProtocolEndpoint" ` - -Arguments @{TargetInterface = $port; ` - ProtocolEndpoint = [ciminstance[]]@($protocolEndpoint)} ` - -CmdletName $cmdletName - } - else { - $lanep = Get-NetworkSwitchAssociatedInstance -InputObject $port ` - -ResultClassName Cim_LanEndpoint ` - -CimSession $CimSession ` - -CmdletName $cmdletName - - $vlanep = Get-NetworkSwitchAssociatedInstance -InputObject $lanep ` - -ResultClassName Cim_VLanEndpoint ` - -CimSession $CimSession ` - -CmdletName $cmdletName - - $vlanepsd = Get-NetworkSwitchAssociatedInstance -InputObject $vlanep ` - -ResultClassName Cim_VLanEndpointSettingData ` - -CimSession $CimSession ` - -CmdletName $cmdletName - if ($AccessMode) { - $vlanepProp = @{DesiredEndpointMode = 2} - $vlanepsdProp = @{AccessVlan = $VlanID} - } - elseif ($TrunkMode) { - $vlanepProp = @{DesiredEndpointMode = 5} - $vlanepsdProp = @{TrunkedVlanList = $VlanIDs} - } - - Set-NetworkSwitchInstance -InputObject $vlanep ` - -Property $vlanepProp ` - -CimSession $CimSession ` - -CmdletName $cmdletName - - Set-NetworkSwitchInstance -InputObject $vlanepsd ` - -Property $vlanepsdProp ` - -CimSession $CimSession ` - -CmdletName $cmdletName - } - } - } - } - - End {} -} - -function Set-NetworkSwitchPortProperty() { -[CmdletBinding(SupportsShouldProcess=$true)] -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - - [Parameter(Mandatory=$false)] - [System.Collections.HashTable] $Property, - - [Parameter(Mandatory=$true, ValueFromPipeline=$true)] - [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject - ) - - Begin { - $cmdletName = "Set-NetworkSwitchPortProperty" - $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession - } - - Process { - if (-not $nsNamespace) { return } - - if ($input) { - $ports = $input[0] - } - else { - $ports = $InputObject - } - - foreach ($port in $ports) { - if ($(CmdletShouldProcess $PSCmdlet $port)) { - Set-NetworkSwitchInstance -InputObject $port ` - -CimSession $CimSession ` - -Property $Property ` - -CmdletName $cmdletName - } - } - } - - End {} -} diff --git a/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchFeature.psm1 b/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchFeature.psm1 deleted file mode 100644 index 3e8bb14..0000000 --- a/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchFeature.psm1 +++ /dev/null @@ -1,221 +0,0 @@ -########################################################################### -# # -# Module Name: NetworkSwitchFeature.psm1 # -# # -# Description: Cmdlets to manage features # -# # -# Copyright (c) Microsoft Corporation. All rights reserved. # -# # -########################################################################### - -import-module "$PSScriptRoot\CmdletHelpers.psm1" -Force -DisableNameChecking - -function Disable-NetworkSwitchFeature() { -[CmdletBinding(SupportsShouldProcess=$true)] -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - - [Parameter(Mandatory=$true, ParameterSetName="FeatureNameSet")] - [int] $FeatureName, - - [Parameter(Mandatory=$true, ParameterSetName="NameSet")] - [string] $Name, - - [Parameter(Mandatory=$true,ParameterSetName="InstanceIdSet")] - [string] $InstanceId, - - [Parameter(Mandatory=$true, - ParameterSetName="InputObjectSet", - ValueFromPipeline=$true)] - [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject - ) - - Begin { - $cmdletName = "Disable-NetworkSwitchFeature" - $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession - } - - Process { - if (-not $nsNamespace) { return } - - if ($InputObject) { - if ($input) { - $features = $input[0] - } - else { - $features = $InputObject - } - } - else { - $features = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` - -ClassName MSFT_Feature ` - -CimSession $CimSession ` - -CmdletName $cmdletName - if ($FeatureName) { - $features = Filter-NetworkSwitchInstance -Instances $features ` - -Property FeatureName ` - -Value $FeatureName ` - -CmdletName $cmdletName - } - elseif ($Name) { - $features = Filter-NetworkSwitchInstance -Instances $features ` - -Property Name ` - -Value $Name ` - -CmdletName $cmdletName ` - -UseLike - } - elseif ($InstanceId) { - $features = Filter-NetworkSwitchInstance -Instances $features ` - -Property InstanceId ` - -Value $InstanceId ` - -CmdletName $cmdletName ` - -AssertNonEmpty - } - } - - foreach ($feature in $features) { - if ($(CmdletShouldProcess $PSCmdlet $feature)) { - Set-NetworkSwitchInstance -InputObject $feature ` - -Property @{IsEnabled = $false} ` - -CimSession $CimSession ` - -CmdletName $cmdletName - } - } - } - - End {} -} - -function Enable-NetworkSwitchFeature() { -[CmdletBinding(SupportsShouldProcess=$true)] -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - - [Parameter(Mandatory=$true,ParameterSetName="FeatureNameSet")] - [int] $FeatureName, - - [Parameter(Mandatory=$true,ParameterSetName="NameSet")] - [string] $Name, - - [Parameter(Mandatory=$true,ParameterSetName="InstanceIdSet")] - [string] $InstanceId, - - [Parameter(Mandatory=$true, - ParameterSetName="InputObjectSet", - ValueFromPipeline=$true)] - [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject - ) - - Begin { - $cmdletName = "Enable-NetworkSwitchFeature" - $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession - } - - Process { - if (-not $nsNamespace) { return } - - if ($InputObject) { - if ($input) { - $features = $input[0] - } - else { - $features = $InputObject - } - } - else { - $features = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` - -ClassName MSFT_Feature ` - -CimSession $CimSession ` - -CmdletName $cmdletName - if ($FeatureName) { - $features = Filter-NetworkSwitchInstance -Instances $features ` - -Property FeatureName ` - -Value $FeatureName ` - -CmdletName $cmdletName - } - elseif ($Name) { - $features = Filter-NetworkSwitchInstance -Instances $features ` - -Property Name ` - -Value $Name ` - -CmdletName $cmdletName ` - -UseLike - } - elseif ($InstanceId) { - $features = Filter-NetworkSwitchInstance -Instances $features ` - -Property InstanceId ` - -Value $InstanceId ` - -CmdletName $cmdletName ` - -AssertNonEmpty - } - } - - foreach ($feature in $features) { - if ($(CmdletShouldProcess $PSCmdlet $feature)) { - Set-NetworkSwitchInstance -InputObject $feature ` - -Property @{IsEnabled = $true} ` - -CimSession $CimSession ` - -CmdletName $cmdletName - } - } - } - - End {} -} - -function Get-NetworkSwitchFeature() { -[CmdletBinding(DefaultParameterSetName="NameSet")] -[OutputType([Microsoft.Management.Infrastructure.CimInstance])] -[OutputType('Microsoft.Management.Infrastructure.CimInstance#MSFT_Feature')] -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - - [Parameter(Mandatory=$false, ParameterSetName="NameSet")] - [string] $Name, - - [Parameter(Mandatory=$true, ParameterSetName="EnabledSet")] - [switch] $Enabled, - - [Parameter(Mandatory=$true, ParameterSetName="DisabledSet")] - [switch] $Disabled - ) - - Begin { - $cmdletName = "Get-NetworkSwitchFeature" - $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession - } - - Process { - if (-not $nsNamespace) { return } - - $featureList = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` - -ClassName MSFT_Feature ` - -CimSession $CimSession ` - -CmdletName $cmdletName - if ($Name) { - $featureList = Filter-NetworkSwitchInstance -Instances $featureList ` - -Property Name ` - -Value $Name ` - -CmdletName $cmdletName ` - -UseLike - } - elseif ($Enabled) { - $featureList = Filter-NetworkSwitchInstance -Instances $featureList ` - -Property IsEnabled ` - -Value $true ` - -CmdletName $cmdletName - } - elseif ($Disabled) { - $featureList = Filter-NetworkSwitchInstance -Instances $featureList ` - -Property IsEnabled ` - -Value $false ` - -CmdletName $cmdletName - } - - $featureList - } - - End {} -} diff --git a/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchGlobalSettingData.psm1 b/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchGlobalSettingData.psm1 deleted file mode 100644 index 06247df..0000000 --- a/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchGlobalSettingData.psm1 +++ /dev/null @@ -1,37 +0,0 @@ -########################################################################### -# # -# Module Name: NetworkSwitchGlobalSettingData.psm1 # -# # -# Description: Cmdlet to access the switch global settings data # -# # -# Copyright (c) Microsoft Corporation. All rights reserved. # -# # -########################################################################### - -import-module "$PSScriptRoot\CmdletHelpers.psm1" -Force -DisableNameChecking - -function Get-NetworkSwitchGlobalData() { -[CmdletBinding()] -[OutputType([Microsoft.Management.Infrastructure.CimInstance])] -[OutputType('Microsoft.Management.Infrastructure.CimInstance#MSFT_GlobalEthernetSwitchSettingData')] -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession - ) - - Begin { - $cmdletName = "Get-NetworkSwitchGlobalData" - $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession - } - - Process { - if (-not $nsNamespace) { return } - - Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` - -ClassName MSFT_GlobalEthernetSwitchSettingData ` - -CimSession $CimSession ` - -CmdletName $cmdletName - } - - End {} -} diff --git a/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchManager.format.ps1xml b/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchManager.format.ps1xml deleted file mode 100644 index 62e915c..0000000 --- a/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchManager.format.ps1xml +++ /dev/null @@ -1,391 +0,0 @@ - - - - - GlobalSwitchSettingData_TableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_GlobalEthernetSwitchSettingData - - - - - - 20 - - - - 20 - - - - 20 - - - - 20 - - - - 15 - - - - 20 - - - - - - - Caption - - - Description - - - Name - - - Banner - - - BannerIsEnabled - - - InstanceID - - - - - - - - Feature_TableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_Feature - - - - - - 20 - - - - 20 - - - - 20 - - - - - - - Name - - - IsEnabled - - - InstanceID - - - - - - - - NetworkVLAN_TableView - - Microsoft.Management.Infrastructure.CimInstance#CIM_NetworkVLAN - - - - - - 20 - - - - 20 - - - - 20 - - - - 20 - - - - 10 - - - - - - - Caption - - - Description - - - Name - - - InstanceID - - - VlanID - - - - - - - - EthernetPort_TableView - - Microsoft.Management.Infrastructure.CimInstance#CIM_EthernetPort - - - - - - 20 - - - - 10 - - - - 20 - - - - 10 - - - - 10 - - - - 10 - - - - 15 - - - - - - - Name - - - PortNumber - - - DeviceID - - - FullDuplex - - - AutoSense - - - PortType - - - MaxDataSize - - - - - - - - IPProtocolEndpoint_TableView - - Microsoft.Management.Infrastructure.CimInstance#CIM_IPProtocolEndpoint - - - - - - 20 - - - - 20 - - - - - - - SubnetAddress - - - IPAddress - - - - - - - - GlobalSwitchSettingData_ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_GlobalEthernetSwitchSettingData - - - - - - - Caption - - - Description - - - Name - - - Banner - - - BannerIsEnabled - - - InstanceID - - - - - - - - Feature_ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_Feature - - - - - - - Name - - - IsEnabled - - - InstanceID - - - - - - - - NetworkVLAN_ListView - - Microsoft.Management.Infrastructure.CimInstance#CIM_NetworkVLAN - - - - - - - Caption - - - Description - - - Name - - - InstanceID - - - VlanID - - - - - - - - EthernetPort_ListView - - Microsoft.Management.Infrastructure.CimInstance#CIM_EthernetPort - - - - - - - Name - - - PortNumber - - - DeviceID - - - FullDuplex - - - AutoSense - - - PortType - - - MaxDataSize - - - - - - - - IPProtocolEndpoint_ListView - - Microsoft.Management.Infrastructure.CimInstance#CIM_IPProtocolEndpoint - - - - - - - SubnetAddress - - - IPAddress - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchManager.psd1 b/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchManager.psd1 deleted file mode 100644 index 9d1b649..0000000 --- a/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchManager.psd1 +++ /dev/null @@ -1,50 +0,0 @@ -########################################################################### -# # -# Module Name: NetworkSwitchManager.psd1 # -# # -# Description: Network switch manager module manifest file # -# # -# Copyright (c) Microsoft Corporation. All rights reserved. # -# # -########################################################################### -@{ - GUID = '53B60D16-69AD-4453-BF41-83EFA5AC35B8' - Author = "Microsoft Corporation" - CompanyName = "Microsoft" - Copyright = "© Microsoft. All rights reserved." - HelpInfoUri = "http://go.microsoft.com/fwlink/?linkid=216365" - ModuleVersion = '1.0.0.0' - NestedModules=@("NetworkSwitchConfiguration.psm1", "NetworkSwitchEthernetPort.psm1", "NetworkSwitchFeature.psm1", "NetworkSwitchGlobalSettingData.psm1", "NetworkSwitchVlan.psm1") - AliasesToExport = @() - - FunctionsToExport = @( - 'Disable-NetworkSwitchEthernetPort', - 'Enable-NetworkSwitchEthernetPort', - 'Get-NetworkSwitchEthernetPort', - 'Remove-NetworkSwitchEthernetPortIPAddress', - 'Set-NetworkSwitchEthernetPortIPAddress', - 'Set-NetworkSwitchPortMode', - 'Set-NetworkSwitchPortProperty', - - 'Disable-NetworkSwitchFeature', - 'Enable-NetworkSwitchFeature', - 'Get-NetworkSwitchFeature', - - 'Disable-NetworkSwitchVlan', - 'Enable-NetworkSwitchVlan', - 'Get-NetworkSwitchVlan', - 'New-NetworkSwitchVlan', - 'Remove-NetworkSwitchVlan', - 'Set-NetworkSwitchVlanProperty', - - 'Get-NetworkSwitchGlobalData', - - 'Save-NetworkSwitchConfiguration', - 'Restore-NetworkSwitchConfiguration' - ) - - PowerShellVersion = '5.1' - TypesToProcess = @('NetworkSwitchManager.types.ps1xml') - FormatsToProcess = @('NetworkSwitchManager.format.ps1xml') - CompatiblePSEditions = @('Desktop','Core') -} diff --git a/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchManager.types.ps1xml b/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchManager.types.ps1xml deleted file mode 100644 index da2686c..0000000 --- a/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchManager.types.ps1xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_GlobalEthernetSwitchSettingData - - - Name - ElementName - - - - - Microsoft.Management.Infrastructure.CimInstance#CIM_NetworkVLAN - - - Name - ElementName - - - - - Microsoft.Management.Infrastructure.CimInstance#CIM_IPProtocolEndpoint - - - IPAddress - IPv4Address - - - SubnetAddress - SubnetMask - - - - diff --git a/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchVlan.psm1 b/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchVlan.psm1 deleted file mode 100644 index fd67c04..0000000 --- a/newton-cn/bin/Modules/NetworkSwitchManager/NetworkSwitchVlan.psm1 +++ /dev/null @@ -1,430 +0,0 @@ -########################################################################### -# # -# Module Name: NetworkSwitchVlan.psm1 # -# # -# Description: Cmdlets for managing VLANs # -# # -# Copyright (c) Microsoft Corporation. All rights reserved. # -# # -########################################################################### - -import-module "$PSScriptRoot\CmdletHelpers.psm1" -Force -DisableNameChecking - -function Disable-NetworkSwitchVlan() { -[CmdletBinding(SupportsShouldProcess=$true)] -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - - [Parameter(Mandatory=$true, ParameterSetName="InstanceIdSet")] - [string] $InstanceId, - - [Parameter(Mandatory=$true, ParameterSetName="NameSet")] - [string] $Name, - - [Parameter(Mandatory=$true, ParameterSetName="VlanIdSet")] - [int] $VlanID - ) - - Begin { - $cmdletName = "Disable-NetworkSwitchVlan" - $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession - } - - Process { - if (-not $nsNamespace) { return } - - $vlans = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` - -ClassName CIM_NetworkVLAN ` - -CimSession $CimSession ` - -CmdletName $cmdletName - - if ($InstanceId) { - $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` - -Property InstanceId ` - -Value $InstanceId ` - -AssertNonEmpty ` - -CmdletName $cmdletName - } - elseif ($VlanID) { - $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` - -Property VlanId ` - -Value $VlanId ` - -AssertNonEmpty ` - -CmdletName $cmdletName - } - elseif ($Name) { - $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` - -Property ElementName ` - -Value $Name ` - -UseLike ` - -CmdletName $cmdletName - } - - $switchService = Get-NetworkSwitchService -Namespace $nsNamespace ` - -CimSession $CimSession ` - -CmdletName $cmdletName - foreach ($vlan in $vlans) { - if ($(CmdletShouldProcess $PSCmdlet $vlan)) { - Invoke-NetworkSwitchMethod -Instance $switchService[0] ` - -CimSession $CimSession ` - -MethodName "DisableVLAN" ` - -Arguments @{VLAN = [ciminstance[]]@($vlan)} ` - -CmdletName $cmdletName - } - } - } - - End {} -} - -function Enable-NetworkSwitchVlan() { -[CmdletBinding(SupportsShouldProcess=$true)] -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - - [Parameter(Mandatory=$true, ParameterSetName="InstanceIdSet")] - [string] $InstanceId, - - [Parameter(Mandatory=$true, ParameterSetName="NameSet")] - [string] $Name, - - [Parameter(Mandatory=$true, ParameterSetName="VlanIdSet")] - [int] $VlanID - ) - - Begin { - $cmdletName = "Enable-NetworkSwitchVlan" - $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession - } - - Process { - if (-not $nsNamespace) { return } - - $vlans = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` - -ClassName CIM_NetworkVLAN ` - -CimSession $CimSession ` - -CmdletName $cmdletName - - if ($InstanceId) { - $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` - -Property InstanceId ` - -Value $InstanceId ` - -AssertNonEmpty ` - -CmdletName $cmdletName - } - elseif ($VlanID) { - $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` - -Property VlanId ` - -Value $VlanId ` - -AssertNonEmpty ` - -CmdletName $cmdletName - } - elseif ($Name) { - $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` - -Property ElementName ` - -Value $Name ` - -UseLike ` - -CmdletName $cmdletName - } - - $switchService = Get-NetworkSwitchService -Namespace $nsNamespace ` - -CimSession $CimSession ` - -CmdletName $cmdletName - foreach ($vlan in $vlans) { - if ($(CmdletShouldProcess $PSCmdlet $vlan)) { - Invoke-NetworkSwitchMethod -Instance $switchService[0] ` - -CimSession $CimSession ` - -MethodName "EnableVLAN" ` - -Arguments @{VLAN = [ciminstance[]]@($vlan)} ` - -CmdletName $cmdletName - } - } - } - - End {} -} - -function Get-NetworkSwitchVlan() { -[CmdletBinding(DefaultParameterSetName="NameSet")] -[OutputType([Microsoft.Management.Infrastructure.CimInstance])] -[OutputType("Microsoft.Management.Infrastructure.CimInstance#CIM_NetworkVLAN")] -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - - [Parameter(Mandatory=$false, ParameterSetName="NameSet")] - [string] $Name, - - [Parameter(Mandatory=$true, ParameterSetName="VlanIdSet")] - [int] $VlanId, - - [Parameter(Mandatory=$true, ParameterSetName="InstanceIdSet")] - [string] $InstanceId, - - [Parameter(Mandatory=$true, ParameterSetName="CaptionSet")] - [string] $Caption, - - [Parameter(Mandatory=$true, ParameterSetName="DescriptionSet")] - [string] $Description - ) - - Begin { - $cmdletName = "Get-NetworkSwitchVlan" - $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession - } - - Process { - if (-not $nsNamespace) { return } - - $vlanList = Get-NetworkSwitchInstanceNoFilter -ClassName CIM_NetworkVlan ` - -Namespace $nsNamespace ` - -CimSession $CimSession ` - -CmdletName $cmdletName - - if ($Name) { - $vlanList = Filter-NetworkSwitchInstance -Instances $vlanList ` - -Property ElementName ` - -Value $Name ` - -UseLike ` - -CmdletName $cmdletName - } - elseif ($Caption) { - $vlanList = Filter-NetworkSwitchInstance -Instances $vlanList ` - -Property Caption ` - -Value $Caption ` - -UseLike ` - -CmdletName $cmdletName - } - elseif ($Description) { - $vlanList = Filter-NetworkSwitchInstance -Instances $vlanList ` - -Property Description ` - -Value $Description ` - -UseLike ` - -CmdletName $cmdletName - } - elseif ($VlanId) { - $vlanList = Filter-NetworkSwitchInstance -Instances $vlanList ` - -Property VlanId ` - -Value $VlanId ` - -AssertNonEmpty ` - -CmdletName $cmdletName - } - elseif ($InstanceId) { - $vlanList = Filter-NetworkSwitchInstance -Instances $vlanList ` - -Property InstanceId ` - -Value $InstanceId ` - -AssertNonEmpty ` - -CmdletName $cmdletName - } - - $vlanList - } - - End {} -} - -function New-NetworkSwitchVlan() { -[CmdletBinding()] -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - - [Parameter(Mandatory=$false)] - [string] $Caption, - - [Parameter(Mandatory=$false)] - [string] $Description, - - [Parameter(Mandatory=$true)] - [int] $VlanID, - - [Parameter(Mandatory=$true)] - [string] $Name - ) - - Begin { - $cmdletName = "New-NetworkSwitchVlan" - $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession - } - - Process { - if (-not $nsNamespace) { return } - - $cs = Get-NetworkSwitchInstanceNoFilter -CimSession $CimSession ` - -ClassName CIM_ComputerSystem ` - -Namespace $nsNamespace ` - -CmdletName $cmdletName - - $switchService = Get-NetworkSwitchService -Namespace $nsNamespace ` - -ClassName MSFT_SwitchService ` - -CimSession $CimSession ` - -CmdletName $cmdletName - - $vlanCls = Get-NetworkSwitchClass -Namespace $nsNamespace ` - -ClassName CIM_NetworkVLAN ` - -CimSession $CimSession ` - -CmdletName $cmdletName - - $vlan = New-LocalCimInstance -CimClass $vlanCls ` - -Property @{VLANId = $VlanID; ` - ElementName = $Name; ` - Caption = [string]$Caption; ` - Description = [string]$Description} - - Invoke-NetworkSwitchMethod -Instance $switchService[0] ` - -CimSession $CimSession ` - -MethodName "AddVLAN" ` - -Arguments @{ TargetedSwitch = $cs[0]; ` - NetworkVLAN = [ciminstance[]]@($vlan) } ` - -CmdletName $cmdletName - } - - End {} -} - -function Remove-NetworkSwitchVlan() { -[CmdletBinding(SupportsShouldProcess=$true)] -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - - [Parameter(Mandatory=$false, ParameterSetName="InstanceIdSet")] - [string] $InstanceId, - - [Parameter(Mandatory=$false, ParameterSetName="NameSet")] - [string] $Name, - - [Parameter(Mandatory=$false, ParameterSetName="VlanIdSet")] - [int] $VlanId, - - [Parameter(Mandatory=$true, - ParameterSetName="InputObjectSet", - ValueFromPipeline=$true)] - [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject - ) - - Begin { - $cmdletName = "Remove-NetworkSwitchVlan" - $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession - } - - Process { - if (-not $nsNamespace) { return } - - if ($InputObject) { - if ($input) { - $vlans = $input[0] - } - else { - $vlans = $InputObject - } - } - else { - $vlans = Get-NetworkSwitchInstanceNoFilter -NameSpace $nsNamespace ` - -ClassName CIM_NetworkVlan ` - -CimSession $CimSession ` - -CmdletName $cmdletName - if ($Name) { - $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` - -Property ElementName ` - -Value $Name ` - -UseLike ` - -CmdletName $cmdletName - } - elseif ($VlanId) { - $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` - -Property VlanId ` - -Value $VlanId ` - -AssertNonEmpty ` - -CmdletName $cmdletName - } - elseif ($InstanceId) { - $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` - -Property InstanceId ` - -Value $InstanceId ` - -AssertNonEmpty ` - -CmdletName $cmdletName - } - } - - $switchService = Get-NetworkSwitchService -Namespace $nsNamespace ` - -ClassName MSFT_SwitchService ` - -CimSession $CimSession ` - -CmdletName $cmdletName - foreach ($vlan in $vlans) { - if ($(CmdletShouldProcess $PSCmdlet $vlan)) { - Invoke-NetworkSwitchMethod -Instance $switchService[0] ` - -CimSession $CimSession ` - -MethodName "RemoveVLAN" ` - -Arguments @{VLAN = [ciminstance[]]@($vlan)} ` - -CmdletName $cmdletName - } - } - } - - End {} -} - -function Set-NetworkSwitchVlanProperty() { -[CmdletBinding(SupportsShouldProcess=$true)] -param( - [Parameter(Mandatory=$true)] - [Microsoft.Management.Infrastructure.CimSession] $CimSession, - - [Parameter(Mandatory=$false)] - [System.Collections.HashTable] $Property, - - [Parameter(Mandatory=$true, ParameterSetName="VlanIdSet")] - [int[]] $VlanId, - - [Parameter(Mandatory=$true, - ParameterSetName="InputObjectSet", - ValueFromPipeline=$true)] - [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject - ) - - Begin { - $cmdletName = "Set-NetworkSwitchVlanProperty" - $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession - } - - Process { - if (-not $nsNamespace) { return } - - if ($InputObject) { - if ($input) { - $vlans = $input[0] - } - else { - $vlans = $InputObject - } - } - else { - $vlans = Get-NetworkSwitchInstanceNoFilter -NameSpace $nsNamespace ` - -ClassName CIM_NetworkVlan ` - -CimSession $CimSession ` - -CmdletName $cmdletName - if ($VlanId) { - $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` - -Property VlanId ` - -Value $VlanId ` - -UseContains ` - -AssertNonEmpty ` - -CmdletName $cmdletName - } - } - - foreach ($vlan in $vlans) { - if ($(CmdletShouldProcess $PSCmdlet $vlan)) { - Set-NetworkSwitchInstance -InputObject $vlan ` - -Property $Property ` - -CimSession $CimSession ` - -CmdletName $cmdletName - } - } - } - - End {} -} diff --git a/newton-cn/bin/Modules/NetworkSwitchManager/ko-KR/NetworkSwitchManager.Resource.psd1 b/newton-cn/bin/Modules/NetworkSwitchManager/ko-KR/NetworkSwitchManager.Resource.psd1 deleted file mode 100644 index 8d02f46..0000000 Binary files a/newton-cn/bin/Modules/NetworkSwitchManager/ko-KR/NetworkSwitchManager.Resource.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_Net6to4Configuration.cdxml b/newton-cn/bin/Modules/NetworkTransition/MSFT_Net6to4Configuration.cdxml deleted file mode 100644 index 13bfec9..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_Net6to4Configuration.cdxml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - 1.0 - Net6to4Configuration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_Net6to4Configuration.format.ps1xml b/newton-cn/bin/Modules/NetworkTransition/MSFT_Net6to4Configuration.format.ps1xml deleted file mode 100644 index 27443ab..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_Net6to4Configuration.format.ps1xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - MSFT_Net6to4Configuration - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_Net6to4Configuration - Microsoft.Management.Infrastructure.CimInstance#MSFT_Net6to4Configuration - - - - - - - Description - - - State - - - AutoSharing - - - RelayName - - - RelayState - - - ResolutionInterval - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_Net6to4Configuration.types.ps1xml b/newton-cn/bin/Modules/NetworkTransition/MSFT_Net6to4Configuration.types.ps1xml deleted file mode 100644 index 26d7736..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_Net6to4Configuration.types.ps1xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_Net6to4Configuration - - - State - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Net6to4Configuration.State]($this.PSBase.CimInstanceProperties['State'].Value) - - - $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ - - - - AutoSharing - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Net6to4Configuration.State]($this.PSBase.CimInstanceProperties['AutoSharing'].Value) - - - $this.PSBase.CimInstanceProperties['AutoSharing'].Value = [System.UInt32]$_ - - - - RelayState - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Net6to4Configuration.State]($this.PSBase.CimInstanceProperties['RelayState'].Value) - - - $this.PSBase.CimInstanceProperties['RelayState'].Value = [System.UInt32]$_ - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_Net6to4Configuration - - - State - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Net6to4Configuration.State]($this.PSBase.CimInstanceProperties['State'].Value) - - - $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ - - - - AutoSharing - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Net6to4Configuration.State]($this.PSBase.CimInstanceProperties['AutoSharing'].Value) - - - $this.PSBase.CimInstanceProperties['AutoSharing'].Value = [System.UInt32]$_ - - - - RelayState - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Net6to4Configuration.State]($this.PSBase.CimInstanceProperties['RelayState'].Value) - - - $this.PSBase.CimInstanceProperties['RelayState'].Value = [System.UInt32]$_ - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetDnsTransitionConfiguration.cdxml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetDnsTransitionConfiguration.cdxml deleted file mode 100644 index 0b25047..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetDnsTransitionConfiguration.cdxml +++ /dev/null @@ -1,145 +0,0 @@ - - - - 1.0 - NetDnsTransitionConfiguration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetDnsTransitionConfiguration.format.ps1xml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetDnsTransitionConfiguration.format.ps1xml deleted file mode 100644 index 3acfe7b..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetDnsTransitionConfiguration.format.ps1xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - MSFT_NetDnsTransitionConfiguration - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetDnsTransitionConfiguration - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetDnsTransitionConfiguration - - - - - - - State - - - AcceptInterface - - - SendInterface - - - OnlySendAQuery - - - Latency - - - - AlwaysSynthesize - - - ExclusionList - - - PrefixMapping - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetDnsTransitionConfiguration.types.ps1xml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetDnsTransitionConfiguration.types.ps1xml deleted file mode 100644 index 3bb4707..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetDnsTransitionConfiguration.types.ps1xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetDnsTransitionConfiguration - - - State - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetDnsTransitionConfiguration.State]($this.PSBase.CimInstanceProperties['State'].Value) - - - $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetDnsTransitionConfiguration - - - State - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetDnsTransitionConfiguration.State]($this.PSBase.CimInstanceProperties['State'].Value) - - - $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetDnsTransitionMonitoring.cdxml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetDnsTransitionMonitoring.cdxml deleted file mode 100644 index 3ccd6fd..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetDnsTransitionMonitoring.cdxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - 1.0 - NetDnsTransitionMonitoring - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetDnsTransitionMonitoring.format.ps1xml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetDnsTransitionMonitoring.format.ps1xml deleted file mode 100644 index 9da684e..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetDnsTransitionMonitoring.format.ps1xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - MSFT_NetDnsTransitionMonitoring - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetDnsTransitionMonitoring - - - - - - - NumAAAAQueriesSucceeded - - - NumAAAAQueriesFailed - - - NumAAAAQueriesSynthesized - - - NumAAAAQueriesIn6ArpaPtr - - - NumOtherQueriesSucceeded - - - NumOtherQueriesFailed - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetISATAPConfiguration.cdxml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetISATAPConfiguration.cdxml deleted file mode 100644 index 1980c83..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetISATAPConfiguration.cdxml +++ /dev/null @@ -1,126 +0,0 @@ - - - - - 1.0 - NetIsatapConfiguration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetISATAPConfiguration.format.ps1xml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetISATAPConfiguration.format.ps1xml deleted file mode 100644 index 0c0262d..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetISATAPConfiguration.format.ps1xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - MSFT_NetISATAPConfiguration - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetISATAPConfiguration - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetISATAPConfiguration - - - - - - - Description - - - State - - - Router - - - ResolutionState - - - ResolutionInterval - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetISATAPConfiguration.types.ps1xml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetISATAPConfiguration.types.ps1xml deleted file mode 100644 index e9e6f72..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetISATAPConfiguration.types.ps1xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetISATAPConfiguration - - - State - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetISATAPConfiguration.State]($this.PSBase.CimInstanceProperties['State'].Value) - - - $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ - - - - ResolutionState - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetISATAPConfiguration.State]($this.PSBase.CimInstanceProperties['ResolutionState'].Value) - - - $this.PSBase.CimInstanceProperties['ResolutionState'].Value = [System.UInt32]$_ - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetISATAPConfiguration - - - State - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetISATAPConfiguration.State]($this.PSBase.CimInstanceProperties['State'].Value) - - - $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ - - - - ResolutionState - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetISATAPConfiguration.State]($this.PSBase.CimInstanceProperties['ResolutionState'].Value) - - - $this.PSBase.CimInstanceProperties['ResolutionState'].Value = [System.UInt32]$_ - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetIpHTTPsConfiguration.cdxml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetIpHTTPsConfiguration.cdxml deleted file mode 100644 index a77d2c2..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetIpHTTPsConfiguration.cdxml +++ /dev/null @@ -1,321 +0,0 @@ - - - - 1.0 - NetIPHttpsConfiguration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetIpHTTPsConfiguration.format.ps1xml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetIpHTTPsConfiguration.format.ps1xml deleted file mode 100644 index df19335..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetIpHTTPsConfiguration.format.ps1xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - MSFT_NetIPHttpsConfiguration - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetIPHttpsConfiguration - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPHttpsConfiguration - - - - - - - PolicyStore - - - ConfigurationType - - - Profile - - - ProfileActivated - - - State - - - ServerURL - - - Type - - - AuthMode - - - StrongCRLRequired - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetIpHTTPsConfiguration.types.ps1xml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetIpHTTPsConfiguration.types.ps1xml deleted file mode 100644 index 3fdecb1..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetIpHTTPsConfiguration.types.ps1xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetIPHttpsConfiguration - - - Type - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPHttpsConfiguration.Type]($this.PSBase.CimInstanceProperties['Type'].Value) - - - $this.PSBase.CimInstanceProperties['Type'].Value = [System.UInt32]$_ - - - - State - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPHttpsConfiguration.State]($this.PSBase.CimInstanceProperties['State'].Value) - - - $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ - - - - AuthMode - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPHttpsConfiguration.AuthMode]($this.PSBase.CimInstanceProperties['AuthMode'].Value) - - - $this.PSBase.CimInstanceProperties['AuthMode'].Value = [System.UInt32]$_ - - - - ConfigurationType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPHttpsConfiguration.ConfigurationType]($this.PSBase.CimInstanceProperties['ConfigurationType'].Value) - - - $this.PSBase.CimInstanceProperties['ConfigurationType'].Value = [System.UInt32]$_ - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPHttpsConfiguration - - - Type - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPHttpsConfiguration.Type]($this.PSBase.CimInstanceProperties['Type'].Value) - - - $this.PSBase.CimInstanceProperties['Type'].Value = [System.UInt32]$_ - - - - State - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPHttpsConfiguration.State]($this.PSBase.CimInstanceProperties['State'].Value) - - - $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ - - - - AuthMode - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPHttpsConfiguration.AuthMode]($this.PSBase.CimInstanceProperties['AuthMode'].Value) - - - $this.PSBase.CimInstanceProperties['AuthMode'].Value = [System.UInt32]$_ - - - - ConfigurationType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPHttpsConfiguration.ConfigurationType]($this.PSBase.CimInstanceProperties['ConfigurationType'].Value) - - - $this.PSBase.CimInstanceProperties['ConfigurationType'].Value = [System.UInt32]$_ - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetIpHTTPsState.cdxml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetIpHTTPsState.cdxml deleted file mode 100644 index 9c469ef..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetIpHTTPsState.cdxml +++ /dev/null @@ -1,10 +0,0 @@ - - - - 1.0 - NetIPHttpsState - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetIpHTTPsState.format.ps1xml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetIpHTTPsState.format.ps1xml deleted file mode 100644 index 02d64ff..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetIpHTTPsState.format.ps1xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - MSFT_NetIPHttpsState - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetIPHttpsState - - - - - - - LastErrorCode - 0x{0:x} - - - InterfaceStatus - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetNatTransitionConfiguration.cdxml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetNatTransitionConfiguration.cdxml deleted file mode 100644 index e64f942..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetNatTransitionConfiguration.cdxml +++ /dev/null @@ -1,165 +0,0 @@ - - - - 1.0 - NetNatTransitionConfiguration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetNatTransitionConfiguration.format.ps1xml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetNatTransitionConfiguration.format.ps1xml deleted file mode 100644 index b4ba685..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetNatTransitionConfiguration.format.ps1xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - MSFT_NetNatTransitionConfiguration - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetNatTransitionConfiguration - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetNatTransitionConfiguration - - - - - - - InstanceName - - - PolicyStore - - - State - - - TcpMappingTimeout - - - InboundInterface - - - OutboundInterface - - - PrefixMapping - - - IPv4AddressPortPool - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetNatTransitionConfiguration.types.ps1xml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetNatTransitionConfiguration.types.ps1xml deleted file mode 100644 index 5166a4f..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetNatTransitionConfiguration.types.ps1xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetNatTransitionConfiguration - - - State - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNatTransitionConfiguration.State]($this.PSBase.CimInstanceProperties['State'].Value) - - - $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ - - - - PolicyStore - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNatTransitionConfiguration.PolicyStore]($this.PSBase.CimInstanceProperties['PolicyStore'].Value) - - - $this.PSBase.CimInstanceProperties['PolicyStore'].Value = [System.UInt32]$_ - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetNatTransitionConfiguration - - - State - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNatTransitionConfiguration.State]($this.PSBase.CimInstanceProperties['State'].Value) - - - $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ - - - - PolicyStore - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNatTransitionConfiguration.PolicyStore]($this.PSBase.CimInstanceProperties['PolicyStore'].Value) - - - $this.PSBase.CimInstanceProperties['PolicyStore'].Value = [System.UInt32]$_ - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetNatTransitionMonitoring.cdxml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetNatTransitionMonitoring.cdxml deleted file mode 100644 index 5f916f5..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetNatTransitionMonitoring.cdxml +++ /dev/null @@ -1,23 +0,0 @@ - - - - 1.0 - NetNatTransitionMonitoring - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetNatTransitionMonitoring.format.ps1xml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetNatTransitionMonitoring.format.ps1xml deleted file mode 100644 index 45ac971..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetNatTransitionMonitoring.format.ps1xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - MSFT_NetNatTransitionMonitoring - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetNatTransitionMonitoring - - - - - - 8 - - - - 25 - - - - 25 - - - - - - - - - - TransportProtocol - - - InboundAddress - - - OutboundAddress - - - NatOutboundAddress - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetTeredoConfiguration.cdxml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetTeredoConfiguration.cdxml deleted file mode 100644 index be6e084..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetTeredoConfiguration.cdxml +++ /dev/null @@ -1,166 +0,0 @@ - - - - - 1.0 - NetTeredoConfiguration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetTeredoConfiguration.format.ps1xml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetTeredoConfiguration.format.ps1xml deleted file mode 100644 index 83d6cb7..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetTeredoConfiguration.format.ps1xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - MSFT_NetTeredoConfiguration - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetTeredoConfiguration - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetTeredoConfiguration - - - - - - - Description - - - Type - - - ServerName - - - RefreshInterval - - - - ClientPort - - - ServerVirtualIP - - - DefaultQualified - - - ServerShunt - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetTeredoConfiguration.types.ps1xml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetTeredoConfiguration.types.ps1xml deleted file mode 100644 index 89d5bc3..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetTeredoConfiguration.types.ps1xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetTeredoConfiguration - - - Type - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTeredoConfiguration.Type]($this.PSBase.CimInstanceProperties['Type'].Value) - - - $this.PSBase.CimInstanceProperties['Type'].Value = [System.UInt32]$_ - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetTeredoConfiguration - - - Type - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTeredoConfiguration.Type]($this.PSBase.CimInstanceProperties['Type'].Value) - - - $this.PSBase.CimInstanceProperties['Type'].Value = [System.UInt32]$_ - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetTeredoState.cdxml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetTeredoState.cdxml deleted file mode 100644 index bf9550b..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetTeredoState.cdxml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - 1.0 - NetTeredoState - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetTeredoState.format.ps1xml b/newton-cn/bin/Modules/NetworkTransition/MSFT_NetTeredoState.format.ps1xml deleted file mode 100644 index 03a7da9..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/MSFT_NetTeredoState.format.ps1xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - MSFT_NetTeredoState - - Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetTeredoState - - - - - - - Error - - - State - - - - - - - - - diff --git a/newton-cn/bin/Modules/NetworkTransition/NetworkTransition.psd1 b/newton-cn/bin/Modules/NetworkTransition/NetworkTransition.psd1 deleted file mode 100644 index 8fb8477..0000000 --- a/newton-cn/bin/Modules/NetworkTransition/NetworkTransition.psd1 +++ /dev/null @@ -1,17 +0,0 @@ - -@{ - ModuleVersion = '1.0.0.0' - NestedModules = @("MSFT_Net6to4Configuration.cdxml", "MSFT_NetDnsTransitionConfiguration.cdxml", "MSFT_NetDnsTransitionMonitoring.cdxml", "MSFT_NetIpHTTPsConfiguration.cdxml", "MSFT_NetIpHTTPsState.cdxml", "MSFT_NetISATAPConfiguration.cdxml", "MSFT_NetNatTransitionConfiguration.cdxml", "MSFT_NetNatTransitionMonitoring.cdxml", "MSFT_NetTeredoConfiguration.cdxml", "MSFT_NetTeredoState.cdxml") - FormatsToProcess = @("MSFT_Net6to4Configuration.format.ps1xml", "MSFT_NetDnsTransitionConfiguration.format.ps1xml", "MSFT_NetDnsTransitionMonitoring.format.ps1xml", "MSFT_NetIpHTTPsConfiguration.format.ps1xml", "MSFT_NetIpHTTPsState.format.ps1xml", "MSFT_NetISATAPConfiguration.format.ps1xml", "MSFT_NetNatTransitionConfiguration.format.ps1xml", "MSFT_NetNatTransitionMonitoring.format.ps1xml", "MSFT_NetTeredoConfiguration.format.ps1xml", "MSFT_NetTeredoState.format.ps1xml") - TypesToProcess = @("MSFT_Net6to4Configuration.types.ps1xml", "MSFT_NetDnsTransitionConfiguration.types.ps1xml", "MSFT_NetIpHTTPsConfiguration.types.ps1xml", "MSFT_NetISATAPConfiguration.types.ps1xml", "MSFT_NetNatTransitionConfiguration.types.ps1xml", "MSFT_NetTeredoConfiguration.types.ps1xml") - HelpInfoUri = "http://go.microsoft.com/fwlink/?LinkId=285559" - GUID = '{EFF9CCF9-53ED-423d-B0DA-23E6772AACAA}' - Author = 'Microsoft Corporation' - CompanyName = 'Microsoft Corporation' - PowerShellVersion = '5.1' - Copyright = '© Microsoft Corporation. All rights reserved.' - FunctionsToExport = @("Add-NetIPHttpsCertBinding", "Disable-NetDnsTransitionConfiguration", "Disable-NetIPHttpsProfile", "Disable-NetNatTransitionConfiguration", "Enable-NetDnsTransitionConfiguration", "Enable-NetIPHttpsProfile", "Enable-NetNatTransitionConfiguration", "Get-Net6to4Configuration", "Get-NetDnsTransitionConfiguration", "Get-NetDnsTransitionMonitoring", "Get-NetIPHttpsConfiguration", "Get-NetIPHttpsState", "Get-NetIsatapConfiguration", "Get-NetNatTransitionConfiguration", "Get-NetNatTransitionMonitoring", "Get-NetTeredoConfiguration", "Get-NetTeredoState", "New-NetIPHttpsConfiguration", "New-NetNatTransitionConfiguration", "Remove-NetIPHttpsCertBinding", "Remove-NetIPHttpsConfiguration", "Remove-NetNatTransitionConfiguration", "Rename-NetIPHttpsConfiguration", "Reset-Net6to4Configuration", "Reset-NetDnsTransitionConfiguration", "Reset-NetIPHttpsConfiguration", "Reset-NetIsatapConfiguration", "Reset-NetTeredoConfiguration", "Set-Net6to4Configuration", "Set-NetDnsTransitionConfiguration", "Set-NetIPHttpsConfiguration", "Set-NetIsatapConfiguration", "Set-NetNatTransitionConfiguration", "Set-NetTeredoConfiguration") - CmdletsToExport = @() - AliasesToExport = @() - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/PKI/pki.psd1 b/newton-cn/bin/Modules/PKI/pki.psd1 deleted file mode 100644 index 6b2d4a2..0000000 Binary files a/newton-cn/bin/Modules/PKI/pki.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PKI/pki.types.ps1xml b/newton-cn/bin/Modules/PKI/pki.types.ps1xml deleted file mode 100644 index bf543e8..0000000 --- a/newton-cn/bin/Modules/PKI/pki.types.ps1xml +++ /dev/null @@ -1,186 +0,0 @@ - - - System.Security.Cryptography.X509Certificates.X509Certificate2 - - - - EnrollmentPolicyEndPoint - - new-object Microsoft.CertificateServices.Commands.EnrollmentEndPointProperty -argumentlist $this,$true - - - $e = $this.EnrollmentPolicyEndPoint - $e.CopyUrlAndAuthType($args[0]) - - - - EnrollmentServerEndPoint - - new-object Microsoft.CertificateServices.Commands.EnrollmentEndPointProperty -argumentlist $this,$false - - - $e = $this.EnrollmentServerEndPoint - $e.CopyUrlAndAuthType($args[0]) - - - - PolicyId - - [Microsoft.CertificateServices.Commands.PolicyIdProperty]::ReadPolicyId($this) - - - $policyId = $args[0] - [Microsoft.CertificateServices.Commands.PolicyIdProperty]::WritePolicyId($this,$policyId) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCClassResources/WindowsPackageCab/WindowsPackageCab.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCClassResources/WindowsPackageCab/WindowsPackageCab.psd1 deleted file mode 100644 index 05c8a5c..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCClassResources/WindowsPackageCab/WindowsPackageCab.psd1 +++ /dev/null @@ -1,33 +0,0 @@ -@{ - -# Script module or binary module file associated with this manifest. -RootModule = 'WindowsPackageCab.psm1' - -DscResourcesToExport = 'WindowsPackageCab' - -# Version number of this module. -ModuleVersion = '1.0' - -# ID used to uniquely identify this module -GUID = 'fe7be92e-9fad-47f7-84f7-aa6093bf4c0e' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) 2016 Microsoft. All rights reserved.' - -# Description of the functionality provided by this module -# Description = '' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '5.0' - -# Name of the Windows PowerShell host required by this module -# PowerShellHostName = '' - -# FunctionsToExport = '*' -} \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCClassResources/WindowsPackageCab/WindowsPackageCab.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCClassResources/WindowsPackageCab/WindowsPackageCab.psm1 deleted file mode 100644 index 18d8d17..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCClassResources/WindowsPackageCab/WindowsPackageCab.psm1 +++ /dev/null @@ -1,1109 +0,0 @@ -# -# Windows Cab Package Provider - Microsoft 2016 -# This resource manages the packages for a live image. -# - -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -SourcePathDoesNotExist=Source does not exist: {0} -ConfigurationStarted=The configuration of WindowsPackageCab resource is starting -ConfigurationFinished=The configuration of WindowsPackageCab resource has completed -FailedToAddPackage=Failed to add package from {0} -FailedToRemovePackage=Failed to remove package {0} -SourcePathInvalid=Source path is null or empty -'@ -} - -Import-LocalizedData LocalizedData -FileName WindowsPackageCab.Strings.psd1 - -[DscResource()] -class WindowsPackageCab { - - # Property: Holds the product name of the package. - [DscProperty(Key)] - [String] $Name; - - # Property: Makes sure a package is installed/not installed on the image. - [DscProperty(Mandatory)] - [ValidateSet("Absent","Present")] - [String] $Ensure; - - # Property: Points to the location of a .cab file. - [DscProperty(Mandatory)] - [String] $SourcePath; - - # Property: Points the desired location for a log file - [DscProperty()] - [String] $LogPath; - - WindowsPackageCab() - { - Import-DscNativeDISMMethods - } - - [void] Set() - { - Write-Verbose $script:LocalizedData.ConfigurationStarted - - if ([string]::IsNullOrEmpty($this.SourcePath)) - { - Throw-TerminatingError ($script:LocalizedData.SourcePathInvalid) - } - - $SourcePathExists = Test-Path -Path $this.SourcePath - if (-not $SourcePathExists) - { - Throw-TerminatingError ($script:LocalizedData.SourcePathDoesNotExist -f $this.SourcePath) - } - - if ($this.Ensure -match 'Present') - { - Add-CabPackage -PackagePath $this.SourcePath - } - else - { - Remove-CabPackage -PackagePath $this.SourcePath - } - - Write-Verbose $script:LocalizedData.ConfigurationFinished - } - - [bool] Test() - { - $details = Get-DISMDetailedInstalledPackageInfo -PackageName $this.Name - - $isPackagePresent = Test-PackagePresence -packageInfoDetails $details - - if ($this.Ensure -match 'Present') - { - return $isPackagePresent - } - else - { - return -not $isPackagePresent - } - } - - [WindowsPackageCab] Get() - { - $details = Get-DISMDetailedInstalledPackageInfo -PackageName $this.Name - - if ($details -eq $null) - { - $this.Ensure = 'Absent' - } - else - { - $this.Ensure = 'Present' - } - - $this.SourcePath = $null - $this.LogPath = $null - - return $this - } -} - -Function Trace-Message -{ - param - ( - [string] $Message - ) - - Write-Verbose $Message - - if ($this.LogPath) - { - New-Item -Path $this.LogPath -ErrorAction SilentlyContinue - Add-Content -Path $this.LogPath -Value $message - } -} - -Function Throw-TerminatingError -{ - param - ( - [string] $Message, - [System.Management.Automation.ErrorRecord] $ErrorRecord, - [string] $ExceptionType - ) - - $exception = new-object "System.InvalidOperationException" $Message,$ErrorRecord.Exception - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception,"MachineStateIncorrect","InvalidOperation",$null - throw $errorRecord -} - -Function Test-PackagePresence -{ - Param - ( - [Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.DismDetailedPackageInfo] $packageInfoDetails - ) - - if (-not $packageInfoDetails) - { - return $false; - } - - if ($packageInfoDetails.PackageState -eq [Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.DismPackageFeatureState]::DismStateInstalled -or - $packageInfoDetails.PackageState -eq [Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.DismPackageFeatureState]::DismStateInstallPending) - { - return $true; - } - - return $false; -} - -Function Get-DISMDetailedInstalledPackageInfo -{ - Param - ( - [string] $PackageName - ) - - try - { - $detailedPacketInfo = [Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.Dism]::new().GetDetailedPackageInfo($PackageName, $this.LogPath) - } - catch - { - $detailedPacketInfo = $null - } - - return $detailedPacketInfo -} - -Function Get-DISMDetailedCabFileInfo -{ - Param - ( - [string] $PackagePath - ) - - return [Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.Dism]::new().GetDetailedCabFileInfo($PackagePath, $this.LogPath) -} - -Function Add-CabPackage -{ - Param - ( - [string] $PackagePath - ) - - try - { - $dismStatus = [Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.Dism]::new().AddPackage($PackagePath, $this.LogPath) - if ($dismStatus -eq [Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.DismStatus]::DismStatusRebootRequired) - { - $global:DSCMachineStatus = 1; - } - Trace-Message ("-CabPackage successful. PackagePath = $PackagePath") - } - catch [System.Exception] - { - Throw-TerminatingError ($script:LocalizedData.FailedToAddPackage -f $this.SourcePath) - } - -} - -Function Remove-CabPackage -{ - Param - ( - [string] $PackagePath - ) - - try - { - $dismStatus = [Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.Dism]::new().RemovePackage($PackagePath, $this.LogPath) - if ($dismStatus -eq [Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.DismStatus]::DismStatusRebootRequired) - { - $global:DSCMachineStatus = 1; - } - Trace-Message ("Remove-CabPackage successful. PackagePath = $PackagePath") - } - catch [System.Exception] - { - Throw-TerminatingError ($script:LocalizedData.FailedToRemovePackage -f $this.SourcePath) - } -} - -Function Import-DscNativeDISMMethods -{ - if (-not ([System.Management.Automation.PSTypeName]'Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.Dism').Type) - { - $source = @" -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.InteropServices; - -#if CORECLR - using Environment = System.Management.Automation.Environment; -#else -using Environment = System.Environment; -#endif - -namespace Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab -{ - #region Native Handlers - - internal enum DismPackageIdentifier - { - DismPackageNone = 0, - DismPackageName = 1, - DismPackagePath = 2 - }; - - internal enum DismLogLevel - { - DismLogErrors = 0, - DismLogErrorsWarnings, - DismLogErrorsWarningsInfo - }; - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal class SystemTime - { - [MarshalAs(UnmanagedType.U2)] - public UInt16 wYear; - [MarshalAs(UnmanagedType.U2)] - public UInt16 wMonth; - [MarshalAs(UnmanagedType.U2)] - public UInt16 wDayOfWeek; - [MarshalAs(UnmanagedType.U2)] - public UInt16 wDay; - [MarshalAs(UnmanagedType.U2)] - public UInt16 wHour; - [MarshalAs(UnmanagedType.U2)] - public UInt16 wMinute; - [MarshalAs(UnmanagedType.U2)] - public UInt16 wSecond; - [MarshalAs(UnmanagedType.U2)] - public UInt16 wMillisecond; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal class DismPackage - { - [MarshalAs(UnmanagedType.LPWStr)] - internal string PackageName; - internal DismPackageFeatureState PackageState; - internal DismReleaseType ReleaseType; - internal SystemTime InstalledOn; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal class DismPackageDetails - { - [MarshalAs(UnmanagedType.LPWStr)] - public string PackageName; - public DismPackageFeatureState PackageState; - public DismReleaseType ReleaseType; - public SystemTime InstalledOn; - public bool Applicable; - [MarshalAs(UnmanagedType.LPWStr)] - public string Copyright; - [MarshalAs(UnmanagedType.LPWStr)] - public string Company; - public SystemTime CreationTime; - [MarshalAs(UnmanagedType.LPWStr)] - public string DisplayName; - [MarshalAs(UnmanagedType.LPWStr)] - public string Description; - [MarshalAs(UnmanagedType.LPWStr)] - public string InstallClient; - [MarshalAs(UnmanagedType.LPWStr)] - public string InstallPackageName; - public SystemTime LastUpdateTime; - [MarshalAs(UnmanagedType.LPWStr)] - public string ProductName; - [MarshalAs(UnmanagedType.LPWStr)] - public string ProductVersion; - public DismRestartType RestartRequired; - public DismFullyOfflineInstallable FullyOffline; - [MarshalAs(UnmanagedType.LPWStr)] - public string SupportInformation; - public IntPtr CustomPropertyBuffer; - [MarshalAs(UnmanagedType.U4)] - public UInt32 CustomPropertyCount; - public IntPtr FeatureBuffer; - [MarshalAs(UnmanagedType.U4)] - public UInt32 FeatureCount; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal class DismPackageCustomProperty - { - [MarshalAs(UnmanagedType.LPWStr)] - public string Name; - [MarshalAs(UnmanagedType.LPWStr)] - public string Value; - [MarshalAs(UnmanagedType.LPWStr)] - public string Path; - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public class DismPackageFeature - { - [MarshalAs(UnmanagedType.LPWStr)] - public string FeatureName; - public DismPackageFeatureState State; - } - - internal class DismNativeMethods - { - internal static string DismOnlineImage = "DISM_{53BFAE52-B167-4E2F-A258-0A37B57FF845}"; - - [DllImport("DismApi.dll")] - public static extern int DismCloseSession(uint session); - - [DllImport("DismApi.dll")] - public static extern int DismOpenSession( - [MarshalAs(UnmanagedType.LPWStr)] string imagePath, - [MarshalAs(UnmanagedType.LPWStr)] string windowsDirectory, - [MarshalAs(UnmanagedType.LPWStr)] string systemDrive, - out uint session - ); - - [DllImport("DismApi.dll")] - public static extern int DismInitialize( - DismLogLevel logLevel, - [MarshalAs(UnmanagedType.LPWStr)] string logFilePath, - [MarshalAs(UnmanagedType.LPWStr)] string scratchDirectory - ); - - [DllImport("DismApi.dll")] - public static extern int DismShutdown(); - - [DllImport("DismApi.dll")] - public static extern int DismDelete(IntPtr dismStructure); - - [DllImport("DismApi.dll")] - public static extern int DismGetPackages( - uint session, - out IntPtr packageBufPtr, - out uint packageCount - ); - - [DllImport("DismApi.dll")] - public static extern int DismGetPackageInfo( - uint session, - [MarshalAs(UnmanagedType.LPWStr)] string identifier, - DismPackageIdentifier packageIdentifier, - out IntPtr packageInfo - ); - - [DllImport("DismApi.dll")] - public static extern int DismAddPackage( - uint session, - [MarshalAs(UnmanagedType.LPWStr)] string packagePath, - [MarshalAs(UnmanagedType.Bool)] bool ignoreCheck, - [MarshalAs(UnmanagedType.Bool)] bool preventPending, - IntPtr cancelEvent, - DismProgressCallback progress, - IntPtr userData - ); - - [DllImport("DismApi.dll")] - public static extern int DismRemovePackage( - uint session, - [MarshalAs(UnmanagedType.LPWStr)] string identifier, - DismPackageIdentifier packageIdentifier, - IntPtr cancelEvent, - DismProgressCallback progress, - IntPtr userData - ); - - public delegate void DismProgressCallback( - uint current, - uint total, - IntPtr userData - ); - - internal static DateTime GetDateTimeFromSystemTime(SystemTime time) - { - try - { - return new DateTime(time.wYear, time.wMonth, time.wDay, - time.wHour, time.wMinute, time.wSecond, DateTimeKind.Local); - } - catch (ArgumentOutOfRangeException) - { - return new DateTime(0, DateTimeKind.Local); - } - } - } - - #endregion Native Handlers - - #region Helper Classes - - internal class DismHandler : IDisposable - { - #region Private Members - - private readonly string _logPath; - private uint _sessionToken; - private readonly DismLogLevel _logLevel; - private bool _sessionOpened; - - #endregion Private Members - - #region Constructors - internal DismHandler(string logPath, DismLogLevel logLevel) - { - _logPath = logPath; - _logLevel = logLevel; - } - - internal DismHandler() : this(string.Format("{0}\\dism.log", Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System))), DismLogLevel.DismLogErrorsWarnings) { } - - internal DismHandler(string logPath) - { - if (!String.IsNullOrEmpty(logPath)) - _logPath = logPath; - else - _logPath = string.Format("{0}\\dism.log", Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System))); - - _logLevel = DismLogLevel.DismLogErrorsWarnings; - } - #endregion Constructors - - #region Private Methods - private const int CbsInvalidPackage = unchecked((int)0x800f0805); - private const int FileNotFound = unchecked((int)0x80070002); - private const int CorruptedFile = unchecked((int)0x80070570); - private const int InvalidArgument = unchecked((int)0x80070057); - private const int SessionReloadRequired = 0x1; - private const int MachineRebootRequired = 0xbc2; - - private static void ValidateResult(int hr) - { - if (hr == 0) return; - if (IsSpecialErrorCode(hr)) return; - - switch (hr) - { - case CbsInvalidPackage: // 0x800f0805 - { - // 0x800f0805 -2146498555 : CBS_E_INVALID_PACKAGE the update package was not a valid CSI update - // when package is queried by name and is not installed - throw new DismInvalidPackageException(string.Format("Dism error code = {0}", hr)); - } - case FileNotFound: // 0x80070002 - { - // 0x80070002 : -2147024894 E_FILE_NOT_FOUND The system cannot find the file specified. - // when package is queried by path and the file does not exist - throw new FileNotFoundException(); - } - case CorruptedFile: // 0x80070570 - { - // 0x80070570 : 1392 ERROR_FILE_CORRUPT The file or directory is corrupted and unreadable - // when package file iscorrupted and unreadable - throw new DismInvalidPackageException(string.Format("Dism error code = {0}", hr)); - } - case InvalidArgument: // 0x80070057 - { - // 0x80070057 -2147024809 : E_INVALIDARG One or more arguments are invalid - // when package is queried by name and is not installed - throw new DismInvalidPackageException(string.Format("Dism error code = {0}", hr)); - } - default: - { - throw new DismException(string.Format("Dism error code = {0}", hr)); - } - } - } - - /// - /// Special Error codes are not failures. They are positive values and often indicate an expected followup operation. - /// - /// - /// - private static bool IsSpecialErrorCode(int errorCode) - { - switch (errorCode) - { - case SessionReloadRequired: - { - return true; - } - case MachineRebootRequired: - { - return true; - } - } - - return false; - } - - private static DismStatus GetStatusFromErrorCode(int errorCode) - { - switch (errorCode) - { - case SessionReloadRequired: - { - return DismStatus.DismStatusSuccess; - } - case MachineRebootRequired: - { - return DismStatus.DismStatusRebootRequired; - } - } - - return DismStatus.DismStatusSuccess; - } - - private void OpenSession() - { - if (_sessionOpened) return; - - var hr = DismNativeMethods.DismInitialize(_logLevel, _logPath, null); - ValidateResult(hr); - - hr = DismNativeMethods.DismOpenSession(DismNativeMethods.DismOnlineImage, null, null, out _sessionToken); - ValidateResult(hr); - - _sessionOpened = true; - } - - private void CloseSession() - { - if (!_sessionOpened) return; - - var hr = DismNativeMethods.DismCloseSession(_sessionToken); - ValidateResult(hr); - - DismNativeMethods.DismShutdown(); - - _sessionOpened = false; - } - - private void DeleteDismBuffer(IntPtr buffer) - { - if (buffer != IntPtr.Zero) DismNativeMethods.DismDelete(buffer); - buffer = IntPtr.Zero; - } - - #endregion Private Methods - - #region Dispose - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - protected void Dispose(bool isDisposing) - { - CloseSession(); - } - - #endregion Dispose - - #region Core Logic - - internal List GetInstalledPackages() - { - OpenSession(); - - List packages = new List(); - - IntPtr pPackagesBuffer; - uint numOfPackages = 0; - - var hr = DismNativeMethods.DismGetPackages(_sessionToken, out pPackagesBuffer, out numOfPackages); - ValidateResult(hr); - - try - { - var pBuffer = pPackagesBuffer; - var originalPackageSize = Marshal.SizeOf(typeof(DismPackage)); - for (uint i = 0; i < numOfPackages; i++) - { - try - { - var dismPackage = (DismPackage)Marshal.PtrToStructure(pBuffer, typeof(DismPackage)); - if (dismPackage != null) - { - packages.Add(new DismPackageInfo(dismPackage)); - } - } - finally - { - pBuffer = new IntPtr(pBuffer.ToInt64() + originalPackageSize); - } - } - } - finally - { - if (pPackagesBuffer != IntPtr.Zero) - { - DismNativeMethods.DismDelete(pPackagesBuffer); - } - } - return packages; - } - - internal DismDetailedPackageInfo GetPackageInfo(string identifier, DismPackageIdentifier packageIdentifier) - { - OpenSession(); - - IntPtr packageInfo; - - var hr = 0; - - hr = DismNativeMethods.DismGetPackageInfo(_sessionToken, identifier, packageIdentifier, out packageInfo); - ValidateResult(hr); - - try - { - var details = (DismPackageDetails)Marshal.PtrToStructure(packageInfo, typeof(DismPackageDetails)); - return extractDismDetailedPackageInfo(details); - } - finally - { - DeleteDismBuffer(packageInfo); - } - } - - internal DismDetailedPackageInfo extractDismDetailedPackageInfo(DismPackageDetails details) - { - string PackageName = details.PackageName; - DismPackageFeatureState PackageState = details.PackageState; - DismReleaseType ReleaseType = details.ReleaseType; - DateTime InstalledOn = DismNativeMethods.GetDateTimeFromSystemTime(details.InstalledOn); - bool Applicable = details.Applicable; - string Copyright = details.Copyright; - string Company = details.Company; - DateTime CreationTime = DismNativeMethods.GetDateTimeFromSystemTime(details.CreationTime); - string DisplayName = details.DisplayName; - string Description = details.Description; - string InstallClient = details.InstallClient; - string InstallPackageName = details.InstallPackageName; - DateTime LastUpdateTime = DismNativeMethods.GetDateTimeFromSystemTime(details.LastUpdateTime); - string ProductName = details.ProductName; - string ProductVersion = details.ProductVersion; - DismRestartType RestartRequired = details.RestartRequired; - DismFullyOfflineInstallable FullyOffline = details.FullyOffline; - string SupportInformation = details.SupportInformation; - - List CustomProperty = new List(); - - IntPtr currentCustomPropertyPtr = details.CustomPropertyBuffer; - for (int i = 0; i < details.CustomPropertyCount; ++i) - { - DismCustomProperty customPropertyInstance = new DismCustomProperty(currentCustomPropertyPtr); - CustomProperty.Add(customPropertyInstance); - currentCustomPropertyPtr = new IntPtr(currentCustomPropertyPtr.ToInt64() + Marshal.SizeOf(typeof(DismCustomProperty))); - } - - List Feature = new List(); - IntPtr currentFeaturePtr = details.FeatureBuffer; - for (int i = 0; i < details.FeatureCount; ++i) - { - DismFeature basicFeature = new DismFeature(currentFeaturePtr); - Feature.Add(basicFeature); - currentFeaturePtr = new IntPtr(currentFeaturePtr.ToInt64() + Marshal.SizeOf(typeof(DismPackageFeature))); - } - - return new DismDetailedPackageInfo( - PackageName, - PackageState, - ReleaseType, - InstalledOn, - Applicable, - Copyright, - Company, - CreationTime, - DisplayName, - Description, - InstallClient, - InstallPackageName, - LastUpdateTime, - ProductName, - ProductVersion, - RestartRequired, - FullyOffline, - SupportInformation, - CustomProperty, - Feature - ); - } - - internal DismStatus AddPackage(string packagePath) - { - OpenSession(); - - // Add the package - var hr = DismNativeMethods.DismAddPackage(_sessionToken, packagePath, false, false, IntPtr.Zero, null, IntPtr.Zero); - ValidateResult(hr); - return GetStatusFromErrorCode(hr); - } - - internal DismStatus RemoveInstalledPackage(string packagePath) - { - OpenSession(); - - // Remove the package - var hr = DismNativeMethods.DismRemovePackage(_sessionToken, packagePath, DismPackageIdentifier.DismPackagePath, IntPtr.Zero, null, IntPtr.Zero); - ValidateResult(hr); - return GetStatusFromErrorCode(hr); - } - - #endregion Core Logic - } - - #endregion Helper Classes - - #region Core Logic - - public class DismException : Exception - { - public DismException(string message) : base(message) - { - } - } - - public class DismInvalidPackageException : Exception - { - public DismInvalidPackageException(string message) - { - } - } - - public class DismSessionException : Exception - { - public DismSessionException(string message) - { - } - } - - /// - /// Core Dism class is used directly by the resource and provides a managed interface - /// - public class Dism - { - /// - /// Get a list of installed packages - /// - /// list containining installed packages - public List GetInstalledPackages(string logPath = null) - { - using (var dismHandler = new DismHandler(logPath)) - { - return dismHandler.GetInstalledPackages(); - } - } - - /// - /// Get detailed package info based on unique package name - /// - /// - /// - public DismDetailedPackageInfo GetDetailedPackageInfo(string packageName, string logPath = null) - { - using (var dismHandler = new DismHandler(logPath)) - { - return dismHandler.GetPackageInfo(packageName, DismPackageIdentifier.DismPackageName); - } - } - - /// - /// Get detailed package info based on path to a .cab file - /// - public DismDetailedPackageInfo GetDetailedCabFileInfo(string packagePath, string logPath = null) - { - using (var dismHandler = new DismHandler(logPath)) - { - return dismHandler.GetPackageInfo(packagePath, DismPackageIdentifier.DismPackagePath); - } - } - - /// - /// Install windows package from .cab file - /// - /// - /// - public DismStatus AddPackage(string packagePath, string logPath = null) - { - using (var dismHandler = new DismHandler(logPath)) - { - return dismHandler.AddPackage(packagePath); - } - } - - /// - /// Remove the installed windows package pointed to by the .cab file - /// - /// - /// - public DismStatus RemovePackage(string packagePath, string logPath = null) - { - using (var dismHandler = new DismHandler(logPath)) - { - return dismHandler.RemoveInstalledPackage(packagePath); - } - } - - private static readonly object SyncObject = new object(); - private static Dism _instance; - public static Dism Instance - { - get - { - if (_instance == null) - { - lock (SyncObject) - { - if (_instance == null) - { - _instance = new Dism(); - } - } - } - - return _instance; - } - } - } - - public class DismDetailedPackageInfo - { - public string PackageName; - public DismPackageFeatureState PackageState; - public DismReleaseType ReleaseType; - public DateTime InstalledOn; - public bool Applicable; - public string Copyright; - public string Company; - public DateTime CreationTime; - public string DisplayName; - public string Description; - public string InstallClient; - public string InstallPackageName; - public DateTime LastUpdateTime; - public string ProductName; - public string ProductVersion; - public DismRestartType RestartRequired; - public DismFullyOfflineInstallable FullyOffline; - public string SupportInformation; - public List CustomProperty; - public List Feature; - - internal DismDetailedPackageInfo( - string aPackageName, - DismPackageFeatureState aPackageState, - DismReleaseType aReleaseType, - DateTime aInstalledOn, - bool aApplicable, - string aCopyright, - string aCompany, - DateTime aCreationTime, - string aDisplayName, - string aDescription, - string aInstallClient, - string aInstallPackageName, - DateTime aLastUpdateTime, - string aProductName, - string aProductVersion, - DismRestartType aRestartRequired, - DismFullyOfflineInstallable aFullyOffline, - string aSupportInformation, - List aCustomProperty, - List aFeature - ) - { - PackageName = aPackageName; - PackageState = aPackageState; - ReleaseType = aReleaseType; - InstalledOn = aInstalledOn; - Applicable = aApplicable; - Copyright = aCopyright; - Company = aCompany; - CreationTime = aCreationTime; - DisplayName = aDisplayName; - Description = aDescription; - InstallClient = aInstallClient; - InstallPackageName = aInstallPackageName; - LastUpdateTime = aLastUpdateTime; - ProductName = aProductName; - ProductVersion = aProductVersion; - RestartRequired = aRestartRequired; - FullyOffline = aFullyOffline; - SupportInformation = aSupportInformation; - CustomProperty = aCustomProperty; - Feature = aFeature; - } - } - - public class DismCustomProperty - { - public string Name; - public string Value; - public string Path; - - public DismCustomProperty( - string Name, - string Value, - string Path - ) - { - this.Name = Name; - this.Value = Value; - this.Path = Path; - } - - public DismCustomProperty(IntPtr DismPackageCustomPropertyPtr) - { - DismPackageCustomProperty customProperty = (DismPackageCustomProperty)Marshal.PtrToStructure(DismPackageCustomPropertyPtr, typeof(DismPackageCustomProperty)); - - Name = customProperty.Name; - Value = customProperty.Value; - Path = customProperty.Path; - } - } - - public class DismFeature - { - public string FeatureName; - public DismFeatureState FeatureState; - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - public DismFeature(IntPtr FeatureBuf) - { - DismPackageFeature Feature = (DismPackageFeature)Marshal.PtrToStructure(FeatureBuf, typeof(DismPackageFeature)); - - SetFeatureState(Feature.State); - FeatureName = Feature.FeatureName; - } - - public void SetFeatureState(DismPackageFeatureState state) - { - switch (state) - { - case DismPackageFeatureState.DismStateNotPresent: - case DismPackageFeatureState.DismStateStaged: - FeatureState = DismFeatureState.Disabled; - break; - case DismPackageFeatureState.DismStateUninstallPending: - FeatureState = DismFeatureState.DisablePending; - break; - case DismPackageFeatureState.DismStateResolved: - FeatureState = DismFeatureState.DisabledWithPayloadRemoved; - break; - case DismPackageFeatureState.DismStateInstalled: - FeatureState = DismFeatureState.Enabled; - break; - case DismPackageFeatureState.DismStateInstallPending: - FeatureState = DismFeatureState.EnablePending; - break; - case DismPackageFeatureState.DismStateSuperseded: - FeatureState = DismFeatureState.Superseded; - break; - case DismPackageFeatureState.DismStatePartiallyInstalled: - FeatureState = DismFeatureState.PartiallyInstalled; - break; - default: - FeatureState = DismFeatureState.Disabled; - break; - } - } - } - - public enum DismPackageFeatureState - { - DismStateNotPresent = 0, - DismStateUninstallPending, - DismStateStaged, - DismStateResolved, - DismStateRemoved = DismStateResolved, - DismStateInstalled, - DismStateInstallPending, - DismStateSuperseded, - DismStatePartiallyInstalled - }; - - public enum DismFeatureState - { - Disabled = 0, - DisablePending, - Enabled, - EnablePending, - Superseded, - PartiallyInstalled, - DisabledWithPayloadRemoved - } - - public enum DismReleaseType - { - DismReleaseTypeCriticalUpdate = 0, - DismReleaseTypeDriver, - DismReleaseTypeFeaturePack, - DismReleaseTypeHotfix, - DismReleaseTypeSecurityUpdate, - DismReleaseTypeSoftwareUpdate, - DismReleaseTypeUpdate, - DismReleaseTypeUpdateRollup, - DismReleaseTypeLanguagePack, - DismReleaseTypeFoundation, - DismReleaseTypeServicePack, - DismReleaseTypeProduct, - DismReleaseTypeLocalPack, - DismReleaseTypeOther - }; - - public class DismPackageInfo - { - public string Name; - public DismPackageFeatureState PackageState; - public DismReleaseType ReleaseType; - public DateTime InstalledOn; - - internal DismPackageInfo(DismPackage package) - { - Name = package.PackageName; - PackageState = package.PackageState; - ReleaseType = package.ReleaseType; - InstalledOn = DismNativeMethods.GetDateTimeFromSystemTime(package.InstalledOn); - } - } - - public enum DismRestartType - { - DismRestartNo = 0, - DismRestartPossible = 1, - DismRestartRequired = 2 - } - - public enum DismFullyOfflineInstallable - { - DismFullyOfflineInstallable = 0, - DismFullyOfflineNotInstallable = 1, - DismFullyOfflineInstallableUndetermined = 2 - } - - public enum DismStatus - { - DismStatusSuccess = 0, - DismStatusRebootRequired = 1, - DismStatusFailed = 2 - }; - - #endregion Core logic - -} - - -"@ - - Add-Type -TypeDefinition $source - } -} - -Export-ModuleMember -Function '' \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCClassResources/WindowsPackageCab/ko-KR/WindowsPackageCab.Strings.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCClassResources/WindowsPackageCab/ko-KR/WindowsPackageCab.Strings.psd1 deleted file mode 100644 index 79e605b..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCClassResources/WindowsPackageCab/ko-KR/WindowsPackageCab.Strings.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/CompositeResourceHelper.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/CompositeResourceHelper.psm1 deleted file mode 100644 index 3cb4906..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/CompositeResourceHelper.psm1 +++ /dev/null @@ -1,147 +0,0 @@ -########################################################################### -# Common code for built-in Composite Resources -########################################################################### - -Set-StrictMode -version Latest - -# -# Builds a string with all common parameters shared across all -# resource nodes. -# -function BuildResourceCommonParameters -{ - [CmdletBinding()] - param( - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [string] - $KeyParamName, - - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [System.Array] - $OptionalParams, - - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [System.Collections.Hashtable] - $PSBoundParams) - - [System.Text.StringBuilder] $pb = new-object System.Text.StringBuilder - - #build optional parameters for invoking the inbuilt resource - foreach($paramName in $($PSBoundParams.keys)) - { - #If the param name is the 'Key' then continue - if ($paramName -eq $KeyParamName) - { - continue - } - if ($paramName -in $OptionalParams) - { - $value = $PSBoundParams[$paramName] - if ($value -eq $null) - { - continue - } - - if ($value -is [System.String]) - { - $pb.AppendFormat('{0} = "{1}"', $paramName, $value) | Out-Null - $pb.AppendLine() | Out-Null - } - else - { - $pb.Append($paramName + ' = $' + $paramName) | Out-Null - $pb.AppendLine() | Out-Null - } - } - } - - return $pb.ToString() -} - -# -# Builds a string with all resource nodes based on the key parameter along with -# the other optional parameters provided in the composite configuration. -# For e.g. While installing multiple features using WindowsFeature resource, -# output of this method would be: -# -# $KeyParam = @("Telnet-client","web-server") -# WindowsFeature Resource0 -# { -# Name = "Telnet-client" #Name provided in the composite configuration -# Ensure = "Present" -# IncludeAllSubFeature = True -# } -# -# WindowsFeature Resource1 -# { -# Name = "Web-Server" #Name provided in the composite configuration -# Ensure = "Present" -# IncludeAllSubFeature = True -# } -# -# -function BuildResourceString -{ - [CmdletBinding()] - param( - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [string[]] - $KeyParam, - - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [string] - $KeyParamName, - - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [string] - $CommonParams, - - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [string] - $ResourceName, - - [ValidateNotNullOrEmpty()] - [string] - $ModuleName="PSDesiredStateConfiguration", - - [ValidateNotNullOrEmpty()] - [string] - $DefaultParams - ) - - [System.Text.StringBuilder] $sb = new-object System.Text.StringBuilder - - $sb.AppendFormat('Import-DscResource -Name {0} -ModuleName {1}', $ResourceName, $ModuleName) | Out-Null - $sb.AppendLine() | Out-Null - - # add the resource nodes and their common parameters - [int] $count = 0 - foreach ($key in $KeyParam) - { - $sb.AppendFormat('{0} Resource{1}', $ResourceName, $count) | Out-Null - $sb.AppendLine() | Out-Null - $sb.AppendLine('{') | Out-Null - $sb.AppendFormat($KeyParamName + ' = "{0}"', $key) | Out-Null - $sb.AppendLine() | Out-Null - $sb.AppendLine($CommonParams) | Out-Null - - if($DefaultParams) - { - $sb.AppendLine($DefaultParams) | Out-Null - } - - $sb.AppendLine('}') | Out-Null - $count++ - } - - return $sb.ToString() -} - -Export-ModuleMember -Function BuildResourceCommonParameters, BuildResourceString diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/DSCResourceHelper.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/DSCResourceHelper.psm1 deleted file mode 100644 index 04b5f01..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/DSCResourceHelper.psm1 +++ /dev/null @@ -1,14 +0,0 @@ -########################################################################### -# Common code for built-in DSC Resources -########################################################################### - -function IsNanoServer -{ - if($PSVersionTable.PSEdition -ieq 'Core') - { - return $true - } - return $false -} - -Export-ModuleMember -Function IsNanoServer diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/GroupSet/GroupSet.Schema.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/GroupSet/GroupSet.Schema.psm1 deleted file mode 100644 index f716431..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/GroupSet/GroupSet.Schema.psm1 +++ /dev/null @@ -1,40 +0,0 @@ -Import-Module "$PSScriptRoot\..\CompositeResourceHelper.psm1" - -Configuration GroupSet -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param( - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [System.String[]] - $GroupName, - - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [System.String[]] - $MembersToInclude, - - [System.String[]] - $MembersToExclude, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - $Credential - ) - - $psboundParams = $PSBoundParameters - $optionalParameters = @("Ensure","MembersToInclude","MembersToExclude","Credential") - $keyParamName = "GroupName" - $resourceName = "Group" - - #build common parameters for all Group resource nodes - [string] $commonParameters = BuildResourceCommonParameters -KeyParamName $keyParamName -OptionalParams $optionalParameters -PSBoundParams $psboundParams - - #build Group resource string - [string] $resourceString = BuildResourceString -KeyParam $GroupName -KeyParamName $keyParamName -CommonParams $commonParameters -ResourceName $resourceName - - $configScript = [scriptblock]::Create($resourceString) - . $configScript -} \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/GroupSet/GroupSet.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/GroupSet/GroupSet.psd1 deleted file mode 100644 index 768299e..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/GroupSet/GroupSet.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/MSFT_ArchiveResource.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/MSFT_ArchiveResource.psm1 deleted file mode 100644 index 91bb46c..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/MSFT_ArchiveResource.psm1 +++ /dev/null @@ -1,983 +0,0 @@ -data LocalizedData -{ - # culture="en-US" - # TODO: Support WhatIf - ConvertFrom-StringData @' -InvalidChecksumArgsMessage=Specifying a Checksum without requesting content validation (the Validate parameter) is not meaningful -InvalidDestinationDirectory=The specified destination directory {0} does not exist or is not a directory -InvalidSourcePath=The specified source file {0} does not exist or is not a file -InvalidNetSourcePath=The specified source file {0} is not a valid net source path -ErrorOpeningExistingFile=An error occurred while opening the file {0} on disk. Please examine the inner exception for details -ErrorOpeningArchiveFile=An error occurred while opening the archive file {0}. Please examine the inner exception for details -ItemExistsButIsWrongType=The named item ({0}) exists but is not the expected type, and Force was not specified -ItemExistsButIsIncorrect=The destination file {0} has been determined not to match the source, but Force has not been specified. Cannot continue -ErrorCopyingToOutstream=An error was encountered while copying the archived file to {0} -PackageUninstalled=The archive at {0} was removed from destination {1} -PackageInstalled=The archive at {0} was unpacked to destination {1} -ConfigurationStarted=The configuration of MSFT_ArchiveResource is starting -ConfigurationFinished=The configuration of MSFT_ArchiveResource has completed -MakeDirectory=Make directory {0} -RemoveFileAndRecreateAsDirectory=Remove existing file {0} and replace it with a directory of the same name -RemoveFile=Remove file {0} -RemoveDirectory=Remove directory {0} -UnzipFile=Unzip archived file to {0} -DestMissingOrIncorrectTypeReason=The destination file {0} was missing or was not a file -DestHasIncorrectHashvalue=The destination file {0} exists but its checksum did not match the origin file -DestShouldNotBeThereReason=The destination file {0} exists but should not -UsingKeyToRetrieveHashValue = Using {0} to retrieve hash value -Nocachevaluefound = No cache value found -Cachevaluefoundreturning = Cache value found, returning {0} -CacheCorrupt = Cache found, but failed to loaded. Ignoring Cache. -Usingtmpkeytosavehashvalue = Using {0} {1} to save hash value -AbouttocachevalueInputObject = About to cache value {0} -InUpdateCache = In Update-Cache -AddingentryFullNameasacacheentry = Adding {0} as a cache entry -UpdatingCacheObject = Updating CacheObject -Placednewcacheentry = Placed new cache entry -NormalizeChecksumreturningChecksum = Normalize-Checksum returning {0} -PathPathisalreadyaccessiableNomountneeded. = Path {0} is already accessible. No mount needed. -Pathpathisnotavalidatenetpath = Path {0} is not a validate net path. -createpsdrivewithPathpath = create psdrive with Path {0}... -CannotaccessPathPathwithgivenCredential = Cannot access Path {0} with given Credential -Abouttovalidatestandardarguments = About to validate standard arguments -Goingforcacheentries = Going for cache entries -Thecachewasuptodateusingcachetosatisfyrequests = The cache was up to date, using cache to satisfy requests -Abouttoopenthezipfile = About to open the zip file -Cacheupdatedwithentries = Cache updated with {0} entries -Processing = Processing {0} -InTestTargetResourcedestexistsnotusingchecksumscontinuing = In Test-TargetResource: {0} exists, not using checksums, continuing -Notperformingchecksumthefileondiskhasthesamewritetimeasthelasttimeweverifieditscontents = Not performing checksum, the file on disk has the same write time as the last time we verified its contents -destexistsandthehashmatcheseven = {0} exists and the hash matches even though the LastModifiedTime did not. Updating cache -InTestTargetResourcedestexistsandtheselectedtimestampChecksummatched = In Test-TargetResource: {0} exists and the selected timestamp {1} matched -RemovePSDriveonRootpsdriveRoot = Remove PSDrive on Root {0} -RemovingDir = Removing {0} -Hashesofexistingandzipfilesmatchremoving = Hashes of existing and zip files match, removing -HashdidnotmatchfilehasbeenmodifiedsinceitwasextractedLeaving = Hash did not match, file has been modified since it was extracted. Leaving -InSetTargetResourceexistsselectedtimestampmatched = In Set-TargetResource: {0} exists and the selected timestamp {1} matched, removing -InSetTargetResourceexistsdtheselectedtimestampnotmatchg = In Set-TargetResource: {0} exists and the selected timestamp {1} did not match, leaving -existingappearstobeanemptydirectoryRemovingit = {0} appears to be an empty directory. Removing it -LastWriteTimemtcheswhatwehaverecordnotreexaminingchecksum = LastWriteTime of {0} matches what we have on record, not re-examining {1} -FoundfatdestwheregoingtoplaceoneandhashmatchedContinuing = Found a file at {0} where we were going to place one and hash matched. Continuing -FoundfileatdestwhereweweregoingtoplaceoneandhashdidntmatchItwillbeoverwritten = Found a file at $dest where we were going to place one and hash did not match. It will be overwritten -FoundfileatdestwhereweweregoingtoplaceoneanddoesnotmatchthesourcebutForcewasnotspecifiedErroring = Found a file at {0} where we were going to place one and does not match the source, but Force was not specified. Erroring -InSetTargetResourcedestexistsandtheselectedtimestamp$ChecksumdidnotmatchForcewasspecifiedwewilloverwrite = "In Set-TargetResource: {0} exists and the selected timestamp {1} did not match. Force was specified, we will overwrite -FoundafileatdestandtimestampChecksumdoesnotmatchthesourcebutForcewasnotspecifiedErroring = Found a file at {0} and timestamp {1} does not match the source, but Force was not specified. Erroring -FoundadirectoryatdestwhereafileshouldbeRemoving = Found a directory at {0} where a file should be. Removing -FounddirectoryatdestwhereafileshouldbeandForcewasnotspecifiedErroring = Found a directory at {0} where a file should be and Force was not specified. Erroring. -Writingtofiledest = Writing to file {0} -RemovePSDriveonRootdriveRoot = Remove PSDrive on Root {0} -Updatingcache = Updating cache -FolderDirdoesnotexist = Folder {0} does not exist -Examiningdirectorytoseeifitshouldberemoved = Examining {0} to see if it should be removed -InSetTargetResourcedestexistsandtheselectedtimestampChecksummatchedwillleaveit = In Set-TargetResource: {0} exists and the selected timestamp {1} matched, will leave it -'@ -} - -Import-LocalizedData LocalizedData -filename ArchiveProvider.psd1 - -Import-Module "$PSScriptRoot\..\RunAsHelper.psm1" - -$Debug = $false -Function Trace-Message -{ - param([string] $Message) - - if($Debug) - { - Write-Verbose $Message - } -} - -$CacheLocation = "$env:systemroot\system32\Configuration\BuiltinProvCache\MSFT_ArchiveResource" - -Function DSCHashNameToPSHashName -{ - param( - [string] $Algorithm - ) - - $dscToPsName= @{ - # Since in-box powershell Get-FileHash cmdlet takes algorithm without hypen, we silently change the names - "sha-1" = "SHA1" - "sha-256" = "SHA256" - "sha-512" = "SHA512" - } - - $psName = $dscToPsName[$Algorithm] - - $psName -} - - -Function Get-CacheEntry -{ - param( - [string]$path, - [string]$destination - ) - - $key = ($path + $destination).GetHashCode() - Trace-Message ($LocalizedData.UsingKeyToRetrieveHashValue -f $Key) - $path = Join-Path $CacheLocation $key - if(-not (Test-Path $path)) - { - Trace-Message ($LocalizedData.Nocachevaluefound) - return @{} - } - else - { - # ErroAction seems to have no affect on this condition, (see: https://microsoft.visualstudio.com/web/wi.aspx?pcguid=cb55739e-4afe-46a3-970f-1b49d8ee7564&id=1185735) - # using a try/catch to work around the issue. - try - { - $tmp = Import-CliXml $path - Trace-Message ($LocalizedData.Cachevaluefoundreturning -f $tmp) - return $tmp - } - catch [System.Xml.XmlException] - { - Trace-Message ($LocalizedData.CacheCorrupt) - return @{} - } - } -} - -Function Set-CacheEntry -{ - param( - [object] $InputObject, - [string] $path, - [string] $destination - ) - $key = ($path + $destination).GetHashCode() - Trace-Message ($LocalizedData.Usingtmpkeytosavehashvalue -f $tmp, $key) - $path = Join-Path $CacheLocation $key - Trace-Message ($LocalizedData.AbouttocachevalueInputObject -f $InputObject) - if(-not (Test-Path $CacheLocation)) - { - mkdir $CacheLocation | Out-Null - } - - Export-CliXml -Path $path -InputObject $InputObject -} - -Function Throw-InvalidArgumentException -{ - param( - [string] $Message, - [string] $ParamName - ) - - $exception = new-object System.ArgumentException $Message,$ParamName - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception,$ParamName,"InvalidArgument",$null - throw $errorRecord -} - -Function Throw-TerminatingError -{ - param( - [string] $Message, - [System.Management.Automation.ErrorRecord] $ErrorRecord, - [string] $ExceptionType - ) - - $exception = new-object "System.InvalidOperationException" $Message,$ErrorRecord.Exception - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception,"MachineStateIncorrect","InvalidOperation",$null - throw $errorRecord -} - -Function Assert-ValidStandardArgs -{ - param( - [string] $Path, - [string] $Destination, - [boolean] $Validate, - [string] $Checksum - ) - - #mkdir and Test-Path can each fail with a useful error message - #We want to stop our execution if that happens - $ErrorActionPreference = "Stop" - - if(-not (Test-Path -PathType Leaf $Path)) - { - Throw-InvalidArgumentException ($LocalizedData.InvalidSourcePath -f $Path) "Path" - } - - $item = Get-Item -EA Ignore $Destination - if($item -and $item.GetType() -eq [System.IO.FileInfo]) - { - Throw-InvalidArgumentException ($LocalizedData.InvalidDestinationDirectory -f $Destination) "Destination" - } - - if($Checksum -and -not $Validate) - { - Throw-InvalidArgumentException ($LocalizedData.InvalidChecksumArgsMessage -f $Checksum) "Checksum" - } -} - -Function Compare-FileToEntry -{ - param( - [string] $FileName, - [object] $Entry, - [string] $Algorithm - ) - - $existingStream = $null - $hash1 = $null - try - { - $existingStream = New-Object System.IO.FileStream $FileName, "Open" - $psAlgorithm = DSCHashNameToPSHashName -Algorithm $Algorithm - $hash1 = Get-FileHash -InputStream $existingStream -Algorithm $psAlgorithm - } - catch - { - Throw-TerminatingError ($LocalizedData.ErrorOpeningExistingFile -f $FileName) $_ - } - finally - { - if($existingStream -ne $null) - { - $existingStream.Dispose() - } - } - - $hash2 = $Entry.Checksum - return ($hash1.Algorithm -eq $hash2.Algorithm) -and ($hash1.Hash -eq $hash2.Hash) -} - -Function Get-RelevantChecksumTimestamp -{ - param( - [System.IO.FileSystemInfo] $FileSystemObject, - [String] $Checksum - ) - - if($Checksum.Equals("createddate")) - { - return $FileSystemObject.CreationTime - } - else #$Checksum.Equals("modifieddate") - { - return $FileSystemObject.LastWriteTime - } -} - -Function Update-Cache -{ - param( - [Hashtable] $CacheObject, - [System.IO.Compression.ZipArchiveEntry[]] $Entries, - [string] $Checksum, - [string] $SourceLastWriteTime - ) - - Trace-Message ($LocalizedData.InUpdateCache) - $cacheEntries = new-object System.Collections.ArrayList - foreach($entry in $Entries) - { - $hash = $null - if($Checksum.StartsWith("sha")) - { - $stream = $null - try - { - $stream = $entry.Open() - $psAlgorithm = DSCHashNameToPSHashName -Algorithm $Checksum - $hash = Get-FileHash -InputStream $stream -Algorithm $psAlgorithm - } - finally - { - if($stream) - { - $stream.Dispose() - } - } - } - - Trace-Message ($LoalizedData.AddingentryFullNameasacacheentry -f $entry.FullName) - $cacheEntries.Add(@{ - FullName = $entry.FullName - LastWriteTime = $entry.LastWriteTime - Checksum = $hash - }) | Out-Null - } - - Trace-Message ($LocalizedData.UpdatingCacheObject) - $CacheObject["SourceLastWriteTime"] = $SourceLastWriteTime - $CacheObject["Entries"] = (@() + $cacheEntries) - Set-CacheEntry -InputObject $CacheObject -path $Path -destination $Destination - Trace-Message ($LocalizedData.Placednewcacheentry) -} - -Function Normalize-Checksum -{ - param( - [boolean] $Validate, - [string] $Checksum - ) - - if($Validate) - { - if(-not $Checksum) - { - $Checksum = "SHA-256" - } - - $Checksum = $Checksum.ToLower() - } - - Trace-Message ($LocalizedData.NormalizeChecksumreturningChecksum -f $Checksum) - return $Checksum -} - -# create a psdrive to a net share with a given credential. -function Mount-NetworkPath -{ - param ( [string] $path, [pscredential] $Credential) - - # mount the drive only if not accessible - if (Test-Path $path -ErrorAction Ignore) - { - Trace-Message ($LocalizedData.PathPathisalreadyaccessiableNomountneeded -f $Path) - $psdrive = $null - } - else - { - if (-not $path.EndsWith("\")) - { - $index = $Path.LastIndexOf("\"); - if (-1 -eq $index) - { - Trace-Message ($LocalizedData.Pathpathisnotavalidatenetpath -f $path) - Throw-TerminatingError ($LocalizedData.InvalidNetSourcePath -f $Path) - } - else - { - $path = $path.Substring(0, $index) - } - } - - $psdriveArgs = @{ Name=([guid]::NewGuid()); PSProvider="FileSystem"; Root=$Path; Scope="Script"; Credential=$Credential } - try - { - Trace-Message ($LocalizedData.createpsdrivewithPathpath -f $path) - $psdrive = New-PSDrive @psdriveArgs - } - catch - { - Trace-Message ($LocalizedData.CannotaccessPathPathwithgivenCredential -f $Path) - Throw-TerminatingError ($LocalizedData.ErrorOpeningArchiveFile -f $Path) $_ - } - } - - return $psdrive -} - -# The Test-TargetResource cmdlet is used to test the status of item on the destination -function Test-TargetResource -{ - param - ( - [ValidateSet("Present", "Absent")] - [string] $Ensure = "Present", - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $Path, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $Destination, - - [boolean] $Validate = $false, - - [ValidateSet("", "SHA-1", "SHA-256", "SHA-512", "CreatedDate", "ModifiedDate")] - [string] $Checksum, - - [boolean] $Force = $false, - - [pscredential] $Credential - ) - - if ($Credential) - { - $psdrive = Mount-NetworkPath -path $Path -Credential $Credential - } - - try - { - $ErrorActionPreference = "Stop" - - Trace-Message ($LocalizedData.Abouttovalidatestandardarguments) - Assert-ValidStandardArgs $Path $Destination $Validate $Checksum - $Checksum = Normalize-Checksum $Validate $Checksum - Trace-Message ($LocalizedData.Goingforcacheentries) - $result = $true - $cacheObj = Get-CacheEntry -path $Path -destination $Destination - $sourceLastWriteTime = (Get-Item $Path).LastWriteTime - $cacheUpToDate = $cacheObj -and $cacheObj.SourceLastWriteTime -and $cacheObj.SourceLastWriteTime -eq $sourceLastWriteTime - $file = $null - try - { - $entries = $null - if($cacheUpToDate) - { - Trace-Message ($LocalizedData.Thecachewasuptodateusingcachetosatisfyrequests) - $entries = $cacheObj.Entries - } - else - { - Trace-Message ($LocalizedData.Abouttoopenthezipfile) - $entries, $null, $file = Open-ZipFile $Path - - Trace-Message ($LocalizedData.Updatingcache) - Update-Cache $cacheObj $entries $Checksum $sourceLastWriteTime - $entries = $cacheObj.Entries - Trace-Message ($LocalizedData.Cacheupdatedwithentries -f $cacheObj.Entries.Length) - } - - foreach($entry in $entries) - { - $individualResult = $true - Trace-Message ($LocalizedData.Processing -f $entry.FullName) - $dest = join-path $Destination $entry.FullName - if($dest.EndsWith('\')) #Directory - { - $dest = $dest.TrimEnd('\') - if(-not (Test-Path -PathType Container $dest)) - { - Write-Verbose ($LocalizedData.DestMissingOrIncorrectTypeReason -f $dest) - $individualResult = $result = $false - } - } - else - { - $item = Get-Item $dest -EA Ignore - if(-not $item) - { - $individualResult = $result = $false - } - elseif($item.GetType() -ne [System.IO.FileInfo]) - { - $individualResult = $result = $false - } - - if(-not $Checksum) - { - Trace-Message ($LocalizedData.InTestTargetResourcedestexistsnotusingchecksumscontinuing -f $dest) - if(-not $individualResult -and $Ensure -eq "Present") - { - Write-Verbose ($LocalizedData.DestMissingOrIncorrectTypeReason -f $dest) - } - elseif($individualResult -and $Ensure -eq "Absent") - { - Write-Verbose ($LocalizedData.DestShouldNotBeThereReason -f $dest) - } - } - else - { - #If the file is there we need to check if it could possibly fail in a different way - #Otherwise we skip all these checks - there's nothing to work with - if($individualResult) - { - $Checksum = $Checksum.ToLower() - if($Checksum.StartsWith("sha")) - { - if($item.LastWriteTime.Equals($entry.ExistingItemTimestamp)) - { - Trace-Message ($LocalizedData.Notperformingchecksumthefileondiskhasthesamewritetimeasthelasttimeweverifieditscontents) - } - else - { - if(-not (Compare-FileToEntry $dest $entry $Checksum)) - { - $individualResult = $result = $false - } - else - { - $entry.ExistingItemTimestamp = $item.LastWriteTime - Trace-Message ($LocalizedData.destexistsandthehashmatcheseven -f $dest) - } - } - } - else - { - $date = Get-RelevantChecksumTimestamp $item $Checksum - if(-not $date.Equals($entry.LastWriteTime.DateTime)) - { - $individualResult = $result = $false - } - else - { - Trace-Message ($LocalizedData.InTestTargetResourcedestexistsandtheselectedtimestampChecksummatched -f $dest, $Checksum) - } - } - } - - if(-not $individualResult -and $Ensure -eq "Present") - { - Write-Verbose ($LocalizedData.DestHasIncorrectHashvalue -f $dest) - } - elseif($individualResult -and $Ensure -eq "Absent") - { - Write-Verbose ($LocalizedData.DestShouldNotBeThereReason -f $dest) - } - } - } - } - } - finally - { - if($file) - { - $file.Dispose() - } - } - - Set-CacheEntry -InputObject $cacheObj -path $Path -destination $Destination - $result = $result -eq ("Present" -eq $Ensure) - } - finally - { - if($psdrive) - { - $ErrorActionPreference = "SilentlyContinue" - Trace-Message ($LoalizedData.RemovePSDriveonRootpsdrive -f $($psdrive.Root)) - Remove-PSDrive $psdrive -Force -ErrorAction SilentlyContinue - } - } - - return $result -} - -Function Ensure-Directory -{ - param([string] $Dir) - $item = get-item $Dir -EA SilentlyContinue - if(-not $item) - { - Trace-Message ($LocalizedData.FolderDirdoesnotexist -f $Dir) - if($PSCmdlet.ShouldProcess(($LocalizedData.MakeDirectory -f $Dir), $null, $null)) - { - mkdir $Dir | Out-Null - } - } - else - { - if($item.GetType() -ne [System.IO.DirectoryInfo]) - { - if($Force -and $PSCmdlet.ShouldProcess(($LocalizedData.RemoveFileAndRecreateAsDirectory -f $Dir), $null, $null)) - { - Trace-Message ($LocalizedData.RemovingDir -f $Dir) - rm $Dir | Out-Null - mkdir $Dir | Out-Null #Note that we don't do access time translations onto directories since we are emulating the shell's behavior - } - else - { - Throw-TerminatingError ($LocalizedData.ItemExistsButIsWrongType -f $Path) - } - } - } -} - -Function Open-ZipFile -{ - param($Path) - if (IsNanoServer) - { - add-type -assemblyname System.IO.Compression - } - else - { - add-type -assemblyname System.IO.Compression.FileSystem - } - $nameHash = @{} - try - { - $fileHandle = ([System.IO.Compression.ZipFile]::OpenRead($Path)) - $entries = $fileHandle.Entries - } - catch - { - Throw-TerminatingError ($LocalizedData.ErrorOpeningArchiveFile -f $Path) $_ - } - - $entries | %{$nameHash[$_.FullName] = $_} - return $entries, $nameHash, $fileHandle -} - -# The Set-TargetResource cmdlet is used to unpack or remove a zip file to a particular directory -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $Path, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $Destination, - - [ValidateSet("Present", "Absent")] - [string] $Ensure = "Present", - - [boolean] $Validate = $false, - - [ValidateSet("", "SHA-1", "SHA-256", "SHA-512", "CreatedDate", "ModifiedDate")] - [string] $Checksum, - - [boolean] $Force = $false, - - [pscredential] $Credential - ) - - if ($Credential) - { - $psdrive = Mount-NetworkPath -path $Path -Credential $Credential - } - - try - { - $ErrorActionPreference = "Stop" - Assert-ValidStandardArgs $Path $Destination $Validate $Checksum - $Checksum = Normalize-Checksum $Validate $Checksum - Write-Verbose $LocalizedData.ConfigurationStarted - - if(-not (Test-Path $Destination)) - { - mkdir $Destination | Out-Null - } - - $cacheObj = Get-CacheEntry -path $Path -destination $Destination - $sourceLastWriteTime = (Get-Item $Path).LastWriteTime - $cacheUpToDate = $cacheObj -and $cacheObj.SourceLastWriteTime -and $cacheObj.SourceLastWriteTime -eq $sourceLastWriteTime - $file = $null - $nameToEntry = @{} - - try - { - # once cache is updated we need to dispose the handle - # if not, when the second time $file is updated with a - # new handle, the old one not being disposed will lead - # to archive resource having a lock on the file - if(-not $cacheUpToDate) - { - $entries, $nameToEntry, $file = Open-ZipFile $Path - Update-Cache $cacheObj $entries $Checksum $sourceLastWriteTime - } - } - finally - { - if($file) - { - $file.Dispose() - $file = $null - } - - } - - try - { - - $entries = $cacheObj.Entries - if($Ensure -eq "Absent") - { - $directories = new-object system.collections.generic.hashset[string] - foreach($entry in $entries) - { - $isDir = $false - if($entry.FullName.EndsWith("\")) - { - $isDir = $true - $directories.Add((Split-Path -Leaf $entry)) | Out-Null - } - - $parent = $entry.FullName - while(($parent = (Split-Path $parent))) { $directories.Add($parent) | Out-Null } - - if($isDir) - { - #Directory removal is handled as its own pass, see note and code after this loop - continue - } - - $existing = Join-Path $Destination $entry.FullName - $item = Get-Item $existing -EA SilentlyContinue - if(-not $item) - { - continue - } - - #Possible for a folder to have been replaced by a directory of the same name, in which case we must leave it alone - $type = $item.GetType() - if($type -ne [System.IO.FileInfo]) - { - continue - } - - if(-not $Checksum -and $PSCmdlet.ShouldProcess(($LocalizedData.RemoveFile -f $existing), $null, $null)) - { - Trace-Message ($LocalizedData.RemovingDir -f $existing) - rm $existing - continue - } - - $Checksum = $Checksum.ToLower() - if($Checksum.StartsWith("sha")) - { - if((Compare-FileToEntry $existing $entry $Checksum) -and $PSCmdlet.ShouldProcess(($LocalizedData.RemoveFile -f $existing), $null, $null)) - { - Trace-Message ($LocalizedData.Hashesofexistingandzipfilesmatchremoving) - rm $existing - } - else - { - Trace-Message ($LocalizedData.HashdidnotmatchfilehasbeenmodifiedsinceitwasextractedLeaving) - } - } - else - { - $date = Get-RelevantChecksumTimestamp $item $Checksum - if($date.Equals($entry.LastWriteTime.DateTime) -and $PSCmdlet.ShouldProcess(($LocalizedData.RemoveFile -f $existing), $null, $null)) - { - Trace-Message ($LocalizedData.InSetTargetResourceexistsselectedtimestampmatched -f $existing, $Checksum) - rm $existing - } - else - { - Trace-Message ($LocalizedData.InSetTargetResourceexistsdtheselectedtimestampnotmatchg -f $existing, $Checksum) - } - } - } - - #Hashset was useful for dropping dupes in an efficient manner, but it can mess with ordering - #Sort according to current culture (directory names can be localized, obviously) - #Reverse so we hit children before parents - $directories = [system.linq.enumerable]::ToList($directories) - $directories.Sort([System.StringComparer]::InvariantCultureIgnoreCase) - $directories.Reverse() - foreach($directory in $directories) - { - Trace-Message ($LocalizedData.Examiningdirectorytoseeifitshouldberemoved -f $directory) - $existing = Join-Path $Destination $directory - $item = Get-Item $existing -EA SilentlyContinue - if($item -and $item.GetType() -eq [System.IO.DirectoryInfo] -and $item.GetFiles().Count -eq 0 -and $item.GetDirectories().Count -eq 0 ` - -and $PSCmdlet.ShouldProcess(($LocalizedData.RemoveDirectory -f $existing), $null, $null)) - { - Trace-Message ($LocalizedData.existingappearstobeanemptydirectoryRemovingit -f $existing) - rmdir $existing - } - } - - Write-Verbose ($LocalizedData.PackageUninstalled -f $Path,$Destination) - Write-Verbose $LocalizedData.ConfigurationFinished - return - } - - Ensure-Directory $Destination - foreach($entry in $entries) - { - $dest = join-path $Destination $entry.FullName - if($dest.EndsWith('\')) #Directory - { - Ensure-Directory $dest.TrimEnd("\") #Some cmdlets have problems with trailing char - continue - } - - $item = Get-Item $dest -EA SilentlyContinue - if($item) - { - if($item.GetType() -eq [System.IO.FileInfo]) - { - if(-not $Checksum) - { - #It exists. The user didn't specify -Validate, so that's good enough for us - continue - } - - if($Checksum.StartsWith("sha")) - { - if($item.LastWriteTime.Equals($entry.ExistingTimestamp)) - { - Trace-Message ($LocalizedData.LastWriteTimemtcheswhatwehaverecordnotreexaminingchecksum -f $dest, $checksum) - } - else - { - $identical = Compare-FileToEntry $dest $entry $Checksum - - if($identical) - { - Trace-Message ($LocalizedData.FoundfatdestwheregoingtoplaceoneandhashmatchedContinuing -f $dest) - $entry.ExistingItemTimestamp = $item.LastWriteTime - continue - } - else - { - if($Force) - { - Trace-Message ($LocalizedData.FoundfileatdestwhereweweregoingtoplaceoneandhashdidntmatchItwillbeoverwritten -f $dest) - } - else - { - Trace-Message ($LocalizedData.FoundfileatdestwhereweweregoingtoplaceoneanddoesnotmatchthesourcebutForcewasnotspecifiedErroring -f $dest) - Throw-TerminatingError ($LocalizedData.ItemExistsButIsIncorrect -f $dest) - } - } - } - } - else - { - $date = Get-RelevantChecksumTimestamp $item $Checksum - if($date.Equals($entry.LastWriteTime.DateTime)) - { - Trace-Message ($LocalizedData.InSetTargetResourcedestexistsandtheselectedtimestampChecksummatchedwillleaveit -f $dest, $Checksum) - continue - } - else - { - if($Force) - { - Trace-Message ($LocalizedData.InSetTargetResourcedestexistsandtheselectedtimestamp -f $dest, $Checksum) - } - else - { - Trace-Message ($LocalizedData.FoundafileatdestandtimestampChecksumdoesnotmatchthesourcebutForcewasnotspecifiedErroring -f $dest, $Checksum) - Throw-TerminatingError ($LocalizedData.ItemExistsButIsIncorrect -f $dest) - } - } - } - } - else - { - if($Force) - { - Trace-Message ($LocalizedData.FoundadirectoryatdestwhereafileshouldbeRemoving -f $dest) - if($PSCmdlet.ShouldProcess(($LocalizedData.RemoveDirectory -f $dest), $null, $null)) - { - rmdir -Recurse -Force $dest - } - } - else - { - Trace-Message ($LocalizedData.FounddirectoryatdestwhereafileshouldbeandForcewasnotspecifiedErroring -f $dest) - Throw-TerminatingError ($LocalizedData.ItemExistsButIsWrongType -f $dest) - } - } - } - - $parent = Split-Path $dest - if(-not (Test-Path $parent) -and $PSCmdlet.ShouldProcess(($LocalizedData.MakeDirectory -f $parent), $null, $null)) - { - #TODO: This is an edge case we need to revisit. We should be correctly handling wrong file types along - #the directory path if they occur within the archive, but they don't have to. Simple tests demonstrate that - #the Zip format allows you to have the file within a folder without explicitly having an entry for the folder - #This solution will fail in such a case IF anything along the path is of the wrong type (e.g. file in a place - #we expect a directory to be) - mkdir $parent | Out-Null - } - - if($PSCmdlet.ShouldProcess(($LocalizedData.UnzipFile -f $dest), $null, $null)) - { - #If we get here we can safely blow away anything we find. - $null, $nameToEntry, $file = Open-ZipFile $Path - $stream = $null - $outStream = $null - try - { - Trace-Message ($LocalizedData.Writingtofiledest -f $dest) - $stream = $nameToEntry[$entry.FullName].Open() - $outStream = New-Object System.IO.FileStream $dest, "Create" - $stream.CopyTo($outStream) - } - catch - { - Throw-TerminatingError ($LocalizedData.ErrorCopyingToOutstream -f $dest) $_ - } - finally - { - if($stream -ne $null) - { - $stream.Dispose() - } - - if($outStream -ne $null) - { - $outStream.Dispose() - } - } - - $fileInfo = New-Object System.IO.FileInfo $dest - $entry.ExistingItemTimestamp = $fileInfo.LastWriteTime = $fileInfo.LastAccessTime = $fileInfo.CreationTime = $entry.LastWriteTime.DateTime - } - } - } - finally - { - if($file) - { - $file.Dispose() - } - } - - Set-CacheEntry -InputObject $cacheObj -path $Path -destination $Destination - Write-Verbose ($LocalizedData.PackageInstalled -f $Path,$Destination) - Write-Verbose $LocalizedData.ConfigurationFinished - } - finally - { - if($psdrive) - { - $ErrorActionPreference = "SilentlyContinue" - Trace-Message ($LocalizedData.RemovePSDriveonRootdriveRoot -f ($($psdrive.Root))) - Remove-PSDrive $psdrive -Force -ErrorAction SilentlyContinue - } - } -} - -# The Get-TargetResource cmdlet is used to fetch the object -function Get-TargetResource -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $Path, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $Destination, - - [boolean] $Validate = $false, - - [ValidateSet("", "SHA-1", "SHA-256", "SHA-512", "CreatedDate", "ModifiedDate")] - [string] $Checksum, - - [pscredential] $Credential - ) - - if ($null -eq $Credential) - { - $PSBoundParameters.Remove("Credential") - } - - $exists = Test-TargetResource @PSBoundParameters - - $stringResult = "Absent" - if($exists) - { - $stringResult = "Present" - } - - @{ - Ensure = $stringResult; - Path = $Path; - Destination = $Destination; - } -} - -Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/MSFT_ArchiveResource.schema.mof b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/MSFT_ArchiveResource.schema.mof deleted file mode 100644 index 17fb131..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/MSFT_ArchiveResource.schema.mof and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/ko-KR/ArchiveProvider.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/ko-KR/ArchiveProvider.psd1 deleted file mode 100644 index 780e23d..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/ko-KR/ArchiveProvider.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/ko-KR/MSFT_ArchiveResource.schema.mfl b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/ko-KR/MSFT_ArchiveResource.schema.mfl deleted file mode 100644 index ee9ae75..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/ko-KR/MSFT_ArchiveResource.schema.mfl and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/MSFT_EnvironmentResource.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/MSFT_EnvironmentResource.psm1 deleted file mode 100644 index b0553b1..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/MSFT_EnvironmentResource.psm1 +++ /dev/null @@ -1,798 +0,0 @@ -# This PS module contains functions for Desired State Configuration (DSC) "Environment" provider - -# Fallback message strings in en-US -DATA localizedData -{ - # culture = "en-US" - ConvertFrom-StringData @' - EnvVarCreated = (CREATE) Environment variable '{0}' with value '{1}' - EnvVarSetError = (ERROR) Failed to set environment variable '{0}' to value '{1}' - EnvVarPathSetError = (ERROR) Failed to add path '{0}' to environment variable '{1}' holding value '{2}' - EnvVarRemoveError = (ERROR) Failed to remove environment variable '{0}' holding value '{1}' - EnvVarPathRemoveError = (ERROR) Failed to remove path '{0}' from variable '{1}' holding value '{2}' - EnvVarUnchanged = (UNCHANGED) Environment variable '{0}' with value '{1}' - EnvVarUpdated = (UPDATE) Environment variable '{0}' from value '{1}' to value '{2}' - EnvVarPathUnchanged = (UNCHANGED) Path environment variable '{0}' with value '{1}' - EnvVarPathUpdated = (UPDATE) Environment variable '{0}' from value '{1}' to value '{2}' - EnvVarNotFound = (NOT FOUND) Environment variable '{0}' - EnvVarFound = (FOUND) Environment variable '{0}' with value '{1}' - EnvVarFoundWithMisMatchingValue = (FOUND MISMATCH) Environment variable '{0}' with value '{1}' mismatched the specified value '{2}' - EnvVarRemoved = (REMOVE) Environment variable '{0}' -'@ -} -Import-LocalizedData LocalizedData -filename MSFT_EnvironmentResource.strings.psd1 - - -#------------------------------------- -# Script-level Constants and Variables -#------------------------------------- -$EnvVarRegPathMachine = "HKLM:\\System\\CurrentControlSet\\Control\\Session Manager\\Environment" -$EnvVarRegPathUser = "HKCU:\\Environment" - -$EnvironmentVariableTarget = @{ Process = 0; User = 1; Machine = 2 } -$MaxSystemEnvVariableLength = 1024 -$MaxUserEnvVariableLength = 255 - -Function Throw-InvalidArgumentException -{ - param( - [string] $Message, - [string] $ParamName - ) - - $exception = new-object System.ArgumentException $Message,$ParamName - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception,$ParamName,"InvalidArgument",$null - throw $errorRecord -} - -function GetEnvironmentVariable -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $Name, - - [parameter(Mandatory = $true)] - [int] $Target - ) - - if ($Target -eq $EnvironmentVariableTarget.Process) - { - return [System.Environment]::GetEnvironmentVariable($Name); - } - - if ($Target -eq $EnvironmentVariableTarget.Machine) - { - $retVal = Get-ItemProperty $EnvVarRegPathMachine -Name $Name -ErrorAction SilentlyContinue - return $retVal.$Name - } - - if ($Target -eq $EnvironmentVariableTarget.User) - { - $retVal = Get-ItemProperty $EnvVarRegPathUser -Name $Name -ErrorAction SilentlyContinue - return $retVal.$Name - } -} - -function SetEnvironmentVariable -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [String] $Name, - - [String] $Value, - - [parameter(Mandatory = $true)] - [int] $Target - ) - - if ($Target -eq $EnvironmentVariableTarget.Process) - { - [System.Environment]::SetEnvironmentVariable($Name, $Value); - } - - if ($Target -eq $EnvironmentVariableTarget.Machine) - { - if ($Name.Length -ge $MaxSystemEnvVariableLength) { - Throw-InvalidArgumentException -Message "Argument is too long." -ParamName $Name - } - $Path = $EnvVarRegPathMachine - } - elseif ($Target -eq $EnvironmentVariableTarget.User) - { - if ($Name.Length -ge $MaxUserEnvVariableLength) { - Throw-InvalidArgumentException -Message "Argument is too long." -ParamName $Name - } - $Path = $EnvVarRegPathUser - } - - $environmentKey = Get-ItemProperty $Path -Name $Name -ErrorAction SilentlyContinue - if ($environmentKey) - { - if (!$Value) - { - Remove-ItemProperty $Path -Name $Name -ErrorAction SilentlyContinue - } - else - { - Set-ItemProperty $Path -Name $Name -Value $Value -ErrorAction SilentlyContinue - } - } -} - - -#------------------------------ -# The Get-TargetResource cmdlet -#------------------------------ -FUNCTION Get-TargetResource -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name - ) - - $retVal = GetItemProperty $EnvVarRegPathMachine -Name $Name -Expand:$false -ErrorAction SilentlyContinue - - if($retVal -eq $null) - { - Write-Verbose ($localizedData.EnvVarNotFound -f $Name) - - return @{Ensure='Absent'; Name=$Name} - } - - Write-Verbose ($localizedData.EnvVarFound -f $Name, $retVal.$Name) - - return @{Ensure='Present'; Name=$Name; Value=$retVal.$Name} -} - -function Set-EnvVar -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [ValidateNotNull()] - [System.String] - $Value = [String]::Empty - ) - - $err = Set-ItemProperty $EnvVarRegPathMachine -Name $Name -Value $Value 2>&1 - - if($err) - { - Write-Verbose ($localizedData.EnvVarSetError -f $Name, $Value) - - throw $err - } - - try - { - if($value) - { - SetEnvironmentVariable -Name $Name -Value $Value -Target $EnvironmentVariableTarget.Machine - SetEnvironmentVariable -Name $Name -Value $Value -Target $EnvironmentVariableTarget.Process - } - } - catch - { - Write-Verbose ($localizedData.EnvVarSetError -f $Name, $Value) - - throw $_ - } - -} -function Remove-EnvVar -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name - ) - - $curVarProperties = Get-ItemProperty $EnvVarRegPathMachine -Name $Name -ErrorAction SilentlyContinue - $currentValueFromEnv = GetEnvironmentVariable -Name $name -Target $EnvironmentVariableTarget.Process - - if($curVarProperties -ne $null) - { - $err = Remove-ItemProperty $EnvVarRegPathMachine -Name $Name 2>&1 - - if($err) - { - Write-Log -Message ($localizedData.EnvVarRemoveError -f $Name, $Value) - - throw $err - } - } - - if($currentValueFromEnv -ne $null) - { - try - { - SetEnvironmentVariable -Name $Name -Value $null -Target $EnvironmentVariableTarget.Machine - SetEnvironmentVariable -Name $Name -Value $null -Target $EnvironmentVariableTarget.Process - } - catch - { - Write-Verbose ($localizedData.EnvVarRemoveError -f $Name, $Value) - - throw $_ - } - } -} - - -#------------------------------ -# The Set-TargetResource cmdlet -#------------------------------ -FUNCTION Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [ValidateNotNull()] - [System.String] - $Value = [String]::Empty, - - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", - - [System.Boolean] - $Path = $false - ) - - $ValueSpecified = $PSBoundParameters.ContainsKey("Value") - - $curVarProperties = GetItemProperty $EnvVarRegPathMachine -Name $Name -Expand:(-not $Path) -ErrorAction SilentlyContinue - $currentValueFromEnv = GetEnvironmentVariable -Name $name -Target $EnvironmentVariableTarget.Process - - # ---------------- - # ENSURE = PRESENT - if ($Ensure -ieq "Present") - { - if (($curVarProperties -eq $null) -or (($currentValueFromEnv -eq $null) -and ($curVarProperties.$Name -ne [string]::Empty))) # The specified variable doesn't exist already - { - # Given the specified $Name environment variable doesn't exist already, - # simply create one with the specified value and return. If no $Value is - # specified, the default value is set to empty string "" (per spec). - # Both path and non-path cases are covered by this. - - $successMessage = $localizedData.EnvVarCreated -f $Name, $Value - - if ($PSCmdlet.ShouldProcess($successMessage, $null, $null)) - { - Set-EnvVar -Name $Name -Value $Value - } - - return - } - - # If the control reaches here, the specified variable exists already - - if (!$ValueSpecified) - { - # Given no $Value was specified to be set and the variable exists, - # we'll leave the existing variable as is. - # This covers both path and non-path variables. - - Write-Log -Message ($localizedData.EnvVarUnchanged -f $Name, $curVarProperties.$Name) - - return - } - - # If the control reaches here: the specified variable exists already and a $Value has been specified to be set. - - if (!$Path) - { - # For non-path variables, simply set the specified $Value as the new value of the specified - # variable $Name, then return. - - $successMessage = $localizedData.EnvVarUpdated -f $Name, $curVarProperties.$Name, $Value - if ($Value -ceq $curVarProperties.$Name) - { - $successMessage = $localizedData.EnvVarUnchanged -f $Name, $curVarProperties.$Name - } - - if ($PSCmdlet.ShouldProcess($successMessage, $null, $null) -and ($Value -cne $curVarProperties.$Name)) - { - Set-EnvVar -Name $Name -Value $Value - } - - return - } - - # If the control reaches here: the specified variable exists already, it is a path variable and a $Value has been specified to be set. - - # Check if an empty, whitespace or semi-colon only string has been specified. If yes, return unchanged. - $trimmedValue = $Value.Trim(";"," ") - if ([String]::IsNullOrEmpty($trimmedValue)) - { - Write-Log -Message ($localizedData.EnvVarPathUnchanged -f $Name, $curVarProperties.$Name) - - return - } - - - $setValue = $curVarProperties.$Name + ";" - $specifiedPaths = $trimmedValue -split ";" - $currentPaths = $curVarProperties.$Name -split ";" - $varUpdated = $false - - foreach ($specifiedPath in $specifiedPaths) - { - if (FindSubPath -QueryPath $specifiedPath -PathList $currentPaths) - { - # Found this $specifiedPath as one of the $currentPaths, no need to add this again, skip/continue to the next $specifiedPath - - continue - } - - # If the control reached here, we didn't find this $specifiedPath in the $currentPaths, add it - # and mark the environment variable as updated. - - $varUpdated = $true - $setValue += $specifiedPath + ";" - } - - # Remove any extraneous ";" at the end (and potentially start - as a side-effect) of the value to be set - $setValue = $setValue.Trim(";") - - # Set the expected success message - $successMessage = $localizedData.EnvVarPathUnchanged -f $Name, $curVarProperties.$Name - if ($varUpdated) - { - $successMessage = $localizedData.EnvVarPathUpdated -f $Name, $curVarProperties.$Name, $setValue - } - - if ($PSCmdlet.ShouldProcess($successMessage, $null, $null)) - { - # Finally update the existing environment path variable - - Set-EnvVar -Name $Name -Value $setValue - } - } - - # --------------- - # ENSURE = ABSENT - elseif ($Ensure -ieq "Absent") - { - if(($curVarProperties -eq $null) -and ($currentValueFromEnv -eq $null)) - { - # Variable not found, condition is satisfied and there is nothing to set/remove, return - - Write-Log -Message ($localizedData.EnvVarNotFound -f $Name) - - return - } - - if(!$ValueSpecified -or !$Path) - { - # If no $Value specified to be removed, simply remove the environment variable (holds true for both path and non-path variables - # OR - # Regardless of $Value, if the target variable is a non-path variable, simply remove it to meet the absent condition - - $successMessage = $localizedData.EnvVarRemoved -f $Name - - if ($PSCmdlet.ShouldProcess($successMessage, $null, $null)) - { - Remove-EnvVar -Name $Name - } - - return - } - - # If the control reaches here: target variable is an existing environment path-variable and a specified $Value needs be removed from it - - # Check if an empty string or semi-colon only string has been specified as $Value. If yes, return unchanged as we don't need to remove anything. - $trimmedValue = $Value.Trim(";") - if ([String]::IsNullOrEmpty($trimmedValue)) - { - Write-Log -Message ($localizedData.EnvVarPathUnchanged -f $Name, $curVarProperties.$Name) - - return - } - - $finalPath = "" - $specifiedPaths = $trimmedValue -split ";" - $currentPaths = $curVarProperties.$Name -split ";" - $varAltered = $false - - foreach ($subpath in $currentPaths) - { - if (FindSubPath -QueryPath $subpath -PathList $specifiedPaths) - { - # Found this $subpath as one of the $specifiedPaths, skip adding this to the final value/path of this variable - # and mark the variable as altered. - - $varAltered = $true - continue - } - - # If the control reaches here, the current $subpath was not part of the $specifiedPaths (to be removed), - # so keep this $subpath in the finalPath - - $finalPath += $subpath + ";" - } - - # Remove any extraneous ";" at the end (and potentially start - as a side-effect) of the $finalPath - $finalPath = $finalPath.Trim(";") - - - # Set the expected success message - $successMessage = $localizedData.EnvVarPathUnchanged -f $Name, $curVarProperties.$Name - if ($varAltered) - { - $successMessage = $localizedData.EnvVarPathUpdated -f $Name, $curVarProperties.$Name, $finalPath - - if ([String]::IsNullOrEmpty($finalPath)) - { - $successMessage = $localizedData.EnvVarRemoved -f $Name - } - } - - # Handle WhatIf case and update resource as appropriate - if ($PSCmdlet.ShouldProcess($successMessage, $null, $null)) - { - # Finally, update the environment path-variable - - if ([String]::IsNullOrEmpty($finalPath)) - { - Remove-EnvVar -Name $Name - } - else - { - Set-EnvVar -Name $Name -Value $finalPath - } - - if($err) - { - Write-Log -Message ($localizedData.EnvVarPathRemoveError -f $Value, $Name, $curVarProperties.$Name) - - throw $err - } - } - } -} - - -#------------------------------- -# The Test-TargetResource cmdlet -#------------------------------- -FUNCTION Test-TargetResource -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [ValidateNotNull()] - [System.String] - $Value, - - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", - - [System.Boolean] - $Path = $false - ) - - $ValueSpecified = $PSBoundParameters.ContainsKey("Value") - $curVarProperties = GetItemProperty $EnvVarRegPathMachine -Name $Name -Expand:(-not $Path) -ErrorAction SilentlyContinue - $currentValueFromEnv = GetEnvironmentVariable -Name $name -Target $EnvironmentVariableTarget.Process - - # ---------------- - # ENSURE = PRESENT - if ($Ensure -ieq "Present") - { - if (($curVarProperties -eq $null) -or (($currentValueFromEnv -eq $null) -and ($curVarProperties.$Name -ne [string]::Empty)) ) - { - # Variable not found, return failure - - Write-Verbose ($localizedData.EnvVarNotFound -f $Name) - - return $false - } - - if (!$ValueSpecified) - { - # No value has been specified for test, so the existence of the variable means success - - Write-Verbose ($localizedData.EnvVarFound -f $Name, $curVarProperties.$Name) - - return $true - } - - if (!$Path) - { - # For this non-path variable, make sure that the specified $Value matches the current value. - # Success if it matches, failure otherwise - - if ($Value -ceq $curVarProperties.$Name) - { - Write-Verbose ($localizedData.EnvVarFound -f $Name, $curVarProperties.$Name) - - return $true - } - else - { - Write-Verbose ($localizedData.EnvVarFoundWithMisMatchingValue -f $Name, $curVarProperties.$Name, $Value) - - return $false - } - } - - # If the control reaches here, the expected environment variable exists, it is a path variable and a $Value is specified to test against - - if (FindPath -ExistingPaths $curVarProperties.$Name -QueryPaths $Value -FindCriteria All) - { - # The specified path was completely present in the existing environment variable, return success - - Write-Verbose ($localizedData.EnvVarFound -f $Name, $curVarProperties.$Name) - - return $true - } - - # If the control reached here some part of the specified path ($Value) was not found in the existing variable, return failure - - Write-Verbose ($localizedData.EnvVarFoundWithMisMatchingValue -f $Name, $curVarProperties.$Name, $Value) - - return $false - } - - # --------------- - # ENSURE = ABSENT - elseif ($Ensure -eq "Absent") - { - if(($curVarProperties -eq $null) -and ($currentValueFromEnv -eq $null)) - { - # Variable not found (path/non-path and $Value both do not matter then), return success - - Write-Verbose ($localizedData.EnvVarNotFound -f $Name) - - return $true - } - - if (!$ValueSpecified) - { - # Given no value has been specified for test, the mere existence of the variable fails the test - - Write-Verbose ($localizedData.EnvVarFound -f $Name, $curVarProperties.$Name) - - return $false - } - - # If the control reaches here: the variable exists and a value has been specified to test against it - - if (!$Path) - { - # For this non-path variable, make sure that the specified value doesn't match the current value - # Success if it doesn't match, failure otherwise - - if ($Value -cne $curVarProperties.$Name) - { - Write-Verbose ($localizedData.EnvVarFoundWithMisMatchingValue -f $Name, $curVarProperties.$Name, $Value) - - return $true - } - else - { - Write-Verbose ($localizedData.EnvVarFound -f $Name, $curVarProperties.$Name) - - return $false - } - } - - # If the control reaches here: the variable exists, it is a path variable, and a value has been specified to test against it - - if (FindPath -ExistingPaths $curVarProperties.$Name -QueryPaths $Value -FindCriteria Any) - { - # One of the specified paths in $Value exists in the environment variable path, thus the test fails - - Write-Verbose ($localizedData.EnvVarFound -f $Name, $curVarProperties.$Name) - - return $false - } - - # If the control reached here, none of the specified paths were found in the existing path-variable, return success - - Write-Verbose ($localizedData.EnvVarFoundWithMisMatchingValue -f $Name, $curVarProperties.$Name, $Value) - - return $true - } -} - - -#---------------------------------------- -# Utility to write WhatIf or Verbose logs -#---------------------------------------- -FUNCTION Write-Log -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Message - ) - - if ($PSCmdlet.ShouldProcess($Message, $null, $null)) - { - Write-Verbose $Message - } -} - - -#----------------------------------- -# Utility to match environment paths -#----------------------------------- -FUNCTION FindPath -{ - param - ( - [System.String] - $ExistingPaths, - - [System.String] - $QueryPaths, - - [parameter(Mandatory = $true)] - [ValidateSet("Any", "All")] - [System.String] - $FindCriteria - ) - - $existingPathList = $ExistingPaths -split ";" - $queryPathList = $QueryPaths -split ";" - - switch ($FindCriteria) - { - "Any" - { - foreach ($queryPath in $queryPathList) - { - if (FindSubPath -QueryPath $queryPath -PathList $existingPathList) - { - # Found this $queryPath in the existing paths, return $true - return $true - } - } - - # If the control reached here, none of the $QueryPaths were found as part of the $ExistingPaths, return $false - return $false - } - - "All" - { - foreach ($queryPath in $queryPathList) - { - $found = $false - if($queryPath) - { - if (!(FindSubPath -QueryPath $queryPath -PathList $existingPathList)) - { - # The current $queryPath wasn't found in any of the $existingPathList, return failure - return $false - } - } - } - - # If the control reached here, all of the $QueryPaths were found as part of the $ExistingPaths, return $true - return $true - } - } -} - - -#--------------------------------------- -# Utility to search a path in a pathlist -#--------------------------------------- -FUNCTION FindSubPath -{ - param - ( - [System.String] - $QueryPath, - - [String[]] - $PathList - ) - - foreach ($path in $PathList) - { - if($QueryPath -ieq $path) - { - # If the query path matches any of the paths in $PathList, return $true - return $true - } - } - - return $false -} - -#--------------------------------------------------------------- -# Utility to get item property without expanding it if necessary -#--------------------------------------------------------------- -FUNCTION GetItemProperty -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path, - - [ValidateNotNull()] - [System.String] - $Name, - - [switch] - $Expand = $false - ) - - if ($Expand) - { - return (Get-ItemProperty $EnvVarRegPathMachine -Name $Name -ErrorAction SilentlyContinue) - } - else - { - if (!(Test-Path -Path $Path)) - { - return $null; - } - - $PathTokens = $Path.Split('\',[System.StringSplitOptions]::RemoveEmptyEntries) - $Division = $PathTokens[0].Replace(':', '') - $Entry = $PathTokens[1..($PathTokens.Count-1)] -join '\' - - # Since the target registry path coming to this function is hardcoded for local machine - $Hive = [Microsoft.Win32.Registry]::LocalMachine - - $NoteProperties = @{} - try - { - $Key = $Hive.OpenSubKey($Entry) - - $ValueNames = $Key.GetValueNames() - if ($ValueNames -inotcontains $Name) - { - return $null - } - - [string] $Value = $Key.GetValue($Name, $null, [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames) - $NoteProperties.Add($Name, $Value) - } - finally - { - if ($key) - { - $key.Close() - } - } - - [System.Management.Automation.PSObject] $PropertyResults = New-Object -TypeName System.Management.Automation.PSObject -Property $NoteProperties - - return $PropertyResults - } -} - -Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/MSFT_EnvironmentResource.schema.mof b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/MSFT_EnvironmentResource.schema.mof deleted file mode 100644 index f83f0f2..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/MSFT_EnvironmentResource.schema.mof and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/ko-KR/MSFT_EnvironmentResource.schema.mfl b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/ko-KR/MSFT_EnvironmentResource.schema.mfl deleted file mode 100644 index f54b711..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/ko-KR/MSFT_EnvironmentResource.schema.mfl and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/ko-KR/MSFT_EnvironmentResource.strings.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/ko-KR/MSFT_EnvironmentResource.strings.psd1 deleted file mode 100644 index 4946bb2..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/ko-KR/MSFT_EnvironmentResource.strings.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/MSFT_GroupResource.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/MSFT_GroupResource.psm1 deleted file mode 100644 index 71686db..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/MSFT_GroupResource.psm1 +++ /dev/null @@ -1,2184 +0,0 @@ -<# -Implementatation notes - -Managing Disposable objects - The types PrincipalContext, Principal, and DirectoryEntry are used througout the code - and all are disposable. However, in many cases, disposing the object immediately - causes subsequent operations to fail or duplicate dispose calls to occur. - To simplify management of these disposables, each public entry point defines a - $disposables ArrayList variable and passes it to secondary functions that may - need to create disposable objects. The public entry point is then required - to dispose the contents of the list in a finally block. - -Managing PrincipalContext instances. - To use the AccountManagement APIs to connect to the local machine or a domain, - a PrincipalContext is needed. - - For the local groups and users, a PrincipalContext reflecting the current user - can be created. - - For the default domain; the domain where the machine is joined, explicit credentials - are needed since the default user context is SYSTEM which has no rights to the - domain. - - Additional PrincipalContext intsances may be needed when the machine is in a domain that is - part of a multi-domain forest. For example, Microsoft uses a multi-domain forest that - includes domains such as ntdev, redmond, wingroup and a group may have members that - span multiple domains. Unless the enterprise implements the Global Catalog; - something that Microsoft does not do; a unique PrincipalContext is needed to resolve - accounts in each of the domains. - - To manage the use of PrincipalContext across domains, public entry points define - a $principalContexts hashtable and pass it to support functions that need to - resolve a group or group member. Consumers of a PrincipalContext call - GetPrincipalContext with a scope (domain name or machine name). GetPrincipalContext - returns an existing hashtable entry or creates a new entry. Note that a PrincipalContext - to a target domain requires connecting to the domain, the hash table avoids subsequent - connection calls. Also note that GetPrincipalContext takes a Credential parameter for the - case where a new PrincipalContext is needed. The implicit assumption is the credentials - provided for the primary domain also has rights to resolve accounts in any of the other domains. - -Resolving Group Members - The original implementation assumed that group members could be resolved using the machine - PrincipalContext or the logged on user. In practice this is not reliable since - the resource is typically run under the system account and this account is not guaranteed - to have rights to resolve domain accounts. Additionally, the API's for enumerating group members - does not provide a facility for passing additional credentials resulting in domain members failing - to resolve. - To address this, group members are enumerated by first converting the GroupPrincipal to a - DirectoryEntry and enumerating its child members. The returned DirectoryEntry instances - are then resolved to Principal objects using a PrincipalContext appropriate for the - target domain. See ResolveGroupMembersToPrincipals for details. - -Handling Stale Group members - A group may have stale members if the machine was moved from one domain to a another, - foreign domain or when accounts are deleted (domain or local). - At this point, members that were defined in the original domain or were deleted are - now stale and cannot be resolved using Principal::FindByIdentity. The original - implementation failed at this point preventing any operations against the group. The - current implementation calls Write-Warning with the associated SID of the member that cannot - be resolved then continues the operation. - -#> - -# A global variable that contains localized messages. -data LocalizedData -{ -# culture="en-US" -ConvertFrom-StringData @' -GroupWithName=Group: {0} -RemoveOperation=Remove -AddOperation=Add -SetOperation=Set -GroupCreated=Group {0} created successfully. -GroupUpdated=Group {0} properties updated successfully. -GroupRemoved=Group {0} removed successfully. -NoConfigurationRequired=Group {0} exists on this node with the desired properties. No action required. -NoConfigurationRequiredGroupDoesNotExist=Group {0} does not exist on this node. No action required. -CouldNotFindPrincipal=Could not find a principal with the provided name [{0}] -MembersAndIncludeExcludeConflict=The {0} and {1} and/or {2} parameters conflict. The {0} parameter should not be used in any combination with the {1} and {2} parameters. -MembersIsNull=The Members parameter value is null. The {0} parameter must be provided if neither {1} nor {2} is provided. -MembersIsEmpty=The Members parameter is empty. At least one group member must be provided. -MemberNotValid=The group member does not exist or cannot be resolved: {0}. -IncludeAndExcludeConflict=The principal {0} is included in both {1} and {2} parameter values. The same principal must not be included in both {1} and {2} parameter values. -IncludeAndExcludeAreEmpty=The MembersToInclude and MembersToExclude are either both null or empty. At least one member must be specified in one of these parameters" -InvalidGroupName=The name {0} cannot be used. Names may not consist entirely of periods and/or spaces, or contain these characters: {1} -GroupExists=A group with the name {0} exists. -GroupDoesNotExist=A group with the name {0} does not exist. -PropertyMismatch=The value of the {0} property is expected to be {1} but it is {2}. -MembersNumberMismatch=Property {0}. The number of provided unique group members {1} is different from the number of actual group members {2}. -MembersMemberMismatch=At least one member {0} of the provided {1} parameter does not have a match in the existing group {2}. -MemberToExcludeMatch=At least one member {0} of the provided {1} parameter has a match in the existing group {2}. -ResolvingLocalAccount=Resolving {0} as a local account. -ResolvingDomainAccount=Resolving {0} in the {1} domain. -ResolvingDomainAccountWithTrust=Resolving {0} with domain trust. -DomainCredentialsRequired=Credentials are required to resolve the domain account {0}. -UnableToResolveAccount=Unable to resolve account '{0}'. Failed with message: {1} (error code={2}) -'@ -} - -Import-Module "$PSScriptRoot\..\RunAsHelper.psm1" - -Import-LocalizedData LocalizedData -FileName MSFT_GroupResource.strings.psd1 - -if (-not (IsNanoServer)) -{ - Add-Type -AssemblyName 'System.DirectoryServices.AccountManagement' -} - -<# -.Synopsis -The Get-TargetResource cmdlet. -#> -function Get-TargetResource -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $GroupName, - - [System.Management.Automation.PSCredential] - $Credential = $null - ) - - if (IsNanoServer) - { - return Get-TargetResourceOnNanoServer @PSBoundParameters - } - else - { - return Get-TargetResourceOnFullSKU @PSBoundParameters - } - -} - -<# -.Synopsis -The Set-TargetResource cmdlet. -#> -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $GroupName, - - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", - - [System.String] - $Description, - - [System.String[]] - $Members, - - [System.String[]] - $MembersToInclude, - - [System.String[]] - $MembersToExclude, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - $Credential - ) - - if (IsNanoServer) - { - Set-TargetResourceOnNanoServer @PSBoundParameters - } - else - { - Set-TargetResourceOnFullSKU @PSBoundParameters - } -} - -<# -.Synopsis -The Test-TargetResource cmdlet is used to validate if the resource is in a state as expected in the instance document. -#> -function Test-TargetResource -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $GroupName, - - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", - - [System.String] - $Description, - - [System.String[]] - $Members, - - [System.String[]] - $MembersToInclude, - - [System.String[]] - $MembersToExclude, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - $Credential - ) - - if (IsNanoServer) - { - return Test-TargetResourceOnNanoServer @PSBoundParameters - } - else - { - return Test-TargetResourceOnFullSKU @PSBoundParameters - } -} - -<# -.Synopsis -The Get-TargetResource cmdlet for Full SKU images. -#> -function Get-TargetResourceOnFullSKU -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $GroupName, - - [System.Management.Automation.PSCredential] - $Credential = $null - ) - - Set-StrictMode -Version Latest - - ValidateGroupName -GroupName $GroupName - - # store disposable objects in a list for cleanup later. - # This is needed for the case where utility functions need to create - # disposable objects (Principal and PrincipalContext) and the - # object's life time is longer than the function. The $disposables - # collection is passed to these functions for storing the disposable objects - # and this function disposes the contents prior to returning. - # See references to DisposeAll for details. - $disposables = New-Object System.Collections.ArrayList - - # hash table of scope to PrincipalContext. This is used for - # cases where the group membership contains entries that span the machine - # and one or more domains. The hashtable's key is the machine or domain - # name (scope) while the value is the PrincipalContext to use to resolve accounts - # within the named scope. - $principalContexts = @{} - - try - { - [System.DirectoryServices.AccountManagement.GroupPrincipal] $group = GetGroup -groupName $GroupName -principalContexts $principalContexts -disposables $disposables - if($group -ne $null) - { - $null = $disposables.Add($group) - - # The group is found. Enumerate all group members. - $members = [String[]]@(EnumerateMembersOnFullSKU -Group $group -principalContexts $principalContexts -disposables $disposables -credential $Credential) - - # Return all group properties and Ensure="Present". - $returnValue = @{ - GroupName = $group.Name; - Ensure = "Present"; - Description = $group.Description; - Members = [System.String[]] $members; - } - - return $returnValue - } - - # The group is not found. Return Ensure=Absent. - return @{ - GroupName = $GroupName; - Ensure = "Absent"; - } - } - finally - { - DisposeAll $disposables - } -} - -<# -.Synopsis -The Set-TargetResource cmdlet for Full SKU images. -#> -function Set-TargetResourceOnFullSKU -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $GroupName, - - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", - - [System.String] - $Description, - - [System.String[]] - $Members, - - [System.String[]] - $MembersToInclude, - - [System.String[]] - $MembersToExclude, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - $Credential - ) - - Set-StrictMode -Version Latest - - ValidateGroupName -GroupName $GroupName - - # store disposable objects in a list for cleanup later. - # This is needed for the case where utility functions need to create - # disposable objects (Principal and PrincipalContext) and the - # object's life time is longer than the function. The $disposables - # collection is passed to these functions for storing the disposable objects - # and this function disposes the contents prior to returning. - # See references to DisposeAll for details. - $disposables = New-Object System.Collections.ArrayList - - # hash table of scope to PrincipalContext. This is used for - # cases where the group membership contains entries that span the machine - # and one or more domains. The hashtable's key is the machine or domain - # name (scope) while the value is the PrincipalContext to use to resolve accounts - # within the named scope. - $principalContexts = @{} - - try - { - # Try to find a group by its name. - [System.DirectoryServices.AccountManagement.GroupPrincipal] $group = GetGroup -groupName $GroupName -principalContexts $principalContexts -disposables $disposables - [bool] $groupExists = $false - - if ($group -ne $null) - { - $groupExists = $true - } - - if($Ensure -eq "Present") - { - [System.DirectoryServices.AccountManagement.Principal[]] $membersToIncludePrincipals = $null - [System.DirectoryServices.AccountManagement.Principal[]] $membersToExcludePrincipals = $null - - if ($group -ne $null) - { - $null = $disposables.Add($group) - } - - # Ensure is set to "Present". - - [bool] $whatIfShouldProcess = $true - [bool] $saveChanges = $false - - if(-not $groupExists) - { - # A group does not exist. Check WhatIf for adding a group. - $whatIfShouldProcess = $pscmdlet.ShouldProcess(($LocalizedData.GroupWithName -f $GroupName), $LocalizedData.AddOperation) - } - else - { - # Check WhatIf for setting a group. - $whatIfShouldProcess = $pscmdlet.ShouldProcess(($LocalizedData.GroupWithName -f $GroupName), $LocalizedData.SetOperation) - } - - if($whatIfShouldProcess) - { - if(-not $groupExists) - { - # NOTE: The PrincipalContext for the local machine is populated above in the call to GetGroup - $localPrincipalContext = $principalContexts[$env:COMPUTERNAME] - - # The group with the provided name does not exist. Add a new group. - $group = New-Object System.DirectoryServices.AccountManagement.GroupPrincipal($localPrincipalContext) - $null = $disposables.Add($group) - - $group.Name = $GroupName - $saveChanges = $true - } - - # Set group properties. - - if($PSBoundParameters.ContainsKey('Description') -and ((-not $groupExists) -or ($Description -ne $group.Description))) - { - $group.Description = $Description - $saveChanges = $true - } - - # NOTE: Group members can be updated in two ways.. - # 1: Supplying the Members parameter - this causes the membership to be replaced with the members defined in Members. - # NOTE: If Members is empty, the group membership is cleared. - # 2: Providing MembersToInclude and/or MembersToExclude - this adds/removes members from the list. - # If Members is mutually exclusive with MembersToInclude and MembersToExclude - # If Members is not defined then MembersToInclude or MembersToExclude must contain at least one entry. - - if($PSBoundParameters.ContainsKey('Members')) - { - if($PSBoundParameters.ContainsKey('MembersToInclude') -or $PSBoundParameters.ContainsKey('MembersToExclude')) - { - # If Members are provided, Include and Exclude are not allowed. - ThrowInvalidArgumentError -ErrorId "GroupTestCmdlet_MembersPlusIncludeOrExcludeConflict" -ErrorMessage ($LocalizedData.MembersAndIncludeExcludeConflict -f "Members","MembersToInclude","MembersToExclude") - } - - if($Members -eq $null) - { - ThrowInvalidArgumentError -ErrorId "GroupTestCmdlet_MembersIsNull" -ErrorMessage ($LocalizedData.MembersIsNull -f "Members","MembersToInclude","MembersToExclude") - } - - if ($Members.Count -eq 0) - { - $group.Members.Clear() - $saveChanges = $true - } - else - { - # Remove duplicate names as strings. - $Members = [String[]]@(RemoveDuplicates -Members $Members) - - # Resolve the names to actual principal objects. - [System.DirectoryServices.AccountManagement.Principal[]]$expectedPrincipals = ResolveNamesToPrincipals -principalContexts $principalContexts -Disposables $disposables -credential $Credential -ObjectNames $Members - - if ($expectedPrincipals.Length -gt 0) - { - $group.Members.Clear() - # Set the contents of the group - if ((AddGroupMembers -Group $group -Principals $expectedPrincipals) -eq $true) - { - $saveChanges = $true - } - } - else - { - #ISSUE: Is an empty $Members parameter valid? - ThrowInvalidArgumentError -ErrorId "GroupSetCmdlet_MembersEmpty" -ErrorMessage ($LocalizedData.MembersIsEmpty) - } - } - } - else - { - [System.DirectoryServices.AccountManagement.Principal[]] $membersToIncludePrincipals = $null - [System.DirectoryServices.AccountManagement.Principal[]] $membersToExcludePrincipals = $null - - if($PSBoundParameters.ContainsKey('MembersToInclude')) - { - $MembersToInclude = [String[]]@(RemoveDuplicates -Members $MembersToInclude) - - # Resolve the names to actual principal objects. - $membersToIncludePrincipals = ResolveNamesToPrincipals -principalContexts $principalContexts -Disposables $disposables -credential $Credential -ObjectNames $MembersToInclude - } - - if($PSBoundParameters.ContainsKey('MembersToExclude')) - { - $MembersToExclude = [String[]]@(RemoveDuplicates -Members $MembersToExclude) - - # Resolve the names to actual principal objects. - $membersToExcludePrincipals = ResolveNamesToPrincipals -principalContexts $principalContexts -Disposables $disposables -credential $Credential -ObjectNames $MembersToExclude - } - - if($membersToIncludePrincipals -ne $null -and $membersToExcludePrincipals -ne $null) - { - # Both MembersToInclude and MembersToExlude were provided. Check if they have common principals. - foreach($includePrincipal in $membersToIncludePrincipals) - { - foreach($excludePrincipal in $membersToExcludePrincipals) - { - if($includePrincipal -eq $excludePrincipal) - { - ThrowInvalidArgumentError -ErrorId "GroupSetCmdlet_IncludeAndExcludeConflict" -ErrorMessage ($LocalizedData.IncludeAndExcludeConflict -f $includePrincipal.SamAccountName,"MembersToInclude", "MembersToExclude") - } - } - } - if ($membersToIncludePrincipals.Length -eq 0 -and $membersToExcludePrincipals.Length -eq 0) - { - ThrowInvalidArgumentError -ErrorId "GroupSetCmdlet_EmptyIncludeAndExclude" -ErrorMessage ($LocalizedData.IncludeAndExcludeAreEmpty) - } - } - - - if ((RemoveGroupMembers -Group $group -Principals $membersToExcludePrincipals) -eq $true) - { - $saveChanges = $true - } - - if ((AddGroupMembers -Group $group -Principals $membersToIncludePrincipals) -eq $true) - { - $saveChanges = $true - } - } - - if($saveChanges) - { - $group.Save() - - # Send an operation success verbose message. - if($groupExists) - { - Write-Verbose -Message ($LocalizedData.GroupUpdated -f $GroupName) - } - else - { - Write-Verbose -Message ($LocalizedData.GroupCreated -f $GroupName) - } - } - else - { - Write-Verbose -Message ($LocalizedData.NoConfigurationRequired -f $GroupName) - } - } - } - else - { - # Ensure is set to "Absent". - if($groupExists -eq $true) - { - # The group exists. - if($pscmdlet.ShouldProcess(($LocalizedData.GroupWithName -f $GroupName), $LocalizedData.RemoveOperation)) - { - # Remove the group by the provided name. - # NOTE: Don't add to $disposables since Delete also disposes. - $group.Delete() - Write-Verbose -Message ($LocalizedData.GroupRemoved -f $GroupName) - } - else - { - $null = $disposables.Add($group) - } - } - else - { - Write-Verbose -Message ($LocalizedData.NoConfigurationRequiredGroupDoesNotExist -f $GroupName) - } - } - } - finally - { - DisposeAll $disposables - } -} - -<# -.Synopsis -The Test-TargetResource cmdlet for Full SKU images is used to validate if the resource is in a state as expected in the instance document. -#> -function Test-TargetResourceOnFullSKU -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $GroupName, - - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", - - [System.String] - $Description, - - [System.String[]] - $Members, - - [System.String[]] - $MembersToInclude, - - [System.String[]] - $MembersToExclude, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - $Credential - ) - - Set-StrictMode -Version Latest - - ValidateGroupName -GroupName $GroupName - - # store disposable objects in a list for cleanup later. - # This is needed for the case where utility functions need to create - # disposable objects (Principal and PrincipalContext) and the - # object's life time is longer than the function. The $disposables - # collection is passed to these functions for storing the disposable objects - # and this function disposes the contents prior to returning. - # See references to DisposeAll for details. - $disposables = New-Object System.Collections.ArrayList - - # hash table of scope to PrincipalContext. This is used for - # cases where the group membership contains entries that span the machine - # and one or more domains. The hashtable's key is the machine or domain - # name (scope) while the value is the PrincipalContext to use to resolve accounts - # within the named scope. - $principalContexts = @{} - - try - { - [System.DirectoryServices.AccountManagement.GroupPrincipal] $group = GetGroup -groupName $GroupName -principalContexts $principalContexts -disposables $disposables - if($group -eq $null) - { - # A group with the provided name does not exist. - Write-Log -Message ($LocalizedData.GroupDoesNotExist -f $GroupName) - - if($Ensure -eq "Absent") - { - return $true - } - else - { - return $false - } - } - $null = $disposables.Add($group) - - # A group with the provided name exists. - Write-Log -Message ($LocalizedData.GroupExists -f $GroupName) - - # Validate separate properties. - if($Ensure -eq "Absent") - { - Write-Log -Message ($LocalizedData.PropertyMismatch -f "Ensure", "Absent", "Present") - return $false # The Ensure property does not match. Return $false - } - - if($PSBoundParameters.ContainsKey('GroupName') -and $GroupName -ne $group.SamAccountName -and $GroupName -ne $group.Sid.Value) - { - return $false # The Name property does not match. Return $false - } - - if($PSBoundParameters.ContainsKey('Description') -and $Description -ne $group.Description) - { - Write-Log -Message ($LocalizedData.PropertyMismatch -f "Description", $Description, $group.Description) - return $false # The Description property does not match. Return $false - } - - if($PSBoundParameters.ContainsKey('Members')) - { - if($PSBoundParameters.ContainsKey('MembersToInclude') -or $PSBoundParameters.ContainsKey('MembersToExclude')) - { - # If Members are provided, Include and Exclude are not allowed. - ThrowInvalidArgumentError -ErrorId "GroupTestCmdlet_MembersPlusIncludeOrExcludeConflict" -ErrorMessage ($LocalizedData.MembersAndIncludeExcludeConflict -f "Members","MembersToInclude","MembersToExclude") - } - - if($Members -eq $null) - { - ThrowInvalidArgumentError -ErrorId "GroupTestCmdlet_MembersIsNull" -ErrorMessage ($LocalizedData.MembersIsNull -f "Members","MembersToInclude","MembersToExclude") - } - - if ($Members.Count -eq 0) - { - if ($group.Members.Count -eq 0) - { - return $true - } - else - { - return $false - } - } - else - { - # Remove duplicate names as strings. - $Members = [String[]]@(RemoveDuplicates -Members $Members) - - # Resolve the names to actual principal objects. - [System.DirectoryServices.AccountManagement.Principal[]] $expectedMembers = ResolveNamesToPrincipals -principalContexts $principalContexts -Disposables $disposables -credential $Credential -ObjectNames $Members - - if($expectedMembers.Length -ne $group.Members.Count) - { - Write-Log -Message ($LocalizedData.MembersNumberMismatch -f "Members", $expectedMembers.Length, $group.Members.Count) - return $false; # The number of provided unique group members is different from the number of actual group members. Return $false. - } - - [System.DirectoryServices.AccountManagement.Principal[]] $actualMembers = ResolveGroupMembersToPrincipals -group $group -principalContexts $principalContexts -disposables $disposables -credential $Credential - - # Compare two members lists. - foreach ($expectedMember in $expectedMembers) - { - $matchFound = $false - - foreach($groupMember in $actualMembers) - { - if($expectedMember -eq $groupMember) - { - $matchFound = $true - break; - } - } - - if(!$matchFound) - { - Write-Log -Message ($LocalizedData.MembersMemberMismatch -f $expectedMember.SamAccountName, "Members", $group.SamAccountName) - return $false # At least one element does not have a match. Return $false - } - } - } - } - else - { - [System.DirectoryServices.AccountManagement.Principal[]] $actualMembers = ResolveGroupMembersToPrincipals -group $group -principalContexts $principalContexts -disposables $disposables -credential $Credential - - if($PSBoundParameters.ContainsKey('MembersToInclude')) - { - $MembersToInclude = [String[]]@(RemoveDuplicates -Members $MembersToInclude) - - # Resolve the names to actual principal objects. - [System.DirectoryServices.AccountManagement.Principal[]] $membersToIncludePrincipals = ResolveNamesToPrincipals -principalContexts $principalContexts -Disposables $disposables -credential $Credential -ObjectNames $MembersToInclude - - # Check if every element in $membersToIncludePrincipals has a match in $group.Members. - # Compare two members lists. - foreach($expectedMember in $membersToIncludePrincipals) - { - $matchFound = $false - - foreach($groupMember in $actualMembers) - { - if($expectedMember -eq $groupMember) - { - $matchFound = $true - break - } - } - - if(!$matchFound) - { - Write-Log -Message ($LocalizedData.MembersMemberMismatch -f $expectedMember.SamAccountName, "MembersToInclude", $group.SamAccountName) - return $false # At least one element from $MembersToInclude does not have a match. Return $false - } - } - } - - if($PSBoundParameters.ContainsKey('MembersToExclude')) - { - $MembersToExclude = [String[]]@(RemoveDuplicates -Members $MembersToExclude); - - # Resolve the names to actual principal objects. - [System.DirectoryServices.AccountManagement.Principal[]] $membersToExcludePrincipals = ResolveNamesToPrincipals -principalContexts $principalContexts -Disposables $disposables -credential $Credential -ObjectNames $MembersToExclude - - foreach($expectedMember in $membersToExcludePrincipals) - { - foreach($groupMember in $actualMembers) - { - if($expectedMember -eq $groupMember) - { - Write-Log -Message ($LocalizedData.MemberToExcludeMatch -f $expectedMember.SamAccountName, "MembersToExclude", $group.SamAccountName) - return $false # At least one element from $MembersToExclude has a match. Return $false - } - } - } - } - } - } - finally - { - DisposeAll $disposables - } - - # All properties match. Return $true. - return $true; -} - -<# -.Synopsis -The Get-TargetResource cmdlet for Nano Server images. -#> -function Get-TargetResourceOnNanoServer -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $GroupName, - - [System.Management.Automation.PSCredential] - $Credential = $null - ) - - Set-StrictMode -Version Latest - - ValidateGroupName -GroupName $GroupName - - try - { - [Microsoft.PowerShell.Commands.LocalGroup] $group = Get-LocalGroup -Name $GroupName -ErrorAction Stop - } - catch [System.Exception] - { - if ($_.CategoryInfo.Reason -eq 'GroupNotFoundException') - { - # The group is not found. Return Ensure=Absent. - return @{ - GroupName = $GroupName; - Ensure = "Absent"; - } - } - Throw-TerminatingError -ErrorRecord $_ - } - - # The group is found. Enumerate all group members. - $members = [String[]](EnumerateMembersOnNanoServer -Group $group) - - # Return all group properties and Ensure="Present". - $returnValue = @{ - GroupName = $group.Name; - Ensure = "Present"; - Description = $group.Description; - Members = [System.String[]] $members; - } - - return $returnValue -} - -<# -.Synopsis -The Set-TargetResource cmdlet for Nano Server images. -#> -function Set-TargetResourceOnNanoServer -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $GroupName, - - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", - - [System.String] - $Description, - - [System.String[]] - $Members, - - [System.String[]] - $MembersToInclude, - - [System.String[]] - $MembersToExclude, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - $Credential - ) - - Set-StrictMode -Version Latest - - ValidateGroupName -GroupName $GroupName - - # Try to find a group by its name. - [bool] $groupExists = $false - try - { - [Microsoft.PowerShell.Commands.LocalGroup] $group = Get-LocalGroup -Name $GroupName -ErrorAction Stop - $groupExists = $true - } - catch [System.Exception] - { - if ($_.CategoryInfo.Reason -eq 'GroupNotFoundException') - { - # A group with the provided name does not exist. - Write-Log -Message ($LocalizedData.GroupDoesNotExist -f $GroupName) - } - else - { - Throw-TerminatingError -ErrorRecord $_ - } - } - - if($Ensure -eq "Present") - { - # Ensure is set to "Present". - if(-not $groupExists) - { - # The group with the provided name does not exist. Add a new group. - New-LocalGroup -Name $GroupName - Write-Verbose -Message ($LocalizedData.GroupCreated -f $GroupName) - } - - # Set group properties. - - if($PSBoundParameters.ContainsKey('Description') -and ((-not $groupExists) -or ($Description -ne $group.Description))) - { - Set-LocalGroup -Name $GroupName -Description $Description - } - - # NOTE: Group members can be updated in two ways.. - # 1: Supplying the Members parameter - this causes the membership to be replaced with the members defined in Members. - # NOTE: If Members is empty, the group membership is cleared. - # 2: Providing MembersToInclude and/or MembersToExclude - this adds/removes members from the list. - # If Members is mutually exclusive with MembersToInclude and MembersToExclude - # If Members is not defined then MembersToInclude or MembersToExclude must contain at least one entry. - - if($PSBoundParameters.ContainsKey('Members')) - { - if($PSBoundParameters.ContainsKey('MembersToInclude') -or $PSBoundParameters.ContainsKey('MembersToExclude')) - { - # If Members are provided, Include and Exclude are not allowed. - ThrowInvalidArgumentError -ErrorId "GroupTestCmdlet_MembersPlusIncludeOrExcludeConflict" -ErrorMessage ($LocalizedData.MembersAndIncludeExcludeConflict -f "Members","MembersToInclude","MembersToExclude") - } - - if($Members -eq $null) - { - ThrowInvalidArgumentError -ErrorId "GroupTestCmdlet_MembersIsNull" -ErrorMessage ($LocalizedData.MembersIsNull -f "Members","MembersToInclude","MembersToExclude") - } - - # Remove duplicate names as strings. - $ExpectedMembers = [String[]]@(RemoveDuplicates -Members $Members) - - if ($ExpectedMembers.Length -gt 0) - { - # Get current members - $CurrentMembers = EnumerateMembersOnNanoServer -Group $group - - # Remove the current members of the group - Remove-LocalGroupMember -Group $GroupName -Member $CurrentMembers - - # Add the list of expected members to the group - Add-LocalGroupMember -Group $GroupName -Member $ExpectedMembers - } - else - { - ThrowInvalidArgumentError -ErrorId "GroupSetCmdlet_MembersEmpty" -ErrorMessage ($LocalizedData.MembersIsEmpty) - } - } - else - { - if($PSBoundParameters.ContainsKey('MembersToInclude')) - { - $MembersToInclude = [String[]]@(RemoveDuplicates -Members $MembersToInclude) - } - - if($PSBoundParameters.ContainsKey('MembersToExclude')) - { - $MembersToExclude = [String[]]@(RemoveDuplicates -Members $MembersToExclude) - } - - if($PSBoundParameters.ContainsKey('MembersToInclude') -and $PSBoundParameters.ContainsKey('MembersToExclude')) - { - # Both MembersToInclude and MembersToExlude were provided. Check if they have common principals. - foreach($includeMember in $MembersToInclude) - { - foreach($excludeMember in $MembersToExclude) - { - if($includeMember -eq $excludeMember) - { - ThrowInvalidArgumentError -ErrorId "GroupSetCmdlet_IncludeAndExcludeConflict" -ErrorMessage ($LocalizedData.IncludeAndExcludeConflict -f $includeMember ,"MembersToInclude", "MembersToExclude") - } - } - } - if ($MembersToInclude.Length -eq 0 -and $MembersToExclude.Length -eq 0) - { - ThrowInvalidArgumentError -ErrorId "GroupSetCmdlet_EmptyIncludeAndExclude" -ErrorMessage ($LocalizedData.IncludeAndExcludeAreEmpty) - } - } - - if($PSBoundParameters.ContainsKey('MembersToInclude')) - { - foreach($includeMember in $MembersToInclude) - { - try - { - Add-LocalGroupMember -Group $GroupName -Member $includeMember -ErrorAction Stop - } - catch [System.Exception] - { - if ($_.CategoryInfo.Reason -ne 'MemberExistsException') - { - throw $_.Exception - } - } - } - } - - if($PSBoundParameters.ContainsKey('MembersToExclude')) - { - foreach($excludeMember in $MembersToExclude) - { - try - { - Remove-LocalGroupMember -Group $GroupName -Member $excludeMember -ErrorAction Stop - } - catch [System.Exception] - { - if ($_.CategoryInfo.Reason -ne 'MemberNotFoundException') - { - Throw-TerminatingError -ErrorRecord $_ - } - } - } - } - } - } - else - { - # Ensure is set to "Absent". - if($groupExists -eq $true) - { - # The group exists. Remove the group by the provided name. - Remove-LocalGroup -Name $GroupName - Write-Verbose -Message ($LocalizedData.GroupRemoved -f $GroupName) - } - else - { - Write-Verbose -Message ($LocalizedData.NoConfigurationRequiredGroupDoesNotExist -f $GroupName) - } - } -} - -<# -.Synopsis -The Test-TargetResource cmdlet for Nano Server images is used to validate if the resource is in a state as expected in the instance document. -#> -function Test-TargetResourceOnNanoServer -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $GroupName, - - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", - - [System.String] - $Description, - - [System.String[]] - $Members, - - [System.String[]] - $MembersToInclude, - - [System.String[]] - $MembersToExclude, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - $Credential - ) - - Set-StrictMode -Version Latest - - ValidateGroupName -GroupName $GroupName - - try - { - [Microsoft.PowerShell.Commands.LocalGroup] $group = Get-LocalGroup -Name $GroupName -ErrorAction Stop - } - catch [System.Exception] - { - if ($_.CategoryInfo.Reason -eq 'GroupNotFoundException') - { - # A group with the provided name does not exist. - Write-Log -Message ($LocalizedData.GroupDoesNotExist -f $GroupName) - - if($Ensure -eq "Absent") - { - return $true - } - else - { - return $false - } - } - Throw-TerminatingError -ErrorRecord $_ - } - - # A group with the provided name exists. - Write-Log -Message ($LocalizedData.GroupExists -f $GroupName) - - # Validate separate properties. - if($Ensure -eq "Absent") - { - Write-Log -Message ($LocalizedData.PropertyMismatch -f "Ensure", "Absent", "Present") - return $false # The Ensure property does not match. Return $false - } - - if($PSBoundParameters.ContainsKey('Description') -and $Description -ne $group.Description) - { - Write-Log -Message ($LocalizedData.PropertyMismatch -f "Description", $Description, $group.Description) - return $false # The Description property does not match. Return $false - } - - if($PSBoundParameters.ContainsKey('Members')) - { - Write-Verbose "Testing members..." - if($PSBoundParameters.ContainsKey('MembersToInclude') -or $PSBoundParameters.ContainsKey('MembersToExclude')) - { - # If Members are provided, Include and Exclude are not allowed. - ThrowInvalidArgumentError -ErrorId "GroupTestCmdlet_MembersPlusIncludeOrExcludeConflict" -ErrorMessage ($LocalizedData.MembersAndIncludeExcludeConflict -f "Members","MembersToInclude","MembersToExclude") - } - - if($Members -eq $null) - { - ThrowInvalidArgumentError -ErrorId "GroupTestCmdlet_MembersIsNull" -ErrorMessage ($LocalizedData.MembersIsNull -f "Members","MembersToInclude","MembersToExclude") - } - - # Remove duplicate names as strings. - $ExpectedMembers = [String[]]@(RemoveDuplicates -Members $Members) - - # Get current members - $CurrentMembers = EnumerateMembersOnNanoServer -Group $group - - if($ExpectedMembers.Length -ne $CurrentMembers.Length) - { - Write-Log -Message ($LocalizedData.MembersNumberMismatch -f "Members", $ExpectedMembers.Length, $CurrentMembers.Length) - return $false; # The number of provided unique group members is different from the number of actual group members. Return $false. - } - - # Compare two members lists. - foreach ($ExpectedMember in $ExpectedMembers) - { - $matchFound = $false - - foreach($groupMember in $CurrentMembers) - { - if($ExpectedMember -eq $groupMember) - { - $matchFound = $true - break; - } - } - - if(-not $matchFound) - { - Write-Log -Message ($LocalizedData.MembersMemberMismatch -f $expectedMember, "Members", $group.Name) - return $false # At least one element does not have a match. Return $false - } - } - } - else - { - # Get current members - $CurrentMembers = EnumerateMembersOnNanoServer -Group $group - - if($PSBoundParameters.ContainsKey('MembersToInclude')) - { - $MembersToInclude = [String[]]@(RemoveDuplicates -Members $MembersToInclude) - - # Check if every element in $membersToIncludePrincipals has a match in $group.Members. - # Compare two members lists. - foreach($expectedMember in $MembersToInclude) - { - $matchFound = $false - - foreach($groupMember in $CurrentMembers) - { - if($expectedMember -eq $groupMember) - { - $matchFound = $true - break - } - } - - if(-not $matchFound) - { - Write-Log -Message ($LocalizedData.MembersMemberMismatch -f $expectedMember, "MembersToInclude", $group.Name) - return $false # At least one element from $MembersToInclude does not have a match. Return $false - } - } - } - - if($PSBoundParameters.ContainsKey('MembersToExclude')) - { - $MembersToExclude = [String[]]@(RemoveDuplicates -Members $MembersToExclude); - - foreach($expectedMember in $MembersToExclude) - { - foreach($groupMember in $CurrentMembers) - { - if($expectedMember -eq $groupMember) - { - Write-Log -Message ($LocalizedData.MemberToExcludeMatch -f $expectedMember, "MembersToExclude", $group.Name) - return $false # At least one element from $MembersToExclude has a match. Return $false - } - } - } - } - } - - # All properties match. Return $true. - return $true; -} - -function RemoveDuplicates -{ - param - ( - [System.String[]] $Members - ) - - Set-StrictMode -Version Latest - - $destIndex = 0; - for([int] $sourceIndex = 0 ; $sourceIndex -lt $Members.Count; $sourceIndex++) - { - $matchFound = $false - for([int] $matchIndex = 0; $matchIndex -lt $destIndex; $matchIndex++) - { - if($Members[$sourceIndex] -eq $Members[$matchIndex]) - { - # A duplicate is found. Discard the duplicate. - $matchFound = $true - continue - } - } - - if(!$matchFound) - { - $Members[$destIndex++] = $Members[$sourceIndex].ToLowerInvariant(); - } - } - - # Create the output array. - $destination = New-Object System.String[] -ArgumentList $destIndex - - # Copy only distinct elements from the original array to the destination array. - [System.Array]::Copy($Members, $destination, $destIndex); - - if ($destIndex -gt 0) - { - return $destination - } - return [System.String[]]@() -} - -function EnumerateMembersOnNanoServer -{ - [OutputType([System.String[]])] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - [Microsoft.PowerShell.Commands.LocalGroup] - $Group - ) - - Set-StrictMode -Version Latest - [System.Collections.ArrayList] $members = New-Object System.Collections.ArrayList - - # Get the group members. - $groupmembers = Get-LocalGroupMember -Group $Group - - foreach($member in $groupmembers) - { - if ($member.PrincipalSource -eq "Local") - { - $null = $members.Add($member.Name.Substring($member.Name.IndexOf("\")+1)) - } - else - { - Write-Verbose "$($member.Name) is not a local user (PrincipalSource = $($member.PrincipalSource))" - } - } - - if ($members.Count -gt 0) - { - return $members.ToArray() - } - return ,([System.String[]]@()) -} - -function EnumerateMembersOnFullSKU -{ - [OutputType([System.String[]])] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.DirectoryServices.AccountManagement.GroupPrincipal] - $group, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - $principalContexts, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.Collections.ArrayList] - $disposables, - - [System.Net.NetworkCredential] - $credential = $null - ) - - Set-StrictMode -Version Latest - [System.Collections.ArrayList] $members = New-Object System.Collections.ArrayList - - # Get the group members as Principal objects. - [System.DirectoryServices.AccountManagement.Principal[]] $principals = ResolveGroupMembersToPrincipals -group $group -principalContexts $principalContexts -disposables $disposables -credential $credential - - foreach($principal in $principals) - { - if($principal.ContextType -eq [System.DirectoryServices.AccountManagement.ContextType]::Domain) - { - # Select only the first part of the full domain name. - [String]$domainName = $principal.Context.Name; - [int] $separatorIndex = $domainName.IndexOf('.') - if ($separatorIndex -ne -1) - { - $domainName = $domainName.Substring(0, $separatorIndex) - } - - if($principal.StructuralObjectClass -eq "computer") - { - $null = $members.Add($domainName+'\'+$principal.Name) - } - else - { - $null = $members.Add($domainName+'\'+$principal.SamAccountName) - } - } - else - { - $null = $members.Add($principal.Name) - } - } - - return $members.ToArray() -} - -<# -.Synopsis - Resolves the members of a group to Principal instances. -#> -function ResolveGroupMembersToPrincipals -{ - [OutputType([System.DirectoryServices.AccountManagement.Principal[]])] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.DirectoryServices.AccountManagement.GroupPrincipal] - $group, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - $principalContexts, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.Collections.ArrayList] - $disposables, - - [System.Net.NetworkCredential] - $credential = $null - ) - Set-StrictMode -Version latest - - [System.Collections.ArrayList] $principals = New-Object System.Collections.ArrayList - - # NOTE: This logic enumerates the group members using the underlying DirectoryEntry API. - # The reason this is needed is due to the fact that enumerating the group - # members as principal instances causes a resolve to occur. Since there is no - # facility for passing credentials to perform the resolution, any members that - # cannot be resolved using the current user will fail; such as when the DSC - # Group resource runs as system. Dropping down to the underyling API - # allows us to access the account's SID which can then be used to - # resolve the associated principal using explicit credentials. - [System.DirectoryServices.DirectoryEntry] $groupDe = $group.GetUnderlyingObject() - - $enum = $groupDe.Invoke("Members") - foreach ($item in $enum) - { - [string] $scope = $null - [string] $accountName = $null - [string] $machineName = $env:COMPUTERNAME - [System.DirectoryServices.AccountManagement.Principal] $principal = $null - - # extract the objectSid from the underlying DirectoryEntry - [System.DirectoryServices.DirectoryEntry] $entry = New-Object System.DirectoryServices.DirectoryEntry($item) - [byte[]] $sidBytes = $entry.Properties["objectSid"].Value - - $null = $disposables.Add($entry) - - [string[]] $parts = $entry.Path.Split("/") - - if ($parts.Count -eq 4) - { - # parsing WinNT://domainname/accountname - # or WinNT://machinename/accountname - $scope = $parts[2] - $accountName = $parts[3] - } - elseif ($parts.Count -eq 5) - { - # parsing WinNT://domainname/machinename/accountname - $scope = $parts[3] - $accountName = $parts[4] - } - else - { - # the account is stale either becuase it was deleted or - # the machine was moved to a new domain without removing - # the domain members from the group. - # If we consider this a fatal error, the group is no longer - # managable by the DSC resource. Writing a warning allows - # the operation to complete while leaving the stale member in the - # group. - Write-Warning -Message ($LocalizedData.MemberNotValid -f $entry.Path) - continue - } - - - [bool] $isLocalMachine = [System.String]::CompareOrdinal($scope, $machineName) -eq 0 - - $principalContext = GetPrincipalContext -principalContexts $principalContexts -disposables $disposables -scope $scope -credential $credential - - # if local machine qualified, get the PrincipalContext for the local machine - if ($isLocalMachine -eq $true) - { - Write-Verbose -Message ($LocalizedData.ResolvingLocalAccount -f $accountName) - } - # the account is domain qualified - credentials required to resolve it. - elseif ($credential -ne $null -or $principalContext -ne $null) - { - Write-Verbose -Message ($LocalizedData.ResolvingDomainAccount -f $scope, $accountName) - } - else - { - # The provided name is not scoped to the local machine and no credentials were provided. - # This is an unsupported use case; credentials are required to resolve off-box. - ThrowInvalidArgumentError -ErrorId "PrincipalNotFoundNoCredential" -ErrorMessage ($LocalizedData.DomainCredentialsRequired -f $accountName) - } - - # create a sid to enable comparison againt the expected member's sid. - [System.Security.Principal.SecurityIdentifier] $sid = New-Object System.Security.Principal.SecurityIdentifier($sidBytes, 0) - - $principal = ResolveSidToPrincipal -principalContext $principalContext -sid $sid -isLocalMachineQualified $isLocalMachine - $null = $principals.Add($principal) - $null = $disposables.Add($principal) - } - - return $principals.ToArray() -} - -<# -.Synopsis - Resolves an array of object names to Principal instances. -#> -function ResolveNamesToPrincipals -{ - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [String[]] $objectNames, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.Collections.ArrayList] $disposables, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - $principalContexts, - - [System.Net.NetworkCredential] - $credential = $null - ) - Set-StrictMode -Version Latest - - [System.Collections.ArrayList] $principals = New-Object System.Collections.ArrayList - $keys = @{} - - foreach($objectName in $objectNames) - { - $principal = ResolveNameToPrincipal -principalContexts $principalContexts -credential $credential -disposables $disposables -objectName $objectName - if ($principal -ne $null) - { - [string] $key = $null - # handle duplicate entries - if ($principal.ContextType -eq [System.DirectoryServices.AccountManagement.ContextType]::Domain) - { - $key = $principal.DistinguishedName - } - else - { - $key = $principal.SamAccountName - } - if ($keys.ContainsKey($key) -eq $false) - { - $keys.Add($key, $null) - $null = $principals.Add($principal) - } - } - } - - $keys.Clear() - return $principals.ToArray() -} - -<# -.Synopsis - resolves an object name to a Principal -#> -function ResolveNameToPrincipal -{ - [OutputType([System.DirectoryServices.AccountManagement.Principal])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - $principalContexts, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - $disposables, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $objectName, - - [System.Net.NetworkCredential] - $credential = $null - - ) - Set-StrictMode -Version Latest - - [string] $accountName = $null - - # the scope of the the object name when in the form of scope\name, UPN, or DN - [string] $scope = Parse-Scope -fullName $objectName -accountName ([ref] $accountName) - - # check for an object qualified to the local machine - [bool] $isLocalMachine = IsLocalMachine $scope - - [System.DirectoryServices.AccountManagement.PrincipalContext] $principalContext = $null - [bool] $UseDomainTrust = $false - - # if local machine qualified, get the PrincipalContext for the local machine - if ($isLocalMachine -eq $true) - { - Write-Verbose -Message ($LocalizedData.ResolvingLocalAccount -f $objectName) - } - # the account is domain qualified - credentials provided to resolve it. - elseif ($credential -ne $null) - { - Write-Verbose -Message ($LocalizedData.ResolvingDomainAccount -f $ObjectName, $scope) - } - # no credentials provided to resolve account name, so try with domain trust - else - { - # The provided name is not scoped to the local machine and no credentials were provided. - # If the object is a domain qualified name, we can try to resolve the user with domain trust, if setup. - $UseDomainTrust = $true - Write-Verbose -Message ($LocalizedData.ResolvingDomainAccountWithTrust -f $objectName) - } - - # Get a PrincipalContext to use to resolve the object - $principalContext = GetPrincipalContext -principalContexts $principalContexts -disposables $disposables -scope $scope -credential $credential - - if ($UseDomainTrust) - { - # When using domain trust, we use the object name to resolve. Object name can be in different formats such as a domain - # qualified name, UPN, or a distinguished name for the scope - $account = $objectName - } - else - { - $account = $accountName - } - - try - { - [System.DirectoryServices.AccountManagement.Principal] $principal = [System.DirectoryServices.AccountManagement.Principal]::FindByIdentity($principalContext, $account) - } - catch [System.Runtime.InteropServices.COMException] - { - ThrowInvalidArgumentError -ErrorId "PrincipalNotFound" -ErrorMessage ( $LocalizedData.UnableToResolveAccount -f $objectName, $_.Exception.Message, $_.Exception.HResult ) - } - - if ($principal -eq $null) - { - [string] $errorId = $null - if ($isLocalMachine) - { - $errorId = "PrincipalNotFound_LocalMachine" - } - else - { - $errorId = "PrincipalNotFound_ProvidedCredential" - } - - ThrowInvalidArgumentError -ErrorId $errorId -ErrorMessage ($LocalizedData.CouldNotFindPrincipal -f $objectName) - } - - return $principal -} - -<# -.Synopsis - Resolves a SID to a principal -#> -function ResolveSidToPrincipal -{ - [OutputType([System.DirectoryServices.AccountManagement.Principal])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.DirectoryServices.AccountManagement.PrincipalContext] $principalContext, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.Security.Principal.SecurityIdentifier] $sid, - - [Parameter(Mandatory = $true)] - [bool] $isLocalMachineQualified - ) - Set-StrictMode -Version Latest - - [string] $sidValue = $Sid.Value - - # Try to find a matching principal. - $principal = [System.DirectoryServices.AccountManagement.Principal]::FindByIdentity($principalContext, [System.DirectoryServices.AccountManagement.IdentityType]::Sid, $sidValue) - - if ($principal -eq $null) - { - [string] $errorId = $null - if ($isLocalMachineQualified) - { - $errorId = "PrincipalNotFound_LocalMachine" - } - else - { - $errorId = "PrincipalNotFound_ProvidedCredential" - } - - ThrowInvalidArgumentError -ErrorId $errorId -ErrorMessage ($LocalizedData.CouldNotFindPrincipal -f $sid.ToString()) - } - - return $principal -} - -<# -.Synopsis - Gets a PrincipalContext to use to resolve an object in the specified $scope - $principalContexts is a hashtable of scope to PrincipalContext. This is used to - cache PrincipalContext instances for cases where it is used multiple times. - disposables is an array of disposable objects. When a new PrincipalContext is - created, it is added to the disposable list as well as the hashtable. - $credential is used when a new PrincipalContext needs to be created with explicit - credentials to a target domain -#> -function GetPrincipalContext -{ - [OutputType([System.DirectoryServices.AccountManagement.PrincipalContext])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - $principalContexts, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - $disposables, - - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [object] $scope, - - [System.Net.NetworkCredential] - $credential = $null - ) - - # The PrincipalContext to use to resolve the account - [System.DirectoryServices.AccountManagement.PrincipalContext] $principalContext = $null - - # check for an object qualified to the local machine - [bool] $isLocalMachine = [System.String]::Compare($env:COMPUTERNAME, $scope) -eq 0 - - if ($isLocalMachine) - { - # check for a cached PrincipalContext for the local machine. - if ($principalContexts.ContainsKey($env:COMPUTERNAME)) - { - $principalContext = $principalContexts[$env:COMPUTERNAME] - } - else - { - # Create a PrincipalContext for the local machine - $principalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::Machine) - - # Cache the PrincipalContext for this scope for subsequent calls. - $principalContexts.Add($env:COMPUTERNAME, $principalContext) - $null = $disposables.Add($principalContext) - } - } - elseif ($principalContexts.ContainsKey($scope)) - { - $principalContext = $principalContexts[$scope] - } - elseif ($credential -ne $null) - { - # Create a PrincipalContext targeing $scope using the network credentials that were passed in. - - $name = [System.String]::Format("{0}\{1}", $credential.Domain, $credential.UserName) - $principalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::Domain, $scope, $name, $credential.Password) - - # Cache the PrincipalContext for this scope for subsequent calls. - $principalContexts.Add($scope, $principalContext) - $null = $disposables.Add($principalContext) - } - else - { - # Get a PrincipalContext for the current user in the target domain (even for local System account). - $principalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::Domain, $scope) - - # Cache the PrincipalContext for this scope for subsequent calls. - $principalContexts.Add($scope, $principalContext) - $null = $disposables.Add($principalContext) - } - - return $principalContext -} - - -<# -.Synopsis - Adds the entries defined in $Principals from $Group.Members. - Returns $true if the members changed (i.e., members were added); - otherwise, $false if all of the entries in $Principals were already present - in $Group.Members -#>function AddGroupMembers -{ - [OutputType([bool])] - param - ( - [System.DirectoryServices.AccountManagement.GroupPrincipal] $Group, - - [System.DirectoryServices.AccountManagement.Principal[]] $Principals - ) - Set-StrictMode -Version Latest - [bool] $updated = $false - - if ($Principals -ne $null) - { - # Make changes to the group. - foreach($principal in $Principals) - { - if ($group.Members.Contains($principal)) - { - continue - } - $group.Members.Add($principal) - # indicate a change was made to $Group.Members - $updated = $true - } - } - return $updated -} - -<# -.Synopsis - Removes the entries defined in $Principals from $Group.Members. - Returns $true if the members changed (i.e., members were removed); - otherwise, $false if none of the entries in $Principals were present - in $Group.Members -#> -function RemoveGroupMembers -{ - [OutputType([bool])] - param - ( - [System.DirectoryServices.AccountManagement.GroupPrincipal] $Group, - - [System.DirectoryServices.AccountManagement.Principal[]] $Principals - ) - Set-StrictMode -Version Latest - [bool] $updated = $false - - if ($Principals -ne $null) - { - # Make changes to the group. - foreach($principal in $Principals) - { - if ($group.Members.Remove($principal) -eq $true) - { - # indicated a change was made to the members. - $updated = $true - } - } - } - - return $updated -} - -#region Utilities - -<# -.Synopsis - Determines if a scope represents the current machine. -#> -function IsLocalMachine -{ - [OutputType([bool])] - param - ( - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [string] - $scope - ) - Set-StrictMode -Version latest - - if ($scope -eq ".") - { - return $true - } - - if ($scope -eq $env:COMPUTERNAME) - { - return $true - } - - if ($scope -eq "localhost") - { - return $true - } - - if ($scope.Contains(".")) - { - if ($scope -eq "127.0.0.1") - { - return $true - } - - # Determine if we have an ip address that matches an ip address on one of the - # network adapters. - # NOTE: This is likely overkill; consider removing it. - $items = @(Get-WmiObject Win32_NetworkAdapterConfiguration) - foreach ($item in $items) - { - if ($item.IPaddress -ne $null) - { - foreach ($addr in $item.IPaddress) - { - if ($addr -eq $scope) - { - return $true - } - } - } - } - } - return $false -} - -<# -.Synopsis - Determines if a specified domain is the same as the domain defined in a PrincipalContext. - This is used to determine if a new connection (PrincipalContext) needs to be created. - -.Notes - This method uses simple string compare and simple parsing to perform the match and - should only be used to determine if a new connection is required since some - comparisons may returned $false due to formatting differences. -#> -function IsSameDomain -{ - [OutputType([bool])] - param - ( - [Parameter(Mandatory=$true)] - [ValidateNotNull()] - [System.DirectoryServices.AccountManagement.PrincipalContext] $principalContext, - - [Parameter(Mandatory=$true)] - [ValidateNotNull()] - [String] $domain - ) - Set-StrictMode -Version latest - - # Compare against Name of $principalContext - typically the undecorated domain name - [bool] $isSameDomain = [System.String]::Compare($domain, $principalContext.Name, [System.StringComparison]::OrdinalIgnoreCase) -eq 0 - - if ($isSameDomain -eq $false) - { - $dotIndex = $principalContext.ConnectedServer.IndexOf(".") - if ($dotIndex -ne -1) - { - $principalDomain = $principalContext.ConnectedServer.Substring($dotIndex + 1) - $isSameDomain = [System.String]::Compare($domain, $principalDomain, [System.StringComparison]::OrdinalIgnoreCase) -eq 0 - } - } - - return $isSameDomain -} - -<# -.Synopsis - Parses various object name formats to extract the machine or domain scope. - - The returned $scope is used to determine where to perform the resolution, - the local machine or a target domain while $accountName is the name - of the account to resolve. - - The following details the formats that are handled as well as how the - values are determined. - - Domain qualified names (domainname\username) - - The value is split on the first '\' character with the left hand side - returned as the scope and the right hand side is returned as the account name. - - UPN: (username@domainname) - - The value is split on the first '@' character with the left hand side - returned as the account name and the right hand side returned - as the scope - - DistinguishedName: - - The value at the first occurance of "DC=" is used to extract the unqualified - domain name. The incoming string is returned, as is, for the account - name. - - Unqualified account names: - - The incoming string is returned as the account name and the local - machine name is returned as the scope. Note that values that do - not fall into the above categories are interpreted as unqualified - account names. - -.Notes - ResolveNameToPrincipal will fail if a machine name is specified - as domainname\machinename. It will succeed if the machine name - is specified as the SAM name (domainname\machinename$) or - as the unqualified machine name. - Parse-Scope splits the scope and account name to avoid - the problem. -#> -function Parse-Scope -{ - [OutputType([string])] - param - ( - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [string] - $fullName, - - [Parameter(Mandatory=$true)] - [AllowEmptyString()] - [AllowNull()] - [ref] $accountName - ) - Set-StrictMode -Version latest - - # assume no scope is defined or $fullName is a DistinguishedName - $accountName.Value = $fullName - - # parse domain or machine qualified account name - [int] $separatorIndex = $fullName.IndexOf("\") - if ($separatorIndex -ne -1) - { - $scope = $fullName.Substring(0, $separatorIndex) - if (IsLocalMachine $scope) - { - $scope = $env:COMPUTERNAME - } - $accountName.Value = $fullName.Substring($separatorIndex+1) - return $scope - } - - # parse UPN for the scope - $separatorIndex = $fullName.IndexOf("@") - if ($separatorIndex -ne -1) - { - $scope = $fullName.Substring($separatorIndex + 1) - $accountName.Value = $fullName.Substring(0,$separatorIndex) - return $scope - } - - # parse distinguished name for the scope - $separatorIndex = $fullName.IndexOf("DC=", [System.StringComparison]::OrdinalIgnoreCase) - if ($separatorIndex -ne -1) - { - # NOTE: For distinguished name formats, the DistinguishedName is - # returned as the account name. See the initialization of $accountName - # above. - $startIndex = $separatorIndex + 3 - $endIndex = $fullName.IndexOf(",", $startIndex) - if ($endIndex -gt $startIndex) - { - $length = $endIndex - $separatorIndex - 3 - $scope = $fullName.Substring($startIndex, $length) - return $scope - } - } - return $env:COMPUTERNAME -} - -<# -.Synopsis - Disposes the contents of an array list containing IDisposable objects. -#> -function DisposeAll -{ - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [AllowEmptyCollection()] - [System.Collections.ArrayList] - $disposables - ) - Set-StrictMode -Version latest - - if ($disposables.Count -gt 0) - { - foreach ($disposable in $disposables) - { - if ($disposable -is [System.IDisposable]) - { - $disposable.Dispose() - } - } - } -} - -<# -.Synopsis - Gets a local windows group - -.Notes - The returned value is NOT added to the $disposables list. -#> -function GetGroup -{ - [OutputType([System.DirectoryServices.AccountManagement.GroupPrincipal])] - param - ( - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $groupName, - - [Parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.Collections.ArrayList] - [AllowEmptyCollection()] - $disposables, - - [Parameter(Mandatory = $true)] - [AllowEmptyCollection()] - $principalContexts - ) - - [System.DirectoryServices.AccountManagement.PrincipalContext] $principalContext = GetPrincipalContext -principalContexts $principalContexts -disposables $disposables -scope $env:COMPUTERNAME -credential $null - [System.DirectoryServices.AccountManagement.GroupPrincipal] $group = [System.DirectoryServices.AccountManagement.GroupPrincipal]::FindByIdentity($principalContext, $groupName) - # NOTE: $group is not automatically added to $disposables because the caller - # may need to call $group.Delete() which also disposes it. - return $group -} - -<# -.Synopsis -Validates the Group name for invalid characters. -#> -function ValidateGroupName -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $GroupName - ) - - # Check if the name consists of only periods and/or white spaces. - [bool] $wrongName = $true - - for($i = 0; $i -lt $GroupName.Length; $i++) - { - if(-not [Char]::IsWhiteSpace($GroupName, $i) -and $GroupName[$i] -ne '.') - { - $wrongName = $false - break - } - } - - $invalidChars = @('\','/','"','[',']',':','|','<','>','+','=',';',',','?','*','@') - - if($wrongName) - { - ThrowInvalidArgumentError -ErrorId "GroupNameHasOnlyWhiteSpacesAndDots" -ErrorMessage ($LocalizedData.InvalidGroupName -f $GroupName, [string]::Join(" ", $invalidChars)) - } - - if($GroupName.IndexOfAny($invalidChars) -ne -1) - { - ThrowInvalidArgumentError -ErrorId "GroupNameHasInvalidCharachter" -ErrorMessage ($LocalizedData.InvalidGroupName -f $GroupName, [string]::Join(" ", $invalidChars)) - } -} - -<# -.Synopsis -Throws an argument error. -#> -function ThrowInvalidArgumentError -{ - [CmdletBinding()] - param - ( - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ErrorId, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ErrorMessage - ) - - $errorCategory=[System.Management.Automation.ErrorCategory]::InvalidArgument - $exception = New-Object System.ArgumentException $ErrorMessage; - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $ErrorId, $errorCategory, $null - throw $errorRecord -} - -Function Throw-TerminatingError -{ - param( - [string] $Message, - [System.Management.Automation.ErrorRecord] $ErrorRecord, - [string] $ExceptionType - ) - - $exception = new-object "System.InvalidOperationException" $Message,$ErrorRecord.Exception - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception,"MachineStateIncorrect","InvalidOperation",$null - throw $errorRecord -} - -<# -.Synopsis -Writes either to Verbose or ShouldProcess channel. -#> -function Write-Log -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Message - ) - - if ($PSCmdlet.ShouldProcess($Message, $null, $null)) - { - Write-Verbose $Message - } -} - -#endregion - -Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/MSFT_GroupResource.schema.mof b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/MSFT_GroupResource.schema.mof deleted file mode 100644 index 9481126..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/MSFT_GroupResource.schema.mof and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/ko-KR/MSFT_GroupResource.schema.mfl b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/ko-KR/MSFT_GroupResource.schema.mfl deleted file mode 100644 index 6d9e2a1..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/ko-KR/MSFT_GroupResource.schema.mfl and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/ko-KR/MSFT_GroupResource.strings.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/ko-KR/MSFT_GroupResource.strings.psd1 deleted file mode 100644 index cc1d372..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/ko-KR/MSFT_GroupResource.strings.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_LogResource/MSFT_LogResource.schema.mof b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_LogResource/MSFT_LogResource.schema.mof deleted file mode 100644 index 9216888..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_LogResource/MSFT_LogResource.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ -#pragma namespace("\\\\.\\root\\microsoft\\windows\\DesiredstateConfiguration") - -[ClassVersion("1.0.0"),FriendlyName("Log")] -class MSFT_LogResource : OMI_BaseResource -{ - [required] string Message; -}; diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_LogResource/ko-KR/MSFT_LogResource.schema.mfl b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_LogResource/ko-KR/MSFT_LogResource.schema.mfl deleted file mode 100644 index 6cc19d8..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_LogResource/ko-KR/MSFT_LogResource.schema.mfl and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/MSFT_PackageResource.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/MSFT_PackageResource.psm1 deleted file mode 100644 index c0b606e..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/MSFT_PackageResource.psm1 +++ /dev/null @@ -1,811 +0,0 @@ -data LocalizedData -{ - # culture="en-US" - # TODO: Support WhatIf - ConvertFrom-StringData @' -InvalidIdentifyingNumber=The specified IdentifyingNumber ({0}) is not a valid Guid -InvalidPath=The specified Path ({0}) is not in a valid format. Valid formats are local paths, UNC, and HTTP -InvalidNameOrId=The specified Name ({0}) and IdentifyingNumber ({1}) do not match Name ({2}) and IdentifyingNumber ({3}) in the MSI file -NeedsMoreInfo=Either Name or ProductId is required -InvalidBinaryType=The specified Path ({0}) does not appear to specify an EXE or MSI file and as such is not supported -CouldNotOpenLog=The specified LogPath ({0}) could not be opened -CouldNotStartProcess=The process {0} could not be started -UnexpectedReturnCode=The return code {0} was not expected. Configuration is likely not correct -PathDoesNotExist=The given Path ({0}) could not be found -CouldNotOpenDestFile=Could not open the file {0} for writing -CouldNotGetHttpStream=Could not get the {0} stream for file {1} -ErrorCopyingDataToFile=Encountered error while writing the contents of {0} to {1} -PackageConfigurationComplete=Package configuration finished -PackageConfigurationStarting=Package configuration starting -InstalledPackage=Installed package -UninstalledPackage=Uninstalled package -NoChangeRequired=Package found in desired state, no action required -RemoveExistingLogFile=Remove existing log file -CreateLogFile=Create log file -MountSharePath=Mount share to get media -DownloadHTTPFile=Download the media over HTTP or HTTPS -StartingProcessMessage=Starting process {0} with arguments {1} -RemoveDownloadedFile=Remove the downloaded file -PackageInstalled=Package has been installed -PackageUninstalled=Package has been uninstalled -MachineRequiresReboot=The machine requires a reboot -PackageDoesNotAppearInstalled=The package {0} is not installed -PackageAppearsInstalled=The package {0} is installed -PostValidationError=Package from {0} was installed, but the specified ProductId and/or Name does not match package details -ValidateStandardArgumentsPathwasPath = Validate-StandardArguments, Path was {0} -TheurischemewasuriScheme = The uri scheme was {0} -ThepathextensionwaspathExt = The path extension was {0} -ParsingProductIdasanidentifyingNumber = Parsing {0} as an identifyingNumber -ParsedProductIdasidentifyingNumber = Parsed {0} as {1} -EnsureisEnsure = Ensure is {0} -productisproduct = product {0} found -productasbooleanis = product as boolean is {0} -Creatingcachelocation = Creating cache location -NeedtodownloadfilefromschemedestinationwillbedestName = Need to download file from {0}, destination will be {1} -Creatingthedestinationcachefile = Creating the destination cache file -Creatingtheschemestream = Creating the {0} stream -Settingdefaultcredential = Setting default credential -Settingauthenticationlevel = Setting authentication level -Ignoringbadcertificates = Ignoring bad certificates -Gettingtheschemeresponsestream = Getting the {0} response stream -ErrorOutString = Error: {0} -Copyingtheschemestreambytestothediskcache = Copying the {0} stream bytes to the disk cache -Redirectingpackagepathtocachefilelocation = Redirecting package path to cache file location -ThebinaryisanEXE = The binary is an EXE -Userhasrequestedloggingneedtoattacheventhandlerstotheprocess = User has requested logging, need to attach event handlers to the process -StartingwithstartInfoFileNamestartInfoArguments = Starting {0} with {1} -'@ -} - -Import-LocalizedData LocalizedData -filename PackageProvider.psd1 - - -$Debug = $true -Function Trace-Message -{ - param([string] $Message) - if($Debug) - { - Write-Verbose $Message - } -} - -$CacheLocation = "$env:ProgramData\Microsoft\Windows\PowerShell\Configuration\BuiltinProvCache\MSFT_PackageResource" - -Function Throw-InvalidArgumentException -{ - param( - [string] $Message, - [string] $ParamName - ) - - $exception = new-object System.ArgumentException $Message,$ParamName - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception,$ParamName,"InvalidArgument",$null - throw $errorRecord -} - -Function Throw-InvalidNameOrIdException -{ - param( - [string] $Message - ) - - $exception = new-object System.ArgumentException $Message - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception,"NameOrIdNotInMSI","InvalidArgument",$null - throw $errorRecord -} - -Function Throw-TerminatingError -{ - param( - [string] $Message, - [System.Management.Automation.ErrorRecord] $ErrorRecord - ) - - $exception = new-object "System.InvalidOperationException" $Message,$ErrorRecord.Exception - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception,"MachineStateIncorrect","InvalidOperation",$null - throw $errorRecord -} - -Function Validate-StandardArguments -{ - param( - $Path, - $ProductId, - $Name - ) - - Trace-Message ($LocalizedData.ValidateStandardArgumentsPathwasPath -f $Path) - $uri = $null - try - { - $uri = [uri] $Path - } - catch - { - Throw-InvalidArgumentException ($LocalizedData.InvalidPath -f $Path) "Path" - } - - if(-not @("file", "http", "https") -contains $uri.Scheme) - { - Trace-Message ($Localized.TheurischemewasuriScheme -f $uri.Scheme) - Throw-InvalidArgumentException ($LocalizedData.InvalidPath -f $Path) "Path" - } - - $pathExt = [System.IO.Path]::GetExtension($Path) - Trace-Message ($LocalizedData.ThepathextensionwaspathExt -f $pathExt) - if(-not @(".msi",".exe") -contains $pathExt.ToLower()) - { - Throw-InvalidArgumentException ($LocalizedData.InvalidBinaryType -f $Path) "Path" - } - - $identifyingNumber = $null - if(-not $Name -and -not $ProductId) - { - #It's a tossup here which argument to blame, so just pick ProductId to encourage customers to use the most efficient version - Throw-InvalidArgumentException ($LocalizedData.NeedsMoreInfo -f $Path) "ProductId" - } - elseif($ProductId) - { - try - { - Trace-Message ($LocalizedData.ParsingProductIdasanidentifyingNumber -f $ProductId) - $identifyingNumber = "{{{0}}}" -f [Guid]::Parse($ProductId).ToString().ToUpper() - Trace-Message ($LocalizedData.ParsedProductIdasidentifyingNumber -f $ProductId, $identifyingNumber) - } - catch - { - Throw-InvalidArgumentException ($LocalizedData.InvalidIdentifyingNumber -f $ProductId) $ProductId - } - } - - return $uri, $identifyingNumber -} - -Function Get-ProductEntry -{ - param - ( - [string] $Name, - [string] $IdentifyingNumber - ) - - $uninstallKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" - $uninstallKeyWow64 = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" - - if($IdentifyingNumber) - { - $keyLocation = "$uninstallKey\$identifyingNumber" - $item = Get-Item $keyLocation -EA SilentlyContinue - if(-not $item) - { - $keyLocation = "$uninstallKeyWow64\$identifyingNumber" - $item = Get-Item $keyLocation -EA SilentlyContinue - } - - return $item - } - - foreach($item in (Get-ChildItem -EA Ignore $uninstallKey, $uninstallKeyWow64)) - { - if($Name -eq (Get-LocalizableRegKeyValue $item "DisplayName")) - { - return $item - } - } - - return $null -} - -function Test-TargetResource -{ - param - ( - [ValidateSet("Present", "Absent")] - [string] $Ensure = "Present", - - [parameter(Mandatory = $true)] - [AllowEmptyString()] - [string] $Name, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $Path, - - [parameter(Mandatory = $true)] - [AllowEmptyString()] - [string] $ProductId, - - [string] $Arguments, - - [pscredential] $Credential, - - [int[]] $ReturnCode, - - [string] $LogPath - ) - - $uri, $identifyingNumber = Validate-StandardArguments $Path $ProductId $Name - $product = Get-ProductEntry $Name $identifyingNumber - Trace-Message ($LocalizedData.EnsureisEnsure -f $Ensure) - if($product) - { - Trace-Message ($LocalizedData.productisproduct -f $product) - } - else - { - Trace-Message "product installation cannot be determined" - } - Trace-Message ($LocalizedData.productasbooleanis -f [boolean]$product) - $res = ($product -ne $null -and $Ensure -eq "Present") -or ($product -eq $null -and $Ensure -eq "Absent") - - if ($product -ne $null) - { - $name = Get-LocalizableRegKeyValue $product "DisplayName" - Write-Verbose ($LocalizedData.PackageAppearsInstalled -f $name) - } - else - { - $displayName = $null - if($Name) - { - $displayName = $Name - } - else - { - $displayName = $ProductId - } - - Write-Verbose ($LocalizedData.PackageDoesNotAppearInstalled -f $displayName) - } - - return $res -} - -function Get-LocalizableRegKeyValue -{ - param( - [object] $RegKey, - [string] $ValueName - ) - - $res = $RegKey.GetValue("{0}_Localized" -f $ValueName) - if(-not $res) - { - $res = $RegKey.GetValue($ValueName) - } - - return $res -} - -function Get-TargetResource -{ - param - ( - [parameter(Mandatory = $true)] - [AllowEmptyString()] - [string] $Name, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $Path, - - [parameter(Mandatory = $true)] - [AllowEmptyString()] - [string] $ProductId - ) - - #If the user gave the ProductId then we derive $identifyingNumber - $uri, $identifyingNumber = Validate-StandardArguments $Path $ProductId $Name - - $localMsi = $uri.IsFile -and -not $uri.IsUnc - - $product = Get-ProductEntry $Name $identifyingNumber - - if(-not $product) - { - return @{ - Ensure = "Absent" - Name = $Name - ProductId = $identifyingNumber - Installed = $false - } - } - - #$identifyingNumber can still be null here (e.g. remote MSI with Name specified, local EXE) - #If the user gave a ProductId just pass it through, otherwise fill it from the product - if(-not $identifyingNumber) - { - $identifyingNumber = Split-Path -Leaf $product.Name - } - - $date = $product.GetValue("InstallDate") - if($date) - { - try - { - $date = "{0:d}" -f [DateTime]::ParseExact($date, "yyyyMMdd",[System.Globalization.CultureInfo]::CurrentCulture).Date - } - catch - { - $date = $null - } - } - - $publisher = Get-LocalizableRegKeyValue $product "Publisher" - $size = $product.GetValue("EstimatedSize") - if($size) - { - $size = $size/1024 - } - - $version = $product.GetValue("DisplayVersion") - $description = $product.GetValue("Comments") - $name = Get-LocalizableRegKeyValue $product "DisplayName" - return @{ - Ensure = "Present" - Name = $name - Path = $Path - InstalledOn = $date - ProductId = $identifyingNumber - Size = $size - Installed = $true - Version = $version - PackageDescription = $description - Publisher = $publisher - } -} - -Function Get-MsiTools -{ - if($script:MsiTools) - { - return $script:MsiTools - } - - $sig = @' - [DllImport("msi.dll", CharSet = CharSet.Unicode, PreserveSig = true, SetLastError = true, ExactSpelling = true)] - private static extern UInt32 MsiOpenPackageExW(string szPackagePath, int dwOptions, out IntPtr hProduct); - - [DllImport("msi.dll", CharSet = CharSet.Unicode, PreserveSig = true, SetLastError = true, ExactSpelling = true)] - private static extern uint MsiCloseHandle(IntPtr hAny); - - [DllImport("msi.dll", CharSet = CharSet.Unicode, PreserveSig = true, SetLastError = true, ExactSpelling = true)] - private static extern uint MsiGetPropertyW(IntPtr hAny, string name, StringBuilder buffer, ref int bufferLength); - - private static string GetPackageProperty(string msi, string property) - { - IntPtr MsiHandle = IntPtr.Zero; - try - { - var res = MsiOpenPackageExW(msi, 1, out MsiHandle); - if (res != 0) - { - return null; - } - - int length = 256; - var buffer = new StringBuilder(length); - res = MsiGetPropertyW(MsiHandle, property, buffer, ref length); - return buffer.ToString(); - } - finally - { - if (MsiHandle != IntPtr.Zero) - { - MsiCloseHandle(MsiHandle); - } - } - } - public static string GetProductCode(string msi) - { - return GetPackageProperty(msi, "ProductCode"); - } - - public static string GetProductName(string msi) - { - return GetPackageProperty(msi, "ProductName"); - } -'@ - $script:MsiTools = Add-Type -PassThru -Namespace Microsoft.Windows.DesiredStateConfiguration.PackageResource ` - -Name MsiTools -Using System.Text -MemberDefinition $sig - return $script:MsiTools -} - - -Function Get-MsiProductEntry -{ - param - ( - [string] $Path - ) - - if(-not (Test-Path -PathType Leaf $Path) -and ($fileExtension -ne ".msi")) - { - Throw-TerminatingError ($LocalizedData.PathDoesNotExist -f $Path) - } - - $tools = Get-MsiTools - - $pn = $tools::GetProductName($Path) - - $pc = $tools::GetProductCode($Path) - - return $pn,$pc -} - - -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [ValidateSet("Present", "Absent")] - [string] $Ensure = "Present", - - [parameter(Mandatory = $true)] - [AllowEmptyString()] - [string] $Name, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $Path, - - [parameter(Mandatory = $true)] - [AllowEmptyString()] - [string] $ProductId, - - [string] $Arguments, - - [pscredential] $Credential, - - [int[]] $ReturnCode, - - [string] $LogPath - ) - - $ErrorActionPreference = "Stop" - - if (Test-TargetResource -Ensure $Ensure -Name $Name -Path $Path -ProductId $ProductId) - { - return - } - - $uri, $identifyingNumber = Validate-StandardArguments $Path $ProductId $Name - $product = Get-ProductEntry $Name $identifyingNumber - - #Path gets overwritten in the download code path. Retain the user's original Path in case the install succeeded - #but the named package wasn't present on the system afterward so we can give a better message - $OrigPath = $Path - - Write-Verbose $LocalizedData.PackageConfigurationStarting - if(-not $ReturnCode) - { - # return code 1641 and 3010 are succeed indication when restart is requested per installation - $ReturnCode = @(0, 1641, 3010) - } - - $logStream = $null - $psdrive = $null - $downloadedFileName = $null - try - { - $fileExtension = [System.IO.Path]::GetExtension($Path).ToLower() - if($LogPath) - { - try - { - if($fileExtension -eq ".msi") - { - #We want to pre-verify the path exists and is writable ahead of time - #even in the MSI case, as detecting WHY the MSI log doesn't exist would - #be rather problematic for the user - if((Test-Path $LogPath) -and $PSCmdlet.ShouldProcess($LocalizedData.RemoveExistingLogFile,$null,$null)) - { - rm $LogPath - } - - if($PSCmdlet.ShouldProcess($LocalizedData.CreateLogFile, $null, $null)) - { - New-Item -Type File $LogPath | Out-Null - } - } - elseif($PSCmdlet.ShouldProcess($LocalizedData.CreateLogFile, $null, $null)) - { - $logStream = new-object "System.IO.StreamWriter" $LogPath,$false - } - } - catch - { - Throw-TerminatingError ($LocalizedData.CouldNotOpenLog -f $LogPath) $_ - } - } - - #Download or mount file as necessary - if(-not ($fileExtension -eq ".msi" -and $Ensure -eq "Absent")) - { - if($uri.IsUnc -and $PSCmdlet.ShouldProcess($LocalizedData.MountSharePath, $null, $null)) - { - $psdriveArgs = @{Name=([guid]::NewGuid());PSProvider="FileSystem";Root=(Split-Path $uri.LocalPath)} - if($Credential) - { - #We need to optionally include these and then splat the hash otherwise - #we pass a null for Credential which causes the cmdlet to pop a dialog up - $psdriveArgs["Credential"] = $Credential - } - - $psdrive = New-PSDrive @psdriveArgs - $Path = Join-Path $psdrive.Root (Split-Path -Leaf $uri.LocalPath) #Necessary? - } - elseif(@("http", "https") -contains $uri.Scheme -and $Ensure -eq "Present" -and $PSCmdlet.ShouldProcess($LocalizedData.DownloadHTTPFile, $null, $null)) - { - $scheme = $uri.Scheme - $outStream = $null - $responseStream = $null - - try - { - Trace-Message ($LocalizedData.Creatingcachelocation) - - if(-not (Test-Path -PathType Container $CacheLocation)) - { - mkdir $CacheLocation | Out-Null - } - - $destName = Join-Path $CacheLocation (Split-Path -Leaf $uri.LocalPath) - - Trace-Message ($LocalizedData.NeedtodownloadfilefromschemedestinationwillbedestName -f $scheme, $destName) - - try - { - Trace-Message ($LocalizedData.Creatingthedestinationcachefile) - $outStream = New-Object System.IO.FileStream $destName, "Create" - } - catch - { - #Should never happen since we own the cache directory - Throw-TerminatingError ($LocalizedData.CouldNotOpenDestFile -f $destName) $_ - } - - try - { - Trace-Message ($LocalizedData.Creatingtheschemestream -f $scheme) - $request = [System.Net.WebRequest]::Create($uri) - Trace-Message ($LocalizedData.Settingdefaultcredential) - $request.Credentials = [System.Net.CredentialCache]::DefaultCredentials - if ($scheme -eq "http") - { - Trace-Message ($LocalizedData.Settingauthenticationlevel) - # default value is MutualAuthRequested, which applies to https scheme - $request.AuthenticationLevel = [System.Net.Security.AuthenticationLevel]::None - } - if ($scheme -eq "https") - { - Trace-Message ($LocalizedData.Ignoringbadcertificates) - $request.ServerCertificateValidationCallBack = {$true} - } - Trace-Message ($LocalizedData.Gettingtheschemeresponsestream -f $scheme) - $responseStream = (([System.Net.HttpWebRequest]$request).GetResponse()).GetResponseStream() - } - catch - { - Trace-Message ($LocalizedData.ErrorOutString -f ($_ | Out-String)) - Throw-TerminatingError ($LocalizedData.CouldNotGetHttpStream -f $scheme, $Path) $_ - } - - try - { - Trace-Message ($LocalizedData.Copyingtheschemestreambytestothediskcache -f $scheme) - $responseStream.CopyTo($outStream) - $responseStream.Flush() - $outStream.Flush() - } - catch - { - Trace-Message ($LocalizedData.ErrorOutString -f ($_ | Out-String)) - Throw-TerminatingError ($LocalizedData.ErrorCopyingDataToFile -f $Path,$destName) $_ - } - } - finally - { - if($outStream) - { - $outStream.Close() - } - - if($responseStream) - { - $responseStream.Close() - } - } - Trace-Message ($LocalizedData.Redirectingpackagepathtocachefilelocation) - $Path = $downloadedFileName = $destName - } - } - - #At this point the Path ought to be valid unless it's an MSI uninstall case - if(-not (Test-Path -PathType Leaf $Path) -and -not ($Ensure -eq "Absent" -and $fileExtension -eq ".msi")) - { - Throw-TerminatingError ($LocalizedData.PathDoesNotExist -f $Path) - } - - $startInfo = New-Object System.Diagnostics.ProcessStartInfo - $startInfo.UseShellExecute = $false #Necessary for I/O redirection and just generally a good idea - $process = New-Object System.Diagnostics.Process - $process.StartInfo = $startInfo - $errLogPath = $LogPath + ".err" #Concept only, will never touch disk - - if($fileExtension -eq ".msi") - { - $startInfo.FileName = "$env:windir\system32\msiexec.exe" - if($Ensure -eq "Present") - { - # check if Msi package contains the ProductName and Code specified - - $pName,$pCode = Get-MsiProductEntry -Path $Path - - if ( - ( (-not [String]::IsNullOrEmpty($Name)) -and ($pName -ne $Name)) ` - -or ( (-not [String]::IsNullOrEmpty($identifyingNumber)) -and ($identifyingNumber -ne $pCode)) - ) - { - Throw-InvalidNameOrIdException ($LocalizedData.InvalidNameOrId -f $Name,$identifyingNumber,$pName,$pCode) - } - - $startInfo.Arguments = '/i "{0}"' -f $Path - } - else - { - $id = Split-Path -Leaf $product.Name #We may have used the Name earlier, now we need the actual ID - $startInfo.Arguments = ("/x{0}" -f $id) - } - - if($LogPath) - { - $startInfo.Arguments += ' /log "{0}"' -f $LogPath - } - - $startInfo.Arguments += " /quiet" - - if($Arguments) - { - $startInfo.Arguments += " " + $Arguments - } - } - else #EXE - { - Trace-Message ($LocalizedData.ThebinaryisanEXE) - if($Ensure -eq "Present") - { - $startInfo.FileName = $Path - $startInfo.Arguments = $Arguments - if($LogPath) - { - Trace-Message ($LocalizedData.Userhasrequestedloggingneedtoattacheventhandlerstotheprocess) - $startInfo.RedirectStandardError = $true - $startInfo.RedirectStandardOutput = $true - Register-ObjectEvent -InputObject $process -EventName "OutputDataReceived" -SourceIdentifier $LogPath - Register-ObjectEvent -InputObject $process -EventName "ErrorDataReceived" -SourceIdentifier $errLogPath - } - } else { - # Absent case - $startInfo.FileName = "$env:windir\system32\msiexec.exe" - $id = Split-Path -Leaf $product.Name - $startInfo.Arguments = ("/x{0} /quiet" -f $id) - # Never let the msiexec to restart automatically, DSC should handle reboot requests - $startInfo.Arguments += ' /norestart' - if($LogPath) - { - $startInfo.Arguments += ' /log "{0}"' -f $LogPath - } - - if($Arguments) - { - $startInfo.Arguments += " " + $Arguments - } - } - } - - Trace-Message ($LocalizedData.StartingwithstartInfoFileNamestartInfoArguments -f $startInfo.FileName, $startInfo.Arguments) - - if($PSCmdlet.ShouldProcess(($LocalizedData.StartingProcessMessage -f $startInfo.FileName, $startInfo.Arguments), $null, $null)) - { - try - { - $exitcode = 0 - $process.Start() | Out-Null - if($logStream) #Identical to $fileExtension -eq ".exe" -and $logPath - { - $process.BeginOutputReadLine(); - $process.BeginErrorReadLine(); - } - - $process.WaitForExit() - - if($process) - { - $exitCode = $process.ExitCode - } - - } - catch - { - Throw-TerminatingError ($LocalizedData.CouldNotStartProcess -f $Path) $_ - } - - - if($logStream) - { - #We have to re-mux these since they appear to us as different streams - #The underlying Win32 APIs prevent this problem, as would constructing a script - #on the fly and executing it, but the former is highly problematic from PowerShell - #and the latter doesn't let us get the return code for UI-based EXEs - $outputEvents = Get-Event -SourceIdentifier $LogPath - $errorEvents = Get-Event -SourceIdentifier $errLogPath - $masterEvents = @() + $outputEvents + $errorEvents - $masterEvents = $masterEvents | Sort-Object -Property TimeGenerated - - foreach($event in $masterEvents) - { - $logStream.Write($event.SourceEventArgs.Data); - } - - Remove-Event -SourceIdentifier $LogPath - Remove-Event -SourceIdentifier $errLogPath - } - - if(-not ($ReturnCode -contains $exitCode)) - { - Throw-TerminatingError ($LocalizedData.UnexpectedReturnCode -f $exitCode.ToString()) - } - } - } - finally - { - if($psdrive) - { - Remove-PSDrive -Force $psdrive - } - - if($logStream) - { - $logStream.Dispose() - } - } - - if($downloadedFileName -and $PSCmdlet.ShouldProcess($LocalizedData.RemoveDownloadedFile, $null, $null)) - { - #This is deliberately not in the Finally block. We want to leave the downloaded file on disk - #in the error case as a debugging aid for the user - rm $downloadedFileName - } - - $operationString = $LocalizedData.PackageUninstalled - if($Ensure -eq "Present") - { - $operationString = $LocalizedData.PackageInstalled - } - - # Check if reboot is required, if so notify CA. The MSFT_ServerManagerTasks provider is missing on client SKUs (Worked on both Server and Client Skus as in windows 10) - $featureData = invoke-wmimethod -EA Ignore -Name GetServerFeature -namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks - $regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore - if(($featureData -and $featureData.RequiresReboot) -or $regData -or $exitcode -eq 3010 -or $exitcode -eq 1641) - { - Write-Verbose $LocalizedData.MachineRequiresReboot - $global:DSCMachineStatus = 1 - } - - if($Ensure -eq "Present") - { - $productEntry = Get-ProductEntry $Name $identifyingNumber - if(-not $productEntry) - { - Throw-TerminatingError ($LocalizedData.PostValidationError -f $OrigPath) - } - } - - Write-Verbose $operationString - Write-Verbose $LocalizedData.PackageConfigurationComplete -} - -Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/MSFT_PackageResource.schema.mof b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/MSFT_PackageResource.schema.mof deleted file mode 100644 index d30eee9..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/MSFT_PackageResource.schema.mof and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/ko-KR/MSFT_PackageResource.schema.mfl b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/ko-KR/MSFT_PackageResource.schema.mfl deleted file mode 100644 index ae86e29..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/ko-KR/MSFT_PackageResource.schema.mfl and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/ko-KR/PackageProvider.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/ko-KR/PackageProvider.psd1 deleted file mode 100644 index 6839d15..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/ko-KR/PackageProvider.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/MSFT_ProcessResource.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/MSFT_ProcessResource.psm1 deleted file mode 100644 index 32438d2..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/MSFT_ProcessResource.psm1 +++ /dev/null @@ -1,722 +0,0 @@ -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -FileNotFound=File not found in the environment path. -AbsolutePathOrFileName=Absolute path or file name expected. -InvalidArgument=Invalid argument: '{0}' with value: '{1}'. -InvalidArgumentAndMessage={0} {1} -ProcessStarted=Process matching path '{0}' started -ProcessesStopped=Proceses matching path '{0}' with Ids '({1})' stopped. -ProcessAlreadyStarted=Process matching path '{0}' found running and no action required. -ProcessAlreadyStopped=Process matching path '{0}' not found running and no action required. -ErrorStopping=Failure stopping processes matching path '{0}' with IDs '({1})'. Message: {2}. -ErrorStarting=Failure starting process matching path '{0}'. Message: {1}. -StartingProcessWhatif=Start-Process -ProcessNotFound=Process matching path '{0}' not found -PathShouldBeAbsolute=The path should be absolute -PathShouldExist=The path should exist -ParameterShouldNotBeSpecified=Parameter {0} should not be specified. -FailureWaitingForProcessesToStart=Failed to wait for processes to start -FailureWaitingForProcessesToStop=Failed to wait for processes to stop -ErrorParametersNotSupportedWithCredential=Can't specify StandardOutputPath, StandardInputPath or WorkingDirectory when trying to run a process under a user context. -VerboseInProcessHandle=In process handle {0} -ErrorRunAsCredentialParameterNotSupported= The PsDscRunAsCredential parameter is not supported by the Process resource. To start the process with user '{0}', add the Credential parameter. -ErrorCredentialParameterNotSupportedWithRunAsCredential= The PsDscRunAsCredential parameter is not supported by the Process resource, and cannot be used with the Credential parameter. To start the process with user '{0}', use only the Credential parameter, not the PsDscRunAsCredential parameter. -'@ -} - -Import-LocalizedData LocalizedData -filename MSFT_ProcessResource.strings.psd1 - -Import-Module "$PSScriptRoot\..\RunAsHelper.psm1" - -function ExtractArguments($functionBoundParameters,[string[]]$argumentNames,[string[]]$newArgumentNames) -{ - $returnValue=@{} - for($i=0;$i -lt $argumentNames.Count;$i++) - { - $argumentName=$argumentNames[$i] - - if($newArgumentNames -eq $null) - { - $newArgumentName=$argumentName - } - else - { - $newArgumentName=$newArgumentNames[$i] - } - - if($functionBoundParameters.ContainsKey($argumentName)) - { - $null=$returnValue.Add($newArgumentName,$functionBoundParameters[$argumentName]) - } - } - - return $returnValue -} - -function IsRunFromLocalSystemUser() -{ - (New-Object Security.Principal.WindowsPrincipal ( [Security.Principal.WindowsIdentity]::GetCurrent())).Identity.IsSystem -} - -function Get-TargetResource -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path, - - [parameter(Mandatory = $true)] - [AllowEmptyString()] - [System.String] - $Arguments, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - $Credential - ) - - $Path=(ResolvePath $Path) - $PSBoundParameters["Path"] = $Path - $getArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - $processes = @(GetWin32_Process @getArguments) - - if($processes.Count -eq 0) - { - return @{ - Path=$Path - Arguments=$Arguments - Ensure='Absent' - } - } - - foreach($process in $processes) - { - # in case the process was killed between GetWin32_Process and this point, we should - # ignore errors which will generate empty entries in the return - $gpsProcess = (get-process -id $process.ProcessId -ErrorAction Ignore) - - @{ - Path=$process.Path - Arguments=(GetProcessArgumentsFromCommandLine $process.CommandLine) - PagedMemorySize=$gpsProcess.PagedMemorySize64 - NonPagedMemorySize=$gpsProcess.NonpagedSystemMemorySize64 - VirtualMemorySize=$gpsProcess.VirtualMemorySize64 - HandleCount=$gpsProcess.HandleCount - Ensure='Present' - ProcessId=$process.ProcessId - } - } -} - - -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path, - - [parameter(Mandatory = $true)] - [AllowEmptyString()] - [System.String] - $Arguments, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - $Credential, - - [System.String] - [ValidateSet("Present", "Absent")] - $Ensure="Present", - - [System.String] - $StandardOutputPath, - - [System.String] - $StandardErrorPath, - - [System.String] - $StandardInputPath, - - [System.String] - $WorkingDirectory - ) - - $Path=ResolvePath $Path - $PSBoundParameters["Path"] = $Path - $getArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - $processes = @(GetWin32_Process @getArguments) - - if($Ensure -eq 'Absent') - { - "StandardOutputPath","StandardErrorPath","StandardInputPath","WorkingDirectory" | AssertParameterIsNotSpecified $PSBoundParameters - - if ($processes.Count -gt 0) - { - $processIds=$processes.ProcessId - - $err=Stop-Process -Id $processIds -force 2>&1 - - if($err -eq $null) - { - Write-Log ($LocalizedData.ProcessesStopped -f $Path,($processIds -join ",")) - } - else - { - Write-Log ($LocalizedData.ErrorStopping -f $Path,($processIds -join ","),($err | out-string)) - throw $err - } - - # Before returning from Set-TargetResource we have to ensure a subsequent Test-TargetResource is going to work - if (!(WaitForProcessCount @getArguments -waitCount 0)) - { - $message = $LocalizedData.ErrorStopping -f $Path,($processIds -join ","),$LocalizedData.FailureWaitingForProcessesToStop - Write-Log $message - ThrowInvalidArgumentError "FailureWaitingForProcessesToStop" $message - } - } - else - { - Write-Log ($LocalizedData.ProcessAlreadyStopped -f $Path) - } - } - else - { - "StandardInputPath","WorkingDirectory" | AssertAbsolutePath $PSBoundParameters -Exist - "StandardOutputPath","StandardErrorPath" | AssertAbsolutePath $PSBoundParameters - - if ($processes.Count -eq 0) - { - $startArguments = ExtractArguments $PSBoundParameters ` - ("Path", "Arguments", "Credential", "StandardOutputPath", "StandardErrorPath", "StandardInputPath", "WorkingDirectory") ` - ("FilePath", "ArgumentList", "Credential", "RedirectStandardOutput", "RedirectStandardError", "RedirectStandardInput", "WorkingDirectory") - - if([string]::IsNullOrEmpty($Arguments)) - { - $null=$startArguments.Remove("ArgumentList") - } - - if($PSCmdlet.ShouldProcess($Path,$LocalizedData.StartingProcessWhatif)) - { - # - # Start-Process calls .net Process.Start() - # If -Credential is present Process.Start() uses win32 api CreateProcessWithLogonW http://msdn.microsoft.com/en-us/library/0w4h05yb(v=vs.110).aspx - # CreateProcessWithLogonW cannot be called as LocalSystem user. - # Details http://msdn.microsoft.com/en-us/library/windows/desktop/ms682431(v=vs.85).aspx (section Remarks/Windows XP with SP2 and Windows Server 2003) - # - # In this case we call another api. - # - if($PSBoundParameters.ContainsKey("Credential") -and (IsRunFromLocalSystemUser)) - { - if($PSBoundParameters.ContainsKey("StandardOutputPath") -or $PSBoundParameters.ContainsKey("StandardInputPath") -or $PSBoundParameters.ContainsKey("WorkingDirectory")) - { - $exception = New-Object System.ArgumentException $LocalizedData.ErrorParametersNotSupportedWithCredential - $err = New-Object System.Management.Automation.ErrorRecord $exception, "InvalidCombinationOfArguments", InvalidArgument, $null - } - else - { - $Domain, $UserName = Get-DomainAndUserName $Credential - try - { - # - # Internally we use win32 api LogonUser() with dwLogonType == LOGON32_LOGON_NETWORK_CLEARTEXT. - # It grants process ability for second-hop. - # - Import-DscNativeMethods - [PSDesiredStateConfiguration.NativeMethods]::CreateProcessAsUser( "$Path $Arguments", $Domain, $UserName, $Credential.Password, $false, [ref] $null ) - } - catch - { - throw New-Object System.Management.Automation.ErrorRecord $_.Exception, "Win32Exception", OperationStopped, $null - } - } - } - else - { - $err=Start-Process @startArguments 2>&1 - } - if($err -eq $null) - { - Write-Log ($LocalizedData.ProcessStarted -f $Path) - } - else - { - Write-Log ($LocalizedData.ErrorStarting -f $Path,($err | Out-String)) - throw $err - } - - # Before returning from Set-TargetResource we have to ensure a subsequent Test-TargetResource is going to work - if (!(WaitForProcessCount @getArguments -waitCount 1)) - { - $message = $LocalizedData.ErrorStarting -f $Path,$LocalizedData.FailureWaitingForProcessesToStart - Write-Log $message - ThrowInvalidArgumentError "FailureWaitingForProcessesToStart" $message - } - } - } - else - { - Write-Log ($LocalizedData.ProcessAlreadyStarted -f $Path) - } - } -} - -function Test-TargetResource -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path, - - [parameter(Mandatory = $true)] - [AllowEmptyString()] - [System.String] - $Arguments, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - $Credential, - - [System.String] - [ValidateSet("Present", "Absent")] - $Ensure="Present", - - [System.String] - $StandardOutputPath, - - [System.String] - $StandardErrorPath, - - [System.String] - $StandardInputPath, - - [System.String] - $WorkingDirectory - ) - - if($PsDscContext.RunAsUser) - { - if($PSBoundParameters.ContainsKey("Credential")) - { - $exception = New-Object System.ArgumentException ($LocalizedData.ErrorCredentialParameterNotSupportedWithRunAsCredential -f $PsDscContext.RunAsUser) - $err = New-Object System.Management.Automation.ErrorRecord $exception, "InvalidArgument", InvalidArgument, $null - } - else - { - $exception = New-Object System.ArgumentException ($LocalizedData.ErrorRunAsCredentialParameterNotSupported -f $PsDscContext.RunAsUser) - $err = New-Object System.Management.Automation.ErrorRecord $exception, "InvalidCombinationOfArguments", InvalidArgument, $null - } - - Write-Log ($LocalizedData.ErrorStarting -f $Path,($err | Out-String)) - throw $err - } - - $Path=ResolvePath $Path - $PSBoundParameters["Path"] = $Path - $getArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - $processes = @(GetWin32_Process @getArguments) - - - if($Ensure -eq 'Absent') - { - return ($processes.Count -eq 0) - } - else - { - return ($processes.Count -gt 0) - } -} - -function GetWin32ProcessOwner -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - $process - ) - - # if the process was killed by the time this is called, GetOwner - # will throw a WMIMethodException "Not found" - try - { - $owner = Invoke-CimMethod -InputObject $process -MethodName GetOwner - } - catch - { - } - - if($owner.Domain -ne $null) - { - return $owner.Domain + "\" + $owner.User - } - else - { - return $owner.User - } -} - -function WaitForProcessCount -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path, - - [System.String] - $Arguments, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - $Credential, - - [parameter(Mandatory=$true)] - $waitCount - ) - - $start = [DateTime]::Now - do - { - $getArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") - $value = @(GetWin32_Process @getArguments).Count -eq $waitCount - } while(!$value -and ([DateTime]::Now - $start).TotalMilliseconds -lt 2000) - - return $value -} - -function GetWin32_Process -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path, - - [System.String] - $Arguments, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - $Credential, - - $useWmiObjectCount=8 - ) - - - - $fileName = [io.path]::GetFileNameWithoutExtension($Path) - - $gpsProcesses = @(get-process -Name $fileName -ErrorAction SilentlyContinue) - - if($gpsProcesses.Count -ge $useWmiObjectCount) - { - # if there are many processes it is faster to perform a Get-WmiObject - # in order to get Win32_Process objects for all processes - $Path=WQLEscape $Path - $filter = "ExecutablePath = '$Path'" - $processes = Get-CimInstance Win32_Process -Filter $filter - } - else - { - # if there are few processes, building a Win32_Process for - # each matching result of get-process is faster - $processes = foreach($gpsProcess in $gpsProcesses) - { - if(!($gpsProcess.Path -ieq $Path)) - { - continue - } - - try - { - Write-Verbose ($LocalizedData.VerboseInProcessHandle -f $gpsProcess.Id) - Get-CimInstance Win32_Process -Filter "ProcessId=$($gpsProcess.Id)" - } - catch - { - #ignore if could not retrieve process - } - } - } - - if($PSBoundParameters.ContainsKey('Credential')) - { - $Domain, $UserName = Get-DomainAndUserName $Credential - # Since there are credentials we need to call the GetOwner method in each process to search for matches - $processes = $processes | where { (GetWin32ProcessOwner $_) -eq "$Domain\$UserName" } - - } - - if($Arguments -eq $null) {$Arguments = ""} - $processes = $processes | where { (GetProcessArgumentsFromCommandLine $_.CommandLine) -eq $Arguments } - - return $processes -} - -<# -.Synopsis - Strips the Arguments part of a commandLine. In "c:\temp\a.exe X Y Z" the Arguments part is "X Y Z". -#> -function GetProcessArgumentsFromCommandLine -{ - param - ( - [System.String] - $commandLine - ) - - if($commandLine -eq $null) - { - return "" - } - - $commandLine=$commandLine.Trim() - - if($commandLine.Length -eq 0) - { - return "" - } - - if($commandLine[0] -eq '"') - { - $charToLookfor=[char]'"' - } - else - { - $charToLookfor=[char]' ' - } - - $endofCommand=$commandLine.IndexOf($charToLookfor ,1) - if($endofCommand -eq -1) - { - return "" - } - - return $commandLine.Substring($endofCommand+1).Trim() -} - -<# -.Synopsis - Escapes a string to be used in a WQL filter as the one passed to get-wmiobject -#> -function WQLEscape -{ - param - ( - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $query - ) - - return $query.Replace("\","\\").Replace('"','\"').Replace("'","\'") -} - -function ThrowInvalidArgumentError -{ - [CmdletBinding()] - param - ( - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $errorId, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $errorMessage - ) - - $errorCategory=[System.Management.Automation.ErrorCategory]::InvalidArgument - $exception = New-Object System.ArgumentException $errorMessage; - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - throw $errorRecord -} - -function ResolvePath -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path - ) - - $Path = [Environment]::ExpandEnvironmentVariables($Path) - - if(IsRootedPath $Path) - { - if(!(Test-Path $Path -PathType Leaf)) - { - ThrowInvalidArgumentError "CannotFindRootedPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) - } - - return $Path - } - - if([string]::IsNullOrEmpty($env:Path)) - { - ThrowInvalidArgumentError "EmptyEnvironmentPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) - } - - # This will block relative paths. The statement is only true id $Path contains a plain file name. - # Checking a relative path against segments of the $env:Path does not make sense - if((Split-Path $Path -Leaf) -ne $Path) - { - ThrowInvalidArgumentError "NotAbsolutePathOrFileName" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.AbsolutePathOrFileName) - } - - foreach($rawSegment in $env:Path.Split(";")) - { - $segment = [Environment]::ExpandEnvironmentVariables($rawSegment) - - # if an exception causes $segmentedRooted not to be set, we will consider it $false - $segmentRooted = $false - try - { - # If the whole path passed through [IO.Path]::IsPathRooted with no exceptions, it does not have - # invalid characters, so segment has no invalid characters and will not throw as well - $segmentRooted=[IO.Path]::IsPathRooted($segment) - } - catch {} - - if(!$segmentRooted) - { - continue - } - - $candidate = join-path $segment $Path - - if(Test-Path $candidate -PathType Leaf) - { - return $candidate - } - } - - ThrowInvalidArgumentError "CannotFindRelativePath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) -} - - -function AssertAbsolutePath -{ - [CmdletBinding()] - param - ( - $ParentBoundParameters, - - [System.String] - [Parameter (ValueFromPipeline=$true)] - $ParameterName, - - [switch] - $Exist - ) - - Process - { - if(!$ParentBoundParameters.ContainsKey($ParameterName)) - { - return - } - - $path=$ParentBoundParameters[$ParameterName] - - if(!(IsRootedPath $Path)) - { - ThrowInvalidArgumentError "PathShouldBeAbsolute" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f $ParameterName,$Path), - $LocalizedData.PathShouldBeAbsolute) - } - - if(!$Exist.IsPresent) - { - return - } - - if(!(Test-Path $Path)) - { - ThrowInvalidArgumentError "PathShouldExist" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f $ParameterName,$Path), - $LocalizedData.PathShouldExist) - } - } -} - -function AssertParameterIsNotSpecified -{ - [CmdletBinding()] - param - ( - $ParentBoundParameters, - - [System.String] - [Parameter (ValueFromPipeline=$true)] - $ParameterName - ) - - Process - { - if($ParentBoundParameters.ContainsKey($ParameterName)) - { - ThrowInvalidArgumentError "ParameterShouldNotBeSpecified" ($LocalizedData.ParameterShouldNotBeSpecified -f $ParameterName) - } - } -} - -function IsRootedPath -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path - ) - - try - { - return [IO.Path]::IsPathRooted($Path) - } - catch - { - # if the Path has invalid characters like >, <, etc, we cannot determine if it is rooted so we do not go on - ThrowInvalidArgumentError "CannotGetIsPathRooted" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $_.Exception.Message) - } -} - -function Write-Log -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Message - ) - - if ($PSCmdlet.ShouldProcess($Message, $null, $null)) - { - Write-Verbose $Message - } -} - -Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/MSFT_ProcessResource.schema.mof b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/MSFT_ProcessResource.schema.mof deleted file mode 100644 index e7dca62..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/MSFT_ProcessResource.schema.mof and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/ko-KR/MSFT_ProcessResource.schema.mfl b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/ko-KR/MSFT_ProcessResource.schema.mfl deleted file mode 100644 index 303732e..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/ko-KR/MSFT_ProcessResource.schema.mfl and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/ko-KR/MSFT_ProcessResource.strings.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/ko-KR/MSFT_ProcessResource.strings.psd1 deleted file mode 100644 index ee347e5..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/ko-KR/MSFT_ProcessResource.strings.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/MSFT_RegistryResource.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/MSFT_RegistryResource.psm1 deleted file mode 100644 index 292a744..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/MSFT_RegistryResource.psm1 +++ /dev/null @@ -1,1100 +0,0 @@ -# This PS module contains functions for Desired State Configuration (DSC) Registry provider. It enables querying, creation, removal and update of Windows registry keys through Get, Set and Test operations on DSC managed nodes. - -# Fallback message strings in en-US -DATA localizedData -{ - # culture = "en-US" - ConvertFrom-StringData @' - ParameterValueInvalid = (ERROR) Parameter '{0}' has an invalid value '{1}' for type '{2}' - InvalidPSDriveSpecified = (ERROR) Invalid PSDrive '{0}' specified in registry key '{1}' - InvalidRegistryHiveSpecified = (ERROR) Invalid registry hive was specified in registry key '{0}' - SetRegValueFailed = (ERROR) Failed to set registry key value '{0}' to value '{1}' of type '{2}' - SetRegValueUnchanged = (UNCHANGED) No change to registry key value '{0}' containing '{1}' - SetRegKeyUnchanged = (UNCHANGED) No change to registry key '{0}' - SetRegValueSucceeded = (SET) Set registry key value '{0}' to '{1}' of type '{2}' - SetRegKeySucceeded = (SET) Create registry key '{0}' - SetRegKeyFailed = (ERROR) Failed to created registry key '{0}' - RemoveRegKeyTreeFailed = (ERROR) Registry Key '{0}' has subkeys, cannot remove without Force flag - RemoveRegKeySucceeded = (REMOVAL) Registry key '{0}' removed - RemoveRegKeyFailed = (ERROR) Failed to remove registry key '{0}' - RemoveRegValueSucceeded = (REMOVAL) Registry key value '{0}' removed - RemoveRegValueFailed = (ERROR) Failed to remove registry key value '{0}' - RegKeyDoesNotExist = Registry key '{0}' does not exist - RegKeyExists = Registry key '{0}' exists - RegValueExists = Found registry key value '{0}' with type '{1}' and data '{2}' - RegValueDoesNotExist = Registry key value '{0}' does not exist - RegValueTypeMismatch = Registry key value '{0}' of type '{1}' does not exist - RegValueDataMismatch = Registry key value '{0}' of type '{1}' does not contain data '{2}' - DefaultValueDisplayName = (Default) -'@ -} -Import-LocalizedData LocalizedData -filename MSFT_RegistryResource.strings.psd1 - -#-------------------------------------- -# The Get-TargetResourceInternal cmdlet -#-------------------------------------- -FUNCTION Get-TargetResourceInternal -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Key, - - # Default is [String]::Empty to cater for the (Default) RegValue - [System.String] - $ValueName = [String]::Empty - ) - - # Perform any required setup steps for the provider - SetupProvider -KeyName ([ref]$Key) - - $ValueNameSpecified = $PSBoundParameters.ContainsKey("ValueName") - - # First check if the specified key exists - $keyInfo = Get-Item -Path $Key -ErrorAction SilentlyContinue - - # If $keyInfo is $null, the registry key doesn't exist - if ($keyInfo -eq $null) - { - Write-Verbose ($localizedData.RegKeyDoesNotExist -f $Key) - - $retVal = @{Ensure='Absent'; Key=$Key} - - return $retVal - } - - # If the control reaches here, the key has been found at least - $retVal = @{Ensure='Present'; Key=$Key; Data=$keyInfo} - - # If $ValueName parameter has not been specified then we simply report success on finding the $Key - if (!$ValueNameSpecified) - { - Write-Verbose ($localizedData.RegKeyExists -f $Key) - - return $retVal - } - - # If the control reaches here, the $ValueName has been specified as a parameter and we should query it now - $valData = $keyInfo.GetValue($ValueName, $null, [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames) - - # If $ValueName is not found in the specified $Key - if($valData -eq $null) - { - Write-Verbose ($localizedData.RegValueDoesNotExist -f "$Key\$ValueName") - - $retVal = @{Ensure='Absent'; Key=$Key; ValueName=(GetValueDisplayName -ValueName $ValueName)} - - return $retVal - } - - # Finalize name, type and data to be returned - $finalName = GetValueDisplayName -ValueName $ValueName - $finalType = $keyInfo.GetValueKind($ValueName) - $finalData = $valData - - # Special case: For Binary type data we convert the received bytes back to a readable hex-strin - if ($finalType -ieq "Binary") - { - $finalData = ConvertByteArrayToHexString -Data $valData - } - - # Populate all config in the return object - $retVal.ValueName = $finalName - $retVal.ValueType = $finalType - $retVal.Data = $finalData - - # If the control reaches here, both the $Key and the $ValueName have been found, query is fully successful - Write-Verbose ($localizedData.RegValueExists -f "$Key\$ValueName", $retVal.ValueType, (ArrayToString $retVal.Data)) - - return $retVal -} - -#------------------------------ -# The Get-TargetResource cmdlet -#------------------------------ -FUNCTION Get-TargetResource -{ - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [System.String] - $Key, - - [Parameter(Mandatory)] - [ValidateNotNull()] - [AllowEmptyString()] - [System.String] - $ValueName, - - # Special-case: Used only as a boolean flag (along with ValueType) to determine if the target entity is the Default Value or the key itself. - [System.String[]] - $ValueData, - - # Special-case: Used only as a boolean flag (along with ValueData) to determine if the target entity is the Default Value or the key itself. - [System.String] - $ValueType - ) - - # If $ValueName is "" and ValueType and ValueData are both not specified, then we target the key itself (not Default Value) - if ($ValueName -eq "" -and !$PSBoundParameters.ContainsKey("ValueType") -and !$PSBoundParameters.ContainsKey("ValueData")) - { - $retVal = Get-TargetResourceInternal -Key $Key - } - else - { - $retVal = Get-TargetResourceInternal -Key $Key -ValueName $ValueName - - if ($retVal.Ensure -eq 'Present') - { - [string[]]$retVal.ValueData += $retVal.Data - - if ($retVal.ValueType -ieq "MultiString") - { - $retVal.ValueData = $retVal.Data - } - } - } - - $retVal.Remove("Data") - - return $retVal -} - - -#------------------------------ -# The Set-TargetResource cmdlet -#------------------------------ -FUNCTION Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [Parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [System.String] - $Key, - - [Parameter(Mandatory)] - [ValidateNotNull()] - [AllowEmptyString()] - [System.String] - $ValueName, - - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", - - [ValidateNotNull()] - [System.String[]] - $ValueData = @(), - - [ValidateSet("String", "Binary", "DWord", "QWord", "MultiString", "ExpandString")] - [System.String] - $ValueType = "String", - - [System.Boolean] - $Hex = $false, - - [System.Boolean] - $Force = $false - ) - - # Perform any required setup steps for the provider - SetupProvider -KeyName ([ref]$Key) - - # Query if the RegVal related parameters have been specified - $ValueNameSpecified = $PSBoundParameters.ContainsKey("ValueName") - $ValueTypeSpecified = $PSBoundParameters.ContainsKey("ValueType") - $ValueDataSpecified = $PSBoundParameters.ContainsKey("ValueData") - $keyCreated = $false - - # If an empty string ValueName has been specified and no ValueType and no ValueData has been specified, - # treat this case as if ValueName was not specified and target the Key itself. This is to cater the limitation - # that both Key and ValueName are mandatory now and we must special-case like this to target the Key only. - if ($ValueName -eq "" -and !$ValueTypeSpecified -and !$ValueDataSpecified) - { - $ValueNameSpecified = $false - } - - # Now, query the specified key - $keyInfo = Get-TargetResourceInternal -Key $Key -Verbose:$false - - # ---------------- - # ENSURE = PRESENT - if ($Ensure -ieq "Present") - { - # If key doesn't exist, attempt to create it - if ($keyInfo.Ensure -ieq "Absent") - { - if ($PSCmdlet.ShouldProcess(($localizedData.SetRegKeySucceeded -f "$Key"), $null, $null)) - { - try - { - $keyInfo = CreateRegistryKey -Key $Key - $keyCreated = $true - } - catch [Exception] - { - Write-Verbose ($localizedData.SetRegKeyFailed -f "$Key") - - throw - } - } - } - - # If $ValueName, $ValueType and $ValueData are not specified, the simple existence/creation of the Regkey satisfies the Ensure=Present condition, just return - if (!$ValueNameSpecified -and !$ValueDataSpecified -and !$ValueTypeSpecified) - { - if (!$keyCreated) - { - Write-Log ($localizedData.SetRegKeyUnchanged -f "$Key") - } - - return - } - - # If $ValueType and $ValueData are both not specified, but $ValueName is specified, check if the Value exists, if yes return with status unchanged, otherwise report input error - if (!$ValueTypeSpecified -and !$ValueDataSpecified -and $ValueNameSpecified) - { - $valData = $keyInfo.Data.GetValue($ValueName) - - if ($valData -ne $null) - { - Write-Log ($localizedData.SetRegValueUnchanged -f "$Key\$ValueName", (ArrayToString -Value $valData)) - - return - } - } - - # Create a strongly-typed object (in accordance with the specified $ValueType) - $setVal = $null - GetTypedObject -Type $ValueType -Data $ValueData -Hex $Hex -ReturnValue ([ref]$setVal) - - # Get the appropriate display name for the specified ValueName (to handle the Default RegValue case) - $valDisplayName = GetValueDisplayName -ValueName $ValueName - - if ($PSCmdlet.ShouldProcess(($localizedData.SetRegValueSucceeded -f "$Key\$valDisplayName", (ArrayToString -Value $setVal), $ValueType), $null, $null)) - { - try - { - # Finally set the $ValueName here - [Microsoft.Win32.Registry]::SetValue($keyInfo.Data.Name, $ValueName, $setVal, $ValueType) - } - catch [Exception] - { - Write-Verbose ($localizedData.SetRegValueFailed -f "$Key\$valDisplayName", (ArrayToString -Value $setVal), $ValueType) - - throw - } - } - } - - # --------------- - # ENSURE = ABSENT - elseif ($Ensure -ieq "Absent") - { - # If key doesn't exist, no action is required - if ($keyInfo.Ensure -ieq "Absent") - { - Write-Log ($localizedData.RegKeyDoesNotExist -f "$Key") - - return - } - - # If the code reaches here, the key exists - - # If ValueName is "" and ValueType and ValueData have not been specified, target the key for removal - if(!$ValueNameSpecified -and !$ValueTypeSpecified -and !$ValueDataSpecified) - { - # If this is not a Force removal and the Key contains subkeys, report no change and return - if (!$Force -and ($keyInfo.Data.SubKeyCount -gt 0)) - { - $errorMessage = $localizedData.RemoveRegKeyTreeFailed -f "$Key" - - Write-Log $errorMessage - - ThrowError -ExceptionName "System.InvalidOperationException" -ExceptionMessage $errorMessage -ExceptionObject $Force -ErrorId "CannotRemoveKeyTreeWithoutForceFlag" -ErrorCategory NotSpecified - } - - # If the control reaches here, either the $Force flag was specified or the Regkey has no subkeys. In either case we simply remove it. - - if ($PSCmdlet.ShouldProcess(($localizedData.RemoveRegKeySucceeded -f $Key), $null, $null)) - { - try - { - # Formulate hiveName and subkeyName compatible with .NET APIs - $hiveName = $keyInfo.Data.PSDrive.Root.Replace("_","").Replace("HKEY","") - $subkeyName = $keyInfo.Data.Name.Substring($keyInfo.Data.Name.IndexOf("\")+1) - - # Finally remove the subkeytree - [Microsoft.Win32.Registry]::$hiveName.DeleteSubKeyTree($subkeyName) - } - catch [Exception] - { - Write-Verbose ($localizedData.RemoveRegKeyFailed -f "$Key") - - throw - } - } - - return - } - - # If the control reaches here, ValueName has been specified so a RegValue needs be removed (if found) - - # Get the appropriate display name for the specified ValueName (to handle the Default RegValue case) - $valDisplayName = GetValueDisplayName -ValueName $ValueName - - # Query the specified $ValueName - $valData = $keyInfo.Data.GetValue($ValueName) - - # If $ValueName is not found in the specified $Key - if($valData -eq $null) - { - Write-Log ($localizedData.RegValueDoesNotExist -f "$Key\$valDisplayName") - - return - } - - # If the control reaches here, the specified Value has been found and should be removed. - - if ($PSCmdlet.ShouldProcess(($localizedData.RemoveRegValueSucceeded -f "$Key\$valDisplayName"), $null, $null)) - { - try - { - # Formulate hiveName and subkeyName compatible with .NET APIs - $hiveName = $keyInfo.Data.PSDrive.Root.Replace("_","").Replace("HKEY","") - $subkeyName = $keyInfo.Data.Name.Substring($keyInfo.Data.Name.IndexOf("\")+1) - - # Finally open the subkey and remove the RegValue in subkey - $subkey = [Microsoft.Win32.Registry]::$hiveName.OpenSubKey($subkeyName, $true) - $subkey.DeleteValue($ValueName) - - } - catch [Exception] - { - Write-Verbose ($localizedData.RemoveRegValueFailed -f "$Key\$valDisplayName") - - throw - } - } - } -} - - -#------------------------------- -# The Test-TargetResource cmdlet -#------------------------------- -FUNCTION Test-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [System.String] - $Key, - - [parameter(Mandatory)] - [AllowEmptyString()] - [ValidateNotNull()] - [System.String] - $ValueName, - - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", - - [ValidateNotNull()] - [System.String[]] - $ValueData = @(), - - [ValidateSet("String", "Binary", "DWord", "QWord", "MultiString", "ExpandString")] - [System.String] - $ValueType = "String", - - [System.Boolean] - $Hex = $false, - - # Force is not used in Test-TargetResource but is required by DSC engine to keep parameter-sets in parity for both SET and TEST - [System.Boolean] - $Force = $false - ) - - # Perform any required setup steps for the provider - SetupProvider -KeyName ([ref]$Key) - - # Query if the RegVal related parameters have been specified - $ValueNameSpecified = $PSBoundParameters.ContainsKey("ValueName") - $ValueTypeSpecified = $PSBoundParameters.ContainsKey("ValueType") - $ValueDataSpecified = $PSBoundParameters.ContainsKey("ValueData") - - # If an empty string ValueName has been specified and no ValueType and no ValueData has been specified, - # treat this case as if ValueName was not specified and target the Key itself. This is to cater the limitation - # that both Key and ValueName are mandatory now and we must special-case like this to target the Key only. - if (($ValueName -eq "") -and !$ValueTypeSpecified -and !$ValueDataSpecified) - { - $ValueNameSpecified = $false - } - - # Now, query the specified key - $keyInfo = Get-TargetResourceInternal -Key $Key -Verbose:$false - - # ---------------- - # ENSURE = PRESENT - if ($Ensure -ieq "Present") - { - # If key doesn't exist, the test fails - if ($keyInfo.Ensure -ieq "Absent") - { - Write-Verbose ($localizedData.RegKeyDoesNotExist -f $Key) - - return $false - } - - # If $ValueName, $ValueType and $ValueData are not specified, the simple existence of the Regkey satisfies the Ensure=Present condition, test is successful - if (!$ValueNameSpecified -and !$ValueDataSpecified -and !$ValueTypeSpecified) - { - Write-Verbose ($localizedData.RegKeyExists -f $Key) - - return $true - } - - # IF THE CONTROL REACHED HERE, THE KEY EXISTS AND A REGVALUE ATTRIBUTE HAS BEEN SPECIFIED - - # Get the appropriate display name for the specified ValueName (to handle the Default RegValue case) - $valDisplayName = GetValueDisplayName -ValueName $ValueName - - # Now query the specified Reg Value - $valData = Get-TargetResourceInternal -Key $Key -ValueName $ValueName -Verbose:$false - - # If the Value doesn't exist, the test has failed - if ($valData.Ensure -ieq "Absent") - { - Write-Verbose ($localizedData.RegValueDoesNotExist -f "$Key\$valDisplayName") - - return $false - } - - # IF THE CONTROL REACHED HERE, THE KEY EXISTS AND THE SPECIFIED (or Default) VALUE EXISTS - - # If the $ValueType has been specified and it doesn't match the type of the found RegValue, test fails - if ($ValueTypeSpecified -and ($ValueType -ine $valData.ValueType)) - { - Write-Verbose ($localizedData.RegValueTypeMismatch -f "$Key\$valDisplayName", $ValueType) - - return $false - } - - # If an explicit ValueType has not been specified, given the Value already exists in Registry, assume the ValueType to be of the existing Value - if (!$ValueTypeSpecified) - { - $ValueType = $valData.ValueType - } - - # If $ValueData has been specified, match the data of the found Regvalue. - if ($ValueDataSpecified -and !(ValueDataMatches -RetrievedValue $valData -ValueType $ValueType -ValueData $ValueData)) - { - # Since the $ValueData specified didn't match the data of the found RegValue, test failed - Write-Verbose ($localizedData.RegValueDataMismatch -f "$Key\$valDisplayName", $ValueType, (ArrayToString -Value $ValueData)) - - return $false - } - - # IF THE CONTROL REACHED HERE, ALL TESTS HAVE PASSED FOR THE SPECIFIED REGISTRY VALUE AND IT COMPLETELY MATCHES, REPORT SUCCESS - - Write-Verbose ($localizedData.RegValueExists -f "$Key\$valDisplayName", $valData.ValueType, (ArrayToString -Value $valData.Data)) - - return $true - } - - # --------------- - # ENSURE = ABSENT - elseif ($Ensure -ieq "Absent") - { - # If key doesn't exist, test is successful - if ($keyInfo.Ensure -ieq "Absent") - { - Write-Log ($localizedData.RegKeyDoesNotExist -f "$Key") - - return $true - } - - # IF CONTROL REACHED HERE, THE SPECIFIED KEY EXISTS - - # If $ValueName, $ValueType and $ValueData are not specified, the simple existence of the Regkey fails the test - if (!$ValueNameSpecified -and !$ValueDataSpecified -and !$ValueTypeSpecified) - { - Write-Verbose ($localizedData.RegKeyExists -f $Key) - - return $false - } - - # IF THE CONTROL REACHED HERE, THE KEY EXISTS AND A REGVALUE ATTRIBUTE HAS BEEN SPECIFIED - - # Get the appropriate display name for the specified ValueName (to handle the Default RegValue case) - $valDisplayName = GetValueDisplayName -ValueName $ValueName - - # Now query the specified RegValue - $valData = Get-TargetResourceInternal -Key $Key -ValueName $ValueName -Verbose:$false - - # If the Value doesn't exist, the test has passed - if ($valData.Ensure -ieq "Absent") - { - Write-Verbose ($localizedData.RegValueDoesNotExist -f "$Key\$valDisplayName") - - return $true - } - - # IF THE CONTROL REACHED HERE, THE KEY EXISTS AND THE SPECIFIED (or Default) VALUE EXISTS, THUS REPORT FAILURE - - Write-Verbose ($localizedData.RegValueExists -f "$Key\$valDisplayName", $valData.ValueType, (ArrayToString -Value $valData.Data)) - - return $false - } -} - - -#-------------------------------------------- -# Utility to create an arbitrary registry key -#-------------------------------------------- -FUNCTION CreateRegistryKey -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Key - ) - - # Trim any "\" back-slash(es) at the end of the specified RegKey - $Key = ([string]$Key).TrimEnd('\') - - # Extract the parent-key - $slashIndex = $Key.LastIndexOf('\') - $parentKey = $Key.Substring(0, $slashIndex) - - # Check if the parent-key exists, if not first create that (recurse). - if ((Get-TargetResourceInternal -Key $parentKey -Verbose:$false).Ensure -eq "Absent") - { - CreateRegistryKey -Key $parentKey | Out-Null - } - - # Create the Regkey - $retVal = New-Item -Path $Key 2>&1 - - # Report any errors - if ($retVal -and $retVal.GetType().Name -ieq "ErrorRecord") - { - throw $retVal - } - - # If the control reaches here, the key was created successfully - return (Get-TargetResourceInternal -Key $Key -Verbose:$false) -} - - -#------------------------------------------- -# Validate PSDrive specified in Registry Key -#------------------------------------------- -FUNCTION ValidatePSDrive -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Key - ) - - # Extract the PSDriveName from the specified Key - $psDriveName = $Key.Substring(0, $Key.IndexOf(':')) - - # Query the specified PSDrive - $psDrive = Get-PSDrive $psDriveName -ErrorAction SilentlyContinue - - # Validate that the specified psdrive is a valid - if (($psDrive -eq $null) -or ($psDrive.Provider -eq $null) -or ($psDrive.Provider.Name -ine "Registry") -or !(IsValidRegistryRoot -PSDriveRoot $psDrive.Root)) - { - $errorMessage = $localizedData.InvalidPSDriveSpecified -f $psDriveName, $Key - ThrowError -ExceptionName "System.ArgumentException" -ExceptionMessage $errorMessage -ExceptionObject $Key -ErrorId "InvalidPSDrive" -ErrorCategory InvalidArgument - } -} - - -#-------------------------------------------------- -# Check if the PSDriveRoot is a valid registry root -#-------------------------------------------------- -FUNCTION IsValidRegistryRoot -{ - param - ( - [System.String] - $PSDriveRoot - ) - - # List of valid registry roots - $validRegistryRoots = @("HKEY_CLASSES_ROOT", "HKEY_CURRENT_USER", "HKEY_LOCAL_MACHINE", "HKEY_USERS", "HKEY_CURRENT_CONFIG") - - # Extract the base of the PSDrive root - if ($PSDriveRoot.Contains('\')) - { - $PSDriveRoot = $PSDriveRoot.Substring(0, $PSDriveRoot.IndexOf('\')) - } - - return ($validRegistryRoots -icontains $PSDriveRoot) -} - - -#---------------------------------------- -# Utility to write WhatIf or Verbose logs -#---------------------------------------- -FUNCTION Write-Log -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Message - ) - - if ($PSCmdlet.ShouldProcess($Message, $null, $null)) - { - Write-Verbose $Message - } -} - - -#------------------------------------ -# Utility to throw an error/exception -#------------------------------------ -FUNCTION ThrowError -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ExceptionName, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ExceptionMessage, - - [System.Object] - $ExceptionObject, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ErrorId, - - [parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.Management.Automation.ErrorCategory] - $ErrorCategory - ) - - $exception = New-Object $ExceptionName $ExceptionMessage; - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $ErrorId, $ErrorCategory, $ExceptionObject - throw $errorRecord -} - - -#---------------------------------------------------------------------- -# Utility to construct a strongly-typed object based on specified $Type -#---------------------------------------------------------------------- -FUNCTION GetTypedObject -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Type, - - [System.String[]] - $Data, - - [ValidateNotNull()] - [Boolean] - $Hex, - - [ref] $ReturnValue - ) - - $ArgumentExceptionScriptBlock = - { - Param($ErrorId) - - $errorMessage = $localizedData.ParameterValueInvalid -f "ValueData", (ArrayToString -Value $Data), $Type - Write-Verbose $errorMessage - ThrowError -ExceptionName "System.ArgumentException" -ExceptionMessage $errorMessage -ExceptionObject $Data -ErrorId $ErrorId -ErrorCategory InvalidArgument - } - - # The the $Type specified is not a multistring then we always expect a non-array $Data. If this is not the case, throw an error and let the user know. - if (($Type -ine "Multistring") -and ($Data -ne $null) -and ($Data.Count -gt 1)) - { - Invoke-Command -ScriptBlock $ArgumentExceptionScriptBlock -ArgumentList ([String]::Format("ArrayNotExpectedForType{0}", $Type)) - } - - Switch($Type) - { - # Case: String - "String" - { - if (($Data -eq $null) -or ($Data.Length -eq 0)) - { - $ReturnValue.Value = [String]::Empty - - return - } - - $ReturnValue.Value = [String]$Data[0] - } - - # Case: ExpandString - "ExpandString" - { - if (($Data -eq $null) -or ($Data.Length -eq 0)) - { - $ReturnValue.Value = [String]::Empty - - return - } - - $ReturnValue.Value = [String]$Data[0] - } - - # Case: MultiString - "MultiString" - { - if (($Data -eq $null) -or ($Data.Length -eq 0)) - { - $ReturnValue.Value = [String[]]@() - - return - } - - $ReturnValue.Value = [String[]]$Data - } - - # Case: DWord - "DWord" - { - if (($Data -eq $null) -or ($Data.Length -eq 0)) - { - $ReturnValue.Value = [Int32]0 - } - elseif ($Hex) - { - $retVal = $null - $val = $Data[0].TrimStart("0x") - - if ([Int32]::TryParse($val, "HexNumber", [System.Globalization.CultureInfo]::CurrentCulture, [ref] $retVal)) - { - $ReturnValue.Value = $retVal - } - else - { - Invoke-Command -ScriptBlock $ArgumentExceptionScriptBlock -ArgumentList "ValueDataNotInHexFormat" - } - } - else - { - $ReturnValue.Value = [Int32]::Parse($Data[0]) - } - } - - # Case: QWord - "QWord" - { - if (($Data -eq $null) -or ($Data.Length -eq 0)) - { - $ReturnValue.Value = [Int64]0 - } - elseif ($Hex) - { - $retVal = $null - $val = $Data[0].TrimStart("0x") - - if ([Int64]::TryParse($val, "HexNumber", [System.Globalization.CultureInfo]::CurrentCulture, [ref] $retVal)) - { - $ReturnValue.Value = $retVal - } - else - { - Invoke-Command -ScriptBlock $ArgumentExceptionScriptBlock -ArgumentList "ValueDataNotInHexFormat" - } - } - else - { - $ReturnValue.Value = [Int64]::Parse($Data[0]) - } - } - - # Case: Binary - "Binary" - { - if (($Data -eq $null) -or ($Data.Length -eq 0)) - { - $ReturnValue.Value = [Byte[]]@() - - return - } - - $binaryVal = $null - $val = $Data[0].TrimStart("0x") - if ($val.Length % 2 -ne 0) - { - $val = $val.PadLeft($val.Length+1, "0") - } - - try - { - $byteArray = [Byte[]]@() - - for ($i = 0 ; $i -lt ($val.Length-1) ; $i = $i+2) - { - $byteArray += [Byte]::Parse($val.Substring($i, 2), "HexNumber") - } - - $ReturnValue.Value = [Byte[]]$byteArray - } - catch [Exception] - { - Invoke-Command -ScriptBlock $ArgumentExceptionScriptBlock -ArgumentList "ValueDataNotInHexFormat" - } - } - } -} - - -#------------------------------------------------------- -# Utility to convert an array to a string representation -#------------------------------------------------------- -FUNCTION ArrayToString -{ - param - ( - [parameter(Mandatory = $true)] - [AllowEmptyCollection()] - [ValidateNotNull()] - [object[]] - $Value - ) - - if (!$Value.GetType().IsArray) - { - return $Value.ToString() - } - if ($Value.Length -eq 1) - { - return $Value[0].ToString() - } - - [System.Text.StringBuilder]$retString = "(" - - $Value | % {$retString = ($retString.ToString() + $_.ToString() + ", ")} - - $retString = $retString.ToString().TrimEnd(", ") + ")" - - return $retString.ToString() -} - - -#------------------------------------------------------- -# Utility to convert an array to a string representation -#------------------------------------------------------- -FUNCTION ConvertByteArrayToHexString -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.Object] - $Data - ) - - $retString = "" - $Data | % {$retString += [String]::Format("{0:x2}", $_)} - - return $retString -} - - -#-------------------------------------------------------------- -# Utility to handle the display name for the (Default) RegValue -#-------------------------------------------------------------- -FUNCTION GetValueDisplayName -{ - param - ( - [System.String] - $ValueName - ) - - if ([String]::IsNullOrEmpty($ValueName)) - { - return $localizedData.DefaultValueDisplayName - } - - return $ValueName -} - - -#--------------------------------------------------------- -# Utility to mount the optional Registry hives as PSDrives -#--------------------------------------------------------- -FUNCTION MountRequiredRegistryHives -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $KeyName - ) - - $psDriveNames = (Get-PSDrive).Name.ToUpperInvariant() - - if ($KeyName.StartsWith("HKCR","OrdinalIgnoreCase") -and !$psDriveNames.Contains("HKCR")) - { - New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT -Scope "Script" -WhatIf:$false | Out-Null - } - elseif ($KeyName.StartsWith("HKUS","OrdinalIgnoreCase") -and !$psDriveNames.Contains("HKUS")) - { - New-PSDrive -Name HKUS -PSProvider Registry -Root HKEY_USERS -Scope "Script" -WhatIf:$false | Out-Null - } - elseif ($KeyName.StartsWith("HKCC","OrdinalIgnoreCase") -and !$psDriveNames.Contains("HKCC")) - { - New-PSDrive -Name HKCC -PSProvider Registry -Root HKEY_CURRENT_CONFIG -Scope "Script" -WhatIf:$false | Out-Null - } - elseif ($KeyName.StartsWith("HKCU","OrdinalIgnoreCase") -and !$psDriveNames.Contains("HKCU")) - { - New-PSDrive -Name HKCU -PSProvider Registry -Root HKEY_CURRENT_USER -Scope "Script" -WhatIf:$false | Out-Null - } - elseif ($KeyName.StartsWith("HKLM","OrdinalIgnoreCase") -and !$psDriveNames.Contains("HKLM")) - { - New-PSDrive -Name HKLM -PSProvider Registry -Root HKEY_LOCAL_MACHINE -Scope "Script" -WhatIf:$false | Out-Null - } -} - - -#--------------------------------------------------------- -# Utility to mount the optional Registry hives as PSDrives -#--------------------------------------------------------- -FUNCTION SetupProvider -{ - param - ( - [ValidateNotNull()] - [ref] $KeyName - ) - - # Fix $KeyName if required - if (!$KeyName.Value.ToString().Contains(":")) - { - if ($KeyName.Value.ToString().StartsWith("hkey_users","OrdinalIgnoreCase")) - { - $KeyName.Value = $KeyName.Value.ToString() -replace "hkey_users", "HKUS:" - } - elseif ($KeyName.Value.ToString().StartsWith("hkey_current_config","OrdinalIgnoreCase")) - { - $KeyName.Value = $KeyName.Value.ToString() -replace "hkey_current_config", "HKCC:" - } - elseif ($KeyName.Value.ToString().StartsWith("hkey_classes_root","OrdinalIgnoreCase")) - { - $KeyName.Value = $KeyName.Value.ToString() -replace "hkey_classes_root", "HKCR:" - } - elseif ($KeyName.Value.ToString().StartsWith("hkey_local_machine","OrdinalIgnoreCase")) - { - $KeyName.Value = $KeyName.Value.ToString() -replace "hkey_local_machine", "HKLM:" - } - elseif ($KeyName.Value.ToString().StartsWith("hkey_current_user","OrdinalIgnoreCase")) - { - $KeyName.Value = $KeyName.Value.ToString() -replace "hkey_current_user", "HKCU:" - } - else - { - $errorMessage = $localizedData.InvalidRegistryHiveSpecified -f $Key - ThrowError -ExceptionName "System.ArgumentException" -ExceptionMessage $errorMessage -ExceptionObject $KeyName -ErrorId "InvalidRegistryHive" -ErrorCategory InvalidArgument - } - } - - # Mount any required registry hives - MountRequiredRegistryHives -KeyName $KeyName.Value.ToString() - - # Check the target PSDrive to be a valid Registry Hive root - ValidatePSDrive -Key $KeyName.Value.ToString() -} - -#---------------------------------------------------------------------------------------- -# Refactored utility to decide if the ValueData specified matches the ValueData retrieved -#---------------------------------------------------------------------------------------- -FUNCTION ValueDataMatches -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.Object] - $RetrievedValue, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ValueType, - - [System.String[]] - $ValueData - ) - - # Convert the specified $ValueData into strongly-typed data for correct comparsion - $specifiedData = $null - $retrievedData = $RetrievedValue.Data - - GetTypedObject -Type $ValueType -Data $ValueData -Hex $Hex -ReturnValue ([ref]$specifiedData) - - # Special case for binary comparison (do hex-string comparison) - if ($ValueType -ieq "Binary") - { - $specifiedData = $ValueData[0].PadLeft($retrievedData.Length, '0') - } - - # If the ValueType is not multistring, do a simple comparison - if ($ValueType -ine "Multistring") - { - return ($specifiedData -ieq $retrievedData) - } - - # IF THE CONTROL REACHES HERE, THE ValueType IS A "MultiString" and we need a size-based and element-by-element comparsion for it - - # Array-size comparison - if ($specifiedData.Length -ne $retrievedData.Length) - { - # Size mismatch - return $false - } - - # Element-by-Element comparison - for ($i = 0 ; $i -lt $specifiedData.Length ; $i++) - { - if ($specifiedData[$i] -ine $retrievedData[$i]) - { - return $false - } - } - - # IF THE CONTROL REACHED HERE, THE Multistring COMPARISON WAS SUCCESSFUL - return $true -} - -Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/MSFT_RegistryResource.schema.mof b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/MSFT_RegistryResource.schema.mof deleted file mode 100644 index 4a40e1c..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/MSFT_RegistryResource.schema.mof and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/ko-KR/MSFT_RegistryResource.schema.mfl b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/ko-KR/MSFT_RegistryResource.schema.mfl deleted file mode 100644 index 1f31ec4..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/ko-KR/MSFT_RegistryResource.schema.mfl and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/ko-KR/MSFT_RegistryResource.strings.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/ko-KR/MSFT_RegistryResource.strings.psd1 deleted file mode 100644 index 6e9ddd3..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/ko-KR/MSFT_RegistryResource.strings.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/MSFT_RoleResource.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/MSFT_RoleResource.psm1 deleted file mode 100644 index 1028272..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/MSFT_RoleResource.psm1 +++ /dev/null @@ -1,538 +0,0 @@ -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -SetTargetResourceInstallwhatIfMessage=Trying to install feature {0} -SetTargetResourceUnInstallwhatIfMessage=Trying to Uninstall feature {0} -FeatureNotFoundError=The requested feature {0} is not found on the target machine. -FeatureDiscoveryFailureError=Failure to get the requested feature {0} information from the target machine. Wildcard pattern is not supported in the feature name. -FeatureInstallationFailureError=Failure to successfully install the feature {0} . -FeatureUnInstallationFailureError=Failure to successfully Unintstall the feature {0} . -QueryFeature=Querying for feature {0} using Server Manager cmdlet Get-WindowsFeature. -InstallFeature=Trying to install feature {0} using Server Manager cmdlet Add-WindowsFeature. -UninstallFeature=Trying to Uninstall feature {0} using Server Manager cmdlet Remove-WindowsFeature. -RestartNeeded=The Target machine needs to be restarted. -GetTargetResourceStartVerboseMessage=Begin executing Get functionality on the {0} feature. -GetTargetResourceEndVerboseMessage=End executing Get functionality on the {0} feature. -SetTargetResourceStartVerboseMessage=Begin executing Set functionality on the {0} feature. -SetTargetResourceEndVerboseMessage=End executing Set functionality on the {0} feature. -TestTargetResourceStartVerboseMessage=Begin executing Test functionality on the {0} feature. -TestTargetResourceEndVerboseMessage=End executing Test functionality on the {0} feature. -ServerManagerModuleNotFoundDebugMessage=ServerManager module is not installed on the machine. -SkuNotSupported=Installing roles and features using PowerShell Desired State Configuration is supported only on Server SKU's. It is not supported on Client SKU. -SourcePropertyNotSupportedDebugMessage=Source property in MSFT_RoleResource is not supported on this operating system and it was ignored. -EnableServerManagerPSHCmdletsFeature=Windows Server 2008R2 Core operating system detected: ServerManager-PSH-Cmdlets feature has been enabled. -UninstallSuccess=Successfully uninstalled the feature {0}. -InstallSuccess=Successfully installed the feature {0}. -'@ -} - -Import-LocalizedData LocalizedData -filename MSFT_RoleResourceStrings - -# The Get-TargetResource cmdlet is used to fetch the status of role or feature on the target machine. -# It gives the feature info of the requested role/feature on the target machine. -function Get-TargetResource -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] - $Name, - - [Parameter(Mandatory=$false)] - [System.Management.Automation.PSCredential] - $Credential - ) - - $getTargetResourceResult = $null; - - $getTargetResourceStartVerboseMessage = $($LocalizedData.GetTargetResourceStartVerboseMessage) -f ${Name} ; - Write-Debug -Message $getTargetResourceStartVerboseMessage; - - ValidatePrerequisites ; - - $qyeryFeatureMessage = $($LocalizedData.QueryFeature) -f ${Name} ; - Write-Debug -Message $qyeryFeatureMessage; - - $isR2Sp1 = IsWinServer2008R2SP1; - if($isR2Sp1 -and $psboundparameters.ContainsKey("Credential")) - { - $parameters = $psboundparameters.Remove("Credential"); - $feature = Invoke-Command -ScriptBlock { Get-WindowsFeature @using:psboundparameters } -ComputerName . -Credential $Credential -ErrorVariable ev - $psboundparameters.Add("Credential", $Credential); - } - else - { - $feature = Get-WindowsFeature @psboundparameters -ErrorVariable ev - } - - if($null -eq $ev -or $ev.Count -eq 0) - { - $foundError = $false; - - ValidateFeature $feature $Name; - - # If a feature does not contain SubFeature then $includeAllSubFeature would be set to $false. - # If a feature contains one or more subfeatures then $includeAllSubFeature would be set to - # $true only if all the subfeatures are installed, or else $includeAllSubFeature would be set to $false. - $includeAllSubFeature = $true; - - if($feature.SubFeatures.Count -eq 0) - { - $includeAllSubFeature = $false; - } - else - { - foreach($currentSubFeature in $feature.SubFeatures) - { - if($foundError -eq $false) - { - $parameters = $psboundparameters.Remove("Name"); - $psboundparameters.Add("Name", $currentSubFeature); - - $isR2Sp1 = IsWinServer2008R2SP1; - if($isR2Sp1 -and $psboundparameters.ContainsKey("Credential")) - { - $parameters = $psboundparameters.Remove("Credential"); - $subFeature = Invoke-Command -ScriptBlock { Get-WindowsFeature @using:psboundparameters } -ComputerName . -Credential $Credential -ErrorVariable errorVar - $psboundparameters.Add("Credential", $Credential); - } - else - { - $subFeature = Get-WindowsFeature @psboundparameters -ErrorVariable errorVar - } - - if($null -eq $errorVar -or $errorVar.Count -eq 0) - { - ValidateFeature $subFeature $currentSubFeature; - - if(!$subFeature.Installed) - { - $includeAllSubFeature = $false; - break; - } - } - else - { - $foundError = $true;; - } - } - } - } - - if($foundError -eq $false) - { - if($feature.Installed) - { - $ensureResult = "Present"; - } - else - { - $ensureResult = "Absent"; - } - - # Add all feature properties to the hash table - $getTargetResourceResult = @{ - Name = $feature.Name; - DisplayName = $feature.DisplayName; - Ensure = $ensureResult; - IncludeAllSubFeature = $includeAllSubFeature; - } - - $getTargetResourceEndVerboseMessage = $($LocalizedData.GetTargetResourceEndVerboseMessage) -f ${Name} ; - Write-Debug -Message $getTargetResourceEndVerboseMessage; - - $getTargetResourceResult; - } - } -} - - -# The Set-TargetResource cmdlet is used to install or uninstall a role on the target machine. -# It also supports installing & uninstalling the role or feature specific subfeatures. -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess=$true, DefaultParameterSetName = "FeatureName")] - - param - ( - [parameter(Mandatory=$true, ParameterSetName = "FeatureName")] - [ValidateNotNullOrEmpty()] - [string] - $Name, - - [parameter()] - [ValidateSet("Present", "Absent")] - [string] - $Ensure = "Present", - - [parameter()] - [ValidateNotNullOrEmpty()] - [string] - $Source, - - [parameter()] - [switch] - $IncludeAllSubFeature, - - [Parameter(Mandatory=$false)] - [System.Management.Automation.PSCredential] - $Credential, - - [ValidateNotNullOrEmpty()] - [string] - $LogPath - ) - - $getTargetResourceResult = $null; - - $inputParameter = $null; - - $setTargetResourceStartVerboseMessage = $($LocalizedData.SetTargetResourceStartVerboseMessage) -f ${Name} ; - Write-Debug -Message $setTargetResourceStartVerboseMessage; - - ValidatePrerequisites ; - - # -Source Parameter is not applicable to Windows Server 2008 R2 SP1. Hence removing it. - # all role/feature spcific binaries are avaliable inboc on Windows Server 2008 R2 SP1, hence - # -Source is not supported on Windows Server 2008 R2 SP1. - $isR2Sp1 = IsWinServer2008R2SP1; - if($isR2Sp1 -and $psboundparameters.ContainsKey("Source")) - { - $sourcePropertyNotSupportedDebugMessage = $($LocalizedData.SourcePropertyNotSupportedDebugMessage) ; - Write-Debug -Message $sourcePropertyNotSupportedDebugMessage; - - $parameters = $psboundparameters.Remove("Source"); - } - - - if($Ensure -eq "Present") - { - $parameters = $psboundparameters.Remove("Ensure"); - - $installFeatureMessage = $($LocalizedData.InstallFeature) -f ${Name} ; - Write-Debug -Message $installFeatureMessage; - - $isR2Sp1 = IsWinServer2008R2SP1; - if($isR2Sp1 -and $psboundparameters.ContainsKey("Credential")) - { - $parameters = $psboundparameters.Remove("Credential"); - $feature = Invoke-Command -ScriptBlock { Add-WindowsFeature @using:psboundparameters } -ComputerName . -Credential $Credential -ErrorVariable ev - $psboundparameters.Add("Credential", $Credential); - } - else - { - $feature = Add-WindowsFeature @psboundparameters -ErrorVariable ev - } - - if($feature -ne $null -and $feature.Success -eq $true) - { - Write-Verbose ($LocalizedData.InstallSuccess -f $Name) - - # Check if reboot is required, if so notify CA. - if($feature.RestartNeeded -eq "Yes") - { - $restartNeededMessage = $($LocalizedData.RestartNeeded); - Write-Verbose -Message $restartNeededMessage; - - $global:DSCMachineStatus = 1; - } - } - else - { - # Add-WindowsFeature cmdlet falied to successfully install the requested feature. - # If there are errors from the Add-WindowsFeature cmdlet. We surface those errors. - # If Add-WindwosFeature cmdlet does not surface any errors. Then the provider throws a - # terminating error. - if($null -eq $ev -or $ev.Count -eq 0) - { - $errorId = "FeatureInstallationFailure"; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidOperation; - $errorMessage = $($LocalizedData.FeatureInstallationFailureError) -f ${Name} ; - $exception = New-Object System.InvalidOperationException $errorMessage ; - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord); - } - } - } - else - { - $parameters = $psboundparameters.Remove("Ensure"); - $parameters = $psboundparameters.Remove("IncludeAllSubFeature"); - $parameters = $psboundparameters.Remove("Source"); - - $uninstallFeatureMessage = $($LocalizedData.UninstallFeature) -f ${Name} ; - Write-Debug -Message $uninstallFeatureMessage; - - $isR2Sp1 = IsWinServer2008R2SP1; - if($isR2Sp1 -and $psboundparameters.ContainsKey("Credential")) - { - $parameters = $psboundparameters.Remove("Credential"); - $feature = Invoke-Command -ScriptBlock { Remove-WindowsFeature @using:psboundparameters } -ComputerName . -Credential $Credential -ErrorVariable ev - $psboundparameters.Add("Credential", $Credential); - } - else - { - $feature = Remove-WindowsFeature @psboundparameters -ErrorVariable ev - } - - if($feature -ne $null -and $feature.Success -eq $true) - { - Write-Verbose ($LocalizedData.UninstallSuccess -f $Name) - - # Check if reboot is required, if so notify CA. - if($feature.RestartNeeded -eq "Yes") - { - $restartNeededMessage = $($LocalizedData.RestartNeeded); - Write-Verbose -Message $restartNeededMessage; - - $global:DSCMachineStatus = 1; - } - } - else - { - # Remove-WindowsFeature cmdlet falied to successfully Uninstall the requested feature. - # If there are errors from the Remove-WindowsFeature cmdlet. We surface those errors. - # If Remove-WindwosFeature cmdlet does not surface any errors. Then the provider throws a - # terminating error. - if($null -eq $ev -or $ev.Count -eq 0) - { - $errorId = "FeatureUnInstallationFailure"; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidOperation; - $errorMessage = $($LocalizedData.FeatureUnInstallationFailureError) -f ${Name} ; - $exception = New-Object System.InvalidOperationException $errorMessage ; - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord); - } - } - } - - $setTargetResourceEndVerboseMessage = $($LocalizedData.SetTargetResourceEndVerboseMessage) -f ${Name} ; - Write-Debug -Message $setTargetResourceEndVerboseMessage; -} - -# The Test-TargetResource cmdlet is used to validate if the role or feature is in a state as expected in the instance document. -function Test-TargetResource -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] - $Name, - - [parameter()] - [ValidateSet("Present", "Absent")] - [string] - $Ensure = "Present", - - [parameter()] - [ValidateNotNullOrEmpty()] - [string] - $Source, - - [parameter()] - [switch] - $IncludeAllSubFeature, - - [Parameter()] - [System.Management.Automation.PSCredential] - $Credential, - - [ValidateNotNullOrEmpty()] - [string] - $LogPath - - ) - - $testTargetResourceStartVerboseMessage = $($LocalizedData.TestTargetResourceStartVerboseMessage) -f ${Name} ; - Write-Debug -Message $testTargetResourceStartVerboseMessage; - - ValidatePrerequisites ; - - $testTargetResourceResult = $false; - - $parameters = $psboundparameters.Remove("Ensure"); - $parameters = $psboundparameters.Remove("IncludeAllSubFeature"); - $parameters = $psboundparameters.Remove("Source"); - - $qyeryFeatureMessage = $($LocalizedData.QueryFeature) -f ${Name} ; - Write-Debug -Message $qyeryFeatureMessage; - - $isR2Sp1 = IsWinServer2008R2SP1; - if($isR2Sp1 -and $psboundparameters.ContainsKey("Credential")) - { - $parameters = $psboundparameters.Remove("Credential"); - $feature = Invoke-Command -ScriptBlock { Get-WindowsFeature @using:psboundparameters } -ComputerName . -Credential $Credential -ErrorVariable ev - $psboundparameters.Add("Credential", $Credential); - } - else - { - $feature = Get-WindowsFeature @psboundparameters -ErrorVariable ev - } - - - if($null -eq $ev -or $ev.Count -eq 0) - { - ValidateFeature $feature $Name; - - - # Check if the feature is in the requested Ensure state. - # If so then check if then check if the subfeature is in the requested Ensure state. - if(($Ensure -eq "Present" -and $feature.Installed -eq $true) -or - ($Ensure -eq "Absent" -and $feature.Installed -eq $false)) - { - $testTargetResourceResult = $true; - - # IncludeAllSubFeature is set to $true, so we need to make - # sure that all Sub Features are alsi installed. - if($IncludeAllSubFeature) - { - - foreach($currentSubFeature in $feature.SubFeatures) - { - $parameters = $psboundparameters.Remove("Name"); - $parameters = $psboundparameters.Remove("Ensure"); - $parameters = $psboundparameters.Remove("IncludeAllSubFeature"); - $parameters = $psboundparameters.Remove("Source"); - $psboundparameters.Add("Name", $currentSubFeature); - - $isR2Sp1 = IsWinServer2008R2SP1; - if($isR2Sp1 -and $psboundparameters.ContainsKey("Credential")) - { - $parameters = $psboundparameters.Remove("Credential"); - $subFeature = Invoke-Command -ScriptBlock { Get-WindowsFeature @using:psboundparameters } -ComputerName . -Credential $Credential -ErrorVariable errorVar - $psboundparameters.Add("Credential", $Credential); - } - else - { - $subFeature = Get-WindowsFeature @psboundparameters -ErrorVariable errorVar - } - - - if($null -eq $errorVar -or $errorVar.Count -eq 0) - { - ValidateFeature $subFeature $currentSubFeature; - - if(!$subFeature.Installed) - { - $testTargetResourceResult = $false; - break; - } - } - } - } - } - - $testTargetResourceEndVerboseMessage = $($LocalizedData.TestTargetResourceEndVerboseMessage) -f ${Name} ; - Write-Debug -Message $testTargetResourceEndVerboseMessage; - - $testTargetResourceResult; - } -} - - -# ValidateFeature is a helper function used to validate the results of SM+ cmdlets -# Get-Windowsfeature for the user supplied feature name. -function ValidateFeature -{ - param - ( - [object] $feature, - - [string] $Name - ) - - if($null -eq $feature) - { - $errorId = "FeatureNotFound"; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidOperation - $errorMessage = $($LocalizedData.FeatureNotFoundError) -f ${Name} - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord); - } - - # WildCard pattern is not supported by the role provider. - # Hence we restrict user to request only one feature information in a single request. - if($feature.Count -gt 1) - { - $errorId = "FeatureDiscoveryFailure"; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidResult - $errorMessage = $($LocalizedData.FeatureDiscoveryFailureError) -f ${Name} - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord); - } -} - -# ValidatePrerequisites is a helper function used to validate if the MSFT_RoleResource is supported on the target machine. -# MSFT_RoleResource is supported only on Server SKU's. MSFT_RoleResource depend on ServerManagerModule which is avaliable -# only on Server SKU's. -function ValidatePrerequisites -{ - param - ( - ) - - #Enable ServerManager-PSH-Cmdlets feature if os is WS2008R2 Core. - $datacenterServerCore = 12 - $standardServerCore = 13 - $EnterpriseServerCore = 14 - - $operatingSystem = Get-WmiObject -Class Win32_operatingsystem - if($operatingSystem.Version.StartsWith('6.1.') -and - (($operatingSystem.OperatingSystemSKU -eq $datacenterServerCore) -or ($operatingSystem.OperatingSystemSKU -eq $standardServerCore) -or ($operatingSystem.OperatingSystemSKU -eq $EnterpriseServerCore))) - { - Write-Verbose -Message $($LocalizedData.EnableServerManagerPSHCmdletsFeature) - - # Update:ServerManager-PSH-Cmdlets has a depndency on Powershell 2 update: MicrosoftWindowsPowerShell - # Hence enabling MicrosoftWindowsPowerShell. - dism /online /enable-feature /FeatureName:MicrosoftWindowsPowerShell | Out-Null - dism /online /enable-feature /FeatureName:ServerManager-PSH-Cmdlets | Out-Null - } - - if(Import-Module ServerManager -PassThru -Verbose:$false -ErrorAction Ignore) - { - } - else - { - - $serverManagerModuleNotFoundDebugMessage = $($LocalizedData.ServerManagerModuleNotFoundDebugMessage); - Write-Debug -Message $serverManagerModuleNotFoundDebugMessage; - - $errorId = "SkuNotSupported"; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidOperation - $errorMessage = $($LocalizedData.SkuNotSupported) - $exception = New-Object System.InvalidOperationException $errorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord); - } -} - - -# IsWinServer2008R2SP1 is a helper function to detect if the target machine is a Win 2008 R2 SP1. -function IsWinServer2008R2SP1 -{ - param - ( - ) - - # We are already checking for the Presence of ServerManager module before using this helper function. - # Hence checking for the version shoudl be good enough to confirm that the target machine is - # Windows Server 2008 R2 machine. - if([Environment]::OSVersion.Version.ToString().Contains("6.1.")) - { - return $true; - } - - return $false; -} - -Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/MSFT_RoleResource.schema.mof b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/MSFT_RoleResource.schema.mof deleted file mode 100644 index 7fea155..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/MSFT_RoleResource.schema.mof and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/ko-KR/MSFT_RoleResource.schema.mfl b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/ko-KR/MSFT_RoleResource.schema.mfl deleted file mode 100644 index ce43b89..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/ko-KR/MSFT_RoleResource.schema.mfl and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/ko-KR/MSFT_RoleResourceStrings.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/ko-KR/MSFT_RoleResourceStrings.psd1 deleted file mode 100644 index a517a1b..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/ko-KR/MSFT_RoleResourceStrings.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/MSFT_ScriptResource.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/MSFT_ScriptResource.psm1 deleted file mode 100644 index 2480853..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/MSFT_ScriptResource.psm1 +++ /dev/null @@ -1,326 +0,0 @@ - -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -SetScriptWhatIfMessage=Executing the SetScript with the user supplied credential -InValidResultFromGetScriptError=Failure to get the results from the script in a hash table format. -InValidResultFromTestScriptError=Failure to get a valid result from the execution of TestScript. The Test script should return True or False. -ScriptBlockProviderScriptExecutionFailureError=Failure to successfully execute the script. -GetTargetResourceStartVerboseMessage=Begin executing Get Script. -GetTargetResourceEndVerboseMessage=End executing Get Script. -SetTargetResourceStartVerboseMessage=Begin executing Set Script. -SetTargetResourceEndVerboseMessage=End executing Set Script. -TestTargetResourceStartVerboseMessage=Begin executing Test Script. -TestTargetResourceEndVerboseMessage=End executing Test Script. -ExecutingScriptMessage=Executing Script: {0} -ResourceNotAllowedWhenDeviceGuardIsEnabled='Script' resource from 'PSDesiredStateConfiguration' module is not supported when Device Guard is enabled. Please use 'Script' resource published by PSDscResources module from PowerShell Gallery. -WarningRunningScriptResourceInFullLanguageMode=Running 'Script' resource in FullLanguage mode as Device Guard is enabled in 'Audit' mode. -'@ -} - -$GenericMessageEventID=0x1005; -$ClassName="MSFT_ScriptResource" - - -Import-LocalizedData LocalizedData -filename MSFT_ScriptResourceStrings - - -# The Get-TargetResource cmdlet is used to fetch the desired state of the DSC managed node through a powershell script. -# This cmdlet executes the user supplied script (i.e., the script is responsible for validating the desired state of the -# DSC managed node). The result of the script execution is in the form of a hashtable containing all the inormation -# gathered from the GetScript execution. -function Get-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] - $GetScript, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string]$SetScript, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] - $TestScript, - - [Parameter(Mandatory=$false)] - [System.Management.Automation.PSCredential] - $Credential - ) - - # Inbox 'Script' resource is not allowed to execute if Device Guard is enabled. - # Check and throw terminating error if Device Guard is enabled. - CheckDeviceGuardStatus - - $getTargetResourceResult = $null; - - $getTargetResourceStartVerboseMessage = $($LocalizedData.GetTargetResourceStartVerboseMessage); - Write-Debug -Message $getTargetResourceStartVerboseMessage; - - $script = [ScriptBlock]::Create($GetScript); - $parameters = $psboundparameters.Remove("GetScript"); - $psboundparameters.Add("ScriptBlock", $script); - - $parameters = $psboundparameters.Remove("SetScript"); - $parameters = $psboundparameters.Remove("TestScript"); - - $scriptResult = ScriptExecutionHelper @psboundparameters; - - $scriptResultAsErrorRescord = $scriptResult -as [System.Management.Automation.ErrorRecord] - if($null -ne $scriptResultAsErrorRescord) - { - $PSCmdlet.ThrowTerminatingError($scriptResultAsErrorRescord); - } - - $scriptResultAsHasTable = $scriptResult -as [hashtable] - - if($null -ne $scriptResultAsHasTable) - { - $getTargetResourceResult = $scriptResultAsHasTable ; - } - else - { - # Error message indicating failure to get valid hashtable as the result of the Get script execution. - $errorId = "InValidResultFromGetScript"; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidResult; - $exception = New-Object System.InvalidOperationException $($LocalizedData.InValidResultFromGetScriptError); - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord); - } - - $getTargetResourceEndVerboseMessage = $($LocalizedData.GetTargetResourceEndVerboseMessage); - Write-Debug -Message $getTargetResourceEndVerboseMessage; - - $getTargetResourceResult; -} - - -# The Set-TargetResource cmdlet is used to Set the desired state of the DSC managed node through a powershell script. -# The method executes the user supplied script (i.e., the script is responsible for validating the desired state of the -# DSC managed node). If the DSC managed node requires a restart either during or after the execution of the SetScript, -# the SetScript notifies the PS Infrasturcure by setting the variable $DSCMachineStatus.IsRestartRequired to $true. -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] - $SetScript, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] - $GetScript, - - [Parameter(Mandatory=$false)] - [System.Management.Automation.PSCredential] - $Credential, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] - $TestScript - - ) - - # Inbox 'Script' resource is not allowed to execute if Device Guard is enabled. - # Check and throw terminating error if Device Guard is enabled. - CheckDeviceGuardStatus - - $setscriptmessage = '$SetScript:' + $SetScript - $testscriptmessage = '$TestScript:' + $TestScript - if ($pscmdlet.ShouldProcess($($LocalizedData.SetScriptWhatIfMessage))) - { - $setTargetResourceStartVerboseMessage = $($LocalizedData.SetTargetResourceStartVerboseMessage); - Write-Debug -Message $setTargetResourceStartVerboseMessage; - - $script = [ScriptBlock]::Create($SetScript); - $parameters = $psboundparameters.Remove("SetScript"); - $psboundparameters.Add("ScriptBlock", $script); - - $parameters = $psboundparameters.Remove("GetScript"); - $parameters = $psboundparameters.Remove("TestScript"); - - $scriptResult = ScriptExecutionHelper @psboundparameters ; - - $scriptResultAsErrorRescord = $scriptResult -as [System.Management.Automation.ErrorRecord] - if($null -ne $scriptResultAsErrorRescord) - { - $PSCmdlet.ThrowTerminatingError($scriptResultAsErrorRescord); - } - - $setTargetResourceEndVerboseMessage = $($LocalizedData.SetTargetResourceEndVerboseMessage); - Write-Debug -Message $setTargetResourceEndVerboseMessage; - } -} - - -# The Test-TargetResource cmdlet is used to validate the desired state of the DSC managed node through a powershell script. -# The method executes the user supplied script (i.e., the script is responsible for validating the desired state of the -# DSC managed node). The result of the script execution should be true if the DSC managed machine is in the desired state -# or else false should be returned. -function Test-TargetResource -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] - $TestScript, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string]$SetScript, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string]$GetScript, - - [Parameter(Mandatory=$false)] - [System.Management.Automation.PSCredential] - $Credential - ) - - # Inbox 'Script' resource is not allowed to execute if Device Guard is enabled. - # Check and throw terminating error if Device Guard is enabled. - CheckDeviceGuardStatus - - $testTargetResourceResult = $false; - - $testTargetResourceStartVerboseMessage = $($LocalizedData.TestTargetResourceStartVerboseMessage); - Write-Debug -Message $testTargetResourceStartVerboseMessage; - - $script = [ScriptBlock]::Create($TestScript); - $parameters = $psboundparameters.Remove("TestScript"); - $psboundparameters.Add("ScriptBlock", $script); - - $parameters = $psboundparameters.Remove("GetScript"); - $parameters = $psboundparameters.Remove("SetScript"); - - $scriptResult = ScriptExecutionHelper @psboundparameters ; - - $scriptResultAsErrorRescord = $scriptResult -as [System.Management.Automation.ErrorRecord] - if($null -ne $scriptResultAsErrorRescord) - { - $PSCmdlet.ThrowTerminatingError($scriptResultAsErrorRescord); - } - - if($null -eq $scriptResult) - { - $errorId = "InValidResultFromTestScript"; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidResult; - $exception = New-Object System.InvalidOperationException $($LocalizedData.InValidResultFromTestScriptError) ; - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord); - } - - # If the script is returing multiple objects, then we consider the last object to be the result of script execution. - if($scriptResult.GetType().ToString() -eq 'System.Object[]') - { - $reultObject = $scriptResult[$scriptResult.Length -1]; - } - else - { - $reultObject = $scriptResult; - } - - if(($null -ne $reultObject) -and - (($reultObject -eq $true) -or ($reultObject -eq $false))) - { - $testTargetResourceResult = $reultObject; - } - else - { - $errorId = "InValidResultFromTestScript"; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidResult; - $exception = New-Object System.InvalidOperationException $($LocalizedData.InValidResultFromTestScriptError) ; - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - - $PSCmdlet.ThrowTerminatingError($errorRecord); - } - - $testTargetResourceEndVerboseMessage = $($LocalizedData.TestTargetResourceEndVerboseMessage); - Write-Debug -Message $testTargetResourceEndVerboseMessage; - - $testTargetResourceResult; -} - -function CheckDeviceGuardStatus -{ - try - { - # Check if Device Guard is enabled. - $systemLockdownPolicy = [System.Management.Automation.Security.SystemPolicy]::GetSystemLockdownPolicy() - if($systemLockdownPolicy -eq [System.Management.Automation.Security.SystemEnforcementMode]::Enforce) - { - $errorId = "ResourceNotAllowedWhenDeviceGuardIsEnabled"; - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidOperation; - $exception = New-Object System.InvalidOperationException $($LocalizedData.ResourceNotAllowedWhenDeviceGuardIsEnabled); - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - $PSCmdlet.ThrowTerminatingError($errorRecord); - } - elseif ($systemLockdownPolicy -eq [System.Management.Automation.Security.SystemEnforcementMode]::Audit) - { - Write-Warning ($LocalizedData.WarningRunningScriptResourceInFullLanguageMode) - } - } - catch - { - if($_.FullyQualifiedErrorId -eq 'TypeNotFound') - { - # [System.Management.Automation.Security.SystemPolicy] Type not found. - # It may happen with old PowerShell version. - # Silently continue. - return - } - - # Failed to get Device Guard status. - throw $_ - } -} - -function ScriptExecutionHelper -{ - param - ( - [ScriptBlock] - $ScriptBlock, - - [System.Management.Automation.PSCredential] - $Credential - ) - - $scriptExecutionResult = $null; - - try - { - - $executingScriptMessage = $($LocalizedData.ExecutingScriptMessage) -f ${ScriptBlock} ; - Write-Debug -Message $executingScriptMessage; - - if($null -ne $Credential) - { - $scriptExecutionResult = Invoke-Command -ScriptBlock $ScriptBlock -ComputerName . -Credential $Credential - } - else - { - $scriptExecutionResult = &$ScriptBlock; - } - $scriptExecutionResult; - } - catch - { - # Surfacing the error thrown by the execution of Get/Set/Test script. - $_; - } -} diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/MSFT_ScriptResource.schema.mof b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/MSFT_ScriptResource.schema.mof deleted file mode 100644 index 125dc8a..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/MSFT_ScriptResource.schema.mof and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/ko-KR/MSFT_ScriptResource.schema.mfl b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/ko-KR/MSFT_ScriptResource.schema.mfl deleted file mode 100644 index 3b8fd49..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/ko-KR/MSFT_ScriptResource.schema.mfl and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/ko-KR/MSFT_ScriptResourceStrings.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/ko-KR/MSFT_ScriptResourceStrings.psd1 deleted file mode 100644 index ad483a1..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/ko-KR/MSFT_ScriptResourceStrings.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/MSFT_ServiceResource.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/MSFT_ServiceResource.psm1 deleted file mode 100644 index f3c714b..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/MSFT_ServiceResource.psm1 +++ /dev/null @@ -1,1256 +0,0 @@ -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @" -ServiceNotFound=Service '{0}' not found. -CannotStartAndDisable=Cannot start and disable a service. -CannotStopServiceSetToStartAutomatically=Cannot stop a service and set it to start automatically. -ServiceAlreadyStarted=Service '{0}' already started, no action required. -ServiceStarted=Service '{0}' started. -ServiceStopped=Service '{0}' stopped. -ErrorStartingService=Failure starting service '{0}'. Please check the path '{1}' provided for the service. Message: '{2}' -OnlyOneParameterCanBeSpecified=Only one of the following parameters can be specified: '{0}', '{1}'. -StartServiceWhatIf=Start Service -ServiceAlreadyStopped=Service '{0}' already stopped, no action required. -ErrorStoppingService=Failure stopping service '{0}'. Message: '{1}' -ErrorRetrievingServiceInformation=Failure retrieving information for service '{0}'. Message: '{1}' -ErrorSettingServiceCredential=Failure setting credentials for service '{0}'. Message: '{1}' -SetCredentialWhatIf=Set Credential -SetStartupTypeWhatIf=Set Start Type -ErrorSettingServiceStartupType=Failure setting start type for service '{0}'. Message: '{1}' -TestUserNameMismatch=User name for service '{0}' is '{1}'. It does not match '{2}. -TestStartupTypeMismatch=Startup type for service '{0}' is '{1}'. It does not match '{2}'. -MethodFailed=The '{0}' method of '{1}' failed with error code: '{2}'. -ErrorChangingProperty=Failed to change '{0}' property. Message: '{1}' -ErrorSetingLogOnAsServiceRightsForUser=Error granting '{0}' the right to log on as a service. Message: '{1}'. -CannotOpenPolicyErrorMessage=Cannot open policy manager -UserNameTooLongErrorMessage=User name is too long -CannotLookupNamesErrorMessage=Failed to lookup user name -CannotOpenAccountErrorMessage=Failed to open policy for user -CannotCreateAccountAccessErrorMessage=Failed to create policy for user -CannotGetAccountAccessErrorMessage=Failed to get user policy rights -CannotSetAccountAccessErrorMessage=Failed to set user policy rights -BinaryPathNotSpecified=Specify the path to the executable when trying to create a new service -ServiceAlreadyExists=The service '{0}' to create already exists -ServiceExistsSamePath=The service '{0}' to create already exists with path '{1}' -ServiceNotExists=The service '{0}' does not exist. Specify the path to the executable to create a new service -ErrorDeletingService=Error in deleting service '{0}' -ServiceDeletedSuccessfully=Service '{0}' Deleted Successfully -TryDeleteAgain=Wait for 2 milliseconds for a service to get deleted -WritePropertiesIgnored=Service '{0}' already exists. Write properties such as Status, DisplayName, Description, Dependencies will be ignored for existing services. -"@ -} - -Import-LocalizedData LocalizedData -filename MSFT_ServiceResource.strings.psd1 -$EscapedLocalizedData = @{} -foreach( $key in $LocalizedData.Keys ) -{ - $EscapedLocalizedData.Add($key, $LocalizedData[$key].Replace('"','""')) -} -$LocalizedData = $EscapedLocalizedData -Import-Module "$PSScriptRoot\..\RunAsHelper.psm1" - -<# -.Synopsis -Gets a service resource -#> -function Get-TargetResource -{ - param - ( - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name - ) - - $svc = GetServiceResource $Name - $svcWmi = GetWMIService $Name - - return @{ - Name=$svc.Name - StartupType=(NormalizeStartupType $svcWmi.StartMode).ToString() - BuiltInAccount=if($svcWmi.StartName -ieq "LocalSystem") {"LocalSystem"} ` - elseif($svcWmi.StartName -ieq "NT Authority\NetworkService") {"NetworkService"} ` - elseif($svcWmi.StartName -ieq "NT Authority\LocalService") {"LocalService"} else {$null} - State=$svc.Status.ToString() - Path=$svcWmi.PathName - DisplayName=$svc.DisplayName - Description=$svcWmi.Description - Dependencies=[string[]](@() + ($svc.ServicesDependedOn | %{$_.Name})) - } -} - - -<# -.Synopsis -Tests a service resource -#> -function Test-TargetResource -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [System.String] - [ValidateSet("Automatic", "Manual", "Disabled")] - $StartupType, - - [System.String] - [ValidateSet("LocalSystem", "LocalService", "NetworkService")] - $BuiltInAccount, - - [System.Management.Automation.PSCredential] - [ValidateNotNull()] - $Credential, - - [System.String] - [ValidateSet("Running", "Stopped")] - $State="Running", - - [System.String] - [ValidateNotNullOrEmpty()] - $DisplayName, - - [System.String] - [ValidateNotNullOrEmpty()] - $Description, - - [System.String] - [ValidateNotNullOrEmpty()] - $Path, - - [System.String[]] - [ValidateNotNullOrEmpty()] - $Dependencies, - - [System.String] - [ValidateSet("Present", "Absent")] - $Ensure="Present" - ) - - ValidateStartupType $Name $StartupType $State - - $serviceExists = ServiceExists -Name $Name -Path $Path -ErrorAction SilentlyContinue - - if($Ensure -eq "Absent") - { - if($serviceExists) - { - return $false - } - return $true - } - - if(!$serviceExists) - { - return $false; - } - - $svc=GetServiceResource $Name - - if($PSBoundParameters.ContainsKey("StartupType") -or $PSBoundParameters.ContainsKey("BuiltInAccount") -or $PSBoundParameters.ContainsKey("Credential")) - { - $svcWmi = GetWMIService $Name - - $getUserNameAndPasswordArgs=@{} - if($PSBoundParameters.ContainsKey("BuiltInAccount")) {$null=$getUserNameAndPasswordArgs.Add("BuiltInAccount",$BuiltInAccount)} - if($PSBoundParameters.ContainsKey("Credential")) {$null=$getUserNameAndPasswordArgs.Add("Credential",$Credential)} - - $userName,$password=GetUserNameAndPassword @getUserNameAndPasswordArgs - if($userName -ne $null -and !(TestUserName $SvcWmi $userName)) - { - write-verbose ($LocalizedData.TestUserNameMismatch -f $svcWmi.Name,$svcWmi.StartName,$userName) - return $false - } - - if($PSBoundParameters.ContainsKey("StartupType") -and !(TestStartupType $SvcWmi $StartupType)) - { - write-verbose ($LocalizedData.TestStartupTypeMismatch -f $svcWmi.Name,$svcWmi.StartMode,$StartupType) - return $false - } - } - - return ($State -eq "Stopped" -and $svc.Status -eq "Stopped") -or ($svc.Status -eq "Running" -and $State -eq "Running") -} - -<# -.Synopsis -Sets properties for a service resource -#> -function Set-TargetResource -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [System.String] - [ValidateSet("Automatic", "Manual", "Disabled")] - $StartupType, - - [System.String] - [ValidateSet("LocalSystem", "LocalService", "NetworkService")] - $BuiltInAccount, - - [System.Management.Automation.PSCredential] - [ValidateNotNull()] - $Credential, - - [System.String] - [ValidateSet("Running", "Stopped")] - $State="Running", - - [System.String] - [ValidateNotNullOrEmpty()] - $DisplayName, - - [System.String] - [ValidateNotNullOrEmpty()] - $Description, - - [System.String] - [ValidateNotNullOrEmpty()] - $Path, - - [System.String[]] - [ValidateNotNullOrEmpty()] - $Dependencies, - - [System.String] - [ValidateSet("Present", "Absent")] - $Ensure="Present" - ) - - ValidateStartupType $Name $StartupType $State - - if($Ensure -eq "Absent") - { - $svc = GetServiceResource $Name - StopService $svc - DeleteService $svc.Name - return - } - - $serviceExists = ServiceExists -Name $Name -ErrorAction SilentlyContinue - - if($PSBoundParameters.ContainsKey("Path") -and $serviceExists) - { - if(CompareServicePath -Path $Path -Name $Name) - { - ThrowInvalidArgumentError "ServiceExistsSamePath" ($LocalizedData.ServiceExistsSamePath -f $Name, $Path) - } - ThrowInvalidArgumentError "ServiceAlreadyExists" ($LocalizedData.ServiceAlreadyExists -f $Name) - } - elseif($PSBoundParameters.ContainsKey("Path") -and !$serviceExists) - { - $argumentsToNewService = @{} - $argumentsToNewService.Add("Name", $Name) - $argumentsToNewService.Add("BinaryPathName", $Path) - if($PSBoundParameters.ContainsKey("Credential")) - { - $argumentsToNewService.Add("Credential", $Credential) - } - if($PSBoundParameters.ContainsKey("StartupType")) - { - $argumentsToNewService.Add("StartupType", $StartupType) - } - if($PSBoundParameters.ContainsKey("DisplayName")) - { - $argumentsToNewService.Add("DisplayName", $DisplayName) - } - if($PSBoundParameters.ContainsKey("Description")) - { - $argumentsToNewService.Add("Description", $Description) - } - if($PSBoundParameters.ContainsKey("Dependencies")) - { - $argumentsToNewService.Add("DependsOn", $Dependencies) - } - try - { - New-Service @argumentsToNewService - $serviceIsNew = $true - } - catch - { - Write-Log ("Error creating service `"$($argumentsToNewService["Name"])`"", $_.Exception.Message) - throw $_ - } - } - elseif(!$PSBoundParameters.ContainsKey("Path") -and !$serviceExists) - { - throw $LocalizedData.ServiceNotExists -f $Name - } - - $svc=GetServiceResource $Name - - if(!$serviceIsNew) - { - Write-Verbose ($LocalizedData.WritePropertiesIgnored -f $Name) - } - - $writeWritePropertiesArguments=@{Name=$svc.name} - if($PSBoundParameters.ContainsKey("StartupType")) {$null=$writeWritePropertiesArguments.Add("StartupType",$StartupType)} - if($PSBoundParameters.ContainsKey("BuiltInAccount")) {$null=$writeWritePropertiesArguments.Add("BuiltInAccount",$BuiltInAccount)} - if($PSBoundParameters.ContainsKey("Credential")) {$null=$writeWritePropertiesArguments.Add("Credential",$Credential)} - - WriteWriteProperties @writeWritePropertiesArguments - - if($State -eq "Stopped") - { - # Ensure service is stopped - StopService $svc - return - } - - # Default state of a newly created service is 'stopped'. If $State=Running, ensure service is started. - if($State -eq "Running") - { - StartService $svc - } -} - -<# -.Synopsis -Validates if a service exist using the Name parameter -#> -function ServiceExists -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [System.String] - $Path - ) - - $service = Get-Service -Name $Name -ErrorAction SilentlyContinue - if($service -ne $null) - { - if($Path -ne $null -and $Path -ne '' -and !(CompareServicePath -Name $Name -Path $Path)){ - return $false - } - return $true - } - return $false -} - -<# -.Synopsis -Compares path to the service path, if the service exists. Returns true when path is same as service path. -#> -function CompareServicePath -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Path, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name - ) - - $servicePath = (Get-CimInstance -Class win32_service | where {$_.Name -eq $Name}).PathName - $result = [string]::Compare($Path, $servicePath, [System.Globalization.CultureInfo]::CurrentUICulture) - - if($result -ne 0) - { - return $false - } - return $true -} - -<# -.Synopsis -Validates a StartupType against the State parameter -#> -function ValidateStartupType -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name, - - [System.String] - $StartupType, - - [System.String] - [ValidateSet("Running", "Stopped")] - $State="Running" - ) - - if($StartupType -eq $null) {return} - - if($State -eq "Stopped") - { - if($StartupType -eq "Automatic") - { - # State = Stopped conflicts with Automatic or Delayed - ThrowInvalidArgumentError "CannotStopServiceSetToStartAutomatically" ($LocalizedData.CannotStopServiceSetToStartAutomatically -f $Name) - } - } - else - { - if($StartupType -eq "Disabled") - { - # State = Running conflicts with Disabled - ThrowInvalidArgumentError "CannotStartAndDisable" ($LocalizedData.CannotStartAndDisable -f $Name) - } - } -} - - -<# -.Synopsis -Writes all write properties if not already correctly set, logging errors and respecting whatif -#> -function WriteWriteProperties -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - $Name, - - [System.String] - [ValidateSet("Automatic", "Manual", "Disabled")] - $StartupType, - - [System.String] - [ValidateSet("LocalSystem", "LocalService", "NetworkService")] - $BuiltInAccount, - - [System.Management.Automation.PSCredential] - [ValidateNotNull()] - $Credential - ) - - if(!$PSBoundParameters.ContainsKey("StartupType") -and !$PSBoundParameters.ContainsKey("BuiltInAccount") -and !$PSBoundParameters.ContainsKey("Credential")) - { - return - } - - $svcWmi = GetWMIService $Name - - $writeCredentialPropertiesArguments=@{"SvcWmi"=$svcWmi} - if($PSBoundParameters.ContainsKey("BuiltInAccount")) {$null=$writeCredentialPropertiesArguments.Add("BuiltInAccount",$BuiltInAccount)} - if($PSBoundParameters.ContainsKey("Credential")) {$null=$writeCredentialPropertiesArguments.Add("Credential",$Credential)} - - WriteCredentialProperties @writeCredentialPropertiesArguments - - $writeStartupArguments=@{"SvcWmi"=$svcWmi} - if($PSBoundParameters.ContainsKey("StartupType")) {$null=$writeStartupArguments.Add("StartupType",$StartupType)} - WriteStartupTypeProperty @writeStartupArguments -} - -<# -.Synopsis -Gets a Win32_Service object corresponding to the name -#> -function GetWMIService -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - $Name - ) - - try - { - return Get-CimInstance -ClassName Win32_Service -Filter "Name='$Name'" - } - catch - { - Write-Verbose ($LocalizedData.ErrorRetrievingServiceInformation -f $Name,$_.Exception.Message) - throw - } -} - -<# -.Synopsis -Writes StartupType if not already correctly set, logging errors and respecting whatif -#> -function WriteStartupTypeProperty -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - $SvcWmi, - - [System.String] - $StartupType - ) - - if($PSBoundParameters.ContainsKey("StartupType") -and !(TestStartupType $SvcWmi $StartupType) -and $PSCmdlet.ShouldProcess($svcWmi.Name,$LocalizedData.SetStartupTypeWhatIf)) - { - $ret = Invoke-CimMethod -InputObject $SvcWmi -MethodName Change -Arguments @{StartMode=$StartupType} - if($ret.ReturnValue -ne 0) - { - $innerMessage = $LocalizedData.MethodFailed -f "Change","Win32_Service",$ret.ReturnValue - $message = $LocalizedData.ErrorChangingProperty -f "StartupType",$innerMessage - ThrowInvalidArgumentError "ChangeStartupTypeFailed" $message - } - } -} - - -<# -.Synopsis -Writes credential properties if not already correctly set, logging errors and respecting whatif -#> -function WriteCredentialProperties -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - - [parameter(Mandatory = $true)] - [ValidateNotNull()] - $SvcWmi, - - - [System.String] - [ValidateSet("LocalSystem", "LocalService", "NetworkService")] - $BuiltInAccount, - - [System.Management.Automation.PSCredential] - $Credential - ) - - if(!$PSBoundParameters.ContainsKey("Credential") -and !$PSBoundParameters.ContainsKey("BuiltInAccount")) - { - return - } - - if($PSBoundParameters.ContainsKey("Credential") -and $PSBoundParameters.ContainsKey("BuiltInAccount")) - { - ThrowInvalidArgumentError "OnlyCredentialOrBuiltInAccount" ($LocalizedData.OnlyOneParameterCanBeSpecified -f "Credential","BuiltInAccount") - } - - $getUserNameAndPasswordArgs=@{} - if($PSBoundParameters.ContainsKey("BuiltInAccount")) {$null=$getUserNameAndPasswordArgs.Add("BuiltInAccount",$BuiltInAccount)} - if($PSBoundParameters.ContainsKey("Credential")) {$null=$getUserNameAndPasswordArgs.Add("Credential",$Credential)} - - $userName,$password=GetUserNameAndPassword @getUserNameAndPasswordArgs - - if($userName -ne $null -and !(TestUserName $SvcWmi $userName) -and $PSCmdlet.ShouldProcess($SvcWmi.Name,$LocalizedData.SetCredentialWhatIf)) - { - if($PSBoundParameters.ContainsKey("Credential")) - { - SetLogOnAsServicePolicy $userName - } - - $ret = Invoke-CimMethod -InputObject $SvcWmi -MethodName Change -Arguments @{StartName=$userName;StartPassword=$password} - if($ret.ReturnValue -ne 0) - { - $innerMessage = $LocalizedData.MethodFailed -f "Change","Win32_Service",$ret.ReturnValue - $message = $LocalizedData.ErrorChangingProperty -f "Credential",$innerMessage - ThrowInvalidArgumentError "ChangeCredentialFailed" $message - } - } -} - -<# -.Synopsis -Returns true if the service's StartName matches $UserName -#> -function TestUserName -{ - param - ( - $SvcWmi, - - [string] - $UserName - ) - - return (NormalizeUserName $SvcWmi.StartName) -ieq $UserName -} - -function TestStartupType -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - $SvcWmi, - - [System.String] - $StartupType - ) - - return (NormalizeStartupType $SvcWmi.StartMode) -ieq $StartupType -} - - -<# -.Synopsis -Retrieves user name and password out of the BuiltInAccount and Credential parameters -#> -function GetUserNameAndPassword -{ - param - ( - [System.String] - [ValidateSet("LocalSystem", "LocalService", "NetworkService")] - $BuiltInAccount, - - [System.Management.Automation.PSCredential] - $Credential - ) - - if($PSBoundParameters.ContainsKey("BuiltInAccount")) - { - return (NormalizeUserName $BuiltInAccount.ToString()),$null - } - - if($PSBoundParameters.ContainsKey("Credential")) - { - return (NormalizeUserName $Credential.UserName),$Credential.GetNetworkCredential().Password - } - - return $null,$null -} - -<# -.Synopsis -Stops a service if it is not already stopped logging the result -#> -function StopService -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - $svc - ) - - if($svc.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Stopped) - { - Write-Log ($LocalizedData.ServiceAlreadyStopped -f $svc.Name) - return - } - - # Exceptions will be thrown, caught and logged by the infrastructure - $err=Stop-Service $svc.Name -force 2>&1 - if($err -eq $null) - { - Write-Log ($LocalizedData.ServiceStopped -f $svc.Name) - } - else - { - Write-Log ($LocalizedData.ErrorStoppingService -f $svc.Name,($err | Out-String)) - throw $err - } -} - -<# -.Synopsis -Starts a service if it is not already started logging the result -#> -function StartService -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - $svc - ) - - if($svc.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) - { - Write-Log ($LocalizedData.ServiceAlreadyStarted -f $svc.Name) - return - } - - if($PSCmdlet.ShouldProcess($svc.Name,$LocalizedData.StartServiceWhatIf)) - { - try - { - $svc.Start() - $twoSeconds = New-Object timespan 20000000 - $svc.WaitForStatus("Running",$twoSeconds) - } - catch - { - $servicePath = (Get-CimInstance -Class win32_service | where {$_.Name -eq $Name}).PathName - $message = $LocalizedData.ErrorStartingService -f $svc.Name,$servicePath,$_.Exception.Message - ThrowInvalidArgumentError "ErrorStartingService" $message - } - - Write-Log ($LocalizedData.ServiceStarted -f $svc.Name) - } - -} - -<# -.Synopsis -Deletes a service -#> -function DeleteService -{ - [CmdletBinding(SupportsShouldProcess = $true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNull()] - $Name - ) - - $err = & "sc.exe" "delete" "$Name" - - for($i = 1; $i -lt 1000; $i++) - { - if(!(ServiceExists -Name $Name)) - { - $serviceDeletedSuccessfully = $true - break - } - - #try again after 2 millisecs if the service is not deleted. - Write-Verbose ($LocalizedData.TryDeleteAgain) - Start-Sleep .002 - } - if(!$serviceDeletedSuccessfully) - { - Write-Log ($LocalizedData.ErrorDeletingService -f $Name) - throw $LocalizedData.ErrorDeletingService -f $Name - } - else - { - Write-Log ($LocalizedData.ServiceDeletedSuccessfully -f $Name) - } -} - -function NormalizeStartupType([string]$StartupType) -{ - if ($StartupType -ieq 'Auto') {return "Automatic"} - return $StartupType -} - -function NormalizeUserName([string]$UserName) -{ - if ($UserName -ieq 'NetworkService') {return "NT Authority\NetworkService"} - if ($UserName -ieq 'LocalService') {return "NT Authority\LocalService"} - if ($UserName -ieq 'LocalSystem') {return ".\LocalSystem"} - if ($UserName.IndexOf("\") -eq -1) { return ".\" + $userName } - return $UserName -} - -<# -.Synopsis -Throws an argument error -#> -function ThrowInvalidArgumentError -{ - [CmdletBinding()] - param - ( - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $errorId, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $errorMessage - ) - - $errorCategory=[System.Management.Automation.ErrorCategory]::InvalidArgument - $exception = New-Object System.ArgumentException $errorMessage; - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null - throw $errorRecord -} - -<# -.Synopsis -Gets a service corresponding to a name, throwing an error if not found -#> -function GetServiceResource -{ - param - ( - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Name - ) - - $svc=Get-Service $name -ErrorAction Ignore - - if($svc -eq $null) - { - ThrowInvalidArgumentError "ServiceNotFound" ($LocalizedData.ServiceNotFound -f $Name) - } - - return $svc -} - -<# -.Synopsis -Grants log on as service right to the given user -#> -function SetLogOnAsServicePolicy([string]$userName) -{ - $logOnAsServiceText=@" - namespace LogOnAsServiceHelper - { - using Microsoft.Win32.SafeHandles; - using System; - using System.Runtime.ConstrainedExecution; - using System.Runtime.InteropServices; - using System.Security; - - public class NativeMethods - { - #region constants - // from ntlsa.h - private const int POLICY_LOOKUP_NAMES = 0x00000800; - private const int POLICY_CREATE_ACCOUNT = 0x00000010; - private const uint ACCOUNT_ADJUST_SYSTEM_ACCESS = 0x00000008; - private const uint ACCOUNT_VIEW = 0x00000001; - private const uint SECURITY_ACCESS_SERVICE_LOGON = 0x00000010; - - // from LsaUtils.h - private const uint STATUS_OBJECT_NAME_NOT_FOUND = 0xC0000034; - - // from lmcons.h - private const int UNLEN = 256; - private const int DNLEN = 15; - - // Extra characteres for "\","@" etc. - private const int EXTRA_LENGTH = 3; - #endregion constants - - #region interop structures - /// - /// Used to open a policy, but not containing anything meaqningful - /// - [StructLayout(LayoutKind.Sequential)] - private struct LSA_OBJECT_ATTRIBUTES - { - public UInt32 Length; - public IntPtr RootDirectory; - public IntPtr ObjectName; - public UInt32 Attributes; - public IntPtr SecurityDescriptor; - public IntPtr SecurityQualityOfService; - - public void Initialize() - { - this.Length = 0; - this.RootDirectory = IntPtr.Zero; - this.ObjectName = IntPtr.Zero; - this.Attributes = 0; - this.SecurityDescriptor = IntPtr.Zero; - this.SecurityQualityOfService = IntPtr.Zero; - } - } - - /// - /// LSA string - /// - [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] - private struct LSA_UNICODE_STRING - { - internal ushort Length; - internal ushort MaximumLength; - [MarshalAs(UnmanagedType.LPWStr)] - internal string Buffer; - - internal void Set(string src) - { - this.Buffer = src; - this.Length = (ushort)(src.Length * sizeof(char)); - this.MaximumLength = (ushort)(this.Length + sizeof(char)); - } - } - - /// - /// Structure used as the last parameter for LSALookupNames - /// - [StructLayout(LayoutKind.Sequential)] - private struct LSA_TRANSLATED_SID2 - { - public uint Use; - public IntPtr SID; - public int DomainIndex; - public uint Flags; - }; - #endregion interop structures - - #region safe handles - /// - /// Handle for LSA objects including Policy and Account - /// - private class LsaSafeHandle : SafeHandleZeroOrMinusOneIsInvalid - { -#if CORECLR - [DllImport("api-ms-win-security-lsapolicy-l1-1-0.dll")] -#else - [DllImport("advapi32.dll")] -#endif - private static extern uint LsaClose(IntPtr ObjectHandle); - - /// - /// Prevents a default instance of the LsaPolicySafeHAndle class from being created. - /// - private LsaSafeHandle(): base(true) - { - } - - /// - /// Calls NativeMethods.CloseHandle(handle) - /// - /// the return of NativeMethods.CloseHandle(handle) -#if !CORECLR - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] -#endif - protected override bool ReleaseHandle() - { - long returnValue = LsaSafeHandle.LsaClose(this.handle); - return returnValue != 0; - - } - } - - /// - /// Handle for IntPtrs returned from Lsa calls that have to be freed with - /// LsaFreeMemory - /// - private class SafeLsaMemoryHandle : SafeHandleZeroOrMinusOneIsInvalid - { -#if CORECLR - [DllImport("api-ms-win-security-lsapolicy-l1-1-0.dll")] -#else - [DllImport("advapi32")] -#endif - internal static extern int LsaFreeMemory(IntPtr Buffer); - - private SafeLsaMemoryHandle() : base(true) { } - - private SafeLsaMemoryHandle(IntPtr handle) - : base(true) - { - SetHandle(handle); - } - - private static SafeLsaMemoryHandle InvalidHandle - { - get { return new SafeLsaMemoryHandle(IntPtr.Zero); } - } - - override protected bool ReleaseHandle() - { - return SafeLsaMemoryHandle.LsaFreeMemory(handle) == 0; - } - - internal IntPtr Memory - { - get - { - return this.handle; - } - } - } - #endregion safe handles - - #region interop function declarations - /// - /// Opens LSA Policy - /// -#if CORECLR - [DllImport("api-ms-win-security-lsapolicy-l1-1-0.dll", SetLastError = true, PreserveSig = true)] -#else - [DllImport("advapi32.dll", SetLastError = true, PreserveSig = true)] -#endif - private static extern uint LsaOpenPolicy( - IntPtr SystemName, - ref LSA_OBJECT_ATTRIBUTES ObjectAttributes, - uint DesiredAccess, - out LsaSafeHandle PolicyHandle - ); - - /// - /// Convert the name into a SID which is used in remaining calls - /// -#if CORECLR - [DllImport("api-ms-win-security-lsapolicy-l1-1-0.dll", CharSet = CharSet.Unicode, SetLastError = true)] -#else - [DllImport("advapi32", CharSet = CharSet.Unicode, SetLastError = true), SuppressUnmanagedCodeSecurityAttribute] -#endif - private static extern uint LsaLookupNames2( - LsaSafeHandle PolicyHandle, - uint Flags, - uint Count, - LSA_UNICODE_STRING[] Names, - out SafeLsaMemoryHandle ReferencedDomains, - out SafeLsaMemoryHandle Sids - ); - - /// - /// Opens the LSA account corresponding to the user's SID - /// -#if CORECLR - [DllImport("advapi32legacy.dll", SetLastError = true, PreserveSig = true)] -#else - [DllImport("advapi32.dll", SetLastError = true, PreserveSig = true)] -#endif - private static extern uint LsaOpenAccount( - LsaSafeHandle PolicyHandle, - IntPtr Sid, - uint Access, - out LsaSafeHandle AccountHandle); - - /// - /// Creates an LSA account corresponding to the user's SID - /// -#if CORECLR - [DllImport("advapi32legacy.dll", SetLastError = true, PreserveSig = true)] -#else - [DllImport("advapi32.dll", SetLastError = true, PreserveSig = true)] -#endif - private static extern uint LsaCreateAccount( - LsaSafeHandle PolicyHandle, - IntPtr Sid, - uint Access, - out LsaSafeHandle AccountHandle); - - /// - /// Gets the LSA Account access - /// -#if CORECLR - [DllImport("advapi32legacy.dll", SetLastError = true, PreserveSig = true)] -#else - [DllImport("advapi32.dll", SetLastError = true, PreserveSig = true)] -#endif - private static extern uint LsaGetSystemAccessAccount( - LsaSafeHandle AccountHandle, - out uint SystemAccess); - - /// - /// Sets the LSA Account access - /// -#if CORECLR - [DllImport("advapi32legacy.dll", SetLastError = true, PreserveSig = true)] -#else - [DllImport("advapi32.dll", SetLastError = true, PreserveSig = true)] -#endif - private static extern uint LsaSetSystemAccessAccount( - LsaSafeHandle AccountHandle, - uint SystemAccess); - #endregion interop function declarations - - /// - /// Sets the Log On As A Service Policy for , if not already set. - /// - /// the user name we want to allow logging on as a service - /// If the is null or empty. - /// In the following cases: - /// Failure opening the LSA Policy. - /// The is too large. - /// Failure looking up the user name. - /// Failure opening LSA account (other than account not found). - /// Failure creating LSA account. - /// Failure getting LSA account policy access. - /// Failure setting LSA account policy access. - /// - public static void SetLogOnAsServicePolicy(string userName) - { - if (String.IsNullOrEmpty(userName)) - { - throw new ArgumentNullException("userName"); - } - - LSA_OBJECT_ATTRIBUTES objectAttributes = new LSA_OBJECT_ATTRIBUTES(); - objectAttributes.Initialize(); - - // All handles are delcared in advance so they can be closed on finally - LsaSafeHandle policyHandle = null; - SafeLsaMemoryHandle referencedDomains = null; - SafeLsaMemoryHandle sids = null; - LsaSafeHandle accountHandle = null; - - try - { - uint status = LsaOpenPolicy( - IntPtr.Zero, - ref objectAttributes, - POLICY_LOOKUP_NAMES | POLICY_CREATE_ACCOUNT, - out policyHandle); - - if (status != 0) - { - throw new InvalidOperationException(@"CannotOpenPolicyErrorMessage"); - } - - // Unicode strings have a maximum length of 32KB. We don't want to create - // LSA strings with more than that. User lengths are much smaller so this check - // ensures userName's length is useful - if (userName.Length > UNLEN + DNLEN + EXTRA_LENGTH) - { - throw new InvalidOperationException(@"UserNameTooLongErrorMessage"); - } - - LSA_UNICODE_STRING lsaUserName = new LSA_UNICODE_STRING(); - lsaUserName.Set(userName); - - LSA_UNICODE_STRING[] names = new LSA_UNICODE_STRING[1]; - names[0].Set(userName); - - status = LsaLookupNames2( - policyHandle, - 0, - 1, - new LSA_UNICODE_STRING[] { lsaUserName }, - out referencedDomains, - out sids); - - if (status != 0) - { - throw new InvalidOperationException(@"CannotLookupNamesErrorMessage"); - } - - LSA_TRANSLATED_SID2 sid = (LSA_TRANSLATED_SID2)Marshal.PtrToStructure(sids.Memory, typeof(LSA_TRANSLATED_SID2)); - - - status = LsaOpenAccount(policyHandle, - sid.SID, - ACCOUNT_VIEW | ACCOUNT_ADJUST_SYSTEM_ACCESS, - out accountHandle); - - uint currentAccess = 0; - - if (status == 0) - { - status = LsaGetSystemAccessAccount(accountHandle, out currentAccess); - - if (status != 0) - { - throw new InvalidOperationException(@"CannotGetAccountAccessErrorMessage"); - } - - } - else if (status == STATUS_OBJECT_NAME_NOT_FOUND) - { - status = LsaCreateAccount( - policyHandle, - sid.SID, - ACCOUNT_ADJUST_SYSTEM_ACCESS, - out accountHandle); - - if (status != 0) - { - throw new InvalidOperationException(@"CannotCreateAccountAccessErrorMessage"); - } - } - else - { - throw new InvalidOperationException(@"CannotOpenAccountErrorMessage"); - } - - if ((currentAccess & SECURITY_ACCESS_SERVICE_LOGON) == 0) - { - status = LsaSetSystemAccessAccount( - accountHandle, - currentAccess | SECURITY_ACCESS_SERVICE_LOGON); - if (status != 0) - { - throw new InvalidOperationException(@"CannotSetAccountAccessErrorMessage"); - } - } - } - finally - { - if (policyHandle != null) { policyHandle.Close(); } - if (referencedDomains != null) { referencedDomains.Close(); } - if (sids != null) { sids.Close(); } - if (accountHandle != null) { accountHandle.Close(); } - } - } - } - } -"@ - - try - { - $existingType=[LogOnAsServiceHelper.NativeMethods] - } - catch - { - $logOnAsServiceText=$logOnAsServiceText.Replace("CannotOpenPolicyErrorMessage",$LocalizedData.CannotOpenPolicyErrorMessage) - $logOnAsServiceText=$logOnAsServiceText.Replace("UserNameTooLongErrorMessage",$LocalizedData.UserNameTooLongErrorMessage) - $logOnAsServiceText=$logOnAsServiceText.Replace("CannotLookupNamesErrorMessage",$LocalizedData.CannotLookupNamesErrorMessage) - $logOnAsServiceText=$logOnAsServiceText.Replace("CannotOpenAccountErrorMessage",$LocalizedData.CannotOpenAccountErrorMessage) - $logOnAsServiceText=$logOnAsServiceText.Replace("CannotCreateAccountAccessErrorMessage",$LocalizedData.CannotCreateAccountAccessErrorMessage) - $logOnAsServiceText=$logOnAsServiceText.Replace("CannotGetAccountAccessErrorMessage",$LocalizedData.CannotGetAccountAccessErrorMessage) - $logOnAsServiceText=$logOnAsServiceText.Replace("CannotSetAccountAccessErrorMessage",$LocalizedData.CannotSetAccountAccessErrorMessage) - - if(IsNanoServer) - { - $logOnAsServiceText = "#define CORECLR`n" + $logOnAsServiceText - } - $null = Add-Type $logOnAsServiceText -PassThru -Debug:$false - } - - if($userName.StartsWith(".\")) - { - $userName = $userName.Substring(2) - } - - try - { - [LogOnAsServiceHelper.NativeMethods]::SetLogOnAsServicePolicy($userName) - } - catch - { - $message = $LocalizedData.ErrorSetingLogOnAsServiceRightsForUser -f $userName,$_.Exception.Message - ThrowInvalidArgumentError "ErrorSetingLogOnAsServiceRightsForUser" $message - } -} - -function Write-Log -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Message - ) - - if ($PSCmdlet.ShouldProcess($Message, $null, $null)) - { - Write-Verbose $Message - } -} - -Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/MSFT_ServiceResource.schema.mof b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/MSFT_ServiceResource.schema.mof deleted file mode 100644 index 5e9fe81..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/MSFT_ServiceResource.schema.mof and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/ko-KR/MSFT_ServiceResource.schema.mfl b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/ko-KR/MSFT_ServiceResource.schema.mfl deleted file mode 100644 index 31e4524..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/ko-KR/MSFT_ServiceResource.schema.mfl and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/ko-KR/MSFT_ServiceResource.strings.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/ko-KR/MSFT_ServiceResource.strings.psd1 deleted file mode 100644 index 2247316..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/ko-KR/MSFT_ServiceResource.strings.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/MSFT_UserResource.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/MSFT_UserResource.psm1 deleted file mode 100644 index f50a7df..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/MSFT_UserResource.psm1 +++ /dev/null @@ -1,1136 +0,0 @@ -# A global variable that contains localized messages. -data LocalizedData -{ -# culture="en-US" -ConvertFrom-StringData @' -UserWithName=User: {0} -RemoveOperation=Remove -AddOperation=Add -SetOperation=Set -ConfigurationStarted=Configuration of user {0} started. -ConfigurationCompleted=Configuration of user {0} completed successfully. -UserCreated=User {0} created successfully. -UserUpdated=User {0} properties updated successfully. -UserRemoved=User {0} removed successfully. -NoConfigurationRequired=User {0} exists on this node with the desired properties. No action required. -NoConfigurationRequiredUserDoesNotExist=User {0} does not exist on this node. No action required. -InvalidUserName=The name {0} cannot be used. Names may not consist entirely of periods and/or spaces, or contain these characters: {1} -UserExists=A user with the name {0} exists. -UserDoesNotExist=A user with the name {0} does not exist. -PropertyMismatch=The value of the {0} property is expected to be {1} but it is {2}. -PasswordPropertyMismatch=The value of the {0} property does not match. -AllUserPropertisMatch=All {0} {1} properties match. -ConnectionError = There could be a possible connection error while trying to use the System.DirectoryServices API's. -MultipleMatches = There could be a possible multiple matches exception while trying to use the System.DirectoryServices API's. -'@ -} - -Import-LocalizedData LocalizedData -FileName MSFT_UserResource.strings.psd1 - -Import-Module "$PSScriptRoot\..\DSCResourceHelper.psm1" - -if (-not (IsNanoServer)) -{ - Add-Type -AssemblyName 'System.DirectoryServices.AccountManagement' -} - -<# -.Synopsys -The Get-TargetResource cmdlet. -#> -function Get-TargetResource -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName - ) - - if (IsNanoServer) - { - Get-TargetResourceOnNanoServer @PSBoundParameters - } - else - { - Get-TargetResourceOnFullSKU @PSBoundParameters - } -} - -<# -.Synopsys -The Set-TargetResource cmdlet. -#> -function Set-TargetResource -{ - [CmdletBInding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName, - - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", - - [System.String] - $FullName, - - [System.String] - $Description, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - $Password, - - [System.Boolean] - $Disabled, - - [System.Boolean] - $PasswordNeverExpires, - - [System.Boolean] - $PasswordChangeRequired, - - [System.Boolean] - $PasswordChangeNotAllowed - ) - - if (IsNanoServer) - { - Set-TargetResourceOnNanoServer @PSBoundParameters - } - else - { - Set-TargetResourceOnFullSKU @PSBoundParameters - } -} - -<# -.Synopsys -The Test-TargetResource cmdlet is used to validate if the resource is in a state as expected in the instance document. -#> -function Test-TargetResource -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName, - - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", - - [System.String] - $FullName, - - [System.String] - $Description, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - $Password, - - [System.Boolean] - $Disabled, - - [System.Boolean] - $PasswordNeverExpires, - - [System.Boolean] - $PasswordChangeRequired, - - [System.Boolean] - $PasswordChangeNotAllowed - ) - - if (IsNanoServer) - { - Test-TargetResourceOnNanoServer @PSBoundParameters - } - else - { - Test-TargetResourceOnFullSKU @PSBoundParameters - } -} - - -<# -.Synopsys -The Get-TargetResource cmdlet. -#> -function Get-TargetResourceOnFullSKU -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName - ) - - Set-StrictMode -Version Latest - - ValidateUserName -UserName $UserName - - # Try to find a user by a name. - $principalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext -ArgumentList ([System.DirectoryServices.AccountManagement.ContextType]::Machine) - - try - { - $user = [System.DirectoryServices.AccountManagement.UserPrincipal]::FindByIdentity($principalContext, $UserName); - if($user -ne $null) - { - # The user is found. Return all user properties and Ensure="Present". - $returnValue = @{ - UserName = $user.Name; - Ensure = "Present"; - FullName = $user.DisplayName; - Description = $user.Description; - Disabled = -not $user.Enabled; - PasswordNeverExpires = $user.PasswordNeverExpires; - PasswordChangeRequired = $null; - PasswordChangeNotAllowed = $user.UserCannotChangePassword; - } - - return $returnValue; - } - - # The user is not found. Return Ensure=Absent. - return @{ - UserName = $UserName; - Ensure = "Absent"; - } - } - catch - { - ThrowExceptionDueToDirectoryServicesError -ErrorId "MultipleMatches" -ErrorMessage ($LocalizedData.MultipleMatches + $_) - } - finally - { - if($user -ne $null) - { - $user.Dispose(); - } - - $principalContext.Dispose(); - } -} - -<# -.Synopsys -The Set-TargetResource cmdlet. -#> -function Set-TargetResourceOnFullSKU -{ - [CmdletBInding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName, - - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", - - [System.String] - $FullName, - - [System.String] - $Description, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - $Password, - - [System.Boolean] - $Disabled, - - [System.Boolean] - $PasswordNeverExpires, - - [System.Boolean] - $PasswordChangeRequired, - - [System.Boolean] - $PasswordChangeNotAllowed - ) - - Set-StrictMode -Version Latest - - Write-Verbose -Message ($LocalizedData.ConfigurationStarted -f $UserName) - - ValidateUserName -UserName $UserName - - - # Try to find a user by a name. - $principalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext -ArgumentList ([System.DirectoryServices.AccountManagement.ContextType]::Machine) - - try - { - $user = [System.DirectoryServices.AccountManagement.UserPrincipal]::FindByIdentity($principalContext, $UserName); - if($Ensure -eq "Present") - { - # Ensure is set to "Present". - - $whatIfShouldProcess = $true; - $userExists = $false; - $saveChanges = $false; - - if($user -eq $null) - { - # A user does not exist. Check WhatIf for adding a user. - $whatIfShouldProcess = $pscmdlet.ShouldProcess($LocalizedData.UserWithName -f $UserName, $LocalizedData.AddOperation); - } - else - { - # A user exists. - $userExists = $true; - - # Check WhatIf for setting a user. - $whatIfShouldProcess = $pscmdlet.ShouldProcess($LocalizedData.UserWithName -f $UserName, $LocalizedData.SetOperation); - } - - if($whatIfShouldProcess) - { - if(-not $userExists) - { - # The user with the provided name does not exist. Add a new user. - $user = New-Object System.DirectoryServices.AccountManagement.UserPrincipal -ArgumentList $principalContext - $user.Name = $UserName; - $saveChanges = $true; - } - - # Set user properties. - if($PSBoundParameters.ContainsKey('FullName') -and (-not $userExists -or $FullName -ne $user.DisplayName)) - { - $user.DisplayName = $FullName; - $saveChanges = $true; - } - else - { - if(-not $userExists) - { - # For a newly created user, set the DisplayName property to an empty string. By default DisplayName is set to user's name. - $user.DisplayName = [String]::Empty; - } - } - - if($PSBoundParameters.ContainsKey('Description') -and (-not $userExists -or $Description -ne $user.Description)) - { - $user.Description = $Description; - $saveChanges = $true; - } - - # Password. Set the password regardless of the state of the user. - if($PSBoundParameters.ContainsKey('Password')) - { - $user.SetPassword($Password.GetNetworkCredential().Password); - $saveChanges = $true; - } - - if($PSBoundParameters.ContainsKey('Disabled') -and (-not $userExists -or $Disabled -eq $user.Enabled)) - { - $user.Enabled = -not $Disabled; - $saveChanges = $true; - } - - if($PSBoundParameters.ContainsKey('PasswordNeverExpires') -and (-not $userExists -or $PasswordNeverExpires -ne $user.PasswordNeverExpires)) - { - $user.PasswordNeverExpires = $PasswordNeverExpires; - $saveChanges = $true; - } - - if($PSBoundParameters.ContainsKey('PasswordChangeRequired')) - { - if($PasswordChangeRequired) - { - # Expire the password. This will force the user to change the password at the next logon. - $user.ExpirePasswordNow(); - $saveChanges = $true; - } - } - - if($PSBoundParameters.ContainsKey('PasswordChangeNotAllowed') -and (-not $userExists -or $PasswordChangeNotAllowed -ne $user.UserCannotChangePassword)) - { - $user.UserCannotChangePassword = $PasswordChangeNotAllowed; - $saveChanges = $true; - - } - - if($saveChanges) - { - $user.Save(); - - # Send an operation success verbose message. - if($userExists) - { - Write-Verbose -Message ($LocalizedData.UserUpdated -f $UserName) - } - else - { - Write-Verbose -Message ($LocalizedData.UserCreated -f $UserName) - } - } - else - { - Write-Verbose -Message ($LocalizedData.NoConfigurationRequired -f $UserName) - } - } - } - else - { - # Ensure is set to "Absent". - if($user -ne $null) - { - # The user exists. - if($pscmdlet.ShouldProcess($LocalizedData.UserWithName -f $UserName, $LocalizedData.RemoveOperation)) - { - # Remove the user by the provided name. - $user.Delete(); - } - - Write-Verbose -Message ($LocalizedData.UserRemoved -f $UserName) - } - else - { - Write-Verbose -Message ($LocalizedData.NoConfigurationRequiredUserDoesNotExist -f $UserName) - } - } - } - catch - { - ThrowExceptionDueToDirectoryServicesError -ErrorId "MultipleMatches" -ErrorMessage ($LocalizedData.MultipleMatches + $_) - } - finally - { - if($user -ne $null) - { - $user.Dispose(); - } - - $principalContext.Dispose(); - } - - Write-Verbose -Message ($LocalizedData.ConfigurationCompleted -f $UserName) -} - -<# -.Synopsys -The Test-TargetResource cmdlet is used to validate if the resource is in a state as expected in the instance document. -#> -function Test-TargetResourceOnFullSKU -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName, - - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", - - [System.String] - $FullName, - - [System.String] - $Description, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - $Password, - - [System.Boolean] - $Disabled, - - [System.Boolean] - $PasswordNeverExpires, - - [System.Boolean] - $PasswordChangeRequired, - - [System.Boolean] - $PasswordChangeNotAllowed - ) - - Set-StrictMode -Version Latest - - ValidateUserName -UserName $UserName - - # Try to find a user by a name. - $principalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext -ArgumentList ([System.DirectoryServices.AccountManagement.ContextType]::Machine) - - try - { - $user = [System.DirectoryServices.AccountManagement.UserPrincipal]::FindByIdentity($principalContext, $UserName); - if($user -eq $null) - { - # A user with the provided name does not exist. - Write-Log -Message ($LocalizedData.UserDoesNotExist -f $UserName) - - if($Ensure -eq "Absent") - { - return $true; - } - else - { - return $false; - } - } - - # A user with the provided name exists. - Write-Log -Message ($LocalizedData.UserExists -f $UserName) - - # Validate separate properties. - if($Ensure -eq "Absent") - { - Write-Log -Message ($LocalizedData.PropertyMismatch -f "Ensure", "Absent", "Present") - return $false; # The Ensure property does not match. Return $false; - } - - if($PSBoundParameters.ContainsKey('FullName') -and $FullName -ne $user.DisplayName) - { - Write-Log -Message ($LocalizedData.PropertyMismatch -f "FullName", $FullName, $user.DisplayName) - return $false; # The FullName property does not match. Return $false; - } - - if($PSBoundParameters.ContainsKey('Description') -and $Description -ne $user.Description) - { - Write-Log -Message ($LocalizedData.PropertyMismatch -f "Description", $Description, $user.Description) - return $false; # The Description property does not match. Return $false; - } - - # Password - if($PSBoundParameters.ContainsKey('Password')) - { - if(-not $principalContext.ValidateCredentials($UserName, $Password.GetNetworkCredential().Password)) - { - Write-Log -Message ($LocalizedData.PasswordPropertyMismatch -f "Password") - return $false; # The Password property does not match. Return $false; - } - } - - if($PSBoundParameters.ContainsKey('Disabled') -and $Disabled -eq $user.Enabled) - { - Write-Log -Message ($LocalizedData.PropertyMismatch -f "Disabled", $Disabled, $user.Enabled) - return $false; # The Disabled property does not match. Return $false; - } - - if($PSBoundParameters.ContainsKey('PasswordNeverExpires') -and $PasswordNeverExpires -ne $user.PasswordNeverExpires) - { - Write-Log -Message ($LocalizedData.PropertyMismatch -f "PasswordNeverExpires", $PasswordNeverExpires, $user.PasswordNeverExpires) - return $false; # The PasswordNeverExpires property does not match. Return $false; - } - - if($PSBoundParameters.ContainsKey('PasswordChangeNotAllowed') -and $PasswordChangeNotAllowed -ne $user.UserCannotChangePassword) - { - Write-Log -Message ($LocalizedData.PropertyMismatch -f "PasswordChangeNotAllowed", $PasswordChangeNotAllowed, $user.UserCannotChangePassword) - return $false; # The PasswordChangeNotAllowed property does not match. Return $false; - } - } - catch - { - ThrowExceptionDueToDirectoryServicesError -ErrorId "ConnectionError" -ErrorMessage ($LocalizedData.ConnectionError + $_) - } - - finally - { - if($user -ne $null) - { - $user.Dispose(); - } - - $principalContext.Dispose(); - - } - - # All properties match. Return $true. - Write-Log -Message ($LocalizedData.AllUserPropertisMatch -f "User", $UserName) - return $true; -} - - -<# -.Synopsys -The Get-TargetResource cmdlet. -#> -function Get-TargetResourceOnNanoServer -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName - ) - - Set-StrictMode -Version Latest - - ValidateUserName -UserName $UserName - - # Try to find a user by a name. - try - { - [Microsoft.PowerShell.Commands.LocalUser] $user = Get-LocalUser -Name $UserName -ErrorAction Stop - } - catch [System.Exception] - { - if ($_.CategoryInfo.ToString().Contains('UserNotFoundException')) - { - # The user is not found. Return Ensure=Absent. - return @{ - UserName = $UserName; - Ensure = "Absent"; - } - } - Throw-TerminatingError -ErrorRecord $_ - } - - # The user is found. Return all user properties and Ensure="Present". - $returnValue = @{ - UserName = $user.Name; - Ensure = "Present"; - FullName = $user.FullName; - Description = $user.Description; - Disabled = -not $user.Enabled; - PasswordChangeRequired = $null; - PasswordChangeNotAllowed = -not $user.UserMayChangePassword; - } - - if ($user.PasswordExpires) - { - $returnValue.Add('PasswordNeverExpires', $false) - } - else - { - $returnValue.Add('PasswordNeverExpires', $true) - } - - return $returnValue; -} - -<# -.Synopsys -The Set-TargetResource cmdlet. -#> -function Set-TargetResourceOnNanoServer -{ - [CmdletBInding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName, - - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", - - [System.String] - $FullName, - - [System.String] - $Description, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - $Password, - - [System.Boolean] - $Disabled, - - [System.Boolean] - $PasswordNeverExpires, - - [System.Boolean] - $PasswordChangeRequired, - - [System.Boolean] - $PasswordChangeNotAllowed - ) - - Set-StrictMode -Version Latest - - Write-Verbose -Message ($LocalizedData.ConfigurationStarted -f $UserName) - - ValidateUserName -UserName $UserName - - ## Try to find a user by a name. - [bool] $userExists = $false - try - { - [Microsoft.PowerShell.Commands.LocalUser] $user = Get-LocalUser -Name $UserName -ErrorAction Stop - $userExists = $true; - } - catch [System.Exception] - { - if ($_.CategoryInfo.ToString().Contains('UserNotFoundException')) - { - # The user is not found. - Write-Log -Message ($LocalizedData.UserDoesNotExist -f $UserName) - } - else - { - Throw-TerminatingError -ErrorRecord $_ - } - } - - if($Ensure -eq "Present") - { - # Ensure is set to "Present". - - if(-not $userExists) - { - # The user with the provided name does not exist. Add a new user. - New-LocalUser -Name $UserName -NoPassword - Write-Verbose -Message ($LocalizedData.UserCreated -f $UserName) - } - - # Set user properties. - if($PSBoundParameters.ContainsKey('FullName')) - { - if (-not $userExists -or $FullName -ne $user.FullName) - { - if ($FullName -eq $null) - { - Set-LocalUser -Name $UserName -FullName ([String]::Empty) - } - else - { - Set-LocalUser -Name $UserName -FullName $FullName - } - } - } - else - { - if (-not $userExists) - { - # For a newly created user, set the DisplayName property to an empty string. By default DisplayName is set to user's name. - Set-LocalUser -Name $UserName -FullName ([String]::Empty) - } - } - - if($PSBoundParameters.ContainsKey('Description') -and (-not $userExists -or $Description -ne $user.Description)) - { - if ($Description -eq $null) - { - Set-LocalUser -Name $UserName -Description ([String]::Empty) - } - else - { - Set-LocalUser -Name $UserName -Description $Description - } - } - - # Password. Set the password regardless of the state of the user. - if($PSBoundParameters.ContainsKey('Password')) - { - Set-LocalUser -Name $UserName -Password $Password.Password - } - - if($PSBoundParameters.ContainsKey('Disabled') -and (-not $userExists -or $Disabled -eq $user.Enabled)) - { - if ($Disabled) - { - Disable-LocalUser -Name $UserName - } - else - { - Enable-LocalUser -Name $UserName - } - } - - $existingUserPasswordNeverExpires = (($userExists) -and ($user.PasswordExpires -eq $null)) - if($PSBoundParameters.ContainsKey('PasswordNeverExpires') -and (-not $userExists -or ($PasswordNeverExpires -ne $existingUserPasswordNeverExpires))) - { - Set-LocalUser -Name $UserName -PasswordNeverExpires:$passwordNeverExpires - } - - # NOTE: The parameter name and the property name have opposite meaning. - [bool] $expected = -not $PasswordChangeNotAllowed - [bool] $actual = $expected - if($userExists) { - $actual = $user.UserMayChangePassword - } - if($PSBoundParameters.ContainsKey('PasswordChangeNotAllowed') -and (-not $userExists -or $expected -ne $actual)) - { - Set-LocalUser -Name $UserName -UserMayChangePassword $expected - } - } - else - { - # Ensure is set to "Absent". - if($userExists) - { - # The user exists. - Remove-LocalUser -Name $UserName - - Write-Verbose -Message ($LocalizedData.UserRemoved -f $UserName) - } - else - { - Write-Verbose -Message ($LocalizedData.NoConfigurationRequiredUserDoesNotExist -f $UserName) - } - } - - - Write-Verbose -Message ($LocalizedData.ConfigurationCompleted -f $UserName) -} - -<# -.Synopsys -The Test-TargetResource cmdlet is used to validate if the resource is in a state as expected in the instance document. -#> -function Test-TargetResourceOnNanoServer -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName, - - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", - - [System.String] - $FullName, - - [System.String] - $Description, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - $Password, - - [System.Boolean] - $Disabled, - - [System.Boolean] - $PasswordNeverExpires, - - [System.Boolean] - $PasswordChangeRequired, - - [System.Boolean] - $PasswordChangeNotAllowed - ) - - Set-StrictMode -Version Latest - - ValidateUserName -UserName $UserName - - # Try to find a user by a name. - try - { - [Microsoft.PowerShell.Commands.LocalUser] $user = Get-LocalUser -Name $UserName -ErrorAction Stop - } - catch [System.Exception] - { - if ($_.CategoryInfo.ToString().Contains('UserNotFoundException')) - { - # The user is not found. Return Ensure=Absent. - if($Ensure -eq "Absent") - { - return $true - } - else - { - return $false - } - } - Throw-TerminatingError -ErrorRecord $_ - } - - # A user with the provided name exists. - Write-Log -Message ($LocalizedData.UserExists -f $UserName) - - # Validate separate properties. - if($Ensure -eq "Absent") - { - Write-Log -Message ($LocalizedData.PropertyMismatch -f "Ensure", "Absent", "Present") - return $false; # The Ensure property does not match. Return $false; - } - - if($PSBoundParameters.ContainsKey('FullName') -and $FullName -ne $user.FullName) - { - Write-Log -Message ($LocalizedData.PropertyMismatch -f "FullName", $FullName, $user.FullName) - return $false; # The FullName property does not match. Return $false; - } - - if($PSBoundParameters.ContainsKey('Description') -and $Description -ne $user.Description) - { - Write-Log -Message ($LocalizedData.PropertyMismatch -f "Description", $Description, $user.Description) - return $false; # The Description property does not match. Return $false; - } - - if($PSBoundParameters.ContainsKey('Password')) - { - if(-not (ValidateCredentialsOnNanoServer -UserName $UserName -Password $Password.Password)) - { - Write-Log -Message ($LocalizedData.PasswordPropertyMismatch -f "Password") - return $false; # The Password property does not match. Return $false; - } - } - - if($PSBoundParameters.ContainsKey('Disabled') -and $Disabled -eq $user.Enabled) - { - Write-Log -Message ($LocalizedData.PropertyMismatch -f "Disabled", $Disabled, $user.Enabled) - return $false; # The Disabled property does not match. Return $false; - } - - $existingUserPasswordNeverExpires = ($user.PasswordExpires -eq $null) - if($PSBoundParameters.ContainsKey('PasswordNeverExpires') -and $PasswordNeverExpires -ne $existingUserPasswordNeverExpires) - { - Write-Log -Message ($LocalizedData.PropertyMismatch -f "PasswordNeverExpires", $PasswordNeverExpires, $existingUserPasswordNeverExpires) - return $false; # The PasswordNeverExpires property does not match. Return $false; - } - - if($PSBoundParameters.ContainsKey('PasswordChangeNotAllowed') -and $PasswordChangeNotAllowed -ne (-not $user.UserMayChangePassword)) - { - Write-Log -Message ($LocalizedData.PropertyMismatch -f "PasswordChangeNotAllowed", $PasswordChangeNotAllowed, (-not $user.UserMayChangePassword)) - return $false; # The PasswordChangeNotAllowed property does not match. Return $false; - } - - # All properties match. Return $true. - Write-Log -Message ($LocalizedData.AllUserPropertisMatch -f "User", $UserName) - return $true; -} - -<# -.Synopsis -Validates the User name for invalid charecters. -#> -function ValidateUserName -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName - ) - - # Check if the name consists of only periods and/or white spaces. - $wrongName = $true; - for($i = 0; $i -lt $UserName.Length; $i++) - { - if(-not [Char]::IsWhiteSpace($UserName, $i) -and $UserName[$i] -ne '.') - { - $wrongName = $false; - break; - } - } - - $invalidChars = @('\','/','"','[',']',':','|','<','>','+','=',';',',','?','*','@') - - if($wrongName) - { - ThrowInvalidArgumentError -ErrorId "UserNameHasOnlyWhiteSpacesAndDots" -ErrorMessage ($LocalizedData.InvalidUserName -f $UserName, [string]::Join(" ", $invalidChars)) - } - - if($UserName.IndexOfAny($invalidChars) -ne -1) - { - ThrowInvalidArgumentError -ErrorId "UserNameHasInvalidCharachter" -ErrorMessage ($LocalizedData.InvalidUserName -f $UserName, [string]::Join(" ", $invalidChars)) - } -} - -<# -.Synopsis -Throws an argument error. -#> -function ThrowInvalidArgumentError -{ - [CmdletBinding()] - param - ( - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ErrorId, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ErrorMessage - ) - - $errorCategory=[System.Management.Automation.ErrorCategory]::InvalidArgument - $exception = New-Object System.ArgumentException $ErrorMessage; - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $ErrorId, $errorCategory, $null - throw $errorRecord -} - -function ThrowExceptionDueToDirectoryServicesError -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ErrorId, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ErrorMessage - ) - - $errorCategory = [System.Management.Automation.ErrorCategory]::ConnectionError - $exception = New-Object System.ArgumentException $ErrorMessage - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $ErrorId, $errorCategory, $null - throw $errorRecord -} - -Function Throw-TerminatingError -{ - param( - [string] $Message, - [System.Management.Automation.ErrorRecord] $ErrorRecord - ) - - - if ($ErrorRecord -ne $null) - { - $exception = new-object "System.InvalidOperationException" $Message,$ErrorRecord.Exception - } - else - { - $exception = new-object "System.InvalidOperationException" $Message - } - $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception,"MachineStateIncorrect","InvalidOperation",$null - throw $errorRecord -} - -<# -.Synopsis -Writes either to Verbose or ShouldProcess channel. -#> -function Write-Log -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $Message - ) - - if ($PSCmdlet.ShouldProcess($Message, $null, $null)) - { - Write-Verbose $Message - } -} - -<# -.Synopsis -Validates the local user's credentials on the local machine. -#> -Function ValidateCredentialsOnNanoServer -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $UserName, - - [ValidateNotNullOrEmpty()] - [securestring] - $Password - ) - - $source = @' - [Flags] - private enum LogonType - { - Logon32LogonInteractive = 2, - Logon32LogonNetwork, - Logon32LogonBatch, - Logon32LogonService, - Logon32LogonUnlock, - Logon32LogonNetworkCleartext, - Logon32LogonNewCredentials - } - - [Flags] - private enum LogonProvider - { - Logon32ProviderDefault = 0, - Logon32ProviderWinnt35, - Logon32ProviderWinnt40, - Logon32ProviderWinnt50 - } - - [DllImport("api-ms-win-security-logon-l1-1-1.dll", CharSet = CharSet.Unicode, SetLastError = true)] - private static extern Boolean LogonUser( - String lpszUserName, - String lpszDomain, - IntPtr lpszPassword, - LogonType dwLogonType, - LogonProvider dwLogonProvider, - out IntPtr phToken - ); - - - [DllImport("api-ms-win-core-handle-l1-1-0.dll", - EntryPoint = "CloseHandle", SetLastError = true, - CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)] - internal static extern bool CloseHandle(IntPtr handle); - - public static bool ValidateCredentials(string username, SecureString password) - { - IntPtr tokenHandle = IntPtr.Zero; - IntPtr unmanagedPassword = IntPtr.Zero; - - unmanagedPassword = SecureStringMarshal.SecureStringToCoTaskMemUnicode(password); - - try - { - return LogonUser( - username, - null, - unmanagedPassword, - LogonType.Logon32LogonInteractive, - LogonProvider.Logon32ProviderDefault, - out tokenHandle); - } - catch - { - return false; - } - finally - { - if (tokenHandle != IntPtr.Zero) - { - CloseHandle(tokenHandle); - } - if (unmanagedPassword != IntPtr.Zero) { - Marshal.ZeroFreeCoTaskMemUnicode(unmanagedPassword); - } - unmanagedPassword = IntPtr.Zero; - } - } -'@ - - Add-Type -PassThru -Namespace Microsoft.Windows.DesiredStateConfiguration.NanoServer.UserResource ` - -Name CredentialsValidationTool -MemberDefinition $source -Using System.Security -ReferencedAssemblies System.Security.SecureString.dll | Out-Null - return [Microsoft.Windows.DesiredStateConfiguration.NanoServer.UserResource.CredentialsValidationTool]::ValidateCredentials($UserName, $Password) -} - - -Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/MSFT_UserResource.schema.mof b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/MSFT_UserResource.schema.mof deleted file mode 100644 index 2287266..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/MSFT_UserResource.schema.mof and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/ko-KR/MSFT_UserResource.schema.mfl b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/ko-KR/MSFT_UserResource.schema.mfl deleted file mode 100644 index 1b9725c..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/ko-KR/MSFT_UserResource.schema.mfl and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/ko-KR/MSFT_UserResource.strings.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/ko-KR/MSFT_UserResource.strings.psd1 deleted file mode 100644 index ef7543b..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/ko-KR/MSFT_UserResource.strings.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAll/MSFT_WaitForAll.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAll/MSFT_WaitForAll.psm1 deleted file mode 100644 index f16256d..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAll/MSFT_WaitForAll.psm1 +++ /dev/null @@ -1,113 +0,0 @@ -# -# WaitForAll -# - -# -# The Get-TargetResource cmdlet. -# -function Get-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $ResourceName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string[]] $NodeName, - - [ValidateRange(1,[Uint64]::MaxValue)] - [Uint64] $RetryIntervalSec = 1, - - [Uint32] $RetryCount = 0, - - [Uint32] $ThrottleLimit = 32 #Powershell New-CimSession default throttle value - ) - - - Import-Module $PSScriptRoot\..\..\PSDSCxMachine.psm1 -Verbose:$false - - return PSDSCxMachine\Get-_InternalPSDscXMachineTR ` - -RemoteResourceId $ResourceName ` - -RemoteMachine $NodeName ` - -MinimalNumberOfMachineInState $NodeName.Count ` - -RetryIntervalSec $RetryIntervalSec ` - -RetryCount $RetryCount ` - -ThrottleLimit $ThrottleLimit -} - -# -# The Set-TargetResource cmdlet. -# -function Set-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $ResourceName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string[]] $NodeName, - - [ValidateRange(1,[Uint64]::MaxValue)] - [Uint64] $RetryIntervalSec = 1, - - [Uint32] $RetryCount = 0, - - [Uint32] $ThrottleLimit = 32 #Powershell New-CimSession default throttle value - ) - - Import-Module $PSScriptRoot\..\..\PSDSCxMachine.psm1 -Verbose:$false - - PSDSCxMachine\Set-_InternalPSDscXMachineTR ` - -RemoteResourceId $ResourceName ` - -RemoteMachine $NodeName ` - -MinimalNumberOfMachineInState $NodeName.Count ` - -RetryIntervalSec $RetryIntervalSec ` - -RetryCount $RetryCount ` - -ThrottleLimit $ThrottleLimit ` - -Verbose:$($PSBoundParameters["Verbose"] -eq $true) -} - -# -# Test-TargetResource -# -# -function Test-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $ResourceName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string[]] $NodeName, - - [ValidateRange(1,[Uint64]::MaxValue)] - [Uint64] $RetryIntervalSec = 1, - - [Uint32] $RetryCount = 0, - - [Uint32] $ThrottleLimit = 32 #Powershell New-CimSession default throttle value - ) - - Import-Module $PSScriptRoot\..\..\PSDSCxMachine.psm1 -Verbose:$false - - return PSDSCxMachine\Test-_InternalPSDscXMachineTR ` - -RemoteResourceId $ResourceName ` - -RemoteMachine $NodeName ` - -MinimalNumberOfMachineInState $NodeName.Count ` - -RetryIntervalSec $RetryIntervalSec ` - -RetryCount $RetryCount ` - -ThrottleLimit $ThrottleLimit ` - -Verbose:$($PSBoundParameters["Verbose"] -eq $true) -} - - - -Export-ModuleMember -Function *-TargetResource \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAll/MSFT_WaitForAll.schema.mof b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAll/MSFT_WaitForAll.schema.mof deleted file mode 100644 index 52f0af5..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAll/MSFT_WaitForAll.schema.mof and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAll/ko-KR/MSFT_WaitForAll.schema.mfl b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAll/ko-KR/MSFT_WaitForAll.schema.mfl deleted file mode 100644 index 1c738ef..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAll/ko-KR/MSFT_WaitForAll.schema.mfl and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAny/MSFT_WaitForAny.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAny/MSFT_WaitForAny.psm1 deleted file mode 100644 index 16457be..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAny/MSFT_WaitForAny.psm1 +++ /dev/null @@ -1,113 +0,0 @@ -# -# WaitForAny -# - -# -# The Get-TargetResource cmdlet. -# -function Get-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $ResourceName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string[]] $NodeName, - - [ValidateRange(1,[Uint64]::MaxValue)] - [Uint64] $RetryIntervalSec = 1, - - [Uint32] $RetryCount = 0, - - [Uint32] $ThrottleLimit = 32 #Powershell New-CimSession default throttle value - ) - - Import-Module $PSScriptRoot\..\..\PSDSCxMachine.psm1 -Verbose:$false - - return PSDSCxMachine\Get-_InternalPSDscXMachineTR ` - -RemoteResourceId $ResourceName ` - -RemoteMachine $NodeName ` - -MinimalNumberOfMachineInState 1 ` - -RetryIntervalSec $RetryIntervalSec ` - -RetryCount $RetryCount ` - -ThrottleLimit $ThrottleLimit -} - -# -# The Set-TargetResource cmdlet. -# -function Set-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $ResourceName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string[]] $NodeName, - - [ValidateRange(1,[Uint64]::MaxValue)] - [Uint64] $RetryIntervalSec = 1, - - [Uint32] $RetryCount = 0, - - [Uint32] $ThrottleLimit = 32 #Powershell New-CimSession default throttle value - ) - - Import-Module $PSScriptRoot\..\..\PSDSCxMachine.psm1 -Verbose:$false - - - PSDSCxMachine\Set-_InternalPSDscXMachineTR ` - -RemoteResourceId $ResourceName ` - -RemoteMachine $NodeName ` - -MinimalNumberOfMachineInState 1 ` - -RetryIntervalSec $RetryIntervalSec ` - -RetryCount $RetryCount ` - -ThrottleLimit $ThrottleLimit ` - -Verbose:$($PSBoundParameters["Verbose"] -eq $true) -} - -# -# Test-TargetResource -# -# -function Test-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $ResourceName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string[]] $NodeName, - - [ValidateRange(1,[Uint64]::MaxValue)] - [Uint64] $RetryIntervalSec = 1, - - [Uint32] $RetryCount = 0, - - [Uint32] $ThrottleLimit = 32 #Powershell New-CimSession default throttle value - ) - - Import-Module $PSScriptRoot\..\..\PSDSCxMachine.psm1 -Verbose:$false - - return PSDSCxMachine\Test-_InternalPSDscXMachineTR ` - -RemoteResourceId $ResourceName ` - -RemoteMachine $NodeName ` - -MinimalNumberOfMachineInState 1 ` - -RetryIntervalSec $RetryIntervalSec ` - -RetryCount $RetryCount ` - -ThrottleLimit $ThrottleLimit ` - -Verbose:$($PSBoundParameters["Verbose"] -eq $true) -} - - - -Export-ModuleMember -Function *-TargetResource \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAny/MSFT_WaitForAny.schema.mof b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAny/MSFT_WaitForAny.schema.mof deleted file mode 100644 index f3bd8fc..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAny/MSFT_WaitForAny.schema.mof and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAny/ko-KR/MSFT_WaitForAny.schema.mfl b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAny/ko-KR/MSFT_WaitForAny.schema.mfl deleted file mode 100644 index 8ab9689..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAny/ko-KR/MSFT_WaitForAny.schema.mfl and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForSome/MSFT_WaitForSome.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForSome/MSFT_WaitForSome.psm1 deleted file mode 100644 index 166a917..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForSome/MSFT_WaitForSome.psm1 +++ /dev/null @@ -1,129 +0,0 @@ -# -# WaitForSome -# - -# -# The Get-TargetResource cmdlet. -# -function Get-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $ResourceName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string[]] $NodeName, - - [parameter(Mandatory)] - [Uint32] $NodeCount, - - [ValidateRange(1,[Uint64]::MaxValue)] - [Uint64] $RetryIntervalSec = 1, - - [Uint32] $RetryCount = 0, - - [Uint32] $ThrottleLimit = 32 #Powershell New-CimSession default throttle value - ) - - Import-Module $PSScriptRoot\..\..\PSDSCxMachine.psm1 -Verbose:$false - - $result = PSDSCxMachine\Get-_InternalPSDscXMachineTR ` - -RemoteResourceId $ResourceName ` - -RemoteMachine $NodeName ` - -MinimalNumberOfMachineInState $NodeCount ` - -RetryIntervalSec $RetryIntervalSec ` - -RetryCount $RetryCount ` - -ThrottleLimit $ThrottleLimit - $result.NodeCount = $NodeCount - - $result -} - -# -# The Set-TargetResource cmdlet. -# -function Set-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $ResourceName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string[]] $NodeName, - - [parameter(Mandatory)] - [Uint32] $NodeCount, - - [ValidateRange(1,[Uint64]::MaxValue)] - [Uint64] $RetryIntervalSec = 1, - - [Uint32] $RetryCount = 0, - - [Uint32] $ThrottleLimit = 32 #Powershell New-CimSession default throttle value - ) - - Import-Module $PSScriptRoot\..\..\PSDSCxMachine.psm1 -Verbose:$false - - PSDSCxMachine\Set-_InternalPSDscXMachineTR ` - -RemoteResourceId $ResourceName ` - -RemoteMachine $NodeName ` - -MinimalNumberOfMachineInState $NodeCount ` - -RetryIntervalSec $RetryIntervalSec ` - -RetryCount $RetryCount ` - -ThrottleLimit $ThrottleLimit ` - -Verbose:$($PSBoundParameters["Verbose"] -eq $true) -} - -# -# Test-TargetResource -# -# -function Test-TargetResource -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $ResourceName, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string[]] $NodeName, - - [parameter(Mandatory)] - [Uint32] $NodeCount, - - [ValidateRange(1,[Uint64]::MaxValue)] - [Uint64] $RetryIntervalSec = 1, - - [Uint32] $RetryCount = 0, - - [Uint32] $ThrottleLimit = 32 #Powershell New-CimSession default throttle value - ) - - if ($NodeCount -gt $NodeName.Count) - { - throw "Invalid input NodeCount!" - } - - Import-Module $PSScriptRoot\..\..\PSDSCxMachine.psm1 -Verbose:$false - - return PSDSCxMachine\Test-_InternalPSDscXMachineTR ` - -RemoteResourceId $ResourceName ` - -RemoteMachine $NodeName ` - -MinimalNumberOfMachineInState $NodeCount ` - -RetryIntervalSec $RetryIntervalSec ` - -RetryCount $RetryCount ` - -ThrottleLimit $ThrottleLimit ` - -Verbose:$($PSBoundParameters["Verbose"] -eq $true) -} - - - -Export-ModuleMember -Function *-TargetResource \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForSome/MSFT_WaitForSome.schema.mof b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForSome/MSFT_WaitForSome.schema.mof deleted file mode 100644 index 058bbb9..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForSome/MSFT_WaitForSome.schema.mof and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForSome/ko-KR/MSFT_WaitForSome.schema.mfl b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForSome/ko-KR/MSFT_WaitForSome.schema.mfl deleted file mode 100644 index b1ee5a0..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForSome/ko-KR/MSFT_WaitForSome.schema.mfl and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/MSFT_WindowsOptionalFeature.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/MSFT_WindowsOptionalFeature.psm1 deleted file mode 100644 index 5db7fd6..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/MSFT_WindowsOptionalFeature.psm1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/MSFT_WindowsOptionalFeature.schema.mof b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/MSFT_WindowsOptionalFeature.schema.mof deleted file mode 100644 index 3b7d191..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/MSFT_WindowsOptionalFeature.schema.mof and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/ko-KR/MSFT_WindowsOptionalFeature.schema.mfl b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/ko-KR/MSFT_WindowsOptionalFeature.schema.mfl deleted file mode 100644 index 9f469e8..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/ko-KR/MSFT_WindowsOptionalFeature.schema.mfl and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/ko-KR/MSFT_WindowsOptionalFeature.strings.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/ko-KR/MSFT_WindowsOptionalFeature.strings.psd1 deleted file mode 100644 index 6de0ed3..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/ko-KR/MSFT_WindowsOptionalFeature.strings.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/ProcessSet/ProcessSet.Schema.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/ProcessSet/ProcessSet.Schema.psm1 deleted file mode 100644 index aa9161c..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/ProcessSet/ProcessSet.Schema.psm1 +++ /dev/null @@ -1,49 +0,0 @@ -Import-Module "$PSScriptRoot\..\CompositeResourceHelper.psm1" - -Configuration ProcessSet -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param( - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [System.String[]] - $Path, - - [ValidateNotNullOrEmpty()] - [System.Management.Automation.PSCredential] - $Credential, - - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [System.String] - $StandardOutputPath, - - [System.String] - $StandardErrorPath, - - [System.String] - $StandardInputPath, - - [System.String] - $WorkingDirectory - ) - - $psboundParams = $PSBoundParameters - $optionalParameters = @("Credential","Ensure","StandardOutputPath","StandardErrorPath","StandardInputPath","WorkingDirectory") - $keyParamName = "Path" - $resourceName = "WindowsProcess" - - #build common parameters for all WindowsProcess resource nodes - [string] $commonParameters = BuildResourceCommonParameters -KeyParamName $keyParamName -OptionalParams $optionalParameters -PSBoundParams $psboundParams - - #Arguments is a key parameter in WindowsProcess resource. Adding it as default parameter with an empty value string - $defaultParam = 'Arguments = ""' - - #build WindowsProcess resource string - [string] $resourceString = BuildResourceString -KeyParam $Path -KeyParamName $keyParamName -CommonParams $commonParameters -ResourceName $resourceName -DefaultParams $defaultParam - - $configScript = [scriptblock]::Create($resourceString) - . $configScript -} \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/ProcessSet/ProcessSet.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/ProcessSet/ProcessSet.psd1 deleted file mode 100644 index 7d3e6d7..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/ProcessSet/ProcessSet.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/RunAsHelper.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/RunAsHelper.psm1 deleted file mode 100644 index b92f3f5..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/RunAsHelper.psm1 +++ /dev/null @@ -1,480 +0,0 @@ -########################################################################### -# built-in DSCResources common functions for Credentials and RunAs support -########################################################################### - -Set-StrictMode -version Latest - -Import-Module "$PSScriptRoot\DSCResourceHelper.psm1" - -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData @' -ErrorInvalidUserName=UserName {0} is not valid. -UserCouldNotBeLoggedError=The user could not be logged on. Ensure that the user has an existing profile on the machine and that correct credentials are provided. Logon error # -OpenProcessTokenError=Open process token error # -PrivilegeLookingUpError=Error in looking up privilege of the process. This should not happen if DSC is running as LocalSystem Lookup privilege error # -TokenElevationError=Token elevation error # -DuplicateTokenError=Duplicate Token error # -CouldNotCreateProcessError=The process could not be created. Create process as user error # -WaitFailedError=Wait during create process failed user error # -RetriveStatusError=Retrieving status error # -'@ -} - -Import-LocalizedData LocalizedData -filename RunAsHelper.strings.psd1 -$EscapedLocalizedData = @{} -foreach( $key in $LocalizedData.Keys ) -{ - $EscapedLocalizedData.Add($key, $LocalizedData[$key].Replace('"','""')) -} -$LocalizedData = $EscapedLocalizedData - -# -# The goal of this function is to get domain and username from PSCredential -# without calling GetNetworkCredential() method. -# Call to GetNetworkCredential() expose password as a plain text in memory. -# -function Get-DomainAndUserName([PSCredential]$Credential) -{ - # - # Supported formats: DOMAIN\username, username@domain - # - $wrongFormat = $false - if ($Credential.UserName.Contains('\')) - { - $segments = $Credential.UserName.Split('\') - if ($segments.Length -gt 2) - { - # i.e. domain\user\foo - $wrongFormat = $true - } else { - $Domain = $segments[0] - $UserName = $segments[1] - } - } - elseif ($Credential.UserName.Contains('@')) - { - $segments = $Credential.UserName.Split('@') - if ($segments.Length -gt 2) - { - # i.e. user@domain@foo - $wrongFormat = $true - } else { - $UserName = $segments[0] - $Domain = $segments[1] - } - } - else - { - # support for default domain (localhost) - return @( $env:COMPUTERNAME, $Credential.UserName ) - } - - if ($wrongFormat) - { - $message = $LocalizedData.ErrorInvalidUserName -f $Credential.UserName - Write-Verbose $message - $exception = New-Object System.ArgumentException $message - throw New-Object System.Management.Automation.ErrorRecord $exception, "InvalidUserName", InvalidArgument, $null - } - - return @( $Domain, $UserName ) -} - -function Import-DscNativeMethods -{ -$script:ProgramSource = @" - -using System; -using System.Collections.Generic; -using System.Text; -using System.Security; -using System.Runtime.InteropServices; -using System.Diagnostics; -using System.Security.Principal; -#if !CORECLR -using System.ComponentModel; -#endif -using System.IO; - -namespace PSDesiredStateConfiguration -{ -#if !CORECLR - [SuppressUnmanagedCodeSecurity] -#endif - public static class NativeMethods - { - //The following structs and enums are used by the various Win32 API's that are used in the code below - - [StructLayout(LayoutKind.Sequential)] - public struct STARTUPINFO - { - public Int32 cb; - public string lpReserved; - public string lpDesktop; - public string lpTitle; - public Int32 dwX; - public Int32 dwY; - public Int32 dwXSize; - public Int32 dwXCountChars; - public Int32 dwYCountChars; - public Int32 dwFillAttribute; - public Int32 dwFlags; - public Int16 wShowWindow; - public Int16 cbReserved2; - public IntPtr lpReserved2; - public IntPtr hStdInput; - public IntPtr hStdOutput; - public IntPtr hStdError; - } - - [StructLayout(LayoutKind.Sequential)] - public struct PROCESS_INFORMATION - { - public IntPtr hProcess; - public IntPtr hThread; - public Int32 dwProcessID; - public Int32 dwThreadID; - } - - [Flags] - public enum LogonType - { - LOGON32_LOGON_INTERACTIVE = 2, - LOGON32_LOGON_NETWORK = 3, - LOGON32_LOGON_BATCH = 4, - LOGON32_LOGON_SERVICE = 5, - LOGON32_LOGON_UNLOCK = 7, - LOGON32_LOGON_NETWORK_CLEARTEXT = 8, - LOGON32_LOGON_NEW_CREDENTIALS = 9 - } - - [Flags] - public enum LogonProvider - { - LOGON32_PROVIDER_DEFAULT = 0, - LOGON32_PROVIDER_WINNT35, - LOGON32_PROVIDER_WINNT40, - LOGON32_PROVIDER_WINNT50 - } - [StructLayout(LayoutKind.Sequential)] - public struct SECURITY_ATTRIBUTES - { - public Int32 Length; - public IntPtr lpSecurityDescriptor; - public bool bInheritHandle; - } - - public enum SECURITY_IMPERSONATION_LEVEL - { - SecurityAnonymous, - SecurityIdentification, - SecurityImpersonation, - SecurityDelegation - } - - public enum TOKEN_TYPE - { - TokenPrimary = 1, - TokenImpersonation - } - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal struct TokPriv1Luid - { - public int Count; - public long Luid; - public int Attr; - } - - public const int GENERIC_ALL_ACCESS = 0x10000000; - public const int CREATE_NO_WINDOW = 0x08000000; - internal const int SE_PRIVILEGE_ENABLED = 0x00000002; - internal const int TOKEN_QUERY = 0x00000008; - internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020; - internal const string SE_INCRASE_QUOTA = "SeIncreaseQuotaPrivilege"; - -#if CORECLR - [DllImport("api-ms-win-core-handle-l1-1-0.dll", -#else - [DllImport("kernel32.dll", -#endif - EntryPoint = "CloseHandle", SetLastError = true, - CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] - public static extern bool CloseHandle(IntPtr handle); - -#if CORECLR - [DllImport("api-ms-win-core-processthreads-l1-1-2.dll", -#else - [DllImport("advapi32.dll", -#endif - EntryPoint = "CreateProcessAsUser", SetLastError = true, - CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] - public static extern bool CreateProcessAsUser( - IntPtr hToken, - string lpApplicationName, - string lpCommandLine, - ref SECURITY_ATTRIBUTES lpProcessAttributes, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - bool bInheritHandle, - Int32 dwCreationFlags, - IntPtr lpEnvrionment, - string lpCurrentDirectory, - ref STARTUPINFO lpStartupInfo, - ref PROCESS_INFORMATION lpProcessInformation - ); - -#if CORECLR - [DllImport("api-ms-win-security-base-l1-1-0.dll", EntryPoint = "DuplicateTokenEx")] -#else - [DllImport("advapi32.dll", EntryPoint = "DuplicateTokenEx")] -#endif - public static extern bool DuplicateTokenEx( - IntPtr hExistingToken, - Int32 dwDesiredAccess, - ref SECURITY_ATTRIBUTES lpThreadAttributes, - Int32 ImpersonationLevel, - Int32 dwTokenType, - ref IntPtr phNewToken - ); - -#if CORECLR - [DllImport("api-ms-win-security-logon-l1-1-1.dll", CharSet = CharSet.Unicode, SetLastError = true)] -#else - [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] -#endif - public static extern Boolean LogonUser( - String lpszUserName, - String lpszDomain, - IntPtr lpszPassword, - LogonType dwLogonType, - LogonProvider dwLogonProvider, - out IntPtr phToken - ); - -#if CORECLR - [DllImport("api-ms-win-security-base-l1-1-0.dll", ExactSpelling = true, SetLastError = true)] -#else - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] -#endif - internal static extern bool AdjustTokenPrivileges( - IntPtr htok, - bool disall, - ref TokPriv1Luid newst, - int len, - IntPtr prev, - IntPtr relen - ); - -#if CORECLR - [DllImport("api-ms-win-downlevel-kernel32-l1-1-0.dll", ExactSpelling = true)] -#else - [DllImport("kernel32.dll", ExactSpelling = true)] -#endif - internal static extern IntPtr GetCurrentProcess(); - -#if CORECLR - [DllImport("api-ms-win-downlevel-advapi32-l1-1-1.dll", ExactSpelling = true, SetLastError = true)] -#else - [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] -#endif - internal static extern bool OpenProcessToken( - IntPtr h, - int acc, - ref IntPtr phtok - ); - -#if CORECLR - [DllImport("api-ms-win-downlevel-kernel32-l1-1-0.dll", ExactSpelling = true)] -#else - [DllImport("kernel32.dll", ExactSpelling = true)] -#endif - internal static extern int WaitForSingleObject( - IntPtr h, - int milliseconds - ); - -#if CORECLR - [DllImport("api-ms-win-downlevel-kernel32-l1-1-0.dll", ExactSpelling = true)] -#else - [DllImport("kernel32.dll", ExactSpelling = true)] -#endif - internal static extern bool GetExitCodeProcess( - IntPtr h, - out int exitcode - ); - -#if CORECLR - [DllImport("api-ms-win-downlevel-advapi32-l4-1-0.dll", SetLastError = true)] -#else - [DllImport("advapi32.dll", SetLastError = true)] -#endif - internal static extern bool LookupPrivilegeValue( - string host, - string name, - ref long pluid - ); - - internal static void ThrowException( - string message - ) - { -#if CORECLR - throw new Exception(message); -#else - throw new Win32Exception(message); -#endif - } - - public static void CreateProcessAsUser(string strCommand, string strDomain, string strName, SecureString secureStringPassword, bool waitForExit, ref int ExitCode) - { - var hToken = IntPtr.Zero; - var hDupedToken = IntPtr.Zero; - TokPriv1Luid tp; - var pi = new PROCESS_INFORMATION(); - var sa = new SECURITY_ATTRIBUTES(); - sa.Length = Marshal.SizeOf(sa); - Boolean bResult = false; - try - { - IntPtr unmanagedPassword = IntPtr.Zero; - try - { -#if CORECLR - unmanagedPassword = SecureStringMarshal.SecureStringToCoTaskMemUnicode(secureStringPassword); -#else - unmanagedPassword = Marshal.SecureStringToGlobalAllocUnicode(secureStringPassword); -#endif - bResult = LogonUser( - strName, - strDomain, - unmanagedPassword, - LogonType.LOGON32_LOGON_NETWORK_CLEARTEXT, - LogonProvider.LOGON32_PROVIDER_DEFAULT, - out hToken - ); - } - finally - { - Marshal.ZeroFreeGlobalAllocUnicode(unmanagedPassword); - } - if (!bResult) - { - ThrowException(@"$($LocalizedData.UserCouldNotBeLoggedError)" + Marshal.GetLastWin32Error().ToString()); - } - IntPtr hproc = GetCurrentProcess(); - IntPtr htok = IntPtr.Zero; - bResult = OpenProcessToken( - hproc, - TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, - ref htok - ); - if (!bResult) - { - ThrowException(@"$($LocalizedData.OpenProcessTokenError)" + Marshal.GetLastWin32Error().ToString()); - } - tp.Count = 1; - tp.Luid = 0; - tp.Attr = SE_PRIVILEGE_ENABLED; - bResult = LookupPrivilegeValue( - null, - SE_INCRASE_QUOTA, - ref tp.Luid - ); - if (!bResult) - { - ThrowException(@"$($LocalizedData.PrivilegeLookingUpError)" + Marshal.GetLastWin32Error().ToString()); - } - bResult = AdjustTokenPrivileges( - htok, - false, - ref tp, - 0, - IntPtr.Zero, - IntPtr.Zero - ); - if (!bResult) - { - ThrowException(@"$($LocalizedData.TokenElevationError)" + Marshal.GetLastWin32Error().ToString()); - } - - bResult = DuplicateTokenEx( - hToken, - GENERIC_ALL_ACCESS, - ref sa, - (int)SECURITY_IMPERSONATION_LEVEL.SecurityIdentification, - (int)TOKEN_TYPE.TokenPrimary, - ref hDupedToken - ); - if (!bResult) - { - ThrowException(@"$($LocalizedData.DuplicateTokenError)" + Marshal.GetLastWin32Error().ToString()); - } - var si = new STARTUPINFO(); - si.cb = Marshal.SizeOf(si); - si.lpDesktop = ""; - bResult = CreateProcessAsUser( - hDupedToken, - null, - strCommand, - ref sa, - ref sa, - false, - 0, - IntPtr.Zero, - null, - ref si, - ref pi - ); - if (!bResult) - { - ThrowException(@"$($LocalizedData.CouldNotCreateProcessError)" + Marshal.GetLastWin32Error().ToString()); - } - if (waitForExit) { - int status = WaitForSingleObject(pi.hProcess, -1); - if(status == -1) - { - ThrowException(@"$($LocalizedData.WaitFailedError)" + Marshal.GetLastWin32Error().ToString()); - } - - bResult = GetExitCodeProcess(pi.hProcess, out ExitCode); - if(!bResult) - { - ThrowException(@"$($LocalizedData.RetriveStatusError)" + Marshal.GetLastWin32Error().ToString()); - } - } - } - finally - { - if (pi.hThread != IntPtr.Zero) - { - CloseHandle(pi.hThread); - } - if (pi.hProcess != IntPtr.Zero) - { - CloseHandle(pi.hProcess); - } - if (hDupedToken != IntPtr.Zero) - { - CloseHandle(hDupedToken); - } - } - } - } -} - -"@ - - if(IsNanoServer) - { - $ProgramSource = "#define CORECLR`n" + $ProgramSource - Add-Type -TypeDefinition $ProgramSource -ReferencedAssemblies System.Security.SecureString.dll - } - else - { - Add-Type -TypeDefinition $ProgramSource -ReferencedAssemblies "System.ServiceProcess" - } -} - -Export-ModuleMember -Function Get-DomainAndUserName,Import-DscNativeMethods,IsNanoServer \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/ServiceSet/ServiceSet.Schema.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/ServiceSet/ServiceSet.Schema.psm1 deleted file mode 100644 index 04aaf2b..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/ServiceSet/ServiceSet.Schema.psm1 +++ /dev/null @@ -1,46 +0,0 @@ -Import-Module "$PSScriptRoot\..\CompositeResourceHelper.psm1" - -Configuration ServiceSet -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param( - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [System.String[]] - $Name, - - [ValidateSet('Automatic','Manual','Disabled')] - [System.String] - $StartupType, - - [ValidateSet('LocalSystem','LocalService','NetworkService')] - [System.String] - $BuiltInAccount, - - [ValidateSet('Running','Stopped')] - [System.String] - $State, - - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - $Credential - ) - - $psboundParams = $PSBoundParameters - $optionalParameters = @("StartupType","BuiltInAccount","State","Ensure","Credential") - $keyParamName = "Name" - $resourceName = "Service" - - #build common parameters for all Service resource nodes - [string] $commonParameters = BuildResourceCommonParameters -KeyParamName $keyParamName -OptionalParams $optionalParameters -PSBoundParams $psboundParams - - #build Service resource string - [string] $resourceString = BuildResourceString -KeyParam $Name -KeyParamName $keyParamName -CommonParams $commonParameters -ResourceName $resourceName - - $configScript = [scriptblock]::Create($resourceString) - . $configScript -} \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/ServiceSet/ServiceSet.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/ServiceSet/ServiceSet.psd1 deleted file mode 100644 index e1faa52..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/ServiceSet/ServiceSet.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/WindowsFeatureSet/WindowsFeatureSet.Schema.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/WindowsFeatureSet/WindowsFeatureSet.Schema.psm1 deleted file mode 100644 index 7a6bdf0..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/WindowsFeatureSet/WindowsFeatureSet.Schema.psm1 +++ /dev/null @@ -1,45 +0,0 @@ -Import-Module "$PSScriptRoot\..\CompositeResourceHelper.psm1" - -Configuration WindowsFeatureSet -{ - [CmdletBinding(SupportsShouldProcess=$true)] - param( - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [System.String[]] - $Name, - - [ValidateSet('Present','Absent')] - [System.String] - $Ensure, - - [ValidateNotNullOrEmpty()] - [System.String] - $Source, - - [System.Boolean] - $IncludeAllSubFeature, - - [ValidateNotNull()] - [System.Management.Automation.PSCredential] - $Credential, - - [ValidateNotNullOrEmpty()] - [System.String] - $LogPath - ) - - $psboundParams = $PSBoundParameters - $optionalParameters = @("Ensure","Source","IncludeAllSubFeature","Credential","LogPath") - $keyParamName = "Name" - $resourceName = "WindowsFeature" - - #build common parameters for all WindowsFeature resource nodes - [string] $commonParameters = BuildResourceCommonParameters -KeyParamName $keyParamName -OptionalParams $optionalParameters -PSBoundParams $psboundParams - - #build WindowsFeature resource string - [string] $resourceString = BuildResourceString -KeyParam $Name -KeyParamName $keyParamName -CommonParams $commonParameters -ResourceName $resourceName - - $configScript = [scriptblock]::Create($resourceString) - . $configScript -} \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/WindowsFeatureSet/WindowsFeatureSet.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/WindowsFeatureSet/WindowsFeatureSet.psd1 deleted file mode 100644 index add6377..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/WindowsFeatureSet/WindowsFeatureSet.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/WindowsOptionalFeatureSet/WindowsOptionalFeatureSet.Schema.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/WindowsOptionalFeatureSet/WindowsOptionalFeatureSet.Schema.psm1 deleted file mode 100644 index 1e1ea9a..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/WindowsOptionalFeatureSet/WindowsOptionalFeatureSet.Schema.psm1 +++ /dev/null @@ -1,49 +0,0 @@ -Import-Module "$PSScriptRoot\..\CompositeResourceHelper.psm1" - -Configuration WindowsOptionalFeatureSet -{ - [CmdletBinding()] - param( - [Parameter(Mandatory=$true)] - [ValidateNotNullOrEmpty()] - [System.String[]] - $Name, - - [Parameter(Mandatory=$true)] - [ValidateSet('Enable','Disable')] - [System.String] - $Ensure, - - [ValidateNotNullOrEmpty()] - [System.String[]] - $Source, - - [System.Boolean] - $RemoveFilesOnDisable, - - [ValidateNotNullOrEmpty()] - [System.String] - $LogPath, - - [System.Boolean] - $NoWindowsUpdateCheck, - - [ValidateSet('ErrorsOnly','ErrorsAndWarning','ErrorsAndWarningAndInformation')] - [System.String] - $LogLevel - ) - - $psboundParams = $PSBoundParameters - $optionalParameters = @("Ensure","Source","RemoveFilesOnDisable","LogPath","NoWindowsUpdateCheck","LogLevel") - $keyParamName = "Name" - $resourceName = "WindowsOptionalFeature" - - #build common parameters for all WindowsOptionalFeature resource nodes - [string] $commonParameters = BuildResourceCommonParameters -KeyParamName $keyParamName -OptionalParams $optionalParameters -PSBoundParams $psboundParams - - #build WindowsOptionalFeature resource string - [string] $resourceString = BuildResourceString -KeyParam $Name -KeyParamName $keyParamName -CommonParams $commonParameters -ResourceName $resourceName - - $configScript = [scriptblock]::Create($resourceString) - . $configScript -} \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/WindowsOptionalFeatureSet/WindowsOptionalFeatureSet.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/WindowsOptionalFeatureSet/WindowsOptionalFeatureSet.psd1 deleted file mode 100644 index f1c5be9..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/WindowsOptionalFeatureSet/WindowsOptionalFeatureSet.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/ko-KR/RunAsHelper.strings.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/ko-KR/RunAsHelper.strings.psd1 deleted file mode 100644 index bb990a5..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DSCResources/ko-KR/RunAsHelper.strings.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/Disable-DscDebug.cdxml b/newton-cn/bin/Modules/PSDesiredStateConfiguration/Disable-DscDebug.cdxml deleted file mode 100644 index 15c15ad..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/Disable-DscDebug.cdxml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - 2.0.0.0 - DscDebug - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DownloadManager/DSCFileDownloadManager/DSCFileDownloadManager.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DownloadManager/DSCFileDownloadManager/DSCFileDownloadManager.psd1 deleted file mode 100644 index 190ea65..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DownloadManager/DSCFileDownloadManager/DSCFileDownloadManager.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DownloadManager/DSCFileDownloadManager/Microsoft.PowerShell.DSC.FileDownloadManager.dll b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DownloadManager/DSCFileDownloadManager/Microsoft.PowerShell.DSC.FileDownloadManager.dll deleted file mode 100644 index cb124fd..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DownloadManager/DSCFileDownloadManager/Microsoft.PowerShell.DSC.FileDownloadManager.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DownloadManager/DSCFileDownloadManager/ko/Microsoft.PowerShell.DSC.FileDownloadManager.Resources.dll b/newton-cn/bin/Modules/PSDesiredStateConfiguration/DownloadManager/DSCFileDownloadManager/ko/Microsoft.PowerShell.DSC.FileDownloadManager.Resources.dll deleted file mode 100644 index 449004a..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/DownloadManager/DSCFileDownloadManager/ko/Microsoft.PowerShell.DSC.FileDownloadManager.Resources.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/Enable-DscDebug.cdxml b/newton-cn/bin/Modules/PSDesiredStateConfiguration/Enable-DscDebug.cdxml deleted file mode 100644 index a7e39c7..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/Enable-DscDebug.cdxml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - 2.0.0.0 - DscDebug - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/Get-DSCLocalConfigurationManager.cdxml b/newton-cn/bin/Modules/PSDesiredStateConfiguration/Get-DSCLocalConfigurationManager.cdxml deleted file mode 100644 index edd6104..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/Get-DSCLocalConfigurationManager.cdxml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - 2.0.0.0 - DscLocalConfigurationManager - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/Get-DscConfiguration.cdxml b/newton-cn/bin/Modules/PSDesiredStateConfiguration/Get-DscConfiguration.cdxml deleted file mode 100644 index 871f9d4..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/Get-DscConfiguration.cdxml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - 2.0.0.0 - DscConfiguration - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/Get-DscConfigurationStatus.cdxml b/newton-cn/bin/Modules/PSDesiredStateConfiguration/Get-DscConfigurationStatus.cdxml deleted file mode 100644 index bf48b36..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/Get-DscConfigurationStatus.cdxml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - 2.0.0.0 - DscConfigurationStatus - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.format.ps1xml b/newton-cn/bin/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.format.ps1xml deleted file mode 100644 index 9827883..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.format.ps1xml +++ /dev/null @@ -1,368 +0,0 @@ - - - - - DSCResourceSyntax - - Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo - - - - - 15 - - - 25 - - - 30 - - - 10 - - - 50 - - - - - - - ImplementedAs - - - Name - - - ModuleName - - - Version - - - Properties - - - - - - - - TestDscConfiguration - - Microsoft.Management.Infrastructure.CimMethodResult#MSFT_DSCLocalConfigurationManager#TestConfiguration - - - - - - 15 - - - - 30 - - - - 30 - - - - 15 - - - - - - - PSComputerName - - - ResourcesInDesiredState - - - ResourcesNotInDesiredState - - - InDesiredState - - - - - - - - GetMetaConfiguration - - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/MSFT_DSCMetaConfiguration - - - - - - - ActionAfterReboot - - - AgentId - - - AllowModuleOverWrite - - - CertificateID - - - ConfigurationDownloadManagers - - - ConfigurationID - - - ConfigurationMode - - - ConfigurationModeFrequencyMins - - - Credential - - - DebugMode - - - DownloadManagerCustomData - - - DownloadManagerName - - - LCMCompatibleVersions - - - LCMState - - - LCMStateDetail - - - LCMVersion - - - StatusRetentionTimeInDays - - - SignatureValidationPolicy - - - SignatureValidations - - - MaximumDownloadSizeMB - - - PartialConfigurations - - - RebootNodeIfNeeded - - - RefreshFrequencyMins - - - RefreshMode - - - ReportManagers - - - ResourceModuleManagers - - - PSComputerName - - - - - - - - GetDscConfigurationStatus - - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/MSFT_DSCConfigurationStatus - - - - - - 10 - - - - 25 - - - - 15 - - - - 5 - - - - 20 - - - - 30 - - - - - - - Status - - - StartDate - - - Type - - - Mode - - - RebootRequested - - - NumberOfResources - - - - - - - - GetDscConfigurationStatus - - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/MSFT_DSCConfigurationStatus - - - - - - - JobID - - - HostName - - - Error - - - Locale - - - IPV4Addresses - - - IPV6Addresses - - - MACAddresses - - - LCMVersion - - - Mode - - - NumberOfResources - - - MetaData - - - MetaConfiguration - - - Type - - - Status - - - StartDate - - - DurationInSeconds - - - RebootRequested - - - ResourcesInDesiredState - - - ResourcesNotInDesiredState - - - PSComputerName - - - - - - - - InvokeDscResourceTest - - Microsoft.Management.Infrastructure.CimMethodResult#MSFT_DSCLocalConfigurationManager#ResourceTest - - - - - 15 - - - - - - - - InDesiredState - - - - - - - - InvokeDscResourceSet - - Microsoft.Management.Infrastructure.CimMethodResult#MSFT_DSCLocalConfigurationManager#ResourceSet - - - - - 15 - - - - - - - - RebootRequired - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psd1 deleted file mode 100644 index 0429563..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psm1 deleted file mode 100644 index 30ac7a0..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psm1 +++ /dev/null @@ -1,4822 +0,0 @@ -########################################################### -# -# 'PSDesiredStateConfiguration' logic module -# -########################################################### -data LocalizedData -{ - # culture="en-US" - ConvertFrom-StringData -StringData @' - CheckSumFileExists = File '{0}' already exists. Please specify -Force parameter to overwrite existing checksum files. - CreateChecksumFile = Create checksum file '{0}' - OverwriteChecksumFile = Overwrite checksum file '{0}' - OutpathConflict = (ERROR) Cannot create directory '{0}'. A file exists with the same name. - InvalidConfigPath = (ERROR) Invalid configuration path '{0}' specified. - InvalidOutpath = (ERROR) Invalid OutPath '{0}' specified. - InvalidConfigurationName = Invalid Configuration Name '{0}' is specified. Standard names may only contain letters (a-z, A-Z), numbers (0-9), period (.), hyphen (-) and underscore (_). The name may not be null or empty, and should start with a letter. - NoValidConfigFileFound = No valid config files (mof,zip) were found. - InputFileNotExist=File {0} doesn't exist. - FileReadError=Error Reading file {0}. - MatchingFileNotFound=No matching file found. - CertificateFileReadError=Error Reading certificate file {0}. - CertificateStoreReadError=Error Reading certificate store for {0}. - CannotCreateOutputPath=Invalid Configuration name and output path combination :{0}. Please make sure output parameter is a valid path segment. - ConflictingDuplicateResource=A conflict was detected between resources '{0}' and '{1}' in node '{2}'. Resources have identical key properties but there are differences in the following non-key properties: '{3}'. Values '{4}' don't match values '{5}'. Please update these property values so that they are identical in both cases. - ConfiguratonDataNeedAllNodes=ConfigurationData parameter need to have property AllNodes. - ConfiguratonDataAllNodesNeedHashtable=ConfigurationData parameter property AllNodes needs to be a collection. - AllNodeNeedToBeHashtable=all elements of AllNodes need to be hashtable and has a property 'NodeName'. - DuplicatedNodeInConfigurationData=There are duplicated NodeNames '{0}' in the configurationData passed in. - EncryptedToPlaintextNotAllowed=Converting and storing encrypted passwords as plain text is not recommended. For more information on securing credentials in MOF file, please refer to MSDN blog: https://go.microsoft.com/fwlink/?LinkId=393729 - DomainCredentialNotAllowed=It is not recommended to use domain credential for node '{0}'. In order to suppress the warning, you can add a property named 'PSDscAllowDomainUser' with a value of $true to your DSC configuration data for node '{0}'. - NestedNodeNotAllowed=Defining node '{0}' inside the current node '{1}' is not allowed since node definitions cannot be nested. Please move the definition for node '{0}' to the top level of the configuration '{2}'. - FailToProcessNode=An exception was raised while processing Node '{0}': {1} - LocalHostNodeNotAllowed=Defining a 'localhost' node in the configuration '{0}' is not allowed since the configuration already contains one or more resource definitions that are not associated with any nodes. - InvalidMOFDefinition=Invalid MOF definition for node '{0}': {1} - RequiredResourceNotFound=Resource '{0}' required by '{1}' does not exist. Please ensure that the required resource exists and the name is properly formed. - ReferencedManagerNotFound=Download Manager '{0}' referenced by '{1}' does not exist. Please ensure that the referenced download manager exists and the name is properly formed. - ReferencedResourceSourceNotFound=Resource Repository '{0}' referenced by '{1}' does not exist. Please ensure that the referenced resource repository exists and the name is properly formed. - DependsOnLinkTooDeep=DependsOn link exceeded max depth limitation '{0}'. - DependsOnLoopDetected=Circular DependsOn exists '{0}'. Please make sure there are no circular reference. - FailToProcessConfiguration=Compilation errors occurred while processing configuration '{0}'. Please review the errors reported in error stream and modify your configuration code appropriately. - FailToProcessProperty={0} error processing property '{1}' OF TYPE '{2}': {3} - NodeNameIsRequired=Node processing is skipped since the node name is empty. - ConvertValueToPropertyFailed=Cannot convert '{0}' to type '{1}' for property '{2}' in resource '{3}'. - ResourceNotFound=The term '{0}' is not recognized as the name of a {1}. - GetDscResourceInputName=The Get-DscResource input '{0}' parameter value is '{1}'. - ResourceNotMatched=Skipping resource '{0}' as it does not match the requested name. - InitializingClassCache=Initializing class cache - LoadingDefaultCimKeywords=Loading default CIM keywords - GettingModuleList=Getting module list - CreatingResourceList=Creating resource list - CreatingResource=Creating resource '{0}'. - SchemaFileForResource=Schema file name for resource {0} - UnsupportedReservedKeyword=The '{0}' keyword is not supported in this version of the language. - UnsupportedReservedProperty=The '{0}' property is not supported in this version of the language. - MetaConfigurationHasMoreThanOneLocalConfigurationManager=The meta configuration for node '{0}' contain more than one definitions for LocalConfigurationManager which is not allowed. - MetaConfigurationSettingsMissing=The settings definition for node '{0}' is missing. A default empty settings definition is added for the node. - ConflictInExclusiveResources=The partial configuration '{0}' and '{1}' have coflicting exclusive resource declarations. - ReferencedModuleNotExist=The referenced module '{0}' does not exist on the machine. Please use Get-DscResource to find out what exists on the machine. - ReferencedResourceNotExist=The referenced resource '{0}' does not exist on the machine. Please use Get-DscResource to find out what exists on the machine. - ReferencedModuleResourceNotExist=The referenced module\resource '{0}' does not exist on the machine. Please use Get-DscResource to find out what exists on the machine. - DuplicatedResourceInModules=The referenced resource '{0}' exists in module {1} and module {2} on the machine. Please make sure it exists in only one module. - CannotConvertStringToBool=Cannot convert value "System.String" to type "System.Boolean". Boolean parameters accept only Boolean values and numbers, such as $True, $False, 1 or 0. - NoModulesPresent=There are no modules present in the system with the given module specification. - ImportDscResourceWarningForInbuiltResource=The configuration '{0}' is loading one or more built-in resources without explicitly importing associated modules. Add Import-DscResource -ModuleName 'PSDesiredStateConfiguration' to your configuration to avoid this message. - PasswordTooLong=An error occurred during encryption of a password in node '{0}'. Most likely the password entered is too long to be encrypted using the selected certificate. Please either use a shorter password or select a certificate with a larger key. - HashtableElementTypeNotAllowed=Value of type '{0}' is not allowed in hashtable. Supported types : [String], [Char], [Int64], [UInt64], [Double], [Bool] ,[DateTime] and [ScriptBlock]. - PullModeWithoutDownloadManager=Meta configuration is set to pull mode which requires a DownloadManager to be specified. - PullModeWithoutConfigurationRepository=Meta configuration is set to pull mode which requires a ConfigurationRepository to be specified. - DownloadManagerWithoutPullMode=A DownloadManager is specified without setting the refresh mode into PULL. - ConfigurationRepositoryWithoutPullMode=A ConfigurationRepository is specified without setting the refresh mode into PULL. - ReferencedPolicyNotDefined=The referenced SignatureValidationPolicy '{0}' is not defined. Please define a SignatureValidation block with the same name. - IncorrectSignatureValidationPolicyFormat =The value provided for SignatureValidationPolicy has incorrect format. Please provide its value in the form of '[SignatureValidation]'. -'@ -} -Set-StrictMode -Off - -# In case localized resource is not available we revert back to English as defined in LocalizedData section so ignore the error instead of showing it to user. -Import-LocalizedData -BindingVariable LocalizedData -FileName PSDesiredStateConfiguration.Resource.psd1 -ErrorAction SilentlyContinue - -$script:V1MetaConfigPropertyList = @('ConfigurationModeFrequencyMins', 'RebootNodeIfNeeded', 'ConfigurationMode', 'ActionAfterReboot', 'RefreshMode', 'CertificateID', 'ConfigurationID', 'DownloadManagerName', 'DownloadManagerCustomData', 'RefreshFrequencyMins', 'AllowModuleOverwrite', 'DebugMode', 'Credential') -$script:DirectAccessMetaConfigPropertyList = @('AllowModuleOverWrite', 'CertificateID', 'ConfigurationDownloadManagers', 'ResourceModuleManagers', 'DebugMode', 'RebootNodeIfNeeded', 'RefreshMode', 'ConfigurationAgent') - -################################################################# -# Code to determin what version related info is needed -# and fixup the configuration document is it is already generated -################################################################# -function Generate-VersionInfo -{ - param( - [Parameter(Mandatory)] - $KeywordData, - [Parameter(Mandatory)] - [Hashtable] - $Value - ) - - $SystemProperties = @('ResourceID', 'SourceInfo', 'ModuleName', 'ModuleVersion') - $HasAdditionalProperty = $false - foreach ($key in $KeywordData.Keys) - { - if (($Value.Contains($key)) -and ($script:V1MetaConfigPropertyList -notcontains $key) -and ($SystemProperties -notcontains $key)) - { - $HasAdditionalProperty = $true - break - } - } - - if($HasAdditionalProperty) - { - Set-PSMetaConfigVersionInfoV2 - } - else - { - $script:PSMetaConfigDocumentInstVersionInfo['MinimumCompatibleVersion'] = ($script:PSMetaConfigDocumentInstVersionInfo['MinimumCompatibleVersion'], "1.0.0" | Measure-Object -Maximum).Maximum - } - - $script:PSMetaConfigDocumentInstVersionInfo['CompatibleVersionAdditionalProperties'] = @('MSFT_DSCMetaConfiguration:StatusRetentionTimeInDays') - $script:PSMetaConfigurationProcessed = $true -} - -# indicate whether meta configuration is processed before document instance -function Set-PSMetaConfigDocInsProcessedBeforeMeta -{ - $Script:PSMetaConfigDocInsProcessedBeforeMeta = $true -} - -function Get-PSMetaConfigurationProcessed -{ - return $script:PSMetaConfigurationProcessed -} - -function Get-PSMetaConfigDocumentInstVersionInfo -{ - return $script:PSMetaConfigDocumentInstVersionInfo -} - -function Set-PSMetaConfigVersionInfoV2 -{ - $script:PSMetaConfigDocumentInstVersionInfo['MinimumCompatibleVersion'] = '2.0.0' - if($Script:PSMetaConfigDocInsProcessedBeforeMeta) #fixup configuration document instance version info - { - [string]$data = Get-MofInstanceText '$OMI_ConfigurationDocument1ref' - $Script:NoNameNodeInstanceAliases['$OMI_ConfigurationDocument1ref'] = $data -replace 'MinimumCompatibleVersion = "1.0.0"', 'MinimumCompatibleVersion = "2.0.0"' - Set-PSDefaultConfigurationDocument $Script:NoNameNodeInstanceAliases['$OMI_ConfigurationDocument1ref'] - } -} - -function Get-CompatibleVersionAddtionaPropertiesStr -{ - '{' - if($script:PSMetaConfigDocumentInstVersionInfo['CompatibleVersionAdditionalProperties']) - { - $len = @($script:PSMetaConfigDocumentInstVersionInfo['CompatibleVersionAdditionalProperties']).Length - foreach ($e in @($script:PSMetaConfigDocumentInstVersionInfo['CompatibleVersionAdditionalProperties'])) - { - "`"$e`"" + $(if (--$len -gt 0) - { - ', ' - } - else - { - '' - } - ) - } - } - '}' -} - -########################################################### -# The MOF generation code -########################################################### - -# -# This scriptblock takes a type name and a list of properties and produces -# the MOF source text to define an instance of that type -# -function ConvertTo-MOFInstance -{ - param ( - [Parameter(Mandatory)] - [string] - $Type, - [Parameter(Mandatory)] - [AllowNull()] - [hashtable] - $Properties - ) - - - # remove ModuleVersion, this will be handled during final validation. - if($properties.ContainsKey('ModuleName') -and $properties['ModuleName'] -ieq 'PsDesiredStateConfiguration') - { - $script:PsDscModuleVersion = $properties['ModuleVersion'] - $properties.Remove('ModuleVersion') - } - if($properties.ContainsKey('PsDscRunAsCredential')) - { - $script:PsDscCompatibleVersion = "2.0.0" - } - # Look up the property definitions for this keyword. - $PropertyTypes = [System.Management.Automation.Language.DynamicKeyword]::GetKeyword($Type).Properties - - # and the CIM type name to use since the keyword might be an alias. - $ResourceName = [System.Management.Automation.Language.DynamicKeyword]::GetKeyword($Type).ResourceName - - if($script:IsMetaConfig -and ($ResourceName -eq 'MSFT_DSCMetaConfigurationV2')) - { - Generate-VersionInfo $PropertyTypes $Properties - } - - # - # Function to convert .NET datetime object to MOF datetime string format - # We're not using [System.Management.ManagementDateTimeConverter]::ToDmtfDateTime() - # because it has known bugs which are not going to be fixed. - # - function ConvertTo-MofDateTimeString ([datetime] $d) - { - $utcOffset = ($d -$d.ToUniversalTime()).TotalMinutes - $utcOffsetString = if ($utcOffset -ge 0) - { - '+' - } - else - { - '-' - } - $utcOffsetString += ([System.Math]::Abs(($utcOffset)).ToString().PadLeft(3,'0')) - '{0}{1}' -f - $d.ToString('yyyyMMddHHmmss.ffffff'), - $utcOffsetString - } - - # - # Utility routine to find if username specified is - # a domain user. - # - - function IsDomainUser() - { - param( - [Parameter(Mandatory)] - [string] - $UserName - ) - # if username contains '\' example: domain\username or '@' example: username@mydomain.com - # it may not be a local user. - if( -not( $UserName.Contains('\') -or $UserName.Contains('@'))) - { - # it is a local user - return $false - } - elseif( $UserName.Contains('@')) - { - return $true - } - else - { - # In case of '\', domain name can be local machine. - $result = $UserName.Split('\') - if( $result.Count -ge 2) - { - $domain = $result[0] - $localMachineNames = @("localhost","127.0.0.1","::1",$env:COMPUTERNAME) - $isDomainUser = $true - if( $localMachineNames -icontains $domain) - { - $isDomainUser = $false - } - return $isDomainUser - } - } - $true - } - - # - # Utility routine to render a property - # as a string in MOF syntax. - # - function stringify ($Value, $asArray = $false, $targetType = [string]) - { - $result = if ($Value -is [array] -or $asArray) - { - '{' - $len = @($Value).Length - foreach ($e in $Value) - { - ' ' + (stringify $e -targetType $targetType) + - $(if (--$len -gt 0) - { - ',' - } - else - { - '' - } - ) - } - '}' - } - elseif ($Value -is [PSCredential] ) - { - # If the input object is a PSCredential, turn it into an MSFT_Credential with an encrypted password. - $clearText = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::GetStringFromSecureString($Value.Password) - $newValue = @{ - UserName = $Value.UserName - Password = $clearText - } - # Recurse to build the object. - ConvertTo-MOFInstance MSFT_Credential $newValue - } - elseif ($Value -is [System.Collections.Hashtable]) - { - # Collect the individual strings - $elementsAsStrings = foreach ($p in $Value.GetEnumerator()) - { - if($p.Value -isnot [string] -and - $p.Value -isnot [char] -and - $p.Value -isnot [int64] -and - $p.Value -isnot [uint64] -and - $p.Value -isnot [double] -and - $p.Value -isnot [bool] -and - $p.Value -isnot [datetime] -and - $p.Value -isnot [ScriptBlock]) - { - $errorMessage = $LocalizedData.HashtableElementTypeNotAllowed -f $($p.Value.GetType()) - ThrowError -ExceptionName 'System.ArgumentException' -ExceptionMessage $errorMessage -ExceptionObject $Value -ErrorId 'NestedHashtableNotAllowed' -ErrorCategory InvalidArgument - } - - ConvertTo-MOFInstance MSFT_KeyValuePair @{ - Key = $p.Key - Value = $p.Value - } - } - # Produce a single formatted string. - ' ' + ($elementsAsStrings -join ",`n ") + "`n" - } - elseif ($Value -is [ScriptBlock] ) - { - # Find all $using: variables used in the script and replace them with normal variables - $scriptText = "$Value" - # Need to create a new scriptblock so the extent offsets are correct - $scriptAst = [scriptblock]::Create($scriptText).Ast - # get the $using: variable asts into an array - $variables = $scriptAst.FindAll({ - param ($ast) - $ast.GetType().FullName -match 'VariableExpressionAst' -and - $ast.Extent.Text -match '^\$using:' - } - , $true).ToArray() - - # do the substitutions in reverse order - [Array]::Reverse($variables) - $variables | ForEach-Object -Process { - $start = $_.Extent.StartOffset - $length = $_.Extent.EndOffset - $start - $newName = '$' + $_.VariablePath.UserPath - $scriptText = $scriptText.Remove($start, $length).Insert($start, $newName) - } - - $completeScript = '' - # generate assignement statements to set the variable values on the other side - # using serialized values passed from the local environment - $varNames = @($variables).VariablePath.UserPath | Sort-Object -Unique - foreach ($v in $varNames) - { - # If the ScriptBlock was defined in a module, then use the module for lookups - if ($Value.Module) - { - $var = $Value.Module.SessionState.PSVariable.Get($v) - } - else - { - # Otherwise look up in the callers context - $var = $ExecutionContext.SessionState.Module.GetVariableFromCallersModule($v) - } - - if ($var) - { - $varValue = $var.Value - # Skip null values but preserve empty arrays and strings for type propigation - if ($varValue -ne $null) - { - # Pass strings quoted; amn explicit type check is needed because -is recognizes too many things as strings - if ($varValue -is [string]) - { - $completeScript += "`$$v ='" + ($varValue -replace "'", "''") + "'`n" - } - else - { - # Serialize everything else - $serializedValue = [System.Management.Automation.PSSerializer]::Serialize($varValue) -replace "'", "''" - $completeScript += "`$$v = [System.Management.Automation.PSSerializer]::Deserialize('$serializedValue')`n" - } - } - } - } - - # Merge in the actual scriptblock body - $completeScript += $scriptText - - # Quote the string so it's suitable to embed in the MOF file... - '"' + ($completeScript -replace '\\', '\\' -replace "[`r]*`n", '\n' -replace '"', '\"') + '"' - } - elseif ($targetType -eq [datetime]) - { - # If the target is a datetime, convert the argument to a datetime and then render that - # as a DMTF datetime... - '"' + (ConvertTo-MofDateTimeString $Value) + '"' - } - elseif ($targetType -eq [double]) - { - # MOF syntax requires reals to always have a decimal point so add - # so add one if the string representation does contain one. - [string] $dblAsString = [double] $Value - if ( -not $dblAsString.Contains('.') ) - { - $dblAsString += '.0' - } - $dblAsString - } - elseif ($targetType -eq [char]) - { - # A char16 is encode as a single quoted character - "'$Value'" - } - elseif ($targetType -eq [int64]) - { - [int64] $Value - } - elseif ($targetType -eq [uint64]) - { - [uint64] $Value - } - elseif ($targetType -eq [bool]) - { - if($Value -is [string]) - { - $errorMessage = $LocalizedData.CannotConvertStringToBool - ThrowError -ExceptionName 'System.ArgumentException' -ExceptionMessage $errorMessage -ExceptionObject $Value -ErrorId 'CannotConvertStringToBool' -ErrorCategory InvalidArgument - } - else - { - [bool]$Value - } - } - elseif ($targetType -ne [string]) - { - # Cast the value to the target type... - $Value -as $targetType - } - elseif ($Value -is [string] -and -not $InstanceAliases[$Value] ) - { - '"' + ($Value -replace '\\', '\\' -replace "`r?`n", '\n' -replace '"', '\"') + '"' - } - elseif ($Value -eq $null) - { - 'NULL' - } - elseif (($targetType -eq [string]) -and ($Value -isnot [string])) - { - # Cast value to string if it is not already a string, this is for covering cases like when a user assign an integer while the - # CIM property type is string - '"' + ($Value -replace '\\', '\\' -replace "`r?`n", '\n' -replace '"', '\"') + '"' - } - else - { - $Value - } - - $result -join "`n" - } - - Write-Debug -Message " BEGIN MOF GENERATION FOR $Type" - - # Generate the MOF instance alias to use for the current node - if ( (Get-PSCurrentConfigurationNode) ) - { - if($Script:NodeTypeRefCount[ (Get-PSCurrentConfigurationNode) ] -eq $null) - { - $Script:NodeTypeRefCount[ (Get-PSCurrentConfigurationNode) ] = - New-Object -TypeName 'System.Collections.Generic.Dictionary[string, System.Collections.Generic.Dictionary[string,int]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - } - - $MofAliasString = '$' + $ResourceName + ++$Script:NodeTypeRefCount[ (Get-PSCurrentConfigurationNode) ][$ResourceName] + 'ref' - $InstanceAliases = $Script:NodeInstanceAliases[ (Get-PSCurrentConfigurationNode) ] - } - else # Generate the MOF instance alias to use for the default (unnamed) node. - { - $MofAliasString = '$' + $ResourceName + ++$Script:NoNameNodeTypeRefCount[$ResourceName] + 'ref' - $InstanceAliases = $Script:NoNameNodeInstanceAliases - } - - # Start generating the MOF source text for this instance - $result = "instance of $ResourceName as $MofAliasString`n{`n" - - #special case psdesiredstateConfiguration module. Insert '0.0' as module if user hasn't explicilty asked for the version - if( $Properties.ContainsKey("ModuleName") -and ($Properties["ModuleName"] -ieq 'PsDesiredStateConfiguration')) - { - if(-not $Script:ExplicitlyImportedModules.ContainsKey('PsDesiredStateConfiguration')) - { - $script:ShowImportDscResourceWarning = $true - } - } - - # generate the property definitions - $oldOFS = $OFS - $OFS = ' ' - try - { - if ($Properties -and $Properties.Count) - { - $result += foreach ($p in $Properties.GetEnumerator()) - { - Write-Debug -Message " Generating property data for '$($p.Name)' = '$($p.Value)'" - - if ($p.Name -eq 'RefreshMode' -and $p.Value -eq 'PULL') - { - $script:MetaConfigSetToPull = $true - } - - if ($p.Name -eq 'DownloadManagerName') - { - $script:SpecifiedV1DownloadManagerName = $true - } - - $targetTypeName = $PropertyTypes[$p.Name].TypeConstraint - - # see if the target type is an array - $asArray = $p.Name -eq 'DependsOn' -or $targetTypeName -match 'Array' -or ((-not [string]::IsNullOrEmpty($targetTypeName)) -and $targetTypeName.EndsWith('[]')) - - # Convert the CIM typename to the appropriate .NET type to use - # to convert the input object into an appropriately encoded string - # using the PowerShell type conversion semantics. - switch -regex ($targetTypeName) - { - # unsigned integer types - '^sint[0-9]{1,2}' - { - $targetType = [int64] - break - } - # Single 16 bit character (note - this type is deprecated and removed in MOFv3 - '^char16' - { - $targetType = [char] - break - } - # signed integer types - '^uint[0-9]{0,2}' - { - $targetType = [uint64] - break - } - # reals - '^real32|^real64' - { - $targetType = [double] - break - } - # boolean - '^boolean' - { - $targetType = [bool] - } - # datetime - 'datetime' - { - $targetType = [datetime] - } - # everything else render directly as a string... - default - { - $targetType = [string] - } - } - - # - # If the scalar target types is a credential, then we need to encrypt the Password property value - # before generating the MOF text - # - if(($Type -match 'MSFT_Credential') -and $p.Name -match 'Password') - { - # For MSFT_Credential we'll have a password that may need to be encrypted depending - # on the availability of a key. This may need to change to the base class of MSFT_WindowCredential - # if we're using the class to refer to non-Windows machines where a Domain may be irrelevant. - - $p.Name + ' = ' + (stringify -value (Get-EncryptedPassword $p.Value) -asArray $asArray -targetType $targetType ) + ";`n" - } - else - { - #embeded instances cannot be null - if($p.Value -eq $null -and $PropertyTypes[$p.Name].TypeConstraint -eq 'Instance') - { - $errorMessage = $LocalizedData.ConvertValueToPropertyFailed -f @('$null', $Type, $p.Name, $ResourceName) - $errorMessage += Get-PositionInfo $Properties['SourceInfo'] - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidArgument -ErrorId FailToProcessProperty - Update-ConfigurationErrorCount - } - if($p.Value -is [PSCredential]) - { - [bool] $PSDscAllowPlainTextPassword = $false - [bool] $PSDscAllowDomainUser = $false - - $key = 'HKLM:\SOFTWARE\Microsoft\PowerShell\3\DSC' - $reg = Get-ItemProperty -path $key -name "PSDscAllowPlainTextPassword" -ea SilentlyContinue - - if ($reg -ne $null -and $reg.PSDscAllowPlainTextPassword -ne $null) - { - $PSDscAllowPlainTextPassword = ((Get-ItemProperty -Path $key -Name PSDscAllowPlainTextPassword).PSDscAllowPlainTextPassword -eq "True") - } - - $reg = Get-ItemProperty -path $key -name "PSDscAllowDomainUser" -ea SilentlyContinue - if ($reg -ne $null -and $reg.PSDscAllowDomainUser -ne $null) - { - $PSDscAllowDomainUser = ((Get-ItemProperty -Path $key -Name PSDscAllowDomainUser).PSDscAllowDomainUser -eq "True") - } - [bool] $PSDscDomainUser = IsDomainUser -username $p.Value.UserName - - if($Node -and $selectedNodesData) - { - if($selectedNodesData -is [array]) - { - foreach($target in $selectedNodesData) - { - if($target['NodeName'] -and $target['NodeName'] -eq $Node) - { - $currentNode = $target - } - } - } - else - { - $currentNode = $selectedNodesData - } - } - # where user need to specify properties for resources not in a node, - # they can do it through localhost nodeName in $allNodes - elseif($allnodes -and $allnodes.AllNodes) - { - foreach($target in $allnodes.AllNodes) - { - if($target['NodeName'] -and $target['NodeName'] -eq 'localhost') - { - $currentNode = $target - } - } - } - - if($currentNode) - { - # PSDscAllowDomainUser set to true would indicate that we want to allow - # domain credential. It takes precedence over PSDscAllowPlainTextPassword behavior - if($currentNode['PSDscAllowDomainUser']) - { - $PSDscAllowDomainUser = $currentNode['PSDscAllowDomainUser'] - } - if($PSDscDomainUser -and (-not $PSDscAllowDomainUser)) - { - if($Script:NodeUsingDomainCred -eq $null) - { - $Script:NodeUsingDomainCred = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,bool]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - } - $Script:NodeUsingDomainCred[$currentNode['NodeName']] = $true - } - # PSDscAllowPlainTextPassword set to true would indicate that we want to allow the - # automatic conversion of the encrypted password to plaintext if a certificate or - # certificate id is not specified. - # if a certid or cert file is specified, it taks precedence over PSDscAllowPlainTextPassword - if($currentNode['PSDscAllowPlainTextPassword']) - { - $PSDscAllowPlainTextPassword = $currentNode['PSDscAllowPlainTextPassword'] - } - - $certificateid = $currentNode['CertificateID'] - - if ( -not $certificateid) - { - # CertificateFile is the public key file - $certificatefile = $currentNode['CertificateFile'] - - if (( -not $certificatefile) -and (-not $PSDscAllowPlainTextPassword)) - { - $errorMessage = $($LocalizedData.EncryptedToPlaintextNotAllowed) - ThrowError -ExceptionName 'System.InvalidOperationException' -ExceptionMessage $errorMessage -ExceptionObject $p -ErrorId 'InvalidPathSpecified' -ErrorCategory InvalidOperation - } - } - - if($currentNode['NodeName'] -and ($certificatefile -or $certificateid)) - { - $Script:NodesPasswordEncrypted[$currentNode['NodeName']] = $true - } - - $p.Name + ' = ' + (stringify -value $p.Value -asArray $asArray -targetType $targetType ) + ";`n" - } - else - { - $errorMessage = $($LocalizedData.EncryptedToPlaintextNotAllowed) - ThrowError -ExceptionName 'System.InvalidOperationException' -ExceptionMessage $errorMessage -ExceptionObject $p -ErrorId 'InvalidPathSpecified' -ErrorCategory InvalidOperation - } - } - else - { - if ($targetTypeName -match 'StringArray') - { - $p.Name + ' = ' + (stringify -value $p.Value -asArray $asArray -targetType $targetType ) + ";`n" - } - elseif ($targetTypeName -notmatch 'Array' -or $p.Value.Count) - { - $p.Name + ' = ' + (stringify -value $p.Value -asArray $asArray -targetType $targetType ) + ";`n" - } - } - } - } - } - else - { - if ($Type -notmatch 'OMI_ConfigurationDocument') - { - $result += "// This instance definition of $Type had no properties`n" - } - Write-Debug -Message " ENCOUNTERED INSTANCE OF TYPE '$Type' WITH NO PROPERTIES" - } - } - catch - { - $errorMessage = $_.Exception.Message + (Get-PositionInfo $Properties['SourceInfo']) - $errorMessage = $LocalizedData.FailToProcessProperty -f @($_.Exception.GetType().FullName, $p.Name, $Type, $errorMessage) - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId FailToProcessProperty - Update-ConfigurationErrorCount - } - finally - { - $OFS = $oldOFS - } - - # - # Add extra information about Author, GenerationHost, GenerationDate and Name if they are not specified - # - if ($Type -match 'OMI_ConfigurationDocument' -and $Properties) - { - if (-not $Properties.ContainsKey('Author')) - { - $result += " Author = `"$([system.environment]::UserName)`";`n" - } - - if (-not $Properties.ContainsKey('GenerationDate')) - { - $result += " GenerationDate = `"$(Get-Date)`";`n" - } - - if (-not $Properties.ContainsKey('GenerationHost')) - { - $result += " GenerationHost = `"$([system.environment]::MachineName)`";`n" - } - - # todo: report error is configuration name does't match - if (-not $Properties.ContainsKey('Name')) - { - $result += " Name = `"$(Get-PSTopConfigurationName)`";`n" - } - } - - # - # Append the completed mof instance text to the overall document - # - $instanceText = "`n" + $result + "`n};`n" - - # - # Record and return the alias for that document - # - Write-Debug -Message " Added alias $MofAliasString to InstanceAliases array for node '$(Get-PSCurrentConfigurationNode)'" - - if ( Get-PSCurrentConfigurationNode ) - { - if($Script:NodeInstanceAliases[ (Get-PSCurrentConfigurationNode) ] -eq $null) - { - $Script:NodeInstanceAliases[ (Get-PSCurrentConfigurationNode) ] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - $Script:NodeResourceIdAliases[ (Get-PSCurrentConfigurationNode) ] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - } - - $Script:NodeInstanceAliases[ (Get-PSCurrentConfigurationNode) ][$MofAliasString] = $instanceText - - if($Properties.ContainsKey('ResourceID')) - { - $Script:NodeResourceIdAliases[ (Get-PSCurrentConfigurationNode) ][$Properties['ResourceID']] = $MofAliasString - } - } - else - { - $Script:NoNameNodeInstanceAliases[$MofAliasString] = $instanceText - - if($Properties.ContainsKey('ResourceID')) - { - $Script:NoNameNodeResourceIdAliases[$Properties['ResourceID']] = $MofAliasString - } - } - - # todo: we can check error for duplicated alias in a node and report it here - # because this can live acrose configurationelement calls - Write-Debug -Message " MOF GENERATION COMPLETED FOR $Type" - $MofAliasString -} - -# -# -# Returns the MOF text for the instance that -# corresponds to the aliasId -# -function Get-MofInstanceText -{ - param ( - [Parameter(Mandatory)] - [string] - $aliasId - ) - - if ( Get-PSCurrentConfigurationNode ) - { - $Script:NodeInstanceAliases[ (Get-PSCurrentConfigurationNode) ][$aliasId] - } - else - { - $Script:NoNameNodeInstanceAliases[$aliasId] - } -} - -# -# Get the position message based on the SourceMetadata -# -function Get-PositionInfo -{ - param( - [string] - $sourceMetadata - ) - - $positionMessage = '' - if ($sourceMetadata) - { - $positionMessage = "`nAt" - $infoItems = $sourceMetadata -split '::' - - # File name may be empty - if ($infoItems[0]) - { - $positionMessage += " $($infoItems[0]):$($infoItems[1])" - } - else - { - $positionMessage += " line:$($infoItems[1])" - } - - $positionMessage += " char:$($infoItems[2])" - $positionMessage += "`n+ $($infoItems[3])" - } - - $positionMessage -} - - -################################################################################### -# -# A function that implements the 'Node' keyword logic. The Node keyword accumulates -# the resource instances to define for a specific node or nodes. It's passed into the -# configuration statement using the ScriptBlock.InvokeWithContext() method -# -function Node -{ - [OutputType([void])] - param ( - [Parameter(Mandatory)] - $KeywordData, # Not used in this function.... - [string[]] - $Name, # the list of nodes to process in this call - [Parameter(Mandatory)] - [ScriptBlock] - $Value, # The scriptblock that generates the configuration in each node. - [Parameter(Mandatory)] - $sourceMetadata # Not used in this function - ) - - - if (-not $Name) - { - Write-Debug -Message 'The name parameter was empty, no nodes generated' - return - } - - Write-Debug -Message "*PROCESSING STARTED FOR NODE SET {$(@($Name) -join ',')} " - - # Save any global level resources and initialize for the resources defined for this node. - $Script:PSOuterConfigurationNodes.Push( (Get-PSCurrentConfigurationNode) ) - $OldNodeResources = $Script:NodeResources - $OldNodeKeys = $Script:NodeKeys - - try - { - $OuterNode = $Script:PSOuterConfigurationNodes.Peek() - if(( $OuterNode -eq [string]::Empty) -or - (($OuterNode -ne [string]::Empty) -and ($Name -contains $OuterNode))) - { - # - # Set up a map from node name to data - # - $nodeDataMap = @{} - - # - # Copy the AllNodes data into the map - # - - if($script:ConfigurationData) - { - $script:ConfigurationData.AllNodes | ForEach-Object -Process { - $nodeDataMap[$_.NodeName] = $_ - } - } - - # - # Create the SelectedNodes list for this Node statement - # - $selectedNodesData = foreach ($nn in $Name) - { - # If there is no data for this node, create a dummy node - # with at least the node name - if ( -not $nodeDataMap[$nn] ) - { - $nodeDataMap[$nn] = @{ - NodeName = $nn - } - } - $nodeDataMap[$nn] - } - - foreach ($Node in $Name) - { - if(($OuterNode -ne [string]::Empty) -and ($OuterNode -ne $Node)) - { - continue - } - - Set-PSCurrentConfigurationNode $Node - - if( $Script:NodesInThisConfiguration[$Node] ) - { - $Script:NodeResources = $Script:NodesInThisConfiguration[$Node] - } - else - { - $Script:NodesInThisConfiguration[$Node] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,[string[]]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - $Script:NodeResources = $Script:NodesInThisConfiguration[$Node] - } - - #this for tracking referenced configuration managers - if( $Script:NodesManagerInThisConfiguration[$Node] ) - { - $Script:NodeManager = $Script:NodesManagerInThisConfiguration[$Node] - } - else - { - $Script:NodesManagerInThisConfiguration[$Node] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - $Script:NodeManager = $Script:NodesManagerInThisConfiguration[$Node] - } - - #this for tracking exclusive resources - if( $Script:NodesExclusiveResourcesInThisConfiguration[$Node] ) - { - $Script:NodeExclusiveResources = $Script:NodesExclusiveResourcesInThisConfiguration[$Node] - } - else - { - $Script:NodesExclusiveResourcesInThisConfiguration[$Node] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - $Script:NodeExclusiveResources = $Script:NodesExclusiveResourcesInThisConfiguration[$Node] - } - - #this for tracking referenced Resource Module Source - if( $Script:NodesResourceSourceInThisConfiguration[$Node] ) - { - $Script:NodeResourceSource = $Script:NodesResourceSourceInThisConfiguration[$Node] - } - else - { - $Script:NodesResourceSourceInThisConfiguration[$Node] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - $Script:NodeResourceSource = $Script:NodesResourceSourceInThisConfiguration[$Node] - } - - if(-not $Script:NodeTypeRefCount[$Node]) - { - $Script:NodeTypeRefCount[$Node] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string, System.Collections.Generic.Dictionary[string,int]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - $Script:NodeInstanceAliases[$Node] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string, System.Collections.Generic.Dictionary[string,string]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - $Script:NodeResourceIdAliases[$Node] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string, System.Collections.Generic.Dictionary[string,string]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - } - - if(-not $script:NodesKeysInThisConfiguration[$Node]) - { - $script:NodesKeysInThisConfiguration[$Node] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.HashSet[string]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - } - $Script:NodeKeys = $script:NodesKeysInThisConfiguration[$Node] - - # - # Set up the context variable list. - # - $variablesToDefine = @( - New-Object -TypeName PSVariable -ArgumentList ('SelectedNodes', $selectedNodesData) - New-Object -TypeName PSVariable -ArgumentList ('Node', $nodeDataMap[$Node]) - New-Object -TypeName PSVariable -ArgumentList ('NodeName', $Node) - ) - - # Initialize dictionary to detect duplicate resources - if ($Script:DuplicateResources -eq $null) - { - $Script:DuplicateResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.Dictionary[string,System.Collections.Generic.List[System.Collections.Hashtable]]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - } - - if (-not $Script:DuplicateResources.ContainsKey($Name)) - { - $Script:DuplicateResources[$Name] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.List[System.Collections.Hashtable]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - } - - try - { - # Evaluate the node's business logic scriptblock - Write-Debug -Message "*$Node : NODE PROCESSING STARTED FOR THIS NODE." - $Value.InvokeWithContext($functionsToDefine, $variablesToDefine) - } - catch [System.Management.Automation.MethodInvocationException] - { - # Write the unwrapped exception message - $pscmdlet.CommandRuntime.WriteError((Get-InnerMostErrorRecord $_)) - Update-ConfigurationErrorCount - } - - # Display warning if domain credential is used in the configuration. - if($Script:NodeUsingDomainCred.ContainsKey($Node) -and $Script:NodeUsingDomainCred[$Node]) - { - $nameMessage = $LocalizedData.DomainCredentialNotAllowed -f @($Node, $Node) - $UserWarningPreference = $WarningPreference - if($ArgsToBody['WarningAction'] -ne $null) - { - $UserWarningPreference = $ArgsToBody['WarningAction'] - } - Write-Warning -Message $nameMessage -WarningAction $UserWarningPreference - } - - # Validate make sure all of the required resources are defined - # if so, add the DependsOn fields for all resources - ValidateNodeResources - # - # Fixup ModuleVersion - # - Update-ModuleVersion $Script:NodeResources $Script:NodeInstanceAliases[$Node] $Script:NodeResourceIdAliases[$Node] - - # Validate make sure all of the referenced download managers are defined - ValidateNodeManager - - # Validate make sure all of the referenced resource source are defined - ValidateNodeResourceSource - - # Validate make sure no conflict between exclusive resources - # also validate exclusive resource exist - ValidateNodeExclusiveResources - - # Validate make sure all of the required resources are defined - ValidateNoCircleInNodeResources - - Write-Debug -Message "*$Node : NODE PROCESSING COMPLETED FOR THIS NODE. configuration errors encountered so far: $(Get-ConfigurationErrorCount)" - } - } - else - { - $errorMessage = $LocalizedData.NestedNodeNotAllowed -f @(($Name -join ','), (Get-PSCurrentConfigurationNode), $Script:PSConfigurationName) - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId NestedNodeNotAllowed - Update-ConfigurationErrorCount - } - } - catch - { - $errorMessage = $_.Exception.Message + (Get-PositionInfo $sourceMetadata) - $errorMessage = $LocalizedData.FailToProcessNode -f @($Node, $errorMessage) - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId FailToProcessNode - Update-ConfigurationErrorCount - } - finally - { - Set-PSCurrentConfigurationNode ($Script:PSOuterConfigurationNodes.Pop()) - $Script:NodeResources = $OldNodeResources - $Script:NodeKeys = $OldNodeKeys - Write-Debug -Message "*NODE STATEMENT PROCESSING COMPLETED. Configuration errors encountered so far: $(Get-ConfigurationErrorCount)" - } -} - -# -# Utility used to track the number of errors encountered while processing the configuration -# -function Update-ConfigurationErrorCount -{ - [OutputType([void])] - param() - - $Script:PSConfigurationErrors++ -} - -function Get-ConfigurationErrorCount -{ - [OutputType([int])] - param() - - $Script:PSConfigurationErrors -} - -function Get-ComplexResourceQualifier -{ - [OutputType([string])] - param() - - # walk the call stack to get at all of the enclosing configuration resource IDs - $stackedConfigs = @(Get-PSCallStack | - where { ($_.InvocationInfo.MyCommand -ne $null) -and ($_.InvocationInfo.MyCommand.CommandType -eq 'Configuration') }) - - $complexResourceQualifier = $null - # keep all but the top-most - if(@($stackedConfigs).Length -ge 3) - { - $stackedConfigs = $stackedConfigs[1..(@($stackedConfigs).Length - 2)] - # and build the complex resource ID suffix. - $complexResourceQualifier = ( $stackedConfigs | foreach { '[' + $_.Command + ']' + $_.InvocationInfo.BoundParameters['InstanceName'] } ) -join '::' - } - - return $complexResourceQualifier - } - -# -# A function to set the document text for default (unnamed) node -# -function Set-PSDefaultConfigurationDocument -{ - [OutputType([void])] - param ( - [Parameter()] - [string] - $documentText = '' - ) - - $Script:PSDefaultConfigurationDocument = $documentText -} - -# -# Get the text associated with the default (unnamed) node. -# -function Get-PSDefaultConfigurationDocument -{ - [OutputType([string])] - param() - - return $Script:PSDefaultConfigurationDocument -} - -################################################## -# -# Returns the name of the configuration currently being configured -# -function Get-PSTopConfigurationName -{ - [OutputType([string])] - param() - - return $Script:PSTopConfigurationName -} - -function Set-PSTopConfigurationName -{ - [OutputType([void])] - param ( - [Parameter()] - [string] - $Name - ) - - $Script:PSTopConfigurationName = $Name -} - -################################################## -# -# Returns the name of the node currently being configured -# -function Get-PSCurrentConfigurationNode -{ - [OutputType([string])] - param() - - return $Script:PSCurrentConfigurationNode -} - -function Set-PSCurrentConfigurationNode -{ - [OutputType([void])] - param ( - [Parameter()] - [string] - $nodeName - ) - - $Script:PSCurrentConfigurationNode = $nodeName -} - -################################################# - -function Set-NodeResources -{ - [OutputType([void])] - param ( - [Parameter(Mandatory)] - [string] - $resourceId, - [Parameter(Mandatory)] - [AllowNull()] - [AllowEmptyCollection()] - [string[]] - $requiredResourceList - ) - - if ($Script:NodeResources -eq $null) - { - $Script:NodeResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,[string[]]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - } - $Script:NodeResources[$resourceId] = $requiredResourceList -} - -function Test-NodeResources -{ - [OutputType([bool])] - param ( - [Parameter(Mandatory)] - - [string] - $resourceId - ) - - if ( -not $Script:NodeResources) - { - $false - } - else - { - $Script:NodeResources.ContainsKey($resourceId) - } -} - -# -# update a mapping of a partial configuration resource and the managers it referenced -# -function Set-NodeManager -{ - [OutputType([void])] - param ( - [Parameter(Mandatory)] - [string] - $resourceId, - [Parameter(Mandatory)] - [AllowNull()] - [string[]] - $referencedManagers - ) - - if ($Script:NodeManager -eq $null) - { - $Script:NodeManager = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - } - $Script:NodeManager[$resourceId] = $referencedManagers -} - -# -# -# -function Test-NodeManager -{ - [OutputType([bool])] - param ( - [Parameter(Mandatory)] - - [string] - $resourceId - ) - - if ( -not $Script:NodeManager) - { - $false - } - else - { - $Script:NodeManager.ContainsKey($resourceId) - } -} - -# -# update a mapping of a partial configuration resource and the managers it referenced -# -function Set-NodeResourceSource -{ - [OutputType([void])] - param ( - [Parameter(Mandatory)] - [string] - $resourceId, - [Parameter(Mandatory)] - [AllowNull()] - [string[]] - $referencedResourceSources - ) - - if ($Script:NodeResourceSource -eq $null) - { - $Script:NodeResourceSource = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - } - $Script:NodeResourceSource[$resourceId] = $referencedResourceSources -} - -# -# -# -function Test-NodeResourceSource -{ - [OutputType([bool])] - param ( - [Parameter(Mandatory)] - - [string] - $resourceId - ) - - if ( -not $Script:NodeResourceSource) - { - $false - } - else - { - $Script:NodeResourceSource.ContainsKey($resourceId) - } -} - -# -# update a mapping of a partial configuration resource and the managers it referenced -# resource format can be moduleName\* moduleName\resourceName and resourceName -# this is validated during mof generation/cananic stage -# -function Set-NodeExclusiveResources -{ - [OutputType([string[]])] - param ( - [Parameter(Mandatory)] - [string] - $resourceId, - [Parameter(Mandatory)] - [AllowNull()] - [string[]] - $exclusiveResource - ) - - $Script:NodeExclusiveResources[$resourceId] = $exclusiveResource - return $exclusiveResource -} - - -function Add-NodeKeys -{ - [OutputType([void])] - param ( - [Parameter(Mandatory)] - [string] - $ResourceKey, - [parameter(Mandatory)] - [string] - $keywordName - ) - - if ($Script:NodeKeys -eq $null) - { - $Script:NodeKeys = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.HashSet[string]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - } - - if( -not $Script:NodeKeys.ContainsKey($keywordName)) - { - $Script:NodeKeys[$keywordName] = New-Object -TypeName 'System.Collections.Generic.HashSet[string]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - } - - if(-not $Script:NodeKeys[$keywordName].Contains($ResourceKey)) - { - $null = $Script:NodeKeys[$keywordName].Add($ResourceKey) - } - -} - -########################################################### -# -# A function to verify there's no duplicate conflicting resources in the configuration -# -# Conflict detecting algorithm works by going through all previuosly visited resources of same type and checking whether previously visited -# resource contains any properties which currently analyzed resource does not have or whether -# they have same properties but with different values. If that's the case, we mark that either key or non-key properties don't match. -# After that we check whether currently analyzed resource contains properties which the previously analyzed resource did not have at all. If that's the case we mark that -# non-key properties don't match (since all key properties were covered in the first phase). -# -# Once we processed all previous resources, we return error about duplicate conflicting resources if and only if key properties match and non key properties don't match. -# -########################################################### -function Test-ConflictingResources -{ - [OutputType([void])] - param ( - [string] - $keyword, - [parameter(Mandatory)] - [Hashtable] - $properties, - [Parameter(Mandatory)] - $keywordData - ) - $resourceID = $properties['ResourceID'] - $sourceInfo = $properties['SourceInfo'] - - $nonConflictingKeywords = @("PartialConfiguration", "WaitForAny", "WaitForSome", "WaitForAll") - if ($keyword -in $nonConflictingKeywords) - { - return - } - - # Get name of the current node - $currentNodeName = Get-PSCurrentConfigurationNode - if (-not $currentNodeName) - { - $currentNodeName = 'localhost' - } - - # Initialize $Script:DuplicateResources if not already initialized - if ($Script:DuplicateResources -eq $null) - { - $Script:DuplicateResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.Dictionary[string,System.Collections.Generic.List[System.Collections.Hashtable]]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - } - - if (-not $Script:DuplicateResources.ContainsKey($currentNodeName)) - { - $Script:DuplicateResources[$currentNodeName] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.List[System.Collections.Hashtable]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - } - - if ( -not $Script:DuplicateResources[$currentNodeName].ContainsKey($keyword)) - { - $Script:DuplicateResources[$currentNodeName][$keyword] = New-Object 'System.Collections.Generic.List[System.Collections.Hashtable]' - } - - # Find if current resource is duplicate and conflicting. - foreach($resource in $Script:DuplicateResources[$currentNodeName][$keyword]) - { - $keyPropertiesMatch = $true - $nonKeyPropertiesMatch = $true - $unmatchedNonKeyPropertiesNames = "" - $unmatchedNonKeyPropertiesCurrentValues = "" - $unmatchedNonKeyPropertiesPreviousValues = "" - - # For every property in previously analyzed resource - foreach($property in $resource.Keys) - { - $nonConflictingProperties = @("DependsOn", "ResourceID", "SourceInfo", "ModuleVersion") - if ($property -in $nonConflictingProperties) - { - continue - } - - # If currently analyzed resource does not have the property - if ( -not $properties.ContainsKey($property)) - { - $nonKeyPropertiesMatch = $false - $unmatchedNonKeyPropertiesNames += $property.ToString() + ';' - # Calling ToString() explicitly so that the value is not converted to Boolean/Integer - if ($resource[$property]) - { - $unmatchedNonKeyPropertiesPreviousValues += $resource[$property].ToString() + ';' - } - else - { - $unmatchedNonKeyPropertiesPreviousValues = $unmatchedNonKeyPropertiesPreviousValues.ToString() + 'NULL;' - } - $unmatchedNonKeyPropertiesCurrentValues = $unmatchedNonKeyPropertiesCurrentValues.ToString() + 'NULL;' - } - # If currently analyzed resource has property, but with different value - elseif ( $resource[$property] -ne $properties[$property] ) - { - # If it's a key property - if ($keywordData.Properties[$property].IsKey) - { - $keyPropertiesMatch = $false - break - } - # If it's a non-key property - else - { - $nonKeyPropertiesMatch = $false - $unmatchedNonKeyPropertiesNames += $property.ToString() + ';' - if ($resource[$property]) - { - $unmatchedNonKeyPropertiesPreviousValues += $resource[$property].ToString() + ';' - } - else - { - $unmatchedNonKeyPropertiesPreviousValues = $unmatchedNonKeyPropertiesPreviousValues.ToString() + 'NULL;' - } - - if ($properties[$property]) - { - $unmatchedNonKeyPropertiesCurrentValues += $properties[$property].ToString() + ';' - } - else - { - $unmatchedNonKeyPropertiesCurrentValues = $unmatchedNonKeyPropertiesCurrentValues.ToString() + 'NULL;' - } - } - } - } - - if ($keyPropertiesMatch) - { - foreach($property in $properties.Keys) - { - # If previously analyzed resource does not have property - if ((-not $resource.containsKey($property)) -and ($property -ne "ModuleVersion")) - { - $nonKeyPropertiesMatch = $false - $unmatchedNonKeyPropertiesNames += $property.ToString() + ';' - $unmatchedNonKeyPropertiesPreviousValues = $unmatchedNonKeyPropertiesPreviousValues.ToString() + 'NULL;' - if ($properties[$property]) - { - $unmatchedNonKeyPropertiesCurrentValues += $properties[$property].ToString() + ';' - } - else - { - $unmatchedNonKeyPropertiesCurrentValues = $unmatchedNonKeyPropertiesCurrentValues.ToString() + 'NULL;' - } - } - } - } - - # If resource is duplicate and conflicting we should return error - if ($keyPropertiesMatch -and (-not $nonKeyPropertiesMatch)) - { - $unmatchedNonKeyPropertiesNames = $unmatchedNonKeyPropertiesNames.Substring(0, $unmatchedNonKeyPropertiesNames.Length-1) - $unmatchedNonKeyPropertiesPreviousValues = $unmatchedNonKeyPropertiesPreviousValues.Substring(0, $unmatchedNonKeyPropertiesPreviousValues.Length-1) - $unmatchedNonKeyPropertiesCurrentValues = $unmatchedNonKeyPropertiesCurrentValues.Substring(0, $unmatchedNonKeyPropertiesCurrentValues.Length-1) - - $previousResourceIdentifier = $resource["ResourceID"] + " (" + $resource["SourceInfo"] + ")" - $currentResourceIdentifier = $resourceID + " (" + $sourceInfo + ")" - $errorMessage = $LocalizedData.ConflictingDuplicateResource -f @($previousResourceIdentifier, $currentResourceIdentifier, $currentNodeName, $unmatchedNonKeyPropertiesNames, $unmatchedNonKeyPropertiesPreviousValues, $unmatchedNonKeyPropertiesCurrentValues) - $exception = New-Object System.InvalidOperationException $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ConflictingDuplicateResource - Update-ConfigurationErrorCount - } - } - - $Script:DuplicateResources[$currentNodeName][$keyword].Add($properties) - -} - -################################################# -# -# A function to get the innermost error record. -# -function Get-InnerMostErrorRecord -{ - param ( - [Parameter(Mandatory)] - [System.Management.Automation.ErrorRecord] - $ErrorRecord - ) - - $exception = $ErrorRecord.Exception - while ($exception.InnerException -and $exception.InnerException.ErrorRecord) - { - $exception = $exception.InnerException - $ErrorRecord = $exception.ErrorRecord - } - $ErrorRecord -} - -########################################################### -# -# A function to set up all of the module-scoped state variables. -# -function Initialize-ConfigurationRuntimeState -{ - param ( - [Parameter()] - [string] - $ConfigurationName = '' - ) - - # The overall name of the configuration being processed - [string] $Script:PSConfigurationName = $ConfigurationName - - # The ModuleVersion used for PsDesiredStateConfiguration module. - [string] $Script:PsDscModuleVersion = "0.0" - - # The compatibility version for the document.. - [string] $Script:PsDscCompatibleVersion = "1.0.0" - - # The list of modules explicitly imported using import-dscresorce - $Script:ExplicitlyImportedModules = New-Object -TypeName 'System.Collections.Generic.Dictionary[String,String]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For the current configuration, this contains the name of the node currently being processed - [string] $Script:PSCurrentConfigurationNode = '' - - # For the current node, this contains a map of resource instance to resource prerequisites (DependsOn resources). - [System.Collections.Generic.Dictionary[string,string[]]] ` - $Script:NodeResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,[string[]]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For the current node, this contains a map of partial configuration instance to configuration managers. - [System.Collections.Generic.Dictionary[string,string]] ` - $Script:NodeManager = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For the current node, this contains a map of partial configuration instance to Resource Source. - [System.Collections.Generic.Dictionary[string,string]] ` - $Script:NodeResourceSource = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For the current node, this contains a map of partial configuration instance to its exclusive resources. - [System.Collections.Generic.Dictionary[string,string[]]] ` - $Script:NodeExclusiveResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For all nodes except the unnamed node, this contains the per-node per-type reference counter used to generate the CIM aliases for each instance - [System.Collections.Generic.Dictionary[string, System.Collections.Generic.Dictionary[string,int]]] ` - $Script:NodeTypeRefCount = New-Object -TypeName 'System.Collections.Generic.Dictionary[string, System.Collections.Generic.Dictionary[string,int]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For all nodes except the unnamed node, this maps the node name to the node's table of alias to mof text mappings. - [System.Collections.Generic.Dictionary[string,System.Collections.Generic.Dictionary[string,string]]] ` - $Script:NodeInstanceAliases = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.Dictionary[string,string]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For all nodes except the unnamed node, this maps the node name to the node's table of resourceID to mof text mappings. - [System.Collections.Generic.Dictionary[string,System.Collections.Generic.Dictionary[string,string]]] ` - $Script:NodeResourceIdAliases = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.Dictionary[string,string]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For all nodes except the unnamed node, this maps the node name to the node's map of resource instance to resource prerequisites - [System.Collections.Generic.Dictionary[string,object]] ` - $Script:NodesInThisConfiguration = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,object]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For all nodes except the unnamed node, this maps the node name to the node's map of partial configuration resource instance to reference resource source. - [System.Collections.Generic.Dictionary[string,object]] ` - $Script:NodesResourceSourceInThisConfiguration = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,object]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For all nodes except the unnamed node, this maps the node name to the node's map of partial configuration resource instance to reference configuraiton manager. - [System.Collections.Generic.Dictionary[string,object]] ` - $Script:NodesManagerInThisConfiguration = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,object]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For all nodes except the unnamed node, this maps the node name to the node's map of resource instance to exclusive resource - [System.Collections.Generic.Dictionary[string,object]] ` - $Script:NodesExclusiveResourcesInThisConfiguration = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,object]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For the unnamed (default) node, this contains a map of resource instance to resource prerequisites (required resources). - [System.Collections.Generic.Dictionary[String,String[]]] ` - $Script:NoNameNodesResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[String,String[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For the unnamed (default) node, this contains a map of partial configuration resource instance to reference configuration manager. - [System.Collections.Generic.Dictionary[String,String]] ` - $Script:NoNameNodeManager = New-Object -TypeName 'System.Collections.Generic.Dictionary[String,String[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For the unnamed (default) node, this contains a map of partial configuration resource instance to reference resource source. - [System.Collections.Generic.Dictionary[String,String]] ` - $Script:NoNameNodeResourceSource = New-Object -TypeName 'System.Collections.Generic.Dictionary[String,String[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For the unnamed (default) node, this contains a map of partial configuration resource instance to its exclusive resources. - [System.Collections.Generic.Dictionary[String,String[]]] ` - $Script:NoNameNodeExclusiveResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[String,String[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For the unnamed (default) node, this contains the per-node per-type reference counter used to generate the CIM aliases for each instance - [System.Collections.Generic.Dictionary[String,int]] ` - $Script:NoNameNodeTypeRefCount = New-Object -TypeName 'System.Collections.Generic.Dictionary[String,int]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For the unnamed (default) node, this maps the node name to the node's table of alias to mof text mappings. - # Alias to mof text mapping for the unnamed node. - [System.Collections.Generic.Dictionary[string,string]] ` - $Script:NoNameNodeInstanceAliases = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For the unnamed (default) node, this maps the node name to the node's table of resourceId to mof text mappings. - # Alias to mof text mapping for the unnamed node. - [System.Collections.Generic.Dictionary[string,string]] ` - $Script:NoNameNodeResourceIdAliases = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - #dictionary to save whether a node has encrypted password - [System.Collections.Generic.Dictionary[string,bool]] ` - $Script:NodesPasswordEncrypted = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,bool]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For all nodes, contain information about node using domain credential or not - [System.Collections.Generic.Dictionary[string,bool]] ` - $Script:NodeUsingDomainCred = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,bool]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - [System.Collections.Generic.Stack[String]] $Script:PSOuterConfigurationNodes = New-Object -TypeName 'System.Collections.Generic.Stack[String]' - - # The number of errors that have occurred while processing this configuration. - [int] $Script:PSConfigurationErrors = 0 - - # Set up a variable to hold a top-level OMI_ConfigurationDocument value - # which will be used by all nodes if it's present. - [string] $Script:PSDefaultConfigurationDocument = '' - - - # Set up a hastable to hold user specified info for OMI_ConfigurationDocument value for meta config - # we will need update it last after processing meta config to figure out what V2 property it uses - [hashtable] $script:PSMetaConfigDocumentInstVersionInfo = @{} - - [bool] $Script:PSMetaConfigDocInsProcessedBeforeMeta = $false - [bool] $script:PSMetaConfigurationProcessed = $false - - # For all nodes except the unnamed node, this maps the node name to the node's map of keys of resources. - [System.Collections.Generic.Dictionary[string,object]] ` - $script:NodesKeysInThisConfiguration = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,object]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For the current node, this contains keys of resource instances. - [System.Collections.Generic.Dictionary[string,System.Collections.Generic.HashSet[string]]] ` - $Script:NodeKeys = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.HashSet[string]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For the unnamed (default) node, this contains keys of resource instances. - [System.Collections.Generic.Dictionary[String,System.Collections.Generic.HashSet[string]]] ` - $Script:NoNameNodeKeys = New-Object -TypeName 'System.Collections.Generic.Dictionary[String,System.Collections.Generic.HashSet[string]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # For the current configuration, $Script:DuplicateResources["Type"] contains list with properties of all resources of the specific type - [System.Collections.Generic.Dictionary[string,System.Collections.Generic.Dictionary[string,System.Collections.Generic.List[System.Collections.Hashtable]]]] ` - $Script:DuplicateResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.Dictionary[string,System.Collections.Generic.List[System.Collections.Hashtable]]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - - # Show Import-DscResource warning if in-build resources are used in the Configuration without Import-DscResource statement. - [bool] $script:ShowImportDscResourceWarning = $false - - # For testing whether setting meta configuration into PULL mode without appropriate configuration manager - [bool] $script:MetaConfigSetToPull = $false - [bool] $script:SpecifiedV1DownloadManagerName = $false - [bool] $script:SpecifiedV2DownloadManager = $false -} - -# -# Then call it to enact the default state. This happens -# only once during the module load. Thereafter the -# configuration function is responsible for resetting state. -# -Initialize-ConfigurationRuntimeState - -# make sure configuration data format: -# 1. Is a hashtable -# 2. Has a collection AllNodes -# 3. Allnodes is an collection of Hashtable -# 4. Each element of Allnodes has NodeName -# 5. We will copy values from NodeName="*" to all node if they don't exist -function ValidateUpdate-ConfigurationData -{ - param ( - [Parameter()] - [hashtable] - $ConfigurationData - ) - - if( -not $ConfigurationData.ContainsKey('AllNodes')) - { - $errorMessage = $LocalizedData.ConfiguratonDataNeedAllNodes - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ConfiguratonDataNeedAllNodes - return $false - } - - if($ConfigurationData.AllNodes -isnot [array]) - { - $errorMessage = $LocalizedData.ConfiguratonDataAllNodesNeedHashtable - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ConfiguratonDataAllNodesNeedHashtable - return $false - } - - $nodeNames = New-Object -TypeName 'System.Collections.Generic.HashSet[string]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - foreach($Node in $ConfigurationData.AllNodes) - { - if($Node -isnot [hashtable] -or -not $Node.NodeName) - { - $errorMessage = $LocalizedData.AllNodeNeedToBeHashtable - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ConfiguratonDataAllNodesNeedHashtable - return $false - } - - if($nodeNames.Contains($Node.NodeName)) - { - $errorMessage = $LocalizedData.DuplicatedNodeInConfigurationData -f $Node.NodeName - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId DuplicatedNodeInConfigurationData - return $false - } - - if($Node.NodeName -eq '*') - { - $AllNodeSettings = $Node - } - [void] $nodeNames.Add($Node.NodeName) - } - - if($AllNodeSettings) - { - foreach($Node in $ConfigurationData.AllNodes) - { - if($Node.NodeName -ne '*') - { - foreach($nodeKey in $AllNodeSettings.Keys) - { - if(-not $Node.ContainsKey($nodeKey)) - { - $Node.Add($nodeKey, $AllNodeSettings[$nodeKey]) - } - } - } - } - - $ConfigurationData.AllNodes = @($ConfigurationData.AllNodes | Where-Object -FilterScript { - $_.NodeName -ne '*' - } - ) - } - - return $true -} - -############################################################## -# -# Checks to see if a module defining composite resources should be reloaded -# based the last write time of the schema file. Returns true if the file exists -# and the last modified time was either not recorded or has change. -# -function Test-ModuleReloadRequired -{ - [OutputType([bool])] - param ( - [Parameter(Mandatory)] - [string] - $SchemaFilePath - ) - - if (-not $SchemaFilePath -or $SchemaFilePath -notmatch '\.schema\.psm1$') - { - # not a composite res - return $false - } - - # If the path doesn't exist, then we can't reload it. - # Note: this condition is explicitly not an error for this function. - if ( -not (Test-Path $SchemaFilePath)) - { - if ($schemaFileLastUpdate.ContainsKey($SchemaFilePath)) - { - $schemaFileLastUpdate.Remove($SchemaFilePath) - } - return $false - } - - # If we have a modified date, then return it. - if ($schemaFileLastUpdate.ContainsKey($SchemaFilePath)) - { - if ( (Get-Item $SchemaFilePath).LastWriteTime -eq $schemaFileLastUpdate[$SchemaFilePath] ) - { - return $false - } - else - { - return $true - } - } - - # Otherwise, record the last write time and return true. - $script:schemaFileLastUpdate[$SchemaFilePath] = (Get-Item $SchemaFilePath).LastWriteTime - $true -} -# Holds the schema file to lastwritetime mapping. -[System.Collections.Generic.Dictionary[string,DateTime]] $script:schemaFileLastUpdate = -New-Object -TypeName 'System.Collections.Generic.Dictionary[string,datetime]' - -########################################################### -# Configuration keyword implementation -########################################################### -# -# Implements the 'configuration' keyword logic that accumulates and writes -# out the generated DSC MOF files -# -function Configuration -{ - [CmdletBinding(HelpUri = 'https://go.microsoft.com/fwlink/?LinkId=517195')] - param ( - # there are extra [] around Tuple arguments - [System.Collections.Generic.List[System.Tuple[[string[]], [Microsoft.PowerShell.Commands.ModuleSpecification[]], [Version]]]] - $ResourceModuleTuplesToImport, - $OutputPath = '.', - $Name, - [scriptblock] - $Body, - [hashtable] - $ArgsToBody, - [hashtable] - $ConfigurationData = @{ - AllNodes = @() - }, - [string] - $InstanceName = '' - ) - - - function ConvertModuleDefnitionToModuleInfo - { - param( - [Microsoft.PowerShell.Commands.ModuleSpecification[]]$moduleToImport, - [Version]$moduleVersion = $null - ) - - if (-not $moduleToImport) { - return $null - } - - $moduleToImport | % { - $versionToUse = $_.Version - if( [string]::IsNullOrEmpty($versionToUse)) - { - $versionToUse = $_.RequiredVersion - } - $Script:ExplicitlyImportedModules[ $_.Name ] = $versionToUse - } - $moduleInfos = Get-Module -ListAvailable -FullyQualifiedName $moduleToImport | sort -Property Version -Descending - - # Import-DscResource matches exact version of the module if ‘ModuleVersion’ is specified. - # This is intentional, ModuleVersion keyword doesn’t refer to the latest version in Import-DscResource. - # Find the module that matches specified version. - $modules = New-Object -TypeName System.Collections.ObjectModel.Collection[System.Management.Automation.PSModuleInfo] - if (($moduleInfos.Count -gt 0) -and ($moduleToImport.Version -or $moduleToImport.Guid)) - { - foreach ($moduleInfo in $moduleInfos) - { - if (($moduleToImport.Guid -and $moduleToImport.Guid.Equals($moduleInfo.Guid.ToString())) -or - ($moduleToImport.Version -and $moduleToImport.Version.Equals($moduleInfo.Version))) - { - $modules.Add($moduleInfo) - break - } - } - } - elseif ($moduleInfos.Count -eq 1) - { - $modules.Add($moduleInfos) - } - - return $modules - } - - try - { - Write-Debug -Message "BEGIN CONFIGURATION '$Name' PROCESSING: OutputPath: '$OutputPath'" - - if ($Name -inotmatch '^[a-z][a-z0-9_./-]*$') - { - $errorId = 'InvalidConfigurationName' - $errorMessage = $($LocalizedData.InvalidConfigurationName) -f ${Name} - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId $errorId - } - - $script:IsMetaConfig = $false - foreach($attri in $Body.Attributes) - { - if ($attri.GetType() -eq [System.Management.Automation.DscLocalConfigurationManagerAttribute]) - { - $script:IsMetaConfig = $true - $Script:PSMetaConfigDocInsProcessedBeforeMeta = $false - $script:PSMetaConfigurationProcessed = $false - break - } - } - - # True if this is the top-most level of the configuration statement. - # - [bool] $topLevel = $false - - if ($Script:PSConfigurationName -eq '') - { - Write-Debug -Message " $Name : TOP-LEVEL CONFIGURATION STARTED" - $topLevel = $true - Set-PSTopConfigurationName $Name - # - # Define a dictionary to hold the "driver" functions that will be created for each CIM class/keyword. - # This dictionary is passed into the body scriptblock, defining these functions in the body scope - # which simplifies cleanup. - # - $script:functionsToDefine = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,ScriptBlock]'([System.StringComparer]::OrdinalIgnoreCase) - - if($ConfigurationData -eq $null) - { - $ConfigurationData = @{ - AllNodes = @() - } - } - - $dataValidated = ValidateUpdate-ConfigurationData $ConfigurationData - - if (-not $dataValidated) - { - Update-ConfigurationErrorCount - Write-Debug -Message 'ConfigurationData validation failed' - return - } - else - { - $script:ConfigurationData = $ConfigurationData - } - - if($OutputPath -eq '.' -or $OutputPath -eq $null -or $OutputPath -eq '') - { - $OutputPath = ".\$Name" - } - # Load the default CIM keyword/function definitions set, populating the function collection - # with the default functions. - [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::LoadDefaultCimKeywords($functionsToDefine) - - # Set up the rest of the configuration runtime state. - Initialize-ConfigurationRuntimeState $Name - - # Create the output directory only if it does not exist. - # If it exists then the document MOF files will overwrite - # any existing MOF files with the same name but otherwise - # leave contents of existing directory alone. - $ConfigurationOutputDirectory = "$OutputPath" - if (!(Test-Path $ConfigurationOutputDirectory)) - { - $mkdirError = $null - mkdir -ErrorVariable mkdirError -Force $ConfigurationOutputDirectory > $null 2> $null - if (! $?) - { - Update-ConfigurationErrorCount - } - - if ($mkdirError) - { - $errorId = 'InvalidOutputPath' - $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidOperation - $errorMessage = $($LocalizedData.CannotCreateOutputPath) -f ${ConfigurationOutputDirectory} - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - $ErrorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord -ArgumentList $exception, $errorId, $errorCategory, $null - Write-Error $ErrorRecord - foreach ($e in $mkdirError) - { - Write-Error -Exception $e.Exception - Update-ConfigurationErrorCount - } - } - } - - # - # Add the utility functions used by the resource implementation functions. - # - $functionsToDefine.Add('Get-MofInstanceText', ${function:Get-MofInstanceText} ) - $functionsToDefine.Add('ConvertTo-MOFInstance', ${function:ConvertTo-MOFInstance} ) - $functionsToDefine.Add('Update-ConfigurationErrorCount', ${function:Update-ConfigurationErrorCount} ) - $functionsToDefine.Add('Get-ConfigurationErrorCount', ${function:Get-ConfigurationErrorCount} ) - $functionsToDefine.Add('Set-PSDefaultConfigurationDocument', ${function:Set-PSDefaultConfigurationDocument} ) - $functionsToDefine.Add('Get-PSDefaultConfigurationDocument', ${function:Get-PSDefaultConfigurationDocument} ) - $functionsToDefine.Add('Get-PSCurrentConfigurationNode', ${function:Get-PSCurrentConfigurationNode} ) - $functionsToDefine.Add('Set-NodeResources', ${function:Set-NodeResources} ) - $functionsToDefine.Add('Test-NodeResources', ${function:Test-NodeResources} ) - $functionsToDefine.Add('Set-NodeManager', ${function:Set-NodeManager} ) - $functionsToDefine.Add('Test-NodeManager', ${function:Test-NodeManager} ) - $functionsToDefine.Add('Set-NodeResourceSource', ${function:Set-NodeResourceSource} ) - $functionsToDefine.Add('Test-NodeResourceSource', ${function:Test-NodeResourceSource} ) - $functionsToDefine.Add('Set-NodeExclusiveResources', ${function:Set-NodeExclusiveResources} ) - $functionsToDefine.Add('Add-NodeKeys', ${function:Add-NodeKeys} ) - $functionsToDefine.Add('Test-ConflictingResources', ${function:Test-ConflictingResources} ) - $functionsToDefine.Add('Set-PSMetaConfigDocInsProcessedBeforeMeta', ${function:Set-PSMetaConfigDocInsProcessedBeforeMeta} ) - $functionsToDefine.Add('Get-PSMetaConfigDocumentInstVersionInfo', ${function:Get-PSMetaConfigDocumentInstVersionInfo} ) - $functionsToDefine.Add('Get-PSMetaConfigurationProcessed', ${function:Get-PSMetaConfigurationProcessed} ) - $functionsToDefine.Add('Set-PSMetaConfigVersionInfoV2', ${function:Set-PSMetaConfigVersionInfoV2}) - - # - # Add the node keyword implementation function which must be module qualified even though - # it's not exported from the module because the parsing logic always adds the module name - # to the command call. - # - $functionsToDefine.Add('PSDesiredStateConfiguration\node', ${function:Node}) - - Write-Debug -Message " $Name : $($functionsToDefine.Count) type handler functions loaded." - Write-Debug -Message " $Name TOP-LEVEL INITIALIZATION COMPLETED" - } - else - { - Write-Debug -Message " $Name : NESTED CONFIGURATION STARTED" - $oldFunctionsToDefine = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,ScriptBlock]' - } - - # - # Load all of the required resource definition modules - # - - foreach ($tuple in $ResourceModuleTuplesToImport) - { - $res = $tuple.Item1 - $modulesInfo = ConvertModuleDefnitionToModuleInfo -moduleToImport $tuple.Item2 -moduleVersion $tuple.Item3 - - if ($modulesInfo.Count -eq 0) { - # Module name is not specified. Try to load resource from all available modules. - $modulesInfo = Get-Module -ListAvailable - } - - foreach ($mod in $modulesInfo) { - - $resourcesFound = ImportClassResourcesFromModule -Module $mod -Resources $res -functionsToDefine $functionsToDefine - $dscResourcesPath = Join-Path -Path $mod.ModuleBase -ChildPath 'DSCResources' - if(Test-Path $dscResourcesPath) - { - foreach($requiredResource in $res) - { - if ($requiredResource.Contains('*')) { - # we historically resolve wildcards by Get-Item File System rules. - # We don't support wildcards resolutions for Friendly names. - foreach ($resource in Get-ChildItem -Path $dscResourcesPath -Directory -Name -Filter $requiredResource) - { - $foundResource = ImportCimAndScriptKeywordsFromModule -Module $mod -Resource $resource -functionsToDefine $functionsToDefine - } - } else { - # ImportCimAndScriptKeywordsFromModule takes care about resolving $requiredResources names to ClassNames or FriendlyNames. - $foundResource = ImportCimAndScriptKeywordsFromModule -Module $mod -Resource $requiredResource -functionsToDefine $functionsToDefine - } - } - } - elseif ($moduleInfos.Count -eq 1) - { - $modules.Add($moduleInfos) - } - } - } - - if (-not (Get-PSCurrentConfigurationNode)) - { - # A dictionary maps a resourceId to its list of required resources list for any resources - # defined outside of a node statement - $Script:NodeResources = $Script:NoNameNodesResources - $Script:NodeKeys = $Script:NoNameNodeKeys - [System.Collections.Generic.Dictionary[string,string[]]] $OldNodeResources = - New-Object -TypeName 'System.Collections.Generic.Dictionary[string,[string[]]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - $Script:NodeManager = $Script:NoNameNodeManager - $Script:NodeExclusiveResources = $Script:NoNameNodeExclusiveResources - $Script:NodeResourceSource = $Script:NoNameNodeResourceSource - - } - else - { - $Script:NodeResources = $Script:NodesInThisConfiguration[(Get-PSCurrentConfigurationNode)] - $Script:NodeManager = $Script:NodesManagerInThisConfiguration[(Get-PSCurrentConfigurationNode)] - $Script:NodeResourceSource = $Script:NodesResourceSourceInThisConfiguration[(Get-PSCurrentConfigurationNode)] - $Script:NodeExclusiveResources = $Script:NodesExclusiveResourcesInThisConfiguration[(Get-PSCurrentConfigurationNode)] - } - - # - # Evaluate the configuration statement body which will generate the resource definitons - # for this configuration. - # - Write-Debug -Message " $Name : Evaluating configuration statement body..." - try - { - $variablesToDefine = @( - # - # Figure out the "type" of this resource, with is the name of the driver function that was called. - # - New-Object -TypeName PSVariable -ArgumentList ('ConfigurationData', $script:ConfigurationData ) - New-Object -TypeName PSVariable -ArgumentList ('MyTypeName', $ExecutionContext.SessionState.Module.GetVariableFromCallersModule('MyInvocation').Value.MyCommand.Name) - New-Object -TypeName PSVariable -ArgumentList ('IsMetaConfig', $script:IsMetaConfig) - New-Object -TypeName PSVariable -ArgumentList ('V1MetaConfigPropertyList', $script:V1MetaConfigPropertyList) - if($script:ConfigurationData) - { - New-Object -TypeName PSVariable -ArgumentList ('AllNodes', $script:ConfigurationData.AllNodes) - } - ) - - $variablesToDefine += foreach ($key in $ArgsToBody.Keys) - { - # - # we need to process dependsOn seperately to - # 1. combined depends on with possible upper level configuration statement (composite resource case - # 2. in case of 1, we also need to fix up the dependson to append the suffix of ::$complexResourceQualifier similar in func:Test-DependsOn in CimDSCParser - # - # we need to process PsDscRunAsCredential seperately as well - # because it will be set recursively to all composite resources - if(($key -ne 'DependsOn') -and ($key -ne 'PsDscRunAsCredential')) - { - New-Object -TypeName PSVariable -ArgumentList ($key, $ArgsToBody[$key]) - } - } - - if($DependsOn -or $ArgsToBody['DependsOn']) - { - $complexResourceQualifier = Get-ComplexResourceQualifier - if($complexResourceQualifier) - { - $updatedDependsOn = foreach($DependsOnVar in @($ArgsToBody['DependsOn'])) - { - if($DependsOnVar) - { - "$DependsOnVar::$complexResourceQualifier" - } - } - $DependsOn = @($DependsOn) + @($updatedDependsOn) - } - else - { - $DependsOn = @($DependsOn) + @($ArgsToBody['DependsOn']) - } - - $variablesToDefine += New-Object -TypeName PSVariable -ArgumentList('DependsOn', $DependsOn) - } - - # If PsDscRunAsCredential is specified both in Outer configuration and inner composite resource we give error when merging PsDscRunAsCredential - if($PsDscRunAsCredential -and $ArgsToBody['PsDscRunAsCredential']) - { - Update-ConfigurationErrorCount - Write-Error -ErrorRecord ([Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::PsDscRunAsCredentialMergeErrorForCompositeResources($InstanceName)) - } - - # If PsDscRunAsCredential is specified in Configuration Argment or in outer configuration as $PsDscRunAsCredential - # set it as a varaible for current configurtaion. - if($PsDscRunAsCredential -or $ArgsToBody['PsDscRunAsCredential']) - { - if($ArgsToBody['PsDscRunAsCredential']) - { - $PsDscRunAsCredential = $ArgsToBody['PsDscRunAsCredential'] - } - $variablesToDefine += New-Object -TypeName PSVariable -ArgumentList('PsDscRunAsCredential', $PsDscRunAsCredential) - } - - $result = $Body.InvokeWithContext($functionsToDefine, $variablesToDefine) - } - catch [System.Management.Automation.MethodInvocationException] - { - Write-Debug -Message " $Name : Top level exception: $($_ | Out-String)" - # Write the unwrapped exception message - $pscmdlet.CommandRuntime.WriteError((Get-InnerMostErrorRecord $_)) - Update-ConfigurationErrorCount - } - - # - # write the generated files to disk and return the resulting files to stdout. - # - - if( $topLevel ) - { - if($Script:NoNameNodeInstanceAliases.Count -gt 0) - { - if ($Script:NodeInstanceAliases.ContainsKey('localhost')) - { - $errorMessage = $LocalizedData.LocalHostNodeNotAllowed -f "$Name" - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId LocalHostNodeNotAllowed - Update-ConfigurationErrorCount - } - - # - # Fixup DependsOn - # - ValidateNoNameNodeResources - Update-DependsOn $Script:NoNameNodesResources $Script:NoNameNodeInstanceAliases $Script:NoNameNodeResourceIdAliases - - - Write-Debug -Message " $Name : Evaluation completed, validating the generated resource set." - ValidateNodeResources - Write-Debug -Message " $Name Validation completed." - - # - # Fixup ModuleVersion - # - Update-ModuleVersion $Script:NoNameNodesResources $Script:NoNameNodeInstanceAliases $Script:NoNameNodeResourceIdAliases - - Write-Debug -Message " $Name : Evaluation completed, validating the generated resource set has no circle." - ValidateNoCircleInNodeResources - Write-Debug -Message " $Name Validation circle completed." - - if($script:IsMetaConfig) - { - # Validate make sure all of the referenced download managers are defined - Write-Debug -Message " $Name : Evaluation completed, validating the generated resource set reference download manager." - ValidateNodeManager - Write-Debug -Message " $Name Validation completed." - - # Validate make sure all of the referenced resource source are defined - Write-Debug -Message " $Name : Evaluation completed, validating the generated resource set reference resource source." - ValidateNodeResourceSource - Write-Debug -Message " $Name Validation completed." - - # Validate make sure new conflict between exclusive resources - Write-Debug -Message " $Name : Evaluation completed, validating no conflict between exclusive resources." - ValidateNodeExclusiveResources - Write-Debug -Message " $Name Validation completed." - - Write-MetaConfigFile $Name 'localhost' $Script:NoNameNodeInstanceAliases - } - else - { - Update-ConfigurationDocumentRef $Script:NoNameNodesResources $Script:NoNameNodeInstanceAliases $Script:NoNameNodeResourceIdAliases $Name - # - # Write the mof instance texts to files - # - Write-NodeMOFFile $Name 'localhost' $Script:NoNameNodeInstanceAliases - } - - # If no script-level $ConfigurationData variable is set, this code - # tries to get it first, from a global PowerShell ConfigurationData variable, - # then if that doesn't work it trys the environment - # variable $ENV:ConfigurationData when is expected to contain a JSON string - # that will be converted to objects. - # - if (-not $script:ConfigurationData) - { - $script:ConfigurationData = try - { - if ($global:ConfigurationData) - { - $global:ConfigurationData - } - elseif ($ENV:ConfigurationData) - { - $ENV:ConfigurationData | ConvertFrom-Json - } - else - { - @() - } - } - catch - { - Write-Error $_ - Update-ConfigurationErrorCount - @() - } - } - } - - if($script:ShowImportDscResourceWarning) - { - $message = $LocalizedData.ImportDscResourceWarningForInbuiltResource -f @(Get-PSTopConfigurationName) - $ImportDscResourceWarningPreference = $WarningPreference - if($ArgsToBody['WarningAction'] -ne $null) - { - $ImportDscResourceWarningPreference = $ArgsToBody['WarningAction'] - } - Write-Warning -Message $message -WarningAction $ImportDscResourceWarningPreference - } - - # - # write using the top-level hashtable - # - foreach($mofNode in $Script:NodeInstanceAliases.Keys) - { - # - # Fixup DependsOn - # - Update-DependsOn $Script:NodesInThisConfiguration[$mofNode] $Script:NodeInstanceAliases[$mofNode] $Script:NodeResourceIdAliases[$mofNode] - - if($script:IsMetaConfig) - { - Write-MetaConfigFile $Name $mofNode $Script:NodeInstanceAliases[$mofNode] - } - else - { - Update-ConfigurationDocumentRef $Script:NodesInThisConfiguration[$mofNode] $Script:NodeInstanceAliases[$mofNode] $Script:NodeResourceIdAliases[$mofNode] $Name - # - # Write the mof instance texts to files - # - Write-NodeMOFFile $Name $mofNode $Script:NodeInstanceAliases[$mofNode] - } - } - - if ($Script:PSConfigurationErrors -gt 0) - { - $errorMessage = $LocalizedData.FailToProcessConfiguration -f "$Name" - ThrowError -ExceptionName 'System.InvalidOperationException' -ExceptionMessage $errorMessage -ExceptionObject "$Name" -ErrorId 'FailToProcessConfiguration' -ErrorCategory InvalidOperation - } - } - } - finally - { - if($topLevel) - { - Write-Debug -Message " CONFIGURATION $Name : DOING TOP-LEVEL CLEAN UP" - [System.Management.Automation.Language.DynamicKeyword]::Reset() - [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ClearCache() - - Initialize-ConfigurationRuntimeState - } - Write-Debug -Message "END CONFIGURATION '$Name' PROCESSING. OutputPath: '$OutputPath'" - } -} -Export-ModuleMember -Function Configuration - -function Update-ModuleVersion -{ - [OutputType([void])] - param( - [Parameter(Mandatory)] - [System.Collections.Generic.Dictionary[String,String[]]] - $NodeResources, - - [Parameter(Mandatory)] - [System.Collections.Generic.Dictionary[string,string]] - $NodeInstanceAliases, - - [Parameter(Mandatory)] - [System.Collections.Generic.Dictionary[string,string]] - $NodeResourceIdAliases - ) - - $moduleVersionValue = '0.0' - - # explicit import-dscresource with version for psdesiredstateconfiguration module was not done. - if( $Script:ExplicitlyImportedModules.ContainsKey('PsDesiredStateConfiguration') -and - (-not [string]::IsNullOrEmpty($Script:ExplicitlyImportedModules['PsDesiredStateConfiguration']))) - { - $moduleVersionValue= $script:PsDscModuleVersion - } - # generating compatible document. - elseif($script:PsDscCompatibleVersion -eq '1.0.0') - { - $moduleVersionValue='1.0' - } - - # The logic is to insert correct moduleVersion for PsDesiredStateConfiguration module. In case of composite - # configuration,determination of what module version to use can happen later. Hence we update all objects - # after processing of every composite configuration to reflect upon with up to date information. - foreach($resourceId in $NodeResources.keys) - { - $alias = $NodeResourceIdAliases[$resourceId] - $instanceText = $NodeInstanceAliases[$alias] - $curlyPosition = $instanceText.LastIndexOf('}') - # check if the resource is from PsDesiredStateConfiguraiton Module. - if(($curlyPosition -gt 0) -and ($instanceText -imatch 'ModuleName[\s]*=[\s]*["]PsDesiredStateConfiguration["]')) - { - $moduleVersionstring = "ModuleVersion = " - $moduleVersionstring += "`"$moduleVersionValue`"" + ";" - - # if ModuleVersion field is not there - if($instanceText -inotmatch 'ModuleVersion[\s]*=') - { - $first = $instanceText.Substring(0, $curlyPosition) - $NodeInstanceAliases[$alias] = $first + $moduleVersionstring + "`r`n};" - } - else - { - #match pattern for eg: 'ModuleVersion = "1.0"' - $regexExpression = 'ModuleVersion[\s]*=[\s]*["][\d.]*["][\s]*;' - $NodeInstanceAliases[$alias] = $instanceText -replace $regexExpression, $moduleVersionstring - } - } - } -} - -function Update-DependsOn -{ - [OutputType([void])] - param( - [Parameter(Mandatory)] - [System.Collections.Generic.Dictionary[String,String[]]] - $NodeResources, - - [Parameter(Mandatory)] - [System.Collections.Generic.Dictionary[string,string]] - $NodeInstanceAliases, - - [Parameter(Mandatory)] - [System.Collections.Generic.Dictionary[string,string]] - $NodeResourceIdAliases - ) - - foreach($resourceId in $NodeResources.keys) - { - $alias = $NodeResourceIdAliases[$resourceId] - $needAdd = $false - $instanceText = $NodeInstanceAliases[$alias] - if($NodeResources[$resourceId]) - { - $curlyPosition = $instanceText.LastIndexOf('}') - if(($curlyPosition -gt 0) -and ($instanceText -notmatch 'dependsOn[\s]*=')) - { - $needAdd = $true - $first = $instanceText.Substring(0, $curlyPosition) - - $dependsOn = "DependsOn = {`r`n" - $len = @($NodeResources[$resourceId]).Length - $dependsOn += foreach ($resourceId in $NodeResources[$resourceId]) - { - ' ' + "`"$($resourceId -replace '\\', '\\' -replace '"', '\"')`"" + - $(if (--$len -gt 0) - { - ",`r`n" - } - else - { - '' - } - ) - } - $dependsOn += '};' - } - } - - if($needAdd) - { - $NodeInstanceAliases[$alias] = $first + $dependsOn + "`r`n};" - } - } -} - -# -# add a reference to each resource to point to the OMI_ConfigurationDocument -# so it can be differiencated after merging of partical configurations -# -function Update-ConfigurationDocumentRef -{ - [OutputType([void])] - param( - [Parameter(Mandatory)] - [System.Collections.Generic.Dictionary[String,String[]]] - $NodeResources, - - [Parameter(Mandatory)] - [System.Collections.Generic.Dictionary[string,string]] - $NodeInstanceAliases, - - [Parameter(Mandatory)] - [System.Collections.Generic.Dictionary[string,string]] - $NodeResourceIdAliases, - - [Parameter(Mandatory)] - [string] - $ConfigurationName - ) - - foreach($resourceId in $NodeResources.keys) - { - $alias = $NodeResourceIdAliases[$resourceId] - $instanceText = $NodeInstanceAliases[$alias] - $needAdd = $false - $curlyPosition = $instanceText.LastIndexOf('}') - if($curlyPosition -gt 0) - { - $needAdd = $true - $first = $instanceText.Substring(0, $curlyPosition).TrimEnd() - - $ConfigurationNameRef = "`r`n ConfigurationName = `"$ConfigurationName`";" - } - - if($needAdd) - { - $NodeInstanceAliases[$alias] = $first + $ConfigurationNameRef + "`r`n};" - } - } -} - -function ImportClassResourcesFromModule -{ - param ( - [Parameter(Mandatory)] - [PSModuleInfo] - $Module, - - [Parameter(Mandatory)] - [System.Collections.Generic.List[string]] - $Resources, - - [System.Collections.Generic.Dictionary[string, scriptblock]] - $functionsToDefine - ) - - $resourcesFound = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ImportClassResourcesFromModule($Module, $Resources, $functionsToDefine) - return ,$resourcesFound -} - -function ImportCimAndScriptKeywordsFromModule -{ - param ( - [Parameter(Mandatory)] - $Module, - - [Parameter(Mandatory)] - $resource, - - $functionsToDefine - ) - - trap - { - continue - } - - $SchemaFilePath = $null - $oldCount = $functionsToDefine.Count - - $keywordErrors = New-Object -TypeName 'System.Collections.ObjectModel.Collection[System.Exception]' - - $foundCimSchema = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ImportCimKeywordsFromModule( - $Module, $resource, [ref] $SchemaFilePath, $functionsToDefine, $keywordErrors) - - foreach($ex in $keywordErrors) - { - Write-Error -Exception $ex - if($ex.InnerException) - { - Write-Error -Exception $ex.InnerException - } - } - - $functionsAdded = $functionsToDefine.Count - $oldCount - Write-Debug -Message " $Name : PROCESSING RESOURCE FILE: Added $functionsAdded type handler functions from '$SchemaFilePath'" - - $SchemaFilePath = $null - $oldCount = $functionsToDefine.Count - - $foundScriptSchema = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ImportScriptKeywordsFromModule( - $Module, $resource, [ref] $SchemaFilePath, $functionsToDefine ) - - $functionsAdded = $functionsToDefine.Count - $oldCount - Write-Debug -Message " $Name : PROCESSING RESOURCE FILE: Added $functionsAdded type handler functions from '$SchemaFilePath'" - - if ($foundScriptSchema -and $SchemaFilePath) - { - $resourceDirectory = Split-Path $SchemaFilePath - if($resourceDirectory -ne $null) - { - Import-Module -Force: (Test-ModuleReloadRequired $SchemaFilePath) -Verbose:$false -Name $resourceDirectory -Global -ErrorAction SilentlyContinue - } - } - - return $foundCimSchema -or $foundScriptSchema -} - -# -# A function to write the MOF instance texts of a node to files as meta config -# -function Write-MetaConfigFile -{ - param( - [string] - $ConfigurationName, - - [string] - $mofNode, - - [System.Collections.Generic.Dictionary[string,string]] - $mofNodeHash - - ) - - # Set up prefix for both the configuration and metaconfiguration documents. - $nodeDoc = "/*`n@TargetNode='$mofNode'`n" + "@GeneratedBy=$([system.environment]::UserName)`n@GenerationDate=$(Get-Date)`n@GenerationHost=$([system.environment]::MachineName)`n*/`n" - $nodeConfigurationDocument = $null - [int]$nodeDocCount = 0 - $resourceManagers = $null - $resourceManagersCount = 0 - $reportManagers = $null - $reportManagersCount = 0 - $downloadManagers = $null - $downloadManagersCount = 0 - $localConfigManager = $null - $partialConfiguratons = $null - $partialConfigurationCount = 0 - $signatureValidationPolicies = $null - $signatureValidationCount = 0 - - foreach($mofTypeName in $mofNodeHash.Keys) - { - if($mofTypeName -match 'OMI_ConfigurationDocument') - { - $nodeConfigurationDocument = $mofNodeHash[$mofTypeName] - } - - if($mofTypeName -match 'MSFT_WebDownloadManager' -or $mofTypeName -match 'MSFT_FileDownloadManager') - { - $r = $mofNodeHash[$mofTypeName] -match '\$\w*' - if($r) - { - if($downloadManagersCount++ -gt 0) - { - $downloadManagers += ",`n" - } - $downloadManagers += ' ' + $Matches[0] - } - $script:SpecifiedV2DownloadManager = $true - } - - if($mofTypeName -match 'MSFT_WebResourceManager' -or $mofTypeName -match 'MSFT_FileResourceManager') - { - $r = $mofNodeHash[$mofTypeName] -match '\$\w*' - if($r) - { - if($resourceManagersCount++ -gt 0) - { - $resourceManagers += ",`n" - } - $resourceManagers += ' ' +$Matches[0] - } - } - - if($mofTypeName -match 'MSFT_OaaSReportManager' -or $mofTypeName -match 'MSFT_WebReportManager') - { - $r = $mofNodeHash[$mofTypeName] -match '\$\w*' - if($r) - { - if($reportManagersCount++ -gt 0) - { - $reportManagers += ",`n" - } - $reportManagers += ' ' +$Matches[0] - } - } - - #MSFT_PartialConfiguration - if($mofTypeName -match 'MSFT_PartialConfiguration') - { - $r = $mofNodeHash[$mofTypeName] -match '\$\w*' - if($r) - { - if($partialConfigurationCount++ -gt 0) - { - $partialConfiguratons += ",`n" - } - $partialConfiguratons += ' ' +$Matches[0] - } - } - - #MSFT_SignatureValidation - if($mofTypeName -match 'MSFT_SignatureValidation') - { - $r = $mofNodeHash[$mofTypeName] -match '\$\w*' - if($r) - { - if($signatureValidationCount++ -gt 0) - { - $signatureValidations += ",`n" - } - $signatureValidations += ' ' +$Matches[0] - } - } - - if($mofTypeName -notmatch 'MSFT_DSCMetaConfiguration') - { - $nodeDoc += $mofNodeHash[$mofTypeName] - } - else - { - if($localConfigManager -eq $null) - { - # save the localConfigManager which need to be fixed up to add additional manager info as embedded resources - $localConfigManager = $mofNodeHash[$mofTypeName] -replace 'MSFT_DSCMetaConfigurationV2', 'MSFT_DSCMetaConfiguration' - } - else - { - $errorMessage = $LocalizedData.MetaConfigurationHasMoreThanOneLocalConfigurationManager -f @($mofNode) - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId InvalidMOFDefinition - Update-ConfigurationErrorCount - return - } - } - - $nodeDocCount++ - } - - if ($script:MetaConfigSetToPull -and (-not $script:SpecifiedV2DownloadManager)) - { - $errorMessage = $LocalizedData.PullModeWithoutConfigurationRepository - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId PullModeWithoutConfigurationRepository - Update-ConfigurationErrorCount - } - - if ($script:SpecifiedV2DownloadManager -and (-not $script:MetaConfigSetToPull)) - { - Write-Warning -Message $LocalizedData.ConfigurationRepositoryWithoutPullMode - } - - if($localConfigManager -eq $null) - { - # Print verbose message that empty settings definition is added. - $emptySettingVerboseMessage = $LocalizedData.MetaConfigurationSettingsMissing -f @($mofNode) - Write-Verbose -Message $emptySettingVerboseMessage - - # Assign default settings - $localConfigManager = "`ninstance of MSFT_DSCMetaConfiguration as `$MSFT_DSCMetaConfiguration1ref `n{`n};" - } - - # fixup to add embedded instances - $nodeDoc += Update-LocalConfigManager $localConfigManager $resourceManagers $reportManagers $downloadManagers $partialConfiguratons $signatureValidations - - - $nodeOutfile = "$ConfigurationOutputDirectory/$($mofNode).meta.mof" - - # add/update OMI_ConfigurationDocument of meta config - if ($nodeDoc -notmatch 'OMI_ConfigurationDocument') - { - if (Get-PSDefaultConfigurationDocument) - { - Write-Debug -Message " ${ConfigurationName}: Adding OMI_ConfigurationDocument from $(Get-PSDefaultConfigurationDocument)" - $nodeDoc += Get-PSDefaultConfigurationDocument - } - else - { - Write-Debug -Message " ${ConfigurationName}: Adding missing OMI_ConfigurationDocument element to the document" - if($Script:NodesPasswordEncrypted[$mofNode]) - { - $nodeDoc += "`ninstance of OMI_ConfigurationDocument`n{`n Version=`"2.0.0`";`n MinimumCompatibleVersion = `"$($script:PSMetaConfigDocumentInstVersionInfo['MinimumCompatibleVersion'])`";`n CompatibleVersionAdditionalProperties= $(Get-CompatibleVersionAddtionaPropertiesStr);`n Author=`"$([system.environment]::UserName)`";`n GenerationDate=`"$(Get-Date)`";`n GenerationHost=`"$([system.environment]::MachineName)`";`n ContentType=`"PasswordEncrypted`";`n Name=`"$(Get-PSTopConfigurationName)`";`n};" - } - else - { - $nodeDoc += "`ninstance of OMI_ConfigurationDocument`n{`n Version=`"2.0.0`";`n MinimumCompatibleVersion = `"$($script:PSMetaConfigDocumentInstVersionInfo['MinimumCompatibleVersion'])`";`n CompatibleVersionAdditionalProperties= $(Get-CompatibleVersionAddtionaPropertiesStr);`n Author=`"$([system.environment]::UserName)`";`n GenerationDate=`"$(Get-Date)`";`n GenerationHost=`"$([system.environment]::MachineName)`";`n Name=`"$(Get-PSTopConfigurationName)`";`n};" - } - } - } - - # Fix up newlines to be CRLF - $nodeDoc = $nodeDoc -replace "`n", "`r`n" - - # todo: meta configuration might not be verifiable currently - $errMsg = Test-MofInstanceText $nodeDoc - if($errMsg) - { - $errorMessage = $LocalizedData.InvalidMOFDefinition -f @($mofNode, $errMsg) - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId InvalidMOFDefinition - Update-ConfigurationErrorCount - $nodeOutfile = "$ConfigurationOutputDirectory/$($mofNode).meta.mof.error" - } - - if($nodeDocCount -gt 0) - { - # Write to a file only if no error was generated or we are writing to .mof.error file - if ($Script:PSConfigurationErrors -eq 0 -or $nodeOutfile.EndsWith('mof.error')) - { - $nodeDoc > $nodeOutfile - Get-ChildItem $nodeOutfile - } - } -} - -# fixup localConfigmanager to have embedded instance -function Update-LocalConfigManager -{ - param( - [string] - $localConfigManager, - [string] - $resourceManagers, - [string] - $reportManagers, - [string] - $downloadManagers, - [string] - $partialConfigurations, - [string] - $signatureValidations - ) - - $curlyPostion = $localConfigManager.LastIndexOf('}') - if($curlyPostion -gt 0) - { - $first = $localConfigManager.Substring(0, $curlyPostion) - if($resourceManagers) - { - $first += " ResourceModuleManagers = {`n" + $resourceManagers + " `n };`n" - } - - if($reportManagers) - { - $first += " ReportManagers = {`n" + $reportManagers + " `n };`n" - } - - if($downloadManagers) - { - $first += " ConfigurationDownloadManagers = {`n" + $downloadManagers + " `n };`n" - } - - #PartialConfigurations - if($partialConfigurations) - { - $first += " PartialConfigurations = {`n" + $partialConfigurations + " `n };`n" - } - if($signatureValidations) - { - $first += " SignatureValidations = {`n" + $signatureValidations + " `n };`n" - } - - $first += "};`n" - - $first - } -} - -function Get-MofInstanceName -{ - param( - [string] - $mofInstance - ) -} -# -# A function to write the MOF instance texts of a node to files -# -function Write-NodeMOFFile -{ - param( - [string] - $ConfigurationName, - - [string] - $mofNode, - - [System.Collections.Generic.Dictionary[string,string]] - $mofNodeHash - ) - - if ($script:MetaConfigSetToPull -and (-not $script:SpecifiedV1DownloadManagerName)) - { - $errorMessage = $LocalizedData.PullModeWithoutDownloadManager - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId PullModeWithoutDownloadManager - Update-ConfigurationErrorCount - } - - if ($script:SpecifiedV1DownloadManagerName -and (-not $script:MetaConfigSetToPull)) - { - Write-Warning -Message $LocalizedData.DownloadManagerWithoutPullMode - } - - # Set up prefix for both the configuration and metaconfiguration documents. - $nodeDoc = "/*`n@TargetNode='$mofNode'`n" + "@GeneratedBy=$([system.environment]::UserName)`n@GenerationDate=$(Get-Date)`n@GenerationHost=$([system.environment]::MachineName)`n*/`n" - $nodeMetaDoc = $nodeDoc - $nodeConfigurationDocument = $null - [int]$metaDocCount = 0 - [int]$nodeDocCount = 0 - - foreach($mofTypeName in $mofNodeHash.Keys) - { - if($mofTypeName -match 'MSFT_DSCMetaConfiguration') - { - $tempMetaDoc = $mofNodeHash[$mofTypeName] - $metaDocCount++ - break - } - } - - foreach($mofTypeName in $mofNodeHash.Keys) - { - if(($mofTypeName -notmatch 'MSFT_DSCMetaConfiguration')) - { - if(($metaDocCount -gt 0) -and ($tempMetaDoc -match [regex]::Escape($mofTypeName))) - { - $nodeMetaDoc += $mofNodeHash[$mofTypeName] - } - else - { - if($mofTypeName -match 'OMI_ConfigurationDocument') - { - $nodeConfigurationDocument = $mofNodeHash[$mofTypeName] - } - $nodeDoc += $mofNodeHash[$mofTypeName] - $nodeDocCount++ - } - } - } - - $nodeMetaDoc += $tempMetaDoc - - $nodeOutfile = "$ConfigurationOutputDirectory/$($mofNode).mof" - if($metaDocCount -gt 0) - { - $nodeMetaOutfile = "$ConfigurationOutputDirectory/$($mofNode).meta.mof" - # this meta config uses v1 schema so will not have v2 properties - if ($nodeConfigurationDocument) - { - Write-Debug -Message " ${ConfigurationName}: Adding OMI_ConfigurationDocument from the current node '$mofNode': $nodeConfigurationDocument" - $nodeMetaDoc += $nodeConfigurationDocument - } - elseif (Get-PSDefaultConfigurationDocument) - { - Write-Debug -Message " ${ConfigurationName}: Adding OMI_ConfigurationDocument from $(Get-PSDefaultConfigurationDocument)" - $nodeMetaDoc += Get-PSDefaultConfigurationDocument - } - else - { - Write-Debug -Message " ${ConfigurationName}: Adding missing OMI_ConfigurationDocument element to the document" - if($Script:NodesPasswordEncrypted[$mofNode]) - { - $nodeMetaDoc += "`ninstance of OMI_ConfigurationDocument`n{`n Version=`"2.0.0`";`n MinimumCompatibleVersion = `"1.0.0`";`n CompatibleVersionAdditionalProperties= $(Get-CompatibleVersionAddtionaPropertiesStr);`n Author=`"$([system.environment]::UserName)`";`n GenerationDate=`"$(Get-Date)`";`n GenerationHost=`"$([system.environment]::MachineName)`";`n ContentType=`"PasswordEncrypted`";`n Name=`"$(Get-PSTopConfigurationName)`";`n};" - } - else - { - $nodeMetaDoc += "`ninstance of OMI_ConfigurationDocument`n{`n Version=`"2.0.0`";`n MinimumCompatibleVersion = `"1.0.0`";`n CompatibleVersionAdditionalProperties= $(Get-CompatibleVersionAddtionaPropertiesStr);`n Author=`"$([system.environment]::UserName)`";`n GenerationDate=`"$(Get-Date)`";`n GenerationHost=`"$([system.environment]::MachineName)`";`n Name=`"$(Get-PSTopConfigurationName)`";`n};" - } - } - } - - if ($nodeDoc -notmatch 'OMI_ConfigurationDocument') - { - if (Get-PSDefaultConfigurationDocument) - { - Write-Debug -Message " ${ConfigurationName}: Adding OMI_ConfigurationDocument from $(Get-PSDefaultConfigurationDocument)" - $nodeDoc += Get-PSDefaultConfigurationDocument - } - else - { - Write-Debug -Message " ${ConfigurationName}: Adding missing OMI_ConfigurationDocument element to the document" - if($Script:NodesPasswordEncrypted[$mofNode]) - { - if($nodeDoc.Contains("PsDscRunAsCredential")) - { - $nodeDoc += "`ninstance of OMI_ConfigurationDocument`n - {`n Version=`"2.0.0`";`n - MinimumCompatibleVersion = `"2.0.0`";`n - CompatibleVersionAdditionalProperties= {`"Omi_BaseResource:ConfigurationName`"};`n - Author=`"$([system.environment]::UserName)`";`n - GenerationDate=`"$(Get-Date)`";`n - GenerationHost=`"$([system.environment]::MachineName)`";`n - ContentType=`"PasswordEncrypted`";`n - Name=`"$(Get-PSTopConfigurationName)`";`n - };" - } - else - { - $nodeDoc += "`ninstance of OMI_ConfigurationDocument`n - {`n Version=`"2.0.0`";`n - MinimumCompatibleVersion = `"1.0.0`";`n - CompatibleVersionAdditionalProperties= {`"Omi_BaseResource:ConfigurationName`"};`n - Author=`"$([system.environment]::UserName)`";`n - GenerationDate=`"$(Get-Date)`";`n - GenerationHost=`"$([system.environment]::MachineName)`";`n - ContentType=`"PasswordEncrypted`";`n - Name=`"$(Get-PSTopConfigurationName)`";`n - };" - } - } - else - { - if($nodeDoc.Contains("PsDscRunAsCredential")) - { - $nodeDoc += "`ninstance of OMI_ConfigurationDocument`n - {`n Version=`"2.0.0`";`n - MinimumCompatibleVersion = `"2.0.0`";`n - CompatibleVersionAdditionalProperties= {`"Omi_BaseResource:ConfigurationName`"};`n - Author=`"$([system.environment]::UserName)`";`n - GenerationDate=`"$(Get-Date)`";`n - GenerationHost=`"$([system.environment]::MachineName)`";`n - Name=`"$(Get-PSTopConfigurationName)`";`n - };" - } - else - { - $nodeDoc += "`ninstance of OMI_ConfigurationDocument`n - {`n Version=`"2.0.0`";`n - MinimumCompatibleVersion = `"1.0.0`";`n - CompatibleVersionAdditionalProperties= {`"Omi_BaseResource:ConfigurationName`"};`n - Author=`"$([system.environment]::UserName)`";`n - GenerationDate=`"$(Get-Date)`";`n - GenerationHost=`"$([system.environment]::MachineName)`";`n - Name=`"$(Get-PSTopConfigurationName)`";`n - };" - } - } - } - } - # Fix up newlines to be CRLF - $nodeDoc = $nodeDoc -replace "`n", "`r`n" - - $errMsg = Test-MofInstanceText $nodeDoc - if($errMsg) - { - $errorMessage = $LocalizedData.InvalidMOFDefinition -f @($mofNode, $errMsg) - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId InvalidMOFDefinition - Update-ConfigurationErrorCount - $nodeOutfile = "$ConfigurationOutputDirectory/$($mofNode).mof.error" - } - - if($nodeDocCount -gt 0) - { - # Write to a file only if no error was generated or we are writing to .mof.error file - if ($Script:PSConfigurationErrors -eq 0 -or $nodeOutfile.EndsWith('mof.error')) - { - $nodeDoc > $nodeOutfile - Get-ChildItem $nodeOutfile - } - } - - if($nodeMetaDoc -match 'MSFT_DSCMetaConfiguration' -and $Script:PSConfigurationErrors -eq 0) - { - $nodeMetaDoc = $nodeMetaDoc -replace "`n", "`r`n" - $nodeMetaDoc > $nodeMetaOutfile - Get-ChildItem $nodeMetaOutfile - } -} - -# -# A function to make sure that only valid resources are referenced within a node. It -# operates off of the $Script:NodeResources dictionary. An empty dictionary is not -# considered an error since this function is called at both the node level and the configuration -# level. -# This function also expand the dependsOn to composite resources -# -function ValidateNodeResources -{ - Write-Debug -Message " Validating resource set for node: $(Get-PSCurrentConfigurationNode)" - $newNodeResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,[string[]]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - if ($Script:NodeResources) - { - foreach ($resourceId in $Script:NodeResources.Keys) - { - Write-Debug -Message " Checking node $resourceId" - $newDependsOn = foreach ($requiredResource in $Script:NodeResources[$resourceId]) - { - # Skip resources that have no DependsOn. - if ($requiredResource) - { - Write-Debug -Message " > Checking for required node $requiredResource" - - if (-not $Script:NodeResources.ContainsKey($requiredResource)) - { - Write-Debug -Message " > trying expand for required node $requiredResource" - $expandedDependsOn = foreach($rId in $Script:NodeResources.keys) - { - if($rId.EndsWith($requiredResource, [System.StringComparison]::InvariantCultureIgnoreCase)) - { - $rId - } - } - - - if(-not $expandedDependsOn) - { - $errorMessage = $LocalizedData.RequiredResourceNotFound -f @($requiredResource, $resourceId) - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId RequiredResourceNotFound - Update-ConfigurationErrorCount - } - else - { - $expandedDependsOn - } - } - else - { - $requiredResource - } - } - } - - if($newDependsOn) - { - $newNodeResources[$resourceId] = $newDependsOn - } - } - - if($newNodeResources) - { - foreach($id in $newNodeResources.keys) - { - $Script:NodeResources[$id] = $newNodeResources[$id] - } - } - } - Write-Debug -Message " Validation complete for node: $(Get-PSCurrentConfigurationNode)" -} - -# -# A function to make sure that only valid resources are referenced within the resource without node. -# This function also expand the dependsOn to composite resources -# -function ValidateNoNameNodeResources -{ - Write-Debug -Message ' Validating resource set for resources in the default configuration' - $newNodeResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,[string[]]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) - if ($Script:NoNameNodesResources) - { - foreach ($resourceId in $Script:NoNameNodesResources.Keys) - { - Write-Debug -Message " Checking node $resourceId" - $newDependsOn = foreach ($requiredResource in $Script:NoNameNodesResources[$resourceId]) - { - # Skip resources that have no DependsOn. - if ($requiredResource) - { - Write-Debug -Message " > Checking for required node $requiredResource" - - if (-not $Script:NoNameNodesResources.ContainsKey($requiredResource)) - { - Write-Debug -Message " > trying expand for required node $requiredResource" - $expandedDependsOn = foreach($rId in $Script:NoNameNodesResources.keys) - { - if($rId.EndsWith($requiredResource, [System.StringComparison]::InvariantCultureIgnoreCase)) - { - $rId - } - } - - if(-not $expandedDependsOn) - { - # When Node name is not specified in the configuration, $NoNameNodesResources & $NodeResources list are same. - # Do not throw error here to avoid duplicate errors, these errors will be throw by ‘ValidateNodeResources’ when $NodeResources list will be validated. - if(-not $Script:NodeResources.ContainsKey($resourceId)) - { - $errorMessage = $LocalizedData.RequiredResourceNotFound -f @($requiredResource, $resourceId) - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId RequiredResourceNotFound - Update-ConfigurationErrorCount - } - } - else - { - $expandedDependsOn - } - } - else - { - $requiredResource - } - } - } - - if($newDependsOn) - { - $newNodeResources[$resourceId] = $newDependsOn - } - } - - if($newNodeResources) - { - foreach($id in $newNodeResources.keys) - { - $Script:NoNameNodesResources[$id] = $newNodeResources[$id] - } - } - } - Write-Debug -Message ' Validation complete for default resources.' -} - -# -# A function to make sure that only valid Manager are referenced within a node. It -# operates off of the $Script:NodeManager dictionary. -# An empty dictionary is not -# considered an error since this function is called at both the node level and the configuration -# level. -# -function ValidateNodeManager -{ - Write-Debug -Message " Validating manager set for node: $(Get-PSCurrentConfigurationNode)" - if ($Script:NodeManager) - { - foreach ($resourceId in $Script:NodeManager.Keys) - { - Write-Debug -Message " Checking node $resourceId" - $refManagers = $Script:NodeManager[$resourceId] - # Skip partial configuration that have no Manager. - if ($refManagers) - { - Write-Debug -Message " > Checking for required manager $refManagers" - - foreach ($refManager in $refManagers) - { - if (-not $Script:NodeResources.ContainsKey($refManager)) - { - $errorMessage = $LocalizedData.ReferencedManagerNotFound -f @($refManager, $resourceId) - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ReferencedManagerNotFound - Update-ConfigurationErrorCount - } - } - } - } - } - - if ($IsMetaConfig) - { - #region Reference check for SignatureValidationPolicy - $referencedSignaturePolicy = $null; - $nodeAliases = @{} - - if ($NoNameNodeInstanceAliases.Count -ne 0) - { - $nodeAliases = $NoNameNodeInstanceAliases - } - else - { - $nodeAliases = $NodeInstanceAliases[$Node] - } - $metaConfigReferenceId = $nodeAliases.Keys | Where-Object -FilterScript {$_ -like '$MSFT_DSCMetaConfiguration*'} - # If there is no setting block defined. - if(!$metaConfigReferenceId) {return} - $v2MetaConfigReference = $nodeAliases.Item($metaConfigReferenceId) - - # Check if user specified the signature policy in the setting block. - $signatrueValidationIsSpecified = $v2MetaConfigReference -match 'SignatureValidationPolicy[ ]*=' - if ($signatrueValidationIsSpecified) - { - $referencedSignaturePolicyMatches = $v2MetaConfigReference -match '\[SignatureValidation\][^"]+' - if ($referencedSignaturePolicyMatches) - { - $referencedSignaturePolicy = $Matches[0] - } - else - { - $errorMessage = $LocalizedData.IncorrectSignatureValidationPolicyFormat - $exception = New-Object -TypeName System.ArgumentException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidArgument -ErrorId IncorrectSignatureValidationPolicyFormat - Update-ConfigurationErrorCount - } - - # If there is a referenced policy ensure that its value matches one of the defined signature validation resources. - if ($referencedSignaturePolicy) - { - if (-not $Script:NodeResources.ContainsKey($referencedSignaturePolicy)) - { - $errorMessage = $LocalizedData.ReferencedPolicyNotDefined -f @($referencedSignaturePolicy) - $exception = New-Object -TypeName System.ArgumentException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidArgument -ErrorId ReferencedPolicyNotDefined - Update-ConfigurationErrorCount - } - } - } - } - #endregion - - Write-Debug -Message " Validation complete for node: $(Get-PSCurrentConfigurationNode)" -} - -# -# A function to make sure that only valid resource source are referenced within a node. It -# operates off of the $Script:NodeResourceSource dictionary. -# An empty dictionary is not -# considered an error since this function is called at both the node level and the configuration -# level. -# -function ValidateNodeResourceSource -{ - Write-Debug -Message " Validating resource source set for node: $(Get-PSCurrentConfigurationNode)" - if ($Script:NodeResourceSource) - { - foreach ($resourceId in $Script:NodeResourceSource.Keys) - { - Write-Debug -Message " Checking node $resourceId" - $refResourceSources = $Script:NodeResourceSource[$resourceId] - # Skip partial configuration that have no Manager. - if ($refResourceSources) - { - Write-Debug -Message " > Checking for required manager $refManagers" - - foreach ($refResourceSource in $refResourceSources) - { - if (-not $Script:NodeResources.ContainsKey($refResourceSource)) - { - $errorMessage = $LocalizedData.ReferencedResourceSourceNotFound -f @($refResourceSource, $resourceId) - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ReferencedResourceSourceNotFound - Update-ConfigurationErrorCount - } - } - } - } - } - Write-Debug -Message " Validation complete for node: $(Get-PSCurrentConfigurationNode)" -} - -# -# A function to make sure that exclusive resources among partial configurations do not conflict with each other -# it is already of format modulename\resourcName or modulename\* or resourceName -# It also validate they exist -function ValidateNodeExclusiveResources -{ - Write-Debug -Message " Validating exclusive resources for node: $(Get-PSCurrentConfigurationNode)" - if ($Script:NodeExclusiveResources) - { - # map will be of format {moduleName, {Id=ResourceId; ContainsAll = $true/$false; Resources=@('r1','r2'...)}} - $ModuleBasedExclusiveResourceMap = @{} - # map for resource that doesn't have module - $NoModuleExclusiveResourceMap = @{} - - foreach ($resourceId in $Script:NodeExclusiveResources.Keys) - { - Write-Debug -Message " Checking node $resourceId" - - # Remove duplicate entries from exclusive Resource array - $exclusiveResourceList = $Script:NodeExclusiveResources[$resourceId] | select -uniq - - foreach($refResource in $exclusiveResourceList) - { - $resourceSegs = $refResource -split '\\' - - if($resourceSegs.Length -eq 2) - { - if($ModuleBasedExclusiveResourceMap[$resourceSegs[0]] -eq $null) - { - $ModuleBasedExclusiveResourceMap[$resourceSegs[0]] = @{ - Id = $resourceId - } - if($resourceSegs[1] -eq '*') - { - $ModuleBasedExclusiveResourceMap[$resourceSegs[0]]['ContainsAll'] = $true - } - else - { - $ModuleBasedExclusiveResourceMap[$resourceSegs[0]]['ContainsAll'] = $false - $ModuleBasedExclusiveResourceMap[$resourceSegs[0]]['Resources'] = @($resourceSegs[1]) - } - } - else - { - # 'Module\Resource' in PartialConfiguration1 conflicts with 'Module\*' in PartialConfiguration2 - # or 'Module\*' in PartialConfiguration1 conflicts with 'Module\Resource' in PartialConfiguration2 - if(($resourceSegs[1] -eq '*') -or $ModuleBasedExclusiveResourceMap[$resourceSegs[0]]['ContainsAll']) - { - $errorMessage = $LocalizedData.ConflictInExclusiveResources -f @($ModuleBasedExclusiveResourceMap[$resourceSegs[0]]['Id'], $resourceId) - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ConflictInExclusiveResources - Update-ConfigurationErrorCount - break - } - # 'Module\Resource' in PartialConfiguration1 conflicts with 'Module\Resource' in PartialConfiguration2 - # or 'Module\Resource' in PartialConfiguration1 conflicts with 'Resource' in PartialConfiguration2 - elseif($ModuleBasedExclusiveResourceMap[$resourceSegs[0]]['Resources'] -icontains $resourceSegs[1] ` - -or $NoModuleExclusiveResourceMap[$resourceSegs[1]] -ne $null) - { - $errorMessage = $LocalizedData.ConflictInExclusiveResources -f @($ModuleBasedExclusiveResourceMap[$resourceSegs[0]]['Id'], $resourceId) - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ConflictInExclusiveResources - Update-ConfigurationErrorCount - break - } - else - { - $ModuleBasedExclusiveResourceMap[$resourceSegs[0]]['Resources'] += @($resourceSegs[1]) - } - } - } - else # no module name, normally means binary resource - { - if($NoModuleExclusiveResourceMap[$refResource] -eq $null) - { - $resourceFound = $false - $ModuleBasedExclusiveResourceMap.GetEnumerator() | % { - if($_.Value.Resources -icontains $refResource) { - $resourceFound = $true - $ConflictingPartialConfigurationId = $_.Value.Id - } - } - - # 'Resource' in PartialConfiguration1 conflicts with 'Module\Resource' in PartialConfiguration2 - if($resourceFound){ - $errorMessage = $LocalizedData.ConflictInExclusiveResources -f @($ConflictingPartialConfigurationId, $resourceId) - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ConflictInExclusiveResources - Update-ConfigurationErrorCount - break - } - - $NoModuleExclusiveResourceMap[$refResource] = @{ - Id = $resourceId - } - } - # 'Resource' in PartialConfiguration1 conflicts with 'Resource' in PartialConfiguration2 - else - { - $errorMessage = $LocalizedData.ConflictInExclusiveResources -f @($NoModuleExclusiveResourceMap[$refResource]['Id'], $resourceId) - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ConflictInExclusiveResources - Update-ConfigurationErrorCount - break - } - } - } - } - } - Write-Debug -Message " Validation complete for node: $(Get-PSCurrentConfigurationNode)" -} - -# -# A function to make sure that only valid resources are referenced within a node. It -# operates off of the $Script:NodeResources dictionary. An empty dictionary is not -# considered an error since this function is called at both the node level and the configuration -# level. -# it uses Tarjan strongly connected component algorithms -# -function ValidateNoCircleInNodeResources -{ - Write-Debug -Message " Validating resource set for node: $(Get-PSCurrentConfigurationNode)" - [int] $script:CircleIndex = 0 - [System.Collections.Generic.Stack[string]] $script:resourceIdStack = - New-Object -TypeName 'System.Collections.Generic.Stack[string]' - [hashtable] $script:resourceIndex = @{} - [hashtable] $script:resourceLowIndex = @{} - [int] $script:ComponentDepth = 0 - [int] $script:MaxComponentDepth = 1024 - - if ($Script:NodeResources) - { - foreach ($resourceId in $Script:NodeResources.Keys) - { - if(($Script:NodeResources[$resourceId] -ne $null) -and $Script:NodeResources[$resourceId].Contains($resourceId)) - { - $errorMessage = $LocalizedData.DependsOnLoopDetected -f "$resourceId->$resourceId" - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId DependsOnLoopDetected - Update-ConfigurationErrorCount - } - - if($resourceIndex[$resourceId] -eq $null) - { - $script:ComponentDepth = 0 - StrongConnect($resourceId) - } - } - } - Write-Debug -Message " Validation circular reference completed for node: $(Get-PSCurrentConfigurationNode)" -} - -function StrongConnect -{ - param ([string]$resourceId) - - $script:resourceIndex[$resourceId] = $script:CircleIndex - $script:resourceLowIndex[$resourceId] = $script:CircleIndex - $script:CircleIndex++ - $script:ComponentDepth++ - if($script:ComponentDepth -gt $script:MaxComponentDepth) - { - $errorMessage = $LocalizedData.DependsOnLinkTooDeep -f $script:MaxComponentDepth - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId DependsOnLinkTooDeep - Update-ConfigurationErrorCount - } - - $script:resourceIdStack.Push($resourceId) - - foreach ($requiredResource in $Script:NodeResources[$resourceId]) - { - Write-Debug -Message " > Checking for required node $requiredResource" - #$requiredResource is not visited yet - if(($requiredResource -ne $null) -and ($script:resourceIndex[$requiredResource] -eq $null)) - { - StrongConnect($requiredResource) - $script:resourceLowIndex[$resourceId] = [math]::Min($script:resourceLowIndex[$resourceId], $script:resourceLowIndex[$requiredResource]) - } - elseif($script:resourceIdStack -Contains $requiredResource) - { - $script:resourceLowIndex[$resourceId] = [math]::Min($script:resourceLowIndex[$resourceId], $script:resourceIndex[$requiredResource]) - } - } - - if($script:resourceIndex[$resourceId] -eq $script:resourceLowIndex[$resourceId]) - { - $resourceCount = 0 - $circularLinks = '' - do - { - $a = $script:resourceIdStack.Pop() - $circularLinks += "->$a" - $resourceCount++ - } - while($a -ne $resourceId) - - if($resourceCount -gt 1) - { - $errorMessage = $LocalizedData.DependsOnLoopDetected -f $circularLinks - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId DependsOnLoopDetected - Update-ConfigurationErrorCount - } - } -} - -# -# Returns any validation error messages -# -function Test-MofInstanceText -{ - param ( - [Parameter(Mandatory)] - $instanceText - ) - - # Ignore empty instances... - if ( $instanceText) - { - try - { - [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ValidateInstanceText($instanceText) - } - catch [System.Management.Automation.MethodInvocationException] - { - # Return the exception message from the inner most ErrorRecord - $ErrorRecord = Get-InnerMostErrorRecord $_ - $ErrorRecord.Exception.Message - } - } -} - -# -# Encrypt a password using CMS -# -function Get-EncryptedPassword -{ - param ( - [Parameter()] - $Value = $null - ) - - $cert = $null - - - if($Node -and $selectedNodesData) - { - if($selectedNodesData -is [array]) - { - foreach($target in $selectedNodesData) - { - # Node name should be exactly the same as one defined in AllNodes - # -eq does case in sensitive comparison - if($target['NodeName'] -and $target['NodeName'] -eq $Node) - { - $currentNode = $target - } - } - } - else - { - $currentNode = $selectedNodesData - } - } - # where user need to specify properties for resources not in a node, - # they can do it through localhost nodeName in $allNodes - elseif($allnodes -and $allnodes.AllNodes) - { - foreach($target in $allnodes.AllNodes) - { - if($target['NodeName'] -and $target['NodeName'] -eq 'localhost') - { - $currentNode = $target - } - } - } - - if($currentNode) - { - # if Certificate is provided, it override PSDscAllowPlainTextPassword : bug 565167 - # CertificateID is currently assumed to be the 'thumbprint' from the certificate - # Protect-CmsMessage [-To] takes actual cert, path to cert file, path to a directory contains cert, thumbprint or subject name of cert - # we only support cert file and thumbprint as before now - $certificateid = $currentNode['CertificateID'] - - # If there is no certificateid defined, just return the original value... - if ( -not $certificateid) - { - # CertificateFile is the public key file - $certificatefile = $currentNode['CertificateFile'] - - if ( -not $certificatefile) - { - return $Value - } - else - { - $CmsMessageRecipient = $certificatefile - } - } - else - { - $CmsMessageRecipient = $certificateid - } - } - - if($CmsMessageRecipient -and $Value -is [string]) - { - # Encrypt using the public key - $encMsg =Protect-CmsMessage -To $CmsMessageRecipient -Content $Value - - # Reverse bytes for unmanaged decryption - #[Array]::Reverse($encbytes) - - #$encMsg = $encMsg -replace '-----BEGIN CMS-----','' - #$encMsg = $encMsg -replace "`n",'' - #$encMsg = $encMsg -replace '-----END CMS-----','' - - return $encMsg - } - else - { - # passwords should be some type of string so this is probably an error but pass - # back the incoming value. Also if there is no key, then we just pass through the - # password as is. - - $Value - } -} - - -# -# Retrieve a public key that can be used for encryption. Matching on thumbprint -# -function Get-PublicKeyFromStore -{ - param( - [Parameter(Mandatory)] - [string] - $certificateid - ) - - $cert = $null - - foreach($certIndex in Get-ChildItem -Path cert:\LocalMachine\My) - { - if($certIndex.Thumbprint -match $certificateid) - { - $cert = $certIndex - break - } - } - - if(-not $cert) - { - $errorMessage = $($LocalizedData.CertificateStoreReadError) -f $certificateid - ThrowError -ExceptionName 'System.InvalidOperationException' -ExceptionMessage $errorMessage -ExceptionObject $certificateid -ErrorId 'InvalidPathSpecified' -ErrorCategory InvalidOperation - } - else - { - $cert - } -} - -# -# Retrieve a public key that can be used for encryption. Certificate loaded from -# a certificate file -# -function Get-PublicKeyFromFile -{ - param( - [Parameter(Mandatory)] - [string] - $certificatefile - ) - - try - { - $cert = New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Certificate2 - - if($cert) - { - $cert.Import($certificatefile) - $cert - } - } - catch - { - $errorMessage = $($LocalizedData.CertificateFileReadError) -f $certificatefile - ThrowError -ExceptionName 'System.InvalidOperationException' -ExceptionMessage $errorMessage -ExceptionObject $certificatefile -ErrorId 'InvalidPathSpecified' -ErrorCategory InvalidOperation - } -} - - -########################################################### -# -# Checksum generation functions. -# -########################################################### - -#----------------------------------------------------------------------------------------------------- -# New-DscChecksum cmdlet is used to create corresponding checksum files for a specified file or folder -#----------------------------------------------------------------------------------------------------- -function New-DscChecksum -{ - [CmdletBinding(SupportsShouldProcess = $true, HelpUri = 'https://go.microsoft.com/fwlink/?LinkId=403986')] - param( - [Parameter(Mandatory)] - [Alias('ConfigurationPath')] - [ValidateNotNullOrEmpty()] - [string[]] - $Path, - - [Parameter()] - [ValidateNotNullOrEmpty()] - [string] - $OutPath = $null, - - [switch] - $Force - ) - - # Check validity of all configuration paths specified, throw if any of them is invalid - for ($i = 0 ; $i -lt $Path.Length ; $i++) - { - if (!(Test-Path -Path $Path[$i])) - { - $errorMessage = $LocalizedData.InvalidConfigPath -f $Path[$i] - ThrowError -ExceptionName 'System.ArgumentException' -ExceptionMessage $errorMessage -ExceptionObject $Path[$i] -ErrorId 'InvalidConfigurationPath' -ErrorCategory InvalidArgument - } - } - - # If an OutPath is specified, handle its creation and error conditions - if ($OutPath) - { - # If and invalid path syntax is specified in $Outpath, throw - if(([System.IO.Path]::GetInvalidPathChars() | ForEach-Object -Process { - $OutPath.Contains($_) - } - ).IndexOf($true)[0] -ne -1) - { - $errorMessage = $LocalizedData.InvalidOutpath -f $OutPath - ThrowError -ExceptionName 'System.ArgumentException' -ExceptionMessage $errorMessage -ExceptionObject $OutPath -ErrorId 'InvalidOutPath' -ErrorCategory InvalidArgument - } - - # If the specified $Outpath conflicts with an existing file, throw - if(Test-Path -Path $OutPath -PathType Leaf) - { - $errorMessage = $LocalizedData.OutpathConflict -f $OutPath - ThrowError -ExceptionName 'System.ArgumentException' -ExceptionMessage $errorMessage -ExceptionObject $OutPath -ErrorId 'InvalidOutPath' -ErrorCategory InvalidArgument - } - - # IF THE CONTROL REACHED HERE, $OutPath IS A VALID DIRECTORY PATH WHICH HAS NO CONFLICT WITH AN EXISTING FILE - - # If $OutPath doesn't exist, create it - if(!(Test-Path -Path $OutPath)) - { - $null = New-Item -Path $OutPath -ItemType Directory - } - - $OutPath = (Resolve-Path $OutPath).ProviderPath - } - - # Retrieve all valid configuration files at the specified $Path - $allConfigFiles = $Path | ForEach-Object -Process { - (Get-ChildItem -Path $_ -Recurse | Where-Object -FilterScript { - $_.Extension -eq '.mof' -or $_.Extension -eq '.zip' - } - ) - } - - # If no valid config file was found, log this and return - if ($allConfigFiles.Length -eq 0) - { - Write-Log -Message $LocalizedData.NoValidConfigFileFound - - return - } - - # IF THE CONTROL REACHED HERE, VALID CONFIGURATION FILES HAVE BEEN FOUND AND WE NEED TO CALCULATE THEIR HASHES - - foreach ($file in $allConfigFiles) - { - $fileOutpath = "$($file.FullName).checksum" - if ($OutPath) - { - $fileOutpath = "$OutPath\$($file.Name).checksum" - } - - # If the Force parameter was not specified and the hash file already exists for the current file, log this, and skip this file - if (!$Force -and (Get-Item -Path $fileOutpath -ErrorAction SilentlyContinue)) - { - Write-Log -Message ($LocalizedData.CheckSumFileExists -f $fileOutpath) - continue - } - - # Devise appropriate message - $message = $LocalizedData.CreateChecksumFile -f $fileOutpath - if (Test-Path -Path $fileOutpath) - { - $message = $LocalizedData.OverwriteChecksumFile -f $fileOutpath - } - - # Finally, if the hash file doesn't exist already or -Force has been specified, then output the corresponding hash file - if ($pscmdlet.ShouldProcess($message, $null, $null)) - { - [String]$checksum = (Get-FileHash -Path $file.FullName -Algorithm SHA256).Hash - - WriteFile -Path $fileOutpath -Value $checksum - } - } -} -Export-ModuleMember -Function New-DscChecksum - - -#------------------------------------ -# Utility to throw an error/exception -#------------------------------------ -function ThrowError -{ - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ExceptionName, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $ExceptionMessage, - - [System.Object] - $ExceptionObject, - - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $errorId, - - [parameter(Mandatory = $true)] - [ValidateNotNull()] - [System.Management.Automation.ErrorCategory] - $errorCategory - ) - - $exception = New-Object $ExceptionName $ExceptionMessage - $ErrorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord -ArgumentList $exception, $errorId, $errorCategory, $ExceptionObject - throw $ErrorRecord -} - -#---------------------------------------- -# Utility to write WhatIf or Verbose logs -#---------------------------------------- -function Write-Log -{ - [CmdletBinding(SupportsShouldProcess = $true)] - param - ( - [parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [System.String] - $message - ) - - if ($pscmdlet.ShouldProcess($message, $null, $null)) - { - Write-Verbose -Message $message - } -} - -# WriteFile is a helper function used to write the content to the file -function WriteFile -{ - param( - [parameter(Mandatory)] - [string] - $Value, - - [parameter(Mandatory)] - [string] - $Path) - - try - { - [system.io.streamwriter]$stream = New-Object -TypeName system.io.StreamWriter -ArgumentList ($Path, $false) - try - { - [void] $stream.Write($Value) - } - finally - { - if ($stream) - { - $stream.Close() - } - } - } - catch - { - $errorMessage = $LocalizedData.FileReadError -f $Path - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId InvalidPathSpecified - Update-ConfigurationErrorCount - } -} - -# -# ReadEnvironmentFile imports the contents of a -# file as ConfigurationData -# -function ReadEnvironmentFile -{ - param( - [parameter(Mandatory)] - [string] - $FilePath) - - try - { - $resolvedPath = Resolve-Path $FilePath - } - catch - { - $errorMessage = $LocalizedData.FilePathError -f $FilePath - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId InvalidPathSpecified - Update-ConfigurationErrorCount - } - - try - { - $content = Get-Content $resolvedPath -Raw - $sb = [scriptblock]::Create($content) - $sb.CheckRestrictedLanguage($null, $null, $true) - $sb.Invoke() - } - catch - { - $errorMessage = $LocalizedData.EnvironmentContentError -f $FilePath - $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage - Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId InvalidEnvironmentContentSpecified - Update-ConfigurationErrorCount - } -} - -function Get-DSCResourceModules -{ - $listPSModuleFolders = $env:PSModulePath.Split(";") - $dscModuleFolderList = [System.Collections.Generic.HashSet[System.String]]::new() - - foreach ($folder in $listPSModuleFolders) - { - $folder = $folder.Trim() - if (!(Test-Path $folder)) - { - continue - } - - foreach($moduleFolder in Get-ChildItem $folder -Directory) - { - $addModule = $false - - $dscFolders = Get-childitem "$($moduleFolder.FullName)\DscResources","$($moduleFolder.FullName)\*\DscResources" -ErrorAction Ignore - if($dscFolders -ne $null) - { - $addModule = $true - } - - if(-not $addModule) - { - foreach($psd1 in Get-ChildItem -Recurse -Filter "$($moduleFolder.Name).psd1" -Path $moduleFolder.fullname -Depth 2) - { - $containsDSCResource = select-string -LiteralPath $psd1 -pattern '^(?!#).*\bDscResourcesToExport\b.*' - if($containsDSCResource -ne $null) - { - $addModule = $true - } - } - } - - if($addModule) - { - $dscModuleFolderList.Add($moduleFolder.Name) - } - } - } - - $dscModuleFolderList -} - -########################################################### -# Get-DSCResource -########################################################### - -# -# Gets DSC resources on the machine. Allows to filter on a particular resource. -# It parses all the resources defined in the schema.mof file and also the composite -# resources defined or imported from PowerShell modules -# -function Get-DscResource -{ - [CmdletBinding(HelpUri = 'https://go.microsoft.com/fwlink/?LinkId=403985')] - [OutputType('Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo[]')] - [OutputType('string[]')] - param ( - [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [ValidateNotNullOrEmpty()] - [string[]] - $Name, - [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] - [ValidateNotNullOrEmpty()] - [Object] - $Module, - - [Parameter()] - [switch] - $Syntax - ) - - Begin - { - $initialized = $false - $ModuleString = $null - Write-Progress -Id 1 -Activity $LocalizedData.LoadingDefaultCimKeywords - - $keywordErrors = New-Object -TypeName 'System.Collections.ObjectModel.Collection[System.Exception]' - - # Load the default Inbox providers (keyword) in cache, also allow caching the resources from multiple versions of modules. - [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::LoadDefaultCimKeywords($keywordErrors, $true) - - foreach($ex in $keywordErrors) - { - Write-Error -Exception $ex - if($ex.InnerException) - { - Write-Error -Exception $ex.InnerException - } - } - - Write-Progress -Id 2 -Activity $LocalizedData.GettingModuleList - - $initialized = $true - - if($Module) #Pick from the specified module if there's one - { - $moduleSpecificName = [System.Management.Automation.LanguagePrimitives]::ConvertTo($Module,[Microsoft.PowerShell.Commands.ModuleSpecification]) - $modules = Get-Module -ListAvailable -FullyQualifiedName $moduleSpecificName - if($Module -is [System.Collections.Hashtable]) - { - $ModuleString = $Module.ModuleName - } - else - { - $ModuleString = $Module - } - } - else - { - $modules = Get-Module -ListAvailable -Name (Get-DSCResourceModules) - } - - foreach ($mod in $modules) - { - if ($mod.ExportedDscResources.Count -gt 0) - { - $null = ImportClassResourcesFromModule -Module $mod -Resources * -functionsToDefine $functionsToDefine - } - - $dscResources = Join-Path -Path $mod.ModuleBase -ChildPath 'DSCResources' - if(Test-Path $dscResources) - { - foreach ($resource in Get-ChildItem -Path $dscResources -Directory -Name) - { - $null = ImportCimAndScriptKeywordsFromModule -Module $mod -Resource $resource -functionsToDefine $functionsToDefine - } - } - } - - $Resources = @() - } - - Process - { - try - { - if ($Name -ne $null) - { - $nameMessage = $LocalizedData.GetDscResourceInputName -f @('Name', [system.string]::Join(', ', $Name)) - Write-Verbose -Message $nameMessage - } - if($Module -and !$modules) - { - #Return if no modules were found with the required specification - Write-Warning -Message $LocalizedData.NoModulesPresent - return - } - $ignoreResourceParameters = @('InstanceName', 'OutputPath', 'ConfigurationData') + [System.Management.Automation.Cmdlet]::CommonParameters + [System.Management.Automation.Cmdlet]::OptionalCommonParameters - - $patterns = GetPatterns $Name - - Write-Progress -Id 3 -Activity $LocalizedData.CreatingResourceList - - # Get resources for CIM cache - $keywords = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::GetCachedKeywords() | Where-Object -FilterScript { - (!$_.IsReservedKeyword) -and ($_.ResourceName -ne $null) -and !(IsHiddenResource $_.ResourceName) -and (![bool]$Module -or ($_.ImplementingModule -like $ModuleString)) - } - - $Resources += $keywords | - ForEach-Object -Process { - GetResourceFromKeyword -keyword $_ -patterns $patterns -modules $modules - } | - Where-Object -FilterScript { - $_ -ne $null - } - - # Get composite resources - $Resources += Get-Command -CommandType Configuration | - ForEach-Object -Process { - GetCompositeResource $patterns $_ $ignoreResourceParameters -modules $modules - } | - Where-Object -FilterScript { - $_ -ne $null -and (![bool]$ModuleString -or ($_.Module -like $ModuleString)) -and - ($_.Path -and ((Split-Path -Leaf $_.Path) -eq "$($_.Name).schema.psm1")) - } - - # check whether all resources are found - CheckResourceFound $Name $Resources - } - catch - { - if ($initialized) - { - [System.Management.Automation.Language.DynamicKeyword]::Reset() - [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ClearCache() - - $initialized = $false - } - - throw $_ - } - } - - End - { - $Resources = $Resources | Sort-Object -Property Module, Name - foreach ($resource in $Resources) - { - # return formatted string if required - if ($Syntax) - { - GetSyntax $resource | Write-Output - } - else - { - Write-Output -InputObject $resource - } - } - - if ($initialized) - { - [System.Management.Automation.Language.DynamicKeyword]::Reset() - [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ClearCache() - - $initialized = $false - } - } -} - -# -# Get DSC resoruce for a dynamic keyword -# -function GetResourceFromKeyword -{ - [OutputType('Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo')] - param ( - [Parameter(Mandatory)] - [System.Management.Automation.Language.DynamicKeyword] - $keyword, - [System.Management.Automation.WildcardPattern[]] - $patterns, - [Parameter(Mandatory)] - [System.Management.Automation.PSModuleInfo[]] - $modules - ) - - # Find whether $name follows the pattern - $matched = (IsPatternMatched $patterns $keyword.ResourceName) -or (IsPatternMatched $patterns $keyword.Keyword) - if ($matched -eq $false) - { - $message = $LocalizedData.ResourceNotMatched -f @($keyword.Keyword) - Write-Verbose -Message ($message) - return - } - else - { - $message = $LocalizedData.CreatingResource -f @($keyword.Keyword) - Write-Verbose -Message $message - } - - $resource = New-Object -TypeName Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo - - $resource.ResourceType = $keyword.ResourceName - - if ($keyword.ResourceName -ne $keyword.Keyword) - { - $resource.FriendlyName = $keyword.Keyword - } - - $resource.Name = $keyword.Keyword - - $schemaFiles = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::GetFileDefiningClass($keyword.ResourceName) - if ($schemaFiles.Count) - { - # Find the correct schema file that matches module name and version - # if same module/version is installed in multiple locations, then pick the first schema file. - foreach ($schemaFileName in $schemaFiles){ - $moduleInfo = GetModule $modules $schemaFileName; - if ($moduleInfo.Name -eq $keyword.ImplementingModule -and $moduleInfo.Version -eq $keyword.ImplementingModuleVersion){ - break - } - } - - # if the class is not a resource we will ignore it except if it is DSC inbox resource. - if(-not $schemaFileName.StartsWith("$env:windir\system32\configuration",[stringComparison]::OrdinalIgnoreCase)) - { - $classesFromSchema = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::GetCachedClassByFileName($schemaFileName) - if( $classesFromSchema -ne $null) - { - # check if the resource is proper DSC resource that always derives from OMI_BaseResource. - $schemaToProcess = $classesFromSchema | ForEach-Object -Process { - if(($_.CimSystemProperties.ClassName -ieq $keyword.ResourceName) -and ($_.CimSuperClassName -ieq 'OMI_BaseResource')) - { - $_ - } - } - if( $schemaToProcess -eq $null) - { - return - } - } - } - - $message = $LocalizedData.SchemaFileForResource -f @($schemaFileName) - Write-Verbose -Message $message - - $resource.Module = $moduleInfo - $resource.Path = GetImplementingModulePath $schemaFileName - $resource.ParentPath = Split-Path $schemaFileName - } - else - { - $Module = $modules | Where-Object -FilterScript { - $_.Name -eq $keyword.ImplementingModule -and - $_.Version -eq $keyword.ImplementingModuleVersion - } - - # Get cim classes defined under $Module - $cachedClasses = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::GetCachedClassesForModule($Module) - - # Check if it is a DSC Resource that is always derived from OMI_BaseResource class. - $isDscResource = $false - foreach($cachedClasse in $cachedClasses) { - if($cachedClasse.CimSystemProperties.ClassName -ieq $keyword.Keyword -and ($cachedClasse.CimSuperClassName -ieq 'OMI_BaseResource')) - { - $isDscResource = $true - break - } - } - if(-not $isDscResource) - { - return - } - - if ($Module -and $Module.ExportedDscResources -contains $keyword.Keyword) - { - $resource.Module = $Module - $resource.Path = $Module.Path - $resource.ParentPath = Split-Path -Path $Module.Path - } - } - - if ([system.string]::IsNullOrEmpty($resource.Path) -eq $false) - { - $resource.ImplementedAs = [Microsoft.PowerShell.DesiredStateConfiguration.ImplementedAsType]::PowerShell - } - else - { - $resource.ImplementedAs = [Microsoft.PowerShell.DesiredStateConfiguration.ImplementedAsType]::Binary - } - - if ($resource.Module -ne $null) - { - $resource.CompanyName = $resource.Module.CompanyName - } - - # add properties - $keyword.Properties.Values | ForEach-Object -Process { - AddDscResourceProperty $resource $_ - } - - # sort properties - $updatedProperties = $resource.Properties | Sort-Object -Property @{ - expression = 'IsMandatory' - Descending = $true - }, @{ - expression = 'Name' - Ascending = $true - } - $resource.UpdateProperties($updatedProperties) - - return $resource -} - -# -# Gets composite resource -# -function GetCompositeResource -{ - [OutputType('Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo')] - param ( - [System.Management.Automation.WildcardPattern[]] - $patterns, - [Parameter(Mandatory)] - [System.Management.Automation.ConfigurationInfo] - $configInfo, - $ignoreParameters, - [Parameter(Mandatory)] - [System.Management.Automation.PSModuleInfo[]] - $modules - ) - - # Find whether $name follows the pattern - $matched = IsPatternMatched $patterns $configInfo.Name - if ($matched -eq $false) - { - $message = $LocalizedData.ResourceNotMatched -f @($configInfo.Name) - Write-Verbose -Message ($message) - - return $null - } - else - { - $message = $LocalizedData.CreatingResource -f @($configInfo.Name) - Write-Verbose -Message $message - } - - $resource = New-Object -TypeName Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo - - $resource.ResourceType = $configInfo.Name - $resource.FriendlyName = $null - $resource.Name = $configInfo.Name - $resource.ImplementedAs = [Microsoft.PowerShell.DesiredStateConfiguration.ImplementedAsType]::Composite - - if ($configInfo.Module -ne $null) - { - $resource.Module = GetModule $modules $configInfo.Module.Path - if($resource.Module -eq $null) - { - $resource.Module = $configInfo.Module - } - $resource.CompanyName = $configInfo.Module.CompanyName - $resource.Path = $configInfo.Module.Path - $resource.ParentPath = Split-Path -Path $resource.Path - } - - # add properties - $configInfo.Parameters.Values | ForEach-Object -Process { - AddDscResourcePropertyFromMetadata $resource $_ $ignoreParameters - } - - return $resource -} - -# -# Adds property to a DSC resource -# -function AddDscResourceProperty -{ - param ( - [Parameter(Mandatory)] - [Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo] - $dscresource, - [Parameter(Mandatory)] - $property - ) - - $convertTypeMap = @{ - 'MSFT_Credential'='[PSCredential]'; - 'MSFT_KeyValuePair'='[HashTable]'; - 'MSFT_KeyValuePair[]'='[HashTable]' - } - - $ignoreProperties = @('ResourceId', 'ConfigurationName') - if ($ignoreProperties -contains $property.Name) - { - return - } - - $dscProperty = New-Object -TypeName Microsoft.PowerShell.DesiredStateConfiguration.DscResourcePropertyInfo - $dscProperty.Name = $property.Name - if ($convertTypeMap.ContainsKey($property.TypeConstraint)) - { - $type = $convertTypeMap[$property.TypeConstraint] - } - else - { - $Type = [System.Management.Automation.LanguagePrimitives]::ConvertTypeNameToPSTypeName($property.TypeConstraint) - if([string]::IsNullOrEmpty($Type)) - { - $Type = "[$($property.TypeConstraint)]" - } - } - - if ($property.ValueMap -ne $null) - { - $property.ValueMap.Keys | - Sort-Object | - ForEach-Object -Process { - $dscProperty.Values.Add($_) - } - } - - $dscProperty.PropertyType = $Type - $dscProperty.IsMandatory = $property.Mandatory - - $dscresource.Properties.Add($dscProperty) -} - -# -# Adds property to a DSC resource -# -function AddDscResourcePropertyFromMetadata -{ - param ( - [Parameter(Mandatory)] - [Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo] - $dscresource, - [Parameter(Mandatory)] - [System.Management.Automation.ParameterMetadata] - $parameter, - $ignoreParameters - ) - - if ($ignoreParameters -contains $parameter.Name) - { - return - } - - $dscProperty = New-Object -TypeName Microsoft.PowerShell.DesiredStateConfiguration.DscResourcePropertyInfo - $dscProperty.Name = $parameter.Name - - # adding [] in Type name to keep it in sync with the name returned from LanguagePrimitives.ConvertTypeNameToPSTypeName - $dscProperty.PropertyType = '[' +$parameter.ParameterType.Name + ']' - $dscProperty.IsMandatory = $parameter.Attributes.Mandatory - - $dscresource.Properties.Add($dscProperty) -} - -# -# Gets syntax for a DSC resource -# -function GetSyntax -{ - [OutputType('string')] - param ( - [Parameter(Mandatory)] - [Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo] - $dscresource - ) - - $output = $dscresource.Name + " [String] #ResourceName`n" - $output += "{`n" - foreach ($property in $dscresource.Properties) - { - $output += ' ' - if ($property.IsMandatory -eq $false) - { - $output += '[' - } - - $output += $property.Name - - $output += ' = ' + $property.PropertyType + '' - - # Add possible values - if ($property.Values.Count -gt 0) - { - $output += '{ ' + [system.string]::Join(' | ', $property.Values) + ' }' - } - - if ($property.IsMandatory -eq $false) - { - $output += ']' - } - - $output += "`n" - } - - $output += "}`n" - - return $output -} - -# -# Checks whether a resource is found or not -# -function CheckResourceFound($names, $Resources) -{ - if ($names -eq $null) - { - return - } - - $namesWithoutWildcards = $names | Where-Object -FilterScript { - [System.Management.Automation.WildcardPattern]::ContainsWildcardCharacters($_) -eq $false - } - - foreach ($Name in $namesWithoutWildcards) - { - $foundResources = $Resources | Where-Object -FilterScript { - ($_.Name -eq $Name) -or ($_.ResourceType -eq $Name) - } - if ($foundResources.Count -eq 0) - { - $errorMessage = $LocalizedData.ResourceNotFound -f @($Name, 'Resource') - Write-Error -Message $errorMessage - } - } -} - -# -# Get implementing module path -# -function GetImplementingModulePath -{ - param ( - [Parameter(Mandatory)] - [string] - $schemaFileName - ) - - $moduleFileName = ($schemaFileName -replace ".schema.mof$", '') + '.psd1' - if (Test-Path $moduleFileName) - { - return $moduleFileName - } - - $moduleFileName = ($schemaFileName -replace ".schema.mof$", '') + '.psm1' - if (Test-Path $moduleFileName) - { - return $moduleFileName - } - - return -} - -# -# Gets module for a DSC resource -# -function GetModule -{ - [OutputType('System.Management.Automation.PSModuleInfo')] - param ( - [Parameter(Mandatory)] - [System.Management.Automation.PSModuleInfo[]] - $modules, - [Parameter(Mandatory)] - [string] - $schemaFileName - ) - - if($schemaFileName -eq $null) - { - return $null - } - - $schemaFileExt = $null - if ($schemaFileName -match '.schema.mof') - { - $schemaFileExt = ".schema.mof$" - } - - if ($schemaFileName -match '.schema.psm1') - { - $schemaFileExt = ".schema.psm1$" - } - - if(!$schemaFileExt) - { - return $null - } - - # get module from parent directory. - # Desired structure is : /DSCResources//schema.File - $validResource = $false - $schemaDirectory = Split-Path $schemaFileName - if($schemaDirectory) - { - $subDirectory = [System.IO.Directory]::GetParent($schemaDirectory) - - if ($subDirectory -and ($subDirectory.Name -eq 'DSCResources') -and $subDirectory.Parent) - { - $moduleDirectory = [System.IO.Directory]::GetParent($subDirectory) - $results = $modules | Where-Object -FilterScript { - $_.ModuleBase -eq $subDirectory.Parent.FullName - } - - if ($results) - { - # Log Resource is internally handled by the CA. There is no formal provider for it. - if ($schemaFileName -match 'MSFT_LogResource') - { - $validResource = $true - } - else - { - # check for proper resource module - foreach ($ext in @('.psd1', '.psm1', '.dll', '.cdxml')) - { - $resModuleFileName = ($schemaFileName -replace $schemaFileExt, '') + $ext - if(Test-Path($resModuleFileName)) - { - $validResource = $true - break - } - } - } - } - } - } - - if ($results -and $validResource) - { - return $results[0] - } - else - { - return $null - } -} - -# -# Checks whether a resource is hidden or not -# -function IsHiddenResource -{ - param ( - [Parameter(Mandatory)] - [string] - $ResourceName - ) - - $hiddenResources = @( - 'OMI_BaseResource', - 'MSFT_KeyValuePair', - 'MSFT_BaseConfigurationProviderRegistration', - 'MSFT_CimConfigurationProviderRegistration', - 'MSFT_PSConfigurationProviderRegistration', - 'OMI_ConfigurationDocument', - 'MSFT_Credential', - 'MSFT_DSCMetaConfiguration', - 'OMI_ConfigurationDownloadManager', - 'OMI_ResourceModuleManager', - 'OMI_ReportManager', - 'MSFT_FileDownloadManager', - 'MSFT_WebDownloadManager', - 'MSFT_FileResourceManager', - 'MSFT_WebResourceManager', - 'MSFT_WebReportManager', - 'OMI_MetaConfigurationResource', - 'MSFT_PartialConfiguration', - 'MSFT_DSCMetaConfigurationV2' - ) - - return $hiddenResources -contains $ResourceName -} - -# -# Gets patterns for names -# -function GetPatterns -{ - [OutputType('System.Management.Automation.WildcardPattern[]')] - param ( - [string[]] - $names - ) - - $patterns = @() - - if ($names -eq $null) - { - return $patterns - } - - foreach ($Name in $names) - { - $patterns += New-Object -TypeName System.Management.Automation.WildcardPattern -ArgumentList @($Name, [System.Management.Automation.WildcardOptions]::IgnoreCase) - } - - return $patterns -} - -# -# Checks whether an input name matches one of the patterns -# $pattern is not expected to have an empty or null values -# -function IsPatternMatched -{ - [OutputType('bool')] - param ( - [System.Management.Automation.WildcardPattern[]] - $patterns, - [Parameter(Mandatory)] - [string] - $Name - ) - - if ($patterns -eq $null) - { - return $true - } - - foreach ($pattern in $patterns) - { - if ($pattern.IsMatch($Name)) - { - return $true - } - } - - return $false -} - -Export-ModuleMember -Function Get-DscResource -########################################################### - - -########################################################### -# Aliases -########################################################### -New-Alias -Name 'sacfg' -Value 'Start-DSCConfiguration' -New-Alias -Name 'tcfg' -Value 'Test-DSCConfiguration' -New-Alias -Name 'gcfg' -Value 'Get-DSCConfiguration' -New-Alias -Name 'rtcfg' -Value 'Restore-DSCConfiguration' -New-Alias -Name 'glcm' -Value 'Get-DSCLocalConfigurationManager' -New-Alias -Name 'slcm' -Value 'Set-DSCLocalConfigurationManager' -New-Alias -Name 'pbcfg' -Value 'Publish-DSCConfiguration' -New-Alias -Name 'ulcm' -Value 'Update-DscLocalConfigurationManager' -New-Alias -Name 'upcfg' -Value 'Update-DSCConfiguration' -New-Alias -Name 'gcfgs' -Value 'Get-DscConfigurationStatus' - -Export-ModuleMember -Alias * \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.types.ps1xml b/newton-cn/bin/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.types.ps1xml deleted file mode 100644 index f816fe6..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.types.ps1xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - GetDscConfigurationType - - - CimClassName - - if ($this.CimClass -ne $null) { $this.CimClass.CimClassName } else {""} - - - - - - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/MSFT_PartialConfiguration - - - ToString - - - - - - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/OMI_ConfigurationDownloadManager - - - ToString - - - - - - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/OMI_ResourceModuleManager - - - ToString - - - - - - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/OMI_ReportManager - - - ToString - - - - - - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/MSFT_ResourceInDesiredState - - - ToString - - - - - - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/MSFT_ResourceNotInDesiredState - - - ToString - - - - - - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/MSFT_DSCConfigurationStatus - - - ToString - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/PSDscXMachine.psm1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/PSDscXMachine.psm1 deleted file mode 100644 index 494da2f..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/PSDscXMachine.psm1 +++ /dev/null @@ -1,376 +0,0 @@ -# internal functions for WaitForX - -# Fallback message strings in en-US -DATA localizedData -{ - # culture = "en-US" - ConvertFrom-StringData @' - InvalidInputParam = Invalid input parameters! - InvalidInputThrottle = Invalid input throttle limit! - CheckRemoteState = Checking remote resource '{0}' state ... - RemoteResourceNotReady = Remote resource '{0}' is not ready. - RemoteResourceNotReadyAndRetry = Remote resource '{0}' is not ready. Retrying after {1} second(s) - RemoteResourceReady = Remote resource '{0}' is ready - RemoteConfigNotReady = Resource '{0}' on machine(s) '{1}' is not ready. - RemoteConfigNotReadyWithRetry = Resource '{0}' on machine(s) '{1}' is not ready after '{2}' retries with retry interval of '{3}' second(s). - NodeNameHasDuplicates = NodeName contains duplicate machine names! Check the NodeName and expected MinimalNumberOfMachineInState parameters. - RemoteConnectivityFailure = Cannot create remote session to machine '{0}' -'@ -} -Import-LocalizedData LocalizedData -filename PSDSCxMachine.strings.psd1 - -$script:NodeInDesiredState = @() -$script:NodeNameIsDuplicated = $false - -function Get-_InternalPSDscXMachineTR -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $RemoteResourceId, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string[]] $RemoteMachine, - - [Uint32] $MinimalNumberOfMachineInState = $RemoteMachine.Length, - - [ValidateRange(1,[Uint64]::MaxValue)] - [Uint64] $RetryIntervalSec = 1, - - [Uint32] $RetryCount = 0, - - [Uint32] $ThrottleLimit = 32 - ) - - return @{ - ResourceName = $RemoteResourceId - NodeName = $RemoteMachine - RetryIntervalSec = $RetryIntervalSec - RetryCount = $RetryCount - ThrottleLimit = $ThrottleLimit - } -} - -function IsAccessDeniedIssue -{ - param ( $er) - - $ci = $er.CategoryInfo - [xml]$xml = $er.Exception.Message - return ($ci.TargetName -ilike "*MSFT_DscProxy") -and ($er.Exception.HResult -eq 0x80131509 ) -and ( -not (($xml.ChildNodes.Count -gt 0) -and ($xml.ChildNodes[0].Code -eq 5))) -} - -function Set-_InternalPSDscXMachineTR -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $RemoteResourceId, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string[]] $RemoteMachine, - - [Uint32] $MinimalNumberOfMachineInState = $RemoteMachine.Length, - - [ValidateRange(1,[Uint64]::MaxValue)] - [Uint64] $RetryIntervalSec = 1, - - [Uint32] $RetryCount = 0, - - [Uint32] $ThrottleLimit = 32 - ) - - if ($MinimalNumberOfMachineInState -gt $remoteMachine.Count) - { - throw $localizedData.InvalidInputParam - } - - if ($ThrottleLimit -eq 0) - { - throw $localizedData.InvalidInputThrottle - } - - $bState = $false - $retry = 0 - - Write-Debug -Message ($localizedData.CheckRemoteState -f $RemoteResourceId) - for ($retry = 0; $retry -lt $RetryCount; $retry++) - { - Write-Verbose -Message ($localizedData.RemoteResourceNotReadyAndRetry -f $RemoteResourceId, $RetryIntervalSec) - Sleep -Seconds $RetryIntervalSec - - $Iterations = [math]::Ceiling($RemoteMachine.Count / $ThrottleLimit) - $initialItr = $retry * $Iterations - for ($itr = $initialItr; $itr -lt $initialItr+$Iterations; $itr++) - { - try - { - $machinesToConnect = Get-MachinesToEnsureConnection -remoteMachine $remoteMachine -iteration $itr -throttleLimit $ThrottleLimit - if ($machinesToConnect.Count -eq 0) - { - $bState = $true; - } - else - { - $bState = Get-RemoteResourceState -remoteMachine $machinesToConnect -RemoteResourceId $RemoteResourceId -MinimalNumberOfMachineInState $MinimalNumberOfMachineInState - } - } - catch - { - if (IsAccessDeniedIssue -er $_) - { - Write-Debug -Message "Exception: $_" - } - else - { - Write-Verbose -Message "Exception: $_" - } - } - - if ($bState) - { - Write-Verbose -Message ($localizedData.RemoteResourceReady -f $RemoteResourceId) - return - } - } - } - if ($script:NodeNameIsDuplicated) - { - # reset $NodeNameIsDuplicated - $script:NodeNameIsDuplicated = $false - throw $localizedData.NodeNameHasDuplicates - } - else - { - if ($RetryCount -gt 0) - { - throw ($localizedData.RemoteConfigNotReadyWithRetry -f $RemoteResourceId, "$($RemoteMachine)", $RetryCount, $RetryIntervalSec ) - } - else - { - throw ($localizedData.RemoteConfigNotReady -f $RemoteResourceId, "$($RemoteMachine)") - } - } -} - -function Test-_InternalPSDscXMachineTR -{ - param - ( - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string] $RemoteResourceId, - - [parameter(Mandatory)] - [ValidateNotNullOrEmpty()] - [string[]] $RemoteMachine, - - [Uint32] $MinimalNumberOfMachineInState = $RemoteMachine.Length, - - [ValidateRange(1,[Uint64]::MaxValue)] - [Uint64] $RetryIntervalSec = 1, - - [Uint32] $RetryCount = 0, - - [Uint32] $ThrottleLimit = 32 - ) - - if ($MinimalNumberOfMachineInState -gt $remoteMachine.Count) - { - throw $localizedData.InvalidInputParam - } - - if ($ThrottleLimit -eq 0) - { - throw $localizedData.InvalidInputThrottle - } - - $bState = $false - - Write-Debug -Message ($localizedData.CheckRemoteState -f $RemoteResourceId) - - $script:NodeInDesiredState = @() - - $TotalRetryCount = 1 - $MaxRetryCount = 5 - for ($retry = 0; $retry -lt $TotalRetryCount; $retry++) - { - if ($retry -gt 0) { Sleep -Milliseconds 200 } - - # according to algorithm described in Get-MachinesToEnusreConnection, the number of iterations to cover all machines at least once is calculated as stoping condition in following for loop - for ($iteration = 0; $iteration -lt [math]::Ceiling($RemoteMachine.Count / $ThrottleLimit); $iteration++) - { - try - { - $machinesToConnect = Get-MachinesToEnsureConnection -remoteMachine $remoteMachine -iteration $iteration -throttleLimit $ThrottleLimit - $bState = Get-RemoteResourceState -remoteMachine $machinesToConnect -RemoteResourceId $RemoteResourceId -MinimalNumberOfMachineInState $MinimalNumberOfMachineInState - } - catch - { - if (IsAccessDeniedIssue -er $_) - { - Write-Debug -Message "Exception: $_" - $TotalRetryCount = $MaxRetryCount - } - else - { - Write-Verbose -Message "Exception: $_" - $TotalRetryCount = $retry # stop TotalRetryCount as non-connectivity issue. - } - } - - if ($bState) - { - Write-Verbose -Message ($localizedData.RemoteResourceReady -f $RemoteResourceId) - return $true - } - } - } - - Write-Verbose -Message ($localizedData.RemoteResourceNotReady -f $RemoteResourceId) - - return $false -} - -function Get-MachinesToEnsureConnection -{ - param( - [ValidateNotNullOrEmpty()][string[]] $remoteMachine, - [int] $iteration, - [int] $throttleLimit - ) - - $allMachines = @() - foreach ($machine in $remoteMachine) - { - if ($machine -notin $script:NodeInDesiredState) - { - $allMachines += $machine - } - } - - <# the algorithm works like this: - suppose we have 10 machines (0-9) and throttle limit is 3 - following is the machines alively connected in each iteration - iteration machines - 0 0,1,2 - 1 3,4,5 - 2 6,7,8 - 3 9,0,1 - 4 2,3,4 - ... - #> - - if ($throttleLimit -ge $allMachines.Count) - { - return $allMachines - } - else - { - $machinesToConnect = @() - $start = ($iteration * $throttleLimit) % ($allMachines.Count) - - $count = 0 - for ($i = $start; $i -lt $allMachines.Count -and $count -lt $throttleLimit; $i++) - { - $machinesToConnect += $allMachines[$i] - $count++ - } - - if ($count -lt $throttleLimit) - { - for ($i = 0; $i -lt ($throttleLimit - $count); $i++) - { - $machinesToConnect += $allMachines[$i] - } - } - return $machinesToConnect - } -} - -function Get-RemoteResourceState -{ - param ( - - [ValidateNotNullOrEmpty()][string[]] $remoteMachine, - [ValidateNotNullOrEmpty()][string] $RemoteResourceId, - [Uint32] $MinimalNumberOfMachineInState = $remoteMachine.Count - ) - - Write-Debug "Get-RemoteResourceState ..." - - if ($script:NodeInDesiredState.Count -eq $MinimalNumberOfMachineInState) - { - return $true - } - - $remoteMachineException = $null - - foreach ($machine in $remoteMachine) - { - Write-Debug "Get resource state on remoteMachine: $machine" - #Remove duplicate machine names from $remoteMachine list - if ($script:NodeInDesiredState -contains $machine) - { - $script:NodeNameIsDuplicated = $true - continue - } - try - { - if (Get-RemoteResourceStateOnMachine -RemoteResourceId $RemoteResourceId -MachineName $machine) - { - $script:NodeInDesiredState += $machine - - if ($script:NodeInDesiredState.Count -eq $MinimalNumberOfMachineInState) - { - return $true - } - } - else - { - Write-Debug "Resource $RemoteResourceId on machine $machine is not ready" - } - } - catch - { - # continue here to iterate every machine from $remoteMachine list - $remoteMachineException = $_ - } - } - # re-throw the original exception once browsing all the machines is complete - if($remoteMachineException -ne $null) - { - throw $remoteMachineException - } - - $false -} - -function Get-RemoteResourceStateOnMachine -{ - param ( - [ValidateNotNullOrEmpty()][string] $RemoteResourceId, - [ValidateNotNullOrEmpty()][string] $MachineName - ) - - Write-Debug "Get-RemoteResourceStateOnMachine on machine: $MachineName and resource: $RemoteRecourceId..." - - $buf = [Text.Encoding]::Unicode.GetBytes($RemoteResourceId) - $data = [System.Convert]::ToBase64String($buf) - - $result = Invoke-WSManAction -ResourceURI http://schemas.microsoft.com/wbem/wsman/1/wmi/root/microsoft/windows/DesiredStateConfigurationProxy/MSFT_DscProxy ` - -action GetResourceState -ComputerName $MachineName -valueset @{ConfigurationData = "$data" } ` - -Authentication None - $retV = $result.State - - Write-Debug "Get state ($retV) on machine: $MachineName and resource: $RemoteRecourceId" - - return $retV -ieq 'true' -} - -Export-ModuleMember -Function *-_InternalPSDscXMachineTR - diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/Remove-DscConfigurationDocument.cdxml b/newton-cn/bin/Modules/PSDesiredStateConfiguration/Remove-DscConfigurationDocument.cdxml deleted file mode 100644 index bc6a8d4..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/Remove-DscConfigurationDocument.cdxml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - 2.0.0.0 - DscConfigurationDocument - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/Restore-DscConfiguration.cdxml b/newton-cn/bin/Modules/PSDesiredStateConfiguration/Restore-DscConfiguration.cdxml deleted file mode 100644 index e2d0865..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/Restore-DscConfiguration.cdxml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - 2.0.0.0 - DscConfiguration - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/Stop-DscConfiguration.cdxml b/newton-cn/bin/Modules/PSDesiredStateConfiguration/Stop-DscConfiguration.cdxml deleted file mode 100644 index ceb0502..0000000 --- a/newton-cn/bin/Modules/PSDesiredStateConfiguration/Stop-DscConfiguration.cdxml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - 2.0.0.0 - DscConfiguration - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/WebDownloadManager/WebDownloadManager.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/WebDownloadManager/WebDownloadManager.psd1 deleted file mode 100644 index 5c523bd..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/WebDownloadManager/WebDownloadManager.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/ko-KR/PSDSCxMachine.strings.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/ko-KR/PSDSCxMachine.strings.psd1 deleted file mode 100644 index 3eac90c..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/ko-KR/PSDSCxMachine.strings.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDesiredStateConfiguration/ko-KR/PSDesiredStateConfiguration.Resource.psd1 b/newton-cn/bin/Modules/PSDesiredStateConfiguration/ko-KR/PSDesiredStateConfiguration.Resource.psd1 deleted file mode 100644 index ce54e74..0000000 Binary files a/newton-cn/bin/Modules/PSDesiredStateConfiguration/ko-KR/PSDesiredStateConfiguration.Resource.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSDiagnostics/PSDiagnostics.psd1 b/newton-cn/bin/Modules/PSDiagnostics/PSDiagnostics.psd1 deleted file mode 100644 index ba9d444..0000000 --- a/newton-cn/bin/Modules/PSDiagnostics/PSDiagnostics.psd1 +++ /dev/null @@ -1,14 +0,0 @@ -@{ - GUID="c61d6278-02a3-4618-ae37-a524d40a7f44 " - Author="Microsoft Corporation" - CompanyName="Microsoft Corporation" - Copyright="© Microsoft Corporation. All rights reserved." - ModuleVersion="1.0.0.0" - PowerShellVersion = '5.1' - CLRVersion="2.0.50727" - ModuleToProcess="PSDiagnostics.psm1" - AliasesToExport = @() - CmdletsToExport = @() - FunctionsToExport="Disable-PSTrace","Disable-PSWSManCombinedTrace","Disable-WSManTrace","Enable-PSTrace","Enable-PSWSManCombinedTrace","Enable-WSManTrace","Get-LogProperties","Set-LogProperties","Start-Trace","Stop-Trace" - CompatiblePSEditions = @('Desktop') -} diff --git a/newton-cn/bin/Modules/PSDiagnostics/PSDiagnostics.psm1 b/newton-cn/bin/Modules/PSDiagnostics/PSDiagnostics.psm1 deleted file mode 100644 index bc893f1..0000000 Binary files a/newton-cn/bin/Modules/PSDiagnostics/PSDiagnostics.psm1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSScheduledJob/PSScheduledJob.Format.ps1xml b/newton-cn/bin/Modules/PSScheduledJob/PSScheduledJob.Format.ps1xml deleted file mode 100644 index 94605a6..0000000 Binary files a/newton-cn/bin/Modules/PSScheduledJob/PSScheduledJob.Format.ps1xml and /dev/null differ diff --git a/newton-cn/bin/Modules/PSScheduledJob/PSScheduledJob.psd1 b/newton-cn/bin/Modules/PSScheduledJob/PSScheduledJob.psd1 deleted file mode 100644 index 0c0ff94..0000000 --- a/newton-cn/bin/Modules/PSScheduledJob/PSScheduledJob.psd1 +++ /dev/null @@ -1,34 +0,0 @@ -@{ - -ModuleToProcess = 'Microsoft.PowerShell.ScheduledJob.dll' - -ModuleVersion = '1.1.0.0' - -GUID = '50cdb55f-5ab7-489f-9e94-4ec21ff51e59' - -Author = 'Microsoft Corporation' - -CompanyName = 'Microsoft Corporation' - -Copyright = '© Microsoft Corporation. All rights reserved.' - -PowerShellVersion = '5.1' - -CLRVersion = '4.0' - -TypesToProcess = 'PSScheduledJob.types.ps1xml' - -FormatsToProcess="PSScheduledJob.Format.ps1xml" - -CmdletsToExport = 'New-JobTrigger', 'Add-JobTrigger', 'Remove-JobTrigger', - 'Get-JobTrigger', 'Set-JobTrigger', 'Enable-JobTrigger', - 'Disable-JobTrigger', 'New-ScheduledJobOption', 'Get-ScheduledJobOption', - 'Set-ScheduledJobOption', 'Register-ScheduledJob', 'Get-ScheduledJob', - 'Set-ScheduledJob', 'Unregister-ScheduledJob', 'Enable-ScheduledJob', - 'Disable-ScheduledJob' -AliasesToExport = @() -FunctionsToExport = @() - -HelpInfoURI = 'https://go.microsoft.com/fwlink/?linkid=390816' -CompatiblePSEditions = @('Desktop') -} diff --git a/newton-cn/bin/Modules/PSScheduledJob/PSScheduledJob.types.ps1xml b/newton-cn/bin/Modules/PSScheduledJob/PSScheduledJob.types.ps1xml deleted file mode 100644 index 5476073..0000000 Binary files a/newton-cn/bin/Modules/PSScheduledJob/PSScheduledJob.types.ps1xml and /dev/null differ diff --git a/newton-cn/bin/Modules/PSWorkflow/PSWorkflow.psd1 b/newton-cn/bin/Modules/PSWorkflow/PSWorkflow.psd1 deleted file mode 100644 index b618efe..0000000 --- a/newton-cn/bin/Modules/PSWorkflow/PSWorkflow.psd1 +++ /dev/null @@ -1,16 +0,0 @@ -@{ -GUID="{3b6cc51d-c096-4b38-b78d-0fed6277096a}" -Author="Microsoft Corporation" -CompanyName="Microsoft Corporation" -Copyright="© Microsoft Corporation. All rights reserved." -ModuleVersion="2.0.0.0" -PowerShellVersion = '5.1' -CLRVersion="4.0" -CmdletsToExport='New-PSWorkflowExecutionOption' -AliasesToExport = 'nwsn' -FunctionsToExport = 'New-PSWorkflowSession' -NestedModules="Microsoft.PowerShell.Activities","Microsoft.PowerShell.Workflow.ServiceCore","PSWorkflow.psm1" -TypesToProcess="PSWorkflow.types.ps1xml" -HelpInfoURI = 'https://go.microsoft.com/fwlink/?linkid=390817' -CompatiblePSEditions = @('Desktop') -} diff --git a/newton-cn/bin/Modules/PSWorkflow/PSWorkflow.psm1 b/newton-cn/bin/Modules/PSWorkflow/PSWorkflow.psm1 deleted file mode 100644 index ea10548..0000000 Binary files a/newton-cn/bin/Modules/PSWorkflow/PSWorkflow.psm1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PSWorkflow/PSWorkflow.types.ps1xml b/newton-cn/bin/Modules/PSWorkflow/PSWorkflow.types.ps1xml deleted file mode 100644 index 267a72e..0000000 Binary files a/newton-cn/bin/Modules/PSWorkflow/PSWorkflow.types.ps1xml and /dev/null differ diff --git a/newton-cn/bin/Modules/PSWorkflowUtility/PSWorkflowUtility.psd1 b/newton-cn/bin/Modules/PSWorkflowUtility/PSWorkflowUtility.psd1 deleted file mode 100644 index 6ea66b7..0000000 --- a/newton-cn/bin/Modules/PSWorkflowUtility/PSWorkflowUtility.psd1 +++ /dev/null @@ -1,15 +0,0 @@ -@{ -GUID="{e40bae2f-9558-479f-939b-e52407a19c86}" -Author="Microsoft Corporation" -CompanyName="Microsoft Corporation" -Copyright="© Microsoft Corporation. All rights reserved." -ModuleVersion="1.0.0.0" -PowerShellVersion = '5.1' -CLRVersion="4.0" -AliasesToExport = @() -CmdletsToExport = @() -FunctionsToExport = 'Invoke-AsWorkflow' -NestedModules="PSWorkflowUtility.psm1" -HelpInfoURI = 'https://go.microsoft.com/fwlink/?linkid=390818' -CompatiblePSEditions = @('Desktop') -} diff --git a/newton-cn/bin/Modules/PSWorkflowUtility/PSWorkflowUtility.psm1 b/newton-cn/bin/Modules/PSWorkflowUtility/PSWorkflowUtility.psm1 deleted file mode 100644 index 839010c..0000000 Binary files a/newton-cn/bin/Modules/PSWorkflowUtility/PSWorkflowUtility.psm1 and /dev/null differ diff --git a/newton-cn/bin/Modules/PcsvDevice/CIM_PhysicalComputerSystemView.cdxml b/newton-cn/bin/Modules/PcsvDevice/CIM_PhysicalComputerSystemView.cdxml deleted file mode 100644 index 685a375..0000000 --- a/newton-cn/bin/Modules/PcsvDevice/CIM_PhysicalComputerSystemView.cdxml +++ /dev/null @@ -1,275 +0,0 @@ - - - - 1.0 - PcsvDevice - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - None - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/PcsvDevice/PcsvDevice.format.ps1xml b/newton-cn/bin/Modules/PcsvDevice/PcsvDevice.format.ps1xml deleted file mode 100644 index f776532..0000000 --- a/newton-cn/bin/Modules/PcsvDevice/PcsvDevice.format.ps1xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - Table - - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/HardwareManagement/MSFT_PCSVDevice - - - - - - 25 - - - - 25 - - - - 25 - - - - 15 - - - - 17 - - - - - - - TargetAddress - - - Manufacturer - - - Model - - - SerialNumber - - - Status - - - - - - - - diff --git a/newton-cn/bin/Modules/PcsvDevice/PcsvDevice.psd1 b/newton-cn/bin/Modules/PcsvDevice/PcsvDevice.psd1 deleted file mode 100644 index 843340a..0000000 --- a/newton-cn/bin/Modules/PcsvDevice/PcsvDevice.psd1 +++ /dev/null @@ -1,26 +0,0 @@ -@{ - GUID = '576ff287-7d01-46a3-8a88-94df7581a2b0' - Author="Microsoft Corporation" - CompanyName="Microsoft" - Copyright="© Microsoft. All rights reserved." - HelpInfoUri="http://go.microsoft.com/fwlink/?linkid=390809" - NestedModules = @('CIM_PhysicalComputerSystemView.cdxml') - ModuleVersion = '1.0.0.0' - AliasesToExport = @() - CmdletsToExport = @() - FunctionsToExport = @( - 'Get-PcsvDevice', - 'Start-PcsvDevice', - 'Stop-PcsvDevice', - 'Restart-PcsvDevice', - 'Set-PcsvDeviceBootConfiguration', - 'Set-PcsvDeviceNetworkConfiguration', - 'Set-PcsvDeviceUserPassword', - 'Clear-PcsvDeviceLog', - 'Get-PcsvDeviceLog' - ) - PowerShellVersion = '5.1' - TypesToProcess = @('PCSVDevice.types.ps1xml') - FormatsToProcess = @('PCSVDevice.format.ps1xml') - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/PcsvDevice/PcsvDevice.types.ps1xml b/newton-cn/bin/Modules/PcsvDevice/PcsvDevice.types.ps1xml deleted file mode 100644 index 050811f..0000000 --- a/newton-cn/bin/Modules/PcsvDevice/PcsvDevice.types.ps1xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/HardwareManagement/MSFT_PCSVDevice - - - Status - - $cimValue = $this.PSBase.CimInstanceProperties['EnabledState'].Value - if ($cimValue -eq $null) - { - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PcsvDevice.State]::Unknown - } - else - { - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PcsvDevice.State]$cimValue - } - - - - Name - - $this.PSBase.CimSystemProperties['ServerName'].Value - - - - - diff --git a/newton-cn/bin/Modules/PersistentMemory/Microsoft.Storage.PersistentMemory.Management.Commands.dll b/newton-cn/bin/Modules/PersistentMemory/Microsoft.Storage.PersistentMemory.Management.Commands.dll deleted file mode 100644 index b9db44c..0000000 Binary files a/newton-cn/bin/Modules/PersistentMemory/Microsoft.Storage.PersistentMemory.Management.Commands.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/PersistentMemory/PersistentMemory.psd1 b/newton-cn/bin/Modules/PersistentMemory/PersistentMemory.psd1 deleted file mode 100644 index d0d31c7..0000000 --- a/newton-cn/bin/Modules/PersistentMemory/PersistentMemory.psd1 +++ /dev/null @@ -1,53 +0,0 @@ -# -# Module manifest for the persistent memory management module. -# -# Generated by: Microsoft Corporation -# - -@{ - -# Script module or binary module file associated with this manifest -RootModule = 'Microsoft.Storage.PersistentMemory.Management.Commands.dll' - -# Version number of this module. -ModuleVersion = '1.0.0.0' - -# ID used to uniquely identify this module -GUID = 'E5905ED9-12BC-4765-B20D-40A37D69C3DD' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) Microsoft Corporation. All rights reserved.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '5.1' - -# Minimum version of the common language runtime (CLR) required by this module -CLRVersion = '4.0' - -# Format files (.ps1xml) to be loaded when importing this module -FormatsToProcess = @( - 'PmemPhysicalDevice.ps1xml', - 'PmemDisk.ps1xml' - ) - -# Cmdlets to export from this module -CmdletsToExport = @( - 'Get-PmemDisk', - 'Get-PmemPhysicalDevice', - 'Get-PmemUnusedRegion', - 'New-PmemDisk', - 'Remove-PmemDisk', - 'Initialize-PmemPhysicalDevice' - ) - -# HelpInfo - TBD -# HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=390775" - -CompatiblePSEditions = @('Desktop') -} diff --git a/newton-cn/bin/Modules/PersistentMemory/PmemDisk.ps1xml b/newton-cn/bin/Modules/PersistentMemory/PmemDisk.ps1xml deleted file mode 100644 index b526004..0000000 --- a/newton-cn/bin/Modules/PersistentMemory/PmemDisk.ps1xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - Persistent memory disk - - Microsoft.Storage.PersistentMemory.Management.PmemDisk - - - - - - - - - - - - - - - - - - DiskNumber - - - - "{0:#.##}" -f ($_.SizeInBytes / 1GB) + " GB" - - - HealthStatus - - - AtomicityType - - - CanBeRemoved - - - PhysicalDeviceIds - - - UnsafeShutdownCount - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PersistentMemory/PmemPhysicalDevice.ps1xml b/newton-cn/bin/Modules/PersistentMemory/PmemPhysicalDevice.ps1xml deleted file mode 100644 index 32824ef..0000000 --- a/newton-cn/bin/Modules/PersistentMemory/PmemPhysicalDevice.ps1xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - Physical persistent memory device - - Microsoft.Storage.PersistentMemory.Management.PmemPhysicalDevice - - - - - - - - - - - - - - - - - - - - - DeviceId - - - DeviceType - - - HealthStatus - - - OperationalStatus - - - PhysicalLocation - - - FirmwareRevision - - - - "{0:0.##}" -f ($_.PersistentMemorySizeInBytes / 1GB) + " GB" - - - - if ($_.VolatileMemorySizeInBytes -eq $null) { - "Unknown" - } else { - "{0:0.##}" -f ($_.VolatileMemorySizeInBytes / 1GB) + " GB" - } - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PersistentMemory/ko/Microsoft.Storage.PersistentMemory.Management.Commands.Resources.dll b/newton-cn/bin/Modules/PersistentMemory/ko/Microsoft.Storage.PersistentMemory.Management.Commands.Resources.dll deleted file mode 100644 index c00c048..0000000 Binary files a/newton-cn/bin/Modules/PersistentMemory/ko/Microsoft.Storage.PersistentMemory.Management.Commands.Resources.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/PersistentMemory/scmbridge.dll b/newton-cn/bin/Modules/PersistentMemory/scmbridge.dll deleted file mode 100644 index d176454..0000000 Binary files a/newton-cn/bin/Modules/PersistentMemory/scmbridge.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/PnpDevice/PnpDevice.Format.ps1xml b/newton-cn/bin/Modules/PnpDevice/PnpDevice.Format.ps1xml deleted file mode 100644 index fca9c64..0000000 --- a/newton-cn/bin/Modules/PnpDevice/PnpDevice.Format.ps1xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - Win32_PnPDeviceProperty.TableView - - Microsoft.Management.Infrastructure.CimInstance#ROOT/cimv2/Win32_PnPDeviceProperty - Microsoft.Management.Infrastructure.CimInstance#Win32_PnPDeviceProperty - - - - - 10 - - - 41 - - - 10 - - - 59 - - - - - - - InstanceId - - - KeyName - - - Type - - - Data - - - - - - - - PnpDevice.TableView - - Microsoft.Management.Infrastructure.CimInstance#Win32_PnPEntity - Microsoft.Management.Infrastructure.CimInstance#ROOT/cimv2/Win32_PnPEntity - - - - - 10 - - - 15 - - - 80 - - - 15 - - - - - - - Status - - - Class - - - FriendlyName - - - InstanceId - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PnpDevice/PnpDevice.Resource.psd1 b/newton-cn/bin/Modules/PnpDevice/PnpDevice.Resource.psd1 deleted file mode 100644 index 5458ed4..0000000 --- a/newton-cn/bin/Modules/PnpDevice/PnpDevice.Resource.psd1 +++ /dev/null @@ -1,72 +0,0 @@ -######################################################################################### -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# Localized PnpDevice.Resource.psd1 -# -######################################################################################### - -ConvertFrom-StringData @' -###PSLOC - IDS_PROB_NOT_CONFIGURED=This device is not configured correctly. {0} - IDS_PROB_DEVLOADERFAILED=Windows cannot load the driver for this device. {0} - IDS_PROB_OUT_OF_MEMORY=The driver for this device might be corrupted, or your system may be running low on memory or other resources. {0} - IDS_PROB_WRONG_TYPE=This device is not working properly. One of its drivers or your registry might be corrupted. {0} - IDS_PROB_LACKEDARBITRATOR=The driver for this device needs a resource that Windows cannot manage. {0} - IDS_PROB_BOOT_CONFIG_CONFLICT=The boot configuration for this device conflicts with other devices. {0} - IDS_PROB_FAILED_FILTER=Cannot filter. {0} - IDS_PROB_DEVLOADER_NOT_FOUND=The driver loader for the device is missing. {0} - IDS_PROB_INVALID_DATA=Windows cannot identify this hardware because it does not have a valid hardware identification number. {0}\r\n\r\nFor assistance, contact the hardware manufacturer. - IDS_PROB_FAILED_START=This device cannot start. {0} - IDS_PROB_LIAR=This device failed. {0} - IDS_PROB_NORMAL_CONFLICT=This device cannot find enough free resources that it can use. {0}\r\n\r\nIf you want to use this device, you will need to disable one of the other devices on this system. - IDS_PROB_NOT_VERIFIED=Windows cannot verify this device's resources. {0} - IDS_PROB_NEEDRESTART=This device cannot work properly until you restart your computer. {0} - IDS_PROB_REENUMERATION=This device is not working properly because there is probably a reenumeration problem. {0} - IDS_PROB_PARTIALCONFIG=Windows cannot identify all the resources this device uses. {0} - IDS_PROB_UNKNOWN_RESOURCE=This device is asking for an unknown resource type. {0} - IDS_PROB_REINSTALL=Reinstall the drivers for this device. {0} - IDS_PROB_REGISTRY=Windows cannot start this hardware device because its configuration information (in the registry) is incomplete or damaged. {0} - IDS_PROB_WILL_BE_REMOVED=Windows is uninstalling this device. {0} - IDS_PROB_DISABLED=This device is disabled. {0} - IDS_DEVICE_NOT_THERE=This device is not present, is not working properly, or does not have all its drivers installed. {0} - IDS_PROB_MOVED=Windows is still setting up this device. {0} - IDS_PROB_TOO_EARLY=Windows is still setting up this device. {0} - IDS_PROB_NO_VALID_LOG_CONF=This device does not have valid log configuration. {0} - IDS_PROB_FAILEDINSTALL=The drivers for this device are not installed. {0} - IDS_PROB_HARDWAREDISABLED=This device is disabled because the firmware of the device did not give it the required resources. {0} - IDS_PROB_CANT_SHARE_IRQ=This device is using an Interrupt Request (IRQ) resource that another device is using. {0} - IDS_PROB_FAILED_ADD=This device is not working properly because Windows cannot load the drivers required for this device. {0} - IDS_PROB_DISABLED_SERVICE=A driver (service) for this device has been disabled. An alternate driver may be providing this functionality. {0} - IDS_PROB_TRANSLATION_FAILED=Windows cannot determine which resources are required for this device. {0} - IDS_PROB_NO_SOFTCONFIG=Windows cannot determine the settings for this device. Consult the documentation that came with this device and use the Resource tab to set the configuration. {0} - IDS_PROB_BIOS_TABLE=Your computer's system firmware does not include enough information to properly configure and use this device. To use this device, contact your computer manufacturer to obtain a firmware or BIOS update. {0} - IDS_PROB_IRQ_TRANSLATION_FAILED=This device is requesting a PCI interrupt but is configured for an ISA interrupt (or vice versa). Please use the computer's system setup program to reconfigure the interrupt for this device. {0} - IDS_PROB_FAILED_DRIVER_ENTRY=Windows cannot initialize the device driver for this hardware. {0} - IDS_PROB_DRIVER_FAILED_PRIOR_UNLOAD=Windows cannot load the device driver for this hardware because a previous instance of the device driver is still in memory. {0} - IDS_PROB_DRIVER_FAILED_LOAD=Windows cannot load the device driver for this hardware. The driver may be corrupted or missing. {0} - IDS_PROB_DRIVER_SERVICE_KEY_INVALID=Windows cannot access this hardware because its service key information in the registry is missing or recorded incorrectly. {0} - IDS_PROB_LEGACY_SERVICE_NO_DEVICES=Windows successfully loaded the device driver for this hardware but cannot find the hardware device. {0} - IDS_PROB_DUPLICATE_DEVICE=Windows cannot load the device driver for this hardware because there is a duplicate device already running in the system. {0} - IDS_PROB_FAILED_POST_START=Windows has stopped this device because it has reported problems. {0} - IDS_PROB_HALTED=An application or service has shut down this hardware device. {0} - IDS_PROB_PHANTOM=Currently, this hardware device is not connected to the computer. {0}\r\n\r\nTo fix this problem, reconnect this hardware device to the computer. - IDS_PROB_SYSTEM_SHUTDOWN=Windows cannot gain access to this hardware device because the operating system is in the process of shutting down. {0}\r\n\r\nThe hardware device should work correctly next time you start your computer. - IDS_PROB_HELD_FOR_EJECT=Windows cannot use this hardware device because it has been prepared for ""safe removal"", but it has not been removed from the computer. {0}\r\n\r\nTo fix this problem, unplug this device from your computer and then plug it in again. - IDS_PROB_DRIVER_BLOCKED=The software for this device has been blocked from starting because it is known to have problems with Windows. Contact the hardware vendor for a new driver. {0} - IDS_PROB_REGISTRY_TOO_LARGE=Windows cannot start new hardware devices because the system hive is too large (exceeds the Registry Size Limit). {0}\r\n\r\nTo fix this problem, you should first try uninstalling any hardware devices that you are no longer using. If that doesn't solve the problem, then you will have to reinstall Windows. - IDS_PROB_SETPROPERTIES_FAILED=Windows cannot apply all of the properties for this device. Device properties may include information that describes the device's capabilities and settings (such as security settings for example). {0}\r\n\r\nTo fix this problem, you can try reinstalling this device. However, it is recommended that you contact the hardware manufacturer for a new driver. - IDS_PROB_SYSTEMFAILURE=System failure: Try changing the driver for this device. If that doesn't work, see your hardware documentation. {0} - IDS_PROB_NOPROBLEM=This device is working properly. - IDS_PROB_UNKNOWN=This device has a problem, but Windows cannot determine what the problem is. - IDS_PROB_UNKNOWN_WITHCODE=This device has a problem that Windows cannot identify. {0} - IDS_PROB_CODE=(Code {0}). - IDS_PROB_WAITING_ON_DEPENDENCY=This device is currently waiting on another device or set of devices to start. {0} - IDS_PROB_UNSIGNED_DRIVER=Windows cannot verify the digital signature for the drivers required for this device. A recent hardware or software change might have installed a file that is signed incorrectly or damaged, or that might be malicious software from an unknown source. {0} - IDS_PROB_USED_BY_DEBUGGER=This device has been reserved for use by the Windows kernel debugger for the duration of this boot session. {0} - IDS_PROB_DEVICE_RESET=This device has failed and is undergoing a reset. {0} - IDS_PROB_CONSOLE_LOCKED=This device is blocked from starting while the user is not logged in. {0} - IDS_PROB_NEED_CLASS_CONFIG=Windows is still setting up the class configuration for this device. {0} - IDS_PROB_GUEST_ASSIGNMENT_FAILED=This device could not be assigned to a guest partition. {0} -###PSLOCC -'@ \ No newline at end of file diff --git a/newton-cn/bin/Modules/PnpDevice/PnpDevice.Types.ps1xml b/newton-cn/bin/Modules/PnpDevice/PnpDevice.Types.ps1xml deleted file mode 100644 index c54062a..0000000 --- a/newton-cn/bin/Modules/PnpDevice/PnpDevice.Types.ps1xml +++ /dev/null @@ -1,283 +0,0 @@ - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Cimv2/Win32_PnPEntity - - - Class - PNPClass - - - FriendlyName - Name - - - InstanceId - DeviceID - - - Problem - ConfigManagerErrorCode - - - ConfigManagerErrorCode - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PnpDevice.Problem]($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value) - - - - ProblemDescription - - Microsoft.PowerShell.Utility\Import-LocalizedData LocalizedData -filename PnpDevice.Resource.psd1 - switch([Microsoft.PowerShell.Cmdletization.GeneratedTypes.PnpDevice.Problem]($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - { - CM_PROB_NONE - { - $str = $LocalizedData.IDS_PROB_NOPROBLEM - } - CM_PROB_NOT_CONFIGURED - { - $str = $LocalizedData.IDS_PROB_NOT_CONFIGURED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_DEVLOADER_FAILED - { - $str = $LocalizedData.IDS_PROB_DEVLOADERFAILED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_OUT_OF_MEMORY - { - $str = $LocalizedData.IDS_PROB_OUT_OF_MEMORY -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_ENTRY_IS_WRONG_TYPE - { - $str = $LocalizedData.IDS_PROB_WRONG_TYPE -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_LACKED_ARBITRATOR - { - $str = $LocalizedData.IDS_PROB_LACKEDARBITRATOR -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_BOOT_CONFIG_CONFLICT - { - $str = $LocalizedData.IDS_PROB_BOOT_CONFIG_CONFLICT -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_FAILED_FILTER - { - $str = $LocalizedData.IDS_PROB_FAILED_FILTER -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_DEVLOADER_NOT_FOUND - { - $str = $LocalizedData.IDS_PROB_DEVLOADER_NOT_FOUND -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_INVALID_DATA - { - $str = $LocalizedData.IDS_PROB_INVALID_DATA -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_FAILED_START - { - $str = $LocalizedData.IDS_PROB_FAILED_START -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_LIAR - { - $str = $LocalizedData.IDS_PROB_LIAR -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_NORMAL_CONFLICT - { - $str = $LocalizedData.IDS_PROB_NORMAL_CONFLICT -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_NOT_VERIFIED - { - $str = $LocalizedData.IDS_PROB_NOT_VERIFIED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_NEED_RESTART - { - $str = $LocalizedData.IDS_PROB_NEEDRESTART -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_REENUMERATION - { - $str = $LocalizedData.IDS_PROB_REENUMERATION -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_PARTIAL_LOG_CONF - { - $str = $LocalizedData.IDS_PROB_PARTIALCONFIG -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_UNKNOWN_RESOURCE - { - $str = $LocalizedData.IDS_PROB_UNKNOWN_RESOURCE -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_REINSTALL - { - $str = $LocalizedData.IDS_PROB_REINSTALL -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_REGISTRY - { - $str = $LocalizedData.IDS_PROB_REGISTRY -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_WILL_BE_REMOVED - { - $str = $LocalizedData.IDS_PROB_WILL_BE_REMOVED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_DISABLED - { - $str = $LocalizedData.IDS_PROB_DISABLED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_DEVICE_NOT_THERE - { - $str = $LocalizedData.IDS_DEVICE_NOT_THERE -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_MOVED - { - $str = $LocalizedData.IDS_PROB_MOVED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_TOO_EARLY - { - $str = $LocalizedData.IDS_PROB_TOO_EARLY -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_NO_VALID_LOG_CONF - { - $str = $LocalizedData.IDS_PROB_NO_VALID_LOG_CONF -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_FAILED_INSTALL - { - $str = $LocalizedData.IDS_PROB_FAILEDINSTALL -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_HARDWARE_DISABLED - { - $str = $LocalizedData.IDS_PROB_HARDWAREDISABLED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_CANT_SHARE_IRQ - { - $str = $LocalizedData.IDS_PROB_CANT_SHARE_IRQ -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_FAILED_ADD - { - $str = $LocalizedData.IDS_PROB_FAILED_ADD -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_DISABLED_SERVICE - { - $str = $LocalizedData.IDS_PROB_DISABLED_SERVICE -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_TRANSLATION_FAILED - { - $str = $LocalizedData.IDS_PROB_TRANSLATION_FAILED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_NO_SOFTCONFIG - { - $str = $LocalizedData.IDS_PROB_NO_SOFTCONFIG -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_BIOS_TABLE - { - $str = $LocalizedData.IDS_PROB_BIOS_TABLE -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_IRQ_TRANSLATION_FAILED - { - $str = $LocalizedData.IDS_PROB_IRQ_TRANSLATION_FAILED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_FAILED_DRIVER_ENTRY - { - $str = $LocalizedData.IDS_PROB_FAILED_DRIVER_ENTRY -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_DRIVER_FAILED_PRIOR_UNLOAD - { - $str = $LocalizedData.IDS_PROB_DRIVER_FAILED_PRIOR_UNLOAD -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_DRIVER_FAILED_LOAD - { - $str = $LocalizedData.IDS_PROB_DRIVER_FAILED_LOAD -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_DRIVER_SERVICE_KEY_INVALID - { - $str = $LocalizedData.IDS_PROB_DRIVER_SERVICE_KEY_INVALID -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_LEGACY_SERVICE_NO_DEVICES - { - $str = $LocalizedData.IDS_PROB_LEGACY_SERVICE_NO_DEVICES -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_DUPLICATE_DEVICE - { - $str = $LocalizedData.IDS_PROB_DUPLICATE_DEVICE -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_FAILED_POST_START - { - $str = $LocalizedData.IDS_PROB_FAILED_POST_START -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_HALTED - { - $str = $LocalizedData.IDS_PROB_HALTED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_PHANTOM - { - $str = $LocalizedData.IDS_PROB_PHANTOM -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_SYSTEM_SHUTDOWN - { - $str = $LocalizedData.IDS_PROB_SYSTEM_SHUTDOWN -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_HELD_FOR_EJECT - { - $str = $LocalizedData.IDS_PROB_HELD_FOR_EJECT -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_DRIVER_BLOCKED - { - $str = $LocalizedData.IDS_PROB_DRIVER_BLOCKED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_REGISTRY_TOO_LARGE - { - $str = $LocalizedData.IDS_PROB_REGISTRY_TOO_LARGE -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_SETPROPERTIES_FAILED - { - $str = $LocalizedData.IDS_PROB_SETPROPERTIES_FAILED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_WAITING_ON_DEPENDENCY - { - $str = $LocalizedData.IDS_PROB_WAITING_ON_DEPENDENCY -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_UNSIGNED_DRIVER - { - $str = $LocalizedData.IDS_PROB_UNSIGNED_DRIVER -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_USED_BY_DEBUGGER - { - $str = $LocalizedData.IDS_PROB_USED_BY_DEBUGGER -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_DEVICE_RESET - { - $str = $LocalizedData.IDS_PROB_DEVICE_RESET -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_CONSOLE_LOCKED - { - $str = $LocalizedData.IDS_PROB_CONSOLE_LOCKED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_NEED_CLASS_CONFIG - { - $str = $LocalizedData.IDS_PROB_NEED_CLASS_CONFIG -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - CM_PROB_GUEST_ASSIGNMENT_FAILED - { - $str = $LocalizedData.IDS_PROB_GUEST_ASSIGNMENT_FAILED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - Default - { - $str = $LocalizedData.IDS_PROB_UNKNOWN_WITHCODE -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) - } - } - return $str - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Cimv2/Win32_PnPDeviceProperty - - - InstanceId - DeviceID - - - Type - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PnpDeviceProperty.Type]($this.PSBase.CimInstanceProperties['Type'].Value) - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PnpDevice/PnpDevice.cdxml b/newton-cn/bin/Modules/PnpDevice/PnpDevice.cdxml deleted file mode 100644 index 7ee672b..0000000 --- a/newton-cn/bin/Modules/PnpDevice/PnpDevice.cdxml +++ /dev/null @@ -1,268 +0,0 @@ - - - - 1.0 - PnpDevice - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OK - ERROR - DEGRADED - UNKNOWN - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/PnpDevice/PnpDevice.psd1 b/newton-cn/bin/Modules/PnpDevice/PnpDevice.psd1 deleted file mode 100644 index 628f8a9..0000000 --- a/newton-cn/bin/Modules/PnpDevice/PnpDevice.psd1 +++ /dev/null @@ -1,28 +0,0 @@ -@{ - GUID = 'ad34bc8b-1cf8-47d8-bd82-f681c5358e1c' - Author = "Microsoft Corporation" - CompanyName = "Microsoft Corporation" - Copyright = "© Microsoft Corporation. All rights reserved." - ModuleVersion = '1.0.0.0' - PowerShellVersion = '5.1' - HelpInfoUri="https://go.microsoft.com/fwlink/?LinkID=524801" - NestedModules = @( - 'PnpDevice.cdxml') - TypesToProcess = @( - 'PnpDevice.Types.ps1xml') - FormatsToProcess = @( - 'PnpDevice.format.ps1xml') - FileList = @( - 'PnpDevice.cdxml', - 'PnpDevice.Types.ps1xml', - 'PnpDevice.format.ps1xml', - 'PnpDevice.Resource.psd1') - AliasesToExport = @() - CmdletsToExport = @() - FunctionsToExport = @( - 'Get-PnpDevice', - 'Get-PnpDeviceProperty', - 'Enable-PnpDevice', - 'Disable-PnpDevice') - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_3DPrinter.format.ps1xml b/newton-cn/bin/Modules/PrintManagement/MSFT_3DPrinter.format.ps1xml deleted file mode 100644 index c874ce0..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_3DPrinter.format.ps1xml +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - Formatting For MSFT_3DPrinter (Table View) - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_3DPrinter - - - - - 30 - - - 15 - - - 12 - - - 25 - - - 15 - - - 8 - - - 10 - - - 15 - - - - - - - Name - - - ComputerName - - - Type - - - DriverName - - - PortName - - - Shared - - - Published - - - DeviceType - - - - - - - - Formatting For MSFT_3DPrinter (List View) - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_3DPrinter - - - - - - - Name - - - ComputerName - - - Type - - - ShareName - - - PortName - - - DriverName - - - Location - - - Comment - - - PrintProcessor - - - Datatype - - - Shared - - - Published - - - DeviceType - - - PermissionSDDL - - - Priority - - - DefaultJobPriority - - - StartTime - - - UntilTime - - - PrinterStatus - - - JobCount - - - DisableBranchOfficeLogging - - - BranchOfficeOfflineLogSizeMB - - - - - - - - diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_3DPrinter_v1.0.cdxml b/newton-cn/bin/Modules/PrintManagement/MSFT_3DPrinter_v1.0.cdxml deleted file mode 100644 index 9ed4c73..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_3DPrinter_v1.0.cdxml +++ /dev/null @@ -1,7 +0,0 @@ - - - - 1.0 - Printer - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_AdaptivePrinterPort.format.ps1xml b/newton-cn/bin/Modules/PrintManagement/MSFT_AdaptivePrinterPort.format.ps1xml deleted file mode 100644 index 18a8a87..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_AdaptivePrinterPort.format.ps1xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - Formatting For MSFT_AdaptivePrinterPort (Table View) - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_AdaptivePrinterPort - - - - - 20 - - - 20 - - - 20 - - - 20 - - - - - - - Name - - - ComputerName - - - Description - - - DiscoveryMethod - - - - - - - - Formatting For MSFT_AdaptivePrinterPort (List View) - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_AdaptivePrinterPort - - - - - - - Name - - - ComputerName - - - Description - - - DiscoveryMethod - - - DeviceUUID - - - DeviceURL - - - IppURL - - - - - - - - diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_AdaptivePrinterPort.types.ps1xml b/newton-cn/bin/Modules/PrintManagement/MSFT_AdaptivePrinterPort.types.ps1xml deleted file mode 100644 index 81c3bfe..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_AdaptivePrinterPort.types.ps1xml +++ /dev/null @@ -1,15 +0,0 @@ - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_AdaptivePrinterPort - - - DiscoveryMethod - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.AdaptivePrinterPort.DiscoveryMethodEnum]($this.PSBase.CimInstanceProperties['DiscoveryMethod'].Value) - - - - - - - diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_AdaptivePrinterPort_v1.0.cdxml b/newton-cn/bin/Modules/PrintManagement/MSFT_AdaptivePrinterPort_v1.0.cdxml deleted file mode 100644 index 3fa116a..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_AdaptivePrinterPort_v1.0.cdxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - 1.0 - PrinterPort - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_LocalPrinterPort.format.ps1xml b/newton-cn/bin/Modules/PrintManagement/MSFT_LocalPrinterPort.format.ps1xml deleted file mode 100644 index 2e9c8c4..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_LocalPrinterPort.format.ps1xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - Formatting For MSFT_LocalPrinterPort (Table View) - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_LocalPrinterPort - - - - - 20 - - - 20 - - - 20 - - - - - - - Name - - - ComputerName - - - Description - - - - - - - - Formatting For MSFT_LocalPrinterPort (List View) - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_LocalPrinterPort - - - - - - - Name - - - ComputerName - - - Description - - - - - - - - diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_LocalPrinterPort_v1.0.cdxml b/newton-cn/bin/Modules/PrintManagement/MSFT_LocalPrinterPort_v1.0.cdxml deleted file mode 100644 index 8c81736..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_LocalPrinterPort_v1.0.cdxml +++ /dev/null @@ -1,7 +0,0 @@ - - - - 1.0 - PrinterPort - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_LprPrinterPort.format.ps1xml b/newton-cn/bin/Modules/PrintManagement/MSFT_LprPrinterPort.format.ps1xml deleted file mode 100644 index b6f0ecc..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_LprPrinterPort.format.ps1xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - Formatting For MSFT_LprPrinterPort (Table View) - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_LprPrinterPort - - - - - 20 - - - 20 - - - 20 - - - - - - - Name - - - ComputerName - - - Description - - - - - - - - Formatting For MSFT_LprPrinterPort (List View) - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_LprPrinterPort - - - - - - - Name - - - ComputerName - - - Description - - - HostName - - - PrinterName - - - - - - - - diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_LprPrinterPort_v1.0.cdxml b/newton-cn/bin/Modules/PrintManagement/MSFT_LprPrinterPort_v1.0.cdxml deleted file mode 100644 index c70d662..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_LprPrinterPort_v1.0.cdxml +++ /dev/null @@ -1,7 +0,0 @@ - - - - 1.0 - PrinterPort - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_PrintJob.format.ps1xml b/newton-cn/bin/Modules/PrintManagement/MSFT_PrintJob.format.ps1xml deleted file mode 100644 index 8ef8bc9..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_PrintJob.format.ps1xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - Formatting For MSFT_PrintJob (Table View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_PrintJob - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrintJob - - - - - 5 - - - 15 - - - 15 - - - 20 - - - 20 - - - 15 - - - - - - - Id - - - ComputerName - - - PrinterName - - - DocumentName - - - SubmittedTime - - - JobStatus - - - - - - - - Formatting For MSFT_PrintJob (List View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_PrintJob - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrintJob - - - - - - - Id - - - ComputerName - - - PrinterName - - - UserName - - - DocumentName - - - Datatype - - - Priority - - - Position - - - SubmittedTime - - - Size - - - JobTime - - - PagesPrinted - - - TotalPages - - - JobStatus - - - - - - - - diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_PrintJob.types.ps1xml b/newton-cn/bin/Modules/PrintManagement/MSFT_PrintJob.types.ps1xml deleted file mode 100644 index b334c47..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_PrintJob.types.ps1xml +++ /dev/null @@ -1,26 +0,0 @@ - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrintJob - - - JobStatus - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PrintJob.JobStatus]($this.PSBase.CimInstanceProperties['JobStatus'].Value) - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_PrintJob - - - JobStatus - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PrintJob.JobStatus]($this.PSBase.CimInstanceProperties['JobStatus'].Value) - - - - - - - diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_PrintJob_v1.0.cdxml b/newton-cn/bin/Modules/PrintManagement/MSFT_PrintJob_v1.0.cdxml deleted file mode 100644 index 5a0a7b4..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_PrintJob_v1.0.cdxml +++ /dev/null @@ -1,386 +0,0 @@ - - - - 1.0 - PrintJob - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_Printer.format.ps1xml b/newton-cn/bin/Modules/PrintManagement/MSFT_Printer.format.ps1xml deleted file mode 100644 index fc3dfca..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_Printer.format.ps1xml +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - Formatting For MSFT_Printer (Table View for ALL subclasses.) - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_Printer - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_3DPrinter - - - - - 30 - - - 15 - - - 12 - - - 25 - - - 15 - - - 8 - - - 10 - - - 15 - - - - - - - Name - - - ComputerName - - - Type - - - DriverName - - - PortName - - - Shared - - - Published - - - DeviceType - - - - - - - - Formatting For MSFT_Printer (List View) - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_Printer - - - - - - - Name - - - ComputerName - - - Type - - - ShareName - - - PortName - - - DriverName - - - Location - - - Comment - - - SeparatorPageFile - - - PrintProcessor - - - Datatype - - - Shared - - - Published - - - DeviceType - - - PermissionSDDL - - - RenderingMode - - - KeepPrintedJobs - - - Priority - - - DefaultJobPriority - - - StartTime - - - UntilTime - - - PrinterStatus - - - JobCount - - - DisableBranchOfficeLogging - - - BranchOfficeOfflineLogSizeMB - - - WorkflowPolicy - - - - - - - - diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_Printer.types.ps1xml b/newton-cn/bin/Modules/PrintManagement/MSFT_Printer.types.ps1xml deleted file mode 100644 index 9515faa..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_Printer.types.ps1xml +++ /dev/null @@ -1,38 +0,0 @@ - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_Printer - - - RenderingMode - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Printer.RenderingModeEnum]($this.PSBase.CimInstanceProperties['RenderingMode'].Value) - - - param($value) - $this.PSBase.CimInstanceProperties['RenderingMode'].Value = - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Printer.RenderingModeEnum]$value - - - - PrinterStatus - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Printer.PrinterStatus]($this.PSBase.CimInstanceProperties['PrinterStatus'].Value) - - - - Type - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Printer.TypeEnum]($this.PSBase.CimInstanceProperties['Type'].Value) - - - - DeviceType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Printer.DeviceTypeEnum]($this.PSBase.CimInstanceProperties['DeviceType'].Value) - - - - - - - diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterConfiguration.format.ps1xml b/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterConfiguration.format.ps1xml deleted file mode 100644 index 918a146..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterConfiguration.format.ps1xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - Formatting For MSFT_PrinterConfiguration (Table View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_PrinterConfiguration - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterConfiguration - - - - - 15 - - - 15 - - - 10 - - - 10 - - - 20 - - - - - - - PrinterName - - - ComputerName - - - Collate - - - Color - - - DuplexingMode - - - - - - - - Formatting For MSFT_PrinterConfiguration (List View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_PrinterConfiguration - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterConfiguration - - - - - - - PrinterName - - - ComputerName - - - Collate - - - Color - - - DuplexingMode - - - PaperSize - - - - - - - - diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterConfiguration.types.ps1xml b/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterConfiguration.types.ps1xml deleted file mode 100644 index 0567215..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterConfiguration.types.ps1xml +++ /dev/null @@ -1,31 +0,0 @@ - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_PrinterConfiguration - - - DuplexingMode - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PrinterConfiguration.DuplexingModeEnum]($this.PSBase.CimInstanceProperties['DuplexingMode'].Value) - - - param($value) - $this.PSBase.CimInstanceProperties['DuplexingMode'].Value = - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PrinterConfiguration.DuplexingModeEnum]$value - - - - PaperSize - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PrinterConfiguration.PaperSizeEnum]($this.PSBase.CimInstanceProperties['PaperSize'].Value) - - - param($value) - $this.PSBase.CimInstanceProperties['PaperSize'].Value = - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PrinterConfiguration.PaperSizeEnum]$value - - - - - - - diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterConfiguration_v1.0.cdxml b/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterConfiguration_v1.0.cdxml deleted file mode 100644 index 293d5a8..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterConfiguration_v1.0.cdxml +++ /dev/null @@ -1,323 +0,0 @@ - - - - 1.0 - PrintConfiguration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterDriver.format.ps1xml b/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterDriver.format.ps1xml deleted file mode 100644 index 699a36c..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterDriver.format.ps1xml +++ /dev/null @@ -1,131 +0,0 @@ - - - - - Formatting For MSFT_PrinterDriver (Table View) - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterDriver - - - - - 35 - - - 18 - - - 15 - - - 25 - - - - - - - Name - - - PrinterEnvironment - - - MajorVersion - - - Manufacturer - - - - - - - - Formatting For MSFT_PrinterDriver (List View) - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterDriver - - - - - - - Name - - - ComputerName - - - PrinterEnvironment - - - Path - - - DataFile - - - ConfigFile - - - HelpFile - - - DependentFiles - - - Monitor - - - DefaultDatatype - - - Date - - - MajorVersion - - - DriverVersion - - - Manufacturer - - - OEMUrl - - - HardwareID - - - Provider - - - PrintProcessor - - - VendorSetup - - - ColorProfiles - - - InfPath - - - IsPackageAware - - - CoreDriverDependencies - - - PreviousCompatibleNames - - - - - - - - diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterDriver_v1.0.cdxml b/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterDriver_v1.0.cdxml deleted file mode 100644 index b336d54..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterDriver_v1.0.cdxml +++ /dev/null @@ -1,114 +0,0 @@ - - - - 1.0 - PrinterDriver - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterNfcTag.format.ps1xml b/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterNfcTag.format.ps1xml deleted file mode 100644 index f5f7e26..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterNfcTag.format.ps1xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - Formatting For MSFT_PrinterNfcTag (Table View) - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterNfcTag - - - - - 30 - - - 30 - - - 10 - - - - - - - SharePath - - - WsdAddress - - - Locked - - - - - - - - Formatting For MSFT_PrinterNfcTag (List View) - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterNfcTag - - - - - - - SharePath - - - WsdAddress - - - Locked - - - - - - - - diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterNfcTagTasks_v1.0.cdxml b/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterNfcTagTasks_v1.0.cdxml deleted file mode 100644 index 33429f0..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterNfcTagTasks_v1.0.cdxml +++ /dev/null @@ -1,77 +0,0 @@ - - - - 1.0 - PrinterNfcTag - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterNfcTag_v1.0.cdxml b/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterNfcTag_v1.0.cdxml deleted file mode 100644 index 92047a6..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterNfcTag_v1.0.cdxml +++ /dev/null @@ -1,7 +0,0 @@ - - - - 1.0 - PrinterNfcTag - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterPort.format.ps1xml b/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterPort.format.ps1xml deleted file mode 100644 index 857e07d..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterPort.format.ps1xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - Formatting For MSFT_PrinterPort (Table View for ALL subclasses.) - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterPort - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_LocalPrinterPort - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_TcpIpPrinterPort - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_AdaptivePrinterPort - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_LprPrinterPort - - - - - 20 - - - 20 - - - 20 - - - 20 - - - - - - - Name - - - ComputerName - - - Description - - - PortMonitor - - - - - - - - diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterPortTasks_v1.0.cdxml b/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterPortTasks_v1.0.cdxml deleted file mode 100644 index b350a08..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterPortTasks_v1.0.cdxml +++ /dev/null @@ -1,158 +0,0 @@ - - - - 1.0 - PrinterPort - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterPort_v1.0.cdxml b/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterPort_v1.0.cdxml deleted file mode 100644 index a4a0be5..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterPort_v1.0.cdxml +++ /dev/null @@ -1,57 +0,0 @@ - - - - 1.0 - PrinterPort - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterProperty.format.ps1xml b/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterProperty.format.ps1xml deleted file mode 100644 index f85f3d0..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterProperty.format.ps1xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - Formatting For MSFT_PrinterProperty (Table View) - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterProperty - - - - - 20 - - - 20 - - - 20 - - - 10 - - - 30 - - - - - - - ComputerName - - - PrinterName - - - PropertyName - - - Type - - - Value - - - - - - - - Formatting For MSFT_PrinterProperty (List View) - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterProperty - - - - - - - ComputerName - - - PrinterName - - - PropertyName - - - Type - - - Value - - - - - - - - diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterProperty.types.ps1xml b/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterProperty.types.ps1xml deleted file mode 100644 index 753fe9b..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterProperty.types.ps1xml +++ /dev/null @@ -1,15 +0,0 @@ - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterProperty - - - Type - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PrinterProperty.PropertyTypeEnum]($this.PSBase.CimInstanceProperties['Type'].Value) - - - - - - - diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterProperty_v1.0.cdxml b/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterProperty_v1.0.cdxml deleted file mode 100644 index 40dd233..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_PrinterProperty_v1.0.cdxml +++ /dev/null @@ -1,138 +0,0 @@ - - - - 1.0 - PrinterProperty - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_Printer_v1.0.cdxml b/newton-cn/bin/Modules/PrintManagement/MSFT_Printer_v1.0.cdxml deleted file mode 100644 index 6ac7272..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_Printer_v1.0.cdxml +++ /dev/null @@ -1,639 +0,0 @@ - - - - 1.0 - Printer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_TcpIpPrinterPort.format.ps1xml b/newton-cn/bin/Modules/PrintManagement/MSFT_TcpIpPrinterPort.format.ps1xml deleted file mode 100644 index 755838e..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_TcpIpPrinterPort.format.ps1xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - Formatting For MSFT_TcpIpPrinterPort (Table View) - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_TcpIpPrinterPort - - - - - 20 - - - 20 - - - 20 - - - 20 - - - 20 - - - - - - - Name - - - ComputerName - - - Description - - - PrinterHostAddress - - - PortNumber - - - - - - - - Formatting For MSFT_TcpIpPrinterPort (List View) - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_TcpIpPrinterPort - - - - - - - Name - - - ComputerName - - - Description - - - Protocol - - - PrinterHostAddress - - - PrinterHostIP - - - PortNumber - - - SNMPIndex - - - SNMPCommunity - - - SNMPEnabled - - - LprQueueName - - - LprByteCounting - - - - - - - - diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_TcpIpPrinterPort.types.ps1xml b/newton-cn/bin/Modules/PrintManagement/MSFT_TcpIpPrinterPort.types.ps1xml deleted file mode 100644 index e992647..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_TcpIpPrinterPort.types.ps1xml +++ /dev/null @@ -1,15 +0,0 @@ - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_TcpIpPrinterPort - - - Protocol - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.TcpIpPort.ProtocolEnum]($this.PSBase.CimInstanceProperties['Protocol'].Value) - - - - - - - diff --git a/newton-cn/bin/Modules/PrintManagement/MSFT_TcpIpPrinterPort_v1.0.cdxml b/newton-cn/bin/Modules/PrintManagement/MSFT_TcpIpPrinterPort_v1.0.cdxml deleted file mode 100644 index b2b77a2..0000000 --- a/newton-cn/bin/Modules/PrintManagement/MSFT_TcpIpPrinterPort_v1.0.cdxml +++ /dev/null @@ -1,13 +0,0 @@ - - - - 1.0 - PrinterPort - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/PrintManagement/PrintManagement.psd1 b/newton-cn/bin/Modules/PrintManagement/PrintManagement.psd1 deleted file mode 100644 index abc98a8..0000000 Binary files a/newton-cn/bin/Modules/PrintManagement/PrintManagement.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/ProcessMitigations/Microsoft.ProcessMitigations.Commands.dll b/newton-cn/bin/Modules/ProcessMitigations/Microsoft.ProcessMitigations.Commands.dll deleted file mode 100644 index 232e349..0000000 Binary files a/newton-cn/bin/Modules/ProcessMitigations/Microsoft.ProcessMitigations.Commands.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/ProcessMitigations/Microsoft.ProcessMitigations.Commands.dll-Help.xml b/newton-cn/bin/Modules/ProcessMitigations/Microsoft.ProcessMitigations.Commands.dll-Help.xml deleted file mode 100644 index 81bb2bd..0000000 --- a/newton-cn/bin/Modules/ProcessMitigations/Microsoft.ProcessMitigations.Commands.dll-Help.xml +++ /dev/null @@ -1,749 +0,0 @@ - - - - -ConvertTo-ProcessMitigationPolicy -ConvertTo -ProcessMitigationPolicy -Converts an mitigation policy file formats. - - - -Converts an EMET policy file or pinning rule file to a new Windows 10 format. - - -ConvertTo-ProcessMitigationPolicy -EMETFilePath -File that either contains cert pinning rules or an existing EMET process mitigation configuration file. - - -String -String - -None - -OutputFilePath -Resulting new Windows10 process mitigation/pinning rules format. - - -String -String - -None - - - -EMETFilePath -File that either contains cert pinning rules or an existing EMET process mitigation configuration file. - - -String -String - -None - -OutputFilePath -Resulting new Windows10 process mitigation/pinning rules format. - - -String -String - -None - - -System.String - - - - - - -System.Object - - - - - - - - - - -Example 1 -PS C:\> ConvertTo-ProcessMitigationPolicy -EMETFile policy.xml -Output result.xml -Converts EMET file policy.xml to result.xml, may also generate a CI file CI-result.xml if necessary. - - - - - - - -Get-ProcessMitigation -Get -ProcessMitigation -Gets the current process mitigation settings, either from the registry, from a running process, or saves all to a XML. - - - -Gets all process mitigation settings either by process name (either running or from -Registry), or by process ID. Can also save all settings to an XML file. - - -Get-ProcessMitigation -FullPolicy -Returns every processes' current mitigation settings in the registry - - -SwitchParameter - -False - - -Get-ProcessMitigation -Id -Process Id to retrieve current running process mitigation settings from - - -Int32[] -Int32[] - -None - - -Get-ProcessMitigation -Name -Current process name to get current running (Or from registry) process mitigation settings from one (Can be more than one instance) - - -String -String - -None - -RunningProcesses -Pull the current process mitigation settings from a running instance instead of the registry. - - -SwitchParameter - -False - - -Get-ProcessMitigation -RegistryConfigFilePath -File to save the current registry process mitigation configuration to - - -String -String - -None - - -Get-ProcessMitigation -System -Pulls the current system defaults for process mitigations. - - -SwitchParameter - -False - - - -FullPolicy -Returns every processes' current mitigation settings in the registry - - -SwitchParameter -SwitchParameter - -False - -Id -Process Id to retrieve current running process mitigation settings from - - -Int32[] -Int32[] - -None - -Name -Current process name to get current running (Or from registry) process mitigation settings from one (Can be more than one instance) - - -String -String - -None - -RegistryConfigFilePath -File to save the current registry process mitigation configuration to - - -String -String - -None - -RunningProcesses -Pull the current process mitigation settings from a running instance instead of the registry. - - -SwitchParameter -SwitchParameter - -False - -System -Pulls the current system defaults for process mitigations. - - -SwitchParameter -SwitchParameter - -False - - -System.Int32[] - - - - - - -System.Object - - - - - - - - - - -Example 1 -PS C:\> Get-ProcessMitigation -Name notepad.exe -RunningProcess -Gets the current settings on all running instances of notepad.exe - - - -Example 2 -PS C:\> Get-ProcessMitigation -Name notepad.exe -Gets the current settings in the registry for notepad.exe - - - -Example 3 -PS C:\> Get-ProcessMitigation -Id 1304 -Gets the current settings for the running process with pid 1304 - - - -Example 4 -PS C:\> Get-ProcessMitigation -RegistryConfigFilePath settings.xml -Gets the all process mitigation settings from the registry and saves them to the xml file settings.xml - - - -Example 5 -PS C:\> Get-ProcessMitigation -FullPolicy -Gets all policies for all processes set in the registry. - - - -Example 6 -PS C:\> Get-ProcessMitigation -System -Gets the current system process mitigation defaults stored in the registry. - - - -Example 7 -PS C:\> Get-Process notepad | Get-ProcessMitigation -Gets the current process mitigation settings for all running instances of notepad.exe - - - - - - - -Set-ProcessMitigation -Set -ProcessMitigation -Commands to enable and disable process mitigations or set them in bulk from an XML file. - - - -Used to turn on and off various process mitigation settings. Can also apply (Or Validate) an XML file to apply settings for many processes at once. - - -Set-ProcessMitigation -Name -Name of the process to apply mitigation settings to. Can be in the format "notepad" or "notepad.exe" - - -String -String - -None - -Disable -Comma separated list of mitigations to disable. Disable list takes priority over enable list. If specified in both, it will be disabled. - - -DEP -EmulateAtlThunks -SEHOP -ForceRelocate -RequireInfo -BottomUp -HighEntropy -StrictHandle -DisableWin32kSystemCalls -AuditSystemCall -ExtensionPoint -DynamicCode -AuditDynamicCode -CFG -SuppressExports -StrictCFG -BlockNonMicrosoftSigned -AllowStoreSigned -AuditMicrosoftSigned -AuditStoreSigned -EnforceModuleDepencySigning -DisableNonSystemFonts -FontAuditOnly -AuditFont -BlockRemoteImages -BlockLowLabel -PreferSystem32 -AuditImageLoad -EnableExportAddressFilter -AuditEnableExportAddressFilter -EnableExportAddressFilterPlus -AuditEnableExportAddressFilterPlus -EnableImportAddressFilter -AuditEnableImportAddressFilter -EnableRopStackPivot -AuditEnableRopStackPivot -EnableRopCallerCheck -AuditEnableRopCallerCheck -EnableRopSimExec -AuditEnableRopSimExec -SEHOP -AuditSEHOP -SEHOPTelemetry -TerminateOnHeapError -DisallowChildProcessCreation -AuditChildProcess -UserShadowStack -UserShadowStackStrictMode -AuditUserShadowStack - -String[] -String[] - -None - -EAFModules -Modules to be added to the EAF+ mitigation. - - -String[] -String[] - -None - -Enable -Comma separated list of mitigations to enable. Disable list takes priority over enable list. If specified in both, it will be disabled. - - -DEP -EmulateAtlThunks -SEHOP -ForceRelocate -RequireInfo -BottomUp -HighEntropy -StrictHandle -DisableWin32kSystemCalls -AuditSystemCall -ExtensionPoint -DynamicCode -AuditDynamicCode -CFG -SuppressExports -StrictCFG -BlockNonMicrosoftSigned -AllowStoreSigned -AuditMicrosoftSigned -AuditStoreSigned -EnforceModuleDepencySigning -DisableNonSystemFonts -FontAuditOnly -AuditFont -BlockRemoteImages -BlockLowLabel -PreferSystem32 -AuditImageLoad -EnableExportAddressFilter -EnableExportAddressFilterPlus -EnableImportAddressFilter -EnableRopStackPivot -EnableRopCallerCheck -EnableRopSimExec -SEHOP -AuditSEHOP -SEHOPTelemetry -TerminateOnHeapError -DisallowChildProcessCreation -AuditChildProcess -UserShadowStack -UserShadowStackStrictMode -AuditUserShadowStack - -String[] -String[] - -None - -Force -Overrides a system setting either on or off depending on the level this is set at. Will force "on"/"off" all mitigations provided in the -Enable list - - -on -off -notset - -String -String - -None - -Remove -Removes a mitigation entry from the registry. - - -SwitchParameter - -False - -Reset -Resets a specific mitigation entry to defer. - - -SwitchParameter - -False - - -Set-ProcessMitigation -Disable -Comma separated list of mitigations to disable. Disable list takes priority over enable list. If specified in both, it will be disabled. - - -DEP -EmulateAtlThunks -SEHOP -ForceRelocate -RequireInfo -BottomUp -HighEntropy -StrictHandle -SystemCall -AuditSystemCall -ExtensionPoint -DynamicCode -AuditDynamicCode -CFG -SuppressExports -StrictCFG -BlockNonMicrosoftSigned -AllowStoreSigned -AuditMicrosoftSigned -AuditStoreSigned -EnforceModuleDepencySigning -DisableNonSystemFonts -FontAuditOnly -AuditFont -BlockRemoteImages -BlockLowLabel -PreferSystem32 -AuditImageLoad -EnableExportAddressFilter -EnableExportAddressFilterPlus -EnableImportAddressFilter -EnableRopStackPivot -EnableRopCallerCheck -EnableRopSimExec -SEHOP -AuditSEHOP -SEHOPTelemetry -TerminateOnHeapError -DisallowChildProcessCreation -AuditChildProcess -UserShadowStack -UserShadowStackStrictMode -AuditUserShadowStack - -String[] -String[] - -None - -EAFModules -Modules to be added to the EAF+ mitigation. - - -String[] -String[] - -None - -Enable -Comma separated list of mitigations to enable. Disable list takes priority over enable list. If specified in both, it will be disabled. - - -DEP -EmulateAtlThunks -SEHOP -ForceRelocate -RequireInfo -BottomUp -HighEntropy -StrictHandle -SystemCall -AuditSystemCall -ExtensionPoint -DynamicCode -AuditDynamicCode -CFG -SuppressExports -StrictCFG -BlockNonMicrosoftSigned -AllowStoreSigned -AuditMicrosoftSigned -AuditStoreSigned -EnforceModuleDepencySigning -DisableNonSystemFonts -FontAuditOnly -AuditFont -BlockRemoteImages -BlockLowLabel -PreferSystem32 -AuditImageLoad -EnableExportAddressFilter -EnableExportAddressFilterPlus -EnableImportAddressFilter -EnableRopStackPivot -EnableRopCallerCheck -EnableRopSimExec -SEHOP -AuditSEHOP -SEHOPTelemetry -TerminateOnHeapError -DisallowChildProcessCreation -AuditChildProcess -UserShadowStack -UserShadowStackStrictMode -AuditUserShadowStack - -String[] -String[] - -None - -Force -Overrides a system setting either on or off depending on the level this is set at. Will force "on"/"off" all mitigations provided in the -Enable list - - -on -off -notset - -String -String - -None - -Remove -Removes a mitigation entry from the registry. - - -SwitchParameter - -False - -Reset -Resets a specific mitigation entry to defer. - - -SwitchParameter - -False - -System -Used to configure system defaults rather than individual apps. - - -SwitchParameter - -False - - -Set-ProcessMitigation -IsValid -Set to check the given XML file for validity. Requires local .xsd - - -SwitchParameter - -False - -PolicyFilePath -An XML file with mitigation settings for many processes that is applied to the registry - - -String -String - -None - - - -Disable -Comma separated list of mitigations to disable. Disable list takes priority over enable list. If specified in both, it will be disabled. - - -String[] -String[] - -None - -EAFModules -Modules to be added to the EAF+ mitigation. - - -String[] -String[] - -None - -Enable -Comma separated list of mitigations to enable. Disable list takes priority over enable list. If specified in both, it will be disabled. - - -String[] -String[] - -None - -Force -Overrides a system setting either on or off depending on the level this is set at. Will force "on"/"off" all mitigations provided in the -Enable list - - -String -String - -None - -IsValid -Set to check the given XML file for validity. Requires local .xsd - - -SwitchParameter -SwitchParameter - -False - -Name -Name of the process to apply mitigation settings to. Can be in the format "notepad" or "notepad.exe" - - -String -String - -None - -PolicyFilePath -An XML file with mitigation settings for many processes that is applied to the registry - - -String -String - -None - -Remove -Removes a mitigation entry from the registry. - - -SwitchParameter -SwitchParameter - -False - -Reset -Resets a specific mitigation entry to defer. - - -SwitchParameter -SwitchParameter - -False - -System -Used to configure system defaults rather than individual apps. - - -SwitchParameter -SwitchParameter - -False - - -System.String - - - - - - -System.Object - - - - - - - - - - -Example 1 -PS C:\> set-ProcessMitigation -Name Notepad.exe -Enable SEHOP -Disable MandatoryASLR -Gets the current process mitigation for "notepad.exe" from the registry and then enables SEHOP, and disables MandatoryASLR. - - - -Example 2 -PS C:\> set-ProcessMitigation -PolicyFilePath settings.xml -Applies all settings inside settings.xml - - - -Example 3 -PS C:\> set-ProcessMitigation -PolicyFilePath settings.xml -IsValid -Checks if the given file is a valid settings.xml, requires local .xsd - - - - - - - diff --git a/newton-cn/bin/Modules/ProcessMitigations/Microsoft.ProcessMitigations.Commands.ps1xml b/newton-cn/bin/Modules/ProcessMitigations/Microsoft.ProcessMitigations.Commands.ps1xml deleted file mode 100644 index b36da0f..0000000 --- a/newton-cn/bin/Modules/ProcessMitigations/Microsoft.ProcessMitigations.Commands.ps1xml +++ /dev/null @@ -1,1422 +0,0 @@ - - - - - - - AppMitigations - - Microsoft.Samples.PowerShell.Commands.AppMitigations - - - - - - - depControl - - - - - Enable : - - Enable - - - EmulateAtlThunks : - - EmulateAtlThunks - - - Override DEP : - - OverrideDEP - - - - - - - - - - - aslrControl - - - - - BottomUp : - - BottomUp - - - Override BottomUp : - - OverrideBottomUp - - - ForceRelocateImages : - - ForceRelocateImages - - - RequireInfo : - - RequireInfo - - - Override ForceRelocate : - - OverrideForceRelocateImages - - - HighEntropy : - - HighEntropy - - - Override High Entropy : - - OverrideHighEntropy - - - - - - - - - - - strictHandleControl - - - - - Enable : - - Enable - - - Override StrictHandle : - - OverrideStrictHandle - - - - - - - - - - - systemCallControl - - - - - DisableWin32kSystemCalls : - - DisableWin32kSystemCalls - - - Audit : - - Audit - - - Override SystemCall : - - OverrideSystemCall - - - - - - - - - - - extensionPointControl - - - - - DisableExtensionPoints : - - DisableExtensionPoints - - - Override ExtensionPoint : - - OverrideExtensionPoint - - - - - - - - - - - dynamicCodeControl - - - - - BlockDynamicCode : - - BlockDynamicCode - - - AllowThreadsToOptOut : - - AllowThreadsToOptOut - - - Audit : - - Audit - - - Override DynamicCode : - - OverrideDynamicCode - - - - - - - - - - - CFGControl - - - - - Enable : - - Enable - - - SuppressExports : - - SuppressExports - - - Override CFG : - - OverrideCFG - - - StrictControlFlowGuard : - - StrictControlFlowGuard - - - Override StrictCFG : - - OverrideStrictCFG - - - - - - - - - - - binarySignatureControl - - - - - MicrosoftSignedOnly : - - MicrosoftSignedOnly - - - AllowStoreSignedBinaries : - - AllowStoreSignedBinaries - - - EnforceModuleDependencySigning : - - EnforceModuleDependencySigning - - - AuditMicrosoftSignedOnly : - - Audit - - - AuditStoreSigned : - - AuditStoreSigned - - - AuditEnforceModuleDependencySigning: - - AuditEnforceModuleDependencySigning - - - Override MicrosoftSignedOnly : - - OverrideMicrosoftSignedOnly - - - Override DependencySigning : - - OverrideEnforceModuleDependencySigning - - - - - - - - - - - fontDisableControl - - - - - DisableNonSystemFonts : - - DisableNonSystemFonts - - - Audit : - - Audit - - - Override FontDisable : - - OverrideFontDisable - - - - - - - - - - - imageLoadControl - - - - - BlockRemoteImageLoads : - - BlockRemoteImageLoads - - - AuditRemoteImageLoads : - - AuditRemoteImageLoads - - - Override BlockRemoteImages : - - OverrideBlockRemoteImageLoads - - - BlockLowLabelImageLoads : - - BlockLowLabelImageLoads - - - AuditLowLabelImageLoads : - - AuditLowLabelImageLoads - - - Override BlockLowLabel : - - OverrideBlockLowLabel - - - PreferSystem32 : - - PreferSystem32 - - - AuditPreferSystem32 : - - AuditPreferSystem32 - - - Override PreferSystem32 : - - OverridePreferSystem32 - - - - - - - - - - - payloadControl - - - - - EnableExportAddressFilter : - - EnableExportAddressFilter - - - AuditEnableExportAddressFilter : - - AuditEnableExportAddressFilter - - - Override ExportAddressFilter : - - OverrideEnableExportAddressFilter - - - EnableExportAddressFilterPlus : - - EnableExportAddressFilterPlus - - - AuditEnableExportAddressFilterPlus : - - AuditEnableExportAddressFilterPlus - - - Override ExportAddressFilterPlus : - - OverrideEnableExportAddressFilterPlus - - - EAFModules : - - EAFModules - - - EnableImportAddressFilter : - - EnableImportAddressFilter - - - AuditEnableImportAddressFilter : - - AuditEnableImportAddressFilter - - - Override ImportAddressFilter : - - OverrideEnableImportAddressFilter - - - EnableRopStackPivot : - - EnableRopStackPivot - - - AuditEnableRopStackPivot : - - AuditEnableRopStackPivot - - - Override EnableRopStackPivot : - - OverrideEnableRopStackPivot - - - EnableRopCallerCheck : - - EnableRopCallerCheck - - - AuditEnableRopCallerCheck : - - AuditEnableRopCallerCheck - - - Override EnableRopCallerCheck : - - OverrideEnableRopCallerCheck - - - EnableRopSimExec : - - EnableRopSimExec - - - AuditEnableRopSimExec : - - AuditEnableRopSimExec - - - Override EnableRopSimExec : - - OverrideEnableRopSimExec - - - - - - - - - - - SEHOPControl - - - - - Enable : - - Enable - - - TelemetryOnly : - - TelemetryOnly - - - Audit : - - Audit - - - Override SEHOP : - - OverrideSEHOP - - - - - - - - - - - HeapControl - - - - - TerminateOnError : - - TerminateOnError - - - Override HEAP : - - OverrideHeap - - - - - - - - - - - ChildProcessControl - - - - - DisallowChildProcessCreation : - - DisallowChildProcessCreation - - - Audit : - - Audit - - - Override ChildProcess : - - OverrideChildProcess - - - - - - - - - - - UserShadowStackControl - - - - - UserShadowStack : - - UserShadowStack - - - UserShadowStackStrictMode : - - UserShadowStackStrictMode - - - AuditUserShadowStack : - - AuditUserShadowStack - - - Override UserShadowStack : - - OverrideUserShadowStack - - - - - - - - - - - - - - - - - ProcessName : - - ProcessName - - - Source : - - Source - - - Id : - - Id - - - - DEP: - - - 4 - - - Dep - depControl - - - - - ASLR: - - - 4 - - - aslr - aslrControl - - - - - StrictHandle: - - - 4 - - - strictHandle - strictHandleControl - - - - - System Call: - - - 4 - - - SystemCall - systemCallControl - - - - - ExtensionPoint: - - - 4 - - - extensionPoint - extensionPointControl - - - - - DynamicCode: - - - 4 - - - dynamicCode - dynamicCodeControl - - - - - CFG: - - - 4 - - - cfg - CFGControl - - - - - BinarySignature: - - - 4 - - - binarySignature - binarySignatureControl - - - - - FontDisable: - - - 4 - - - fontDisable - fontDisableControl - - - - - ImageLoad: - - - 4 - - - imageLoad - imageLoadControl - - - - - Payload: - - - 4 - - - Payload - payloadControl - - - - - SEHOP: - - - 4 - - - SEHOP - SEHOPControl - - - - - Heap: - - - 4 - - - Heap - HeapControl - - - - - Child Process: - - - 4 - - - ChildProcess - ChildProcessControl - - - - - User Shadow Stack: - - - 4 - - - UserShadowStack - UserShadowStackControl - - - - - - - - - - - - ProcessMitigations - - Microsoft.Samples.PowerShell.Commands.ProcessMitigations - - - - - - - depControl - - - - - Enable : - - Enable - - - EmulateAtlThunks : - - EmulateAtlThunks - - - - - - - - - - - aslrControl - - - - - BottomUp : - - BottomUp - - - ForceRelocateImages : - - ForceRelocateImages - - - RequireInfo : - - RequireInfo - - - HighEntropy : - - HighEntropy - - - - - - - - - - - strictHandleControl - - - - - Enable : - - Enable - - - - - - - - - - - systemCallControl - - - - - DisableWin32kSystemCalls : - - DisableWin32kSystemCalls - - - Audit : - - Audit - - - - - - - - - - - extensionPointControl - - - - - DisableExtensionPoints : - - DisableExtensionPoints - - - - - - - - - - - dynamicCodeControl - - - - - BlockDynamicCode : - - BlockDynamicCode - - - AllowThreadsToOptOut : - - AllowThreadsToOptOut - - - Audit : - - Audit - - - - - - - - - - - CFGControl - - - - - Enable : - - Enable - - - SuppressExports : - - SuppressExports - - - StrictControlFlowGuard : - - StrictControlFlowGuard - - - - - - - - - - - binarySignatureControl - - - - - MicrosoftSignedOnly : - - MicrosoftSignedOnly - - - AllowStoreSignedBinaries : - - AllowStoreSignedBinaries - - - AuditMicrosoftSignedOnly : - - Audit - - - AuditStoreSigned : - - AuditStoreSigned - - - - - - - - - - - fontDisableControl - - - - - DisableNonSystemFonts : - - DisableNonSystemFonts - - - Audit : - - Audit - - - - - - - - - - - imageLoadControl - - - - - BlockRemoteImageLoads : - - BlockRemoteImageLoads - - - AuditRemoteImageLoads : - - AuditRemoteImageLoads - - - BlockLowLabelImageLoads : - - BlockLowLabelImageLoads - - - AuditLowLabelImageLoads : - - AuditLowLabelImageLoads - - - PreferSystem32 : - - PreferSystem32 - - - AuditPreferSystem32 : - - AuditPreferSystem32 - - - - - - - - - - - payloadControl - - - - - EnableExportAddressFilter : - - EnableExportAddressFilter - - - AuditEnableExportAddressFilter : - - AuditEnableExportAddressFilter - - - EnableExportAddressFilterPlus : - - EnableExportAddressFilterPlus - - - AuditEnableExportAddressFilterPlus : - - AuditEnableExportAddressFilterPlus - - - EnableImportAddressFilter : - - EnableImportAddressFilter - - - AuditEnableImportAddressFilter : - - AuditEnableImportAddressFilter - - - EnableRopStackPivot : - - EnableRopStackPivot - - - AuditEnableRopStackPivot : - - AuditEnableRopStackPivot - - - EnableRopCallerCheck : - - EnableRopCallerCheck - - - AuditEnableRopCallerCheck : - - AuditEnableRopCallerCheck - - - EnableRopSimExec : - - EnableRopSimExec - - - AuditEnableRopCallerCheck : - - AuditEnableRopCallerCheck - - - - - - - - - - - ChildProcessControl - - - - - DisallowChildProcessCreation : - - DisallowChildProcessCreation - - - Audit : - - Audit - - - - - - - - - - - UserShadowStackControl - - - - - UserShadowStack : - - UserShadowStack - - - UserShadowStackStrictMode : - - UserShadowStackStrictMode - - - AuditUserShadowStack : - - AuditUserShadowStack - - - SetContextIpValidation : - - SetContextIpValidation - - - AuditSetContextIpValidation : - - AuditSetContextIpValidation - - - BlockNonCetBinaries : - - BlockNonCetBinaries - - - BlockNonCetBinariesNonEhcont : - - BlockNonCetBinariesNonEhcont - - - AuditBlockNonCetBinaries : - - AuditBlockNonCetBinaries - - - - - - - - - - - - - - - - - ProcessName : - - ProcessName - - - Source : - - Source - - - Id : - - Id - - - - DEP: - - - 4 - - - Dep - depControl - - - - - ASLR: - - - 4 - - - aslr - aslrControl - - - - - StrictHandle: - - - 4 - - - strictHandle - strictHandleControl - - - - - System Call: - - - 4 - - - SystemCall - systemCallControl - - - - - ExtensionPoint: - - - 4 - - - extensionPoint - extensionPointControl - - - - - DynamicCode: - - - 4 - - - dynamicCode - dynamicCodeControl - - - - - CFG: - - - 4 - - - cfg - CFGControl - - - - - BinarySignature: - - - 4 - - - binarySignature - binarySignatureControl - - - - - FontDisable: - - - 4 - - - fontDisable - fontDisableControl - - - - - ImageLoad: - - - 4 - - - imageLoad - imageLoadControl - - - - - Payload: - - - 4 - - - Payload - payloadControl - - - - - Child Process: - - - 4 - - - ChildProcess - ChildProcessControl - - - - - User Shadow Stack: - - - 4 - - - UserShadowStack - UserShadowStackControl - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/ProcessMitigations/ProcessMitigations.psd1 b/newton-cn/bin/Modules/ProcessMitigations/ProcessMitigations.psd1 deleted file mode 100644 index 7185004..0000000 --- a/newton-cn/bin/Modules/ProcessMitigations/ProcessMitigations.psd1 +++ /dev/null @@ -1,15 +0,0 @@ -@{ -GUID = "{1e8f5a4c-f11b-41a5-bdbd-4695ca4a503e}" -Author = "Microsoft Corporation" -CompanyName = "Microsoft Corporation" -Copyright = "© Microsoft Corporation. All rights reserved." -RootModule = 'Microsoft.ProcessMitigations.Commands.dll' -ModuleVersion = "1.0.12" -PowerShellVersion = '5.1' -CLRVersion = "2.0" -FormatsToProcess = 'Microsoft.ProcessMitigations.Commands.ps1xml' -CmdletsToExport="Get-ProcessMitigation", "Set-ProcessMitigation", "ConvertTo-ProcessMitigationPolicy" -# Location from which to download updateable help -HelpInfoURI = "https://go.microsoft.com/fwlink/?linkid=845399" -CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/Provisioning/provautologger_add.reg b/newton-cn/bin/Modules/Provisioning/provautologger_add.reg deleted file mode 100644 index 88b6d2d..0000000 --- a/newton-cn/bin/Modules/Provisioning/provautologger_add.reg +++ /dev/null @@ -1,176 +0,0 @@ -Windows Registry Editor Version 5.00 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning] -"Guid"="{0c225950-4d2c-4d9d-9b19-ec40855b7eec}" -"Start"=dword:00000001 -"Status"=dword:00000000 -"FileName"="{LogFile}" -"FileMax"=dword:0000000A -"BufferSize"=dword:00000040 -"MaxFileSize"=dword:00000400 -"LogFileMode"=dword:00000022 -"FlushTimer"=dword:00000001 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{A6A847B7-4429-49AA-BBA6-2AD8C191AC8C}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{0BBE6221-EF09-4A3F-82EE-BE00DBB6A98A}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{42C60CEA-0FE7-4541-A86B-9E11F95BD9BF}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{B876B1FC-C7F1-443E-9012-86677F7DE580}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{7EDBED09-1FF7-4FEE-B8C3-5DB694420830}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{82ADD491-01D7-4B85-9EAD-192C3CAACA23}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{16E12400-A2D8-44B7-9479-004568EC7819}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{0383D92C-2337-4F25-A0B5-A51767F04746}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{7F99598F-B2C1-4371-9911-63DEE13B9EB1}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{B1F30020-8BC3-4888-BB1B-4DD681F24209}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{55239D60-0EB6-495B-874E-15DE5D5F9A70}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{B55883E6-6C45-45C2-AB9D-800BB7B66B13}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{2BF4B6BA-556E-4D05-8534-CAFEDF19FED8}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{00BB69FC-60BC-4502-9438-25608F375CCB}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{E74EFD1A-B62D-4B83-AB00-66F4A166A2D3}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{F9E3B648-9AF1-4DC3-9A8E-BF42C0FBCE9A}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{C02087CB-200C-404B-9AB4-E0EACCEFCDC3}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{468E4CDB-B802-4624-BCDC-80658ABF3A02}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{78F60602-7581-4AB5-908F-8D23F8976FB1}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{0BA3FB88-9AF5-4D80-B3B3-A94AC136B6C5}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{A109A7C6-D975-46CC-B593-2B079B604E34}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{0A8E17FD-ED19-4C54-A1E7-5A2829BF507F}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{8CC7D9C9-09AF-45CA-86CE-4CECF680F2B7}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{FADD8651-7B42-423F-B37D-3B98B9E81560}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{18F2AB69-92B9-47E4-B9DB-B4AC2E4C7115}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{2F94E1CC-A8C5-4FE7-A1C3-53D7BDA8E73E}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{E3E3DA3E-B97E-47BA-A47E-9D00A92D607A}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{0e71a49b-ca69-5999-a395-626493eb0cbd}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{CF69DF80-7690-41DA-99C9-186E46860E7D}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - -[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{A9F17D57-43D6-498C-94E4-EB0E9E7E19C2}] -"Enabled"=dword:00000001 -"EnableLevel"=dword:00000005 -"Status"=dword:00000000 - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Provisioning/provautologger_del.reg b/newton-cn/bin/Modules/Provisioning/provautologger_del.reg deleted file mode 100644 index 98cafd8..0000000 --- a/newton-cn/bin/Modules/Provisioning/provautologger_del.reg +++ /dev/null @@ -1,17 +0,0 @@ -Windows Registry Editor Version 5.00 - -[-HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning] - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Provisioning/provcmdlets.dll b/newton-cn/bin/Modules/Provisioning/provcmdlets.dll deleted file mode 100644 index 4802ab3..0000000 Binary files a/newton-cn/bin/Modules/Provisioning/provcmdlets.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/Provisioning/provcommon.dll b/newton-cn/bin/Modules/Provisioning/provcommon.dll deleted file mode 100644 index ac146bb..0000000 Binary files a/newton-cn/bin/Modules/Provisioning/provcommon.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/Provisioning/provisioning.psd1 b/newton-cn/bin/Modules/Provisioning/provisioning.psd1 deleted file mode 100644 index 35691a9..0000000 Binary files a/newton-cn/bin/Modules/Provisioning/provisioning.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/Provisioning/provisioning.psm1 b/newton-cn/bin/Modules/Provisioning/provisioning.psm1 deleted file mode 100644 index 29acac3..0000000 --- a/newton-cn/bin/Modules/Provisioning/provisioning.psm1 +++ /dev/null @@ -1,16 +0,0 @@ -# -# Script Module file for provcmdlets module. -# -# Copyright (c) Microsoft Corporation -# - -# -# Cmdlet aliases -# - -Set-Alias Add-ProvisioningPackage Install-ProvisioningPackage -Set-Alias Remove-ProvisioningPackage Uninstall-ProvisioningPackage -Set-Alias Add-TrustedProvisioningCertificate Install-TrustedProvisioningCertificate -Set-Alias Remove-TrustedProvisioningCertificate Uninstall-TrustedProvisioningCertificate - -Export-ModuleMember -Alias * -Function * -Cmdlet * diff --git a/newton-cn/bin/Modules/Provisioning/provpackageapi.dll b/newton-cn/bin/Modules/Provisioning/provpackageapi.dll deleted file mode 100644 index 4b8edd2..0000000 Binary files a/newton-cn/bin/Modules/Provisioning/provpackageapi.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/Provisioning/provtrace.wprp b/newton-cn/bin/Modules/Provisioning/provtrace.wprp deleted file mode 100644 index c79ded0..0000000 --- a/newton-cn/bin/Modules/Provisioning/provtrace.wprp +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Provisioning/wiminterop.dll b/newton-cn/bin/Modules/Provisioning/wiminterop.dll deleted file mode 100644 index 539e84a..0000000 Binary files a/newton-cn/bin/Modules/Provisioning/wiminterop.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/ScheduledTasks/MSFT_ScheduledTask.format.ps1xml b/newton-cn/bin/Modules/ScheduledTasks/MSFT_ScheduledTask.format.ps1xml deleted file mode 100644 index e909d64..0000000 --- a/newton-cn/bin/Modules/ScheduledTasks/MSFT_ScheduledTask.format.ps1xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - Formatting For MSFT_ScheduledTask (Table View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_ScheduledTask - - - - - 46 - - - 33 - - - 10 - - - - - - - - TaskPath - - - TaskName - - - State - - - - - - - - Formatting For MSFT_ClusteredScheduledTask (Table View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_ClusteredScheduledTask - - - - - 16 - - - 33 - - - - - - - - TaskName - - - TaskType - - - - - - - - diff --git a/newton-cn/bin/Modules/ScheduledTasks/MSFT_ScheduledTask.types.ps1xml b/newton-cn/bin/Modules/ScheduledTasks/MSFT_ScheduledTask.types.ps1xml deleted file mode 100644 index 128c40b..0000000 --- a/newton-cn/bin/Modules/ScheduledTasks/MSFT_ScheduledTask.types.ps1xml +++ /dev/null @@ -1,179 +0,0 @@ - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_ScheduledTask - - - State - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.StateEnum]($this.PSBase.CimInstanceProperties['State'].Value) - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_TaskSettings - - - MultipleInstances - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.MultipleInstancesEnum]($this.PSBase.CimInstanceProperties['MultipleInstances'].Value) - - - $this.PSBase.CimInstanceProperties['MultipleInstances'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.MultipleInstancesEnum]($args[0]) - - - - Compatibility - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.CompatibilityEnum]($this.PSBase.CimInstanceProperties['Compatibility'].Value) - - - $this.PSBase.CimInstanceProperties['Compatibility'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.CompatibilityEnum]($args[0]) - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_TaskSettings2 - - - MultipleInstances - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.MultipleInstancesEnum]($this.PSBase.CimInstanceProperties['MultipleInstances'].Value) - - - $this.PSBase.CimInstanceProperties['MultipleInstances'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.MultipleInstancesEnum]($args[0]) - - - - Compatibility - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.CompatibilityEnum]($this.PSBase.CimInstanceProperties['Compatibility'].Value) - - - $this.PSBase.CimInstanceProperties['Compatibility'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.CompatibilityEnum]($args[0]) - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_TaskSettings3 - - - MultipleInstances - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.MultipleInstancesEnum]($this.PSBase.CimInstanceProperties['MultipleInstances'].Value) - - - $this.PSBase.CimInstanceProperties['MultipleInstances'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.MultipleInstancesEnum]($args[0]) - - - - Compatibility - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.CompatibilityEnum]($this.PSBase.CimInstanceProperties['Compatibility'].Value) - - - $this.PSBase.CimInstanceProperties['Compatibility'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.CompatibilityEnum]($args[0]) - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_TaskPrincipal - - - RunLevel - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.RunLevelEnum]($this.PSBase.CimInstanceProperties['RunLevel'].Value) - - - $this.PSBase.CimInstanceProperties['RunLevel'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.RunLevelEnum]($args[0]) - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_TaskPrincipal - - - LogonType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.LogonTypeEnum]($this.PSBase.CimInstanceProperties['LogonType'].Value) - - - $this.PSBase.CimInstanceProperties['LogonType'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.LogonTypeEnum]($args[0]) - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_TaskPrincipal2 - - - RunLevel - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.RunLevelEnum]($this.PSBase.CimInstanceProperties['RunLevel'].Value) - - - $this.PSBase.CimInstanceProperties['RunLevel'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.RunLevelEnum]($args[0]) - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_TaskPrincipal2 - - - LogonType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.LogonTypeEnum]($this.PSBase.CimInstanceProperties['LogonType'].Value) - - - $this.PSBase.CimInstanceProperties['LogonType'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.LogonTypeEnum]($args[0]) - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_TaskPrincipal2 - - - ProcessTokenSidType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.ProcessTokenSidTypeEnum]($this.PSBase.CimInstanceProperties['ProcessTokenSidType'].Value) - - - $this.PSBase.CimInstanceProperties['ProcessTokenSidType'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.ProcessTokenSidTypeEnum]($args[0]) - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_ClusteredScheduledTask - - - TaskType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.ClusterTaskTypeEnum]($this.PSBase.CimInstanceProperties['TaskType'].Value) - - - - - - - diff --git a/newton-cn/bin/Modules/ScheduledTasks/MSFT_ScheduledTask_v1.0.cdxml b/newton-cn/bin/Modules/ScheduledTasks/MSFT_ScheduledTask_v1.0.cdxml deleted file mode 100644 index 1ebcf31..0000000 --- a/newton-cn/bin/Modules/ScheduledTasks/MSFT_ScheduledTask_v1.0.cdxml +++ /dev/null @@ -1,73 +0,0 @@ - - - - 1.0 - ScheduledTask - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/ScheduledTasks/PS_ClusteredScheduledTask_v1.0.cdxml b/newton-cn/bin/Modules/ScheduledTasks/PS_ClusteredScheduledTask_v1.0.cdxml deleted file mode 100644 index 3e11c9b..0000000 --- a/newton-cn/bin/Modules/ScheduledTasks/PS_ClusteredScheduledTask_v1.0.cdxml +++ /dev/null @@ -1,391 +0,0 @@ - - - - 1.0 - ClusteredScheduledTask - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/ScheduledTasks/PS_ScheduledTask.types.ps1xml b/newton-cn/bin/Modules/ScheduledTasks/PS_ScheduledTask.types.ps1xml deleted file mode 100644 index 50e9272..0000000 --- a/newton-cn/bin/Modules/ScheduledTasks/PS_ScheduledTask.types.ps1xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - Microsoft.Management.Infrastructure.CimInstance#PS_ScheduledTask - - - RunLevel - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.RunLevelEnum]($this.PSBase.CimInstanceProperties['RunLevel'].Value) - - - $this.PSBase.CimInstanceProperties['RunLevel'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.RunLevelEnum]($args[0]) - - - - MultipleInstances - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.ScheduledTask.MultipleInstancesEnum]($this.PSBase.CimInstanceProperties['MultipleInstances'].Value) - - - $this.PSBase.CimInstanceProperties['MultipleInstances'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.MultipleInstancesEnum]($args[0]) - - - - Compatibility - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.ScheduledTask.CompatibilityEnum]($this.PSBase.CimInstanceProperties['Compatibility'].Value) - - - $this.PSBase.CimInstanceProperties['Compatibility'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.CompatibilityEnum]($args[0]) - - - - LogonType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.LogonTypeEnum]($this.PSBase.CimInstanceProperties['LogonType'].Value) - - - $this.PSBase.CimInstanceProperties['LogonType'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.LogonTypeEnum]($args[0]) - - - - ProcessTokenSidType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.ProcessTokenSidTypeEnum]($this.PSBase.CimInstanceProperties['ProcessTokenSidType'].Value) - - - $this.PSBase.CimInstanceProperties['ProcessTokenSidType'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.ProcessTokenSidTypeEnum]($args[0]) - - - - - - diff --git a/newton-cn/bin/Modules/ScheduledTasks/PS_ScheduledTask_v1.0.cdxml b/newton-cn/bin/Modules/ScheduledTasks/PS_ScheduledTask_v1.0.cdxml deleted file mode 100644 index deac266..0000000 --- a/newton-cn/bin/Modules/ScheduledTasks/PS_ScheduledTask_v1.0.cdxml +++ /dev/null @@ -1,1348 +0,0 @@ - - - - 1.0 - ScheduledTask - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/ScheduledTasks/ScheduledTasks.psd1 b/newton-cn/bin/Modules/ScheduledTasks/ScheduledTasks.psd1 deleted file mode 100644 index 2483a49..0000000 --- a/newton-cn/bin/Modules/ScheduledTasks/ScheduledTasks.psd1 +++ /dev/null @@ -1,52 +0,0 @@ - -@{ - GUID = '5378EE8E-E349-49BB-83B9-F3D9C396C0A6' - - Author = 'Microsoft Corporation' - - CompanyName = 'Microsoft Corporation' - - ClrVersion = '4.0' - - Copyright = '© Microsoft Corporation. All rights reserved.' - - ModuleVersion = '1.0.0.0' - - PowerShellVersion = '5.1' - - HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=390822" - - NestedModules = @( 'MSFT_ScheduledTask_v1.0.cdxml', - 'PS_ScheduledTask_v1.0.cdxml', - 'PS_ClusteredScheduledTask_v1.0.cdxml') - - TypesToProcess = @( 'MSFT_ScheduledTask.types.ps1xml', - 'PS_ScheduledTask.types.ps1xml' ) - - FormatsToProcess = @( 'MSFT_ScheduledTask.format.ps1xml' ) - - AliasesToExport = @() - - CmdletsToExport = @() - - FunctionsToExport = @( 'Get-ScheduledTask', - 'Set-ScheduledTask', - 'Register-ScheduledTask', - 'Unregister-ScheduledTask', - 'Enable-ScheduledTask', - 'Disable-ScheduledTask', - 'Export-ScheduledTask', - 'New-ScheduledTask', - 'New-ScheduledTaskAction', - 'New-ScheduledTaskPrincipal', - 'New-ScheduledTaskSettingsSet', - 'New-ScheduledTaskTrigger', - 'Start-ScheduledTask', - 'Stop-ScheduledTask', - 'Get-ScheduledTaskInfo' - 'Get-ClusteredScheduledTask', - 'Set-ClusteredScheduledTask', - 'Register-ClusteredScheduledTask', - 'Unregister-ClusteredScheduledTask' ) - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/SecureBoot/SecureBoot.psd1 b/newton-cn/bin/Modules/SecureBoot/SecureBoot.psd1 deleted file mode 100644 index 5590ed0..0000000 --- a/newton-cn/bin/Modules/SecureBoot/SecureBoot.psd1 +++ /dev/null @@ -1,18 +0,0 @@ -@{ -GUID="{a5bd98e1-e44c-44fb-b88f-5af9bde66fdf}" -Author="Microsoft Corporation" -CompanyName="Microsoft Corporation" -Copyright="© Microsoft Corporation. All rights reserved." -ModuleVersion="2.0.0.0" -ModuleToProcess="Microsoft.SecureBoot.Commands" -PowerShellVersion = '5.1' -CLRVersion="4.0" -CmdletsToExport= - "Confirm-SecureBootUEFI", - "Set-SecureBootUEFI", - "Get-SecureBootUEFI", - "Format-SecureBootUEFI", - "Get-SecureBootPolicy" -HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=390823" -CompatiblePSEditions = @('Desktop','Core') -} diff --git a/newton-cn/bin/Modules/SmbShare/Smb.format.ps1xml b/newton-cn/bin/Modules/SmbShare/Smb.format.ps1xml deleted file mode 100644 index d70dbbb..0000000 --- a/newton-cn/bin/Modules/SmbShare/Smb.format.ps1xml +++ /dev/null @@ -1,1220 +0,0 @@ - - - - - SmbClientConfigurationTypes - - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbClientConfiguration - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/SMB/MSFT_SmbClientConfiguration - - - - SmbClientNetworkInterfaceTypes - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbClientNetworkInterface - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbClientNetworkInterface - - - - SmbMappingTypes - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbMapping - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbMapping - - - - SmbGlobalMappingTypes - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbGlobalMapping - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbGlobalMapping - - - - SmbMultichannelConnectionTypes - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbMultichannelConnection - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbMultichannelConnection - - - - SmbOpenFileTypes - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbOpenFile - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbOpenFile - - - - SmbServerConfigurationTypes - - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbServerConfiguration - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/SMB/MSFT_SmbServerConfiguration - - - - SmbServerNetworkInterfaceTypes - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbServerNetworkInterface - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbServerNetworkInterface - - - - SmbSessionTypes - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbSession - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbSession - - - - SmbShareTypes - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbShare - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbShare - - - - SmbShareAccessControlEntryTypes - - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/SMB/MSFT_SmbShareAccessControlEntry - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbShareAccessControlEntry - - - - SmbConnectionTypes - - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/SMB/MSFT_SmbConnection - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbConnection - - - - SmbBandwidthLimitTypes - - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/SMB/MSFT_SmbBandwidthLimit - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbBandwidthLimit - - - - SmbServerCertificateMappingTypes - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbServerCertificateMapping - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbServerCertificateMapping - - - - - - - SmbClientConfigurationListView - - SmbClientConfigurationTypes - - - - - - - ConnectionCountPerRssNetworkInterface - - - DirectoryCacheEntriesMax - - - DirectoryCacheEntrySizeMax - - - DirectoryCacheLifetime - - - DormantFileLimit - - - EnableBandwidthThrottling - - - EnableByteRangeLockingOnReadOnlyFiles - - - EnableInsecureGuestLogons - - - EnableLargeMtu - - - EnableLoadBalanceScaleOut - - - EnableMultiChannel - - - EnableSecuritySignature - - - ExtendedSessionTimeout - - - FileInfoCacheEntriesMax - - - FileInfoCacheLifetime - - - FileNotFoundCacheEntriesMax - - - FileNotFoundCacheLifetime - - - KeepConn - - - MaxCmds - - - MaximumConnectionCountPerServer - - - OplocksDisabled - - - RequireSecuritySignature - - - SessionTimeout - - - UseOpportunisticLocking - - - WindowSizeThreshold - - - - - - - - SmbClientNetworkInterfaceTableView - - SmbClientNetworkInterfaceTypes - - - - - - - - - - - - - - - - - - - - - - - - - - - InterfaceIndex - - - RssCapable - - - RdmaCapable - - - - Import-Module SmbShare\SmbShare.Format.Helper.psm1 - Format-LinkSpeed $_.LinkSpeed - - - - IpAddresses - - - FriendlyName - - - - - - - - SmbClientNetworkInterfaceListView - - SmbClientNetworkInterfaceTypes - - - - - - - InterfaceIndex - - - RssCapable - - - RdmaCapable - - - - - Import-Module SmbShare\SmbShare.Format.Helper.psm1 - Format-LinkSpeed $_.LinkSpeed - - - - IpAddresses - - - FriendlyName - - - - - - - - SmbMappingTableView - - SmbMappingTypes - - - - - - - - - - - - - - - - - - Status - - - LocalPath - - - RemotePath - - - - - - - - SmbMappingListView - - SmbMappingTypes - - - - - - - Status - - - LocalPath - - - RemotePath - - - - - - - - SmbGlobalMappingTableView - - SmbGlobalMappingTypes - - - - - - - - - - - - - - - - - - Status - - - LocalPath - - - RemotePath - - - - - - - - SmbGlobalMappingListView - - SmbGlobalMappingTypes - - - - - - - Status - - - LocalPath - - - RemotePath - - - - - - - - SmbConnectiontNetworkInterfaceTableView - - SmbMultichannelConnectionTypes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ServerName - - - Selected - - - ClientIpAddress - - - ServerIpAddress - - - ClientInterfaceIndex - - - ServerInterfaceIndex - - - ClientRSSCapable - - - ClientRdmaCapable - - - - - - - - SmbMultichannelConnectionListView - - SmbMultichannelConnectionTypes - - - - - - - ServerName - - - Selected - - - Failed - - - FailureCount - - - ClientInterfaceIndex - - - ClientRSSCapable - - - ClientRdmaCapable - - - - - Import-Module SmbShare\SmbShare.Format.Helper.psm1 - Format-LinkSpeed $_.ClientLinkSpeed - - - - ClientIpAddress - - - ServerInterfaceIndex - - - ServerRSSCapable - - - ServerRdmaCapable - - - - - Import-Module SmbShare\SmbShare.Format.Helper.psm1 - Format-LinkSpeed $_.ServerLinkSpeed - - - - ServerIpAddress - - - MaxChannels - - - CurrentChannels - - - - - - - - SmbOpenFilenTableView - - SmbOpenFileTypes - - - - - - - - - - - - - - - - - - - - - - - - - - - FileId - - - SessionId - - - Path - - - ShareRelativePath - - - ClientComputerName - - - ClientUserName - - - - - - - - SmbOpenFileListView - - SmbOpenFileTypes - - - - - - - FileId - - - SessionId - - - Path - - - ShareRelativePath - - - ClientComputerName - - - ClientUserName - - - - - - - - SmbServerConfigurationListView - - SmbServerConfigurationTypes - - - - - - - AnnounceComment - - - AnnounceServer - - - AsynchronousCredits - - - AuditSmb1Access - - - AutoDisconnectTimeout - - - AutoShareServer - - - AutoShareWorkstation - - - CachedOpenLimit - - - DurableHandleV2TimeoutInSeconds - - - EnableAuthenticateUserSharing - - - EnableDownlevelTimewarp - - - EnableForcedLogoff - - - EnableLeasing - - - EnableMultiChannel - - - EnableOplocks - - - EnableSecuritySignature - - - EnableSMB1Protocol - - - EnableSMB2Protocol - - - EnableStrictNameChecking - - - EncryptData - - - IrpStackSize - - - KeepAliveTime - - - MaxChannelPerSession - - - MaxMpxCount - - - MaxSessionPerConnection - - - MaxThreadsPerQueue - - - MaxWorkItems - - - NullSessionPipes - - - NullSessionShares - - - OplockBreakWait - - - PendingClientTimeoutInSeconds - - - RejectUnencryptedAccess - - - RequireSecuritySignature - - - ServerHidden - - - Smb2CreditsMax - - - Smb2CreditsMin - - - SmbServerNameHardeningLevel - - - TreatHostAsStableStorage - - - ValidateAliasNotCircular - - - ValidateShareScope - - - ValidateShareScopeNotAliased - - - ValidateTargetName - - - - - - - - SmbServerNetworkInterfaceTableView - - SmbServerNetworkInterfaceTypes - - - - - - - - - - - - - - - - - - - - - - - - - - - ScopeName - - - InterfaceIndex - - - RssCapable - - - RdmaCapable - - - - Import-Module SmbShare\SmbShare.Format.Helper.psm1 - Format-LinkSpeed $_.LinkSpeed - - - - IpAddress - - - - - - - - SmbServerNetworkInterfaceListView - - SmbServerNetworkInterfaceTypes - - - - - - - ScopeName - - - InterfaceIndex - - - RssCapable - - - RdmaCapable - - - - - Import-Module SmbShare\SmbShare.Format.Helper.psm1 - Format-LinkSpeed $_.LinkSpeed - - - - IpAddress - - - - - - - - SmbSessionTableView - - SmbSessionTypes - - - - - - - - - - - - - - - - - - - - - SessionId - - - ClientComputerName - - - ClientUserName - - - NumOpens - - - - - - - - SmbSessionListView - - SmbSessionTypes - - - - - - - SessionId - - - ClientComputerName - - - ClientUserName - - - NumOpens - - - SecondsIdle - - - SecondsExists - - - - - - - - SmbShareAccessControlEntryTableView - - SmbShareAccessControlEntryTypes - - - - - - - - - - - - - - - - - - - - - - - - Name - - - ScopeName - - - AccountName - - - AccessControlType - - - AccessRight - - - - - - - - SmbShareAccessControlEntryListView - - SmbShareAccessControlEntryTypes - - - - - - - Name - - - ScopeName - - - AccountName - - - AccessControlType - - - AccessRight - - - - - - - - SmbShareTableView - - SmbShareTypes - - - - - - - - - - - - - - - - - - - - - Name - - - ScopeName - - - Path - - - Description - - - - - - - - SmbShareListView - - SmbShareTypes - - - - - - - Name - - - ScopeName - - - Path - - - Description - - - - - - - - SmbConnectionTableView - - SmbConnectionTypes - - - - - - - - - - - - - - - - - - - - - - - - - - - ServerName - - - ShareName - - - UserName - - - Credential - - - Dialect - - - NumOpens - - - - - - - - SmbConnectionListView - - SmbConnectionTypes - - - - - - - ServerName - - - ShareName - - - UserName - - - Credential - - - Dialect - - - NumOpens - - - - - - - - SmbBandwidthLimitTableView - - SmbBandwidthLimitTypes - - - - - - - - - - - - - - - Category - - - BytesPerSecond - - - - - - - - SmbServerCertificateMappingTableView - - SmbServerCertificateMappingTypes - - - - - - - - - - - - - - - - - - - - - - - - Name - - - Subject - - - Thumbprint - - - DisplayName - - - Type - - - - - - - - diff --git a/newton-cn/bin/Modules/SmbShare/Smb.types.ps1xml b/newton-cn/bin/Modules/SmbShare/Smb.types.ps1xml deleted file mode 100644 index 3dd9cfe..0000000 --- a/newton-cn/bin/Modules/SmbShare/Smb.types.ps1xml +++ /dev/null @@ -1,453 +0,0 @@ - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbShare - - - PresetPathAcl - - $acl = Get-Acl ($this.PSBase.CimInstanceProperties['Path'].Value) - $acl.SetSecurityDescriptorSddlForm( $this.PSBase.CimInstanceProperties['SecurityDescriptor'].Value, [System.Security.AccessControl.AccessControlSections]::Access ) - - $newacl = Get-Acl ($this.PSBase.CimInstanceProperties['Path'].Value) - $newacl.SetSecurityDescriptorSddlForm( $this.PSBase.CimInstanceProperties['SecurityDescriptor'].Value, [System.Security.AccessControl.AccessControlSections]::Access ) - - - $type = [System.Security.Principal.SecurityIdentifier] - $flag = [System.Security.AccessControl.InheritanceFlags]::ContainerInherit,[System.Security.AccessControl.InheritanceFlags]::ObjectInherit - $rules = $acl.GetAccessRules( $true, $false, $type) - - # - # First clear all rules fron $newacl - # - For( $i=0; $i -lt $rules.Count; $i++ ) - { - $newacl.PurgeAccessRules( $rules[$i].IdentityReference ) - } - - # - # Now add the rules back with Container Inheritance and Object Inheritance flags set - # - For( $i=0; $i -lt $rules.Count; $i++ ) - { - $modifiedRule = new-object System.Security.AccessControl.FileSystemAccessRule $rules[$i].IdentityReference,$rules[$i].FileSystemRights,$flag,$rules[$i].PropagationFlags,$rules[$i].AccessControlType - - $newacl.AddAccessRule( $modifiedRule) - } - - $newacl - - - - - ShareState - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.ShareState] ($this.PSBase.CimInstanceProperties['ShareState'].Value) - - - - AvailabilityType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.AvailabilityType] ($this.PSBase.CimInstanceProperties['AvailabilityType'].Value) - - - - ShareType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.ShareType] ($this.PSBase.CimInstanceProperties['ShareType'].Value) - - - - FolderEnumerationMode - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.FolderEnumerationMode] ($this.PSBase.CimInstanceProperties['FolderEnumerationMode'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['FolderEnumerationMode'].Value = [System.UInt32] [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.FolderEnumerationMode] $newValue - - - - CachingMode - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.CachingMode] ($this.PSBase.CimInstanceProperties['CachingMode'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['CachingMode'].Value = [System.UInt32] [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.CachingMode] $newValue - - - - LeasingMode - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.LeasingMode] ($this.PSBase.CimInstanceProperties['LeasingMode'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['LeasingMode'].Value = [System.UInt32] [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.LeasingMode] $newValue - - - - SmbInstance - - if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) - { - $SmbInstance = 0; - } - else - { - $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); - } - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbShare - - - ShareState - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.ShareState] ($this.PSBase.CimInstanceProperties['ShareState'].Value) - - - - AvailabilityType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.AvailabilityType] ($this.PSBase.CimInstanceProperties['AvailabilityType'].Value) - - - - ShareType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.ShareType] ($this.PSBase.CimInstanceProperties['ShareType'].Value) - - - - FolderEnumerationMode - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.FolderEnumerationMode] ($this.PSBase.CimInstanceProperties['FolderEnumerationMode'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['FolderEnumerationMode'].Value = [System.UInt32] [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.FolderEnumerationMode] $newValue - - - - CachingMode - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.CachingMode] ($this.PSBase.CimInstanceProperties['CachingMode'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['CachingMode'].Value = [System.UInt32] [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.CachingMode] $newValue - - - - SmbInstance - - if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) - { - $SmbInstance = 0; - } - else - { - $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); - } - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbShareAccessControlEntry - - - AccessControlType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.ShareAccessControlType] ($this.PSBase.CimInstanceProperties['AccessControlType'].Value) - - - - AccessRight - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.ShareAccessRight] ($this.PSBase.CimInstanceProperties['AccessRight'].Value) - - - - - - - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/SMB/MSFT_SmbShareAccessControlEntry - - - AccessControlType - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.ShareAccessControlType] ($this.PSBase.CimInstanceProperties['AccessControlType'].Value) - - - - AccessRight - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.ShareAccessRight] ($this.PSBase.CimInstanceProperties['AccessRight'].Value) - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbMapping - - - Status - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.MappingStatus] ($this.PSBase.CimInstanceProperties['Status'].Value) - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbMapping - - - Status - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.MappingStatus] ($this.PSBase.CimInstanceProperties['Status'].Value) - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbGlobalMapping - - - Status - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.MappingStatus] ($this.PSBase.CimInstanceProperties['Status'].Value) - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbGlobalMapping - - - Status - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.MappingStatus] ($this.PSBase.CimInstanceProperties['Status'].Value) - - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbBandwidthLimit - - - Category - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.BandwidthLimitCategory] ($this.PSBase.CimInstanceProperties['Category'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Category'].Value = [System.UInt32] [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.BandwidthLimitCategory] $newValue - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbBandwidthLimit - - - Category - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.BandwidthLimitCategory] ($this.PSBase.CimInstanceProperties['Category'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['Category'].Value = [System.UInt32] [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.BandwidthLimitCategory] $newValue - - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbSession - - - SmbInstance - - if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) - { - $SmbInstance = 0; - } - else - { - $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); - } - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbSession - - - SmbInstance - - if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) - { - $SmbInstance = 0; - } - else - { - $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); - } - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) - - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbOpenFile - - - SmbInstance - - if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) - { - $SmbInstance = 0; - } - else - { - $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); - } - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbOpenFile - - - SmbInstance - - if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) - { - $SmbInstance = 0; - } - else - { - $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); - } - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) - - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbConnection - - - SmbInstance - - if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) - { - $SmbInstance = 0; - } - else - { - $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); - } - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbConnection - - - SmbInstance - - if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) - { - $SmbInstance = 0; - } - else - { - $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); - } - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) - - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbMultichannelConnection - - - SmbInstance - - if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) - { - $SmbInstance = 0; - } - else - { - $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); - } - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbMultichannelConnection - - - SmbInstance - - if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) - { - $SmbInstance = 0; - } - else - { - $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); - } - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) - - - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbServerCertificateMapping - - - Type - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbServerCertificateMapping.Type] ($this.PSBase.CimInstanceProperties['Type'].Value) - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbServerCertificateMapping - - - Type - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbServerCertificateMapping.Type] ($this.PSBase.CimInstanceProperties['Type'].Value) - - - - - diff --git a/newton-cn/bin/Modules/SmbShare/SmbBandwidthLimit.cdxml b/newton-cn/bin/Modules/SmbShare/SmbBandwidthLimit.cdxml deleted file mode 100644 index cabd254..0000000 --- a/newton-cn/bin/Modules/SmbShare/SmbBandwidthLimit.cdxml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - 1.0 - - SmbBandwidthLimit - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/SmbShare/SmbClientConfiguration.cdxml b/newton-cn/bin/Modules/SmbShare/SmbClientConfiguration.cdxml deleted file mode 100644 index 256185a..0000000 --- a/newton-cn/bin/Modules/SmbShare/SmbClientConfiguration.cdxml +++ /dev/null @@ -1,237 +0,0 @@ - - - - 1.0 - - SmbClientConfiguration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/SmbShare/SmbClientNetworkInterface.cdxml b/newton-cn/bin/Modules/SmbShare/SmbClientNetworkInterface.cdxml deleted file mode 100644 index 6a9a01d..0000000 --- a/newton-cn/bin/Modules/SmbShare/SmbClientNetworkInterface.cdxml +++ /dev/null @@ -1,26 +0,0 @@ - - - - 1.0 - - SmbClientNetworkInterface - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/SmbShare/SmbComponent.cdxml b/newton-cn/bin/Modules/SmbShare/SmbComponent.cdxml deleted file mode 100644 index 15d54c2..0000000 --- a/newton-cn/bin/Modules/SmbShare/SmbComponent.cdxml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - 1.0 - SmbComponent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/SmbShare/SmbConnection.cdxml b/newton-cn/bin/Modules/SmbShare/SmbConnection.cdxml deleted file mode 100644 index 0358b15..0000000 --- a/newton-cn/bin/Modules/SmbShare/SmbConnection.cdxml +++ /dev/null @@ -1,56 +0,0 @@ - - - - 1.0 - - SmbConnection - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/SmbShare/SmbGlobalMapping.cdxml b/newton-cn/bin/Modules/SmbShare/SmbGlobalMapping.cdxml deleted file mode 100644 index 3071864..0000000 --- a/newton-cn/bin/Modules/SmbShare/SmbGlobalMapping.cdxml +++ /dev/null @@ -1,169 +0,0 @@ - - - - 1.0 - SmbGlobalMapping - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/SmbShare/SmbMapping.cdxml b/newton-cn/bin/Modules/SmbShare/SmbMapping.cdxml deleted file mode 100644 index 389b918..0000000 --- a/newton-cn/bin/Modules/SmbShare/SmbMapping.cdxml +++ /dev/null @@ -1,177 +0,0 @@ - - - - 1.0 - - SmbMapping - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/SmbShare/SmbMultichannelConnection.cdxml b/newton-cn/bin/Modules/SmbShare/SmbMultichannelConnection.cdxml deleted file mode 100644 index 827fdf5..0000000 --- a/newton-cn/bin/Modules/SmbShare/SmbMultichannelConnection.cdxml +++ /dev/null @@ -1,83 +0,0 @@ - - - - 1.0 - - SmbMultichannelConnection - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/SmbShare/SmbMultichannelConstraint.cdxml b/newton-cn/bin/Modules/SmbShare/SmbMultichannelConstraint.cdxml deleted file mode 100644 index a1d73fc..0000000 --- a/newton-cn/bin/Modules/SmbShare/SmbMultichannelConstraint.cdxml +++ /dev/null @@ -1,168 +0,0 @@ - - - - - 1.0 - - SmbMultichannelConstraint - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/SmbShare/SmbOpenFile.cdxml b/newton-cn/bin/Modules/SmbShare/SmbOpenFile.cdxml deleted file mode 100644 index c32a50e..0000000 --- a/newton-cn/bin/Modules/SmbShare/SmbOpenFile.cdxml +++ /dev/null @@ -1,149 +0,0 @@ - - - - 1.0 - - SmbOpenFile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/SmbShare/SmbScriptModule.psm1 b/newton-cn/bin/Modules/SmbShare/SmbScriptModule.psm1 deleted file mode 100644 index 9dbba10..0000000 --- a/newton-cn/bin/Modules/SmbShare/SmbScriptModule.psm1 +++ /dev/null @@ -1,185 +0,0 @@ - data _system_translations - { - ConvertFrom-StringData @' - - # Fallback text - # Copy all the strings in the psd1 file here - - msg_ad_forest = SMB Delegation cmdlets require the Active Directory forest to be in Windows Server 2012 forest functional level. - - msg_ad_cmdlets = SMB Delegation cmdlets require the installation of the Active Directory module for Windows PowerShell. - -'@ -} - -Import-LocalizedData -BindingVariable _system_translations -fileName SmbLocalization.psd1 - - function Set-SmbPathAcl - { - [CmdletBinding()] - param( - [Parameter(Mandatory=$true)] - [string] - $ShareName, - - [Parameter()] - [string] - $ScopeName = $null - ) - - if( ($null -ne $ScopeName ) -and ( "" -ne $ScopeName) ) - { - (Get-SmbShare -Name $ShareName -ScopeName $ScopeName ).PresetPathACL | Set-Acl - } - else - { - (Get-SmbShare -Name $ShareName ).PresetPathACL | Set-Acl - } - - } - -function CheckDelegationPrerequisites -{ - if( $null -eq (Get-Command -Module ActiveDirectory) ) - { - Write-Error $_system_translations.msg_ad_cmdlets - - return $false - } - - # - # Forest mode should be greater than or equal to Windows2012Forest - # - if( (Get-AdForest).ForestMode.ToInt32($null) -lt [Microsoft.ActiveDirectory.Management.AdForestMode]::Windows2012Forest.ToInt32($null) ) - { - Write-Error $_system_translations.msg_ad_forest - - return $false - } - - return $true -} - - function Get-SmbDelegation - { - [CmdletBinding()] - param( - [Parameter(Mandatory=$true)] - [string] - $SmbServer - ) - - $check = CheckDelegationPrerequisites - - if( -not $check ) - { - return - } - - $result = @() - - $fsAD = Get-ADComputer -filter {Name -Like $SmbServer} -Properties 'msds-allowedtoactonbehalfofotheridentity' - - foreach ($AllowedAccount in $fsAD."msDS-AllowedToActOnBehalfOfOtherIdentity".Access) - { - $samAccountName = $AllowedAccount.IdentityReference.Value - $samAccountName = $samAccountName.Remove(0, ($samAccountName.IndexOf("\")+1)) - - $result += Get-ADComputer -Filter {SamAccountName -Like $samAccountName} - } - - $result.Name - } - - function Enable-SmbDelegation - { - [CmdletBinding()] - param( - [Parameter(Mandatory=$true)] - [string] - $SmbClient, - - [Parameter(Mandatory=$true)] - [string] - $SmbServer - ) - - $check = CheckDelegationPrerequisites - - if( -not $check ) - { - return - } - - $delegationPrinciples = @() - $fsAD = Get-ADComputer -Filter {Name -Like $SmbServer} -Properties msDS-AllowedToActOnBehalfOfOtherIdentity - - foreach ($AllowedAccount in $fsAD."msDS-AllowedToActOnBehalfOfOtherIdentity".Access) - { - $samAccountName = $AllowedAccount.IdentityReference.Value - $samAccountName = $samAccountName.Remove(0, ($samAccountName.IndexOf("\")+1)) - - $delegationPrinciples += Get-ADComputer -Filter {SamAccountName -Like $samAccountName} - } - - $delegationPrinciples += Get-ADComputer -Identity $SmbClient - $fsAD | Set-ADComputer -PrincipalsAllowedToDelegateToAccount $delegationPrinciples - } - - - function Disable-SmbDelegation - { - [CmdletBinding()] - param( - [Parameter()] - [string] - $SmbClient, - - [Parameter(Mandatory=$true)] - [string] - $SmbServer, - - [System.Management.Automation.SwitchParameter] - [bool] - $Force = $false - ) - - $check = CheckDelegationPrerequisites - - if( -not $check ) - { - return - } - - $delegationPrinciples = @() - $fsAD = Get-ADComputer -Filter {Name -Like $SmbServer} -Properties msDS-AllowedToActOnBehalfOfOtherIdentity - - if( ($null -ne $SmbClient) -and ("" -ne $SmbClient) ) - { - foreach ($AllowedAccount in $fsAD."msDS-AllowedToActOnBehalfOfOtherIdentity".Access) - { - $samAccountName = $AllowedAccount.IdentityReference.Value - $samAccountName = $samAccountName.Remove(0, ($samAccountName.IndexOf("\")+1)) - - $adc = Get-ADComputer -Filter {SamAccountName -Like $samAccountName} - - if( $adc.Name -ne $SmbClient ) - { - $delegationPrinciples += $adc - } - } - } - - $fsAD | Set-ADComputer -PrincipalsAllowedToDelegateToAccount $delegationPrinciples - } - - Set-Alias -Name ssmbp -Value Set-SmbPathAcl - Set-Alias -Name gsmbd -Value Get-SmbDelegation - Set-Alias -Name esmbd -Value Enable-SmbDelegation - Set-Alias -Name dsmbd -Value Disable-SmbDelegation - - - Export-ModuleMember -Function Set-SmbPathAcl -Alias ssmbp - Export-ModuleMember -Function Get-SmbDelegation -Alias gsmbd - Export-ModuleMember -Function Enable-SmbDelegation -Alias esmbd - Export-ModuleMember -Function Disable-SmbDelegation -Alias dsmbd \ No newline at end of file diff --git a/newton-cn/bin/Modules/SmbShare/SmbServerCertificateMapping.cdxml b/newton-cn/bin/Modules/SmbShare/SmbServerCertificateMapping.cdxml deleted file mode 100644 index b20d89c..0000000 --- a/newton-cn/bin/Modules/SmbShare/SmbServerCertificateMapping.cdxml +++ /dev/null @@ -1,198 +0,0 @@ - - - - - 1.0 - - SmbServerCertificateMapping - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/SmbShare/SmbServerConfiguration.cdxml b/newton-cn/bin/Modules/SmbShare/SmbServerConfiguration.cdxml deleted file mode 100644 index cf28b0b..0000000 --- a/newton-cn/bin/Modules/SmbShare/SmbServerConfiguration.cdxml +++ /dev/null @@ -1,350 +0,0 @@ - - - - 1.0 - - SmbServerConfiguration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/SmbShare/SmbServerNetworkInterface.cdxml b/newton-cn/bin/Modules/SmbShare/SmbServerNetworkInterface.cdxml deleted file mode 100644 index fd433a3..0000000 --- a/newton-cn/bin/Modules/SmbShare/SmbServerNetworkInterface.cdxml +++ /dev/null @@ -1,26 +0,0 @@ - - - - 1.0 - - SmbServerNetworkInterface - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/SmbShare/SmbSession.cdxml b/newton-cn/bin/Modules/SmbShare/SmbSession.cdxml deleted file mode 100644 index dc8b5a4..0000000 --- a/newton-cn/bin/Modules/SmbShare/SmbSession.cdxml +++ /dev/null @@ -1,136 +0,0 @@ - - - - 1.0 - - SmbSession - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/SmbShare/SmbShare.Format.Helper.psm1 b/newton-cn/bin/Modules/SmbShare/SmbShare.Format.Helper.psm1 deleted file mode 100644 index bcb34a6..0000000 --- a/newton-cn/bin/Modules/SmbShare/SmbShare.Format.Helper.psm1 +++ /dev/null @@ -1,43 +0,0 @@ -<# - -Copyright (c) 2011 Microsoft Corporation. All Rights Reserved. - -Module Name: - - SmbShare.Format.Helper.psm1 - -Description: - - Provides helper routines for formatting the output of - SmbShare CmdLets. - -#> - -function Format-LinkSpeed($LinkSpeed) -<# -Function Description: - This function returns the link speed of a network adapter - -Arguments: - $LinkSpeed - -Return Value: - Formatted link speed -#> -{ - $out= - if($LinkSpeed -eq $null) - {"Unknown"} - else - { - switch ($LinkSpeed) - { - {$_ -lt 1000} {"$_ bps"; break} - {$_ -lt 1000000} {"$($_/1000) Kbps"; break} - {$_ -lt 1000000000} {"$($_/1000000) Mbps"; break} - default {"$($_/1000000000) Gbps"} - } - } - - return $out -} \ No newline at end of file diff --git a/newton-cn/bin/Modules/SmbShare/SmbShare.cdxml b/newton-cn/bin/Modules/SmbShare/SmbShare.cdxml deleted file mode 100644 index 1067238..0000000 --- a/newton-cn/bin/Modules/SmbShare/SmbShare.cdxml +++ /dev/null @@ -1,776 +0,0 @@ - - - - - 1.0 - - SmbShare - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/SmbShare/SmbShare.psd1 b/newton-cn/bin/Modules/SmbShare/SmbShare.psd1 deleted file mode 100644 index 6445c63..0000000 --- a/newton-cn/bin/Modules/SmbShare/SmbShare.psd1 +++ /dev/null @@ -1,114 +0,0 @@ - -@{ - GUID = '3af1699d-cc54-4e54-81cf-28d2df5cce0a' - Author="Microsoft Corporation" - CompanyName="Microsoft Corporation" - Copyright="© Microsoft Corporation. All rights reserved." - HelpInfoUri="http://go.microsoft.com/fwlink/?linkid=390827" - NestedModules = @('SmbShare.cdxml', - 'SmbSession.cdxml', - 'SmbServerNetworkInterface.cdxml', - 'SmbServerConfiguration.cdxml', - 'SmbOpenFile.cdxml', - 'SmbMultichannelConnection.cdxml', - 'SmbMapping.cdxml', - 'SmbGlobalMapping.cdxml', - 'SmbClientNetworkInterface.cdxml', - 'SmbClientConfiguration.cdxml', - 'SmbConnection.cdxml', - 'SmbMultichannelConstraint.cdxml', - 'SmbBandwidthLimit.cdxml', - 'SmbServerCertificateMapping.cdxml', - 'SmbComponent.cdxml', - 'SmbScriptModule.psm1') - FormatsToProcess = @('Smb.format.ps1xml') - TypesToProcess = @('Smb.types.ps1xml') - ModuleVersion = '2.0.0.0' - AliasesToExport = @('gsmbs', - 'nsmbs', - 'rsmbs', - 'ssmbs', - 'gsmba', - 'grsmba', - 'rksmba', - 'blsmba', - 'ulsmba', - 'gsmbse', - 'cssmbse', - 'gsmbo', - 'cssmbo', - 'gsmbsc', - 'ssmbsc', - 'gsmbcc', - 'ssmbcc', - 'gsmbc', - 'gsmbm', - 'nsmbm', - 'rsmbm', - 'gsmbcn', - 'gsmbsn', - 'gsmbmc', - 'udsmbmc', - 'gsmbt', - 'nsmbt', - 'rsmbt', - 'ssmbp', - 'gsmbb', - 'ssmbb', - 'rsmbb', - 'gsmbd', - 'esmbd', - 'dsmbd', - 'gsmbgm', - 'nsmbgm', - 'rsmbgm', - 'gsmbscm', - 'rsmbscm', - 'nsmbscm', - 'rsmbc') - CmdletsToExport = @() - FunctionsToExport = @('Get-SmbShare', - 'Remove-SmbShare', - 'Set-SmbShare', - 'Block-SmbShareAccess', - 'Unblock-SmbShareAccess', - 'Grant-SmbShareAccess', - 'Revoke-SmbShareAccess', - 'Get-SmbShareAccess', - 'New-SmbShare', - 'Get-SmbSession', - 'Close-SmbSession', - 'Get-SmbServerNetworkInterface', - 'Get-SmbServerConfiguration', - 'Set-SmbServerConfiguration', - 'Get-SmbOpenFile', - 'Close-SmbOpenFile', - 'Get-SmbMultichannelConnection', - 'Update-SmbMultichannelConnection', - 'Get-SmbMapping', - 'Remove-SmbMapping', - 'New-SmbMapping', - 'Get-SmbClientNetworkInterface', - 'Get-SmbClientConfiguration', - 'Set-SmbClientConfiguration', - 'Get-SmbConnection', - 'Get-SmbMultichannelConstraint', - 'New-SmbMultichannelConstraint', - 'Remove-SmbMultichannelConstraint', - 'Set-SmbPathAcl', - 'Get-SmbBandWidthLimit', - 'Set-SmbBandwidthLimit', - 'Remove-SmbBandwidthLimit', - 'Get-SmbDelegation', - 'Enable-SmbDelegation', - 'Disable-SmbDelegation', - 'Get-SmbGlobalMapping', - 'Remove-SmbGlobalMapping', - 'New-SmbGlobalMapping', - 'Get-SmbServerCertificateMapping', - 'New-SmbServerCertificateMapping', - 'Remove-SmbServerCertificateMapping', - 'Remove-SMBComponent') - PowerShellVersion = '5.1' - CompatiblePSEditions = @('Desktop','Core') -} diff --git a/newton-cn/bin/Modules/SmbShare/en-US/SmbLocalization.psd1 b/newton-cn/bin/Modules/SmbShare/en-US/SmbLocalization.psd1 deleted file mode 100644 index 621b912..0000000 --- a/newton-cn/bin/Modules/SmbShare/en-US/SmbLocalization.psd1 +++ /dev/null @@ -1,11 +0,0 @@ -# Localized 12/07/2019 01:04 AM (GMT) 303:6.40.20520 SmbLocalization.psd1 -# Only add new (name,value) pairs to the end of this table -# Do not remove, insert or re-arrange entries - -ConvertFrom-StringData @' - - msg_ad_forest = SMB Delegation cmdlets require the Active Directory forest to be in Windows Server 2012 forest functional level. - - msg_ad_cmdlets = SMB Delegation cmdlets require the installation of the Active Directory module for Windows PowerShell. - -'@ diff --git a/newton-cn/bin/Modules/SmbWitness/SmbWitness.Format.ps1xml b/newton-cn/bin/Modules/SmbWitness/SmbWitness.Format.ps1xml deleted file mode 100644 index 5230543..0000000 --- a/newton-cn/bin/Modules/SmbWitness/SmbWitness.Format.ps1xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - SmbWitnessClientEntryType - - Microsoft.Management.Infrastructure.CimInstance#root\Microsoft\Windows\SMBWitness\MSFT_SmbWitnessClient - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbWitnessClient - - - - - - SmbWitnessClientTableView - - SmbWitnessClientEntryType - - - - - - - - - - - - - - - - - - - - - - - - - - - ClientName - - - WitnessNodeName - - - FileServerNodeName - - - NetworkName - - - ShareName - - - State - - - - - - - - diff --git a/newton-cn/bin/Modules/SmbWitness/SmbWitness.psd1 b/newton-cn/bin/Modules/SmbWitness/SmbWitness.psd1 deleted file mode 100644 index 9adc04c..0000000 --- a/newton-cn/bin/Modules/SmbWitness/SmbWitness.psd1 +++ /dev/null @@ -1,19 +0,0 @@ - -@{ - GUID = 'ef018256-3318-4e74-a823-158022778487' - Author="Microsoft Corporation" - CompanyName="Microsoft Corporation" - Copyright="© Microsoft Corporation. All rights reserved." - NestedModules = @('SmbWitnessWmiClient.cdxml') - FormatsToProcess = @('SmbWitness.format.ps1xml') - TypesToProcess = @('SmbWitness.types.ps1xml') - ModuleVersion = '2.0.0.0' - AliasesToExport = @('gsmbw', - 'msmbw', - 'Move-SmbClient') - FunctionsToExport = @('Get-SmbWitnessClient', - 'Move-SmbWitnessClient') - PowerShellVersion = '5.1' - HelpInfoUri= "http://go.microsoft.com/fwlink/?linkid=390828" - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/SmbWitness/SmbWitness.types.ps1xml b/newton-cn/bin/Modules/SmbWitness/SmbWitness.types.ps1xml deleted file mode 100644 index 36208d1..0000000 --- a/newton-cn/bin/Modules/SmbWitness/SmbWitness.types.ps1xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbWitnessClient - - - State - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbWitnessClient.State] ($this.PSBase.CimInstanceProperties['State'].Value) - - - - Flags - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbWitnessClient.Flags] ($this.PSBase.CimInstanceProperties['Flags'].Value) - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbWitnessClient - - - State - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbWitnessClient.State] ($this.PSBase.CimInstanceProperties['State'].Value) - - - - Flags - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbWitnessClient.Flags] ($this.PSBase.CimInstanceProperties['Flags'].Value) - - - - - diff --git a/newton-cn/bin/Modules/SmbWitness/SmbWitnessWmiClient.cdxml b/newton-cn/bin/Modules/SmbWitness/SmbWitnessWmiClient.cdxml deleted file mode 100644 index c7e19b1..0000000 --- a/newton-cn/bin/Modules/SmbWitness/SmbWitnessWmiClient.cdxml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - 1.0 - SmbWitnessClient - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/StartLayout/GetStartApps.psm1 b/newton-cn/bin/Modules/StartLayout/GetStartApps.psm1 deleted file mode 100644 index 3f5adc1..0000000 --- a/newton-cn/bin/Modules/StartLayout/GetStartApps.psm1 +++ /dev/null @@ -1,14 +0,0 @@ -function Get-StartApps($Name) { - Get-AllStartApps | Where-Object { $_.Name -like "*$Name*" } -} - -function Get-AllStartApps { - (New-Object -ComObject Shell.Application). - NameSpace("shell:::{4234d49b-0245-4df3-b780-3893943456e1}"). # FOLDERID_AppsFolder - Items() | % { - [PSCustomObject]@{ - 'Name'=$_.Name - 'AppID'=$_.Path - } - } -} \ No newline at end of file diff --git a/newton-cn/bin/Modules/StartLayout/StartLayout.psd1 b/newton-cn/bin/Modules/StartLayout/StartLayout.psd1 deleted file mode 100644 index 0aadcdb..0000000 --- a/newton-cn/bin/Modules/StartLayout/StartLayout.psd1 +++ /dev/null @@ -1,15 +0,0 @@ -@{ -GUID="C361139B-C043-44A9-B94F-513FBAF1AF0D" -Author="Microsoft Corporation" -CompanyName="Microsoft Corporation" -Copyright="© Microsoft Corporation. All rights reserved." -ModuleVersion="1.0.0.2" -PowerShellVersion = '5.1' -ClrVersion="4.0" -RootModule="Microsoft.Windows.StartLayout.Commands" -NestedModules="GetStartApps.psm1" -CmdletsToExport="Export-StartLayout", "Import-StartLayout", "Export-StartLayoutEdgeAssets" -FunctionsToExport="Get-StartApps" -HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=390831" -CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/Storage/Disk.cdxml b/newton-cn/bin/Modules/Storage/Disk.cdxml deleted file mode 100644 index 77a39c2..0000000 --- a/newton-cn/bin/Modules/Storage/Disk.cdxml +++ /dev/null @@ -1,562 +0,0 @@ - - - 1.0.0.0 - Disk - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Storage/DiskImage.cdxml b/newton-cn/bin/Modules/Storage/DiskImage.cdxml deleted file mode 100644 index 872dd18..0000000 --- a/newton-cn/bin/Modules/Storage/DiskImage.cdxml +++ /dev/null @@ -1,150 +0,0 @@ - - - 1.0.0.0 - DiskImage - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/Storage/FileIntegrity.cdxml b/newton-cn/bin/Modules/Storage/FileIntegrity.cdxml deleted file mode 100644 index ea1f5d7..0000000 --- a/newton-cn/bin/Modules/Storage/FileIntegrity.cdxml +++ /dev/null @@ -1,92 +0,0 @@ - - - 1.0.0.0 - FileIntegrity - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Storage/FileServer.cdxml b/newton-cn/bin/Modules/Storage/FileServer.cdxml deleted file mode 100644 index e1846f8..0000000 --- a/newton-cn/bin/Modules/Storage/FileServer.cdxml +++ /dev/null @@ -1,210 +0,0 @@ - - - 1.0.0.0 - StorageFileServer - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/Storage/FileShare.cdxml b/newton-cn/bin/Modules/Storage/FileShare.cdxml deleted file mode 100644 index ba1b170..0000000 --- a/newton-cn/bin/Modules/Storage/FileShare.cdxml +++ /dev/null @@ -1,386 +0,0 @@ - - - 1.0.0.0 - FileShare - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/Storage/FileStorageTier.cdxml b/newton-cn/bin/Modules/Storage/FileStorageTier.cdxml deleted file mode 100644 index d270f61..0000000 --- a/newton-cn/bin/Modules/Storage/FileStorageTier.cdxml +++ /dev/null @@ -1,269 +0,0 @@ - - - 1.0.0.0 - FileStorageTier - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Storage/InitiatorId.cdxml b/newton-cn/bin/Modules/Storage/InitiatorId.cdxml deleted file mode 100644 index 9a7bc44..0000000 --- a/newton-cn/bin/Modules/Storage/InitiatorId.cdxml +++ /dev/null @@ -1,139 +0,0 @@ - - - 1.0.0.0 - InitiatorId - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Storage/InitiatorPort.cdxml b/newton-cn/bin/Modules/Storage/InitiatorPort.cdxml deleted file mode 100644 index 977454c..0000000 --- a/newton-cn/bin/Modules/Storage/InitiatorPort.cdxml +++ /dev/null @@ -1,152 +0,0 @@ - - - 1.0.0.0 - InitiatorPort - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Storage/MaskingSet.cdxml b/newton-cn/bin/Modules/Storage/MaskingSet.cdxml deleted file mode 100644 index 3b88138..0000000 --- a/newton-cn/bin/Modules/Storage/MaskingSet.cdxml +++ /dev/null @@ -1,524 +0,0 @@ - - - 1.0.0.0 - MaskingSet - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Storage/OffloadDataTransferSetting.cdxml b/newton-cn/bin/Modules/Storage/OffloadDataTransferSetting.cdxml deleted file mode 100644 index 86c2d2d..0000000 --- a/newton-cn/bin/Modules/Storage/OffloadDataTransferSetting.cdxml +++ /dev/null @@ -1,26 +0,0 @@ - - - 1.0.0.0 - OffloadDataTransferSetting - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/Storage/Partition.cdxml b/newton-cn/bin/Modules/Storage/Partition.cdxml deleted file mode 100644 index 2c0bdf1..0000000 --- a/newton-cn/bin/Modules/Storage/Partition.cdxml +++ /dev/null @@ -1,404 +0,0 @@ - - - 1.0.0.0 - Partition - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Storage/PhysicalDisk.cdxml b/newton-cn/bin/Modules/Storage/PhysicalDisk.cdxml deleted file mode 100644 index 23c102f..0000000 --- a/newton-cn/bin/Modules/Storage/PhysicalDisk.cdxml +++ /dev/null @@ -1,6 +0,0 @@ - - - 1.0.0.0 - PhysicalDisk - - diff --git a/newton-cn/bin/Modules/Storage/ResiliencySetting.cdxml b/newton-cn/bin/Modules/Storage/ResiliencySetting.cdxml deleted file mode 100644 index 69f9257..0000000 --- a/newton-cn/bin/Modules/Storage/ResiliencySetting.cdxml +++ /dev/null @@ -1,123 +0,0 @@ - - - 1.0.0.0 - ResiliencySetting - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/Storage/Storage.format.ps1xml b/newton-cn/bin/Modules/Storage/Storage.format.ps1xml deleted file mode 100644 index 158aaf6..0000000 --- a/newton-cn/bin/Modules/Storage/Storage.format.ps1xml +++ /dev/null @@ -1,2933 +0,0 @@ - - - - - DeviceInformation - - - - - DeviceNumber : - - DeviceNumber - - - DeviceGuid : - - DeviceGuid - - - FriendlyName : - - FriendlyName - - - SerialNumber : - - SerialNumber - - - AdapterSerialNumber : - - AdapterSerialNumber - - - FirmwareRevision : - - FirmwareRevision - - - BusType : - - BusType - - - MediaType : - - MediaType - - - IoTimeout : - - - if ($_.IoTimeout -gt 0) - { - $_.IoTimeout.ToString() + " seconds" - } - else - { - "Not available" - } - - - - - - - - - - - - DiskTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_Disk - - - - - - 6 - - - - - - - 32 - - - - 20 - - - - 20 - - - - 12 - - - - 10 - - - - - - - Number - - - FriendlyName - - - SerialNumber - - - HealthStatus - - - OperationalStatus - - - Right - - $size = $_.Size; - $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) - for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } - return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; - - - - PartitionStyle - - - - - - - - DiskListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_Disk - - - - - - - UniqueId - - - Number - - - Path - - - Manufacturer - - - Model - - - SerialNumber - - - - - $size = $_.Size; - $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) - for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } - return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; - - - - AllocatedSize - - - LogicalSectorSize - - - PhysicalSectorSize - - - NumberOfPartitions - - - PartitionStyle - - - IsReadOnly - - - IsSystem - - - IsBoot - - - - - - - - - PartitionTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_Partition - - - DiskId - - - - - - - 16 - - - - 11 - - - - - - - 10 - - - - - - - - - - PartitionNumber - - - DriveLetter - - - Offset - - - Right - - $size = $_.Size; - $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) - for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } - return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; - - - - Type - - - - - - - - PartitionListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_Partition - - - - - - - UniqueId - - - AccessPaths - - - DiskNumber - - - DiskPath - - - DriveLetter - - - Guid - - - IsActive - - - IsBoot - - - IsHidden - - - IsOffline - - - IsReadOnly - - - IsShadowCopy - - - IsDAX - - - IsSystem - - - NoDefaultDriveLetter - - - Offset - - - OperationalStatus - - - PartitionNumber - - - - - $size = $_.Size; - $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) - for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } - return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; - - - - Type - - - - - - - - - VirtualDiskTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_VirtualDisk - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FriendlyName - - - ResiliencySettingName - - - PhysicalDiskRedundancy - - - OperationalStatus - - - HealthStatus - - - Right - - $size = $_.Size; - $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) - for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } - return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; - - - - Right - - $footprint = $_.FootprintOnPool; - $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) - for ($i=0; $footprint -ge 1024 -and $i -lt $postfixes.Length; $i++) { $footprint = $footprint / 1024; } - return "" + [System.Math]::Round($footprint,2) + " " + $postfixes[$i]; - - - - Right - - $efficiency = ""; - if ($_.FootprintOnPool -gt 0) { $efficiency = ($_.AllocatedSize / $_.FootprintOnPool).ToString("P"); } - return $efficiency - - - - - - - - - - StorageTierTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageTier - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FriendlyName - - - TierClass - - - MediaType - - - ResiliencySettingName - - - PhysicalDiskRedundancy - - - Right - - $size = $_.Size; - $postfixes = @( "B ", "KB", "MB", "GB", "TB", "PB" ) - for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } - return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; - - - - Right - - $footprint = $_.FootprintOnPool; - $postfixes = @( "B ", "KB", "MB", "GB", "TB", "PB" ) - for ($i=0; $footprint -ge 1024 -and $i -lt $postfixes.Length; $i++) { $footprint = $footprint / 1024; } - return "" + [System.Math]::Round($footprint,2) + " " + $postfixes[$i]; - - - - Right - - $efficiency = ""; - if ($_.FootprintOnPool -gt 0) { $efficiency = ($_.Size / $_.FootprintOnPool).ToString("P"); } - return $efficiency - - - - - - - - - - StorageFaultDomainView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageFaultDomain - - - - - - 24 - - - - - - - - - - - - - 14 - - - - - - - - - - - return $_.ClassName.Replace('MSFT_', ''); - - - - FriendlyName - - - SerialNumber - - - PhysicalLocation - - - HealthStatus - - - OperationalStatus - - - - - - - - - PhysicalDiskTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_PhysicalDisk - - - - - - - - - - - - - - - - - - 9 - - - - - - - 14 - - - - 14 - - - - 10 - - - - - - - DeviceId - - - FriendlyName - - - SerialNumber - - - MediaType - - - CanPool - - - OperationalStatus - - - HealthStatus - - - Usage - - - Right - - $size = $_.Size; - $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) - for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } - return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; - - - - - - - - - AdvancedPhysicalDiskTableView - - Microsoft.Windows.StorageManagement.PhysicalDiskAdvancedProperties - - - - - - - - - - - - 20 - - - - 24 - - - - - - - $_.PhysicalDisk.FriendlyName - - - $_.PhysicalDisk.SerialNumber - - - Right - IsPowerProtected - - - Right - IsDeviceCacheEnabled - - - - - - - - - StorageError_v1TableView - - Microsoft.Windows.StorageManagement.StorageError_v1 - - - DeviceGuid - DeviceInformation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Right - - [DateTime]$datetime = $_.EventTime.ToString('yyyy/MM/dd HH:MM:00') - return $datetime.ToShortDateString() - - - - Right - - [DateTime]$datetime = $_.EventTime.ToString('yyyy/MM/dd HH:MM:00') - return $datetime.ToShortTimeString() - - - - Right - - return "0x" + [String]::Format('{0:x2}',$_.Command) - - - - Right - - return "0x" + [String]::Format('{0:x2}',$_.SrbStatus) - - - - Right - - return "0x" + [String]::Format('{0:x2}',$_.ScsiStatus) - - - - Right - - return "0x" + [String]::Format('{0:x2}',$_.SenseKey) - - - - Right - - return "0x" + [String]::Format('{0:x2}',$_.SenseCode) - - - - Right - - return "0x" + [String]::Format('{0:x2}',$_.SenseCodeQualifier) - - - - Right - - return [String]::Format('{0:N0}',$_.IoSize) - - - - Right - - return [String]::Format('{0:N0}',$_.LBA) - - - - - - - - - - StorageHistory_v5TableView - - Microsoft.Windows.StorageManagement.StorageHistory_v5 - - - DeviceGuid - DeviceInformation - - - - - - - - - - - - - - - - - - - - - - - - - - - Right - - [DateTime]$datetime = $_.EventTime.ToString('yyyy/MM/dd HH:00:00') - return $datetime.ToShortDateString() - - - - Right - - [DateTime]$datetime = $_.EventTime.ToString('yyyy/MM/dd HH:00:00') - return $datetime.ToShortTimeString() - - - - Right - - return [String]::Format('{0:N0}',$_.TotalIoCount) - - - - Right - MaxOutstandingCount - - - Right - - return [String]::Format('{0:N1}',$_.AvgIoLatency/10) - - - - Right - - return [String]::Format('{0:N1}',$_.MaxIoLatency/10) - - - - - - - - - StorageHistory_v11TableView - - Microsoft.Windows.StorageManagement.StorageHistory_v11 - - - DeviceGuid - DeviceInformation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Right - - [DateTime]$datetime = $_.EventTime.ToString('yyyy/MM/dd HH:00:00') - return $datetime.ToShortDateString() - - - - Right - - [DateTime]$datetime = $_.EventTime.ToString('yyyy/MM/dd HH:00:00') - return $datetime.ToShortTimeString() - - - - Right - - return [String]::Format('{0:N0}',$_.TotalIoCount) - - - - Right - - return [String]::Format('{0:N0}',$_.FailedIoCount) - - - - Right - MaxOutstandingCount - - - Right - - return [String]::Format('{0:N1}',$_.AvgIoLatency/10) - - - - Right - - return [String]::Format('{0:N1}',$_.MaxIoLatency/10) - - - - Right - - return [String]::Format('{0:N0}',$_.TotalQueueIoCount) - - - - Right - - return [String]::Format('{0:N1}',$_.AvgQueueIoWaitTime/10) - - - - Right - - return [String]::Format('{0:N1}',$_.MaxQueueIoWaitTime/10) - - - - Right - - return [String]::Format('{0:N0}',$_.QueueIoWaitExceededTimeoutCount) - - - - - - - - - - StorageHistoryAggregate_v5TableView - - Microsoft.Windows.StorageManagement.StorageHistoryAggregate_v5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DeviceNumber - - - FriendlyName - - - SerialNumber - - - BusType - - - MediaType - - - Right - - return [String]::Format('{0:N0}',$_.TotalIoCount) - - - - Right - - return [String]::Format('{0:N1}',$_.AvgIoLatency/10) - - - - Right - - return [String]::Format('{0:N1}',$_.MaxIoLatency/10) - - - - Right - EventCount - - - Right - - if ($_.BucketHighestLatencyCount[0] -gt 0) - { - return $_.BucketHighestLatencyCount[0] - } - - - - Right - - if ($_.BucketHighestLatencyCount[1] -gt 0) - { - return $_.BucketHighestLatencyCount[1] - } - - - - Right - - if ($_.BucketHighestLatencyCount[2] -gt 0) - { - return $_.BucketHighestLatencyCount[2] - } - - - - Right - - if ($_.BucketHighestLatencyCount[3] -gt 0) - { - return $_.BucketHighestLatencyCount[3] - } - - - - Right - - if ($_.BucketHighestLatencyCount[4] -gt 0) - { - return $_.BucketHighestLatencyCount[4] - } - - - - - - - - - StorageHistoryAggregate_v11TableView - - Microsoft.Windows.StorageManagement.StorageHistoryAggregate_v11 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DeviceNumber - - - FriendlyName - - - SerialNumber - - - BusType - - - MediaType - - - Right - - return [String]::Format('{0:N0}',$_.TotalIoCount) - - - - Right - - return [String]::Format('{0:N0}',$_.FailedIoCount) - - - - Right - - return [String]::Format('{0:N0}',$_.TotalQueueIoCount) - - - - Right - - return [String]::Format('{0:N1}',$_.AvgIoLatency/10) - - - - Right - - return [String]::Format('{0:N1}',$_.MaxIoLatency/10) - - - - Right - EventCount - - - Right - - if ($_.BucketHighestLatencyCount[0] -gt 0) - { - return $_.BucketHighestLatencyCount[0] - } - - - - Right - - if ($_.BucketHighestLatencyCount[1] -gt 0) - { - return $_.BucketHighestLatencyCount[1] - } - - - - Right - - if ($_.BucketHighestLatencyCount[2] -gt 0) - { - return $_.BucketHighestLatencyCount[2] - } - - - - Right - - if ($_.BucketHighestLatencyCount[3] -gt 0) - { - return $_.BucketHighestLatencyCount[3] - } - - - - Right - - if ($_.BucketHighestLatencyCount[4] -gt 0) - { - return $_.BucketHighestLatencyCount[4] - } - - - - Right - - if ($_.BucketHighestLatencyCount[5] -gt 0) - { - return $_.BucketHighestLatencyCount[5] - } - - - - Right - - if ($_.BucketHighestLatencyCount[6] -gt 0) - { - return $_.BucketHighestLatencyCount[6] - } - - - - Right - - if ($_.BucketHighestLatencyCount[7] -gt 0) - { - return $_.BucketHighestLatencyCount[7] - } - - - - Right - - if ($_.BucketHighestLatencyCount[8] -gt 0) - { - return $_.BucketHighestLatencyCount[8] - } - - - - Right - - if ($_.BucketHighestLatencyCount[9] -gt 0) - { - return $_.BucketHighestLatencyCount[9] - } - - - - Right - - if ($_.BucketHighestLatencyCount[10] -gt 0) - { - return $_.BucketHighestLatencyCount[10] - } - - - - Right - - if ($_.BucketHighestLatencyCount[11] -gt 0) - { - return $_.BucketHighestLatencyCount[11] - } - - - - - - - - - - StoragePoolTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StoragePool - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FriendlyName - - - OperationalStatus - - - HealthStatus - - - IsPrimordial - - - IsReadOnly - - - Right - - $size = $_.Size; - $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) - for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } - return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; - - - - Right - - $allocatedSize = $_.AllocatedSize; - $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) - for ($i=0; $allocatedSize -ge 1024 -and $i -lt $postfixes.Length; $i++) { $allocatedSize = $allocatedSize / 1024; } - return "" + [System.Math]::Round($allocatedSize,2) + " " + $postfixes[$i]; - - - - - - - - - - ResiliencySettingTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_ResiliencySetting - - - StoragePoolFriendlyName - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name - - - NumberOfDataCopiesDefault - - - PhysicalDiskRedundancyDefault - - - NumberOfColumnsDefault - - - InterleaveDefault - - - NumberOfGroupsDefault - - - - - - - - - StorageEnclosureTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageEnclosure - - - - - - - - - - - - - - - 13 - - - - 14 - - - - - - - - - - FriendlyName - - - SerialNumber - - - OperationalStatus - - - HealthStatus - - - NumberOfSlots - - - - $ElementTypesInError = @( ); - foreach ( $status in $_.SlotOperationalStatus ) - { - if ( ( $status -ne "OK" ) -and ( $status -ne "Not Installed" ) -and ( $status -ne "Off" ) -and ( $status -ne "No Access Allowed" ) -and ( $status -ne "Not Reported" ) ) - { - $ElementTypesInError = $ElementTypesInError + "Slot"; - break; - } - } - foreach ( $status in $_.PowerSupplyOperationalStatus ) - { - if ( ( $status -ne "OK" ) -and ( $status -ne "Not Installed" ) -and ( $status -ne "Off" ) -and ( $status -ne "No Access Allowed" ) -and ( $status -ne "Not Reported" ) ) - { - $ElementTypesInError = $ElementTypesInError + "PowerSupply"; - break; - } - } - foreach ( $status in $_.FanOperationalStatus ) - { - if ( ( $status -ne "OK" ) -and ( $status -ne "Not Installed" ) -and ( $status -ne "Off" ) -and ( $status -ne "No Access Allowed" ) -and ( $status -ne "Not Reported" ) ) - { - $ElementTypesInError = $ElementTypesInError + "Fan"; - break; - } - } - foreach ( $status in $_.TemperatureSensorOperationalStatus ) - { - if ( ( $status -ne "OK" ) -and ( $status -ne "Not Installed" ) -and ( $status -ne "Off" ) -and ( $status -ne "No Access Allowed" ) -and ( $status -ne "Not Reported" ) ) - { - $ElementTypesInError = $ElementTypesInError + "TemperatureSensor"; - break; - } - } - foreach ( $status in $_.VoltageSensorOperationalStatus ) - { - if ( ( $status -ne "OK" ) -and ( $status -ne "Not Installed" ) -and ( $status -ne "Off" ) -and ( $status -ne "No Access Allowed" ) -and ( $status -ne "Not Reported" ) ) - { - $ElementTypesInError = $ElementTypesInError + "VoltageSensor"; - break; - } - } - foreach ( $status in $_.CurrentSensorOperationalStatus ) - { - if ( ( $status -ne "OK" ) -and ( $status -ne "Not Installed" ) -and ( $status -ne "Off" ) -and ( $status -ne "No Access Allowed" ) -and ( $status -ne "Not Reported" ) ) - { - $ElementTypesInError = $ElementTypesInError + "CurrentSensor"; - break; - } - } - foreach ( $status in $_.IOControllerOperationalStatus ) - { - if ( ( $status -ne "OK" ) -and ( $status -ne "Not Installed" ) -and ( $status -ne "Off" ) -and ( $status -ne "No Access Allowed" ) -and ( $status -ne "Not Reported" ) ) - { - $ElementTypesInError = $ElementTypesInError + "IOController"; - break; - } - } - return $ElementTypesInError; - - - - - - - - - - StorageProviderTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageProvider - - - - - - 7 - - - - - - - - - - - - - Type - - - Name - - - Manufacturer - - - - - - - - StorageProviderListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageProvider - - - - - - - UniqueId - - - Name - - - Manufacturer - - - Version - - - - - - - - StorageProviderWideView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageProvider - - - - - - Name - - - - - - - - StorageSubSystemTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageSubSystem - - - - - - - - - - - - - - - - - - FriendlyName - - - HealthStatus - - - OperationalStatus - - - - - - - - - StorageNodeTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageNode - - - - - - - - - - - - - - - - - - - - - - - - Name - - - Manufacturer - - - Model - - - SerialNumber - - - OperationalStatus - - - - - - - - - VolumeTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_Volume - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DriveLetter - - - FileSystemLabel - - - FileSystemType - - - DriveType - - - HealthStatus - - - OperationalStatus - - - Right - - $size = $_.SizeRemaining; - $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) - for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } - return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; - - - - Right - - $size = $_.Size; - $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) - for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } - return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; - - - - - - - - - - InitiatorPortTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_InitiatorPort - - - - - - - - - - - - - - - - - - - - - InstanceName - - - NodeAddress - - - PortAddress - - - ConnectionType - - - - - - - - - InitiatorIdTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_InitiatorId - - - - - - - - - - - - - - - - - - InitiatorAddress - - - Type - - - HostType - - - - - - - - - TargetPortTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_TargetPort - - - - - - - - - - - - - - - - - - - - - - - - - - - FriendlyName - - - NodeAddress - - - PortAddress - - - ConnectionType - - - HealthStatus - - - OperationalStatus - - - - - - - - - TargetPortalTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_TargetPortal - - - - - - - - - - - - - - - - - - - - - IPv4Address - - - IPv6Address - - - PortNumber - - - SubnetMask - - - - - - - - - MaskingSetTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_MaskingSet - - - - - - - - - - - - - - - FriendlyName - - - HostType - - - - - - - - - StorageJobTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageJob - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name - - - IsBackgroundTask - - - ElapsedTime - - - JobState - - - PercentComplete - - - Right - - $bytesProcessed = $_.BytesProcessed; - $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) - for ($i=0; $bytesProcessed -ge 1024 -and $i -lt $postfixes.Length; $i++) { $bytesProcessed = $bytesProcessed / 1024; } - return "" + [System.Math]::Round($bytesProcessed,2) + " " + $postfixes[$i]; - - - - Right - - $bytesTotal = $_.BytesTotal; - $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) - for ($i=0; $bytesTotal -ge 1024 -and $i -lt $postfixes.Length; $i++) { $bytesTotal = $bytesTotal / 1024; } - return "" + [System.Math]::Round($bytesTotal,2) + " " + $postfixes[$i]; - - - - - - - - - - FileIntegrityTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_FileIntegrity - - - - - - - - - - - - - - - - - - FileName - - - Enabled - - - Enforced - - - - - - - - - FileStorageTierTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_FileStorageTier - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FilePath - - - FileSize - - - DesiredStorageTierClass - - - FileSizeOnPerformanceTierClass - - - FileSizeOnCapacityTierClass - - - PlacementStatus - - - State - - - - "{0:P}" -f ($_.FileSizeOnDesiredStorageTierClass / $_.FileSize); - - - - - - - - - - StorageNodeToDisk - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageNodeToDisk - - - StorageNodeObjectId - - - - - - - - DiskNumber - - - HealthStatus - - - OperationalStatus - - - IsReadOnly - - - IsOffline - - - OfflineReason - - - StorageNode - - - Disk - - - - - - - - - FileServerTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_FileServer - - - - - - - - - - - - - - - - - - FriendlyName - - - HealthStatus - - - OperationalStatus - - - - - - - - - FileShareTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_FileShare - - - - - - - - - - - - - - - - - - Name - - - HealthStatus - - - OperationalStatus - - - - - - - - - StorageReliabilityCounterTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageReliabilityCounter - - - - - - - - - - - - - - - - - - - - - - - - DeviceId - - - - if( $_.Temperature ) - { - $_str += $_.Temperature; - $_str += " C" - } - return $_str - - - - ReadErrorsUncorrected - - - Wear - - - PowerOnHours - - - - - - - - - StorageNodeToPhysicalDisk - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageNodeToPhysicalDisk - - - StorageNodeObjectId - - - - - - - - DiskNumber - - - IsPhysicallyConnected - - - HealthStatus - - - OperationalStatus - - - IsMpioEnabled - - - LoadBalancePolicy - - - PathId - - - PathState - - - StorageNode - - - PhysicalDisk - - - - - - - - - StorageNodeToStorageEnclosure - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageNodeToStorageEnclosure - - - StorageNodeObjectId - - - - - - - - EnclosureNumber - - - IsPhysicallyConnected - - - HealthStatus - - - SlotOperationalStatus - - - PowerSupplyOperationalStatus - - - FanOperationalStatus - - - TemperatureSensorOperationalStatus - - - VoltageSensorOperationalStatus - - - CurrentSensorOperationalStatus - - - IOControllerOperationalStatus - - - StorageNode - - - StorageEnclosure - - - - - - - - - HealthActionTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_HealthAction - - - - - - 18 - - - - 25 - - - - 25 - - - - - - - - true - - - PercentComplete - - - State - - - StartTime - - - Reason - - - - - - - - - StorageDiagnoseResultListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageDiagnoseResult - - - PerceivedSeverity - - - - - - - - Reason - - - - $($_.RecommendedActions -join "`r`n") - - - - FaultingObjectLocation - - - - FaultingObjectDescription - - - - - - - - StorageDiagnoseResultTableView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageDiagnoseResult - - - PerceivedSeverity - - - - - - - - - - - - - - true - - - Reason - - - FaultingObjectDescription - - - - - - - - - StorageDiagnoseResultTableView - - Microsoft.Management.Infrastructure.CimMethodStreamedResult#MSFT_StorageHealth#GetReport - - - true - - - true - - - - $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) - $bytesPerSecond = @( "B/S", "KB/S", "MB/S", "GB/S", "TB/S", "PB/S" ) - $Seconds = @( "min", "s", "ms", "us","ns" ) - $nameLength = 0 - $valueLength = 0 - $values = @() - $postFx = @() - - foreach($r in $_.ItemValue.Records) - { - if ($r.Name.Length -gt $nameLength) - { - $nameLength = $r.Name.Length - } - - $localValue="" - switch($r.Units) - { - 0{ - $size = $r.Value; - for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } - - $localValue = "{0}" -f [System.Math]::Round($size,2) - $values += $localValue - $postfx += $postfixes[$i]; - } - 1{ - $size = $r.Value; - for ($i=0; $size -ge 1024 -and $i -lt $bytesPerSecond.Length; $i++) { $size = $size / 1024; } - - $localValue = "{0}" -f [System.Math]::Round($size,2) - $values += $localValue - $postfx += $bytesPerSecond[$i]; - } - 2{ - $localValue = "{0}" -f [System.Math]::Round($r.Value,2) - $values += $localValue - $postfx += "/S"; - } - 3{ - $size = $r.Value; - $i = 1 - if ($size -lt 1) - { - for($i = 1; $size -le 1 -and $i -lt $Seconds.Length; $i++ ) { $size = $size * 1000; } - } - else - { - if($size -gt 60) - { - $size = $size / 60 - $i-- - } - } - - $localValue = "{0}" -f [System.Math]::Round($size,2) - $values += $localValue - $postfx += $Seconds[$i]; - } - 4{ - $localValue = "{0}" -f [System.Math]::Round($r.Value,2) - $values += $localValue - $postfx += "%"; - } - default - { - $values += $r.Value - $postfx += ""; - } - } - - if($localValue.Length -gt $valueLength) - { - $valueLength = $localValue.Length - } - } - $j=0; - foreach($r in $_.ItemValue.Records) - { - $s = "{0,-$nameLength} : {1,$valueLength} {2}" -f @($r.Name, $values[$j], $postfx[$j] ) - Write-host $s - $j++ - } - - write-host "" - - - - - - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_HealthRecord - Microsoft.Management.Infrastructure.CimInstance#MSFT_HealthRecordUInt64 - Microsoft.Management.Infrastructure.CimInstance#MSFT_HealthRecordReal64 - - Both - - - - - diff --git a/newton-cn/bin/Modules/Storage/Storage.psd1 b/newton-cn/bin/Modules/Storage/Storage.psd1 deleted file mode 100644 index 3e78b28..0000000 --- a/newton-cn/bin/Modules/Storage/Storage.psd1 +++ /dev/null @@ -1,213 +0,0 @@ -@{ - GUID = '41486F7D-842F-40F1-ACE4-8405F9C2ED9B' - Author="Microsoft Corporation" - CompanyName="Microsoft Corporation" - Copyright="© Microsoft Corporation. All rights reserved." - ModuleVersion = '2.0.0.0' - PowerShellVersion = '5.1' - FormatsToProcess = 'Storage.format.ps1xml' - TypesToProcess = 'Storage.types.ps1xml' - NestedModules = @( - 'Disk.cdxml', - 'DiskImage.cdxml', - 'FileIntegrity.cdxml', - 'FileServer.cdxml', - 'FileShare.cdxml', - 'FileStorageTier.cdxml', - 'InitiatorId.cdxml', - 'InitiatorPort.cdxml', - 'MaskingSet.cdxml', - 'OffloadDataTransferSetting.cdxml', - 'Partition.cdxml', - 'PhysicalDisk.cdxml', - 'ResiliencySetting.cdxml', - 'StorageCmdlets.cdxml', - 'StorageEnclosure.cdxml', - 'StorageJob.cdxml', - 'StorageHealth.cdxml', - 'StorageNode.cdxml', - 'StoragePool.cdxml', - 'StorageProvider.cdxml', - 'StorageReliabilityCounter.cdxml', - 'StorageSetting.cdxml', - 'StorageSubSystem.cdxml', - 'StorageTier.cdxml', - 'TargetPort.cdxml', - 'TargetPortal.cdxml', - 'VirtualDisk.cdxml', - 'Volume.cdxml', - 'StorageScripts.psm1' - ) - AliasesToExport = @( - 'Disable-PhysicalDiskIndication', - 'Disable-StorageDiagnosticLog', - 'Enable-PhysicalDiskIndication', - 'Enable-StorageDiagnosticLog', - 'Flush-Volume', - 'Initialize-Volume', - 'Write-FileSystemCache', - 'Get-PhysicalDiskSNV', - 'Get-DiskSNV', - 'Get-StorageEnclosureSNV' - ) - CmdletsToExport = @() - FunctionsToExport = @( - 'Add-InitiatorIdToMaskingSet', - 'Add-PartitionAccessPath', - 'Add-PhysicalDisk', - 'Add-StorageFaultDomain', - 'Add-TargetPortToMaskingSet', - 'Add-VirtualDiskToMaskingSet', - 'Block-FileShareAccess', - 'Clear-Disk', - 'Clear-FileStorageTier', - 'Clear-StorageDiagnosticInfo', - 'Connect-VirtualDisk', - 'Debug-FileShare', - 'Debug-StorageSubSystem', - 'Debug-Volume', - 'Disable-PhysicalDiskIdentification', - 'Disable-StorageEnclosureIdentification', - 'Disable-StorageEnclosurePower', - 'Disable-StorageHighAvailability', - 'Disable-StorageMaintenanceMode', - 'Disconnect-VirtualDisk', - 'Dismount-DiskImage', - 'Enable-PhysicalDiskIdentification', - 'Enable-StorageEnclosureIdentification', - 'Enable-StorageEnclosurePower', - 'Enable-StorageHighAvailability', - 'Enable-StorageMaintenanceMode', - 'Format-Volume', - 'Get-DedupProperties', - 'Get-Disk', - 'Get-DiskImage', - 'Get-DiskStorageNodeView', - 'Get-FileIntegrity', - 'Get-FileStorageTier', - 'Get-StorageFileServer', - 'Get-FileShare', - 'Get-FileShareAccessControlEntry', - 'Get-InitiatorId', - 'Get-InitiatorPort', - 'Get-MaskingSet', - 'Get-Partition', - 'Get-PartitionSupportedSize', - 'Get-PhysicalDisk', - 'Get-PhysicalDiskStorageNodeView', - 'Get-PhysicalExtent', - 'Get-PhysicalExtentAssociation', - 'Get-ResiliencySetting', - 'Get-StorageAdvancedProperty', - 'Get-StorageChassis', - 'Get-StorageDiagnosticInfo', - 'Get-StorageEnclosure', - 'Get-StorageEnclosureStorageNodeView', - 'Get-StorageEnclosureVendorData', - 'Get-StorageExtendedStatus', - 'Get-StorageFaultDomain', - 'Get-StorageFirmwareInformation', - 'Get-StorageHealthAction', - 'Get-StorageHealthReport', - 'Get-StorageHealthSetting', - 'Get-StorageJob', - 'Get-StorageNode', - 'Get-StorageHistory', - 'Get-StoragePool', - 'Get-StorageProvider', - 'Get-StorageRack', - 'Get-StorageReliabilityCounter', - 'Get-StorageScaleUnit', - 'Get-StorageSetting', - 'Get-StorageSite', - 'Get-StorageSubSystem', - 'Get-StorageTier', - 'Get-StorageTierSupportedSize', - 'Get-SupportedFileSystems', - 'Get-SupportedClusterSizes', - 'Get-TargetPort', - 'Get-TargetPortal', - 'Get-VirtualDisk', - 'Get-VirtualDiskSupportedSize', - 'Get-OffloadDataTransferSetting' - 'Get-Volume', - 'Get-VolumeCorruptionCount', - 'Get-VolumeScrubPolicy', - 'Grant-FileShareAccess', - 'Hide-VirtualDisk', - 'Initialize-Disk', - 'Mount-DiskImage', - 'New-MaskingSet', - 'New-Partition', - 'New-StorageFileServer', - 'New-FileShare', - 'New-StoragePool', - 'New-StorageSubsystemVirtualDisk', - 'New-StorageTier', - 'New-VirtualDisk', - 'New-VirtualDiskClone', - 'New-VirtualDiskSnapshot', - 'New-Volume', - 'Optimize-Volume', - 'Optimize-StoragePool' - 'Register-StorageSubsystem', - 'Remove-FileShare', - 'Remove-InitiatorId', - 'Remove-InitiatorIdFromMaskingSet', - 'Remove-MaskingSet', - 'Remove-Partition', - 'Remove-PartitionAccessPath', - 'Remove-PhysicalDisk', - 'Remove-StorageFaultDomain', - 'Remove-StorageFileServer', - 'Remove-StorageHealthIntent', - 'Remove-StorageHealthSetting', - 'Remove-StoragePool', - 'Remove-StorageTier', - 'Remove-TargetPortFromMaskingSet', - 'Remove-VirtualDisk', - 'Remove-VirtualDiskFromMaskingSet', - 'Rename-MaskingSet', - 'Repair-FileIntegrity', - 'Repair-VirtualDisk', - 'Repair-Volume', - 'Reset-PhysicalDisk', - 'Reset-StorageReliabilityCounter', - 'Resize-Partition', - 'Resize-StorageTier', - 'Resize-VirtualDisk', - 'Revoke-FileShareAccess', - 'Set-Disk', - 'Set-FileIntegrity', - 'Set-FileStorageTier', - 'Set-FileShare', - 'Set-InitiatorPort', - 'Set-Partition', - 'Set-PhysicalDisk', - 'Set-ResiliencySetting', - 'Set-StorageFileServer', - 'Set-StorageHealthSetting', - 'Set-StoragePool', - 'Set-StorageProvider', - 'Set-StorageSetting', - 'Set-StorageSubSystem', - 'Set-StorageTier', - 'Set-VirtualDisk', - 'Set-Volume', - 'Set-VolumeScrubPolicy', - 'Show-StorageHistory', - 'Show-VirtualDisk', - 'Start-StorageDiagnosticLog', - 'Stop-StorageDiagnosticLog', - 'Stop-StorageJob', - 'Unregister-StorageSubsystem', - 'Unblock-FileShareAccess', - 'Update-Disk', - 'Update-HostStorageCache', - 'Update-StorageFirmware', - 'Update-StoragePool', - 'Update-StorageProviderCache', - 'Write-VolumeCache') - HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=390832" - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/Storage/Storage.types.ps1xml b/newton-cn/bin/Modules/Storage/Storage.types.ps1xml deleted file mode 100644 index 7109033..0000000 --- a/newton-cn/bin/Modules/Storage/Storage.types.ps1xml +++ /dev/null @@ -1,3472 +0,0 @@ - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_Disk - - - DiskNumber - Number - - - PartitionStyle - - switch ($this.psBase.CimInstanceProperties["PartitionStyle"].Value) - { - 0 { "RAW" } - 1 { "MBR" } - 2 { "GPT" } - Default { "Unknown" } - } - - - - ProvisioningType - - switch ($this.psBase.CimInstanceProperties["ProvisioningType"].Value) - { - 0 { "Unknown" } - 1 { "Thin" } - 2 { "Fixed" } - Default { "Unknown" } - } - - - - OperationalStatus - - $_status = @(); - foreach( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) - { - switch ( $status ) - { - 1 { $_status += "Other" } - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 4 { $_status += "Stressed" } - 5 { $_status += "Predictive Failure" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 8 { $_status += "Starting" } - 9 { $_status += "Stopping" } - 10 { $_status += "Stopped" } - 11 { $_status += "InService" } - 12 { $_status += "No Contact" } - 13 { $_status += "Lost Communication" } - 14 { $_status += "Aborted" } - 15 { $_status += "Dormant" } - 16 { $_status += "Supporting Entity in Error" } - 17 { $_status += "Completed" } - 18 { $_status += "Power Mode" } - 19 { $_status += "Relocating" } - 53264 { $_status += "Online" } - 53265 { $_status += "Not Ready" } - 53266 { $_status += "No Media" } - 53267 { $_status += "Offline" } - 53268 { $_status += "Failed" } - Default { $_status += "Unknown" } - } - } - $_status; - - - - HealthStatus - - switch ($this.psBase.CimInstanceProperties["HealthStatus"].Value) - { - 0 { "Healthy" } - 1 { "Warning" } - 2 { "Unhealthy" } - Default { "Unknown" } - } - - - - BusType - - switch ($this.psBase.CimInstanceProperties["BusType"].Value) - { - 0 { "Unknown" } - 1 { "SCSI" } - 2 { "ATAPI" } - 3 { "ATA" } - 4 { "1394" } - 5 { "SSA" } - 6 { "Fibre Channel" } - 7 { "USB" } - 8 { "RAID" } - 9 { "iSCSI" } - 10 { "SAS" } - 11 { "SATA" } - 12 { "SD" } - 13 { "MMC" } - 14 { "Virtual" } - 15 { "File Backed Virtual" } - 16 { "Spaces" } - 17 { "NVMe" } - 18 { "SCM" } - 19 { "UFS" } - Default { "Unknown" } - } - - - - UniqueIdFormat - - switch ($this.psBase.CimInstanceProperties["UniqueIdFormat"].Value) - { - 0 { "Vendor Specific" } - 1 { "Vendor Id" } - 2 { "EUI64" } - 3 { "FCPH Name" } - 8 { "SCSI Name String" } - } - - - - OfflineReason - - switch ($this.psBase.CimInstanceProperties["OfflineReason"].Value) - { - 1 { "Policy" } - 2 { "Redundant Path" } - 3 { "Snapshot" } - 4 { "Collision" } - 5 { "Resource Exhaustion" } - 6 { "Critical Write Failures" } - 7 { "Data Integrity Scan Required" } - Default { $null } - } - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_Partition - - - OperationalStatus - - switch ($this.psBase.CimInstanceProperties["OperationalStatus"].Value) - { - 0 { "Unknown" } - 1 { "Online" } - 3 { "No Media" } - 5 { "Failed" } - 4 { "Offline" } - Default { "Unknown" } - } - - - - Type - - if ($this.psBase.CimInstanceProperties["MbrType"].Value -gt 0) - { - switch ($this.psBase.CimInstanceProperties["MbrType"].Value) - { - 1 { "FAT12" } - 2 { "Xenix" } - 3 { "Xenix" } - 4 { "FAT16" } - 5 { "Extended" } - 6 { "Logical" } - 7 { "IFS" } - 10 { "OS/2 BootMgr" } - 11 { "FAT32" } - 12 { "FAT32 XINT13" } - 14 { "XINT13" } - 15 { "XINT13 Extended" } - 65 { "PReP" } - 66 { "LDM" } - 99 { "Unix" } - 231 { "Space Protective" } - Default { "Unknown" } - } - } - else - { - switch ($this.psBase.CimInstanceProperties["GptType"].Value) - { - "{c12a7328-f81f-11d2-ba4b-00a0c93ec93b}" { "System" } - "{e3c9e316-0b5c-4db8-817d-f92df00215ae}" { "Reserved" } - "{ebd0a0a2-b9e5-4433-87c0-68b6b72699c7}" { "Basic" } - "{5808c8aa-7e8f-42e0-85d2-e1e90434cfb3}" { "LDM Metadata" } - "{af9b60a0-1431-4f62-bc68-3311714a69ad}" { "LDM Data" } - "{de94bba4-06d1-4d40-a16a-bfd50179d6ac}" { "Recovery" } - "{e75caf8f-f680-4cee-afa3-b001e56efc2d}" { "Space Protective" } - "{eeff8352-dd2a-44db-ae83-bee1cf7481dc}" { "S2D Cache" } - "{03aaa829-ebfc-4e7e-aac9-c4d76c63b24b}" { "S2D Cache Metadata" } - Default { "Unknown" } - } - } - - - - DiskPath - - if ( $this.psBase.CimInstanceProperties["DiskId"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - $this.psBase.CimInstanceProperties["DiskId"].Value - } - else - { - $null - } - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_VirtualDisk - - - Usage - - if ( $this.psBase.CimInstanceProperties["Usage"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["Usage"].Value) - { - 0 { "Unknown" } - 1 { "Other" } - 2 { "Unrestricted" } - 3 { "Reserved for ComputerSystem (the block server)" } - 4 { "Reserved by Replication Services" } - 5 { "Reserved by Migration Services" } - 6 { "Local Replica Source" } - 7 { "Remote Replica Source" } - 8 { "Local Replica Target" } - 9 { "Remote Replica Target" } - 10 { "Local Replica Source or Target" } - 11 { "Remote Replica Source or Target" } - 12 { "Delta Replica Target" } - 13 { "Element Component" } - 14 { "Reserved as Pool Contributer" } - 15 { "Composite Volume Member" } - 16 { "Composite LogicalDisk Member" } - 17 { "Reserved for Sparing" } - 18 { "Configuration" } - 19 { "Data" } - 20 { "Journal" } - 21 { "Read Cache" } - 22 { "Write Cache" } - 23 { "Dirty Region Tracking" } - 24 { "Valid Data Tracking" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - NameFormat - - if ( $this.psBase.CimInstanceProperties["NameFormat"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["NameFormat"].Value) - { - 0 { "Unknown" } - 1 { "Other" } - 2 { "VPD83NAA6" } - 3 { "VPD83NAA5" } - 4 { "VPD83Type2" } - 5 { "VPD83Type1" } - 6 { "VPD83Type0" } - 7 { "SNVM" } - 8 { "NodeWWN" } - 9 { "NAA" } - 10 { "EUI64" } - 11 { "T10VID" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - OperationalStatus - - $_status = @(); - foreach( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) - { - switch ( $status ) - { - 1 { $_status += "Other" } - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 4 { $_status += "Stressed" } - 5 { $_status += "Predictive Failure" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 8 { $_status += "Starting" } - 9 { $_status += "Stopping" } - 10 { $_status += "Stopped" } - 11 { $_status += "InService" } - 12 { $_status += "No Contact" } - 13 { $_status += "Lost Communication" } - 14 { $_status += "Aborted" } - 15 { $_status += "Dormant" } - 16 { $_status += "Supporting Entity in Error" } - 17 { $_status += "Completed" } - 18 { $_status += "Power Mode" } - 19 { $_status += "Relocating" } - 53250 { $_status += "Detached" } - 53251 { $_status += "Incomplete" } - 53275 { $_status += "Suboptimal" } - 53284 { $_status += "No Redundancy" } - Default { $_status += "Unknown" } - } - } - $_status; - - - - HealthStatus - - switch ($this.psBase.CimInstanceProperties["HealthStatus"].Value) - { - 0 { "Healthy" } - 1 { "Warning" } - 2 { "Unhealthy" } - 5 { "Unknown" } - Default { "Unknown" } - } - - - - ProvisioningType - - if ( $this.psBase.CimInstanceProperties["ProvisioningType"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["ProvisioningType"].Value) - { - 0 { "Unknown" } - 1 { "Thin" } - 2 { "Fixed" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - AllocationUnitSize - - if ( $this.psBase.CimInstanceProperties["AllocationUnitSize"].Value -eq [System.UInt64]::MaxValue ) - { - "Auto" - } - else - { - $this.psBase.CimInstanceProperties["AllocationUnitSize"].Value - } - - - - MediaType - - if ( $this.psBase.CimInstanceProperties["MediaType"].Flags.HasFlag( [Microsoft.Management.Infrastructure.CimFlags]::NullValue ) -eq $false ) - { - switch ( $this.psBase.CimInstanceProperties["MediaType"].Value ) - { - 0 { "Unspecified" } - 3 { "HDD" } - 4 { "SSD" } - 5 { "SCM" } - Default { "Unspecified" } - } - } - else - { - $null - } - - - - ParityLayout - - if ( $this.psBase.CimInstanceProperties["ParityLayout"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["ParityLayout"].Value) - { - 1 { "Non-rotated Parity" } - 2 { "Rotated Parity" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - Access - - if ( $this.psBase.CimInstanceProperties["Access"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["Access"].Value) - { - 0 { "Unknown" } - 1 { "Readable" } - 2 { "Writeable" } - 3 { "Read/Write" } - 4 { "Write Once" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - UniqueIdFormat - - if ( $this.psBase.CimInstanceProperties["UniqueIdFormat"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["UniqueIdFormat"].Value) - { - 0 { "Vendor Specific" } - 1 { "Vendor Id" } - 2 { "EUI64" } - 3 { "FCPH Name" } - 8 { "SCSI Name String" } - } - } - else - { - $null - } - - - - DetachedReason - - if ( $this.psBase.CimInstanceProperties["DetachedReason"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["DetachedReason"].Value) - { - 0 { "Unknown" } - 1 { "None" } - 2 { "By Policy" } - 3 { "Majority Disks Unhealthy" } - 4 { "Incomplete" } - 5 { "Timeout" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - WriteCacheSize - - if ( $this.psBase.CimInstanceProperties["WriteCacheSize"].Value -eq [System.UInt64]::MaxValue ) - { - "Auto" - } - else - { - $this.psBase.CimInstanceProperties["WriteCacheSize"].Value - } - - - - FaultDomainAwareness - - if ( $this.psBase.CimInstanceProperties["FaultDomainAwareness"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["FaultDomainAwareness"].Value) - { - 1 { "PhysicalDisk" } - 2 { "StorageEnclosure" } - 3 { "StorageScaleUnit" } - 4 { "StorageChassis" } - 5 { "StorageRack" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - ColumnIsolation - - if ( $this.psBase.CimInstanceProperties["ColumnIsolation"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["ColumnIsolation"].Value) - { - 1 { "PhysicalDisk" } - 2 { "StorageEnclosure" } - 3 { "StorageScaleUnit" } - 4 { "StorageChassis" } - 5 { "StorageRack" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - GetSecurityDescriptor - - - - SetSecurityDescriptor - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageFaultDomain - - - ClassName - - if ($this.CimClass -ne $null) { $this.CimClass.CimClassName } else {""} - - - - HealthStatus - - switch ( $this.psBase.CimInstanceProperties["HealthStatus"].Value ) - { - 0 { "Healthy" } - 1 { "Warning" } - 2 { "Unhealthy" } - 5 { "Unknown" } - Default { "Unknown" } - } - - - - OperationalStatus - - $_status = @(); - foreach( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) - { - switch ( $status ) - { - 1 { $_status += "Other" } - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 4 { $_status += "Stressed" } - 5 { $_status += "Predictive Failure" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 8 { $_status += "Starting" } - 9 { $_status += "Stopping" } - 10 { $_status += "Stopped" } - 11 { $_status += "InService" } - 12 { $_status += "No Contact" } - 13 { $_status += "Lost Communication" } - 14 { $_status += "Aborted" } - 15 { $_status += "Dormant" } - 16 { $_status += "Supporting Entity in Error" } - 17 { $_status += "Completed" } - 18 { $_status += "Power Mode" } - 19 { $_status += "Relocating" } - 53252 { $_status += "Failed Media" } - 53253 { $_status += "Split" } - 53254 { $_status += "Stale Metadata" } - 53255 { $_status += "IO Error" } - 53256 { $_status += "Unrecognized Metadata" } - 53269 { $_status += "Removing From Pool" } - 53270 { $_status += "In Maintenance Mode" } - 53271 { $_status += "Updating Firmware" } - 53272 { $_status += "Device Hardware Error" } - 53273 { $_status += "Not Usable" } - 53274 { $_status += "Transient Error" } - 53276 { $_status += "Starting Maintenance Mode"} - 53277 { $_status += "Stopping Maintenance Mode"} - 53285 { $_status += "Threshold Exceeded"} - 53286 { $_status += "Abnormal Latency"} - Default { $_status += "Unknown" } - } - } - $_status; - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_PhysicalDisk - - - Usage - - if ( $this.psBase.CimInstanceProperties["Usage"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ( $this.psBase.CimInstanceProperties["Usage"].Value ) - { - 0 { "Unknown" } - 1 { "Auto-Select" } - 2 { "Manual-Select" } - 3 { "Hot Spare" } - 4 { "Retired" } - 5 { "Journal" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - OperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) - { - switch ( $status ) - { - 1 { $_status += "Other" } - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 4 { $_status += "Stressed" } - 5 { $_status += "Predictive Failure" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 8 { $_status += "Starting" } - 9 { $_status += "Stopping" } - 10 { $_status += "Stopped" } - 11 { $_status += "In Service" } - 12 { $_status += "No Contact" } - 13 { $_status += "Lost Communication" } - 14 { $_status += "Aborted" } - 15 { $_status += "Dormant" } - 16 { $_status += "Supporting Entity in Error" } - 17 { $_status += "Completed" } - 18 { $_status += "Power Mode" } - 19 { $_status += "Relocating" } - 53252 { $_status += "Failed Media" } - 53253 { $_status += "Split" } - 53254 { $_status += "Stale Metadata" } - 53255 { $_status += "IO Error" } - 53256 { $_status += "Unrecognized Metadata" } - 53269 { $_status += "Removing From Pool" } - 53270 { $_status += "In Maintenance Mode" } - 53271 { $_status += "Updating Firmware" } - 53272 { $_status += "Device Hardware Error" } - 53273 { $_status += "Not Usable" } - 53274 { $_status += "Transient Error" } - 53276 { $_status += "Starting Maintenance Mode"} - 53277 { $_status += "Stopping Maintenance Mode"} - 53285 { $_status += "Threshold Exceeded"} - 53286 { $_status += "Abnormal Latency"} - Default { "Unknown" } - } - } - $_status; - - - - UniqueIdFormat - - if ( $this.psBase.CimInstanceProperties["UniqueIdFormat"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["UniqueIdFormat"].Value) - { - 0 { "Vendor Specific" } - 1 { "Vendor Id" } - 2 { "EUI64" } - 3 { "FCPH Name" } - 8 { "SCSI Name String" } - } - } - else - { - $null - } - - - - HealthStatus - - switch ( $this.psBase.CimInstanceProperties["HealthStatus"].Value ) - { - 0 { "Healthy" } - 1 { "Warning" } - 2 { "Unhealthy" } - 5 { "Unknown" } - Default { "Unknown" } - } - - - - BusType - - if ( $this.psBase.CimInstanceProperties["BusType"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ( $this.psBase.CimInstanceProperties["BusType"].Value ) - { - 0 { "Unknown" } - 1 { "SCSI" } - 2 { "ATAPI" } - 3 { "ATA" } - 4 { "1394" } - 5 { "SSA" } - 6 { "Fibre Channel" } - 7 { "USB" } - 8 { "RAID" } - 9 { "iSCSI" } - 10 { "SAS" } - 11 { "SATA" } - 12 { "SD" } - 13 { "MMC" } - 14 { "Virtual" } - 15 { "File Backed Virtual" } - 16 { "Spaces" } - 17 { "NVMe" } - 18 { "SCM" } - 19 { "UFS" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - CannotPoolReason - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["CannotPoolReason"].Value ) - { - switch ( $status ) - { - 0 { $_status += "Unknown" } - 1 { $_status += "Other" } - 2 { $_status += "In a Pool" } - 3 { $_status += "Not Healthy" } - 4 { $_status += "Removable Media" } - 5 { $_status += "In Use by Cluster" } - 6 { $_status += "Offline" } - 7 { $_status += "Insufficient Capacity" } - 8 { $_status += "Spare Disk" } - 9 { $_status += "Reserved by Subsystem" } - 10 { $_status += "Starting" } - 11 { $_status += "Partial SCM" } - 12 { $_status += "Discovery Disabled" } - 32768 { $_status += "Verification in progress" } - 32769 { $_status += "Verification failed" } - 32770 { $_status += "Firmware not compliant" } - 32771 { $_status += "Hardware not compliant" } - Default { "Unknown" } - } - } - $_status; - - - - SupportedUsages - - $_usages = @(); - foreach ( $_usage in $this.psBase.CimInstanceProperties["SupportedUsages"].Value ) - { - switch ( $_usage ) - { - 1 { $_usages += "Auto-Select" } - 2 { $_usages += "Manual-Select" } - 3 { $_usages += "Hot Spare" } - 4 { $_usages += "Retired" } - 5 { $_usages += "Journal" } - Default { "Unknown" } - } - } - $_usages; - - - - MediaType - - switch ( $this.psBase.CimInstanceProperties["MediaType"].Value ) - { - 0 { "Unspecified" } - 3 { "HDD" } - 4 { "SSD" } - 5 { "SCM" } - Default { "Unspecified" } - } - - - - SpindleSpeed - - $speed = $this.psBase.CimInstanceProperties["SpindleSpeed"].Value; - if ( $speed -eq [System.UInt32]::MaxValue ) { - "Unknown"; - } - else - { - $speed; - } - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageEnclosure - - - BusType - - switch ($this.psBase.CimInstanceProperties["BusType"].Value) - { - 0 { "Unknown" } - 1 { "SCSI" } - 2 { "ATAPI" } - 3 { "ATA" } - 4 { "1394" } - 5 { "SSA" } - 6 { "Fibre Channel" } - 7 { "USB" } - 8 { "RAID" } - 9 { "iSCSI" } - 10 { "SAS" } - 11 { "SATA" } - 12 { "SD" } - 13 { "MMC" } - 14 { "Virtual" } - 15 { "File Backed Virtual" } - 16 { "Spaces" } - 17 { "NVMe" } - 18 { "SCM" } - 19 { "UFS" } - Default { "Unknown" } - } - - - - HealthStatus - - switch ( $this.psBase.CimInstanceProperties["HealthStatus"].Value ) - { - 0 { "Healthy" } - 1 { "Warning" } - 2 { "Unhealthy" } - 5 { "Unknown" } - Default { "Unknown" } - } - - - - OperationalStatus - - $_status = @(); - foreach( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) - { - switch ( $status ) - { - 1 { $_status += "Other" } - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 4 { $_status += "Stressed" } - 5 { $_status += "Predictive Failure" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 8 { $_status += "Starting" } - 9 { $_status += "Stopping" } - 10 { $_status += "Stopped" } - 11 { $_status += "InService" } - 12 { $_status += "No Contact" } - 13 { $_status += "Lost Communication" } - 14 { $_status += "Aborted" } - 15 { $_status += "Dormant" } - 16 { $_status += "Supporting Entity in Error" } - 17 { $_status += "Completed" } - 18 { $_status += "Power Mode" } - 19 { $_status += "Relocating" } - 53250 { $_status += "Detached" } - 53251 { $_status += "Incomplete" } - Default { $_status += "Unknown" } - } - } - $_status; - - - - SlotOperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["SlotOperationalStatus"].Value ) - { - switch ( $status ) - { - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 53257 { $_status += "Not Installed" } - 53258 { $_status += "Off" } - 53259 { $_status += "No Access Allowed" } - 53260 { $_status += "Not Reported" } - Default { "Unknown" } - } - } - $_status; - - - - PowerSupplyOperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["PowerSupplyOperationalStatus"].Value ) - { - switch ( $status ) - { - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 53257 { $_status += "Not Installed" } - 53258 { $_status += "Off" } - 53259 { $_status += "No Access Allowed" } - 53260 { $_status += "Not Reported" } - Default { "Unknown" } - } - } - $_status; - - - - FanOperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["FanOperationalStatus"].Value ) - { - switch ( $status ) - { - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 53257 { $_status += "Not Installed" } - 53258 { $_status += "Off" } - 53259 { $_status += "No Access Allowed" } - 53260 { $_status += "Not Reported" } - Default { "Unknown" } - } - } - $_status; - - - - TemperatureSensorOperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["TemperatureSensorOperationalStatus"].Value ) - { - switch ( $status ) - { - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 53257 { $_status += "Not Installed" } - 53258 { $_status += "Off" } - 53259 { $_status += "No Access Allowed" } - 53260 { $_status += "Not Reported" } - Default { "Unknown" } - } - } - $_status; - - - - VoltageSensorOperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["VoltageSensorOperationalStatus"].Value ) - { - switch ( $status ) - { - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 53257 { $_status += "Not Installed" } - 53258 { $_status += "Off" } - 53259 { $_status += "No Access Allowed" } - 53260 { $_status += "Not Reported" } - Default { "Unknown" } - } - } - $_status; - - - - CurrentSensorOperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["CurrentSensorOperationalStatus"].Value ) - { - switch ( $status ) - { - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 53257 { $_status += "Not Installed" } - 53258 { $_status += "Off" } - 53259 { $_status += "No Access Allowed" } - 53260 { $_status += "Not Reported" } - Default { "Unknown" } - } - } - $_status; - - - - IOControllerOperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["IOControllerOperationalStatus"].Value ) - { - switch ( $status ) - { - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 53257 { $_status += "Not Installed" } - 53258 { $_status += "Off" } - 53259 { $_status += "No Access Allowed" } - 53260 { $_status += "Not Reported" } - Default { "Unknown" } - } - } - $_status; - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageNode - - - NameFormat - - if ( $this.psBase.CimInstanceProperties["NameFormat"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["NameFormat"].Value) - { - 1 { "Other" } - 2 { "IP" } - 3 { "Dial" } - 4 { "HID" } - 5 { "NWA" } - 6 { "HWA" } - 7 { "X25" } - 8 { "ISDN" } - 9 { "IPX" } - 10 { "DCC" } - 11 { "ICD" } - 12 { "E.164" } - 13 { "SNA" } - 14 { "OID/OSI" } - 15 { "WWN" } - 16 { "NAA" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - OperationalStatus - - switch ($this.psBase.CimInstanceProperties["OperationalStatus"].Value) - { - 0 { "Unknown" } - 2 { "Up" } - 6 { "Down" } - 8 { "Joining" } - 10 { "Paused" } - } - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StoragePool - - - Usage - - if ( $this.psBase.CimInstanceProperties["Usage"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["Usage"].Value) - { - 0 { "Unknown" } - 1 { "Other" } - 2 { "Unrestricted" } - 3 { "Reserved for ComputerSystem (the block server)" } - 4 { "Reserved as a Delta Replica Container" } - 5 { "Reserved for Migration Services" } - 6 { "Reserved for Local Replication Services" } - 7 { "Reserved for Remote Replication Services" } - 8 { "Reserved for Sparing" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - OperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) - { - switch ( $status ) - { - 1 { $_status += "Other" } - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 4 { $_status += "Stressed" } - 5 { $_status += "Predictive Failure" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 8 { $_status += "Starting" } - 9 { $_status += "Stopping" } - 10 { $_status += "Stopped" } - 11 { $_status += "In Service" } - 12 { $_status += "No Contact" } - 13 { $_status += "Lost Communication" } - 14 { $_status += "Aborted" } - 15 { $_status += "Dormant" } - 16 { $_status += "Supporting Entity in Error" } - 17 { $_status += "Completed" } - 18 { $_status += "Power Mode" } - 19 { $_status += "Relocating" } - 53248 { $_status += "Read-only" } - 53249 { $_status += "Incomplete" } - Default { "Unknown" } - } - } - $_status; - - - - HealthStatus - - switch ($this.psBase.CimInstanceProperties["HealthStatus"].Value) - { - 0 { "Healthy" } - 1 { "Warning" } - 2 { "Unhealthy" } - 5 { "Unknown" } - Default { "Unknown" } - } - - - - ProvisioningTypeDefault - - if ( $this.psBase.CimInstanceProperties["ProvisioningTypeDefault"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["ProvisioningTypeDefault"].Value) - { - 0 { "Unknown" } - 1 { "Thin" } - 2 { "Fixed" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - SupportedProvisioningTypes - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["SupportedProvisioningTypes"].Value ) - { - switch ( $status ) - { - 0 { $_status += "Unknown" } - 1 { $_status += "Thin" } - 2 { $_status += "Fixed" } - Default { "Unknown" } - } - } - $_status; - - - - MediaTypeDefault - - if ( $this.psBase.CimInstanceProperties["MediaTypeDefault"].Flags.HasFlag( [Microsoft.Management.Infrastructure.CimFlags]::NullValue ) -eq $false ) - { - switch ( $this.psBase.CimInstanceProperties["MediaTypeDefault"].Value ) - { - 0 { "Unspecified" } - 3 { "HDD" } - 4 { "SSD" } - 5 { "SCM" } - Default { "Unspecified" } - } - } - else - { - $null - } - - - - ReadOnlyReason - - if ( $this.psBase.CimInstanceProperties["ReadOnlyReason"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["ReadOnlyReason"].Value) - { - 0 { "Unknown" } - 1 { "None" } - 2 { "By Policy" } - 3 { "Majority Disks Unhealthy" } - 4 { "Starting" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - RepairPolicy - - if ( $this.psBase.CimInstanceProperties["RepairPolicy"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ( $this.psBase.CimInstanceProperties["RepairPolicy"].Value ) - { - 2 { "Sequential" } - 3 { "Parallel" } - Default { "Parallel" } - } - } - else - { - $null - } - - - - RetireMissingPhysicalDisks - - if ( $this.psBase.CimInstanceProperties["RetireMissingPhysicalDisks"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ( $this.psBase.CimInstanceProperties["RetireMissingPhysicalDisks"].Value ) - { - 0 { "Unknown" } - 1 { "Auto" } - 2 { "Always" } - 3 { "Never" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - WriteCacheSizeDefault - - if ( $this.psBase.CimInstanceProperties["WriteCacheSizeDefault"].Value -eq [System.UInt64]::MaxValue ) - { - "Auto" - } - else - { - $this.psBase.CimInstanceProperties["WriteCacheSizeDefault"].Value - } - - - - Version - - # ScVersionWindows8 - if ( $this.psBase.CimInstanceProperties["Version"].Value -eq 1 ) - { - "Windows Server 2012" - } - - # ScVersionWindowsBlueInternal1 - # ScVersionWindowsBlueInternal2 - # ScVersionWindowsBlueInternal3 - # ScVersionWindowsBlueInternal4 - # ScVersionWindowsBlueInternal5 - elseif ( $this.psBase.CimInstanceProperties["Version"].Value -eq 2 ) - { - "Windows Server 2012 R2 Preview" - } - - # ScVersionWindowsBlue - elseif ( $this.psBase.CimInstanceProperties["Version"].Value -eq 3 ) - { - "Windows Server 2012 R2" - } - - # ScVersionWindowsThresholdInternal1 - # ScVersionWindowsThresholdInternal2 - # ScVersionWindowsThresholdInternal3 - # ScVersionWindowsThresholdInternal4 - # ScVersionWindowsThresholdInternal5 - # ScVersionWindowsThresholdInternal6 - # ScVersionWindowsThreshold - # ScVersionWindowsThreshold2 - # ScVersionWindowsRedstone1Internal1 - # ScVersionWindowsRedstone1Internal2 - # ScVersionWindowsRedstone1Internal3 - elseif ( $this.psBase.CimInstanceProperties["Version"].Value -ge 4 -and $this.psBase.CimInstanceProperties["Version"].Value -le 18 ) - { - "Windows Server 2016 Preview" - } - - # ScVersionWindowsRedstone1 - elseif ( $this.psBase.CimInstanceProperties["Version"].Value -eq 19 ) - { - "Windows Server 2016" - } - - # ScVersionWindowsRedstone3 - elseif ( $this.psBase.CimInstanceProperties["Version"].Value -eq 20 ) - { - "Windows Server 2016 RS3" - } - - # ScVersionWindowsRedstone5Internal1 - elseif ( $this.psBase.CimInstanceProperties["Version"].Value -eq 21 ) - { - "Windows Server 2019 Preview" - } - - # ScVersionWindowsRedstone5 - elseif ( $this.psBase.CimInstanceProperties["Version"].Value -eq 22 ) - { - "Windows Server 2019" - } - - # >= ScVersionWindows19H1Internal1 - elseif ( $this.psBase.CimInstanceProperties["Version"].Value -ge 23 ) - { - "Windows Server vNext" - } - - - - FaultDomainAwarenessDefault - - switch ($this.psBase.CimInstanceProperties["FaultDomainAwarenessDefault"].Value) - { - 1 { "PhysicalDisk" } - 2 { "StorageEnclosure" } - 3 { "StorageScaleUnit" } - 4 { "StorageChassis" } - 5 { "StorageRack" } - Default { "Unknown" } - } - - - - GetSecurityDescriptor - - - - SetSecurityDescriptor - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_ResiliencySetting - - - ParityLayout - - if ( $this.psBase.CimInstanceProperties["ParityLayout"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["ParityLayout"].Value) - { - 1 { "Non-rotated Parity" } - 2 { "Rotated Parity" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - NumberOfColumnsDefault - - if ( $this.psBase.CimInstanceProperties["NumberOfColumnsDefault"].Value -eq [System.UInt16]::MaxValue ) - { - "Auto" - } - else - { - $this.psBase.CimInstanceProperties["NumberOfColumnsDefault"].Value - } - - - - NumberOfGroupsDefault - - if ( $this.psBase.CimInstanceProperties["NumberOfGroupsDefault"].Value -eq [System.UInt16]::MaxValue ) - { - "Auto" - } - else - { - $this.psBase.CimInstanceProperties["NumberOfGroupsDefault"].Value - } - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageProvider - - - Type - - switch ($this.psBase.CimInstanceProperties["Type"].Value) - { - 1 { "SMP" } - 2 { "SMI-S" } - Default { "Unknown" } - } - - - - RemoteSubsystemCacheMode - - switch ($this.psBase.CimInstanceProperties["RemoteSubsystemCacheMode"].Value) - { - 0 { "Unknown" } - 2 { "Disabled" } - 3 { "Manual-Discovery" } - Default { "Unknown" } - } - - - - SupportedRemoteSubsystemCacheModes - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["SupportedRemoteSubsystemCacheModes"].Value ) - { - switch ( $status ) - { - 0 { $_status += "Unknown" } - 2 { $_status += "Disabled" } - 3 { $_status += "Manual-Discovery" } - Default { "Unknown" } - } - } - $_status; - - - - GetSecurityDescriptor - - - - SetSecurityDescriptor - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageSubSystem - - - NameFormat - - if ( $this.psBase.CimInstanceProperties["NameFormat"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["NameFormat"].Value) - { - 1 { "Other" } - 2 { "IP" } - 3 { "Dial" } - 4 { "HID" } - 5 { "NWA" } - 6 { "HWA" } - 7 { "X25" } - 8 { "ISDN" } - 9 { "IPX" } - 10 { "DCC" } - 11 { "ICD" } - 12 { "E.164" } - 13 { "SNA" } - 14 { "OID/OSI" } - 15 { "WWN" } - 16 { "NAA" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - HealthStatus - - switch ($this.psBase.CimInstanceProperties["HealthStatus"].Value) - { - 0 { "Healthy" } - 1 { "Warning" } - 2 { "Unhealthy" } - Default { "Unknown" } - } - - - - OperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) - { - switch ( $status ) - { - 1 { $_status += "Other" } - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 4 { $_status += "Stressed" } - 5 { $_status += "Predictive Failure" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 8 { $_status += "Starting" } - 9 { $_status += "Stopping" } - 10 { $_status += "Stopped" } - 11 { $_status += "In Service" } - 12 { $_status += "No Contact" } - 13 { $_status += "Lost Communication" } - 14 { $_status += "Aborted" } - 15 { $_status += "Dormant" } - 16 { $_status += "Supporting Entity in Error" } - 17 { $_status += "Completed" } - 18 { $_status += "Power Mode" } - 19 { $_status += "Relocating" } - Default { $_status += "Unknown" } - } - } - $_status; - - - - FaultDomainAwarenessDefault - - switch ($this.psBase.CimInstanceProperties["FaultDomainAwarenessDefault"].Value) - { - 1 { "PhysicalDisk" } - 2 { "StorageEnclosure" } - 3 { "StorageScaleUnit" } - 4 { "StorageChassis" } - 5 { "StorageRack" } - Default { "Unknown" } - } - - - - MaskingValidInitiatorIdTypes - - $_type = @(); - foreach ( $type in $this.psBase.CimInstanceProperties["MaskingValidInitiatorIdTypes"].Value ) - { - switch ( $type ) - { - 1 { $_type += "Other" } - 2 { $_type += "Port WWN" } - 3 { $_type += "Node WWN" } - 4 { $_type += "Host Name" } - 5 { $_type += "iSCSI Name" } - 6 { $_type += "Switch WWN" } - 7 { $_type += "SAS Address" } - Default { $_type += "Unknown" } - } - } - $_type; - - - - MaskingPortsPerView - - switch ($this.psBase.CimInstanceProperties["MaskingPortsPerView"].Value) - { - 2 { "One TargetPort per view" } - 3 { "Multiple target ports per view" } - 4 { "All target ports share the same view" } - Default { "Unknown" } - } - - - - DataTieringType - - if ( $this.psBase.CimInstanceProperties["DataTieringType"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["DataTieringType"].Value) - { - 0 { "Unknown" } - 1 { "Not Supported" } - 2 { "Manual" } - 3 { "Auto" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - iSCSITargetCreationScheme - - if ( $this.psBase.CimInstanceProperties["iSCSITargetCreationScheme"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["iSCSITargetCreationScheme"].Value) - { - 0 { "Unknown" } - 1 { "Not Supported" } - 2 { "Manual" } - 3 { "Auto" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - SupportedHostType - - $_type = @(); - foreach ( $type in $this.psBase.CimInstanceProperties["SupportedHostType"].Value ) - { - switch ( $type ) - { - 0 { $_type += "Unknown" } - 1 { $_type += "Other" } - 2 { $_type += "Standard" } - 3 { $_type += "Solaris" } - 4 { $_type += "HPUX" } - 5 { $_type += "OpenVMS" } - 6 { $_type += "Tru64" } - 7 { $_type += "Netware" } - 8 { $_type += "Sequent" } - 9 { $_type += "AIX" } - 10 { $_type += "DGUX" } - 11 { $_type += "Dynix" } - 12 { $_type += "Irix" } - 13 { $_type += "Cisco iSCSI Storage Router" } - 14 { $_type += "Linux" } - 15 { $_type += "Microsoft Windows" } - 16 { $_type += "OS400" } - 17 { $_type += "TRESPASS" } - 18 { $_type += "HI-UX" } - 19 { $_type += "VMware ESXi" } - 20 { $_type += "Microsoft Windows Server 2008" } - 21 { $_type += "Microsoft Windows Server 2003" } - Default { $_type += "Unknown" } - } - } - $_type; - - - - SupportedDeduplicationObjectTypes - - $_type = @(); - foreach ( $type in $this.psBase.CimInstanceProperties["SupportedDeduplicationObjectTypes"].Value ) - { - switch ( $type ) - { - 2 { $_type += "Volume" } - 4 { $_type += "VirtualDisk" } - 8 { $_type += "Partition" } - 16 { $_type += "StoragePool" } - Default { $_type += "Unknown" } - } - } - $_type; - - - - SupportedDeduplicationFileSystemTypes - - $_type = @(); - foreach ( $type in $this.psBase.CimInstanceProperties["SupportedDeduplicationFileSystemTypes"].Value ) - { - switch ( $type ) - { - 0 { $_type += "Unknown" } - 1 { $_type += "Threshold" } - 2 { $_type += "UFS" } - 3 { $_type += "HFS" } - 4 { $_type += "FAT" } - 5 { $_type += "FAT16" } - 6 { $_type += "FAT32" } - 7 { $_type += "NTFS4" } - 8 { $_type += "NTFS5" } - 9 { $_type += "XFS" } - 10 { $_type += "AFS" } - 11 { $_type += "EXT2" } - 12 { $_type += "EXT3" } - 13 { $_type += "ReiserFS" } - 14 { $_type += "NTFS" } - 15 { $_type += "ReFS" } - 32768 { $_type += "CSVFS_NTFS" } - 32769 { $_type += "CSVFS_ReFS" } - Default { $_type += "Unknown" } - } - } - $_type; - - - - SupportedFileSystems - - $_type = @(); - foreach ( $type in $this.psBase.CimInstanceProperties["SupportedFileSystems"].Value ) - { - switch ( $type ) - { - 0 { $_type += "Unknown" } - 2 { $_type += "UFS" } - 3 { $_type += "HFS" } - 4 { $_type += "FAT" } - 5 { $_type += "FAT16" } - 6 { $_type += "FAT32" } - 7 { $_type += "NTFS4" } - 8 { $_type += "NTFS5" } - 9 { $_type += "XFS" } - 10 { $_type += "AFS" } - 11 { $_type += "EXT2" } - 12 { $_type += "EXT3" } - 13 { $_type += "ReiserFS" } - 14 { $_type += "NTFS" } - 15 { $_type += "ReFS" } - 32768 { $_type += "CSVFS_NTFS" } - 32769 { $_type += "CSVFS_ReFS" } - Default { $_type += "Unknown" } - } - } - $_type; - - - - StorageConnectionType - - switch ( $this.psBase.CimInstanceProperties["StorageConnectionType"].Value ) - { - 0 { "Unknown" } - 1 { "Shared Storage" } - 2 { "Local Storage" } - Default { "Unknown" } - } - - - - SupportedFileServerProtocols - - $_protos = @(); - foreach ( $p in $this.psBase.CimInstanceProperties["SupportedFileServerProtocols"].Value ) - { - switch ( $p ) - { - 2 { $_protos += "NFS" } - 3 { $_protos += "SMB" } - Default { "Unknown" } - } - } - $_protos; - - - - GetSecurityDescriptor - - - - SetSecurityDescriptor - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_Volume - - - OperationalStatus - - $_status = @(); - foreach( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) - { - switch ( $status ) - { - 1 { $_status += "Other" } - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 4 { $_status += "Stressed" } - 5 { $_status += "Predictive Failure" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 8 { $_status += "Starting" } - 9 { $_status += "Stopping" } - 10 { $_status += "Stopped" } - 11 { $_status += "InService" } - 12 { $_status += "No Contact" } - 13 { $_status += "Lost Communication" } - 14 { $_status += "Aborted" } - 15 { $_status += "Dormant" } - 16 { $_status += "Supporting Entity in Error" } - 17 { $_status += "Completed" } - 18 { $_status += "Power Mode" } - 19 { $_status += "Relocating" } - 53261 { $_status += "Scan Needed" } - 53262 { $_status += "Spot Fix Needed" } - 53263 { $_status += "Full Repair Needed" } - 53267 { $_status += "Offline" } - Default { $_status += "Unknown" } - } - } - $_status; - - - - HealthStatus - - switch ($this.psBase.CimInstanceProperties["HealthStatus"].Value) - { - 0 { "Healthy" } - 1 { "Warning" } - 2 { "Unhealthy" } - Default { "Unknown" } - } - - - - DriveType - - switch ($this.psBase.CimInstanceProperties["DriveType"].Value) - { - 0 { "Unknown" } - 1 { "Invalid Root Path" } - 2 { "Removable" } - 3 { "Fixed" } - 4 { "Remote" } - 5 { "CD-ROM" } - 6 { "RAM Disk" } - Default { "Unknown" } - } - - - - FileSystemType - - switch ($this.psBase.CimInstanceProperties["FileSystemType"].Value) - { - 0 { "Unknown" } - 2 { "UFS" } - 3 { "HFS" } - 4 { "FAT" } - 5 { "FAT16" } - 6 { "FAT32" } - 7 { "NTFS4" } - 8 { "NTFS5" } - 9 { "XFS" } - 10 { "AFS" } - 11 { "EXT2" } - 12 { "EXT3" } - 13 { "ReiserFS" } - 14 { "NTFS" } - 15 { "ReFS" } - 32768 { "CSVFS_NTFS" } - 32769 { "CSVFS_ReFS" } - Default { $null } - } - - - - DedupMode - - switch ($this.psBase.CimInstanceProperties["DedupMode"].Value) - { - 0 { "Disabled" } - 1 { "GeneralPurpose" } - 2 { "HyperV" } - 3 { "Backup" } - 4 { "NotAvailable" } - Default { "Unknown" } - } - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_TargetPort - - - ConnectionType - - if ( $this.psBase.CimInstanceProperties["ConnectionType"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["ConnectionType"].Value) - { - 1 { "Other" } - 2 { "Fibre Channel" } - 3 { "Parallel SCSI" } - 4 { "SSA" } - 5 { "IEEE 1394" } - 6 { "RDMA" } - 7 { "iSCSI" } - 8 { "SAS" } - 9 { "ADT " } - } - } - else - { - $null - } - - - - Role - - if ( $this.psBase.CimInstanceProperties["Role"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["Role"].Value) - { - 0 { "Unknown" } - 1 { "Initiator" } - 2 { "Target" } - 3 { "Both Initiator and Target" } - } - } - else - { - $null; - } - - - - OperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) - { - switch ( $status ) - { - 1 { $_status += "Other" } - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 4 { $_status += "Stressed" } - 5 { $_status += "Predictive Failure" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 8 { $_status += "Starting" } - 9 { $_status += "Stopping" } - 10 { $_status += "Stopped" } - 11 { $_status += "InService" } - 12 { $_status += "No Contact" } - 13 { $_status += "Lost Communication" } - 14 { $_status += "Aborted" } - 15 { $_status += "Dormant" } - 16 { $_status += "Supporting Entity in Error" } - 17 { $_status += "Completed" } - 18 { $_status += "Power Mode" } - 19 { $_status += "Relocating" } - Default { $_status += "Unknown" } - } - } - $_status; - - - - HealthStatus - - switch ($this.psBase.CimInstanceProperties["HealthStatus"].Value) - { - 0 { "Healthy" } - 1 { "Warning" } - 2 { "Unhealthy" } - Default { "Unknown" } - } - - - - LinkTechnology - - if ( $this.psBase.CimInstanceProperties["LinkTechnology"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["LinkTechnology"].Value) - { - 0 { "Unknown" } - 1 { "Other" } - 2 { "Ethernet" } - 3 { "IB" } - 4 { "FC" } - 5 { "FDDI" } - 6 { "ATM" } - 7 { "Token Ring" } - 8 { "Frame Relay" } - 9 { "Infrared" } - 10 { "Bluetooth" } - 11 { "Wireless LAN" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - PortType - - if ( $this.psBase.CimInstanceProperties["PortType"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["PortType"].Value) - { - 0 { "Unknown" } - 1 { "Other" } - 10 { "N" } - 11 { "NL" } - 12 { "F/NL" } - 13 { "Nx" } - 14 { "E" } - 15 { "F" } - 16 { "FL" } - 17 { "B" } - 18 { "G" } - 50 {"10BaseT" } - 51 { "10-100BaseT" } - 52 { "100BaseT" } - 53 { "1000BaseT" } - 54 { "2500BaseT" } - 55 { "10GBaseT" } - 56 { "10GBase-CX4" } - 94 { "SAS" } - 100 { "100Base-FX" } - 101 { "100Base-SX" } - 102 { "1000Base-SX" } - 103 { "1000Base-LX" } - 104 { "1000Base-CX" } - 105 { "10GBase-SR" } - 106 { "10GBase-SW" } - 107 { "10GBase-LX4" } - 108 { "10GBase-LR" } - 109 { "10GBase-LW" } - 110 { "10GBase-ER" } - 111 { "10GBase-EW" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - UsageRestriction - - if ( $this.psBase.CimInstanceProperties["UsageRestriction"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["UsageRestriction"].Value) - { - 0 { "Unknown" } - 2 { "Front-end only" } - 3 { "Back-end only" } - 4 { "Not restricted" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_InitiatorId - - - Type - - if ( $this.psBase.CimInstanceProperties["Type"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["Type"].Value) - { - 1 { "Other" } - 2 { "PortWWN" } - 3 { "NodeWWN" } - 4 { "Hostname" } - 5 { "iSCSI Name" } - 6 { "SwitchWWN" } - 7 { "SASAddress" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - HostType - - if ( $this.psBase.CimInstanceProperties["HostType"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["HostType"].Value) - { - 0 { "Unknown" } - 1 { "Other" } - 2 { "Standard" } - 3 { "Solaris" } - 4 { "HPUX" } - 5 { "OpenVMS" } - 6 { "Tru64" } - 7 { "Netware" } - 8 { "Sequent" } - 9 { "AIX" } - 10 { "DGUX" } - 11 { "Dynix" } - 12 { "Irix" } - 13 { "Cisco iSCSI Storage Router" } - 14 { "Linux" } - 15 { "Microsoft Windows" } - 16 { "OS400" } - 17 { "TRESPASS" } - 18 { "HI-UX" } - 19 { "VMware ESXi" } - 20 { "Microsoft Windows Server 2008" } - 21 { "Microsoft Windows Server 2003" } - Default { "Unknown" } - } - } - else - { - $null; - } - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_InitiatorPort - - - PortType - - switch ($this.psBase.CimInstanceProperties["PortType"].Value) - { - 1 { "Unknown" } - 2 { "Other" } - 3 { "Not present" } - 5 { "Fabric" } - 6 { "Public Loop" } - 7 { "FL Port" } - 8 { "Fabric Port" } - 9 { "Fabric expansion port" } - 10 { "Generic Fabric Port" } - 20 { "Private Loop" } - 21 { "Point to Point" } - Default { "Unknown" } - } - - - - ConnectionType - - switch ($this.psBase.CimInstanceProperties["ConnectionType"].Value) - { - 0 { "Other" } - 1 { "Fibre Channel" } - 2 { "iSCSI" } - 3 { "SAS" } - Default { "Unknown" } - } - - - - OperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) - { - switch ( $status ) - { - 1 { $_status += "Unknown" } - 2 { $_status += "Operational" } - 3 { $_status += "User Offline" } - 4 { $_status += "Bypassed" } - 5 { $_status += "In diagnostics mode" } - 6 { $_status += "Link Down" } - 7 { $_status += "Port Error" } - 8 { $_status += "Loopback" } - } - } - $_status; - - - - PortSupportedSpeed - - switch ($this.psBase.CimInstanceProperties["PortSupportedSpeed"].Value) - { - 1 { "1 GBit/sec" } - 2 { "2 GBit/sec" } - 4 { "10 GBit/sec" } - 8 { "4 GBit/sec" } - Default { "Unknown" } - } - - - - PortSpeed - - switch ($this.psBase.CimInstanceProperties["PortSpeed"].Value) - { - 1 { "1 GBit/sec" } - 2 { "2 GBit/sec" } - 4 { "10 GBit/sec" } - 8 { "4 GBit/sec" } - Default { "Unknown" } - } - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_MaskingSet - - - HostType - - if ( $this.psBase.CimInstanceProperties["HostType"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["HostType"].Value) - { - 0 { "Unknown" } - 1 { "Other" } - 2 { "Standard" } - 3 { "Solaris" } - 4 { "HPUX" } - 5 { "OpenVMS" } - 6 { "Tru64" } - 7 { "Netware" } - 8 { "Sequent" } - 9 { "AIX" } - 10 { "DGUX" } - 11 { "Dynix" } - 12 { "Irix" } - 13 { "Cisco iSCSI Storage Router" } - 14 { "Linux" } - 15 { "Microsoft Windows" } - 16 { "OS400" } - 17 { "TRESPASS" } - 18 { "HI-UX" } - 19 { "VMware ESXi" } - 20 { "Microsoft Windows Server 2008" } - 21 { "Microsoft Windows Server 2003" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageSetting - - - NewDiskPolicy - - switch ($this.psBase.CimInstanceProperties["NewDiskPolicy"].Value) - { - 0 { "Unknown" } - 1 { "OnlineAll" } - 2 { "OfflineShared" } - 3 { "OfflineAll" } - 4 { "OfflineInternal" } - Default { "OfflineShared" } - } - - - - ScrubPolicy - - switch ($this.psBase.CimInstanceProperties["ScrubPolicy"].Value) - { - 0 { "Off" } - 1 { "IntegrityStreams" } - 2 { "All" } - Default { "Integrity Streams" } - } - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageJob - - - OperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) - { - switch ( $status ) - { - 1 { $_status += "Other" } - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 4 { $_status += "Stressed" } - 5 { $_status += "Predictive Failure" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 8 { $_status += "Starting" } - 9 { $_status += "Stopping" } - 10 { $_status += "Stopped" } - 11 { $_status += "In Service" } - 12 { $_status += "No Contact" } - 13 { $_status += "Lost Communication" } - 14 { $_status += "Aborted" } - 15 { $_status += "Dormant" } - 16 { $_status += "Supporting Entity in Error" } - 17 { $_status += "Completed" } - 18 { $_status += "Power Mode" } - 19 { $_status += "Relocating" } - 32772 { $_status += "Failed Media" } - 32773 { $_status += "Split" } - 32774 { $_status += "Stale Metadata" } - 32775 { $_status += "IO Error" } - 32776 { $_status += "Unrecognized Metadata" } - Default { "Unknown" } - } - } - $_status; - - - - JobState - - switch ( $this.psBase.CimInstanceProperties["JobState"].Value ) - { - 2 { "New" } - 3 { "Starting" } - 4 { "Running" } - 5 { "Suspended" } - 6 { "Shutting Down" } - 7 { "Completed" } - 8 { "Terminated" } - 9 { "Killed" } - 10 { "Exception" } - 11 { "Service" } - 12 { "Query Pending" } - Default { "Unknown" } - } - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_FileStorageTier - - - PlacementStatus - - switch ( $this.psBase.CimInstanceProperties["PlacementStatus"].Value ) - { - 0 { "Unknown" } - 1 { "Completely on tier" } - 2 { "Partially on tier" } - 3 { "Not on tier" } - Default { "Unknown" } - } - - - - State - - switch ( $this.psBase.CimInstanceProperties["State"].Value ) - { - 0 { "Unknown" } - 1 { "OK" } - 2 { "Insufficent Capacity" } - 3 { "In Process" } - 4 { "Pending" } - Default { "Unknown" } - } - - - - DesiredStorageTierClass - - switch ( $this.psBase.CimInstanceProperties["DesiredStorageTierClass"].Value ) - { - 1 { "Capacity" } - 2 { "Performance" } - Default { "Unknown" } - } - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageTier - - - Usage - - switch ( $this.psBase.CimInstanceProperties["Usage"].Value ) - { - 0 { "Unknown" } - 1 { "Data" } - 2 { "Read Cache" } - 3 { "Write Cache" } - 4 { "Dirty Region Tracking" } - 5 { "Valid Data Tracking" } - Default { "Unknown" } - } - - - - ProvisioningType - - switch ( $this.psBase.CimInstanceProperties["ProvisioningType"].Value ) - { - 0 { "Unknown" } - 1 { "Thin" } - 2 { "Fixed" } - Default { "Unknown" } - } - - - - AllocationUnitSize - - if ( $this.psBase.CimInstanceProperties["AllocationUnitSize"].Value -eq [System.UInt64]::MaxValue ) - { - "Auto" - } - else - { - $this.psBase.CimInstanceProperties["AllocationUnitSize"].Value - } - - - - MediaType - - switch ( $this.psBase.CimInstanceProperties["MediaType"].Value ) - { - 0 { "Unspecified" } - 3 { "HDD" } - 4 { "SSD" } - 5 { "SCM" } - Default { "Unspecified" } - } - - - - TierClass - - switch ( $this.psBase.CimInstanceProperties["TierClass"].Value ) - { - 0 { "Unknown" } - 1 { "Capacity" } - 2 { "Performance" } - Default { "Unknown" } - } - - - - FaultDomainAwareness - - switch ($this.psBase.CimInstanceProperties["FaultDomainAwareness"].Value) - { - 1 { "PhysicalDisk" } - 2 { "StorageEnclosure" } - 3 { "StorageScaleUnit" } - 4 { "StorageChassis" } - 5 { "StorageRack" } - Default { "Unknown" } - } - - - - ColumnIsolation - - switch ($this.psBase.CimInstanceProperties["ColumnIsolation"].Value) - { - 1 { "PhysicalDisk" } - 2 { "StorageEnclosure" } - 3 { "StorageScaleUnit" } - 4 { "StorageChassis" } - 5 { "StorageRack" } - Default { "Unknown" } - } - - - - NumberOfColumns - - if ( $this.psBase.CimInstanceProperties["NumberOfColumns"].Value -eq [System.UInt16]::MaxValue ) - { - "Auto" - } - else - { - $this.psBase.CimInstanceProperties["NumberOfColumns"].Value - } - - - - NumberOfGroups - - if ( $this.psBase.CimInstanceProperties["NumberOfGroups"].Value -eq [System.UInt16]::MaxValue ) - { - "Auto" - } - else - { - $this.psBase.CimInstanceProperties["NumberOfGroups"].Value - } - - - - ParityLayout - - if ( $this.psBase.CimInstanceProperties["ParityLayout"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ($this.psBase.CimInstanceProperties["ParityLayout"].Value) - { - 1 { "Non-rotated Parity" } - 2 { "Rotated Parity" } - Default { "Unknown" } - } - } - else - { - $null - } - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_PhysicalExtent - - - Flags - - $_flags = $this.psBase.CimInstanceProperties["Flags"].Value - $_flagsToHex = "{0:x16}" -f $_flags - '0x' + $_flagsToHex; - - - - OperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) - { - switch ( $status ) - { - 13 { $_status += "Lost Communication" } - 53254 { $_status += "Stale Metadata" } - 53278 { $_status += "Active" } - 53279 { $_status += "Need Reallocation" } - 53280 { $_status += "Need Regeneration" } - 53281 { $_status += "Regenerating" } - 53282 { $_status += "Not Allocated" } - 53283 { $_status += "Pending Deletion" } - Default { "Unknown" } - } - } - $_status; - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageNodeToDisk - - - HealthStatus - - switch ($this.psBase.CimInstanceProperties["HealthStatus"].Value) - { - 0 { "Healthy" } - 1 { "Warning" } - 2 { "Unhealthy" } - Default { "Unknown" } - } - - - - OperationalStatus - - $_status = @(); - foreach( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) - { - switch ( $status ) - { - 1 { $_status += "Other" } - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 4 { $_status += "Stressed" } - 5 { $_status += "Predictive Failure" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 8 { $_status += "Starting" } - 9 { $_status += "Stopping" } - 10 { $_status += "Stopped" } - 11 { $_status += "InService" } - 12 { $_status += "No Contact" } - 13 { $_status += "Lost Communication" } - 14 { $_status += "Aborted" } - 15 { $_status += "Dormant" } - 16 { $_status += "Supporting Entity in Error" } - 17 { $_status += "Completed" } - 18 { $_status += "Power Mode" } - 19 { $_status += "Relocating" } - 53264 { $_status += "Online" } - 53265 { $_status += "Not Ready" } - 53266 { $_status += "No Media" } - 53267 { $_status += "Offline" } - 53268 { $_status += "Failed" } - Default { $_status += "Unknown" } - } - } - $_status; - - - - OfflineReason - - switch ($this.psBase.CimInstanceProperties["OfflineReason"].Value) - { - 1 { "Policy" } - 2 { "Redundant Path" } - 3 { "Snapshot" } - 4 { "Collision" } - 5 { "Resource Exhaustion" } - 6 { "Critical Write Failures" } - 7 { "Data Integrity Scan Required" } - Default { $null } - } - - - - StorageNodeObjectId - - $this.psBase.CimInstanceProperties["StorageNode"].Value.ObjectId - - - - DiskObjectId - - $this.psBase.CimInstanceProperties["Disk"].Value.ObjectId - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_FileServer - - - HealthStatus - - switch ( $this.psBase.CimInstanceProperties["HealthStatus"].Value ) - { - 0 { "Healthy" } - 1 { "Warning" } - 2 { "Unhealthy" } - 5 { "Unknown" } - Default { "Unknown" } - } - - - - OperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) - { - switch ( $status ) - { - 1 { $_status += "Other" } - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 4 { $_status += "Stressed" } - 5 { $_status += "Predictive Failure" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 8 { $_status += "Starting" } - 9 { $_status += "Stopping" } - 10 { $_status += "Stopped" } - 11 { $_status += "In Service" } - 12 { $_status += "No Contact" } - 13 { $_status += "Lost Communication" } - 14 { $_status += "Aborted" } - 15 { $_status += "Dormant" } - 16 { $_status += "Supporting Entity in Error" } - 17 { $_status += "Completed" } - 18 { $_status += "Power Mode" } - 19 { $_status += "Relocating" } - 53248 { $_status += "Read-Only" } - 53248 { $_status += "Incomplete" } - Default { "Unknown" } - } - } - $_status; - - - - FileSharingProtocols - - $_protos = @(); - foreach ( $p in $this.psBase.CimInstanceProperties["FileSharingProtocols"].Value ) - { - switch ( $p ) - { - 2 { $_protos += "NFS" } - 3 { $_protos += "SMB" } - Default { "Unknown" } - } - } - $_protos; - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_FileShare - - - HealthStatus - - switch ( $this.psBase.CimInstanceProperties["HealthStatus"].Value ) - { - 0 { "Healthy" } - 1 { "Warning" } - 2 { "Unhealthy" } - 5 { "Unknown" } - Default { "Unknown" } - } - - - - OperationalStatus - - $_status = @(); - foreach( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) - { - switch ( $status ) - { - 1 { $_status += "Other" } - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 4 { $_status += "Stressed" } - 5 { $_status += "Predictive Failure" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 8 { $_status += "Starting" } - 9 { $_status += "Stopping" } - 10 { $_status += "Stopped" } - 11 { $_status += "InService" } - 12 { $_status += "No Contact" } - 13 { $_status += "Lost Communication" } - 14 { $_status += "Aborted" } - 15 { $_status += "Dormant" } - 16 { $_status += "Supporting Entity in Error" } - 17 { $_status += "Completed" } - 18 { $_status += "Power Mode" } - 19 { $_status += "Relocating" } - 53264 { $_status += "Online" } - 53265 { $_status += "Not Ready" } - 53266 { $_status += "No Media" } - 53267 { $_status += "Offline" } - 53268 { $_status += "Failed" } - Default { $_status += "Unknown" } - } - } - $_status; - - - - ShareState - - switch ( $this.psBase.CimInstanceProperties["ShareState"].Value ) - { - 0 { "Pending" } - 1 { "Online" } - 2 { "Offline" } - Default { "Unknown" } - } - - - - FileSharingProtocol - - switch ( $this.psBase.CimInstanceProperties["FileSharingProtocol"].Value ) - { - 2 { "NFS" } - 3 { "SMB" } - Default { "Unknown" } - } - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageNodeToPhysicalDisk - - - HealthStatus - - switch ($this.psBase.CimInstanceProperties["HealthStatus"].Value) - { - 0 { "Healthy" } - 1 { "Warning" } - 2 { "Unhealthy" } - 5 { "Unknown" } - Default { "Unknown" } - } - - - - OperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) - { - switch ( $status ) - { - 1 { $_status += "Other" } - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 4 { $_status += "Stressed" } - 5 { $_status += "Predictive Failure" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 8 { $_status += "Starting" } - 9 { $_status += "Stopping" } - 10 { $_status += "Stopped" } - 11 { $_status += "In Service" } - 12 { $_status += "No Contact" } - 13 { $_status += "Lost Communication" } - 14 { $_status += "Aborted" } - 15 { $_status += "Dormant" } - 16 { $_status += "Supporting Entity in Error" } - 17 { $_status += "Completed" } - 18 { $_status += "Power Mode" } - 19 { $_status += "Relocating" } - 53252 { $_status += "Failed Media" } - 53253 { $_status += "Split" } - 53254 { $_status += "Stale Metadata" } - 53255 { $_status += "IO Error" } - 53256 { $_status += "Unrecognized Metadata" } - 53269 { $_status += "Removing from pool" } - 53270 { $_status += "In Maintenance Mode" } - 53271 { $_status += "Updating firmware" } - 53272 { $_status += "Device Hardware Error" } - 53273 { $_status += "Not Usable" } - 53274 { $_status += "Transient Error" } - 53276 { $_status += "Starting Maintenance Mode"} - 53277 { $_status += "Stopping Maintenance Mode"} - 53285 { $_status += "Threshold Exceeded"} - 53286 { $_status += "Abnormal Latency"} - Default { "Unknown" } - } - } - $_status; - - - - LoadBalancePolicy - - if ( $this.psBase.CimInstanceProperties["LoadBalancePolicy"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) - { - switch ( $this.psBase.CimInstanceProperties["LoadBalancePolicy"].Value ) - { - 0 { "Unknown" } - 1 { "Fail Over" } - 2 { "Round Robin" } - 3 { "Round Robin with Subset" } - 4 { "Least Queue Depth" } - 5 { "Weighted Paths" } - 6 { "Least Blocks" } - 7 { "Vendor Specific" } - } - } - - - - PathState - - $_state = @(); - foreach ( $state in $this.psBase.CimInstanceProperties["PathState"].Value ) - { - switch ( $state ) - { - 0 { $_state += "Unavailable" } - 1 { $_state += "Active/Unoptimized" } - 2 { $_state += "Standby" } - 3 { $_state += "Active/Optimized" } - 4 { $_state += "Failed" } - } - } - $_state; - - - - StorageNodeObjectId - - $this.psBase.CimInstanceProperties["StorageNode"].Value.ObjectId - - - - PhysicalDiskObjectId - - $this.psBase.CimInstanceProperties["PhysicalDisk"].Value.ObjectId - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageNodeToStorageEnclosure - - - HealthStatus - - switch ($this.psBase.CimInstanceProperties["HealthStatus"].Value) - { - 0 { "Healthy" } - 1 { "Warning" } - 2 { "Unhealthy" } - 5 { "Unknown" } - Default { "Unknown" } - } - - - - SlotOperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["SlotOperationalStatus"].Value ) - { - switch ( $status ) - { - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 53257 { $_status += "Not Installed" } - 53258 { $_status += "Off" } - 53259 { $_status += "No Access Allowed" } - 53260 { $_status += "Not Reported" } - Default { "Unknown" } - } - } - $_status; - - - - PowerSupplyOperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["PowerSupplyOperationalStatus"].Value ) - { - switch ( $status ) - { - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 53257 { $_status += "Not Installed" } - 53258 { $_status += "Off" } - 53259 { $_status += "No Access Allowed" } - 53260 { $_status += "Not Reported" } - Default { "Unknown" } - } - } - $_status; - - - - FanOperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["FanOperationalStatus"].Value ) - { - switch ( $status ) - { - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 53257 { $_status += "Not Installed" } - 53258 { $_status += "Off" } - 53259 { $_status += "No Access Allowed" } - 53260 { $_status += "Not Reported" } - Default { "Unknown" } - } - } - $_status; - - - - TemperatureSensorOperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["TemperatureSensorOperationalStatus"].Value ) - { - switch ( $status ) - { - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 53257 { $_status += "Not Installed" } - 53258 { $_status += "Off" } - 53259 { $_status += "No Access Allowed" } - 53260 { $_status += "Not Reported" } - Default { "Unknown" } - } - } - $_status; - - - - VoltageSensorOperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["VoltageSensorOperationalStatus"].Value ) - { - switch ( $status ) - { - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 53257 { $_status += "Not Installed" } - 53258 { $_status += "Off" } - 53259 { $_status += "No Access Allowed" } - 53260 { $_status += "Not Reported" } - Default { "Unknown" } - } - } - $_status; - - - - CurrentSensorOperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["CurrentSensorOperationalStatus"].Value ) - { - switch ( $status ) - { - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 53257 { $_status += "Not Installed" } - 53258 { $_status += "Off" } - 53259 { $_status += "No Access Allowed" } - 53260 { $_status += "Not Reported" } - Default { "Unknown" } - } - } - $_status; - - - - IOControllerOperationalStatus - - $_status = @(); - foreach ( $status in $this.psBase.CimInstanceProperties["IOControllerOperationalStatus"].Value ) - { - switch ( $status ) - { - 2 { $_status += "OK" } - 3 { $_status += "Degraded" } - 6 { $_status += "Error" } - 7 { $_status += "Non-Recoverable Error" } - 53257 { $_status += "Not Installed" } - 53258 { $_status += "Off" } - 53259 { $_status += "No Access Allowed" } - 53260 { $_status += "Not Reported" } - Default { "Unknown" } - } - } - $_status; - - - - StorageNodeObjectId - - $this.psBase.CimInstanceProperties["StorageNode"].Value.ObjectId - - - - StorageEnclosureObjectId - - $this.psBase.CimInstanceProperties["StorageEnclosure"].Value.ObjectId - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageDiagnoseResult - - - PerceivedSeverity - - switch ( $this.psBase.CimInstanceProperties["PerceivedSeverity"].Value ) - { - 0 { "Unknown" } - 2 { "Information" } - 3 { "Degraded/Warning" } - 4 { "Minor" } - 5 { "Major" } - 6 { "Critical" } - 7 { "Fatal/NonRecoverable" } - } - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_HealthAction - - - State - - switch ( $this.psBase.CimInstanceProperties["State"].Value ) - { - 0 { "None" } - 1 { "Scheduled" } - 2 { "Running" } - 3 { "Paused" } - 1024 { "Succeeded" } - 1025 { "Failed" } - 1026 { "Canceled" } - } - - - - - diff --git a/newton-cn/bin/Modules/Storage/StorageCmdlets.cdxml b/newton-cn/bin/Modules/Storage/StorageCmdlets.cdxml deleted file mode 100644 index 219b64b..0000000 --- a/newton-cn/bin/Modules/Storage/StorageCmdlets.cdxml +++ /dev/null @@ -1,3187 +0,0 @@ - - - 1.0.0.0 - NoExport - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Storage/StorageEnclosure.cdxml b/newton-cn/bin/Modules/Storage/StorageEnclosure.cdxml deleted file mode 100644 index 4c51f4e..0000000 --- a/newton-cn/bin/Modules/Storage/StorageEnclosure.cdxml +++ /dev/null @@ -1,339 +0,0 @@ - - - 1.0.0.0 - StorageEnclosure - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Storage/StorageHealth.cdxml b/newton-cn/bin/Modules/Storage/StorageHealth.cdxml deleted file mode 100644 index 8341214..0000000 --- a/newton-cn/bin/Modules/Storage/StorageHealth.cdxml +++ /dev/null @@ -1,151 +0,0 @@ - - - 1.0.0.0 - StorageHealth - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/Storage/StorageJob.cdxml b/newton-cn/bin/Modules/Storage/StorageJob.cdxml deleted file mode 100644 index fa537a2..0000000 --- a/newton-cn/bin/Modules/Storage/StorageJob.cdxml +++ /dev/null @@ -1,172 +0,0 @@ - - - 1.0.0.0 - StorageJob - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Storage/StorageNode.cdxml b/newton-cn/bin/Modules/Storage/StorageNode.cdxml deleted file mode 100644 index b009ffe..0000000 --- a/newton-cn/bin/Modules/Storage/StorageNode.cdxml +++ /dev/null @@ -1,113 +0,0 @@ - - - 1.0.0.0 - StorageNode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Storage/StoragePool.cdxml b/newton-cn/bin/Modules/Storage/StoragePool.cdxml deleted file mode 100644 index 66f2753..0000000 --- a/newton-cn/bin/Modules/Storage/StoragePool.cdxml +++ /dev/null @@ -1,786 +0,0 @@ - - - 1.0.0.0 - StoragePool - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/Storage/StorageProvider.cdxml b/newton-cn/bin/Modules/Storage/StorageProvider.cdxml deleted file mode 100644 index c7041e1..0000000 --- a/newton-cn/bin/Modules/Storage/StorageProvider.cdxml +++ /dev/null @@ -1,227 +0,0 @@ - - - 1.0.0.0 - StorageProvider - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Storage/StorageReliabilityCounter.cdxml b/newton-cn/bin/Modules/Storage/StorageReliabilityCounter.cdxml deleted file mode 100644 index 30b834d..0000000 --- a/newton-cn/bin/Modules/Storage/StorageReliabilityCounter.cdxml +++ /dev/null @@ -1,49 +0,0 @@ - - - 1.0.0.0 - StorageReliabilityCounter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/Storage/StorageScripts.psm1 b/newton-cn/bin/Modules/Storage/StorageScripts.psm1 deleted file mode 100644 index ad25618..0000000 --- a/newton-cn/bin/Modules/Storage/StorageScripts.psm1 +++ /dev/null @@ -1,7951 +0,0 @@ -############################ -# -# Copyright (c) Microsoft Corporation -# -# Abstract: -# SMAPI script cmdlets -# -############################ - -using namespace System.Management.Automation.Runspaces - -import-module Storage\StorageHealth.cdxml -import-module Storage\StorageSubSystem.cdxml - -$StorageNamespace = 'root\microsoft\windows\storage' -$WmiNamespace = 'root\wmi' -$ClusterNamespace = 'root\mscluster' - -$Global:StorageHistoryCharts = [Hashtable]::Synchronized(@{}) - -function CreateErrorRecord -{ - Param - ( - [String] - $ErrorId, - - [String] - $ErrorMessage, - - [System.Management.Automation.ErrorCategory] - $ErrorCategory, - - [Exception] - $Exception, - - [Object] - $TargetObject - ) - - if($Exception -eq $null) - { - $Exception = New-Object System.Management.Automation.RuntimeException $ErrorMessage - } - - $errorRecord = New-Object System.Management.Automation.ErrorRecord @($Exception, $ErrorId, $ErrorCategory, $TargetObject) - return $errorRecord -} - -class StorageHistory -{ - [UInt16]$Version - [String]$FriendlyName - [String]$SerialNumber - [String]$AdapterSerialNumber - [String]$FirmwareRevision - [String]$DeviceGuid - [String]$DeviceNumber - [String]$BusType - [String]$MediaType - [DateTime]$EventTime - [UInt32]$MaxQueueCount - [UInt32]$MaxOutstandingCount - [UInt64]$TotalIoCount - [UInt64]$SuccessIoCount - [UInt64]$FailedIoCount - [UInt64]$TotalReadBytes - [UInt64]$TotalWriteBytes - [UInt64]$TotalIoLatency - [UInt64]$AvgIoLatency - [UInt64]$MaxIoLatency - [UInt64]$MaxFlushLatency - [UInt64]$MaxUnmapLatency - [UInt64]$TotalQueueIoCount - [UInt64]$TotalQueueIoWaitTime - [UInt64]$AvgQueueIoWaitTime - [UInt64]$MaxQueueIoWaitTime - [UInt32]$IoTimeout - [UInt64]$QueueIoWaitExceededTimeoutCount - [UInt64]$QueueIoBusyCount - [UInt64]$QueueIoPausedCount - [UInt64]$QueueIoUntaggedCommandOutstandingCount - [UInt64]$QueueIoPausedForUntaggedCount - [UInt64]$TotalErrors - [UInt64]$TotalReadWriteErrors - [UInt64]$TotalImpendingDeviceFailureErrors - [UInt64]$TotalDeviceFailureErrors - [UInt16]$BucketCount - [UInt64[]]$BucketIoLatency - [UInt64[]]$BucketSuccessIoCount - [UInt64[]]$BucketFailedIoCount - [UInt64[]]$BucketTotalIoCount - [UInt64[]]$BucketTotalIoTime - [Single[]]$BucketIoPercent - [UInt16]$HighestLatencyBucket - [System.Collections.ArrayList]$UnresponsiveTime - [System.Collections.ArrayList]$ResponsiveTime -} - -class StorageHistoryAggregate -{ - [UInt16]$Version - [String]$FriendlyName - [String]$SerialNumber - [String]$AdapterSerialNumber - [String]$FirmwareRevision - [String]$DeviceGuid - [String]$DeviceNumber - [String]$BusType - [String]$MediaType - [DateTime]$StartTime - [DateTime]$EndTime - [UInt32]$EventCount - [UInt32]$MaxQueueCount - [UInt32]$MaxOutstandingCount - [Double]$TotalIoCount - [Double]$SuccessIoCount - [Double]$FailedIoCount - [Double]$TotalReadBytes - [Double]$TotalWriteBytes - [Double]$TotalIoLatency - [UInt64]$AvgIoLatency - [UInt64]$MaxIoLatency - [UInt64]$MaxFlushLatency - [UInt64]$MaxUnmapLatency - [Double]$TotalQueueIoCount - [Double]$TotalQueueIoWaitTime - [UInt64]$AvgQueueIoWaitTime - [UInt64]$MaxQueueIoWaitTime - [UInt32]$IoTimeout - [Double]$QueueIoWaitExceededTimeoutCount - [Double]$QueueIoBusyCount - [Double]$QueueIoPausedCount - [Double]$QueueIoUntaggedCommandOutstandingCount - [Double]$QueueIoPausedForUntaggedCount - [Double]$TotalErrors - [Double]$TotalReadWriteErrors - [Double]$TotalImpendingDeviceFailureErrors - [Double]$TotalDeviceFailureErrors - [UInt16]$BucketCount - [UInt64[]]$BucketIoLatency - [Double[]]$BucketSuccessIoCount - [Double[]]$BucketFailedIoCount - [Double[]]$BucketTotalIoCount - [Double[]]$BucketTotalIoTime - [UInt32[]]$BucketIoPercent - [UInt32[]]$BucketHighestLatencyCount -} - -class StorageError -{ - [UInt16]$Version - [String]$FriendlyName - [String]$SerialNumber - [String]$AdapterSerialNumber - [String]$FirmwareRevision - [String]$DeviceGuid - [String]$DeviceNumber - [String]$BusType - [String]$MediaType - [DateTime]$EventTime - [UInt32]$ServiceDuration - [UInt32]$QueueWaitDuration - [Byte]$Command - [Byte]$SrbStatus - [Byte]$ScsiStatus - [Byte]$SenseKey - [Byte]$SenseCode - [Byte]$SenseCodeQualifier - [UInt32]$IoSize - [UInt32]$QueueDepth - [UInt64]$LBA -} - - -$PopulateStorageError = { - - Param - ( - [Ref] - $Object, - - [System.Diagnostics.Eventing.Reader.EventRecord] - $EventRecord, - - [System.String] - $FriendlyName, - - [System.String] - $SerialNumber, - - [System.String] - $AdapterSerialNumber, - - [System.String] - $FirmwareRevision, - - [System.String] - $DeviceGuid, - - [System.String] - $Number, - - [System.String] - $BusType, - - [System.String] - $MediaType - ) - - $eventXml = [XML]$EventRecord.ToXml() - $tempObject = [PsCustomObject]@{} - - for ($index = 0; $index -lt $eventXml.Event.EventData.Data.Count; $index++) - { - $tempObject | Add-Member -MemberType NoteProperty ` - -Name $eventXml.Event.EventData.Data[$index].Name ` - -Value $eventXml.Event.EventData.Data[$index].'#Text' - } - - $Object.Value.PSObject.TypeNames.Insert( 0, "Microsoft.Windows.StorageManagement.StorageError" ) - $Object.Value.PSObject.TypeNames.Insert( 1, "Microsoft.Windows.StorageManagement.StorageError_v1" ) - - $Object.Value.Version = [UInt16]$tempObject.Version - - if ([String]::IsNullOrEmpty($FriendlyName) -eq $false) - { - $Object.Value.FriendlyName = $FriendlyName - } - else - { - $Object.Value.FriendlyName = $tempObject.ProductId - } - - if ([String]::IsNullOrEmpty($SerialNumber) -eq $false) - { - $Object.Value.SerialNumber = $SerialNumber - } - else - { - $Object.Value.SerialNumber = $tempObject.SerialNumber - } - - if ([String]::IsNullOrEmpty($AdapterSerialNumber) -eq $false) - { - $Object.Value.AdapterSerialNumber = $AdapterSerialNumber - } - else - { - $Object.Value.AdapterSerialNumber = $tempObject.AdapterSerialNumber - } - - if ([String]::IsNullOrEmpty($FirmwareRevision) -eq $false) - { - $Object.Value.FirmwareRevision = $FirmwareRevision - } - - $Object.Value.DeviceGuid = $DeviceGuid - $Object.Value.DeviceNumber = $Number - - if ([String]::IsNullOrEmpty($BusType) -eq $false) - { - $Object.Value.BusType = $BusType - } - else - { - switch ($tempObject.BusType) - { - "8" { $Object.Value.BusType = "RAID" } - "10" { $Object.Value.BusType = "SAS" } - "11" { $Object.Value.BusType = "SATA" } - "14" { $Object.Value.BusType = "Virtual" } - "17" { $Object.Value.BusType = "NVMe" } - "19" { $Object.Value.BusType = "UFS" } - default { $Object.Value.BusType = "Unknown" } - } - } - - $Object.Value.MediaType = $MediaType - $Object.Value.EventTime = $event.TimeCreated - $Object.Value.ServiceDuration = $tempObject.RequestDuration_ms - $Object.Value.QueueWaitDuration = $tempObject.WaitDuration_ms - $Object.Value.Command = $tempObject.Command - $Object.Value.SrbStatus = $tempObject.SrbStatus - $Object.Value.ScsiStatus = $tempObject.ScsiStatus - $Object.Value.SenseKey = $tempObject.SenseKey - $Object.Value.SenseCode = $tempObject.AddSense - $Object.Value.SenseCodeQualifier = $tempObject.AddSenseQ - $Object.Value.IoSize = $tempObject.IoSize - $Object.Value.QueueDepth = $tempObject.QueueDepth - $Object.Value.LBA = $tempObject.LBA -} - - -$PopulateStorageHistory = { - - Param - ( - [Ref] - $Object, - - [System.Diagnostics.Eventing.Reader.EventRecord] - $EventRecord, - - [System.String] - $FriendlyName, - - [System.String] - $SerialNumber, - - [System.String] - $AdapterSerialNumber, - - [System.String] - $FirmwareRevision, - - [System.String] - $DeviceGuid, - - [System.String] - $Number, - - [System.String] - $BusType, - - [System.String] - $MediaType - ) - - $eventXml = [XML]$EventRecord.ToXml() - $tempObject = [PsCustomObject]@{} - - for ($index = 0; $index -lt $eventXml.Event.EventData.Data.Count; $index++) - { - $tempObject | Add-Member -MemberType NoteProperty ` - -Name $eventXml.Event.EventData.Data[$index].Name ` - -Value $eventXml.Event.EventData.Data[$index].'#Text' - } - - $Object.Value.PSObject.TypeNames.Insert( 0, "Microsoft.Windows.StorageManagement.StorageHistory" ) - - $Object.Value.Version = [UInt16]$tempObject.Version - - if ([String]::IsNullOrEmpty($FriendlyName) -eq $false) - { - $Object.Value.FriendlyName = $FriendlyName - } - else - { - $Object.Value.FriendlyName = $tempObject.ProductId - } - - if ([String]::IsNullOrEmpty($SerialNumber) -eq $false) - { - $Object.Value.SerialNumber = $SerialNumber - } - else - { - $Object.Value.SerialNumber = $tempObject.SerialNumber - } - - if ([String]::IsNullOrEmpty($AdapterSerialNumber) -eq $false) - { - $Object.Value.AdapterSerialNumber = $AdapterSerialNumber - } - else - { - $Object.Value.AdapterSerialNumber = $tempObject.AdapterSerialNumber - } - - if ([String]::IsNullOrEmpty($FirmwareRevision) -eq $false) - { - $Object.Value.FirmwareRevision = $FirmwareRevision - } - else - { - $Object.Value.FirmwareRevision = $tempObject.FirmwareRevision - } - - $Object.Value.DeviceGuid = $DeviceGuid - $Object.Value.DeviceNumber = $Number - - if ([String]::IsNullOrEmpty($BusType) -eq $false) - { - $Object.Value.BusType = $BusType - } - else - { - switch ($tempObject.BusType) - { - "8" { $Object.Value.BusType = "RAID" } - "10" { $Object.Value.BusType = "SAS" } - "11" { $Object.Value.BusType = "SATA" } - "14" { $Object.Value.BusType = "Virtual" } - "17" { $Object.Value.BusType = "NVMe" } - "19" { $Object.Value.BusType = "UFS" } - default { $Object.Value.BusType = "Unknown" } - } - } - - $Object.Value.MediaType = $MediaType - $Object.Value.EventTime = $event.TimeCreated - $Object.Value.MaxQueueCount = [UInt32]$tempObject.MaxDeviceQueueCount - $Object.Value.MaxOutstandingCount = [UInt32]$tempObject.MaxOutstandingCount - - if ($Object.Value.Version -eq 5) - { - $Object.Value.PSObject.TypeNames.Insert( 1, "Microsoft.Windows.StorageManagement.StorageHistory_v5" ) - - $Object.Value.BucketCount = 5 - $Object.Value.BucketIoLatency = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount - $Object.Value.BucketSuccessIoCount = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount - $Object.Value.BucketFailedIoCount = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount - $Object.Value.BucketTotalIoCount = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount - $Object.Value.BucketTotalIoTime = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount - $Object.Value.BucketIoPercent = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount - - $Object.Value.BucketIoLatency[0] = 16 * 10000 # 16 ms in 100ns - $Object.Value.BucketIoLatency[1] = 64 * 10000 # 64 ms in 100ns - $Object.Value.BucketIoLatency[2] = 2048 * 10000 # 2048 ms in 100ns - $Object.Value.BucketIoLatency[3] = 5120 * 10000 # 5120 ms in 100ns - $Object.Value.BucketIoLatency[4] = 10000 * 10000 # 5120+ ms approx to 10000 ms in 100ns - - for ($index = 0; $index -lt $Object.Value.BucketCount; $index++) - { - $field = "BucketIoCount" + [System.String]($index + 1) - $Object.Value.BucketTotalIoCount[$index] = $($tempObject.$field) - $Object.Value.BucketTotalIoTime[$index] = $Object.Value.BucketTotalIoCount[$index] * $Object.Value.BucketIoLatency[$index] - - $Object.Value.TotalIoCount += $Object.Value.BucketTotalIoCount[$index] - $Object.Value.TotalIoLatency += $Object.Value.BucketTotalIoTime[$index] - - if ($Object.Value.BucketTotalIoCount[$index] -gt 0) - { - $Object.Value.MaxIoLatency = $Object.Value.BucketIoLatency[$index] - $Object.Value.HighestLatencyBucket = $index - } - } - - if ($Object.Value.TotalIoCount -gt 0) - { - for ($index = 0; $index -lt $Object.Value.BucketCount; $index++) - { - $Object.Value.BucketIoPercent[$index] = ($Object.Value.BucketTotalIoCount[$index] * 100) / $Object.Value.TotalIoCount - } - } - } - elseif (($Object.Value.Version -ge 9) -or ($Object.Value.Version -le 11)) - { - $Object.Value.PSObject.TypeNames.Insert( 1, "Microsoft.Windows.StorageManagement.StorageHistory_v11" ) - - $Object.Value.TotalIoCount = $tempObject.TotalIoCount - $Object.Value.TotalReadBytes = $tempObject.TotalReadBytes - $Object.Value.TotalWriteBytes = $tempObject.TotalWriteBytes - $Object.Value.MaxIoLatency = $tempObject.MaxReadWriteLatency_100ns - $Object.Value.MaxFlushLatency = $tempObject.MaxFlushLatency_100ns - $Object.Value.MaxUnmapLatency = $tempObject.MaxUnmapLatency_100ns - - if ($Object.Value.Version -eq 11) - { - $Object.Value.TotalQueueIoCount = $tempObject.TotalDeviceQueueIoCount - $Object.Value.TotalQueueIoWaitTime = $tempObject.TotalDeviceQueueIoWaitDuration_100ns - $Object.Value.MaxQueueIoWaitTime = $tempObject.MaxDeviceQueueIoWaitDuration_100ns - $Object.Value.IoTimeout = $tempObject.IoTimeout_s - $Object.Value.QueueIoWaitExceededTimeoutCount = $tempObject.DeviceQueueIoWaitExceededTimeoutCount - $Object.Value.QueueIoBusyCount = $tempObject.DeviceQueueIoBusyCount - $Object.Value.QueueIoPausedCount = $tempObject.DeviceQueueIoPausedCount - $Object.Value.QueueIoUntaggedCommandOutstandingCount = $tempObject.DeviceQueueIoUntaggedCommandOutstandingCount - $Object.Value.QueueIoPausedForUntaggedCount = $tempObject.DeviceQueueIoPausedForUntaggedCount - } - - $Object.Value.BucketCount = 12 - $Object.Value.BucketIoLatency = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount - $Object.Value.BucketSuccessIoCount = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount - $Object.Value.BucketFailedIoCount = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount - $Object.Value.BucketTotalIoCount = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount - $Object.Value.BucketTotalIoTime = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount - $Object.Value.BucketIoPercent = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount - - $Object.Value.BucketIoLatency[0] = 256 * 10 # 256 us in 100ns - $Object.Value.BucketIoLatency[1] = 1 * 10000 # 1 ms in 100ns - $Object.Value.BucketIoLatency[2] = 4 * 10000 # 4 ms in 100ns - $Object.Value.BucketIoLatency[3] = 16 * 10000 # 16 ms in 100ns - $Object.Value.BucketIoLatency[4] = 64 * 10000 # 64 ms in 100ns - $Object.Value.BucketIoLatency[5] = 128 * 10000 # 128 ms in 100ns - $Object.Value.BucketIoLatency[6] = 256 * 10000 # 256 ms in 100ns - $Object.Value.BucketIoLatency[7] = 2000 * 10000 # 2000 ms in 100ns - $Object.Value.BucketIoLatency[8] = 6000 * 10000 # 6000 ms in 100ns - $Object.Value.BucketIoLatency[9] = 10000 * 10000 # 10000 ms in 100ns - $Object.Value.BucketIoLatency[10] = 20000 * 10000 # 20000 ms in 100ns - $Object.Value.BucketIoLatency[11] = 30000 * 10000 # 20000+ ms approx to 30000 ms in 100ns - - for ($index = 0; $index -lt $Object.Value.BucketCount; $index++) - { - $field = "BucketIoSuccess" + [System.String]($index + 1) - $Object.Value.BucketSuccessIoCount[$index] = $($tempObject.$field) - - $field = "BucketIoFailed" + [System.String]($index + 1) - $Object.Value.BucketFailedIoCount[$index] = $($tempObject.$field) - - $field = "BucketIoLatency" + [System.String]($index + 1) + "_100ns" - $Object.Value.BucketTotalIoTime[$index] = $($tempObject.$field) - - $Object.Value.BucketTotalIoCount[$index] = $Object.Value.BucketSuccessIoCount[$index] + $Object.Value.BucketFailedIoCount[$index] - - $Object.Value.SuccessIoCount += $Object.Value.BucketSuccessIoCount[$index] - $Object.Value.FailedIoCount += $Object.Value.BucketFailedIoCount[$index] - $Object.Value.TotalIoLatency += $Object.Value.BucketTotalIoTime[$index] - - if ($Object.Value.TotalIoCount -gt 0) - { - $Object.Value.BucketIoPercent[$index] = ($Object.Value.BucketTotalIoCount[$index] * 100) / $Object.Value.TotalIoCount - } - - if ($Object.Value.BucketTotalIoCount[$index] -gt 0) - { - $Object.Value.HighestLatencyBucket = $index - } - } - } - - if ($Object.Value.TotalIoCount -gt 0) - { - $Object.Value.AvgIoLatency = $Object.Value.TotalIoLatency / $Object.Value.TotalIoCount - } - - if (($Object.Value.Version -eq 11) -and ($Object.Value.TotalQueueIoCount -gt 0)) - { - $Object.Value.AvgQueueIoWaitTime = $Object.Value.TotalQueueIoWaitTime / $Object.Value.TotalQueueIoCount - } -} - - -$AugmentStorageHistory = { - - Param - ( - [Ref] - $Object, - - [System.Diagnostics.Eventing.Reader.EventRecord] - $EventRecord - ) - - $eventXml = [XML]$EventRecord.ToXml() - $tempObject = [PsCustomObject]@{} - - for ($index = 0; $index -lt $eventXml.Event.EventData.Data.Count; $index++) - { - $tempObject | Add-Member -MemberType NoteProperty ` - -Name $eventXml.Event.EventData.Data[$index].Name ` - -Value $eventXml.Event.EventData.Data[$index].'#Text' - } - - if ($EventRecord.Id -eq 502) - { - if ($Object.Value.UnresponsiveTime -eq $null) - { - $Object.Value.UnresponsiveTime = New-Object System.Collections.ArrayList - } - - $Object.Value.UnresponsiveTime.Add($EventRecord.TimeCreated) - } - elseif ($EventRecord.Id -eq 503) - { - if ($Object.Value.ResponsiveTime -eq $null) - { - $Object.Value.ResponsiveTime = New-Object System.Collections.ArrayList - } - - $Object.Value.ResponsiveTime.Add($EventRecord.TimeCreated) - } - elseif ($EventRecord.Id -eq 504) - { - $Object.Value.TotalErrors = $tempObject.TotalErrors - $Object.Value.TotalReadWriteErrors = $tempObject.TotalReadWriteErrors - $Object.Value.TotalImpendingDeviceFailureErrors = $tempObject.TotalImpendingDeviceFailureErrors - $Object.Value.TotalDeviceFailureErrors = $tempObject.TotalDeviceFailureErrors - } -} - - -$PopulateStorageHistoryAggregate = { - - Param - ( - [Ref] - $AggregateObject, - - [Ref] - $Object - ) - - if ($AggregateObject.Value.Version -eq 0) - { - $AggregateObject.Value.PSObject.TypeNames.Insert( 0, "Microsoft.Windows.StorageManagement.StorageHistoryAggregate" ) - - if ($Object.Value.Version -eq 5) - { - $AggregateObject.Value.PSObject.TypeNames.Insert( 1, "Microsoft.Windows.StorageManagement.StorageHistoryAggregate_v5" ) - } - elseif (($Object.Value.Version -ge 9) -or ($Object.Value.Version -le 11)) - { - $AggregateObject.Value.PSObject.TypeNames.Insert( 1, "Microsoft.Windows.StorageManagement.StorageHistoryAggregate_v11" ) - } - - $AggregateObject.Value.Version = $Object.Value.Version - $AggregateObject.Value.FriendlyName = $Object.Value.FriendlyName - $AggregateObject.Value.SerialNumber = $Object.Value.SerialNumber - $AggregateObject.Value.AdapterSerialNumber = $Object.Value.AdapterSerialNumber - $AggregateObject.Value.FirmwareRevision = $Object.Value.FirmwareRevision - $AggregateObject.Value.DeviceGuid = $Object.Value.DeviceGuid - $AggregateObject.Value.DeviceNumber = $Object.Value.DeviceNumber - $AggregateObject.Value.BusType = $Object.Value.BusType - $AggregateObject.Value.MediaType = $Object.Value.MediaType - $AggregateObject.Value.StartTime = $Object.Value.EventTime - $AggregateObject.Value.EndTime = $Object.Value.EventTime - $AggregateObject.Value.EventCount = 1 - $AggregateObject.Value.MaxQueueCount = $Object.Value.MaxQueueCount - $AggregateObject.Value.MaxOutstandingCount = $Object.Value.MaxOutstandingCount - $AggregateObject.Value.TotalIoCount = $Object.Value.TotalIoCount - $AggregateObject.Value.SuccessIoCount = $Object.Value.SuccessIoCount - $AggregateObject.Value.FailedIoCount = $Object.Value.FailedIoCount - $AggregateObject.Value.TotalReadBytes = $Object.Value.TotalReadBytes - $AggregateObject.Value.TotalWriteBytes = $Object.Value.TotalWriteBytes - $AggregateObject.Value.TotalIoLatency = $Object.Value.TotalIoLatency - $AggregateObject.Value.MaxIoLatency = $Object.Value.MaxIoLatency - $AggregateObject.Value.MaxFlushLatency = $Object.Value.MaxFlushLatency - $AggregateObject.Value.MaxUnmapLatency = $Object.Value.MaxUnmapLatency - $AggregateObject.Value.TotalQueueIoCount = $Object.Value.TotalQueueIoCount - $AggregateObject.Value.TotalQueueIoWaitTime = $Object.Value.TotalQueueIoWaitTime - $AggregateObject.Value.MaxQueueIoWaitTime = $Object.Value.MaxQueueIoWaitTime - - if ($Object.Value.IoTimeout) - { - $AggregateObject.Value.IoTimeout = $Object.Value.IoTimeout - } - - $AggregateObject.Value.QueueIoWaitExceededTimeoutCount = $Object.Value.QueueIoWaitExceededTimeoutCount - $AggregateObject.Value.QueueIoBusyCount = $Object.Value.QueueIoBusyCount - $AggregateObject.Value.QueueIoPausedCount = $Object.Value.QueueIoPausedCount - $AggregateObject.Value.QueueIoUntaggedCommandOutstandingCount = $Object.Value.QueueIoUntaggedCommandOutstandingCount - $AggregateObject.Value.QueueIoPausedForUntaggedCount = $Object.Value.QueueIoPausedForUntaggedCount - $AggregateObject.Value.TotalErrors = $Object.Value.TotalErrors - $AggregateObject.Value.TotalReadWriteErrors = $Object.Value.TotalReadWriteErrors - $AggregateObject.Value.TotalImpendingDeviceFailureErrors = $Object.Value.TotalImpendingDeviceFailureErrors - $AggregateObject.Value.TotalDeviceFailureErrors = $Object.Value.TotalDeviceFailureErrors - $AggregateObject.Value.BucketCount = $Object.Value.BucketCount - - $AggregateObject.Value.BucketIoLatency = New-Object -TypeName System.UInt64[] $AggregateObject.Value.BucketCount - $AggregateObject.Value.BucketSuccessIoCount = New-Object -TypeName System.UInt64[] $AggregateObject.Value.BucketCount - $AggregateObject.Value.BucketFailedIoCount = New-Object -TypeName System.UInt64[] $AggregateObject.Value.BucketCount - $AggregateObject.Value.BucketTotalIoCount = New-Object -TypeName System.UInt64[] $AggregateObject.Value.BucketCount - $AggregateObject.Value.BucketTotalIoTime = New-Object -TypeName System.UInt64[] $AggregateObject.Value.BucketCount - $AggregateObject.Value.BucketIoPercent = New-Object -TypeName System.UInt64[] $AggregateObject.Value.BucketCount - $AggregateObject.Value.BucketHighestLatencyCount = New-Object -TypeName System.UInt32[] $AggregateObject.Value.BucketCount - - for ($index = 0; $index -lt $AggregateObject.Value.BucketCount; $index++) - { - $AggregateObject.Value.BucketIoLatency[$index] = $Object.Value.BucketIoLatency[$index] - $AggregateObject.Value.BucketSuccessIoCount[$index] = $Object.Value.BucketSuccessIoCount[$index] - $AggregateObject.Value.BucketFailedIoCount[$index] = $Object.Value.BucketFailedIoCount[$index] - $AggregateObject.Value.BucketTotalIoCount[$index] = $Object.Value.BucketTotalIoCount[$index] - $AggregateObject.Value.BucketTotalIoTime[$index] = $Object.Value.BucketTotalIoTime[$index] - } - - $AggregateObject.Value.BucketHighestLatencyCount[$($Object.Value.HighestLatencyBucket)]++ - - } - else - { - if ($Object.Value.Version -ne $AggregateObject.Value.Version) - { - return - } - - if ($Object.Value.EventTime -lt $AggregateObject.Value.StartTime) - { - $AggregateObject.Value.StartTime = $Object.Value.EventTime - } - - if ($Object.Value.EventTime -gt $AggregateObject.Value.EndTime) - { - $AggregateObject.Value.EndTime = $Object.Value.EventTime - } - - $AggregateObject.Value.EventCount++ - - if ($Object.Value.MaxQueueCount -gt $AggregateObject.Value.MaxQueueCount) - { - $AggregateObject.Value.MaxQueueCount = $Object.Value.MaxQueueCount - } - - if ($Object.Value.MaxOutstandingCount -gt $AggregateObject.Value.MaxOutstandingCount) - { - $AggregateObject.Value.MaxOutstandingCount = $Object.Value.MaxOutstandingCount - } - - $AggregateObject.Value.TotalIoCount += $Object.Value.TotalIoCount - $AggregateObject.Value.SuccessIoCount += $Object.Value.SuccessIoCount - $AggregateObject.Value.FailedIoCount += $Object.Value.FailedIoCount - $AggregateObject.Value.TotalReadBytes += $Object.Value.TotalReadBytes - $AggregateObject.Value.TotalWriteBytes += $Object.Value.TotalWriteBytes - $AggregateObject.Value.TotalIoLatency += $Object.Value.TotalIoLatency - - if ($Object.Value.MaxIoLatency -gt $AggregateObject.Value.MaxIoLatency) - { - $AggregateObject.Value.MaxIoLatency = $Object.Value.MaxIoLatency - } - - if ($Object.Value.MaxFlushLatency -gt $AggregateObject.Value.MaxFlushLatency) - { - $AggregateObject.Value.MaxFlushLatency = $Object.Value.MaxFlushLatency - } - - if ($Object.Value.MaxUnmapLatency -gt $AggregateObject.Value.MaxUnmapLatency) - { - $AggregateObject.Value.MaxUnmapLatency = $Object.Value.MaxUnmapLatency - } - - $AggregateObject.Value.TotalQueueIoCount += $Object.Value.TotalQueueIoCount - $AggregateObject.Value.TotalQueueIoWaitTime += $Object.Value.TotalQueueIoWaitTime - - if ($Object.Value.MaxQueueIoWaitTime -gt $AggregateObject.Value.MaxQueueIoWaitTime) - { - $AggregateObject.Value.MaxQueueIoWaitTime = $Object.Value.MaxQueueIoWaitTime - } - - if ($Object.Value.IoTimeout) - { - $AggregateObject.Value.IoTimeout = $Object.Value.IoTimeout - } - - $AggregateObject.Value.QueueIoWaitExceededTimeoutCount += $Object.Value.QueueIoWaitExceededTimeoutCount - $AggregateObject.Value.QueueIoBusyCount += $Object.Value.QueueIoBusyCount - $AggregateObject.Value.QueueIoPausedCount += $Object.Value.QueueIoPausedCount - $AggregateObject.Value.QueueIoUntaggedCommandOutstandingCount += $Object.Value.QueueIoUntaggedCommandOutstandingCount - $AggregateObject.Value.QueueIoPausedForUntaggedCount += $Object.Value.QueueIoPausedForUntaggedCount - $AggregateObject.Value.TotalErrors += $Object.Value.TotalErrors - $AggregateObject.Value.TotalReadWriteErrors += $Object.Value.TotalReadWriteErrors - $AggregateObject.Value.TotalImpendingDeviceFailureErrors += $Object.Value.TotalImpendingDeviceFailureErrors - $AggregateObject.Value.TotalDeviceFailureErrors += $Object.Value.TotalDeviceFailureErrors - - for ($index = 0; $index -lt $AggregateObject.Value.BucketCount; $index++) - { - $AggregateObject.Value.BucketSuccessIoCount[$index] += $Object.Value.BucketSuccessIoCount[$index] - $AggregateObject.Value.BucketFailedIoCount[$index] += $Object.Value.BucketFailedIoCount[$index] - $AggregateObject.Value.BucketTotalIoCount[$index] += $Object.Value.BucketTotalIoCount[$index] - $AggregateObject.Value.BucketTotalIoTime[$index] += $Object.Value.BucketTotalIoTime[$index] - } - - $AggregateObject.Value.BucketHighestLatencyCount[$($Object.Value.HighestLatencyBucket)]++ - } -} - - -function Get-StorageHistory -{ - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $PhysicalDisk, - - [System.String] - [Parameter( - ParameterSetName = 'ByDeviceGuid', - ValueFromPipeline = $false, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("DeviceId")] - $DeviceGuid, - - [System.String] - [Parameter( - ParameterSetName = 'ByDeviceNumber', - ValueFromPipeline = $false, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $DeviceNumber, - - #### ------------------------- PhysicalDisk parameters -----------------------#### - - [System.Management.Automation.PSCredential] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - Mandatory = $false)] - $Credential, - - #### ------------------------- Common method parameters ----------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDeviceGuid', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDeviceNumber', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $LogFile, - - [UInt32] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDeviceGuid', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDeviceNumber', - Mandatory = $false)] - $NumberOfHours, - - [Switch] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDeviceGuid', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDeviceNumber', - Mandatory = $false)] - $Disaggregate, - - [Switch] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDeviceGuid', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDeviceNumber', - Mandatory = $false)] - $Errors - ) - - Begin - { - } - - Process - { - # - # Get the device id based on the parameter set - # - - switch -regex ($psCmdlet.ParameterSetName) - { - { @( ` - "ByPhysicalDisk", ` - "ByDeviceNumber" ` - ) -contains $_ ` - } - { - # - # If device number is specified, - # get the corresponding device - # - - try - { - if ($DeviceNumber) - { - $PhysicalDisk = Get-PhysicalDisk -DeviceNumber $DeviceNumber - } - } - catch - { - $errorObject = CreateErrorRecord -ErrorId "ObjectNotFound" ` - -ErrorMessage "A physical disk matching the input criteria was not found" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - - # - # If log file is not specified, - # get the node name where the - # device is connected - # - - if (-not $LogFile) - { - $subsystem = $PhysicalDisk | get-storagesubsystem - - if ($subsystem.Model -eq "Clustered Windows Storage" -and - $subsystem.StorageConnectionType -eq "Local Storage") - { - # If the subsystem is clustered local (storage spaces direct) use - # SSU mapping since it works for 'Lost Communication' drives - - $storageScaleUnit = $PhysicalDisk | Get-StorageScaleUnit - - if (-not $storageScaleUnit) - { - $errorObject = CreateErrorRecord -ErrorId "ObjectNotFound" ` - -ErrorMessage "A storage scale unit was not found for the physical disk" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - - $computerName = $storageScaleUnit.FriendlyName - } - else - { - $storageNode = $PhysicalDisk | Get-StorageNode -PhysicallyConnected - - if (-not $storageNode) - { - $errorObject = CreateErrorRecord -ErrorId "ObjectNotFound" ` - -ErrorMessage "A storage node was not found for the physical disk" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - - $computerName = $storageNode.Name - } - } - - # Extract the device guid from the object id - # It is of the format ' <>:PD:" ' - $guid = $PhysicalDisk.ObjectId.Split(":")[2].TrimEnd('"') - - $friendlyName = $PhysicalDisk.FriendlyName - $serialNumber = $PhysicalDisk.SerialNumber - $adapterSerialNumber = $PhysicalDisk.AdapterSerialNumber - $firmwareRevision = $PhysicalDisk.FirmwareVersion - - if ($PhysicalDisk.DeviceId -ge 0) - { - $deviceNumber = $PhysicalDisk.DeviceId - } - - $busType = $PhysicalDisk.BusType - $mediaType = $PhysicalDisk.MediaType - } - - { @( ` - "ByDeviceGuid" ` - ) -contains $_ ` - } - { - try - { - [System.Guid]::Parse($DeviceGuid) | Out-Null - $guid = $DeviceGuid - } - catch - { - $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` - -ErrorMessage "DeviceGuid (or DeviceId) should be a GUID of the format 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' or '{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}'" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - } - } - - # - # Build the query to look for the specific events in storport log - # - - if ($PSBoundParameters.ContainsKey("Errors")) - { - $eventFilter = "EventID=549" - } - else - { - $eventFilter = "EventID=502 or ` - EventID=503 or ` - EventID=504 or ` - EventID=505" - } - - if ($NumberOfHours) - { - $query = "*[System[($eventFilter) and TimeCreated[timediff(@SystemTime) <= $($NumberOfHours*3600*1000)]]] and *[EventData[Data[@Name='ClassDeviceGuid'] and (Data='$guid')]]" - } - else - { - $query = "*[System[($eventFilter)]] and *[EventData[Data[@Name='ClassDeviceGuid'] and (Data='$guid')]]" - } - - # - # Retrive the events depending on the parameters - # - - Write-Progress -Activity "Get-StorageHistory" -PercentComplete 0 -CurrentOperation "Gathering events" -Status "0/2" - - try - { - if ($computerName) - { - if ($Credential) - { - $events = Get-WinEvent -LogName Microsoft-Windows-Storage-Storport/Operational ` - -FilterXPath $query ` - -ComputerName $computerName ` - -Credential $Credential ` - -ErrorAction Stop ` - -Oldest - } - else - { - $events = Get-WinEvent -LogName Microsoft-Windows-Storage-Storport/Operational ` - -FilterXPath $query ` - -ComputerName $computerName ` - -ErrorAction Stop ` - -Oldest - } - } - else - { - if ($LogFile) - { - $events = Get-WinEvent -Path $LogFile ` - -FilterXPath $query ` - -ErrorAction Stop ` - -Oldest - } - else - { - $events = Get-WinEvent -LogName Microsoft-Windows-Storage-Storport/Operational ` - -FilterXPath $query ` - -ErrorAction Stop ` - -Oldest - } - } - } - catch - { - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - - $psCmdlet.WriteError($errorObject) - return - } - - # - # Construct StorageHistory and StorageHistoryAggregate objects - # - - Write-Progress -Activity "Get-StorageHistory" -PercentComplete 0 -CurrentOperation "Constructing storage history objects" -Status "1/2" - - if ($PSBoundParameters.ContainsKey("Errors")) - { - for ($index = 0; $index -lt $events.count;) - { - $event = $events[$index] - $index++ - - [StorageError]$data = [StorageError]::new() - - &$PopulateStorageError -Object ([ref]$data) ` - -EventRecord $event ` - -FriendlyName $friendlyName ` - -SerialNumber $serialNumber ` - -AdapterSerialNumber $adapterSerialNumber ` - -FirmwareRevision $firmwareRevision ` - -DeviceGuid $guid ` - -Number $deviceNumber ` - -BusType $busType ` - -MediaType $mediaType | Out-Null - - $psCmdlet.WriteObject($data) - } - } - else - { - $firstEvent = $true - - for ($index = 0; $index -lt $events.count;) - { - $event = $events[$index] - $index++ - - # - # A StorageHistory object is created for every 505 event. - # Following non-505 events are collaped into it till - # the next 505 event is encountered. All non-505 events - # before the first 505 event are ignored - # - if ($event.Id -ne 505) - { - continue - } - - [StorageHistory]$data = [StorageHistory]::new() - - &$PopulateStorageHistory -Object ([ref]$data) ` - -EventRecord $event ` - -FriendlyName $friendlyName ` - -SerialNumber $serialNumber ` - -AdapterSerialNumber $adapterSerialNumber ` - -FirmwareRevision $firmwareRevision ` - -DeviceGuid $guid ` - -Number $deviceNumber ` - -BusType $busType ` - -MediaType $mediaType | Out-Null - - # - # If there are no IOs, skip - # - - if ($data.TotalIoCount -eq 0) - { - continue - } - - # - # Check if there are any non-505 events following it - # - - for (; $index -lt $events.count; $index++) - { - $event = $events[$index] - - if ($event.Id -eq 505) - { - break - } - - &$AugmentStorageHistory -Object ([ref]$data) ` - -EventRecord $event | Out-Null - } - - if ($PSBoundParameters.ContainsKey("Disaggregate")) - { - $psCmdlet.WriteObject($data) - } - else - { - if ($firstEvent) - { - [StorageHistoryAggregate]$aggregateData = [StorageHistoryAggregate]::new() - $firstEvent = $false - } - - &$PopulateStorageHistoryAggregate -AggregateObject ([ref]$aggregateData) ` - -Object ([ref]$data) | Out-Null - } - } - - if ($aggregateData) - { - $aggregateData.AvgIoLatency = $aggregateData.TotalIoLatency / $aggregateData.TotalIoCount - - if ($aggregateData.TotalQueueIoCount -gt 0) - { - $aggregateData.AvgQueueIoWaitTime = $aggregateData.TotalQueueIoWaitTime / $aggregateData.TotalQueueIoCount - } - - for ($index = 0; $index -lt $aggregateData.BucketCount; $index++) - { - $aggregateData.BucketIoPercent[$index] = ($aggregateData.BucketTotalIoCount[$index] * 100) / $aggregateData.TotalIoCount - } - - $psCmdlet.WriteObject($aggregateData) - } - } - - Write-Progress -Activity "Get-StorageHistory" -Completed -Status "2/2" - } -} - - -$DisplayTimeSeriesChart = { - - Param - ( - [System.String] - $ChartId, - - [System.String] - $Title, - - [System.Collections.ArrayList] - $StorageHistory, - - [System.Boolean] - $ShowDefault, - - [System.Boolean] - $ShowAvgLatency, - - [System.Boolean] - $ShowMaxLatency - ) - - # - # Build a device table with the - # data to chart. - # - - $deviceTable = New-Object System.Collections.Hashtable - - ForEach ($data in $StorageHistory) - { - if ($deviceTable.Contains($data.DeviceId) -eq $false) - { - $deviceData = New-Object -TypeName PsObject - $deviceData | Add-Member -NotePropertyName "DeviceNumber" -NotePropertyValue $data.DeviceNumber - $deviceData | Add-Member -NotePropertyName "FriendlyName" -NotePropertyValue $data.FriendlyName - $deviceData | Add-Member -NotePropertyName "SerialNumber" -NotePropertyValue $data.SerialNumber - - $dataList = New-Object System.Collections.ArrayList - $deviceData | Add-Member -NotePropertyName "DataList" -NotePropertyValue $dataList - - $deviceTable.Add($data.DeviceId, $deviceData) - } - else - { - $deviceData = $deviceTable[$data.DeviceId] - $dataList = $deviceData.DataList - } - - $dataPoint = New-Object -TypeName PsObject - $dataPoint | Add-Member -NotePropertyName "DateTime" -NotePropertyValue $data.EventTime - $dataPoint | Add-Member -NotePropertyName "AvgIoLatency" -NotePropertyValue ($data.AvgIoLatency/10) - $dataPoint | Add-Member -NotePropertyName "MaxIoLatency" -NotePropertyValue ($data.MaxIoLatency/10) - $dataPoint | Add-Member -NotePropertyName "MaxQueueDepth" -NotePropertyValue $data.MaxOutstandingCount - $dataPoint | Add-Member -NotePropertyName "UnresponsiveTime" -NotePropertyValue $data.UnresponsiveTime - $dataPoint | Add-Member -NotePropertyName "ResponsiveTime" -NotePropertyValue $data.ResponsiveTime - - [void]$dataList.Add($dataPoint) - } - - # - # Create a chart - # - - $chart = New-object Windows.Forms.DataVisualization.Charting.Chart - $chart.Anchor = [Windows.Forms.AnchorStyles]::Bottom -bor - [Windows.Forms.AnchorStyles]::Right -bor - [Windows.Forms.AnchorStyles]::Top -bor - [Windows.Forms.AnchorStyles]::Left - - $chart.Width = 1000 - $chart.Height = 800 - $chart.Left = 40 - $chart.Top = 30 - $chart.BackColor = [Drawing.Color]::White - [void]$chart.Titles.Add($Title) - $chart.Titles[0].Font = "segoeuilight,12pt" - - # - # Create a chart area to draw on - # - - $chartArea = New-Object Windows.Forms.DataVisualization.Charting.ChartArea - $chartarea.Name = "TimeSeries" - $chartarea.AxisX.IntervalType = [Windows.Forms.DataVisualization.Charting.DateTimeIntervalType]::Hours - $chartarea.AxisX.IntervalAutoMode = [Windows.Forms.DataVisualization.Charting.IntervalAutoMode]::VariableCount - $chartarea.AxisX.MajorGrid.Enabled = $false - $chartarea.AxisX.LabelStyle.Format = "yyyy/MM/dd h tt" - $chartarea.AxisX.ScaleView.Zoomable = $true - $chartarea.AxisX.ScrollBar.IsPositionedInside = $true - $chartarea.AxisX.ScrollBar.ButtonStyle = [Windows.Forms.DataVisualization.Charting.ScrollBarButtonStyles]::All - $chartarea.CursorX.IsUserEnabled = $true - $chartarea.CursorX.IsUserSelectionEnabled = $true - $chartarea.CursorX.IntervalType = [Windows.Forms.DataVisualization.Charting.DateTimeIntervalType]::Hours - $chartarea.CursorX.AutoScroll = $true - $chartArea.AxisY.Title = "Latency (us)" - $chartArea.AxisY.TitleFont = "segoeuilight,12pt" - $chartarea.AxisY.LabelStyle.Format = "N0" - $chartarea.AxisY.MinorGrid.Enabled = $true - $chartarea.AxisY.MinorGrid.LineDashStyle = [Windows.Forms.DataVisualization.Charting.ChartDashStyle]::Dot - - $chart.ChartAreas.Add($chartArea) - - $legend = New-Object Windows.Forms.DataVisualization.Charting.Legend - $legend.Name = "TimeSeries" - $legend.Docking = [Windows.Forms.DataVisualization.Charting.Docking]::Right - $legend.LegendStyle = [Windows.Forms.DataVisualization.Charting.LegendStyle]::Column - $chart.Legends.Add($legend) - - # - # Build the data to chart - # - - if ($ShowDefault -eq $true) - { - $ShowAvgLatency = $true - - if ($deviceTable.Count -eq 1) - { - $ShowMaxLatency = $true - } - else - { - $ShowMaxLatency = $false - } - } - - ForEach ($deviceId in $deviceTable.Keys) - { - $deviceData = $deviceTable[$deviceId] - $dataList = $deviceData.DataList - - if ($deviceTable.Count -eq 1) - { - [void]$chart.Titles.Add("Latency plot for " + - $deviceData.DeviceNumber + " : " + - $deviceData.FriendlyName + " : " + - $deviceData.SerialNumber) - } - - # - # Show max and avg latencies - # - - if ($ShowAvgLatency -eq $true) - { - if ($deviceTable.Count -eq 1) - { - $seriesName = "Avg" - } - else - { - $seriesName = "$($deviceData.DeviceNumber) : $($deviceData.SerialNumber) : Avg" - } - - [void]$chart.Series.Add($seriesName) - $chart.Series[$seriesName].ChartType = [Windows.Forms.DataVisualization.Charting.SeriesChartType]::Line - $chart.Series[$seriesName].XValueType = [Windows.Forms.DataVisualization.Charting.ChartValueType]::DateTime - $chart.Series[$seriesName].Legend = "TimeSeries" - $chart.Series[$seriesName].MarkerStyle = [Windows.Forms.DataVisualization.Charting.MarkerStyle]::Circle - - if ($deviceTable.Count -eq 1) - { - $chart.Series[$seriesName].Color = [Drawing.Color]::Green - } - - ForEach ($dataPoint in $dataList) - { - $point = New-Object Windows.Forms.DataVisualization.Charting.DataPoint - $point.SetValueXY($dataPoint.DateTime, $dataPoint.AvgIoLatency) - $point.Tooltip = "Value: #VALY{N0} us\n" + - "At: #VALX{yyyy/MM/dd h:mm tt}\n" + - "Max QD: $($dataPoint.MaxQueueDepth)" - - $chart.Series[$seriesName].Points.Add($point) - } - } - - if ($ShowMaxLatency -eq $true) - { - if ($deviceTable.Count -eq 1) - { - $seriesName = "Max" - } - else - { - $seriesName = "$($deviceData.DeviceNumber) : $($deviceData.SerialNumber) : Max" - } - - [void]$chart.Series.Add($seriesName) - $chart.Series[$seriesName].ChartType = [Windows.Forms.DataVisualization.Charting.SeriesChartType]::Line - $chart.Series[$seriesName].XValueType = [Windows.Forms.DataVisualization.Charting.ChartValueType]::DateTime - $chart.Series[$seriesName].Legend = "TimeSeries" - $chart.Series[$seriesName].MarkerStyle = [Windows.Forms.DataVisualization.Charting.MarkerStyle]::Circle - - if ($deviceTable.Count -eq 1) - { - $chart.Series[$seriesName].Color = [Drawing.Color]::Orange - } - - ForEach ($dataPoint in $dataList) - { - $point = New-Object Windows.Forms.DataVisualization.Charting.DataPoint - $point.SetValueXY($dataPoint.DateTime, $dataPoint.MaxIoLatency) - $point.Tooltip = "Value: #VALY{N0} us\n" + - "At: #VALX{yyyy/MM/dd h:mm tt}\n" + - "Max QD: $($dataPoint.MaxQueueDepth)" - - $chart.Series[$seriesName].Points.Add($point) - } - } - - # - # Show interesting events when there - # is a single device - # - - if ($deviceTable.Count -eq 1) - { - $seriesName = "Events" - - [void]$chart.Series.Add($seriesName) - $chart.Series[$seriesName].ChartType = [Windows.Forms.DataVisualization.Charting.SeriesChartType]::Point - $chart.Series[$seriesName].XValueType = [Windows.Forms.DataVisualization.Charting.ChartValueType]::DateTime - $chart.Series[$seriesName].Legend = "TimeSeries" - $chart.Series[$seriesName].MarkerStyle = [Windows.Forms.DataVisualization.Charting.MarkerStyle]::Square - $chart.Series[$seriesName].MarkerSize = 5 - $chart.Series[$seriesName].Color = [Drawing.Color]::Red - - # - # Find the level at which to show the points - # - - $value = 0 - - ForEach ($dataPoint in $dataList) - { - if ($ShowMaxLatency -eq $true) - { - if ($dataPoint.MaxIoLatency -gt $value) - { - $value = $dataPoint.MaxIoLatency - } - } - else - { - if ($dataPoint.AvgIoLatency -gt $value) - { - $value = $dataPoint.AvgIoLatency - } - } - } - - ForEach ($dataPoint in $dataList) - { - ForEach ($time in $dataPoint.UnresponsiveTime) - { - $point = New-Object Windows.Forms.DataVisualization.Charting.DataPoint - $point.SetValueXY($time, $value) - $point.Tooltip = "Marked unresponsive at #VALX{yyyy/MM/dd h:mm tt}\n" - - $chart.Series[$seriesName].Points.Add($point) - } - - ForEach ($time in $dataPoint.ResponsiveTime) - { - $point = New-Object Windows.Forms.DataVisualization.Charting.DataPoint - $point.SetValueXY($time, $value) - $point.Tooltip = "Marked responsive at #VALX{yyyy/MM/dd h:mm tt}\n" - - $chart.Series[$seriesName].Points.Add($point) - } - } - } - } - - $chart.ChartAreas[0].AxisX.LabelStyle.Angle = -45 - - # - # Display the chart on a form - # - - $form = New-Object Windows.Forms.Form - $form.Text = "Storage Performance Chart" - $form.Width = 1100 - $form.Height = 900 - $form.controls.add($chart) - $form.Add_Shown({$form.Activate()}) - - [void]$form.ShowDialog() - $form.Close() - $form.Dispose() - - [void]$StorageHistoryCharts.Host.Runspace.Events.GenerateEvent("StorageHistoryChart.Close", $null, $null, $ChartId) -} - - -$DisplaySummaryChart = { - - Param - ( - [System.String] - $ChartId, - - [System.String] - $Title, - - [System.Collections.ArrayList] - $StorageHistory, - - [System.Boolean] - $ShowDefault, - - [System.Boolean] - $ShowAvgLatency, - - [System.Boolean] - $ShowMaxLatency - ) - - # - # Create a chart - # - - $chart = New-object Windows.Forms.DataVisualization.Charting.Chart - $chart.Anchor = [Windows.Forms.AnchorStyles]::Bottom -bor - [Windows.Forms.AnchorStyles]::Right -bor - [Windows.Forms.AnchorStyles]::Top -bor - [Windows.Forms.AnchorStyles]::Left - - $chart.Width = 1000 - $chart.Height = 800 - $chart.Left = 40 - $chart.Top = 30 - $chart.BackColor = [Drawing.Color]::White - [void]$chart.Titles.Add($Title) - $chart.Titles[0].Font = "segoeuilight,12pt" - - if ($StorageHistory.Count -eq 1) - { - [void]$chart.Titles.Add("IO Distribution for " + - $StorageHistory[0].DeviceNumber + " : " + - $StorageHistory[0].FriendlyName + " : " + - $StorageHistory[0].SerialNumber) - } - else - { - [void]$chart.Titles.Add("Latency comparison") - } - - # - # Create a chart area to draw on - # - - $chartArea = New-Object Windows.Forms.DataVisualization.Charting.ChartArea - $chartarea.Name = "Summary" - $chartarea.AxisX.Interval = 1 - $chartarea.AxisX.IntervalAutoMode = [Windows.Forms.DataVisualization.Charting.IntervalAutoMode]::FixedCount - $chartarea.AxisX.MajorGrid.Enabled = $false - - # For a single device show IO distribution. - # For multiple devices show avg and max latency. - - if ($StorageHistory.Count -eq 1) - { - $chartArea.AxisX.Title = "Latency buckets (us)" - $chartArea.AxisX.TitleFont = "segoeuilight,12pt" - $chartArea.AxisY.Title = "IO Count" - } - else - { - $chartarea.AxisX.ScaleView.Size = [Math]::Min($StorageHistory.Count, 40) - $chartarea.AxisX.ScaleView.Zoomable = $true - $chartarea.AxisX.ScrollBar.IsPositionedInside = $true - $chartarea.AxisX.ScrollBar.ButtonStyle = [Windows.Forms.DataVisualization.Charting.ScrollBarButtonStyles]::All - $chartarea.CursorX.IsUserEnabled = $true - $chartarea.CursorX.IsUserSelectionEnabled = $true - $chartarea.CursorX.AutoScroll = $true - $chartArea.AxisY.Title = "Latency (us)" - } - - $chartArea.AxisY.TitleFont = "segoeuilight,12pt" - $chartarea.AxisY.LabelStyle.Format = "N0" - $chartarea.AxisY.MinorGrid.Enabled = $true - $chartarea.AxisY.MinorGrid.LineDashStyle = [Windows.Forms.DataVisualization.Charting.ChartDashStyle]::Dot - $chart.ChartAreas.Add($chartArea) - - $legend = New-Object Windows.Forms.DataVisualization.Charting.Legend - $legend.Name = "Summary" - $legend.Docking = [Windows.Forms.DataVisualization.Charting.Docking]::Right - $legend.LegendStyle = [Windows.Forms.DataVisualization.Charting.LegendStyle]::Column - $chart.Legends.Add($legend) - - # - # Build the data to chart - # - - if ($StorageHistory.Count -eq 1) - { - $data = $StorageHistory[0] - - $seriesName = "SuccessIoCount" - - [void]$chart.Series.Add($seriesName) - $chart.Series[$seriesName].ChartType = [Windows.Forms.DataVisualization.Charting.SeriesChartType]::StackedColumn - $chart.Series[$seriesName].XValueType = [Windows.Forms.DataVisualization.Charting.ChartValueType]::String - $chart.Series[$seriesName].Legend = "Summary" - $chart.Series[$seriesName].Color = [Drawing.Color]::Green - - for ($index = 0; $index -lt $data.BucketCount; $index++) - { - $point = New-Object Windows.Forms.DataVisualization.Charting.DataPoint - $point.SetValueXY([String]::Format('{0:N0}', $data.BucketIoLatency[$index] / 10), - $data.BucketSuccessIoCount[$index]) - $point.Tooltip = [String]::Format('Success: {0:N0}\nTotal: {1:N0}', - $data.BucketSuccessIoCount[$index], - $data.BucketTotalIoCount[$index]) - - $chart.Series[$seriesName].Points.Add($point) - } - - $seriesName = "FailedIoCount" - - [void]$chart.Series.Add($seriesName) - $chart.Series[$seriesName].ChartType = [Windows.Forms.DataVisualization.Charting.SeriesChartType]::StackedColumn - $chart.Series[$seriesName].XValueType = [Windows.Forms.DataVisualization.Charting.ChartValueType]::String - $chart.Series[$seriesName].Legend = "Summary" - $chart.Series[$seriesName].Color = [Drawing.Color]::Red - - for ($index = 0; $index -lt $data.BucketCount; $index++) - { - $point = New-Object Windows.Forms.DataVisualization.Charting.DataPoint - $point.SetValueXY([String]::Format('{0:N0}', $data.BucketIoLatency[$index] / 10), - $data.BucketFailedIoCount[$index]) - $point.Tooltip = [String]::Format('Failed: {0:N0}\nTotal: {1:N0}', - $data.BucketFailedIoCount[$index], - $data.BucketTotalIoCount[$index]) - - $chart.Series[$seriesName].Points.Add($point) - } - } - else - { - if ($ShowDefault -eq $true) - { - $ShowAvgLatency = $true - $ShowMaxLatency = $true - } - - if ($ShowAvgLatency -eq $true) - { - $seriesName = "Avg" - - [void]$chart.Series.Add($seriesName) - $chart.Series[$seriesName].ChartType = [Windows.Forms.DataVisualization.Charting.SeriesChartType]::Column - $chart.Series[$seriesName].XValueType = [Windows.Forms.DataVisualization.Charting.ChartValueType]::String - $chart.Series[$seriesName].Legend = "Summary" - $chart.Series[$seriesName].Color = [Drawing.Color]::Green - - ForEach ($data in $StorageHistory) - { - $point = New-Object Windows.Forms.DataVisualization.Charting.DataPoint - $point.SetValueXY($data.DeviceNumber + " : " + $data.SerialNumber, - $data.AvgIoLatency / 10) - $point.Tooltip = "Avg: #VALY{N0} us\n" + - [String]::Format('Total Io Count: {0:N0}\nSuccess Io Count: {1:N0}\nFailed Io Count: {2:N0}', - $data.TotalIoCount, $data.SuccessIoCount, $data.FailedIoCount) - - $chart.Series[$seriesName].Points.Add($point) - } - } - - if ($ShowMaxLatency -eq $true) - { - $seriesName = "Max" - - [void]$chart.Series.Add($seriesName) - $chart.Series[$seriesName].ChartType = [Windows.Forms.DataVisualization.Charting.SeriesChartType]::Column - $chart.Series[$seriesName].XValueType = [Windows.Forms.DataVisualization.Charting.ChartValueType]::String - $chart.Series[$seriesName].Legend = "Summary" - $chart.Series[$seriesName].Color = [Drawing.Color]::Orange - - ForEach ($data in $StorageHistory) - { - $point = New-Object Windows.Forms.DataVisualization.Charting.DataPoint - $point.SetValueXY($data.DeviceNumber + " : " + $data.SerialNumber, - $data.MaxIoLatency / 10) - $point.Tooltip = "Max: #VALY{N0} us\n" + - [String]::Format('Total Io Count: {0:N0}\nSuccess Io Count: {1:N0}\nFailed Io Count: {2:N0}', - $data.TotalIoCount, $data.SuccessIoCount, $data.FailedIoCount) - - $chart.Series[$seriesName].Points.Add($point) - } - } - - $chart.ChartAreas[0].AxisX.LabelStyle.Angle = -45 - } - - # - # Display the chart on a form - # - - $form = New-Object Windows.Forms.Form - $form.Text = "Storage Performance Chart" - $form.Width = 1100 - $form.Height = 900 - $form.controls.add($chart) - $form.Add_Shown({$form.Activate()}) - - [void]$form.ShowDialog() - $form.Close() - $form.Dispose() - - [void]$StorageHistoryCharts.Host.Runspace.Events.GenerateEvent("StorageHistoryChart.Close", $null, $null, $ChartId) -} - - -$StorageHistoryChartClose = { - - $chartId = $event.MessageData - $runspace = $Global:StorageHistoryCharts[$chartId] - - $runspace.Close() - $runspace.Dispose() - - $Global:StorageHistoryCharts.Remove($chartId) -} - - -function Show-StorageHistory -{ - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [System.Collections.ArrayList] - [Parameter( - ParameterSetName = 'ByObjects', - ValueFromPipeline = $false, - Mandatory = $true, - Position = 0)] - [ValidateNotNullOrEmpty()] - $Objects, - - #### ------------------------- Common method parameters ----------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'ByObjects', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $Title, - - [Switch] - [Parameter( - ParameterSetName = 'ByObjects', - Mandatory = $false)] - $DisplayAvgLatency, - - [Switch] - [Parameter( - ParameterSetName = 'ByObjects', - Mandatory = $false)] - $DisplayMaxLatency - ) - - Begin - { - } - - Process - { - if ($PSEdition -ne "Desktop") - { - # - # Full PowerShell is required for charting - # - $errorObject = CreateErrorRecord -ErrorId "NotSupported" ` - -ErrorMessage "This cmdlet requires full powershell support" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::NotEnabled) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - - # - # Global state initialization - # - - Add-Type -AssemblyName System.Windows.Forms - Add-Type -AssemblyName System.Windows.Forms.DataVisualization - - $Global:StorageHistoryCharts.Host = $Host - - $subscriber = Get-EventSubscriber -SourceIdentifier "StorageHistoryChart.Close" ` - -ErrorAction SilentlyContinue - - if ($subscriber -eq $null) - { - Register-EngineEvent -SourceIdentifier "StorageHistoryChart.Close" ` - -Action $StorageHistoryChartClose | Out-Null - } - - # - # Display chart based on the data passed - # - - $type = [String]::Empty - $storageHistory = New-Object System.Collections.ArrayList - - ForEach ($object in $Objects) - { - if ([String]::IsNullOrEmpty($type)) - { - $type = $object.PSObject.TypeNames[0] - } - - if ($object.PSObject.TypeNames[0] -eq $type) - { - [void]$storageHistory.Add($object) - } - } - - $chartId = [System.Guid]::newguid().ToString() - - $runspace = [RunspaceFactory]::CreateRunspace() - $runspace.ApartmentState = "STA" - $runspace.ThreadOptions = "ReuseThread" - $runspace.Open() - $runspace.SessionStateProxy.SetVariable("StorageHistoryCharts",$Global:StorageHistoryCharts) - - $Global:StorageHistoryCharts.Add($chartId, $runspace) - - $powershell = [PowerShell]::Create() - - $showDefault = $true - $showAvgLatency = $false - $showMaxLatency = $false - - if ($PSBoundParameters.ContainsKey("DisplayAvgLatency")) - { - $showDefault = $false - $showAvgLatency = $true - } - - if ($PSBoundParameters.ContainsKey("DisplayMaxLatency")) - { - $showDefault = $false - $showMaxLatency = $true - } - - if ($type -eq "Microsoft.Windows.StorageManagement.StorageHistory") - { - [void]$powershell.AddScript($DisplayTimeSeriesChart) - } - elseif ($type -eq "Microsoft.Windows.StorageManagement.StorageHistoryAggregate") - { - [void]$powershell.AddScript($DisplaySummaryChart) - } - else - { - return - } - - [void]$powershell.AddArgument($chartId) - [void]$powershell.AddArgument($Title) - [void]$powershell.AddArgument($storageHistory) - [void]$powershell.AddArgument($showDefault) - [void]$powershell.AddArgument($showAvgLatency) - [void]$powershell.AddArgument($showMaxLatency) - - $powershell.Runspace = $runspace - - [void]$powershell.BeginInvoke() - } -} - - -function Get-PhysicalDisk -{ - [CmdletBinding( DefaultParameterSetName = "ByUniqueId" )] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'ByUniqueId', - ValueFromPipeline = $true, - ValueFromPipelineByPropertyName = $true, - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - [Alias("Id")] - $UniqueId, - - [System.String] - [Parameter( - ParameterSetName = 'ByObjectId', - ValueFromPipeline = $true, - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - [Alias("PhysicalDiskObjectId")] - $ObjectId, - - [System.String] - [Parameter( - ParameterSetName = 'ByDeviceNumber', - ValueFromPipeline = $false, - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $DeviceNumber, - - [System.String] - [Parameter( - ParameterSetName = 'ByName', - ValueFromPipeline = $true, - Mandatory = $false, - Position = 0)] - [ValidateNotNullOrEmpty()] - $FriendlyName, - - [System.String] - [Parameter( - ParameterSetName = 'ByName', - ValueFromPipeline = $true, - Mandatory = $false, - Position = 1)] - [ValidateNotNullOrEmpty()] - $SerialNumber, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] - [Parameter( - ParameterSetName = 'ByInputObject', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $InputObject, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubsystem")] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageSubsystem, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageEnclosure")] - [Parameter( - ParameterSetName = 'ByStorageEnclosure', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageEnclosure, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageScaleUnit")] - [Parameter( - ParameterSetName = 'ByStorageScaleUnit', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageScaleUnit, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageChassis")] - [Parameter( - ParameterSetName = 'ByStorageChassis', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageChassis, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageRack")] - [Parameter( - ParameterSetName = 'ByStorageRack', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageRack, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSite")] - [Parameter( - ParameterSetName = 'ByStorageSite', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageSite, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageNode")] - [Parameter( - ParameterSetName = 'ByStorageNode', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageNode, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StoragePool")] - [Parameter( - ParameterSetName = 'ByStoragePool', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StoragePool, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_VirtualDisk")] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $VirtualDisk, - - #### ------------------ VirtualDisk association parameters -------------------#### - - [System.UInt64] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - Mandatory = $false)] - $VirtualRangeMin, - - [System.UInt64] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - Mandatory = $false)] - $VirtualRangeMax, - - [System.Boolean] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - Mandatory = $false)] - $HasAllocations, - - [System.Boolean] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - Mandatory = $false)] - $SelectedForUse, - - [Switch] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - Mandatory = $false)] - $NoRedundancy, - - #### --------- StoragePool and VirtualDisk association parameters ------------#### - - [Switch] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - Mandatory = $false)] - $HasMetadata, - - #### ------------------ StorageNode association parameters -------------------#### - - [Switch] - [Parameter( - ParameterSetName = 'ByStorageNode', - Mandatory = $false)] - $PhysicallyConnected, - - #### ------------------------- Common parameters -----------------------------#### - - [PhysicalDiskUsage] - [Parameter( - ParameterSetName = 'ByUniqueId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByObjectId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDeviceNumber', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageEnclosure', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageScaleUnit', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageChassis', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageRack', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSite', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageNode', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - Mandatory = $false)] - $Usage, - - [System.String] - [Parameter( - ParameterSetName = 'ByUniqueId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByObjectId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDeviceNumber', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageEnclosure', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageScaleUnit', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageChassis', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageRack', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSite', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageNode', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $Description, - - [System.String] - [Parameter( - ParameterSetName = 'ByUniqueId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByObjectId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDeviceNumber', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageEnclosure', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageScaleUnit', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageChassis', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageRack', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSite', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageNode', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $Manufacturer, - - [System.String] - [Parameter( - ParameterSetName = 'ByUniqueId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByObjectId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDeviceNumber', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageEnclosure', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageScaleUnit', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageChassis', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageRack', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSite', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageNode', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $Model, - - [System.Boolean] - [Parameter( - ParameterSetName = 'ByUniqueId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByObjectId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDeviceNumber', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageEnclosure', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageScaleUnit', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageChassis', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageRack', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSite', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageNode', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - Mandatory = $false)] - $CanPool, - - [PhysicalDiskHealthStatus] - [Parameter( - ParameterSetName = 'ByUniqueId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByObjectId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDeviceNumber', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageEnclosure', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageScaleUnit', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageChassis', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageRack', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSite', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageNode', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - Mandatory = $false)] - $HealthStatus, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession - ) - - Begin - { - [flagsattribute()] - Enum PhysicalDiskUsage - { - Unknown = 0 - AutoSelect = 1 - ManualSelect = 2 - HotSpare = 3 - Retired = 4 - Journal = 5 - } - - [flagsattribute()] - Enum PhysicalDiskHealthStatus - { - Healthy = 0 - Warning = 1 - Unhealthy = 2 - Unknown = 5 - } - } - - Process - { - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - ## Gather the instance objects. - - $options = New-Object Microsoft.Management.Infrastructure.Options.CimOperationOptions - - switch -regex ($psCmdlet.ParameterSetName) - { - { @( ` - "ByInputObject" ` - ) -contains $_ ` - } - { - $cimInstance = New-Object Microsoft.Management.Infrastructure.CimInstance("MSFT_PhysicalDisk") - - $cimInstance.CimInstanceProperties.Add([Microsoft.Management.Infrastructure.CimProperty]::Create("ObjectId", $InputObject.ObjectId, "String", "Key")) - - $instance = $CimSession.GetInstance($StorageNamespace, - $cimInstance); - break; - } - - { @( ` - "ByObjectId", ` - "ByUniqueId", ` - "ByDeviceNumber", ` - "ByName" ` - ) -contains $_ ` - } - { - $results = $CimSession.EnumerateInstances($StorageNamespace, - "MSFT_PhysicalDisk"); - break; - } - - { @( ` - "ByStorageSubsystem", ` - "ByStoragePool", ` - "ByStorageEnclosure", ` - "ByStorageNode", ` - "ByVirtualDisk" ` - ) -contains $_ ` - } - { - if ($PSBoundParameters.ContainsKey("StorageSubsystem")) - { - $subsystem = $StorageSubsystem - } - elseif ($PSBoundParameters.ContainsKey("StoragePool")) - { - $subsystem = $StoragePool | get-storagesubsystem -CimSession $CimSession - } - elseif ($PSBoundParameters.ContainsKey("StorageEnclosure")) - { - $subsystem = $StorageEnclosure | get-storagesubsystem -CimSession $CimSession - } - elseif ($PSBoundParameters.ContainsKey("StorageNode")) - { - $subsystem = $StorageNode | get-storagesubsystem -CimSession $CimSession - } - elseif ($PSBoundParameters.ContainsKey("VirtualDisk")) - { - $subsystem = $VirtualDisk | get-storagesubsystem -CimSession $CimSession - } - - # If the subsystem model is "Windows Storage", - # perform associations using enumeration - - if ($PSBoundParameters.ContainsKey("StorageSubsystem")) - { - $options.SetCustomOption("InputClassName", "MSFT_StorageSubsystem", $false) - $options.SetCustomOption("InputObjectId", $StorageSubsystem.ObjectId, $false) - - if ($subsystem.Model -like "*Windows Storage*") - { - $results = $CimSession.EnumerateInstances($StorageNamespace, - "MSFT_PhysicalDisk", - $options) - } - else - { - $results = $CimSession.EnumerateAssociatedInstances($StorageNamespace, - $StorageSubsystem, - "MSFT_StorageSubsystemToPhysicalDisk", - "MSFT_PhysicalDisk", - "StorageSubsystem", - "PhysicalDisk", - $options) - } - } - elseif ($PSBoundParameters.ContainsKey("StoragePool")) - { - $options.SetCustomOption("InputClassName", "MSFT_StoragePool", $false) - $options.SetCustomOption("InputObjectId", $StoragePool.ObjectId, $false) - - if ($PSBoundParameters.ContainsKey("HasMetadata")) - { - $options.SetCustomOption("HasMetadata", $HasMetadata, $false) - } - - if ($subsystem.Model -like "*Windows Storage*") - { - $results = $CimSession.EnumerateInstances($StorageNamespace, - "MSFT_PhysicalDisk", - $options) - } - else - { - $results = $CimSession.EnumerateAssociatedInstances($StorageNamespace, - $StoragePool, - "MSFT_StoragePoolToPhysicalDisk", - "MSFT_PhysicalDisk", - "StoragePool", - "PhysicalDisk", - $options) - } - } - elseif ($PSBoundParameters.ContainsKey("StorageEnclosure")) - { - $options.SetCustomOption("InputClassName", "MSFT_StorageEnclosure", $false) - $options.SetCustomOption("InputObjectId", $StorageEnclosure.ObjectId, $false) - - if ($subsystem.Model -like "*Windows Storage*") - { - $results = $CimSession.EnumerateInstances($StorageNamespace, - "MSFT_PhysicalDisk", - $options); - } - else - { - $results = $CimSession.EnumerateAssociatedInstances($StorageNamespace, - $StorageEnclosure, - "MSFT_StorageEnclosureToPhysicalDisk", - "MSFT_PhysicalDisk", - "StorageEnclosure", - "PhysicalDisk", - $options); - } - } - elseif ($PSBoundParameters.ContainsKey("StorageNode")) - { - $options.SetCustomOption("InputClassName", "MSFT_StorageNode", $false) - $options.SetCustomOption("InputObjectId", $StorageNode.ObjectId, $false) - - if ($PSBoundParameters.ContainsKey("PhysicallyConnected")) - { - $options.SetCustomOption("PhysicallyConnected", $true, $false) - } - - if ($subsystem.Model -like "*Windows Storage*") - { - $results = $CimSession.EnumerateInstances($StorageNamespace, - "MSFT_PhysicalDisk", - $options); - } - else - { - $results = $CimSession.EnumerateAssociatedInstances($StorageNamespace, - $StorageNode, - "MSFT_StorageNodeToPhysicalDisk", - "MSFT_PhysicalDisk", - "StorageNode", - "PhysicalDisk", - $options); - } - } - elseif ($PSBoundParameters.ContainsKey("VirtualDisk")) - { - $options.SetCustomOption("InputClassName", "MSFT_VirtualDisk", $false) - $options.SetCustomOption("InputObjectId", $VirtualDisk.ObjectId, $false) - - if ($PSBoundParameters.ContainsKey("VirtualRangeMin")) - { - $options.SetCustomOption("VirtualRangeMin", $VirtualRangeMin, [Microsoft.Management.Infrastructure.CimType]::UInt64, $false) - } - - if ($PSBoundParameters.ContainsKey("VirtualRangeMax")) - { - $options.SetCustomOption("VirtualRangeMax", $VirtualRangeMax, [Microsoft.Management.Infrastructure.CimType]::UInt64, $false) - } - - if ($PSBoundParameters.ContainsKey("HasAllocations")) - { - $options.SetCustomOption("HasAllocations", $HasAllocations, $false) - } - - if ($PSBoundParameters.ContainsKey("SelectedForUse")) - { - $options.SetCustomOption("SelectedForUse", $SelectedForUse, $false) - } - - if ($PSBoundParameters.ContainsKey("HasMetadata")) - { - $options.SetCustomOption("HasMetadata", $HasMetadata, $false) - } - - if ($PSBoundParameters.ContainsKey("NoRedundancy")) - { - $options.SetCustomOption("NoRedundancy", $true, $false) - } - - if ($subsystem.Model -like "*Windows Storage*") - { - $results = $CimSession.EnumerateInstances($StorageNamespace, - "MSFT_PhysicalDisk", - $options); - } - else - { - $results = $CimSession.EnumerateAssociatedInstances($StorageNamespace, - $VirtualDisk, - "MSFT_VirtualDiskToPhysicalDisk", - "MSFT_PhysicalDisk", - "VirtualDisk", - "PhysicalDisk", - $options); - } - } - - break; - } - { @( ` - "ByStorageScaleUnit", ` - "ByStorageChassis", ` - "ByStorageRack", ` - "ByStorageSite" ` - ) -contains $_ ` - } - { - if ($PSBoundParameters.ContainsKey("StorageScaleUnit")) - { - $inputObject = $StorageScaleUnit - } - elseif ($PSBoundParameters.ContainsKey("StorageChassis")) - { - $inputObject = $StorageChassis - } - elseif ($PSBoundParameters.ContainsKey("StorageRack")) - { - $inputObject = $StorageRack - } - elseif ($PSBoundParameters.ContainsKey("StorageSite")) - { - $inputObject = $StorageSite - } - - # If the subsystem model is "Windows Storage", - # perform associations using enumeration - - $subsystem = $inputObject | get-storagesubsystem -CimSession $CimSession - - if ($subsystem.Model -like "*Windows Storage*") - { - $options.SetCustomOption("InputClassName", $inputObject.ClassName, $false) - $options.SetCustomOption("InputObjectId", $inputObject.ObjectId, $false) - - $results = $CimSession.EnumerateInstances($StorageNamespace, - "MSFT_PhysicalDisk", - $options); - } - else - { - $options.SetCustomOption("ResultObject", "MSFT_PhysicalDisk", $false) - - $results = $CimSession.EnumerateAssociatedInstances($StorageNamespace, - $inputObject, - "MSFT_StorageFaultDomainToStorageFaultDomain", - "MSFT_PhysicalDisk", - "SourceStorageFaultDomain", - "TargetStorageFaultDomain", - $options); - } - - break; - } - } - - $instances = @() - - if ($psCmdlet.ParameterSetName -eq "ByInputObject") - { - $instances += $instance - } - else - { - $enumerator = $results.GetEnumerator() - - while ($enumerator.MoveNext()) - { - $instance = $enumerator.Current - - ## Filter by optional input parameters - - if (($PSBoundParameters.ContainsKey("ObjectId")) -and - ($instance.ObjectId -notlike $ObjectId)) - { - continue - } - - if (($PSBoundParameters.ContainsKey("UniqueId")) -and - ($instance.UniqueId -notlike $UniqueId)) - { - continue - } - - if (($PSBoundParameters.ContainsKey("DeviceNumber")) -and - ($instance.DeviceId -ne $DeviceNumber)) - { - continue - } - - if (($PSBoundParameters.ContainsKey("FriendlyName")) -and - ($instance.FriendlyName -notlike $FriendlyName)) - { - continue - } - - if (($PSBoundParameters.ContainsKey("SerialNumber")) -and - ($instance.SerialNumber -notlike $SerialNumber)) - { - continue - } - - if ($PSBoundParameters.ContainsKey("Usage")) - { - $matchFound = $true - - switch -regex ($Usage) - { - { @( ` - "Unknown", ` - "Retired", ` - "Journal" ` - ) -contains $_ ` - } - { - if ( $instance.Usage -ne $Usage ) - { - $matchFound = $false - break - } - } - - { @( ` - "AutoSelect" ` - ) -contains $_ ` - } - { - if ( $instance.Usage -ne "Auto-Select" ) - { - $matchFound = $false - break - } - } - - { @( ` - "ManualSelect" ` - ) -contains $_ ` - } - { - if ( $instance.Usage -ne "Manual-Select" ) - { - $matchFound = $false - break - } - } - - { @( ` - "HotSpare" ` - ) -contains $_ ` - } - { - if ( $instance.Usage -ne "Hot Spare" ) - { - $matchFound = $false - break - } - } - } - - if ( $matchFound -eq $false ) - { - continue - } - } - - if (($PSBoundParameters.ContainsKey("Description")) -and - ($instance.Description -notlike $Description)) - { - continue - } - - if (($PSBoundParameters.ContainsKey("Manufacturer")) -and - ($instance.Manufacturer -ne $Manufacturer)) - { - continue - } - - if (($PSBoundParameters.ContainsKey("Model")) -and - ($instance.Model -ne $Model)) - { - continue - } - - if (($PSBoundParameters.ContainsKey("CanPool")) -and - ($instance.CanPool -ne $CanPool)) - { - continue - } - - if (($PSBoundParameters.ContainsKey("HealthStatus")) -and - ($instance.HealthStatus -ne $HealthStatus)) - { - continue - } - - $instances += $instance - } - } - - $instances - } -} - - -function Get-PhysicalExtent -{ - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_VirtualDisk")] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $VirtualDisk, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageTier")] - [Parameter( - ParameterSetName = 'ByStorageTier', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageTier, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $PhysicalDisk, - - #### -------------------- Powershell parameters ------------------------------#### - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession - ) - - Process - { - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - ## Gather the instance objects - - switch ($psCmdlet.ParameterSetName) - { - "ByVirtualDisk" { $inputObject = $VirtualDisk; break; } - "ByStorageTier" { $inputObject = $StorageTier; break; } - "ByPhysicalDisk" { $inputObject = $PhysicalDisk; break; } - } - - $instances = @() - - try - { - $output = Invoke-CimMethod -CimSession $CimSession -InputObject $inputObject -MethodName "GetPhysicalExtent" -ErrorAction Stop - $enumerator = $output.PhysicalExtents.GetEnumerator() - - while ($enumerator.MoveNext()) - { - $instance = $enumerator.Current - $instance.PSObject.TypeNames.Insert(0, "Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalExtent") - - $instances += $instance - } - } - catch - { - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - - $psCmdlet.WriteError($errorObject) - } - - $instances - } -} - - -function Get-PhysicalExtentAssociation -{ - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalExtent")] - [Parameter( - ParameterSetName = 'ByInputObject', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $InputObject, - - #### -------------------- Powershell parameters ------------------------------#### - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession - ) - - Process - { - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - $virtualDisk = Get-VirtualDisk -CimSession $CimSession -UniqueId $InputObject.VirtualDiskUniqueId -ErrorAction Stop - - if ($InputObject.StorageTierUniqueId -ne $null) - { - $storageTier = Get-StorageTier -CimSession $CimSession -UniqueId $InputObject.StorageTierUniqueId -ErrorAction Stop - } - - $physicalDisk = Get-PhysicalDisk -CimSession $CimSession -UniqueId $InputObject.PhysicalDiskUniqueId -ErrorAction Stop - - $associations = [pscustomobject]@{ - VirtualDisk = $virtualDisk; - StorageTier = $storageTier; - PhysicalDisk = $physicalDisk; - } - - $associations - } -} - - -function Enable-PhysicalDiskIdentification -{ - [CmdletBinding( DefaultParameterSetName = "ByName", ConfirmImpact="Low" )] - [Alias("Enable-PhysicalDiskIndication")] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'ByUniqueId', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("Id")] - $UniqueId, - - [System.String] - [Parameter( - ParameterSetName = 'ByName', - ValueFromPipeline = $true, - Mandatory = $true, - Position = 0)] - [ValidateNotNullOrEmpty()] - $FriendlyName, - - [Microsoft.Management.Infrastructure.CimInstance[]] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] - [Parameter( - ParameterSetName = 'ByInputObject', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $InputObject, - - #### ------------------------- Common method parameters ----------------------#### - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - # Provided for compatibility with CDXML cmdlets, not actually used. - [Int32] - $ThrottleLimit, - - [Switch] - $AsJob - ) - - Begin - { - $SourceCaller = "Microsoft.PowerShell" - } - - Process - { - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - if (-not $AsJob) - { - Write-Progress -Activity "Enable-PhysicalDiskIdentification" -PercentComplete 0 -CurrentOperation "Gathering objects" -Status "0/2" - } - - ## Gather the instance objects - - switch ($psCmdlet.ParameterSetName) - { - "ByInputObject" { $Instances = $InputObject; break; } - "ByUniqueId" { $Instances = Get-PhysicalDisk -UniqueId $UniqueId -CimSession $CimSession -ErrorAction Stop; break; } - "ByName" { $Instances = Get-PhysicalDisk -FriendlyName $FriendlyName -CimSession $CimSession -ErrorAction Stop; break; } - } - - # Would use a closure here, but jobs are run in their own session state. - $methodblock = { - param($session, $asjob, $instances) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession - } - - $arguments = @{ "EnableIndication" = $true } - $errorObject = $null - - if (-not $asjob) - { - Write-Progress -Activity "Enable-PhysicalDiskIdentification" -PercentComplete 30 -CurrentOperation "Executing method" -Status "1/2" - } - - ForEach ( $instance in $instances ) - { - try - { - $progressPreference = "silentlyContinue" - - $output = Invoke-CimMethod -CimSession $session -InputObject $instance -MethodName Maintenance -Arguments $arguments -ErrorAction Stop - - $progressPreference = "Continue" - } - catch - { - $progressPreference = "Continue" - - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - - $psCmdlet.WriteError($errorObject) - } - } - - if (-not $asjob) - { - Write-Progress -Activity "Enable-PhysicalDiskIdentification" -Completed -Status "2/2" - } - } - - if ($asjob) - { - $p = $true - - Start-Job -Name EnablePhysicalDiskIdentification -ScriptBlock $methodblock -ArgumentList @($CimSession, $p, $Instances) - } - else - { - &$methodblock $CimSession $p $Instances - } - } -} - - -function Disable-PhysicalDiskIdentification -{ - [CmdletBinding( DefaultParameterSetName = "ByName", ConfirmImpact="Low" )] - [Alias("Disable-PhysicalDiskIndication")] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'ByUniqueId', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("Id")] - $UniqueId, - - [System.String] - [Parameter( - ParameterSetName = 'ByName', - ValueFromPipeline = $true, - Mandatory = $true, - Position = 0)] - [ValidateNotNullOrEmpty()] - $FriendlyName, - - [Microsoft.Management.Infrastructure.CimInstance[]] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] - [Parameter( - ParameterSetName = 'ByInputObject', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $InputObject, - - #### ------------------------- Common method parameters ----------------------#### - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - # Provided for compatibility with CDXML cmdlets, not actually used. - [Int32] - $ThrottleLimit, - - [Switch] - $AsJob - ) - - Begin - { - $SourceCaller = "Microsoft.PowerShell" - } - - Process - { - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - if (-not $AsJob) - { - Write-Progress -Activity "Disable-PhysicalDiskIdentification" -PercentComplete 0 -CurrentOperation "Gathering objects" -Status "0/2" - } - - ## Gather the instance objects - - switch ($psCmdlet.ParameterSetName) - { - "ByInputObject" { $Instances = $InputObject; break; } - "ByUniqueId" { $Instances = Get-PhysicalDisk -UniqueId $UniqueId -CimSession $CimSession -ErrorAction Stop; break; } - "ByName" { $Instances = Get-PhysicalDisk -FriendlyName $FriendlyName -CimSession $CimSession -ErrorAction Stop; break; } - } - - # Would use a closure here, but jobs are run in their own session state. - $methodblock = { - param($session, $asjob, $instances) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession - } - - $arguments = @{ "EnableIndication" = $false } - $errorObject = $null - - if (-not $asjob) - { - Write-Progress -Activity "Disable-PhysicalDiskIdentification" -PercentComplete 30 -CurrentOperation "Executing method" -Status "1/2" - } - - ForEach ( $instance in $instances ) - { - try - { - $progressPreference = "silentlyContinue" - - $output = Invoke-CimMethod -CimSession $session -InputObject $instance -MethodName Maintenance -Arguments $arguments -ErrorAction Stop - - $progressPreference = "Continue" - } - catch - { - $progressPreference = "Continue" - - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - - $psCmdlet.WriteError($errorObject) - } - } - - if (-not $asjob) - { - Write-Progress -Activity "Disable-PhysicalDiskIdentification" -Completed -Status "2/2" - } - } - - if ($asjob) - { - $p = $true - - Start-Job -Name DisablePhysicalDiskIdentification -ScriptBlock $methodblock -ArgumentList @($CimSession, $p, $Instances) - } - else - { - &$methodblock $CimSession $p $Instances - } - } -} - - -function Reset-PhysicalDisk -{ - [CmdletBinding( DefaultParameterSetName = "ByName", ConfirmImpact="Medium" )] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'ByUniqueId', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("Id")] - $UniqueId, - - [System.String] - [Parameter( - ParameterSetName = 'ByName', - ValueFromPipeline = $true, - Mandatory = $true, - Position = 0)] - [ValidateNotNullOrEmpty()] - $FriendlyName, - - [Microsoft.Management.Infrastructure.CimInstance[]] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] - [Parameter( - ParameterSetName = 'ByInputObject', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $InputObject, - - #### ------------------------- Common method parameters ----------------------#### - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - # Provided for compatibility with CDXML cmdlets, not actually used. - [Int32] - $ThrottleLimit, - - [Switch] - $AsJob - ) - - Begin - { - $SourceCaller = "Microsoft.PowerShell" - } - - Process - { - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - if (-not $AsJob) - { - Write-Progress -Activity "Reset-PhysicalDisk" -PercentComplete 0 -CurrentOperation "Gathering objects" -Status "0/2" - } - - ## Gather the instance objects - - switch ($psCmdlet.ParameterSetName) - { - "ByInputObject" { $Instances = $InputObject; break; } - "ByUniqueId" { $Instances = Get-PhysicalDisk -UniqueId $UniqueId -CimSession $CimSession -ErrorAction Stop; break; } - "ByName" { $Instances = Get-PhysicalDisk -FriendlyName $FriendlyName -CimSession $CimSession -ErrorAction Stop; break; } - } - - # Would use a closure here, but jobs are run in their own session state. - $methodblock = { - param($session, $asjob, $instances) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession - } - - $errorObject = $null - - if (-not $asjob) - { - Write-Progress -Activity "Reset-PhysicalDisk" -PercentComplete 30 -CurrentOperation "Executing method" -Status "1/2" - } - - ForEach ( $instance in $instances ) - { - try - { - $progressPreference = "silentlyContinue" - - $output = Invoke-CimMethod -CimSession $session -InputObject $instance -MethodName Reset -ErrorAction Stop - - $progressPreference = "Continue" - } - catch - { - $progressPreference = "Continue" - - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - - $psCmdlet.WriteError($errorObject) - } - } - - if (-not $asjob) - { - Write-Progress -Activity "Reset-PhysicalDisk" -Completed -Status "2/2" - } - } - - if ($asjob) - { - $p = $true - - Start-Job -Name ResetPhysicalDisk -ScriptBlock $methodblock -ArgumentList @($CimSession, $p, $Instances) - } - else - { - &$methodblock $CimSession $p $Instances - } - } -} - - -function Get-StorageFirmwareInformation -{ - [CmdletBinding( DefaultParameterSetName = "ByPhysicalDiskFriendlyName", ConfirmImpact="None" )] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'ByPhysicalDiskUniqueId', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("Id")] - [Alias("PhysicalDiskUniqueId")] - $UniqueId, - - [System.String] - [Parameter( - ParameterSetName = 'ByPhysicalDiskFriendlyName', - ValueFromPipeline = $true, - Mandatory = $true, - Position = 0)] - [ValidateNotNullOrEmpty()] - [Alias("PhysicalDiskFriendlyName")] - $FriendlyName, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("PhysicalDisk")] - $InputObject, - - [System.String] - [Parameter( - ParameterSetName = 'ByStorageEnclosureUniqueId', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageEnclosureUniqueId, - - [System.String] - [Parameter( - ParameterSetName = 'ByStorageEnclosureFriendlyName', - Mandatory = $true, - Position = 0)] - [ValidateNotNullOrEmpty()] - $StorageEnclosureFriendlyName, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageEnclosure")] - [Parameter( - ParameterSetName = 'ByStorageEnclosure', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageEnclosure, - - #### ------------------------- Common method parameters ----------------------#### - - #### -------------------- Powershell parameters ------------------------------#### - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - # Provided for compatibility with CDXML cmdlets, not actually used. - [Int32] - $ThrottleLimit, - - [Switch] - $AsJob - ) - - Begin - { - $SourceCaller = "Microsoft.PowerShell" - } - - Process - { - $info = $resources.info - $p = $null - - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - ## Gather the instance object - - switch ($psCmdlet.ParameterSetName) - { - "ByPhysicalDisk" { $PhysicalDiskInstance = $InputObject; break; } - "ByPhysicalDiskUniqueId" { $PhysicalDiskInstance = Get-PhysicalDisk -UniqueId $UniqueId -CimSession $CimSession -ErrorAction Stop; break; } - "ByPhysicalDiskFriendlyName" { $PhysicalDiskInstance = Get-PhysicalDisk -FriendlyName $FriendlyName -CimSession $CimSession -ErrorAction Stop; break; } - - "ByStorageEnclosure" { $StorageEnclosureInstance = $StorageEnclosure; break; } - "ByStorageEnclosureUniqueId" { $StorageEnclosureInstance = Get-StorageEnclosure -UniqueId $StorageEnclosureUniqueId -CimSession $CimSession -ErrorAction Stop; break; } - "ByStorageEnclosureFriendlyName" { $StorageEnclosureInstance = Get-StorageEnclosure -FriendlyName $StorageEnclosureFriendlyName -CimSession $CimSession -ErrorAction Stop; break; } - } - - if (-not $AsJob) - { - Write-Progress -Activity "Get-StorageFirmwareInformation" -PercentComplete 0 -CurrentOperation "Validating parameters" -Status "0/2" - } - - # Would use a closure here, but jobs are run in their own session state. - $methodblock = { - param($session, $asjob, $inputobject) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession - } - - $errorObject = $null - - if (-not $asjob) - { - Write-Progress -Activity "Get-StorageFirmwareInformation" -PercentComplete 30 -CurrentOperation "Getting storage firmware information" -Status "1/2" - } - - try - { - $progressPreference = "silentlyContinue" - - $output = Invoke-CimMethod -CimSession $session -InputObject $inputobject -MethodName GetFirmwareInformation -ErrorAction Stop - - $progressPreference = "Continue" - - $firmwareInformation = [pscustomobject]@{ - Object = $inputobject; - SupportsUpdate = $output.SupportsUpdate; - NumberOfSlots = $output.NumberOfSlots; - ActiveSlotNumber = $output.ActiveSlotNumber; - SlotNumber = $output.SlotNumber; - IsSlotWritable = $output.IsSlotWritable; - FirmwareVersionInSlot = $output.FirmwareVersionInSlot; - } - - $psCmdlet.WriteObject($firmwareInformation); - } - catch - { - $progressPreference = "Continue" - - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - - $psCmdlet.WriteError($errorObject) - } - - if (-not $asjob) - { - Write-Progress -Activity "Get-StorageFirmwareInformation" -Completed -Status "2/2" - } - } - - if ($asjob) - { - $p = $true - - if ($PhysicalDiskInstance) - { - Start-Job -Name GetStorageFirmwareInformation -ScriptBlock $methodblock -ArgumentList @($CimSession, $p, $PhysicalDiskInstance) - } - elseif ($StorageEnclosureInstance) - { - Start-Job -Name GetStorageFirmwareInformation -ScriptBlock $methodblock -ArgumentList @($CimSession, $p, $StorageEnclosureInstance) - } - } - else - { - if ($PhysicalDiskInstance) - { - &$methodblock $CimSession $p $PhysicalDiskInstance - } - elseif ($StorageEnclosureInstance) - { - &$methodblock $CimSession $p $StorageEnclosureInstance - } - } - } -} - - -function Update-StorageFirmware -{ - [CmdletBinding( DefaultParameterSetName = "ByPhysicalDiskFriendlyName", ConfirmImpact="Medium" )] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'ByPhysicalDiskUniqueId', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("Id")] - [Alias("PhysicalDiskUniqueId")] - $UniqueId, - - [System.String] - [Parameter( - ParameterSetName = 'ByPhysicalDiskFriendlyName', - ValueFromPipeline = $true, - Mandatory = $true, - Position = 0)] - [ValidateNotNullOrEmpty()] - [Alias("PhysicalDiskFriendlyName")] - $FriendlyName, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("PhysicalDisk")] - $InputObject, - - [System.String] - [Parameter( - ParameterSetName = 'ByStorageEnclosureUniqueId', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageEnclosureUniqueId, - - [System.String] - [Parameter( - ParameterSetName = 'ByStorageEnclosureFriendlyName', - Mandatory = $true, - Position = 0)] - [ValidateNotNullOrEmpty()] - $StorageEnclosureFriendlyName, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageEnclosure")] - [Parameter( - ParameterSetName = 'ByStorageEnclosure', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageEnclosure, - - #### ------------------------- Common method parameters ----------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'ByPhysicalDiskUniqueId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByPhysicalDiskFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageEnclosureUniqueId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageEnclosureFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageEnclosure', - Mandatory = $false)] - $ImagePath, - - [System.UInt16] - [Parameter( - ParameterSetName = 'ByPhysicalDiskUniqueId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByPhysicalDiskFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageEnclosureUniqueId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageEnclosureFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageEnclosure', - Mandatory = $false)] - $SlotNumber, - - #### -------------------- Powershell parameters ------------------------------#### - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - # Provided for compatibility with CDXML cmdlets, not actually used. - [Int32] - $ThrottleLimit, - - [Switch] - $AsJob - ) - - Begin - { - $SourceCaller = "Microsoft.PowerShell" - } - - Process - { - $info = $resources.info - $p = $null - - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - ## Gather the instance object - - switch ($psCmdlet.ParameterSetName) - { - "ByPhysicalDisk" { $PhysicalDiskInstance = $InputObject; break; } - "ByPhysicalDiskUniqueId" { $PhysicalDiskInstance = Get-PhysicalDisk -UniqueId $UniqueId -CimSession $CimSession -ErrorAction Stop; break; } - "ByPhysicalDiskFriendlyName" { $PhysicalDiskInstance = Get-PhysicalDisk -FriendlyName $FriendlyName -CimSession $CimSession -ErrorAction Stop; break; } - - "ByStorageEnclosure" { $StorageEnclosureInstance = $StorageEnclosure; break; } - "ByStorageEnclosureUniqueId" { $StorageEnclosureInstance = Get-StorageEnclosure -UniqueId $StorageEnclosureUniqueId -CimSession $CimSession -ErrorAction Stop; break; } - "ByStorageEnclosureFriendlyName" { $StorageEnclosureInstance = Get-StorageEnclosure -FriendlyName $StorageEnclosureFriendlyName -CimSession $CimSession -ErrorAction Stop; break; } - } - - if (-not $AsJob) - { - Write-Progress -Activity "Update-StorageFirmware" -PercentComplete 0 -CurrentOperation "Validating parameters" -Status "0/2" - } - - ## Populate arguments list - - $arguments = @{} - - if ($PSBoundParameters.ContainsKey("ImagePath")) - { - $arguments.Add("ImagePath", $ImagePath) - } - - if ($PSBoundParameters.ContainsKey("SlotNumber")) - { - $arguments.Add("SlotNumber", $SlotNumber) - } - - # Would use a closure here, but jobs are run in their own session state. - $methodblock = { - param($session, $asjob, $inputobject, $arguments) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession - } - - $errorObject = $null - - if (-not $asjob) - { - Write-Progress -Activity "Update-StorageFirmware" -PercentComplete 30 -CurrentOperation "Updating storage firmware" -Status "1/2" - } - - try - { - $progressPreference = "silentlyContinue" - - $output = Invoke-CimMethod -CimSession $session -InputObject $inputobject -MethodName UpdateFirmware -Arguments $arguments -ErrorAction Stop - - $progressPreference = "Continue" - } - catch - { - $progressPreference = "Continue" - - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - - $psCmdlet.WriteError($errorObject) - } - - if (-not $asjob) - { - Write-Progress -Activity "Update-StorageFirmware" -Completed -Status "2/2" - } - } - - if ($asjob) - { - $p = $true - - if ($PhysicalDiskInstance) - { - Start-Job -Name UpdateStorageFirmware -ScriptBlock $methodblock -ArgumentList @($CimSession, $p, $PhysicalDiskInstance, $arguments) - } - elseif ($StorageEnclosureInstance) - { - Start-Job -Name UpdateStorageFirmware -ScriptBlock $methodblock -ArgumentList @($CimSession, $p, $StorageEnclosureInstance, $arguments) - } - } - else - { - if ($PhysicalDiskInstance) - { - &$methodblock $CimSession $p $PhysicalDiskInstance $arguments - } - elseif ($StorageEnclosureInstance) - { - &$methodblock $CimSession $p $StorageEnclosureInstance $arguments - } - } - } -} - - -function Get-PhysicalDiskStorageNodeView -{ - [CmdletBinding()] - Param - ( - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageNode")] - [Parameter( - ValueFromPipeline = $true)] - $StorageNode, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] - [Parameter( - ValueFromPipeline = $true)] - $PhysicalDisk, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession - ) - - Process - { - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - ## Gather the association objects - $options = New-Object Microsoft.Management.Infrastructure.Options.CimOperationOptions - - if ($PSBoundParameters.ContainsKey("StorageNode")) - { - $options.SetCustomOption("InputClassName", "MSFT_StorageNode", $false) - $options.SetCustomOption("InputObjectId", $StorageNode.ObjectId, $false) - } - elseif ($PSBoundParameters.ContainsKey("PhysicalDisk")) - { - $options.SetCustomOption("InputClassName", "MSFT_PhysicalDisk", $false) - $options.SetCustomOption("InputObjectId", $PhysicalDisk.ObjectId, $false) - } - - $results = $CimSession.EnumerateInstances($StorageNamespace, - "MSFT_StorageNodeToPhysicalDisk", - $options - ) - - $enumerator = $results.GetEnumerator() - $instances = @() - - while ($enumerator.MoveNext()) - { - $instance = $enumerator.Current - - if ($PSBoundParameters.ContainsKey("StorageNode")) - { - if ($instance.StorageNodeObjectId -ne $StorageNode.ObjectId) - { - continue - } - } - elseif ($PSBoundParameters.ContainsKey("PhysicalDisk")) - { - if ($instance.PhysicalDiskObjectId -ne $PhysicalDisk.ObjectId) - { - continue - } - } - - $instances += $instance - } - - $instances - } -} - - -function Get-DiskStorageNodeView -{ - [CmdletBinding()] - Param - ( - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageNode")] - [Parameter( - ValueFromPipeline = $true)] - $StorageNode, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Disk")] - [Parameter( - ValueFromPipeline = $true)] - $Disk, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession - ) - - Process - { - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - ## Gather the association objects - $options = New-Object Microsoft.Management.Infrastructure.Options.CimOperationOptions - - if ($PSBoundParameters.ContainsKey("StorageNode")) - { - $options.SetCustomOption("InputClassName", "MSFT_StorageNode", $false) - $options.SetCustomOption("InputObjectId", $StorageNode.ObjectId, $false) - } - elseif ($PSBoundParameters.ContainsKey("Disk")) - { - $options.SetCustomOption("InputClassName", "MSFT_Disk", $false) - $options.SetCustomOption("InputObjectId", $Disk.ObjectId, $false) - } - - $results = $CimSession.EnumerateInstances($StorageNamespace, - "MSFT_StorageNodeToDisk", - $options - ) - - $enumerator = $results.GetEnumerator() - $instances = @() - - while ($enumerator.MoveNext()) - { - $instance = $enumerator.Current - - if ($PSBoundParameters.ContainsKey("StorageNode")) - { - if ($instance.StorageNodeObjectId -ne $StorageNode.ObjectId) - { - continue - } - } - elseif ($PSBoundParameters.ContainsKey("Disk")) - { - if ($instance.DiskObjectId -ne $Disk.ObjectId) - { - continue - } - } - - $instances += $instance - } - - $instances - } -} - - -function Get-StorageEnclosureStorageNodeView -{ - [CmdletBinding()] - Param - ( - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageNode")] - [Parameter( - ValueFromPipeline = $true)] - $StorageNode, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageEnclosure")] - [Parameter( - ValueFromPipeline = $true)] - $StorageEnclosure, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession - ) - - Process - { - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - ## Gather the association objects - $options = New-Object Microsoft.Management.Infrastructure.Options.CimOperationOptions - - if ($PSBoundParameters.ContainsKey("StorageNode")) - { - $options.SetCustomOption("InputClassName", "MSFT_StorageNode", $false) - $options.SetCustomOption("InputObjectId", $StorageNode.ObjectId, $false) - } - elseif ($PSBoundParameters.ContainsKey("StorageEnclosure")) - { - $options.SetCustomOption("InputClassName", "MSFT_StorageEnclosure", $false) - $options.SetCustomOption("InputObjectId", $StorageEnclosure.ObjectId, $false) - } - - $results = $CimSession.EnumerateInstances($StorageNamespace, - "MSFT_StorageNodeToStorageEnclosure", - $options - ) - - $enumerator = $results.GetEnumerator() - $instances = @() - - while ($enumerator.MoveNext()) - { - $instance = $enumerator.Current - - if ($PSBoundParameters.ContainsKey("StorageNode")) - { - if ($instance.StorageNodeObjectId -ne $StorageNode.ObjectId) - { - continue - } - } - elseif ($PSBoundParameters.ContainsKey("StorageEnclosure")) - { - if ($instance.StorageEnclosureObjectId -ne $StorageEnclosure.ObjectId) - { - continue - } - } - - $instances += $instance - } - - $instances - } -} - - -function Get-StorageHealthAction -{ - [CmdletBinding()] - Param - ( - [string[]] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "ByUniqueId")] - $UniqueId, - - [CimInstance] - [Parameter( - Mandatory = $false, - ValueFromPipeline = $true, - ParameterSetName = "InputObject")] - $InputObject, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - # Provided for compatibility with CDXML cmdlets, not actually used. - [Int32] - $ThrottleLimit, - - [Switch] - $AsJob - ) - - Begin{} - - Process - { - $info = $resources.info - $p = $null - $methodName = "GetActions" - - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - if ($UniqueId) - { - # Would use a closure here, but jobs are run in their own session state. - $block = { - param($session, $asjob, $ns, $id) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession - } - - Get-CimInstance -CimSession $session -Query "Select * From MSFT_HealthAction Where UniqueId='$id'" -Namespace $ns - - } - - if ($asjob) - { - $p = $true - Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $StorageNamespace, $UniqueId) - } - else - { - if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) - { - &$block $CimSession $p $StorageNamespace $UniqueId - } - } - } - elseif ($InputObject.CimClass.CimClassName -eq "MSFT_HealthAction") - { - # Would use a closure here, but jobs are run in their own session state. - $block = { - param($session, $asjob, $io) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession - } - - $io | Get-CimInstance -CimSession $session - - } - - if ($asjob) - { - $p = $true - Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $InputObject) - } - else - { - if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) - { - &$block $CimSession $p $InputObject - } - } - } - elseif (-not $InputObject -or ( $InputObject.CimClass.CimClassName -eq "MSFT_StorageHealth" )) - { - $className = "MSFT_HealthAction" - $block = { - param($session, $ns, $asjob, $cn) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession - } - - Get-CimInstance -CimSession $session -Namespace $ns -ClassName $cn - } - - if ($asjob) - { - $p = $true - Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $StorageNamespace, $p, $className) - } - else - { - if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) - { - &$block $CimSession $StorageNamespace $p $className - } - } - } - else - { - # Would use a closure here, but jobs are run in their own session state. - $block = { - param($session, $ns, $asjob, $mn, $io) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession - } - - $r = Invoke-CimMethod -CimSession $session -InputObject $io -MethodName $mn -Confirm:$false - - for($i = 0; $i -lt $r.Count - 1; $i++) - { - $r[$i].ItemValue - } - } - - if ($asjob) - { - $p = $true - Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $StorageNamespace, $p, $methodName, $InputObject) - } - else - { - if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) - { - &$block $CimSession $StorageNamespace $p $methodName $InputObject - } - } - } - } -} - - -function Get-StorageFaultDomain -{ - [CmdletBinding( DefaultParameterSetName = "EnumerateFaultDomains" )] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubsystem")] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageSubsystem, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageFaultDomain, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_VirtualDisk")] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $VirtualDisk, - - #### ------------------------- Common parameters -----------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'EnumerateFaultDomains', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - Mandatory = $false)] - $FriendlyName, - - [System.String] - [Parameter( - ParameterSetName = 'EnumerateFaultDomains', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - Mandatory = $false)] - $SerialNumber, - - [StorageFaultDomainType] - [Parameter( - ParameterSetName = 'EnumerateFaultDomains', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - Mandatory = $false)] - $Type, - - [System.String] - [Parameter( - ParameterSetName = 'EnumerateFaultDomains', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $PhysicalLocation, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession - ) - - Begin - { - [flagsattribute()] - Enum StorageFaultDomainType - { - PhysicalDisk = 1 - StorageEnclosure = 2 - StorageScaleUnit = 3 - StorageChassis = 4 - StorageRack = 5 - StorageSite = 6 - } - - $className = "MSFT_StorageFaultDomain" - - switch ($Type) - { - PhysicalDisk { $className = "MSFT_PhysicalDisk" } - StorageEnclosure { $className = "MSFT_StorageEnclosure" } - StorageScaleUnit { $className = "MSFT_StorageScaleUnit" } - StorageChassis { $className = "MSFT_StorageChassis" } - StorageRack { $className = "MSFT_StorageRack" } - StorageSite { $className = "MSFT_StorageSite" } - } - } - - Process - { - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - ## Gather the instance objects. - - $options = New-Object Microsoft.Management.Infrastructure.Options.CimOperationOptions - - if ($PSBoundParameters.ContainsKey("Type")) - { - $options.SetCustomOption("ResultObject", $className, $false) - } - - switch ($psCmdlet.ParameterSetName) - { - "ByStorageSubsystem" - { - if (($className -eq "MSFT_PhysicalDisk") -and - ($StorageSubsystem.Model -like "*Windows Storage*")) - { - $options.SetCustomOption("InputClassName", "MSFT_StorageSubsystem", $false) - $options.SetCustomOption("InputObjectId", $StorageSubsystem.ObjectId, $false) - - $results = $CimSession.EnumerateInstances($StorageNamespace, - "MSFT_PhysicalDisk", - $options) - } - else - { - $results = $CimSession.EnumerateAssociatedInstances($StorageNamespace, - $StorageSubsystem, - "MSFT_StorageSubsystemToStorageFaultDomain", - $className, - "StorageSubSystem", - "StorageFaultDomain", - $options) - } - - break; - } - - "ByStorageFaultDomain" - { - $subsystem = $StorageFaultDomain | get-storagesubsystem -CimSession $CimSession - - if (($className -eq "MSFT_PhysicalDisk") -and - ($subsystem.Model -like "*Windows Storage*")) - { - $options.SetCustomOption("InputClassName", $StorageFaultDomain.ClassName, $false) - $options.SetCustomOption("InputObjectId", $StorageFaultDomain.ObjectId, $false) - - $results = $CimSession.EnumerateInstances($StorageNamespace, - "MSFT_PhysicalDisk", - $options) - } - else - { - $results = $CimSession.EnumerateAssociatedInstances($StorageNamespace, - $StorageFaultDomain, - "MSFT_StorageFaultDomainToStorageFaultDomain", - $className, - "SourceStorageFaultDomain", - "TargetStorageFaultDomain", - $options) - } - - break; - } - - "ByVirtualDisk" - { - $results = $CimSession.EnumerateAssociatedInstances($StorageNamespace, - $VirtualDisk, - "MSFT_VirtualDiskToStorageFaultDomain", - "MSFT_StorageFaultDomain", - "VirtualDisk", - "StorageFaultDomain") - } - - "EnumerateFaultDomains" - { - $results = $CimSession.EnumerateInstances($StorageNamespace, - $className) - break; - } - } - - $enumerator = $results.GetEnumerator() - $instances = @() - - while ($enumerator.MoveNext()) - { - $instance = $enumerator.Current - - if (($PSBoundParameters.ContainsKey("FriendlyName")) -and - ($instance.FriendlyName -notlike $FriendlyName)) - { - continue - } - - if (($PSBoundParameters.ContainsKey("SerialNumber")) -and - ($instance.SerialNumber -notlike $SerialNumber)) - { - continue - } - - ## Filter by physical location if required and ensure - ## the formatting selected is for MSFT_StorageFaultDomain - - if (($PSBoundParameters.ContainsKey("PhysicalLocation")) -and - ($instance.PhysicalLocation -notlike $PhysicalLocation)) - { - continue - } - - $typename = $instance.PSObject.TypeNames.GetEnumerator() - $index = 0; - - while ($typename.MoveNext()) - { - if ($typename.Current.Equals("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageObject", - [System.StringComparison]::OrdinalIgnoreCase) -eq $true) - { - break - } - - $index++ - } - - $instance.PSObject.TypeNames.Insert($index + 1, "Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageFaultDomain") - $instances += $instance - } - - $instances - } -} - - -function Get-StorageScaleUnit -{ - [CmdletBinding( DefaultParameterSetName = "EnumerateFaultDomains" )] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubsystem")] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageSubsystem, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageFaultDomain, - - #### ------------------------- Common parameters -----------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'EnumerateFaultDomains', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - Mandatory = $false)] - $FriendlyName, - - [System.String] - [Parameter( - ParameterSetName = 'EnumerateFaultDomains', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - Mandatory = $false)] - $SerialNumber, - - [System.String] - [Parameter( - ParameterSetName = 'EnumerateFaultDomains', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $PhysicalLocation, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession - ) - - Begin - { - } - - Process - { - $arguments = @{} - - $arguments.Add("Type", 'StorageScaleUnit') - - if ($PSBoundParameters.ContainsKey("FriendlyName")) - { - $arguments.Add("FriendlyName", $FriendlyName) - } - - if ($PSBoundParameters.ContainsKey("SerialNumber")) - { - $arguments.Add("SerialNumber", $SerialNumber) - } - - if ($PSBoundParameters.ContainsKey("PhysicalLocation")) - { - $arguments.Add("PhysicalLocation", $PhysicalLocation) - } - - if ($PSBoundParameters.ContainsKey("StorageSubsystem")) - { - $arguments.Add("StorageSubsystem", $StorageSubsystem) - } - - if ($PSBoundParameters.ContainsKey("StorageFaultDomain")) - { - $arguments.Add("StorageFaultDomain", $StorageFaultDomain) - } - - if ($PSBoundParameters.ContainsKey("CimSession")) - { - $arguments.Add("CimSession", $CimSession) - } - - Get-StorageFaultDomain @arguments - } -} - - -function Get-StorageChassis -{ - [CmdletBinding( DefaultParameterSetName = "EnumerateFaultDomains" )] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubsystem")] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageSubsystem, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageFaultDomain, - - #### ------------------------- Common parameters -----------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'EnumerateFaultDomains', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - Mandatory = $false)] - $FriendlyName, - - [System.String] - [Parameter( - ParameterSetName = 'EnumerateFaultDomains', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - Mandatory = $false)] - $SerialNumber, - - [System.String] - [Parameter( - ParameterSetName = 'EnumerateFaultDomains', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $PhysicalLocation, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession - ) - - Begin - { - } - - Process - { - $arguments = @{} - - $arguments.Add("Type", 'StorageChassis') - - if ($PSBoundParameters.ContainsKey("FriendlyName")) - { - $arguments.Add("FriendlyName", $FriendlyName) - } - - if ($PSBoundParameters.ContainsKey("SerialNumber")) - { - $arguments.Add("SerialNumber", $SerialNumber) - } - - if ($PSBoundParameters.ContainsKey("PhysicalLocation")) - { - $arguments.Add("PhysicalLocation", $PhysicalLocation) - } - - if ($PSBoundParameters.ContainsKey("StorageSubsystem")) - { - $arguments.Add("StorageSubsystem", $StorageSubsystem) - } - - if ($PSBoundParameters.ContainsKey("StorageFaultDomain")) - { - $arguments.Add("StorageFaultDomain", $StorageFaultDomain) - } - - if ($PSBoundParameters.ContainsKey("CimSession")) - { - $arguments.Add("CimSession", $CimSession) - } - - Get-StorageFaultDomain @arguments - } -} - - -function Get-StorageRack -{ - [CmdletBinding( DefaultParameterSetName = "EnumerateFaultDomains" )] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubsystem")] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageSubsystem, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageFaultDomain, - - #### ------------------------- Common parameters -----------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'EnumerateFaultDomains', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - Mandatory = $false)] - $FriendlyName, - - [System.String] - [Parameter( - ParameterSetName = 'EnumerateFaultDomains', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - Mandatory = $false)] - $SerialNumber, - - [System.String] - [Parameter( - ParameterSetName = 'EnumerateFaultDomains', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $PhysicalLocation, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession - ) - - Begin - { - } - - Process - { - $arguments = @{} - - $arguments.Add("Type", 'StorageRack') - - if ($PSBoundParameters.ContainsKey("FriendlyName")) - { - $arguments.Add("FriendlyName", $FriendlyName) - } - - if ($PSBoundParameters.ContainsKey("SerialNumber")) - { - $arguments.Add("SerialNumber", $SerialNumber) - } - - if ($PSBoundParameters.ContainsKey("PhysicalLocation")) - { - $arguments.Add("PhysicalLocation", $PhysicalLocation) - } - - if ($PSBoundParameters.ContainsKey("StorageSubsystem")) - { - $arguments.Add("StorageSubsystem", $StorageSubsystem) - } - - if ($PSBoundParameters.ContainsKey("StorageFaultDomain")) - { - $arguments.Add("StorageFaultDomain", $StorageFaultDomain) - } - - if ($PSBoundParameters.ContainsKey("CimSession")) - { - $arguments.Add("CimSession", $CimSession) - } - - Get-StorageFaultDomain @arguments - } -} - - -function Get-StorageSite -{ - [CmdletBinding( DefaultParameterSetName = "EnumerateFaultDomains" )] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubsystem")] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageSubsystem, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageFaultDomain, - - #### ------------------------- Common parameters -----------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'EnumerateFaultDomains', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - Mandatory = $false)] - $FriendlyName, - - [System.String] - [Parameter( - ParameterSetName = 'EnumerateFaultDomains', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - Mandatory = $false)] - $SerialNumber, - - [System.String] - [Parameter( - ParameterSetName = 'EnumerateFaultDomains', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubsystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageFaultDomain', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $PhysicalLocation, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession - ) - - Begin - { - } - - Process - { - $arguments = @{} - - $arguments.Add("Type", 'StorageSite') - - if ($PSBoundParameters.ContainsKey("FriendlyName")) - { - $arguments.Add("FriendlyName", $FriendlyName) - } - - if ($PSBoundParameters.ContainsKey("SerialNumber")) - { - $arguments.Add("SerialNumber", $SerialNumber) - } - - if ($PSBoundParameters.ContainsKey("PhysicalLocation")) - { - $arguments.Add("PhysicalLocation", $PhysicalLocation) - } - - if ($PSBoundParameters.ContainsKey("StorageSubsystem")) - { - $arguments.Add("StorageSubsystem", $StorageSubsystem) - } - - if ($PSBoundParameters.ContainsKey("StorageFaultDomain")) - { - $arguments.Add("StorageFaultDomain", $StorageFaultDomain) - } - - if ($PSBoundParameters.ContainsKey("CimSession")) - { - $arguments.Add("CimSession", $CimSession) - } - - Get-StorageFaultDomain @arguments - } -} - - -function ValidateFaultDomainsExist -{ - Param - ( - [String[]] - $StorageFaultDomainFriendlyNames, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubsystem")] - $StorageSubsystem, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession - ) - - [Microsoft.Management.Infrastructure.CimInstance[]] $faultdomains = @() - - $subsystemFDs = Get-CimAssociatedInstance -InputObject $StorageSubsystem ` - -Association MSFT_StorageSubsystemToStorageFaultDomain ` - -ResultClassName MSFT_StorageFaultDomain ` - -CimSession $CimSession ` - -ErrorAction Stop - - for ($i = 0; $i -lt $StorageFaultDomainFriendlyNames.Count; $i++) - { - $found = $false - - foreach ($fd in $subsystemFDs) - { - if ($fd.FriendlyName -eq $StorageFaultDomainFriendlyNames[$i]) - { - $faultdomains += $fd - $found = $true - break - } - } - - if ($found -eq $false) - { - $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` - -ErrorMessage "Could not find storage fault domain with the friendly name '$($StorageFaultDomainFriendlyNames[$i])' in the storage subsystem" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - - $faultdomains = @() - break - } - } - - return $faultdomains -} - - -function Add-StorageFaultDomain -{ - [CmdletBinding()] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_VirtualDisk")] - [Parameter( - ParameterSetName = "ByVirtualDisk", - ValueFromPipeline = $true, - Mandatory = $true, - Position = 0)] - [ValidateNotNullOrEmpty()] - $VirtualDisk, - - [String] - [Parameter( - ParameterSetName = "ByVirtualDiskFriendlyName", - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $VirtualDiskFriendlyName, - - [String] - [Parameter( - ParameterSetName = "ByVirtualDiskName", - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $VirtualDiskName, - - [String] - [Parameter( - ParameterSetName = "ByVirtualDiskUniqueId", - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $VirtualDiskUniqueId, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageTier")] - [Parameter( - ParameterSetName = "ByStorageTier", - ValueFromPipeline = $true, - Mandatory = $true, - Position = 0)] - [ValidateNotNullOrEmpty()] - $StorageTier, - - [String] - [Parameter( - ParameterSetName = "ByStorageTierFriendlyName", - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageTierFriendlyName, - - [String] - [Parameter( - ParameterSetName = "ByStorageTierUniqueId", - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageTierUniqueId, - - #### -------------------- Common method parameters ---------------------------#### - - [Microsoft.Management.Infrastructure.CimInstance[]] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDiskFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDiskName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDiskUniqueId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageTier', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageTierFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageTierUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $StorageFaultDomains, - - [String[]] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDiskFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDiskName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDiskUniqueId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageTier', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageTierFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageTierUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $StorageFaultDomainFriendlyNames, - - #### -------------------- Powershell parameters ------------------------------#### - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - # Provided for compatibility with CDXML cmdlets, not actually used. - [Int32] - $ThrottleLimit, - - [Switch] - $AsJob - ) - - Begin - { - $SourceCaller = "Microsoft.PowerShell" - } - - Process - { - $info = $resources.info - $p = $null - - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - ## Gather the instance object - - switch ($psCmdlet.ParameterSetName) - { - "ByVirtualDisk" { $VirtualDiskInstance = $VirtualDisk; break; } - "ByVirtualDiskFriendlyName" { $VirtualDiskInstance = Get-VirtualDisk -FriendlyName $VirtualDiskFriendlyName -CimSession $CimSession -ErrorAction Stop; break; } - "ByVirtualDiskName" { $VirtualDiskInstance = Get-VirtualDisk -Name $VirtualDiskName -CimSession $CimSession -ErrorAction Stop; break; } - "ByVirtualDiskUniqueId" { $VirtualDiskInstance = Get-VirtualDisk -UniqueId $VirtualDiskUniqueId -CimSession $CimSession -ErrorAction Stop; break; } - - "ByStorageTier" { $StorageTierInstance = $StorageTier; break; } - "ByStorageTierFriendlyName" { $StorageTierInstance = Get-StorageTier -FriendlyName $StorageTierFriendlyName -CimSession $CimSession -ErrorAction Stop; break; } - "ByStorageTierUniqueId" { $StorageTierInstance = Get-StorageTier -UniqueId $StorageTierUniqueId -CimSession $CimSession -ErrorAction Stop; break; } - } - - if (-not $AsJob) - { - Write-Progress -Activity "Add-StorageFaultDomain" -PercentComplete 0 -CurrentOperation "Validating parameters" -Status "0/2" - } - - if ($VirtualDiskInstance) - { - $subsystem = $VirtualDiskInstance | get-storagesubsystem -CimSession $CimSession - } - elseif ($StorageTierInstance) - { - $subsystem = $StorageTierInstance | get-storagesubsystem -CimSession $CimSession - } - - ## Populate arguments list - - $arguments = @{} - - if ($PSBoundParameters.ContainsKey("StorageFaultDomains") -and - $PSBoundParameters.ContainsKey("StorageFaultDomainFriendlyNames")) - { - $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` - -ErrorMessage "Use either 'StorageFaultDomains' or 'StorageFaultDomainFriendlyNames' parameter" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - - if ($PSBoundParameters.ContainsKey("StorageFaultDomains")) - { - $arguments.Add("StorageFaultDomains", $StorageFaultDomains) - } - elseif ($PSBoundParameters.ContainsKey("StorageFaultDomainFriendlyNames")) - { - [Microsoft.Management.Infrastructure.CimInstance[]] $faultdomains = @() - - $faultdomains = ValidateFaultDomainsExist -StorageFaultDomainFriendlyNames $StorageFaultDomainFriendlyNames ` - -StorageSubsystem $subsystem ` - -CimSession $CimSession - - if ($faultdomains.Count -eq 0) - { - return - } - - $arguments.Add("StorageFaultDomains", $faultdomains) - } - - # Would use a closure here, but jobs are run in their own session state. - $addfdblock = { - param($session, $asjob, $inputobject, $arguments) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession - } - - $errorObject = $null - $output = $null - - try - { - if (-not $asjob) - { - Write-Progress -Activity "Add-StorageFaultDomain" -PercentComplete 10 -CurrentOperation "Adding storage fault domains" -Status "1/2" - } - - $progressPreference = "silentlyContinue" - - $output = Invoke-CimMethod -CimSession $session -InputObject $inputobject -MethodName AddStorageFaultDomain -Arguments $arguments -ErrorAction Stop - - $progressPreference = "Continue" - } - catch - { - $progressPreference = "Continue" - - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - } - finally - { - if (-not $asjob) - { - Write-Progress -Activity "Add-StorageFaultDomain" -Completed -Status "2/2" - } - } - - if ($errorObject) - { - $psCmdlet.WriteError($errorObject) - } - else - { - $null - } - } - - if ($asjob) - { - $p = $true - - if ($VirtualDiskInstance) - { - Start-Job -Name AddStorageFaultDomain -ScriptBlock $addfdblock -ArgumentList @($CimSession, $p, $VirtualDiskInstance, $arguments) - } - elseif ($StorageTierInstance) - { - Start-Job -Name AddStorageFaultDomain -ScriptBlock $addfdblock -ArgumentList @($CimSession, $p, $StorageTierInstance, $arguments) - } - } - else - { - if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) - { - if ($VirtualDiskInstance) - { - &$addfdblock $CimSession $p $VirtualDiskInstance $arguments - } - elseif ($StorageTierInstance) - { - &$addfdblock $CimSession $p $StorageTierInstance $arguments - } - } - } - } -} - - -function Remove-StorageFaultDomain -{ - [CmdletBinding()] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_VirtualDisk")] - [Parameter( - ParameterSetName = "ByVirtualDisk", - ValueFromPipeline = $true, - Mandatory = $true, - Position = 0)] - [ValidateNotNullOrEmpty()] - $VirtualDisk, - - [String] - [Parameter( - ParameterSetName = "ByVirtualDiskFriendlyName", - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $VirtualDiskFriendlyName, - - [String] - [Parameter( - ParameterSetName = "ByVirtualDiskName", - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $VirtualDiskName, - - [String] - [Parameter( - ParameterSetName = "ByVirtualDiskUniqueId", - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $VirtualDiskUniqueId, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageTier")] - [Parameter( - ParameterSetName = "ByStorageTier", - ValueFromPipeline = $true, - Mandatory = $true, - Position = 0)] - [ValidateNotNullOrEmpty()] - $StorageTier, - - [String] - [Parameter( - ParameterSetName = "ByStorageTierFriendlyName", - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageTierFriendlyName, - - [String] - [Parameter( - ParameterSetName = "ByStorageTierUniqueId", - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageTierUniqueId, - - #### -------------------- Common method parameters ---------------------------#### - - [Microsoft.Management.Infrastructure.CimInstance[]] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDiskFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDiskName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDiskUniqueId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageTier', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageTierFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageTierUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $StorageFaultDomains, - - [String[]] - [Parameter( - ParameterSetName = 'ByVirtualDisk', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDiskFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDiskName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByVirtualDiskUniqueId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageTier', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageTierFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageTierUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $StorageFaultDomainFriendlyNames, - - #### -------------------- Powershell parameters ------------------------------#### - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - # Provided for compatibility with CDXML cmdlets, not actually used. - [Int32] - $ThrottleLimit, - - [Switch] - $AsJob - ) - - Begin - { - $SourceCaller = "Microsoft.PowerShell" - } - - Process - { - $info = $resources.info - $p = $null - - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - ## Gather the instance object - - switch ($psCmdlet.ParameterSetName) - { - "ByVirtualDisk" { $VirtualDiskInstance = $VirtualDisk; break; } - "ByVirtualDiskFriendlyName" { $VirtualDiskInstance = Get-VirtualDisk -FriendlyName $VirtualDiskFriendlyName -CimSession $CimSession -ErrorAction Stop; break; } - "ByVirtualDiskName" { $VirtualDiskInstance = Get-VirtualDisk -Name $VirtualDiskName -CimSession $CimSession -ErrorAction Stop; break; } - "ByVirtualDiskUniqueId" { $VirtualDiskInstance = Get-VirtualDisk -UniqueId $VirtualDiskUniqueId -CimSession $CimSession -ErrorAction Stop; break; } - - "ByStorageTier" { $StorageTierInstance = $StorageTier; break; } - "ByStorageTierFriendlyName" { $StorageTierInstance = Get-StorageTier -FriendlyName $StorageTierFriendlyName -CimSession $CimSession -ErrorAction Stop; break; } - "ByStorageTierUniqueId" { $StorageTierInstance = Get-StorageTier -UniqueId $StorageTierUniqueId -CimSession $CimSession -ErrorAction Stop; break; } - } - - if (-not $AsJob) - { - Write-Progress -Activity "Remove-StorageFaultDomain" -PercentComplete 0 -CurrentOperation "Validating parameters" -Status "0/2" - } - - if ($VirtualDiskInstance) - { - $subsystem = $VirtualDiskInstance | get-storagesubsystem -CimSession $CimSession - } - elseif ($StorageTierInstance) - { - $subsystem = $StorageTierInstance | get-storagesubsystem -CimSession $CimSession - } - - ## Populate arguments list - - $arguments = @{} - - if ($PSBoundParameters.ContainsKey("StorageFaultDomains") -and - $PSBoundParameters.ContainsKey("StorageFaultDomainFriendlyNames")) - { - $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` - -ErrorMessage "Use either 'StorageFaultDomains' or 'StorageFaultDomainFriendlyNames' parameter" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - - if ($PSBoundParameters.ContainsKey("StorageFaultDomains")) - { - $arguments.Add("StorageFaultDomains", $StorageFaultDomains) - } - elseif ($PSBoundParameters.ContainsKey("StorageFaultDomainFriendlyNames")) - { - [Microsoft.Management.Infrastructure.CimInstance[]] $faultdomains = @() - - $faultdomains = ValidateFaultDomainsExist -StorageFaultDomainFriendlyNames $StorageFaultDomainFriendlyNames ` - -StorageSubsystem $subsystem ` - -CimSession $CimSession - - if ($faultdomains.Count -eq 0) - { - return - } - - $arguments.Add("StorageFaultDomains", $faultdomains) - } - - # Would use a closure here, but jobs are run in their own session state. - $removefdblock = { - param($session, $asjob, $inputobject, $arguments) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession - } - - $errorObject = $null - $output = $null - - try - { - if (-not $asjob) - { - Write-Progress -Activity "Remove-StorageFaultDomain" -PercentComplete 10 -CurrentOperation "Removing storage fault domains" -Status "1/2" - } - - $progressPreference = "silentlyContinue" - - $output = Invoke-CimMethod -CimSession $session -InputObject $inputobject -MethodName RemoveStorageFaultDomain -Arguments $arguments -ErrorAction Stop - - $progressPreference = "Continue" - } - catch - { - $progressPreference = "Continue" - - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - } - finally - { - if (-not $asjob) - { - Write-Progress -Activity "Remove-StorageFaultDomain" -Completed -Status "2/2" - } - } - - if ($errorObject) - { - $psCmdlet.WriteError($errorObject) - } - else - { - $null - } - } - - if ($asjob) - { - $p = $true - - if ($VirtualDiskInstance) - { - Start-Job -Name RemoveStorageFaultDomain -ScriptBlock $removefdblock -ArgumentList @($CimSession, $p, $VirtualDiskInstance, $arguments) - } - elseif ($StorageTierInstance) - { - Start-Job -Name RemoveStorageFaultDomain -ScriptBlock $removefdblock -ArgumentList @($CimSession, $p, $StorageTierInstance, $arguments) - } - } - else - { - if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) - { - if ($VirtualDiskInstance) - { - &$removefdblock $CimSession $p $VirtualDiskInstance $arguments - } - elseif ($StorageTierInstance) - { - &$removefdblock $CimSession $p $StorageTierInstance $arguments - } - } - } - } -} - - -function New-Volume -{ - [CmdletBinding( DefaultParameterSetName = "ByStoragePool" )] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StoragePool")] - [Parameter( - ParameterSetName = "ByStoragePool", - ValueFromPipeline = $true, - Mandatory = $false, - Position = 0)] - [ValidateNotNullOrEmpty()] - $StoragePool, - - [String] - [Parameter( - ParameterSetName = "ByStoragePoolFriendlyName", - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StoragePoolFriendlyName, - - [String] - [Parameter( - ParameterSetName = "ByStoragePoolName", - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StoragePoolName, - - [String] - [Parameter( - ParameterSetName = "ByStoragePoolUniqueId", - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StoragePoolUniqueId, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Disk")] - [Parameter( - ParameterSetName = "ByDisk", - ValueFromPipeline = $true, - Mandatory = $true, - Position = 0)] - [ValidateNotNullOrEmpty()] - $Disk, - - [UInt32] - [Parameter( - ParameterSetName = "ByDiskNumber", - Mandatory = $true, - Position = 0)] - [ValidateNotNullOrEmpty()] - $DiskNumber, - - [String] - [Parameter( - ParameterSetName = "ByDiskPath", - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $DiskPath, - - [String] - [Parameter( - ParameterSetName = "ByDiskUniqueId", - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $DiskUniqueId, - - #### -------------------- Common method parameters ---------------------------#### - - [String] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $true)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $true)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $true)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $true)] - [Parameter( - ParameterSetName = 'ByDisk', - Mandatory = $true)] - [Parameter( - ParameterSetName = 'ByDiskNumber', - Mandatory = $true)] - [Parameter( - ParameterSetName = 'ByDiskPath', - Mandatory = $true)] - [Parameter( - ParameterSetName = 'ByDiskUniqueId', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $FriendlyName, - - [FileSystemType] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDisk', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDiskNumber', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDiskPath', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDiskUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $FileSystem, - - [String] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDisk', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDiskNumber', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDiskPath', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDiskUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $AccessPath, - - [Char] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDisk', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDiskNumber', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDiskPath', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDiskUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $DriveLetter, - - [UInt32] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDisk', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDiskNumber', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDiskPath', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByDiskUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $AllocationUnitSize, - - #### -------------------- Storage pool parameters ----------------------------#### - - [UInt64] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $Size, - - [String] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $ResiliencySettingName, - - [ProvisioningType] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $ProvisioningType, - - [MediaType] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $MediaType, - - [UInt16] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - [Alias("FaultDomainRedundancy")] - $PhysicalDiskRedundancy, - - [UInt16] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $NumberOfDataCopies, - - [UInt16] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $NumberOfColumns, - - [UInt16] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $NumberOfGroups, - - [Microsoft.Management.Infrastructure.CimInstance[]] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $StorageFaultDomainsToUse, - - [String[]] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $StorageFaultDomainsToUseFriendlyNames, - - [Microsoft.Management.Infrastructure.CimInstance[]] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageTier")] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $StorageTiers, - - [String[]] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $StorageTierFriendlyNames, - - [UInt64[]] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $StorageTierSizes, - - [UInt64] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $WriteCacheSize, - - [UInt64] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $ReadCacheSize, - - [Switch] - [Parameter( - ParameterSetName = 'ByStoragePool', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStoragePoolUniqueId', - Mandatory = $false)] - $UseMaximumSize = $false, - - #### -------------------- Disk parameters ------------------------------------#### - - - #### -------------------- Powershell parameters ------------------------------#### - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - # Provided for compatibility with CDXML cmdlets, not actually used. - [Int32] - $ThrottleLimit, - - [Switch] - $AsJob - ) - - Begin - { - $SourceCaller = "Microsoft.PowerShell" - - [flagsattribute()] - Enum FileSystemType - { - NTFS = 14 - ReFS = 15 - CSVFS_NTFS = 32768 - CSVFS_ReFS = 32769 - } - - [flagsattribute()] - Enum ProvisioningType - { - Unknown = 0 - Thin = 1 - Fixed = 2 - } - - [flagsattribute()] - Enum MediaType - { - HDD = 3 - SSD = 4 - SCM = 5 - } - } - - Process - { - $info = $resources.info - $p = $null - - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - ## Gather the instance object - - switch ($psCmdlet.ParameterSetName) - { - "ByStoragePool" - { - if ($StoragePool -ne $null) - { - $PoolInstance = $StoragePool - } - else - { - # Also accept the existence of a single non-primordial pool as unambiguous - $PoolInstance = Get-StoragePool |? IsPrimordial -eq $false - if ($PoolInstance -eq $null -or $PoolInstance.Count -gt 1) - { - $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` - -ErrorMessage "Storage pool must be specified by one of the 'StoragePool' parameters" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - } - - break - } - "ByStoragePoolFriendlyName" { $PoolInstance = Get-StoragePool -FriendlyName $StoragePoolFriendlyName -CimSession $CimSession -ErrorAction Stop; break; } - "ByStoragePoolName" { $PoolInstance = Get-StoragePool -Name $StoragePoolName -CimSession $CimSession -ErrorAction Stop; break; } - "ByStoragePoolUniqueId" { $PoolInstance = Get-StoragePool -UniqueId $StoragePoolUniqueId -CimSession $CimSession -ErrorAction Stop; break; } - - "ByDisk" { $DiskInstance = $Disk; break; } - "ByDiskNumber" { $DiskInstance = Get-Disk -Number $DiskNumber -CimSession $CimSession -ErrorAction Stop; break; } - "ByDiskPath" { $DiskInstance = Get-Disk -Path $DiskPath -CimSession $CimSession -ErrorAction Stop; break; } - "ByDiskUniqueId" { $DiskInstance = Get-Disk -UniqueId $DiskUniqueId -CimSession $CimSession -ErrorAction Stop; break; } - } - - if (-not $AsJob) - { - if ($PoolInstance) - { - Write-Progress -Activity "New-Volume" -PercentComplete 0 -CurrentOperation "Validating parameters" -Status "0/3" - } - elseif ($DiskInstance) - { - Write-Progress -Activity "New-Volume" -PercentComplete 0 -CurrentOperation "Validating parameters" -Status "0/2" - } - } - - ## Populate arguments list - - $arguments = @{} - - if ($PSBoundParameters.ContainsKey("FriendlyName")) - { - $arguments.Add("FriendlyName", $FriendlyName) - } - - if ($PSBoundParameters.ContainsKey("FileSystem")) - { - $arguments.Add("FileSystem", [System.UInt16]$FileSystem) - } - - if ($PSBoundParameters.ContainsKey("AccessPath") -and - $PSBoundParameters.ContainsKey("DriveLetter")) - { - $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` - -ErrorMessage "Use either 'AccessPath' or 'DriveLetter' parameter" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - - if ($PSBoundParameters.ContainsKey("AccessPath")) - { - $arguments.Add("AccessPath", $AccessPath) - } - elseif ($PSBoundParameters.ContainsKey("DriveLetter")) - { - $arguments.Add("AccessPath", $DriveLetter + ":") - } - - if ($PSBoundParameters.ContainsKey("AllocationUnitSize")) - { - $arguments.Add("AllocationUnitSize", $AllocationUnitSize) - } - - if ($PoolInstance) - { - if ($PSBoundParameters.ContainsKey("Size")) - { - $arguments.Add("Size", $Size) - } - - if ($PSBoundParameters.ContainsKey("ResiliencySettingName")) - { - $arguments.Add("ResiliencySettingName", $ResiliencySettingName) - } - - if ($PSBoundParameters.ContainsKey("ProvisioningType")) - { - $arguments.Add("ProvisioningType", [System.UInt16]$ProvisioningType) - } - - if ($PSBoundParameters.ContainsKey("MediaType")) - { - $arguments.Add("MediaType", [System.UInt16]$MediaType) - } - - if ($PSBoundParameters.ContainsKey("PhysicalDiskRedundancy")) - { - $arguments.Add("PhysicalDiskRedundancy", $PhysicalDiskRedundancy) - } - - if ($PSBoundParameters.ContainsKey("NumberOfDataCopies")) - { - $arguments.Add("NumberOfDataCopies", $NumberOfDataCopies) - } - - if ($PSBoundParameters.ContainsKey("NumberOfColumns")) - { - $arguments.Add("NumberOfColumns", $NumberOfColumns) - } - - if ($PSBoundParameters.ContainsKey("NumberOfGroups")) - { - $arguments.Add("NumberOfGroups", $NumberOfGroups) - } - - if ($PSBoundParameters.ContainsKey("StorageFaultDomainsToUse") -and - $PSBoundParameters.ContainsKey("StorageFaultDomainsToUseFriendlyNames")) - { - $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` - -ErrorMessage "Use either 'StorageFaultDomainsToUse' or 'StorageFaultDomainsToUseFriendlyNames' parameter" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - - if ($PSBoundParameters.ContainsKey("StorageFaultDomainsToUse")) - { - $arguments.Add("StorageFaultDomainsToUse", $StorageFaultDomainsToUse) - } - elseif ($PSBoundParameters.ContainsKey("StorageFaultDomainsToUseFriendlyNames")) - { - [Microsoft.Management.Infrastructure.CimInstance[]] $faultdomains = @() - - $subsystem = $PoolInstance | get-storagesubsystem -CimSession $CimSession - - $faultdomains = ValidateFaultDomainsExist -StorageFaultDomainFriendlyNames $StorageFaultDomainsToUseFriendlyNames ` - -StorageSubsystem $subsystem ` - -CimSession $CimSession - - if ($faultdomains.Count -eq 0) - { - return - } - - $arguments.Add("StorageFaultDomainsToUse", $faultdomains) - } - - if ($PSBoundParameters.ContainsKey("StorageTiers") -and - $PSBoundParameters.ContainsKey("StorageTierFriendlyNames")) - { - $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` - -ErrorMessage "Use either 'StorageTiers' or 'StorageTierFriendlyNames' parameter" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - - if ($PSBoundParameters.ContainsKey("StorageTiers")) - { - $arguments.Add("StorageTiers", $StorageTiers) - } - elseif ($PSBoundParameters.ContainsKey("StorageTierFriendlyNames")) - { - [Microsoft.Management.Infrastructure.CimInstance[]] $tiers = @() - - $poolTiers = Get-CimAssociatedInstance -InputObject $PoolInstance ` - -Association MSFT_StoragePoolToStorageTier ` - -ResultClassName MSFT_StorageTier ` - -CimSession $CimSession ` - -ErrorAction Stop - - for ($i = 0; $i -lt $StorageTierFriendlyNames.Count; $i++) - { - $found = $false - - foreach ($tier in $poolTiers) - { - if ($tier.FriendlyName -eq $StorageTierFriendlyNames[$i]) - { - $tiers += $tier - $found = $true - break - } - } - - if ($found -eq $false) - { - $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` - -ErrorMessage "Could not find storage tier with the friendly name '$($StorageTierFriendlyNames[$i])' in the storage pool" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - } - - $arguments.Add("StorageTiers", $tiers) - } - - if ($PSBoundParameters.ContainsKey("StorageTierSizes")) - { - $arguments.Add("StorageTierSizes", $StorageTierSizes) - } - - if ($PSBoundParameters.ContainsKey("WriteCacheSize")) - { - $arguments.Add("WriteCacheSize", $WriteCacheSize) - } - - if ($PSBoundParameters.ContainsKey("ReadCacheSize")) - { - $arguments.Add("ReadCacheSize", $ReadCacheSize) - } - - if ($PSBoundParameters.ContainsKey("UseMaximumSize")) - { - $arguments.Add("UseMaximumSize", $UseMaximumSize.ToBool()) - } - } - - # Would use a closure here, but jobs are run in their own session state. - $poolblock = { - param($session, $asjob, $pool, $arguments) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession - } - - $errorObject = $null - $output = $null - $retry = 0 - $time = 1 - $virtualdisk = $null - $volume = $null - - $subsystem = $pool | get-storagesubsystem -CimSession $session - - # If the subsystem model is "Windows Storage", - # perform the individual steps - if ($subsystem.Model -like "*Windows Storage*") - { - $volCreateParams = @{} - - if ($arguments.ContainsKey("FriendlyName")) - { - $volCreateParams.Add("FriendlyName", $arguments["FriendlyName"]) - } - - if ($arguments.ContainsKey("FileSystem")) - { - $volCreateParams.Add("FileSystem", $arguments["FileSystem"]) - $arguments.Remove("FileSystem") - } - elseif ($subsystem.Model -eq "Clustered Windows Storage" -and - $subsystem.StorageConnectionType -eq "Local Storage" -and - $subsystem.SupportedFileSystems -contains [FilesystemType]::CSVFS_ReFS) - { - # If the subsystem is clustered local (storage spaces direct) and supports it, - # default to CSVFS + ReFS. - $volCreateParams.Add("FileSystem", [System.Uint16][FilesystemType]::CSVFS_ReFS) - } - - if ($arguments.ContainsKey("AccessPath")) - { - $volCreateParams.Add("AccessPath", $arguments["AccessPath"]) - $arguments.Remove("AccessPath") - } - - if ($arguments.ContainsKey("AllocationUnitSize")) - { - $volCreateParams.Add("AllocationUnitSize", $arguments["AllocationUnitSize"]) - $arguments.Remove("AllocationUnitSize") - } - - try - { - if (-not $asjob) - { - Write-Progress -Activity "New-Volume" -PercentComplete 10 -CurrentOperation "Creating virtual disk" -Status "1/3" - } - - $progressPreference = "silentlyContinue" - - $output = Invoke-CimMethod -CimSession $session -InputObject $pool -MethodName CreateVirtualDisk -Arguments $arguments -ErrorAction Stop - - $progressPreference = "Continue" - - $virtualdisk = $output.CreatedVirtualDisk - - do - { - $disk = $output.CreatedVirtualDisk | get-disk -CimSession $session - - if ($disk -or ($retry -ge 3)) - { - break - } - - Start-Sleep -Seconds $time - - $retry++ - $time = $time * 2 - } - while ($disk -eq $null) - - if ($disk -eq $null) - { - $errorObject = CreateErrorRecord -ErrorId "ObjectNotFound" ` - -ErrorMessage "The disk associated with the virtual disk created could not be found." ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - - if (-not $asjob) - { - Write-Progress -Activity "New-Volume" -PercentComplete 70 -CurrentOperation "Creating volume" -Status "2/3" - } - - $progressPreference = "silentlyContinue" - - $output = Invoke-CimMethod -CimSession $session -InputObject $disk -MethodName CreateVolume -Arguments $volCreateParams -ErrorAction Stop - - $progressPreference = "Continue" - - $volume = $output.CreatedVolume - } - catch - { - $progressPreference = "Continue" - - if (-not $asjob) - { - Write-Progress -Activity "New-Volume" -PercentComplete 90 -CurrentOperation "Error encountered. Checking if cleanup is required." -Status "2/3" - } - - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - - # If virtual disk was created and volume was formatted, but - # adding to cluster failed or the cluster resource did not - # come online after successful addition, do not revert. - - if (($virtualdisk) -and - ($_.FullyQualifiedErrorId -notmatch "46008") -and - ($_.FullyQualifiedErrorId -notmatch "46011")) - { - $progressPreference = "silentlyContinue" - - $virtualdisk | Remove-VirtualDisk -CimSession $session -Confirm:$false - - $progressPreference = "Continue" - } - } - finally - { - if (-not $asjob) - { - Write-Progress -Activity "New-Volume" -Completed -Status "3/3" - } - } - } - # Else fallback to the API on the storage pool - else - { - try - { - if (-not $asjob) - { - Write-Progress -Activity "New-Volume" -PercentComplete 10 -CurrentOperation "Creating volume" -Status "1/2" - } - - $progressPreference = "silentlyContinue" - - $output = Invoke-CimMethod -CimSession $session -InputObject $pool -MethodName CreateVolume -Arguments $arguments -ErrorAction Stop - - $progressPreference = "Continue" - - $volume = $output.CreatedVolume - } - catch - { - $progressPreference = "Continue" - - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - } - finally - { - if (-not $asjob) - { - Write-Progress -Activity "New-Volume" -Completed -Status "2/2" - } - } - } - - if ($errorObject) - { - $psCmdlet.WriteError($errorObject) - } - else - { - $volume - } - } - - # Would use a closure here, but jobs are run in their own session state. - $diskblock = { - param($session, $asjob, $disk, $arguments) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession - } - - $errorObject = $null - $output = $null - $volume = $null - - try - { - if (-not $asjob) - { - Write-Progress -Activity "New-Volume" -PercentComplete 10 -CurrentOperation "Creating volume" -Status "1/2" - } - - $progressPreference = "silentlyContinue" - - $output = Invoke-CimMethod -CimSession $session -InputObject $disk -MethodName CreateVolume -Arguments $arguments -ErrorAction Stop - - $progressPreference = "Continue" - - $volume = $output.CreatedVolume - } - catch - { - $progressPreference = "Continue" - - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - } - finally - { - if (-not $asjob) - { - Write-Progress -Activity "New-Volume" -Completed -Status "3/3" - } - } - - if ($errorObject) - { - $psCmdlet.WriteError($errorObject) - } - else - { - $volume - } - } - - if ($asjob) - { - $p = $true - - if ($PoolInstance) - { - Start-Job -Name CreateVolume -ScriptBlock $poolblock -ArgumentList @($CimSession, $p, $PoolInstance, $arguments) - } - elseif ($DiskInstance) - { - Start-Job -Name CreateVolume -ScriptBlock $diskblock -ArgumentList @($CimSession, $p, $DiskInstance, $arguments) - } - } - else - { - if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) - { - if ($PoolInstance) - { - &$poolblock $CimSession $p $PoolInstance $arguments - } - elseif ($DiskInstance) - { - &$diskblock $CimSession $p $DiskInstance $arguments - } - } - } - } -} - - -function Get-StorageExtendedStatus -{ - [CmdletBinding()] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageJob")] - [Parameter( - ParameterSetName = 'ByStorageJob', - Mandatory = $true, - ValueFromPipeline = $true)] - [ValidateNotNullOrEmpty()] - $StorageJob, - - #### -------------------- Powershell parameters ------------------------------#### - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession - ) - - Process - { - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - ## Gather the instance objects - - switch ($psCmdlet.ParameterSetName) - { - "ByStorageJob" { $inputObject = $StorageJob; break; } - } - - $extendedStatus = $null - - try - { - $output = Invoke-CimMethod -MethodName "GetExtendedStatus" -InputObject $inputObject -CimSession $CimSession -ErrorAction Stop - $extendedStatus = $output.ExtendedStatus - } - catch - { - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - - $psCmdlet.WriteError($errorObject) - } - - $extendedStatus - } -} - -function Get-StorageAdvancedProperty -{ - [CmdletBinding()] - Param - ( - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - Mandatory = $true, - ValueFromPipeline = $true)] - $PhysicalDisk - ) - - Process - { - if ( $PhysicalDisk ) { - - $isDeviceCacheEnabled = $null - $isPowerProtected = $null - - $deviceCacheOutput = Invoke-CimMethod -MethodName IsDeviceCacheEnabled -InputObject $PhysicalDisk -ErrorAction SilentlyContinue - $powerProtectedOutput = Invoke-CimMethod -MethodName IsPowerProtected -InputObject $PhysicalDisk -ErrorAction SilentlyContinue - - # DeviceCache error handling - if ( $deviceCacheOutput -and $deviceCacheOutput.ReturnValue -ne 0 ) { - - Write-Warning "Retrieving IsDeviceCacheEnabled failed with ErrorCode $( $deviceCacheOutput.ReturnValue )." - } - else { - $isDeviceCacheEnabled = $deviceCacheOutput.IsDeviceCacheEnabled - } - - # PowerProtected error handling - if ( $powerProtectedOutput -and $powerProtectedOutput.ReturnValue -ne 0 ) { - - Write-Warning "Retrieving IsPowerProtected failed with ErrorCode $( $powerProtectedOutput.ReturnValue )." - } - else { - $isPowerProtected = $powerProtectedOutput.IsPowerProtected - } - - $customDrive = [pscustomobject]@{ - PhysicalDisk = $PhysicalDisk; - IsPowerProtected = $isPowerProtected; - IsDeviceCacheEnabled = $isDeviceCacheEnabled; - } - - $customDrive.PSObject.TypeNames.Insert( 0, "Microsoft.Windows.StorageManagement.PhysicalDiskAdvancedProperties" ) - - $customDrive - } - } -} - -function Get-StorageHealthReport -{ - [CmdletBinding()] - Param - ( - [CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageObject")] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "InputObject")] - $InputObject, - - [Int32] - $Count = 1, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - # Provided for compatibility with CDXML cmdlets, not actually used. - [Int32] - $ThrottleLimit, - - [Switch] - $AsJob - ) - - Begin{ - Write-Warning "This cmdlet is deprecated and may not be available in the future. Use Get-ClusterPerformanceHistory instead." - } - - Process - { - $info = $resources.info - $p = $null - $methodName = "GetReport" - - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - if ($InputObject.CimClass.CimClassName -ne "MSFT_StoragesubSystem" -and - $InputObject.CimClass.CimClassName -ne "MSFT_StorageNode" -and - $InputObject.CimClass.CimClassName -ne "MSFT_Volume" -and - $InputObject.CimClass.CimClassName -ne "MSFT_FileShare") - { - $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` - -ErrorMessage "The input object must be a StorageSubSystem, StorageNode, Volume or FileShare" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - - if($InputObject.CimSystemProperties.ClassName.Equals("MSFT_FileShare")) - { - $InputObject = $InputObject | Get-Volume -CimSession $CimSession -ErrorAction Stop - } - - $storageSubSystem = $InputObject | Get-StorageSubSystem -CimSession $CimSession -ErrorAction Stop - - $StorageHealth = Get-CimAssociatedInstance -ResultClassName MSFT_StorageHealth -InputObject $storageSubSystem -CimSession $CimSession -ErrorAction Stop - - # Would use a closure here, but jobs are run in their own session state. - $block = { - param($session, $ns, $asjob, $mn, $sh, $io, $co) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession - } - - Invoke-CimMethod -CimSession $session -InputObject $sh -MethodName $mn -Arguments @{TargetObject=$io;Count=[uint32]$co} -Confirm:$false - } - - if ($asjob) - { - $p = $true - Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $StorageNamespace, $p, $methodName, $StorageHealth, $InputObject, $Count) - } - else - { - if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) - { - &$block $CimSession $StorageNamespace $p $methodName $StorageHealth $InputObject $Count - } - } - } -} - -function Get-StorageHealthSetting -{ - [CmdletBinding()] - Param - ( - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubSystem")] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "InputObject")] - $InputObject, - - [String] - $Name, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - # Provided for compatibility with CDXML cmdlets, not actually used. - [Int32] - $ThrottleLimit, - - [Switch] - $AsJob - ) - - Begin{} - - Process - { - $info = $resources.info - $p = $null - - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - $StorageHealth = $InputObject | Get-StorageHealth -CimSession $CimSession -ErrorAction Stop - - # Would use a closure here, but jobs are run in their own session state. - $block = { - param($session, $asjob, $sh, $na) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - # We need to load the module or it fails with CMDLET Not Found - import-module Storage\StorageHealth.cdxml - $session = $session | New-CimSession - } - - $sh | Get-StorageHealthSettingInternal -Name $na -CimSession $session - } - - if ($asjob) - { - $p = $true - Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $StorageHealth, $Name) - } - else - { - if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) - { - &$block $CimSession $p $StorageHealth $Name - } - } - } -} - -function Set-StorageHealthSetting -{ - [CmdletBinding()] - Param - ( - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubSystem")] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "InputObject")] - $InputObject, - - [String] - [Parameter( - Mandatory = $true)] - $Name, - - [String] - [Parameter( - Mandatory = $true)] - $Value, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - # Provided for compatibility with CDXML cmdlets, not actually used. - [Int32] - $ThrottleLimit, - - [Switch] - $AsJob - ) - - Begin{} - - Process - { - $info = $resources.info - $p = $null - - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - $StorageHealth = $InputObject | Get-StorageHealth -CimSession $CimSession -ErrorAction Stop - - # Would use a closure here, but jobs are run in their own session state. - $block = { - param($session, $asjob, $sh, $na, $va) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - # We need to load the module or it fails with CMDLET Not Found - import-module Storage\StorageHealth.cdxml - $session = $session | New-CimSession - } - - $sh | Set-StorageHealthSettingInternal -Name $na -Value $va -CimSession $session - } - - if ($asjob) - { - $p = $true - Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $StorageHealth, $Name, $Value) - } - else - { - if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) - { - &$block $CimSession $p $StorageHealth $Name $Value - } - } - } -} - -function Remove-StorageHealthSetting -{ - [CmdletBinding()] - Param - ( - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubSystem")] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "InputObject")] - $InputObject, - - [String] - [Parameter( - Mandatory = $true)] - $Name, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - # Provided for compatibility with CDXML cmdlets, not actually used. - [Int32] - $ThrottleLimit, - - [Switch] - $AsJob - ) - - Begin{} - - Process - { - $info = $resources.info - $p = $null - - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - $StorageHealth = $InputObject | Get-StorageHealth -CimSession $CimSession -ErrorAction Stop - - # Would use a closure here, but jobs are run in their own session state. - $block = { - param($session, $asjob, $sh, $na) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - import-module Storage\StorageHealth.cdxml - $session = $session | New-CimSession - } - - $sh | Remove-StorageHealthSettingInternal -Name $na -CimSession $session - } - - if ($asjob) - { - $p = $true - Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $StorageHealth, $Name) - } - else - { - if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) - { - &$block $CimSession $p $StorageHealth $Name - } - } - } -} - -function Debug-StorageSubSystem -{ - [CmdletBinding( DefaultParameterSetName="ByFriendlyName" )] - Param - ( - [string[]] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "ByFriendlyName", - Position = 0)] - $StorageSubSystemFriendlyName, - - [string[]] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "ByUniqueId")] - $StorageSubSystemUniqueId, - - [string[]] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "ByName")] - $StorageSubSystemName, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubSystem")] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "InputObject")] - $InputObject, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - # Provided for compatibility with CDXML cmdlets, not actually used. - [Int32] - $ThrottleLimit, - - [Switch] - $AsJob - ) - - Begin{ - Write-Warning "This cmdlet is deprecated and may not be available in the future. Use Get-HealthFault instead." - } - - Process - { - $info = $resources.info - $p = $null - - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - switch ($PsCmdlet.ParameterSetName) - { - "ByName" { $InputObject = Get-StorageSubSystem -Name $StorageSubSystemName -CimSession $CimSession; break; } - "ByUniqueId" { $InputObject = Get-StorageSubSystem -UniqueId $StorageSubSystemUniqueId -CimSession $CimSession; break; } - "ByFriendlyName" { $InputObject = Get-StorageSubSystem -FriendlyName $StorageSubSystemFriendlyName -CimSession $CimSession; break; } - } - - # Would use a closure here, but jobs are run in their own session state. - $block = { - param($session, $asjob, $io) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession - } - - $result = @() - $output = Invoke-CimMethod -MethodName Diagnose -InputObject $io -CimSession $session - foreach($i in $output){$result += $i.ItemValue} - $result | Sort-Object -Property PerceivedSeverity - } - - if ($asjob) - { - $p = $true - Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $InputObject) - } - else - { - if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) - { - &$block $CimSession $p $InputObject - } - } - } -} - -function Debug-FileShare -{ - [CmdletBinding( DefaultParameterSetName="ByName" )] - Param - ( - [string[]] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "ByName", - Position = 0 )] - $Name, - - [string[]] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "ByUniqueId")] - $UniqueId, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_FileShare")] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "InputObject")] - $InputObject, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - # Provided for compatibility with CDXML cmdlets, not actually used. - [Int32] - $ThrottleLimit, - - [Switch] - $AsJob - ) - - Begin{ - Write-Warning "This cmdlet is deprecated and may not be available in the future. Use Get-HealthFault instead." - } - - Process - { - $info = $resources.info - $p = $null - - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - switch ($PsCmdlet.ParameterSetName) - { - "ByName" { $InputObject = Get-FileShare -Name $Name -CimSession $CimSession -ErrorAction stop; break; } - "ByUniqueId" { $InputObject = Get-FileShare -UniqueId $UniqueId -CimSession $CimSession -ErrorAction stop; break; } - } - - # Would use a closure here, but jobs are run in their own session state. - $block = { - param($session, $asjob, $io) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession - } - - $result = @() - $output = Invoke-CimMethod -MethodName Diagnose -InputObject $io -CimSession $session - foreach($i in $output){$result += $i.ItemValue} - $result | Sort-Object -Property PerceivedSeverity - } - - if ($asjob) - { - $p = $true - Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $InputObject) - } - else - { - if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) - { - &$block $CimSession $p $InputObject - } - } - } -} - -function Debug-Volume -{ - [CmdletBinding( DefaultParameterSetName="ByDriveLetter" )] - Param - ( - [char[]] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "ByDriveLetter", - Position = 0)] - $DriveLetter, - - [string[]] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "ById")] - $ObjectId, - - [string[]] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "ByPaths")] - $Path, - - [string[]] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "ByLabel")] - [Alias("FriendlyName")] - $FileSystemLabel, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Volume")] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "InputObject")] - $InputObject, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - # Provided for compatibility with CDXML cmdlets, not actually used. - [Int32] - $ThrottleLimit, - - [Switch] - $AsJob - ) - - Begin{ - Write-Warning "This cmdlet is deprecated and may not be available in the future. Use Get-HealthFault instead." - } - - Process - { - $info = $resources.info - $p = $null - - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - switch ($PsCmdlet.ParameterSetName) - { - "ByDriveLetter" { $io = Get-Volume -CimSession $CimSession -DriveLetter $DriveLetter -ErrorAction stop; break;} - "ById" { $io = Get-Volume -CimSession $CimSession -ObjectId $ObjectId -ErrorAction stop; break; } - "ByPaths" { $io = Get-Volume -CimSession $CimSession -Path $Path -ErrorAction stop; break;} - "ByLabel" { $io = Get-Volume -CimSession $CimSession -FileSystemLabel $FileSystemLabel -ErrorAction stop; break;} - } - - # Would use a closure here, but jobs are run in their own session state. - $block = { - param($session, $asjob, $io) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession - } - - $result = @() - $output = Invoke-CimMethod -MethodName Diagnose -InputObject $io -CimSession $session - foreach($i in $output){$result += $i.ItemValue} - $result | Sort-Object -Property PerceivedSeverity - } - - if ($asjob) - { - $p = $true - Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $InputObject) - } - else - { - if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) - { - &$block $CimSession $p $InputObject - } - } - } -} - -function Enable-StorageMaintenanceMode -{ - [CmdletBinding()] - Param - ( - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "InputObject")] - $InputObject, - - [Switch] - $IgnoreDetachedVirtualDisks, - - [System.Nullable[Bool]] - $ValidateVirtualDisksHealthy, - - [String] - $Model, - - [String] - $Manufacturer, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - [System.Nullable[Bool]] - $ValidateMaintenanceMode, - - [Switch] - $AsJob - ) - - Begin - { - [flagsattribute()] - Enum ValidationFlags - { - None = 0 - VirtualDisksHealthy = 1 - } - } - - Process - { - $info = $resources.info - $p = $null - - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - if ($InputObject.CimClass.CimClassName -ne "MSFT_PhysicalDisk" -and - $InputObject.CimClass.CimClassName -ne "MSFT_StorageEnclosure" -and - $InputObject.CimClass.CimClassName -ne "MSFT_StorageScaleUnit") - { - $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` - -ErrorMessage "The input object must be a PhysicalDisk, StorageEnclosure or StorageScaleUnit" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - - $arguments = @{} - - $arguments.Add("EnableMaintenanceMode", $true) - $arguments.Add("IgnoreDetachedVirtualDisks", $IgnoreDetachedVirtualDisks.IsPresent) - if ($InputObject.CimClass.CimClassName -ne "MSFT_PhysicalDisk") - { - if ($PSBoundParameters.ContainsKey("Model")) - { - $arguments.Add("Model", $Model) - } - - if ($PSBoundParameters.ContainsKey("Manufacturer")) - { - $arguments.Add("Manufacturer", $Manufacturer) - } - } - - $includeValidationFlags = $false - if ($ValidateVirtualDisksHealthy -ne $null) - { - $includeValidationFlags = $true - if($ValidateVirtualDisksHealthy) - { - $validationFlags += [ValidationFlags]::VirtualDisksHealthy - } - else - { - $validationFlags += [ValidationFlags]::None - } - } - - if ($includeValidationFlags) - { - $arguments.Add("ValidationFlags", $validationFlags) - } - - if ($ValidateMaintenanceMode -ne $null) - { - $arguments.Add("ValidateMaintenanceMode", $ValidateMaintenanceMode) - } - - $storageSubSystem = $InputObject | Get-StorageSubSystem -CimSession $CimSession - - if ($storageSubSystem.Model -eq "Clustered Windows Storage") - { - $storageHealth = Get-CimAssociatedInstance -ResultClassName MSFT_StorageHealth -InputObject $storageSubSystem -CimSession $CimSession - - $arguments.Add("TargetObject", $InputObject) - } - else - { - if ($arguments["ValidationFlags"] -ne $null) - { - $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` - -ErrorMessage "The parameter 'ValidateVirtualDisksHealthy' is not supported in this subsystem. Invoke again without this parameter." ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - } - - # Would use a closure here, but jobs are run in their own session state. - $block = { - param($session, $asjob, $io, $arg, $ss, $sh) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession - } - - if ($ss.Model -eq "Clustered Windows Storage") - { - Invoke-CimMethod -MethodName "Maintenance" -Arguments $arg -InputObject $sh -CimSession $session | Out-Null - } - else - { - Invoke-CimMethod -MethodName "Maintenance" -Arguments $arg -InputObject $io -CimSession $session | Out-Null - } - } - - if ($asjob) - { - $p = $true - Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $InputObject, $arguments, $storageSubSystem, $storageHealth) - } - else - { - if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) - { - &$block $CimSession $p $InputObject $arguments $storageSubSystem $storageHealth - } - } - } -} - -function Disable-StorageMaintenanceMode -{ - [CmdletBinding()] - Param - ( - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "InputObject")] - $InputObject, - - [string] - $Model, - - [string] - $Manufacturer, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - [Switch] - $AsJob - ) - - Begin{} - - Process - { - $info = $resources.info - $p = $null - - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - if ($InputObject.CimClass.CimClassName -ne "MSFT_PhysicalDisk" -and - $InputObject.CimClass.CimClassName -ne "MSFT_StorageEnclosure" -and - $InputObject.CimClass.CimClassName -ne "MSFT_StorageScaleUnit") - { - $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` - -ErrorMessage "The input object must be a PhysicalDisk, StorageEnclosure or StorageScaleUnit" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - - $arguments = @{} - - $arguments.Add("EnableMaintenanceMode", $false) - - if($InputObject.CimClass.CimClassName -ne "MSFT_PhysicalDisk") - { - if ($PSBoundParameters.ContainsKey("Model")) - { - $arguments.Add("Model", $Model) - } - - if ($PSBoundParameters.ContainsKey("Manufacturer")) - { - $arguments.Add("Manufacturer", $Manufacturer) - } - } - - $storageSubSystem = $InputObject | Get-StorageSubSystem -CimSession $CimSession - - if ($storageSubSystem.Model -eq "Clustered Windows Storage") - { - $arguments.Add("TargetObject", $InputObject) - - $storageHealth = Get-CimAssociatedInstance -ResultClassName MSFT_StorageHealth -InputObject $storageSubSystem -CimSession $CimSession - } - - # Would use a closure here, but jobs are run in their own session state. - $block = { - param($session, $asjob, $io, $arg, $ss, $sh) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession - } - - if ($ss.Model -eq "Clustered Windows Storage") - { - Invoke-CimMethod -MethodName "Maintenance" -Arguments $arg -InputObject $sh -CimSession $session | Out-Null - } - else - { - Invoke-CimMethod -MethodName "Maintenance" -Arguments $arg -InputObject $io -CimSession $session | Out-Null - } - } - - if ($asjob) - { - $p = $true - Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $InputObject, $arguments, $storageSubSystem, $storageHealth) - } - else - { - if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) - { - &$block $CimSession $p $InputObject $arguments $storageSubSystem $storageHealth - } - } - } -} - - -function Get-StorageDiagnosticInfo -{ - [CmdletBinding()] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubSystem")] - [Parameter( - ParameterSetName = "ByStorageSubSystem", - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $InputObject, - - [String] - [Parameter( - ParameterSetName = "ByStorageSubSystemFriendlyName", - Mandatory = $true, - Position = 0)] - [ValidateNotNullOrEmpty()] - $StorageSubSystemFriendlyName, - - [String] - [Parameter( - ParameterSetName = "ByStorageSubSystemName", - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $StorageSubSystemName, - - [String] - [Parameter( - ParameterSetName = "ByStorageSubSystemUniqueId", - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("StorageSubSystemId")] - $StorageSubSystemUniqueId, - - #### -------------------- Method parameters ----------------------------------#### - - [String] - [Parameter( - ParameterSetName = 'ByStorageSubSystem', - Mandatory = $true)] - [Parameter( - ParameterSetName = 'ByStorageSubSystemFriendlyName', - Mandatory = $true)] - [Parameter( - ParameterSetName = 'ByStorageSubSystemName', - Mandatory = $true)] - [Parameter( - ParameterSetName = 'ByStorageSubSystemUniqueId', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("Path")] - $DestinationPath, - - [UInt32] - [Parameter( - ParameterSetName = 'ByStorageSubSystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubSystemFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubSystemName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubSystemUniqueId', - Mandatory = $false)] - $TimeSpan, - - [String] - [Parameter( - ParameterSetName = 'ByStorageSubSystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubSystemFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubSystemName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubSystemUniqueId', - Mandatory = $false)] - $ActivityId, - - [System.Management.Automation.SwitchParameter] - [Parameter( - ParameterSetName = 'ByStorageSubSystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubSystemFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubSystemName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubSystemUniqueId', - Mandatory = $false)] - $ExcludeOperationalLog = $false, - - [System.Management.Automation.SwitchParameter] - [Parameter( - ParameterSetName = 'ByStorageSubSystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubSystemFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubSystemName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubSystemUniqueId', - Mandatory = $false)] - $ExcludeDiagnosticLog = $false, - - [System.Management.Automation.SwitchParameter] - [Parameter( - ParameterSetName = 'ByStorageSubSystem', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubSystemFriendlyName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubSystemName', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByStorageSubSystemUniqueId', - Mandatory = $false)] - $IncludeLiveDump = $false, - - #### -------------------- Powershell parameters ------------------------------#### - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - # Provided for compatibility with CDXML cmdlets, not actually used. - [Int32] - $ThrottleLimit, - - [Switch] - $AsJob - ) - - Process - { - $info = $resources.info - $p = $null - - if (-not $CimSession) - { - $CimSession = New-CimSession - } - - if (-not $AsJob) - { - Write-Progress -Activity "Get-StorageDiagnosticInfo" -Id 0 -PercentComplete 0 -CurrentOperation "Validating parameters" -Status "0/2" - } - - ## Gather the instance object - - switch ($psCmdlet.ParameterSetName) - { - "ByStorageSubSystem" { $SubsystemInstance = $InputObject; break; } - "ByStorageSubSystemFriendlyName" { $SubsystemInstance = Get-StorageSubsystem -FriendlyName $StorageSubSystemFriendlyName -CimSession $CimSession -ErrorAction Stop; break; } - "ByStorageSubSystemName" { $SubsystemInstance = Get-StorageSubsystem -Name $StorageSubSystemName -CimSession $CimSession -ErrorAction Stop; break; } - "ByStorageSubSystemUniqueId" { $SubsystemInstance = Get-StorageSubsystem -UniqueId $StorageSubSystemUniqueId -CimSession $CimSession -ErrorAction Stop; break; } - } - - # Would use a closure here, but jobs are run in their own session state. - $methodblock = { - param($session, $asjob, $uniqueId, $arguments) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - # We need to load the module or it fails with CMDLET Not Found - import-module Storage\StorageSubSystem.cdxml - - $session = $session | New-CimSession - } - - $parameters = @{} - - $parameters.Add("CimSession", $session ) - $parameters.Add("StorageSubSystemUniqueId", $uniqueId ) - $parameters.Add("DestinationPath", $arguments["DestinationPath"] ) - - if ($arguments.ContainsKey("TimeSpan")) - { - $parameters.Add("TimeSpan", $arguments["TimeSpan"]) - } - - if ($arguments.ContainsKey("ActivityId")) - { - $parameters.Add("ActivityId", $arguments["ActivityId"]) - } - - if ($arguments.ContainsKey("ExcludeOperationalLog")) - { - $parameters.Add("ExcludeOperationalLog", $arguments["ExcludeOperationalLog"]) - } - - if ($arguments.ContainsKey("ExcludeDiagnosticLog")) - { - $parameters.Add("ExcludeDiagnosticLog", $arguments["ExcludeDiagnosticLog"]) - } - - if ($arguments.ContainsKey("IncludeLiveDump")) - { - $parameters.Add("IncludeLiveDump", $arguments["IncludeLiveDump"]) - } - - if (-not $asjob) - { - Write-Progress -Activity "Get-StorageDiagnosticInfo" -Id 0 -PercentComplete 10 -CurrentOperation "Gathering storage diagnostic logs" -Status "1/2" - } - - Get-StorageDiagnosticInfoInternal @parameters - - if (-not $asjob) - { - Write-Progress -Activity "Get-StorageDiagnosticInfo" -Completed -Status "2/2" - } - } - - if ($asjob) - { - $p = $true - - Start-Job -Name GetDiagnosticInfo ` - -ScriptBlock $methodblock ` - -ArgumentList @($CimSession, $p, $SubsystemInstance.UniqueId, $PSBoundParameters) - } - else - { - &$methodblock $CimSession $p $SubsystemInstance.UniqueId $PSBoundParameters - } - } -} - -function Remove-StorageHealthIntent -{ - [CmdletBinding( - SupportsShouldProcess=$true, - ConfirmImpact="High" - )] - Param - ( - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageObject")] - [Parameter( - Mandatory = $true, - ValueFromPipeline = $true, - ParameterSetName = "InputObject")] - $InputObject, - - [Microsoft.Management.Infrastructure.CimSession] - $CimSession, - - [Switch] - $AsJob - ) - - Process - { - $info = $resources.info - - if (-not $CimSession) - { - $CimSession = New-CimSession -Verbose:$false - } - - $arguments = @{} - - $storageSubSystem = $InputObject | Get-StorageSubSystem -CimSession $CimSession - - if ($storageSubSystem.Model -eq "Clustered Windows Storage") - { - $storageHealth = Get-CimAssociatedInstance -ResultClassName MSFT_StorageHealth -InputObject $storageSubSystem -CimSession $CimSession - - $arguments.Add("TargetObject", $InputObject) - } - else - { - $errorObject = CreateErrorRecord -ErrorId "InvalidSubsystem" ` - -ErrorMessage "This method is not supported for this subsystem." ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - - # Would use a closure here, but jobs are run in their own session state. - $block = { - param($session, $asjob, $io, $arg, $sh) - - # Start-Job serializes/deserializes the CimSession, - # which means it shows up here as having type Deserialized.CimSession. - # Must recreate or cast the object in order to pass it to Get-CimInstance. - if ($asjob) - { - $session = $session | New-CimSession -Verbose:$false - } - - Invoke-CimMethod -MethodName "RemoveIntent" -Arguments $arg -InputObject $sh -CimSession $session | Out-Null - } - - if ($asjob) - { - Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $true, $InputObject, $arguments, $storageHealth) - } - else - { - if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) - { - &$block $CimSession $false $InputObject $arguments $storageHealth - } - } - } -} - -New-Alias Get-PhysicalDiskSNV Get-PhysicalDiskStorageNodeView -New-Alias Get-DiskSNV Get-DiskStorageNodeView -New-Alias Get-StorageEnclosureSNV Get-StorageEnclosureStorageNodeView - -Export-ModuleMember -Alias * -Function * \ No newline at end of file diff --git a/newton-cn/bin/Modules/Storage/StorageSetting.cdxml b/newton-cn/bin/Modules/Storage/StorageSetting.cdxml deleted file mode 100644 index f116db9..0000000 --- a/newton-cn/bin/Modules/Storage/StorageSetting.cdxml +++ /dev/null @@ -1,82 +0,0 @@ - - - 1.0.0.0 - StorageSetting - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Storage/StorageSubSystem.cdxml b/newton-cn/bin/Modules/Storage/StorageSubSystem.cdxml deleted file mode 100644 index 5a8bb11..0000000 --- a/newton-cn/bin/Modules/Storage/StorageSubSystem.cdxml +++ /dev/null @@ -1,928 +0,0 @@ - - - 1.0.0.0 - StorageSubSystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Storage/StorageTier.cdxml b/newton-cn/bin/Modules/Storage/StorageTier.cdxml deleted file mode 100644 index 018e31a..0000000 --- a/newton-cn/bin/Modules/Storage/StorageTier.cdxml +++ /dev/null @@ -1,206 +0,0 @@ - - - 1.0.0.0 - StorageTier - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Storage/TargetPort.cdxml b/newton-cn/bin/Modules/Storage/TargetPort.cdxml deleted file mode 100644 index e210e7a..0000000 --- a/newton-cn/bin/Modules/Storage/TargetPort.cdxml +++ /dev/null @@ -1,167 +0,0 @@ - - - 1.0.0.0 - TargetPort - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Storage/TargetPortal.cdxml b/newton-cn/bin/Modules/Storage/TargetPortal.cdxml deleted file mode 100644 index 48d949e..0000000 --- a/newton-cn/bin/Modules/Storage/TargetPortal.cdxml +++ /dev/null @@ -1,65 +0,0 @@ - - - 1.0.0.0 - TargetPortal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/Storage/VirtualDisk.cdxml b/newton-cn/bin/Modules/Storage/VirtualDisk.cdxml deleted file mode 100644 index 91815d7..0000000 --- a/newton-cn/bin/Modules/Storage/VirtualDisk.cdxml +++ /dev/null @@ -1,765 +0,0 @@ - - - 1.0.0.0 - VirtualDisk - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Storage/Volume.cdxml b/newton-cn/bin/Modules/Storage/Volume.cdxml deleted file mode 100644 index 0c49972..0000000 --- a/newton-cn/bin/Modules/Storage/Volume.cdxml +++ /dev/null @@ -1,856 +0,0 @@ - - - 1.0.0.0 - Volume - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FAT - FAT32 - exFAT - NTFS - ReFS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/StorageBusCache/StorageBusCache.format.ps1xml b/newton-cn/bin/Modules/StorageBusCache/StorageBusCache.format.ps1xml deleted file mode 100644 index 75d7910..0000000 --- a/newton-cn/bin/Modules/StorageBusCache/StorageBusCache.format.ps1xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - DiskTableView - - StorageBusDisk - - - - - - - - - - - - - - - - - - - - - Guid - - - Number - - - IsCache - - - BusType - - - - - - - - DiskListView - - StorageBusDisk - - - - - - - Guid - - - Number - - - IsCache - - - BusType - - - - - - - - - diff --git a/newton-cn/bin/Modules/StorageBusCache/StorageBusCache.psd1 b/newton-cn/bin/Modules/StorageBusCache/StorageBusCache.psd1 deleted file mode 100644 index 5795d24..0000000 --- a/newton-cn/bin/Modules/StorageBusCache/StorageBusCache.psd1 +++ /dev/null @@ -1,31 +0,0 @@ -@{ - GUID = 'c85588a4-1180-4635-ba9e-a04581bf10c8' - Author="Microsoft Corporation" - CompanyName="Microsoft Corporation" - Copyright="© Microsoft Corporation. All rights reserved." - ModuleVersion = '1.0.0.0' - PowerShellVersion = '3.0' - FormatsToProcess = 'StorageBusCache.format.ps1xml' - TypesToProcess = 'StorageBusCache.types.ps1xml' - NestedModules = @( - 'StorageBusCache.psm1' - ) - - CmdletsToExport = @() - FunctionsToExport = @( - 'Clear-StorageBusDisk', - 'Disable-StorageBusCache', - 'Disable-StorageBusDisk', - 'Enable-StorageBusCache', - 'Enable-StorageBusDisk', - 'Get-StorageBusDisk', - 'Get-StorageBusBinding', - 'New-StorageBusCacheStore', - 'New-StorageBusBinding', - 'Remove-StorageBusBinding', - 'Resume-StorageBusDisk', - 'Set-StorageBusProfile', - 'Suspend-StorageBusDisk') -} - - diff --git a/newton-cn/bin/Modules/StorageBusCache/StorageBusCache.psm1 b/newton-cn/bin/Modules/StorageBusCache/StorageBusCache.psm1 deleted file mode 100644 index 5aebee0..0000000 --- a/newton-cn/bin/Modules/StorageBusCache/StorageBusCache.psm1 +++ /dev/null @@ -1,2452 +0,0 @@ -$DiskControls = @" -using System; -using System.Collections; -using System.Runtime.InteropServices; -using System.ComponentModel; - -namespace Microsoft.SFS.StorageBusCache -{ - public enum StorageBusType - { - Unknown = 0, - Scsi = 1, - Atapi = 2, - Ata = 3, - IEEE1394 = 4, - Ssa = 5, - Fibre = 6, - Usb = 7, - RAID = 8, - iScsi = 9, - Sas = 10, - Sata = 11, - Sd = 12, - Mmc = 13, - Virtual = 14, - FileBackedVirtual = 15, - Spaces = 16, - Nvme = 17, - SCM = 18, - Ufs = 19, - Max = 20 - } - - namespace ClusBFlt - { - public enum DeviceType - { - Disk = 0, - Enclosure = 1, - SSU = 2 - } - - [Flags] - public enum CacheStoreBindingAttribute - { - Default = 0x00000000, - Enabled = 0x00000001, - Disable_Read_Cache = 0x00000002, - Disable_Read_Ahead_Cache = 0x00000004, - Disable_Write_Cache = 0x00000008 - } - - public enum PathType - { - Read_Write = 0, - Read_Only = 1, - Engaged = 2, - Maintenance = 3 - } - - [Flags] - public enum PathInfoAttribute - { - Default = 0x00000000, - Virtual = 0x00000001, - Orphan = 0x00000002, - Hybrid = 0x00000004, - Solid = 0x00000008, - Incomplete = 0x00000010, - Fairness_Layer = 0x00000020, - Missing_Layer = 0x00000040, - Hidden = 0x00000080, - Resilient = 0x00000100, - Paused = 0x00000200, - Block_RW = 0x00000400, - Attention = 0x00000800, - Has_Cache_Partition = 0x00001000, - Fairness_Enabled = 0x00002000, - Partition = 0x00004000, - Block_Write = 0x00008000, - All = 0x0000FFFF - } - - [Flags] - public enum DiskAttribute - { - Default = 0x00, - Enabled = 0x01, - Disabled = 0x02, - Maintenance = 0x04, - No_Virtual_Enclosure = 0x08, - Block_ReadWrite = 0x10, - Block_Write = 0x20, - All = 0xFF - } - - [Flags] - public enum SystemFlags - { - Default_System = 0x0000, - Azure_System = 0x0001, - Dont_Set_FastFail = 0x0010, - Allow_Other_Partitions = 0x0020, - Claim_Sbl_Cache_HDD_Guid_Disk = 0x0040, - Claim_Sbl_Cache_SSD_Guid_Part = 0x0080, - Dont_Claim_SSD = 0x0100, - Create_Bus_PDO = 0x0200, - Disable_Cache_On_Error = 0x0400 - } - } - - public class StorageBusDisk - { - public string Guid { get; set; } - public uint Number { get; set; } - public bool IsClaimed { get; set; } - public bool IsCache { get; set; } - public StorageBusType BusType { get; set; } - } - - public class StorageBusBinding - { - public string Guid { get; set; } - public uint Number { get; set; } - public bool IsCache { get; set; } - } - - public static class DeviceMgmt - { - #region PInvoke structs - - [StructLayout(LayoutKind.Sequential)] - public struct CBFLT_IS_SUPPORTED_DISK_IN - { - public IntPtr Handle; - public UInt32 BusTypesOverride; - } - - [StructLayout(LayoutKind.Sequential)] - public struct CBFLT_SET_PROFILE_IN - { - public UInt32 SystemFlags; - } - - [StructLayout(LayoutKind.Sequential)] - public struct STORAGE_DEVICE_NUMBER - { - public UInt32 DeviceType; - public UInt32 DeviceNumber; - public UInt32 PartitionNumber; - } - - [StructLayout(LayoutKind.Sequential)] - public struct STORAGE_DEVICE_NUMBER_EX - { - public UInt32 Version; - public UInt32 Size; - public UInt32 Flags; - public UInt32 DeviceType; - public UInt32 DeviceNumber; - public Guid DeviceGuid; - public UInt32 PartitionNumber; - } - - public enum PARTITION_STYLE : int - { - PARTITION_STYLE_MBR = 0, - PARTITION_STYLE_GPT = 1, - PARTITION_STYLE_RAW = 2 - } - - [StructLayout(LayoutKind.Sequential)] - public struct DRIVE_LAYOUT_INFORMATION_MBR - { - public UInt32 DiskSignature; - } - - [StructLayout(LayoutKind.Sequential)] - public struct DRIVE_LAYOUT_INFORMATION_GPT - { - public Guid DiskId; - public UInt64 StartingUsableOffset; - public UInt64 UsableLength; - public UInt32 MaxPartitionCount; - } - - [StructLayout(LayoutKind.Explicit)] - public struct PARTITION_INFORMATION_MBR - { - [FieldOffset(0)] - public Byte PartitionType; - [FieldOffset(1)] - public Boolean BootIndicator; - [FieldOffset(2)] - public Boolean RecognizedPartition; - [FieldOffset(4)] - public UInt32 HiddenSectors; - } - - [StructLayout(LayoutKind.Explicit, CharSet=CharSet.Unicode)] - public struct PARTITION_INFORMATION_GPT - { - [FieldOffset(0)] - public Guid PartitionType; - [FieldOffset(16)] - public Guid PartitionId; - [FieldOffset(32)] - public UInt64 Attributes; - [FieldOffset(40)] - [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 36)] - public string PartitionName; - } - - [StructLayout(LayoutKind.Explicit)] - public struct PARTITION_INFORMATION_EX - { - [FieldOffset(0)] - public PARTITION_STYLE PartitionStyle; - [FieldOffset(8)] - public UInt64 StartingOffset; - [FieldOffset(16)] - public UInt64 PartitionLength; - [FieldOffset(24)] - public UInt32 PartitionNumber; - [FieldOffset(28)] - public Boolean RewritePartition; - [FieldOffset(32)] - public PARTITION_INFORMATION_MBR Mbr; - [FieldOffset(32)] - public PARTITION_INFORMATION_GPT Gpt; - } - - [StructLayout(LayoutKind.Explicit)] - public struct DRIVE_LAYOUT_INFORMATION_EX - { - [FieldOffset(0)] - public PARTITION_STYLE PartitionStyle; - [FieldOffset(4)] - public UInt32 PartitionCount; - [FieldOffset(8)] - public DRIVE_LAYOUT_INFORMATION_MBR Mbr; - [FieldOffset(8)] - public DRIVE_LAYOUT_INFORMATION_GPT Gpt; - [FieldOffset(48)] - public PARTITION_INFORMATION_EX[] PartitionEntry; - } - - #endregion - - #region PInvoke Definitions - - //File Handle - [DllImport("kernel32.dll", SetLastError = true)] - static extern IntPtr CreateFile(string lpFileName, uint dwDesiredAccess, uint dwShareMode, IntPtr lpSecurityAttributes, uint dwCreationDisposition, uint dwFlagsAndAttributes, IntPtr hTemplateFile); - - [DllImport("kernel32.dll")] - static extern int CloseHandle(IntPtr hObject); - - [DllImport("kernel32.dll", SetLastError = true)] - static extern bool DeviceIoControl(IntPtr hDevice, uint dwIoControlCode, IntPtr lpInBuffer, uint nInBufferSize, IntPtr lpOutBuffer, - uint nOutBufferSize, ref uint lpBytesReturned, IntPtr lpOverlapped); - - #endregion - - #region constants - - // IoControlCode values for disk devices - const uint FILE_ANY_ACCESS = 0; - const uint FILE_READ_ACCESS = 0x0001; - const uint FILE_WRITE_ACCESS = 0x0002; - const uint FILE_BOTH_ACCESS = FILE_READ_ACCESS | FILE_WRITE_ACCESS; - - const uint METHOD_BUFFERED = 0; - const uint METHOD_IN_DIRECT = 1; - const uint METHOD_OUT_DIRECT = 2; - const uint METHOD_NEITHER = 3; - - // createFile access - const uint GENERIC_READ = (0x80000000); - const uint GENERIC_WRITE = (0x40000000); - const uint FILE_SHARE_READ = 0x00000001; - const uint FILE_SHARE_WRITE = 0x00000002; - const uint OPEN_EXISTING = 3; - - // file attribute values - const uint FILE_ATTRIBUTE_NORMAL = 0x00000080; - - //errors - const uint ERROR_CLASS_MISMATCH = 0xE0000203; - const uint ERROR_NO_MORE_ITEMS = 259; - const uint ERROR_INSUFFICIENT_BUFFER = 122; - const uint ERROR_MORE_DATA = 234; - - //random consts - const uint SpDeviceInterfaceDetailSize = 5; - - //device classes - const int DIGCF_DEFAULT = 0x00000001; - const int DIGCF_PRESENT = 0x00000002; - const int DIGCF_ALLCLASSES = 0x00000004; - const int DIGCF_PROFILE = 0x00000008; - const int DIGCF_DEVICEINTERFACE = 0x00000010; - - //disk and hidden disk interface GUIDs - public static Guid GUID_DEVINTERFACE_HIDDEN_DISK = new Guid(0x7fccc86c, 0x228a, 0x40ad, 0x8a, 0x58, 0xf5, 0x90, 0xaf, 0x7b, 0xfd, 0xce); - public static Guid GUID_DEVINTERFACE_DISK = new Guid(0x53f56307, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b); - public static Guid GUID_DEVINTERFACE_STORAGEPORT = new Guid(0x2ACCFE60, 0xC130, 0x11D2, 0xb0, 0x82, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b); //{2ACCFE60-C130-11D2-B082-00A0C91EFB8B} - - // SBL cache partition type GUIDs - public static Guid PARTITION_SBL_CACHE_SSD_GUID = new Guid(0xeeff8352, 0xdd2a, 0x44db, 0xae, 0x83, 0xbe, 0xe1, 0xcf, 0x74, 0x81, 0xdc); - public static Guid PARTITION_SBL_CACHE_SSD_RESERVED_GUID = new Guid(0xdcc0c7c1, 0x55ad, 0x4f17, 0x9d, 0x43, 0x4b, 0xc7, 0x76, 0xe0, 0x11, 0x7e); - public static Guid PARTITION_SBL_CACHE_HDD_GUID = new Guid(0x03aaa829, 0xebfc, 0x4e7e, 0xaa, 0xc9, 0xc4, 0xd7, 0x6c, 0x63, 0xb2, 0x4b); - - //ioctl code - public const uint IOCTL_PARTMGR_BASE = 0x00000070; - public const uint IOCTL_CBFLT_BASE = 0x791; - public const uint IOCTL_STORAGE_BASE = 0x0000002d; - public const uint FILE_DEVICE_DISK = 0x00000007; - public const uint IOCTL_DISK_BASE = FILE_DEVICE_DISK; - - private static uint IOCTL_DISK_REAUCTION_DISK = CTL_CODE(IOCTL_PARTMGR_BASE, 7, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); - private static uint IOCTL_CBFLT_IS_SUPPORTED_DISK = CTL_CODE(IOCTL_CBFLT_BASE, 0x09, METHOD_BUFFERED, FILE_READ_ACCESS); - private static uint IOCTL_CBFLT_SET_PROFILE = CTL_CODE(IOCTL_CBFLT_BASE, 0x1b, METHOD_BUFFERED, FILE_WRITE_ACCESS); - private static uint IOCTL_STORAGE_GET_DEVICE_NUMBER_EX = CTL_CODE(IOCTL_STORAGE_BASE, 0x0421, METHOD_BUFFERED, FILE_ANY_ACCESS); - private static uint IOCTL_STORAGE_GET_DEVICE_NUMBER = CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS); - private static uint IOCTL_DISK_GET_DRIVE_LAYOUT_EX = CTL_CODE(IOCTL_DISK_BASE, 0x0014, METHOD_BUFFERED, FILE_ANY_ACCESS); - private static uint IOCTL_DISK_SET_DRIVE_LAYOUT_EX = CTL_CODE(IOCTL_DISK_BASE, 0x0015, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); - - // clusbflt - const string CLUSBFLT_PR_MANAGER = "\\\\?\\GLOBALROOT\\Device\\CLUSBFLT\\PrMgr$"; - const string CLUSBFLT_BLOCK_TARGETFILE = "\\\\?\\GLOBALROOT\\Device\\CLUSBFLT\\BlockTarget$"; - - public static UInt32 Standalone_Profile_Default = 0x000101F0; - public static UInt32 Standalone_Profile_Claim_Flash = 0x000000F0; - - public static UInt32 Standalone_Cache_Binding_Attributes = 0x00000007; - - #endregion - - #region Ioctl code - - static private uint CTL_CODE(uint DeviceType, uint Function, uint Method, uint Access) - { - return ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method); - } - - static private IntPtr OpenDevice(string devicePath) - { - IntPtr hDevice = IntPtr.Zero; - - hDevice = CreateFile(devicePath, - GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_WRITE | FILE_SHARE_READ, - IntPtr.Zero, - OPEN_EXISTING, - 0, - IntPtr.Zero); - - if ((int)hDevice == -1) - { - throw new Win32Exception("CreateFile failed, status " + Marshal.GetLastWin32Error().ToString()); - } - if (hDevice == IntPtr.Zero) - { - throw new Win32Exception("Device handle to '" + devicePath + "'is NULL"); - } - return (hDevice); - } - - static private void CloseDevice(IntPtr hDevice) - { - if ((int)CloseHandle(hDevice) == -1) - { - throw new Win32Exception("CloseHandle() failed, status " + Marshal.GetLastWin32Error().ToString()); - } - return; - } - - static public bool ReauctionDevice(string devicePath) - { - bool boolResult = false; - IntPtr hDevice = IntPtr.Zero; - - try - { - hDevice = OpenDevice(devicePath); - uint bytesReturned = 0; - - boolResult = DeviceIoControl(hDevice, - IOCTL_DISK_REAUCTION_DISK, - IntPtr.Zero, - 0, - IntPtr.Zero, - 0, - ref bytesReturned, - IntPtr.Zero); - if (!boolResult) - { - throw new Win32Exception("Device '" + devicePath + "' failed IOCTL_DISK_REAUCTION_DISK, status " + Marshal.GetLastWin32Error().ToString()); - } - } - catch - { - throw; - } - finally - { - if (hDevice != IntPtr.Zero) - CloseDevice(hDevice); - } - - return boolResult; - } - - static public StorageBusDisk GetStorageBusDisk(string devicePath) - { - bool boolResult = false; - IntPtr hDevice = IntPtr.Zero; - IntPtr outputPtr = IntPtr.Zero; - - StorageBusDisk disk = new StorageBusDisk(); - disk.Guid = Guid.Empty.ToString(); - disk.Number = 0; - - try - { - try - { - hDevice = OpenDevice(devicePath); - } - catch - { - return disk; - } - - uint bytesReturned = 0; - - int outputSize = Marshal.SizeOf(typeof(STORAGE_DEVICE_NUMBER_EX)); - outputPtr = Marshal.AllocHGlobal(outputSize); - - boolResult = DeviceIoControl(hDevice, - IOCTL_STORAGE_GET_DEVICE_NUMBER_EX, - IntPtr.Zero, - 0, - outputPtr, - (UInt32)outputSize, - ref bytesReturned, - IntPtr.Zero); - if (!boolResult) - { - throw new Win32Exception("Device '" + devicePath + "' failed IOCTL_STORAGE_GET_DEVICE_NUMBER_EX, status " + Marshal.GetLastWin32Error().ToString()); - } - - STORAGE_DEVICE_NUMBER_EX output = (STORAGE_DEVICE_NUMBER_EX) Marshal.PtrToStructure(outputPtr, typeof(STORAGE_DEVICE_NUMBER_EX)); - disk.Guid = "{" + output.DeviceGuid + "}"; - disk.Number = output.DeviceNumber; - } - catch - { - throw; - } - finally - { - if (outputPtr != IntPtr.Zero) - Marshal.FreeHGlobal(outputPtr); - - if (hDevice != IntPtr.Zero) - CloseDevice(hDevice); - } - - return disk; - } - - static public Guid GetDeviceGuid(string devicePath) - { - bool boolResult = false; - IntPtr hDevice = IntPtr.Zero; - IntPtr outputPtr = IntPtr.Zero; - Guid deviceGuid = new Guid(); - - try - { - try - { - hDevice = OpenDevice(devicePath); - } - catch - { - return deviceGuid; - } - - uint bytesReturned = 0; - - int outputSize = Marshal.SizeOf(typeof(STORAGE_DEVICE_NUMBER_EX)); - outputPtr = Marshal.AllocHGlobal(outputSize); - - boolResult = DeviceIoControl(hDevice, - IOCTL_STORAGE_GET_DEVICE_NUMBER_EX, - IntPtr.Zero, - 0, - outputPtr, - (UInt32)outputSize, - ref bytesReturned, - IntPtr.Zero); - if (!boolResult) - { - throw new Win32Exception("Device '" + devicePath + "' failed IOCTL_STORAGE_GET_DEVICE_NUMBER_EX, status " + Marshal.GetLastWin32Error().ToString()); - } - - STORAGE_DEVICE_NUMBER_EX output = (STORAGE_DEVICE_NUMBER_EX) Marshal.PtrToStructure(outputPtr, typeof(STORAGE_DEVICE_NUMBER_EX)); - deviceGuid = output.DeviceGuid; - } - catch - { - throw; - } - finally - { - if (outputPtr != IntPtr.Zero) - Marshal.FreeHGlobal(outputPtr); - - if (hDevice != IntPtr.Zero) - CloseDevice(hDevice); - } - - return deviceGuid; - } - - static public bool IsClusBFltCandidate(string devicePath, UInt32 busTypes) - { - bool boolResult = false; - IntPtr hPrMgrDevice = IntPtr.Zero; - IntPtr hDevice = IntPtr.Zero; - IntPtr inputPtr = IntPtr.Zero; - IntPtr outputPtr = IntPtr.Zero; - - try - { - hPrMgrDevice = OpenDevice(CLUSBFLT_PR_MANAGER); - hDevice = OpenDevice(devicePath); - - UInt32 bytesReturned = 0; - - CBFLT_IS_SUPPORTED_DISK_IN input = new CBFLT_IS_SUPPORTED_DISK_IN(); - input.Handle = hDevice; - input.BusTypesOverride = busTypes; - int inputSize = Marshal.SizeOf(typeof(CBFLT_IS_SUPPORTED_DISK_IN)); - inputPtr = Marshal.AllocHGlobal(inputSize); - Marshal.StructureToPtr(input, inputPtr, false); - - int outputSize = Marshal.SizeOf(typeof(uint)); - outputPtr = Marshal.AllocHGlobal(outputSize); - - boolResult = DeviceIoControl(hPrMgrDevice, - IOCTL_CBFLT_IS_SUPPORTED_DISK, - inputPtr, - (UInt32)inputSize, - outputPtr, - (UInt32)outputSize, - ref bytesReturned, - IntPtr.Zero); - - if (!boolResult) - { - throw new Win32Exception("Device '" + devicePath + "' failed IOCTL_CBFLT_IS_SUPPORTED_DISK, status " + Marshal.GetLastWin32Error().ToString()); - } - - uint supportStatus = (uint)Marshal.PtrToStructure(outputPtr, typeof(uint)); - boolResult = (supportStatus == 0); - } - catch - { - throw; - } - finally - { - if (inputPtr != IntPtr.Zero) - Marshal.FreeHGlobal(inputPtr); - - if (outputPtr != IntPtr.Zero) - Marshal.FreeHGlobal(outputPtr); - - if (hDevice != IntPtr.Zero) - CloseDevice(hDevice); - - if (hPrMgrDevice != IntPtr.Zero) - CloseDevice(hPrMgrDevice); - } - - return boolResult; - } - - static public bool SetClusBFltSystemFlags(UInt32 systemFlags) - { - bool boolResult = false; - IntPtr hTargetMgrFile = IntPtr.Zero; - IntPtr inputPtr = IntPtr.Zero; - - try - { - hTargetMgrFile = OpenDevice(CLUSBFLT_BLOCK_TARGETFILE); - - UInt32 bytesReturned = 0; - CBFLT_SET_PROFILE_IN input = new CBFLT_SET_PROFILE_IN(); - input.SystemFlags = systemFlags; - int inputSize = Marshal.SizeOf(typeof(CBFLT_SET_PROFILE_IN)); - inputPtr = Marshal.AllocHGlobal(inputSize); - Marshal.StructureToPtr(input, inputPtr, false); - - boolResult = DeviceIoControl(hTargetMgrFile, - IOCTL_CBFLT_SET_PROFILE, - inputPtr, - (UInt32)inputSize, - IntPtr.Zero, - 0, - ref bytesReturned, - IntPtr.Zero); - - if (!boolResult) - { - throw new Win32Exception("ClusBFlt driver failed IOCTL_CBFLT_SET_PROFILE, status " + Marshal.GetLastWin32Error().ToString()); - } - } - catch - { - throw; - } - finally - { - if (inputPtr != IntPtr.Zero) - Marshal.FreeHGlobal(inputPtr); - - if (hTargetMgrFile != IntPtr.Zero) - CloseDevice(hTargetMgrFile); - } - - return boolResult; - } - - private static IntPtr ComputeFieldOffset(IntPtr buffer, Type parentStructure, string fieldName) - { - long offset = (long)Marshal.OffsetOf(parentStructure, fieldName); - return (IntPtr)((long)buffer + offset); - } - - private static IntPtr ComputeFieldOffsetAtIndex(IntPtr buffer, Type parentStructure, string fieldName, UInt32 index) - { - Type fieldType = parentStructure.GetField(fieldName).FieldType.GetElementType(); - long elementSize = Marshal.SizeOf(fieldType); - long offset = (long)Marshal.OffsetOf(parentStructure, fieldName) + elementSize * index; - return (IntPtr)((long)buffer + offset); - } - - private static PARTITION_INFORMATION_EX Unmarshal_PARTITION_INFORMATION_EX(IntPtr buffer, UInt32 size) - { - if (size < (UInt32)Marshal.SizeOf(typeof(PARTITION_INFORMATION_EX))) - throw new ArgumentException("Insufficient buffer size to unmarshal PARTITION_INFORMATION_EX.", "buffer"); - PARTITION_INFORMATION_EX info = (PARTITION_INFORMATION_EX)Marshal.PtrToStructure( - buffer, typeof(PARTITION_INFORMATION_EX)); - if (info.PartitionStyle == PARTITION_STYLE.PARTITION_STYLE_MBR) - info.Mbr = (PARTITION_INFORMATION_MBR)Marshal.PtrToStructure( - ComputeFieldOffset(buffer, typeof(PARTITION_INFORMATION_EX), "Mbr"), - typeof(PARTITION_INFORMATION_MBR)); - if (info.PartitionStyle == PARTITION_STYLE.PARTITION_STYLE_GPT) - info.Gpt = (PARTITION_INFORMATION_GPT)Marshal.PtrToStructure( - ComputeFieldOffset(buffer, typeof(PARTITION_INFORMATION_EX), "Gpt"), - typeof(PARTITION_INFORMATION_GPT)); - return info; - } - - private static DRIVE_LAYOUT_INFORMATION_EX Unmarshal_DRIVE_LAYOUT_INFORMATION_EX(IntPtr buffer, UInt32 size) - { - DRIVE_LAYOUT_INFORMATION_EX info = new DRIVE_LAYOUT_INFORMATION_EX(); - info.PartitionStyle = (PARTITION_STYLE)Marshal.ReadInt32(buffer); - info.PartitionCount = (UInt32)Marshal.ReadInt32(ComputeFieldOffset(buffer, - typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionCount")); - if (size < ((UInt32)Marshal.OffsetOf(typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionEntry") + - info.PartitionCount * (UInt32)Marshal.SizeOf(typeof(PARTITION_INFORMATION_EX)))) - throw new ArgumentException("Insufficient buffer size to unmarshal DRIVE_LAYOUT_INFORMATION_EX.", "buffer"); - if (info.PartitionStyle == PARTITION_STYLE.PARTITION_STYLE_MBR) - info.Mbr = (DRIVE_LAYOUT_INFORMATION_MBR)Marshal.PtrToStructure( - ComputeFieldOffset(buffer, typeof(DRIVE_LAYOUT_INFORMATION_EX), "Mbr"), - typeof(DRIVE_LAYOUT_INFORMATION_MBR)); - if (info.PartitionStyle == PARTITION_STYLE.PARTITION_STYLE_GPT) - info.Gpt = (DRIVE_LAYOUT_INFORMATION_GPT)Marshal.PtrToStructure( - ComputeFieldOffset(buffer, typeof(DRIVE_LAYOUT_INFORMATION_EX), "Gpt"), - typeof(DRIVE_LAYOUT_INFORMATION_GPT)); - info.PartitionEntry = new PARTITION_INFORMATION_EX[info.PartitionCount]; - size -= (UInt32)Marshal.OffsetOf(typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionEntry"); - for (UInt32 partNumber = 0; partNumber < info.PartitionCount; partNumber++) - { - info.PartitionEntry[partNumber] = Unmarshal_PARTITION_INFORMATION_EX(ComputeFieldOffsetAtIndex(buffer, - typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionEntry", partNumber), size); - size -= (UInt32)Marshal.SizeOf(typeof(PARTITION_INFORMATION_EX)); - } - return info; - } - - private static void Marshal_DRIVE_LAYOUT_INFORMATION_EX(DRIVE_LAYOUT_INFORMATION_EX layout, IntPtr buffer, UInt32 size) - { - if (size < ((UInt32)Marshal.OffsetOf(typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionEntry") + - layout.PartitionCount * (UInt32)Marshal.SizeOf(typeof(PARTITION_INFORMATION_EX)))) - throw new ArgumentException("Insufficient buffer size to marshal layout.", "buffer"); - Marshal.WriteInt32(buffer, (int)layout.PartitionStyle); - Marshal.WriteInt32(ComputeFieldOffset(buffer, typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionCount"), - (int)layout.PartitionCount); - if (layout.PartitionStyle == PARTITION_STYLE.PARTITION_STYLE_GPT) - Marshal.StructureToPtr(layout.Gpt, ComputeFieldOffset(buffer, typeof(PARTITION_INFORMATION_EX), - "Gpt"), false); - else if (layout.PartitionStyle == PARTITION_STYLE.PARTITION_STYLE_MBR) - Marshal.StructureToPtr(layout.Mbr, ComputeFieldOffset(buffer, typeof(PARTITION_INFORMATION_EX), - "Mbr"), false); - size -= (UInt32)Marshal.OffsetOf(typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionEntry"); - for (UInt32 partNumber = 0; partNumber < layout.PartitionCount; partNumber++) - { - PARTITION_INFORMATION_EX newPart = layout.PartitionEntry[partNumber]; - newPart.RewritePartition = true; - Marshal_PARTITION_INFORMATION_EX(newPart, ComputeFieldOffsetAtIndex(buffer, - typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionEntry", partNumber), size); - size -= (UInt32)Marshal.SizeOf(typeof(PARTITION_INFORMATION_EX)); - } - } - - private static void Marshal_PARTITION_INFORMATION_EX(PARTITION_INFORMATION_EX info, IntPtr buffer, UInt32 size) - { - if (size < (UInt32)Marshal.SizeOf(typeof(PARTITION_INFORMATION_EX))) - throw new ArgumentException("Insufficient buffer to marshal info.", "buffer"); - Marshal.StructureToPtr(info, buffer, false); - if (info.PartitionStyle == PARTITION_STYLE.PARTITION_STYLE_GPT) - Marshal.StructureToPtr(info.Gpt, ComputeFieldOffset(buffer, - typeof(PARTITION_INFORMATION_EX), "Gpt"), false); - if (info.PartitionStyle == PARTITION_STYLE.PARTITION_STYLE_MBR) - Marshal.StructureToPtr(info.Mbr, ComputeFieldOffset(buffer, - typeof(PARTITION_INFORMATION_EX), "Mbr"), false); - } - - static public DRIVE_LAYOUT_INFORMATION_EX GetDriveLayout(string devicePath) - { - bool boolResult = false; - IntPtr hDevice = IntPtr.Zero; - uint status = 0; - - DRIVE_LAYOUT_INFORMATION_EX layout = new DRIVE_LAYOUT_INFORMATION_EX(); - uint bufferSize = 0; - IntPtr buffer = IntPtr.Zero; - - try - { - hDevice = OpenDevice(devicePath); - bool done = false; - uint bytesReturned = 0; - uint partitionCount = 0; - - while (!done) - { - bufferSize = (UInt32)Marshal.OffsetOf(typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionEntry") + - partitionCount * (uint)Marshal.SizeOf(typeof(PARTITION_INFORMATION_EX)); - buffer = Marshal.AllocHGlobal((int) bufferSize); - - boolResult = DeviceIoControl(hDevice, - IOCTL_DISK_GET_DRIVE_LAYOUT_EX, - IntPtr.Zero, - 0, - buffer, - (UInt32)bufferSize, - ref bytesReturned, - IntPtr.Zero); - if (!boolResult) - { - status = (uint)Marshal.GetLastWin32Error(); - Console.WriteLine("IOCTL_DISK_GET_DRIVE_LAYOUT_EX failed, status = " + status + " bytes returned = " + bytesReturned); - if (status == ERROR_MORE_DATA || status == ERROR_INSUFFICIENT_BUFFER) - { - partitionCount = (UInt32)Marshal.ReadInt32(ComputeFieldOffset(buffer, typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionCount")); - } - else - { - throw new Win32Exception("Device '" + devicePath + "' failed IOCTL_DISK_GET_DRIVE_LAYOUT_EX, status " + status.ToString()); - } - } - else - { - Console.WriteLine("IOCTL_DISK_GET_DRIVE_LAYOUT_EX passed"); - layout = Unmarshal_DRIVE_LAYOUT_INFORMATION_EX(buffer, bufferSize); - done = true; - } - - Marshal.FreeHGlobal(buffer); - buffer = IntPtr.Zero; - } - } - catch - { - throw; - } - finally - { - if (buffer != IntPtr.Zero) - Marshal.FreeHGlobal(buffer); - - if (hDevice != IntPtr.Zero) - CloseDevice(hDevice); - } - - return layout; - } - - static public void SetDriveLayout(string devicePath, DRIVE_LAYOUT_INFORMATION_EX layout) - { - bool boolResult = false; - IntPtr hDevice = IntPtr.Zero; - IntPtr buffer = IntPtr.Zero; - - try - { - hDevice = OpenDevice(devicePath); - uint bytesReturned = 0; - - uint bufferSize = (uint)Marshal.OffsetOf(typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionEntry") + - (uint)Marshal.SizeOf(typeof(PARTITION_INFORMATION_EX)) * (uint)layout.PartitionEntry.Length; - buffer = Marshal.AllocHGlobal((int) bufferSize); - - Marshal_DRIVE_LAYOUT_INFORMATION_EX(layout, buffer, bufferSize); - - boolResult = DeviceIoControl(hDevice, - IOCTL_DISK_SET_DRIVE_LAYOUT_EX, - buffer, - (UInt32)bufferSize, - IntPtr.Zero, - 0, - ref bytesReturned, - IntPtr.Zero); - if (!boolResult) - { - throw new Win32Exception("Device '" + devicePath + "' failed IOCTL_DISK_SET_DRIVE_LAYOUT_EX, status " + Marshal.GetLastWin32Error().ToString()); - } - } - catch - { - throw; - } - finally - { - if (buffer != IntPtr.Zero) - Marshal.FreeHGlobal(buffer); - - if (hDevice != IntPtr.Zero) - CloseDevice(hDevice); - } - } - - static public void CleanupSblCachePartitions(string devicePath) - { - // First, get drive layout - DRIVE_LAYOUT_INFORMATION_EX layout = GetDriveLayout(devicePath); - - // Update layout by skipping SBL cache partitions - uint partitionCount = layout.PartitionCount; - uint partitionIndex = 0; - - for (uint idx = 0; idx < layout.PartitionCount; ++idx) - { - if ((layout.PartitionEntry[idx].Gpt.PartitionType == PARTITION_SBL_CACHE_SSD_GUID) || - (layout.PartitionEntry[idx].Gpt.PartitionType == PARTITION_SBL_CACHE_HDD_GUID) || - (layout.PartitionEntry[idx].Gpt.PartitionType == PARTITION_SBL_CACHE_SSD_RESERVED_GUID)) - { - --partitionCount; - } - else if (partitionIndex != idx) - { - layout.PartitionEntry[partitionIndex] = layout.PartitionEntry[idx]; - ++partitionIndex; - } - } - - // If layout has changed, set the new layout - if (partitionCount < layout.PartitionCount) - { - layout.PartitionCount = partitionCount; - SetDriveLayout(devicePath, layout); - } - } - - #endregion - } -} -"@ - -Add-Type -TypeDefinition $DiskControls -Language CSharp - -[Microsoft.SFS.StorageBusCache.StorageBusType[]]$Global:SupportedBusTypes = @([Microsoft.SFS.StorageBusCache.StorageBusType]::Sas, ` - [Microsoft.SFS.StorageBusCache.StorageBusType]::Sata, ` - [Microsoft.SFS.StorageBusCache.StorageBusType]::Nvme, ` - [Microsoft.SFS.StorageBusCache.StorageBusType]::SCM) - -$Global:SupportedBusTypeFlags = 0 -foreach ($busType in $Global:SupportedBusTypes) -{ - $Global:SupportedBusTypeFlags = $Global:SupportedBusTypeFlags -bor (1 -shl $busType) -} - -function CreateErrorRecord -{ - Param - ( - [String] - $ErrorId, - - [String] - $ErrorMessage, - - [System.Management.Automation.ErrorCategory] - $ErrorCategory, - - [Exception] - $Exception, - - [Object] - $TargetObject - ) - - if($Exception -eq $null) - { - $Exception = New-Object System.Management.Automation.RuntimeException $ErrorMessage - } - - $errorRecord = New-Object System.Management.Automation.ErrorRecord @($Exception, $ErrorId, $ErrorCategory, $TargetObject) - return $errorRecord -} - -function IsS2DEnabled -{ - $clusRegKeyPath = "HKLM:\Cluster" - if (Test-Path $clusRegKeyPath) - { - $clusRegKey = Get-ItemProperty $clusRegKeyPath -Name S2DEnabled -ErrorAction SilentlyContinue - if ($clusRegKey.S2DEnabled -eq 1) - { - return $true - } - } - return $false -} - -function GetAllDisks() -{ - Param () - - $deviceTable = @{} - # Get disk drives visible to PnP, skipping storage spaces virtual disks, if any - $pnpDrives = Get-PnpDevice -Class DiskDrive | ? FriendlyName -ne "Microsoft Storage Space Device" - $systemDisks = Get-Disk | ? { $_.IsSystem -eq $true -or $_.IsBoot -eq $true } - $systemDisks = $systemDisks | Get-PhysicalDisk - - foreach ($drive in $pnpDrives) - { - # Obtain device guid - $devicePathPrefix = "\\?\" + $($drive.DeviceID -replace "\\",'#') - - $devicePath = $devicePathPrefix + "#{" + [Microsoft.SFS.StorageBusCache.DeviceMgmt]::GUID_DEVINTERFACE_DISK + "}" - $disk = [Microsoft.SFS.StorageBusCache.DeviceMgmt]::GetStorageBusDisk($devicePath) - if ($disk.Guid -eq [GUID]::Empty.ToString()) - { - $hiddenDevicePath = $devicePathPrefix + "#{" + [Microsoft.SFS.StorageBusCache.DeviceMgmt]::GUID_DEVINTERFACE_HIDDEN_DISK + "}" - $disk = [Microsoft.SFS.StorageBusCache.DeviceMgmt]::GetStorageBusDisk($hiddenDevicePath) - if ($disk.Guid -eq [GUID]::Empty.ToString()) - { - continue - } - } - - # Check if this is boot or system drive - $sysDisk = $systemDisks | ? ObjectId -match $disk.Guid | Select-Object -First 1 - if ($sysDisk) - { - # Skipping - continue - } - - # Add to device table - if ($disk.Guid -notin $deviceTable.Keys) - { - $deviceTable.Add($disk.Guid, $disk) - } - } - - return $deviceTable -} - - -function Set-StorageBusProfile -{ - [CmdletBinding(ConfirmImpact="High")] - Param - ( - [System.Boolean] - [Parameter( - Mandatory = $false)] - $ClaimFlash = $false - ) - - if (IsS2DEnabled) - { - $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` - -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` - -Exception $null ` - -TargetObject $null - $psCmdlet.WriteError($errorObject) - return - } - - # Disable before setting profile - Disable-StorageBusCache -Force $true - - # Wait for reauction after disable - Start-Sleep -Seconds 10 - - # Set Profile - try - { - $systemFlags = 0; - if ($ClaimFlash) - { - $systemFlags = [Microsoft.SFS.StorageBusCache.DeviceMgmt]::Standalone_Profile_Claim_Flash - } - else - { - $systemFlags = [Microsoft.SFS.StorageBusCache.DeviceMgmt]::Standalone_Profile_Default - } - - # Set profile in memory via clusbflt control - [Microsoft.SFS.StorageBusCache.DeviceMgmt]::SetClusBFltSystemFlags($systemFlags) | Out-Null - - # Set the bus types registry key in clusbflt registry - $clusbfltRegKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Services\clusbflt\Parameters" - $systemFlagsKeyName = "SystemFlags" - if (Test-Path $clusbfltRegKeyPath) - { - New-ItemProperty -Path $clusbfltRegKeyPath -Name $systemFlagsKeyName -Value $systemFlags -PropertyType DWord -Force | Out-Null - } - else - { - $errorObject = CreateErrorRecord -ErrorId "NotFound" ` - -ErrorMessage "ClusBFlt registry key not found" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - } - catch - { - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - $psCmdlet.WriteError($errorObject) - return - } - - # Enable after Setting profile - Enable-StorageBusCache -} - -function Enable-StorageBusCache -{ - [CmdletBinding(ConfirmImpact="None")] - Param () - - if (IsS2DEnabled) - { - $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` - -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` - -Exception $null ` - -TargetObject $null - $psCmdlet.WriteError($errorObject) - return - } - - # Set the bus types registry key in clusbflt registry - $clusbfltRegKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Services\clusbflt\Parameters" - $busTypeKeyName = "SupportedBusTypes" - if (Test-Path $clusbfltRegKeyPath) - { - New-ItemProperty -Path $clusbfltRegKeyPath -Name $busTypeKeyName -Value $Global:SupportedBusTypeFlags -Force | Out-Null - } - else - { - $errorObject = CreateErrorRecord -ErrorId "NotFound" ` - -ErrorMessage "ClusBFlt registry key not found" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - - # Enumerate all eligible disks - $devices = Get-StorageBusDisk - - # Claim disks - try - { - foreach ($device in $devices) - { - $devicePath = "\\?\Disk" + $device.Guid - - # Check if disk is clusbflt candidate - if (-not [Microsoft.SFS.StorageBusCache.DeviceMgmt]::IsClusBFltCandidate($devicePath, $Global:SupportedBusTypeFlags)) - { - continue - } - - # Reauction the disk - [Microsoft.SFS.StorageBusCache.DeviceMgmt]::ReauctionDevice($devicePath) | Out-Null - } - } - catch - { - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - $psCmdlet.WriteError($errorObject) - return - } -} - -function Disable-StorageBusCache -{ - [CmdletBinding(ConfirmImpact="High")] - Param - ( - [System.Boolean] - [Parameter( - Mandatory = $false)] - $Force = $false - ) - - if (IsS2DEnabled) - { - $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` - -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` - -Exception $null ` - -TargetObject $null - $psCmdlet.WriteError($errorObject) - return - } - - $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods - - # We should not release any devices until all bindings are removed, unless -Force is specified - if (-not $Force) - { - # Enumerate all eligible disks - $devices = Get-StorageBusDisk - - # Ensure there are no active bindings - foreach ($device in $devices) - { - $boundDevices = Get-StorageBusBinding -Guid $device.Guid - if ($boundDevices) - { - $errorObject = CreateErrorRecord -ErrorId "InvalidOperation" ` - -ErrorMessage "Found existing cache bindings" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` - -Exception $null ` - -TargetObject $null - $psCmdlet.WriteError($errorObject) - return - } - } - } - - # Enumerate all eligible disks - $devices = Get-StorageBusDisk - - # Clear the bus types registry key in clusbflt registry - $clusbfltRegKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Services\clusbflt\Parameters" - $busTypeKeyName = "SupportedBusTypes" - if (Test-Path $clusbfltRegKeyPath) - { - New-ItemProperty -Path $clusbfltRegKeyPath -Name $busTypeKeyName -Value 0 -Force | Out-Null - } - else - { - $errorObject = CreateErrorRecord -ErrorId "NotFound" ` - -ErrorMessage "ClusBFlt registry key not found" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - - # Now release all devices. - try - { - foreach ($device in $devices) - { - $devicePath = "\\?\Disk" + $device.Guid - # Check if disk is clusbflt candidate - if (-not [Microsoft.SFS.StorageBusCache.DeviceMgmt]::IsClusBFltCandidate($devicePath, $Global:SupportedBusTypeFlags)) - { - continue - } - - # Reauction the disk - [Microsoft.SFS.StorageBusCache.DeviceMgmt]::ReauctionDevice($devicePath) | Out-Null - } - } - catch - { - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - $psCmdlet.WriteError($errorObject) - return - } -} - -function Get-StorageBusDisk -{ - [CmdletBinding( DefaultParameterSetName = "ByGuid")] - Param - ( - #### -------------------- Parameter sets ------------------------------------- #### - - [System.String] - [Parameter( - ParameterSetName = 'ByGuid', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - [Alias("Id")] - $Guid, - - [System.UInt16] - [Parameter( - ParameterSetName = 'ByNumber', - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $Number, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - ValueFromPipeline = $true, - Mandatory = $false)] - [ValidateNotNullOrEmpty()] - $PhysicalDisk - ) - - $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods - $paths = $(gwmi -namespace "root\wmi" ClusBfltDeviceInformation).PathInfo - - # Get all disks on this system - $devices = GetAllDisks - $physicalDisks = Get-PhysicalDisk - - # If device is claimed, update its properties based on path properties - foreach ($deviceGuid in $devices.Keys) - { - $phyDisk = $physicalDisks | ? ObjectId -Match $deviceGuid - if ($phyDisk) - { - # Set properties based on physical disk information - $devices[$deviceGuid].BusType = $phyDisk.BusType - $devices[$deviceGuid].Number = $phyDisk.DeviceId - } - - $path = $paths | ? DeviceGuid -Match $deviceGuid | Select-Object -First 1 - if (-not $path) - { - # Device is not claimed, but check if there is a claimed cache partition - if ($phyDisk) - { - # If the partition is claimed, the device guid on the path - # will be the cache partition guid - $cachePartTypeGuid = [Microsoft.SFS.StorageBusCache.DeviceMgmt]::PARTITION_SBL_CACHE_SSD_GUID.Guid - $partGuid = (Get-Disk -Number $phyDisk.DeviceId | Get-Partition | ? GptType -match $cachePartTypeGuid).Guid - if ($partGuid) - { - $path = $paths | ? DeviceGuid -Match $partGuid | Select-Object -First 1 - } - } - } - - if ($path) - { - if (-not $phyDisk) - { - # Set properties based on SBL path information since - # device is claimed but not exposed above SBL - $devices[$deviceGuid].BusType = $path.BusType - $devices[$deviceGuid].Number = $path.DeviceNumber - } - - # The following properties are SBL specific - if (($path.Attributes -band [Microsoft.SFS.StorageBusCache.ClusBflt.PathInfoAttribute]::Partition) -eq 0) - { - # Path does not correspond to cache partition from an unclaimed device - $devices[$deviceGuid].IsClaimed = $true - } - - if (($path.Attributes -band [Microsoft.SFS.StorageBusCache.ClusBflt.PathInfoAttribute]::Solid) -ne 0) - { - $devices[$deviceGuid].IsCache = $true - } - else - { - $devices[$deviceGuid].IsCache = $false - } - } - } - - [Microsoft.SFS.StorageBusCache.StorageBusDisk[]]$disks = @() - - # Enumerate the paths based on input - switch ($psCmdlet.ParameterSetName) - { - "ByGuid" - { - $disks = $devices.Values | ? Guid -match $Guid - break; - } - "ByNumber" - { - $disks = $devices.Values | ? Number -eq $Number - break; - } - "ByPhysicalDisk" - { - $diskGuid = $PhysicalDisk.ObjectId -Replace '.*:' -Replace '"' - $disks = $devices.Values | ? Guid -match $diskGuid - break; - } - } - - return $disks -} - -function Get-StorageBusBinding -{ - [CmdletBinding(ConfirmImpact="None")] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'ByGuid', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("Id")] - $Guid, - - [System.UInt16] - [Parameter( - ParameterSetName = 'ByNumber', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $Number, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $PhysicalDisk - - ) - - switch ($psCmdlet.ParameterSetName) - { - "ByGuid" { $devices = Get-StorageBusDisk -Guid $Guid; break; } - "ByNumber" { $devices = Get-StorageBusDisk -Number $Number; break; } - "ByPhysicalDisk" { $devices = Get-StorageBusDisk -Number $PhysicalDisk.DeviceId; break; } - } - - $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods - $paths = $(gwmi -namespace "root\wmi" ClusBfltDeviceInformation).PathInfo - $cs = gwmi -namespace "root\wmi" ClusBfltCacheStoresInformation - - [Microsoft.SFS.StorageBusCache.StorageBusBinding[]]$boundDevices = @() - - try - { - foreach ($device in $devices) - { - if ($device.IsCache) - { - $pathid = $pm.GetPathIdByDeviceGuid($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Read_Write, 0, 0, 0) - - if ($pathid.PathId -eq 0) - { - # This could be unclaimed cache device with claimed cache partition - $pathid.PathId = ($paths | ? DeviceNumber -eq $device.Number).Id - } - - if ($pathid.PathId -ne 0) - { - $cache = $cs.CacheStoreInfo | ? PathId -eq $pathid.PathId - - if ($cache) - { - $bindingRecords = $pm.QuerySsdBindingRecords($pathid.PathId, $cache.Id) - - foreach ($bindingRecord in $bindingRecords.BindingRecords.BindingRecords) - { - if (($bindingRecord.Flags -band [Microsoft.SFS.StorageBusCache.ClusBflt.CacheStoreBindingAttribute]::Enabled) -ne 0) - { - $boundDevice = Get-StorageBusDisk -Guid $bindingRecord.DeviceGuid - - [Microsoft.SFS.StorageBusCache.StorageBusBinding]$storageBusBinding = [Microsoft.SFS.StorageBusCache.StorageBusBinding]::new() - $storageBusBinding.Guid = $boundDevice.Guid - $storageBusBinding.Number = $boundDevice.Number - $storageBusBinding.IsCache = $boundDevice.IsCache - - $boundDevices += $storageBusBinding - } - } - } - } - } - else - { - $egPath = $pm.GetPathIdByDeviceGuid($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Engaged, 0, 0, 0) - if ($egPath.PathId -ne 0) - { - $hddBinding = $pm.QueryHddBinding($egPath.PathId) - $cache = $cs.CacheStoreInfo | ? Id -eq $hddBinding.BindingInfo.CacheStoreId - $cachePath = $paths | ? Id -eq $cache.PathId - $boundDevice = Get-StorageBusDisk -Guid $cachePath.DeviceGuid - if (-not $boundDevice) - { - # This could be unclaimed cache device with claimed cache partition - $boundDevice = Get-StorageBusDisk -Number $cachePath.DeviceNumber - } - - [Microsoft.SFS.StorageBusCache.StorageBusBinding]$storageBusBinding = [Microsoft.SFS.StorageBusCache.StorageBusBinding]::new() - $storageBusBinding.Guid = $boundDevice.Guid - $storageBusBinding.Number = $boundDevice.Number - $storageBusBinding.IsCache = $boundDevice.IsCache - - $boundDevices += $storageBusBinding - } - } - } - } - catch - { - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - $psCmdlet.WriteError($errorObject) - return - } - - $boundDevices -} - -function Enable-StorageBusDisk -{ - [CmdletBinding(ConfirmImpact="None")] - param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'ByGuid', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("Id")] - $Guid, - - [System.UInt16] - [Parameter( - ParameterSetName = 'ByNumber', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $Number, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $PhysicalDisk - ) - - if (IsS2DEnabled) - { - $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` - -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` - -Exception $null ` - -TargetObject $null - $psCmdlet.WriteError($errorObject) - return - } - - switch ($psCmdlet.ParameterSetName) - { - "ByGuid" { $devices = Get-StorageBusDisk -Guid $Guid; break; } - "ByNumber" { $devices = Get-StorageBusDisk -Number $Number; break; } - "ByPhysicalDisk" { $devices = Get-StorageBusDisk -Number $PhysicalDisk.DeviceId; break; } - } - - # Filter out claimed devices - $devices = $devices | ? IsClaimed -eq $false - - $dm = gwmi -namespace "root\wmi" ClusBfltDeviceMethods - - foreach ($device in $devices) - { - try - { - # Have clusbflt claim the drive - $dm.SetDeviceAttributes($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::Default, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) - - # Reauction the disk - $devicePath = "\\?\Disk" + $device.Guid - [Microsoft.SFS.StorageBusCache.DeviceMgmt]::ReauctionDevice($devicePath) | Out-Null - } - catch - { - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - $psCmdlet.WriteError($errorObject) - return - } - } -} - -function Disable-StorageBusDisk -{ - [CmdletBinding(ConfirmImpact="High")] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'ByGuid', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("Id")] - $Guid, - - [System.UInt16] - [Parameter( - ParameterSetName = 'ByNumber', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $Number, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $PhysicalDisk - ) - - if (IsS2DEnabled) - { - $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` - -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` - -Exception $null ` - -TargetObject $null - $psCmdlet.WriteError($errorObject) - return - } - - switch ($psCmdlet.ParameterSetName) - { - "ByGuid" { $devices = Get-StorageBusDisk -Guid $Guid; break; } - "ByNumber" { $devices = Get-StorageBusDisk -Number $Number; break; } - "ByPhysicalDisk" { $devices = Get-StorageBusDisk -Number $PhysicalDisk.DeviceId; break; } - } - - # Filter out unclaimed devices - $devices = $devices | ? IsClaimed -eq $true - - $dm = gwmi -namespace "root\wmi" ClusBfltDeviceMethods - $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods - - foreach ($device in $devices) - { - if ($device.IsCache) - { - # First unbind all bound capacity devices - $boundDevices = Get-StorageBusBinding -Guid $device.Guid - if ($boundDevices) - { - $errorObject = CreateErrorRecord -ErrorId "InvalidOperation" ` - -ErrorMessage "Cache device is currently bound" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` - -Exception $null ` - -TargetObject $null - $psCmdlet.WriteError($errorObject) - return - } - } - else - { - # Remove bindings from cache and capacity dev - Remove-StorageBusBinding -Guid $device.Guid - } - - try - { - # Have clusbflt unclaim the drive - $dm.SetDeviceAttributes($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::Disabled, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) - - # Reauction the disk - $devicePath = "\\?\Disk" + $device.Guid - [Microsoft.SFS.StorageBusCache.DeviceMgmt]::ReauctionDevice($devicePath) | Out-Null - } - catch - { - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - $psCmdlet.WriteError($errorObject) - return - } - } -} - -function Resume-StorageBusDisk -{ - [CmdletBinding(ConfirmImpact="Low")] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'ByGuid', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("Id")] - $Guid, - - [System.UInt16] - [Parameter( - ParameterSetName = 'ByNumber', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $Number, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $PhysicalDisk - ) - - if (IsS2DEnabled) - { - $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` - -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` - -Exception $null ` - -TargetObject $null - $psCmdlet.WriteError($errorObject) - return - } - - switch ($psCmdlet.ParameterSetName) - { - "ByGuid" { $devices = Get-StorageBusDisk -Guid $Guid; break; } - "ByNumber" { $devices = Get-StorageBusDisk -Number $Number; break; } - "ByPhysicalDisk" { $devices = Get-StorageBusDisk -Number $PhysicalDisk.DeviceId; break; } - } - - $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods - $paths = $(gwmi -namespace "root\wmi" ClusBfltDeviceInformation).PathInfo - - foreach ($device in $devices) - { - if ($device.IsCache) - { - # First resume all bound capacity devices - $boundDevices = Get-StorageBusBinding -Guid $device.Guid - foreach ($boundDevice in $boundDevices) - { - Resume-StorageBusDisk -Guid $boundDevice.Guid - } - } - else - { - try - { - $egPath = $pm.GetPathIdByDeviceGuid($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Engaged, 0, 0, 0) - if ($egPath.PathId -ne 0) - { - # Obtain the capacity device binding info - $binding = $pm.QueryHddBinding($egPath.PathId).BindingInfo - - # Obtain the cache store - $cs = gwmi -namespace "root\wmi" ClusBfltCacheStoresInformation - $cache = $cs.CacheStoreInfo | ? Id -Match $binding.CacheStoreId - - # Obtain binding record that matches binding Id - $bindingRecord = $pm.QuerySsdBindingRecords($cache.PathId, $cache.Id).BindingRecords.BindingRecords | ? BindingId -Match $binding.BindingId - - if ($bindingRecord -ne $null) - { - # Set cache binding attribute back to default - $pm.SetSsdBindingAttributes($cache.PathId, [Microsoft.SFS.StorageBusCache.ClusBflt.CacheStoreBindingAttribute]::Default, [Microsoft.SFS.StorageBusCache.ClusBflt.CacheStoreBindingAttribute]::Disable_Write_Cache, $cache.Id, $binding.BindingId) - } - } - } - catch - { - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - $psCmdlet.WriteError($errorObject) - return - } - } - } -} - -function Suspend-StorageBusDisk -{ - [CmdletBinding(ConfirmImpact="High")] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'ByGuid', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("Id")] - $Guid, - - [System.UInt16] - [Parameter( - ParameterSetName = 'ByNumber', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $Number, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $PhysicalDisk - ) - - if (IsS2DEnabled) - { - $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` - -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` - -Exception $null ` - -TargetObject $null - $psCmdlet.WriteError($errorObject) - return - } - - switch ($psCmdlet.ParameterSetName) - { - "ByGuid" { $devices = Get-StorageBusDisk -Guid $Guid; break; } - "ByNumber" { $devices = Get-StorageBusDisk -Number $Number; break; } - "ByPhysicalDisk" { $devices = Get-StorageBusDisk -Number $PhysicalDisk.DeviceId; break; } - } - - $dm = gwmi -namespace "root\wmi" ClusBfltDeviceMethods - $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods - - foreach ($device in $devices) - { - if ($device.IsCache) - { - # First suspend all bound capacity devices - $boundDevices = Get-StorageBusBinding -Guid $device.Guid - foreach ($boundDevice in $boundDevices) - { - Suspend-StorageBusDisk -Guid $boundDevice.Guid - } - } - else - { - try - { - $egPath = $pm.GetPathIdByDeviceGuid($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Engaged, 0, 0, 0) - if ($egPath.PathId -ne 0) - { - # Obtain the capacity device binding info - $binding = $pm.QueryHddBinding($egPath.PathId).BindingInfo - - # Obtain the cache store - $cs = gwmi -namespace "root\wmi" ClusBfltCacheStoresInformation - $cache = $cs.CacheStoreInfo | ? Id -Match $binding.CacheStoreId - - # Obtain binding record that matches binding Id - $bindingRecord = $pm.QuerySsdBindingRecords($cache.PathId, $cache.Id).BindingRecords.BindingRecords | ? BindingId -Match $binding.BindingId - - if ($bindingRecord -ne $null -and ($bindingRecord.Flags -band [Microsoft.SFS.StorageBusCache.ClusBflt.CacheStoreBindingAttribute]::Enabled) -ne 0) - { - # Disable Write cache - $pm.SetSsdBindingAttributes($cache.PathId, [Microsoft.SFS.StorageBusCache.ClusBflt.CacheStoreBindingAttribute]::Disable_Write_Cache, [Microsoft.SFS.StorageBusCache.ClusBflt.CacheStoreBindingAttribute]::Disable_Write_Cache, $cache.Id, $binding.BindingId) - - # Wait for dirty page count to go down to 0 for this cache binding - while ($true) - { - if ($bindingRecord.cDirtyPages -eq 0 -and $bindingRecord.cDirtySlots -eq 0) - { - break - } - Start-Sleep -Seconds 10 - $bindingRecord = $pm.QuerySsdBindingRecords($cache.PathId, $cache.Id).BindingRecords.BindingRecords | ? BindingId -Match $binding.BindingId - } - } - } - } - catch - { - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - $psCmdlet.WriteError($errorObject) - return - } - } - } -} - -function New-StorageBusCacheStore -{ - [CmdletBinding(ConfirmImpact="Low")] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'ByGuid', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("Id")] - $Guid, - - [System.String] - [Parameter( - ParameterSetName = 'ByNumber', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $Number, - - #### -------------------- Common parameters -------------------------------------#### - - [System.UInt32] - [Parameter( - ParameterSetName = 'ByGuid', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByNumber', - Mandatory = $false)] - $PageSize = 8KB, - - [System.UInt64] - [Parameter( - ParameterSetName = 'ByGuid', - Mandatory = $false)] - [Parameter( - ParameterSetName = 'ByNumber', - Mandatory = $false)] - $ReserveCapacity = 0 - ) - - if (IsS2DEnabled) - { - $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` - -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` - -Exception $null ` - -TargetObject $null - $psCmdlet.WriteError($errorObject) - return - } - - switch ($psCmdlet.ParameterSetName) - { - "ByGuid" { $cacheDevice = Get-StorageBusDisk -Guid $Guid; break; } - "ByNumber" { $cacheDevice = Get-StorageBusDisk -Number $Number; break; } - } - - # Filter out unclaimed devices - $cacheDevice = $cacheDevice | ? IsClaimed -eq $true - - $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods - $dm = gwmi -namespace "root\wmi" ClusBfltDeviceMethods - - # Ensure exactly one cache device is obtained - if (-not $cacheDevice) - { - $errorObject = CreateErrorRecord -ErrorId "NotFound" ` - -ErrorMessage "Specified cache device not found" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - if ($cacheDevice.Count -ne 1) - { - $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` - -ErrorMessage "More than one matching cache device found" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - if (-not $cacheDevice.IsCache) - { - $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` - -ErrorMessage "Not a cache device" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - - $deviceAttributes = $dm.GetDeviceAttributes($cacheDevice.Guid) - - try - { - # Create cache store - $dm.SetDeviceAttributes($cacheDevice.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::Maintenance, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) - - $mmPath = $pm.GetPathIdByDeviceGuid($cacheDevice.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Maintenance, 0, 0, 0) - if ($mmPath) - { - $pm.CreateSsdCacheStore($mmPath.PathId, 0, $ReserveCapacity, $PageSize) - } - else - { - $errorObject = CreateErrorRecord -ErrorId "NotFound" ` - -ErrorMessage "Device path not found after setting Maintenance mode" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` - -Exception $null ` - -TargetObject $null - $psCmdlet.WriteError($errorObject) - return - } - } - catch - { - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - $psCmdlet.WriteError($errorObject) - return - } - finally - { - $dm.SetDeviceAttributes($cacheDevice.Guid, $deviceAttributes.Attributes, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) - } -} - -function New-StorageBusBinding -{ - [CmdletBinding(ConfirmImpact="Low")] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'ByGuid', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("CacheId")] - $CacheGuid, - - [System.String] - [Parameter( - ParameterSetName = 'ByGuid', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("CapacityId")] - $CapacityGuid, - - [System.String] - [Parameter( - ParameterSetName = 'ByNumber', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $CacheNumber, - - [System.String] - [Parameter( - ParameterSetName = 'ByNumber', - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $CapacityNumber - ) - - if (IsS2DEnabled) - { - $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` - -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` - -Exception $null ` - -TargetObject $null - $psCmdlet.WriteError($errorObject) - return - } - - switch ($psCmdlet.ParameterSetName) - { - "ByGuid" { $cacheDevice = Get-StorageBusDisk -Guid $CacheGuid; $capacityDevice = Get-StorageBusDisk -Guid $CapacityGuid; break; } - "ByNumber" { $cacheDevice = Get-StorageBusDisk -Number $CacheNumber; $capacityDevice = Get-StorageBusDisk -Number $CapacityNumber; break; } - } - - # Filter out unclaimed devices - $capacityDevice = $capacityDevice | ? IsClaimed -eq $true - - # Ensure exactly one cache device is obtained - if (-not $cacheDevice) - { - $errorObject = CreateErrorRecord -ErrorId "NotFound" ` - -ErrorMessage "Specified cache device not found" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - if ($cacheDevice.Count -ne 1) - { - $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` - -ErrorMessage "More than one matching cache device found" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - if (-not $cacheDevice.IsCache) - { - $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` - -ErrorMessage "Not a cache device" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - - # Ensure exactly one capacity device is obtained - if (-not $capacityDevice) - { - $errorObject = CreateErrorRecord -ErrorId "NotFound" ` - -ErrorMessage "Specified capacity device not found" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - if ($capacityDevice.Count -ne 1) - { - $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` - -ErrorMessage "More than one matching capacity device found" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - if ($capacityDevice.IsCache) - { - $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` - -ErrorMessage "Not a capacity device" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` - -Exception $null ` - -TargetObject $null - - $psCmdlet.WriteError($errorObject) - return - } - - $dm = gwmi -namespace "root\wmi" ClusBfltDeviceMethods - $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods - $cs = gwmi -namespace "root\wmi" ClusBfltCacheStoresInformation - $paths = $(gwmi -namespace "root\wmi" ClusBfltDeviceInformation).PathInfo - - $deviceAttributes = $dm.GetDeviceAttributes($capacityDevice.Guid) - - try - { - # Obtain the cache store - $cache = $cs.CacheStoreInfo | ? DeviceGuid -Match $cacheDevice.Guid - - if ($cache -eq $null) - { - # This could be unclaimed cache device with claimed cache partition - $cachePath = $paths | ? DeviceNumber -eq $cacheDevice.Number - if ($cachePath) - { - $cache = $cs.CacheStoreInfo | ? DeviceGuid -Match $cachePath.DeviceGuid - } - } - - if ($cache -eq $null) - { - # No cache store found so create cache store - New-StorageBusCacheStore -Guid $cacheDevice.Guid -PageSize 8KB -ReserveCapacity 32GB - - # Obtain the cache store - $cs = gwmi -namespace "root\wmi" ClusBfltCacheStoresInformation - $cache = $cs.CacheStoreInfo | ? DeviceGuid -Match $cacheDevice.Guid - - if (-not $cache) - { - $errorObject = CreateErrorRecord -ErrorId "NotFound" ` - -ErrorMessage "No cache store found on cache device " + $cacheDevice.Guid ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` - -Exception $null ` - -TargetObject $null - $psCmdlet.WriteError($errorObject) - return - } - } - - # Check if the capacity device is already bound - $egPath = $pm.GetPathIdByDeviceGuid($capacityDevice.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Engaged, 0, 0, 0) - if ($egPath.PathId -eq 0) - { - # Bind Capacity device to cache store - $dm.SetDeviceAttributes($capacityDevice.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::Maintenance, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) - $mmPath = $pm.GetPathIdByDeviceGuid($capacityDevice.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Maintenance, 0, 0, 0) - - if ($mmPath.PathId -ne 0) - { - $pm.PrepareHddForCache($mmPath.PathId, 0) - $pm.BindHddToCacheStore($mmPath.PathId, [Microsoft.SFS.StorageBusCache.DeviceMgmt]::Standalone_Cache_Binding_Attributes, $cache.Id) - } - else - { - $errorObject = CreateErrorRecord -ErrorId "NotFound" ` - -ErrorMessage "Device path not found after setting Maintenance mode" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` - -Exception $null ` - -TargetObject $null - $psCmdlet.WriteError($errorObject) - return - } - } - else - { - $errorObject = CreateErrorRecord -ErrorId "InvalidOperation" ` - -ErrorMessage "Capacity device is already bound" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` - -Exception $null ` - -TargetObject $null - $psCmdlet.WriteError($errorObject) - return - } - } - catch - { - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - $psCmdlet.WriteError($errorObject) - return - } - finally - { - $dm.SetDeviceAttributes($capacityDevice.Guid, $deviceAttributes.Attributes, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) - } -} - -function Remove-StorageBusBinding -{ - [CmdletBinding(ConfirmImpact="High")] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'ByGuid', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("Id")] - $Guid, - - [System.UInt16] - [Parameter( - ParameterSetName = 'ByNumber', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $Number, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $PhysicalDisk - ) - - if (IsS2DEnabled) - { - $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` - -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` - -Exception $null ` - -TargetObject $null - $psCmdlet.WriteError($errorObject) - return - } - - switch ($psCmdlet.ParameterSetName) - { - "ByGuid" { $devices = Get-StorageBusDisk -Guid $Guid; break; } - "ByNumber" { $devices = Get-StorageBusDisk -Number $Number; break; } - "ByPhysicalDisk" { $devices = Get-StorageBusDisk -Number $PhysicalDisk.DeviceId; break; } - } - - # Filter out unclaimed devices - $devices = $devices | ? IsClaimed -eq $true - - $dm = gwmi -namespace "root\wmi" ClusBfltDeviceMethods - $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods - - foreach ($device in $devices) - { - if ($device.IsCache) - { - # First unbind all bound capacity devices - $boundDevices = Get-StorageBusBinding -Guid $device.Guid - foreach ($boundDevice in $boundDevices) - { - Remove-StorageBusBinding -Guid $boundDevice.Guid - } - } - else - { - try - { - $deviceAttributes = $dm.GetDeviceAttributes($device.Guid) - - $egPath = $pm.GetPathIdByDeviceGuid($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Engaged, 0, 0, 0) - if ($egPath.PathId -ne 0) - { - # Disable write cache and drain IOs - Suspend-StorageBusDisk -Guid $device.Guid - - # Unbind HDD - $dm.SetDeviceAttributes($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::Maintenance, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) - $mmPath = $pm.GetPathIdByDeviceGuid($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Maintenance, 0, 0, 0) - if ($mmPath.PathId -ne 0) - { - $pm.UnBindHdd($mmPath.PathId, 0) - } - else - { - $errorObject = CreateErrorRecord -ErrorId "NotFound" ` - -ErrorMessage "Device path not found after setting Maintenance mode" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` - -Exception $null ` - -TargetObject $null - $psCmdlet.WriteError($errorObject) - return - } - } - } - catch - { - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - $psCmdlet.WriteError($errorObject) - return - } - finally - { - $dm.SetDeviceAttributes($device.Guid, $deviceAttributes.Attributes, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) - } - } - } -} - -function Clear-StorageBusDisk -{ - [CmdletBinding(ConfirmImpact="High")] - Param - ( - #### -------------------- Parameter sets -------------------------------------#### - - [System.String] - [Parameter( - ParameterSetName = 'ByGuid', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [Alias("Id")] - $Guid, - - [System.UInt16] - [Parameter( - ParameterSetName = 'ByNumber', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $Number, - - [Microsoft.Management.Infrastructure.CimInstance] - [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] - [Parameter( - ParameterSetName = 'ByPhysicalDisk', - ValueFromPipeline = $true, - Mandatory = $true)] - [ValidateNotNullOrEmpty()] - $PhysicalDisk - ) - - if (IsS2DEnabled) - { - $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` - -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` - -Exception $null ` - -TargetObject $null - $psCmdlet.WriteError($errorObject) - return - } - - switch ($psCmdlet.ParameterSetName) - { - "ByGuid" { $devices = Get-StorageBusDisk -Guid $Guid; break; } - "ByNumber" { $devices = Get-StorageBusDisk -Number $Number; break; } - "ByPhysicalDisk" { $devices = Get-StorageBusDisk -Number $PhysicalDisk.DeviceId; break; } - } - - # Filter out unclaimed devices - $devices = $devices | ? IsClaimed -eq $true - - $dm = gwmi -namespace "root\wmi" ClusBfltDeviceMethods - $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods - - foreach ($device in $devices) - { - $deviceAttributes = $dm.GetDeviceAttributes($device.Guid) - - try - { - $dm.SetDeviceAttributes($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::Maintenance, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) - $mmPath = $pm.GetPathIdByDeviceGuid($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Maintenance, 0, 0, 0) - - if ($mmPath.PathId -ne 0) - { - # Remove all cache partitions on the disk - $devicePath = "\\?\Disk" + $device.Guid - [Microsoft.SFS.StorageBusCache.DeviceMgmt]::CleanupSblCachePartitions($devicePath) | Out-Null - } - else - { - $errorObject = CreateErrorRecord -ErrorId "NotFound" ` - -ErrorMessage "Device path not found after setting Maintenance mode" ` - -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` - -Exception $null ` - -TargetObject $null - $psCmdlet.WriteError($errorObject) - return - } - } - catch - { - $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` - -ErrorMessage $null ` - -ErrorCategory $_.CategoryInfo.Category ` - -Exception $_.Exception ` - -TargetObject $_.TargetObject - $psCmdlet.WriteError($errorObject) - return - } - finally - { - $dm.SetDeviceAttributes($device.Guid, $deviceAttributes.Attributes, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) - } - } -} diff --git a/newton-cn/bin/Modules/StorageBusCache/StorageBusCache.types.ps1xml b/newton-cn/bin/Modules/StorageBusCache/StorageBusCache.types.ps1xml deleted file mode 100644 index 1e2fd8e..0000000 --- a/newton-cn/bin/Modules/StorageBusCache/StorageBusCache.types.ps1xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - StorageBusDisk - - - DiskNumber - Number - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/TLS/tls.psd1 b/newton-cn/bin/Modules/TLS/tls.psd1 deleted file mode 100644 index cbd26a5..0000000 --- a/newton-cn/bin/Modules/TLS/tls.psd1 +++ /dev/null @@ -1,25 +0,0 @@ -@{ -GUID="{1E28C697-2370-42F2-ACE1-5AC8777F8053}" -Author="Microsoft Corporation" -CompanyName="Microsoft Corporation" -Copyright="© Microsoft Corporation. All rights reserved." -ModuleVersion="2.0.0.0" -PowerShellVersion="5.1" -CLRVersion="4.0" -ModuleToProcess="Microsoft.WindowsAuthenticationProtocols.Commands" -HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=287167" -CmdletsToExport= - "New-TlsSessionTicketKey", - "Enable-TlsSessionTicketKey", - "Disable-TlsSessionTicketKey", - "Export-TlsSessionTicketKey", - "Get-TlsCipherSuite", - "Enable-TlsCipherSuite", - "Disable-TlsCipherSuite", - "Get-TlsEccCurve", - "Enable-TlsEccCurve", - "Disable-TlsEccCurve" -CompatiblePSEditions= - "Core", - "Desktop" -} diff --git a/newton-cn/bin/Modules/TroubleshootingPack/TroubleshootingPack.format.ps1xml b/newton-cn/bin/Modules/TroubleshootingPack/TroubleshootingPack.format.ps1xml deleted file mode 100644 index 9ff58bb..0000000 --- a/newton-cn/bin/Modules/TroubleshootingPack/TroubleshootingPack.format.ps1xml +++ /dev/null @@ -1,383 +0,0 @@ - - - - DiagPack - - Microsoft.Windows.Diagnosis.DiagPack - - - - - - 25 - left - - - - 40 - left - - - - 40 - left - - - - 15 - left - - - - - - - Id - - - Name - - - Publisher - - - Version - - - - - - - - DiagRootCause - - Microsoft.Windows.Diagnosis.DiagRootCause - - - - - - 120 - left - - - - - - - Name - - - - - - - - DiagRootCause - - Microsoft.Windows.Diagnosis.DiagRootCause - - - - - - 120 - left - - - - - - - Name - - - - - - - - DiagResolution - - Microsoft.Windows.Diagnosis.DiagResolution - - - - - - 75 - left - - - - 10 - left - - - - 15 - left - - - - 20 - left - - - - - - - Name - - - Manual - - - RequiresElevation - - - RequiresInteraction - - - - - - - - DiagInteraction - - Microsoft.Windows.Diagnosis.DiagInteraction - - - - - - 85 - left - - - - 15 - left - - - - 20 - left - - - - - - - Name - - - ($_.Dynamic -eq $false) - - - AnswerType - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/TroubleshootingPack/TroubleshootingPack.psd1 b/newton-cn/bin/Modules/TroubleshootingPack/TroubleshootingPack.psd1 deleted file mode 100644 index 0e0b5e4..0000000 --- a/newton-cn/bin/Modules/TroubleshootingPack/TroubleshootingPack.psd1 +++ /dev/null @@ -1,14 +0,0 @@ -@{ - GUID="{d6fdb0d8-2b0f-406b-afc6-68f60569ebdf}" - Author="Microsoft Corporation" - CompanyName="Microsoft Corporation" - Copyright="© Microsoft Corporation. All rights reserved." - ModuleVersion="1.0.0.0" - PowerShellVersion = '5.1' - CLRVersion="4.0" - FormatsToProcess="TroubleshootingPack.Format.ps1xml" - NestedModules="Microsoft.Windows.Diagnosis.TroubleshootingPack" - HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=285571" - CmdletsToExport = "Get-TroubleshootingPack","Invoke-TroubleshootingPack" - CompatiblePSEditions = @("Desktop", "Core") -} diff --git a/newton-cn/bin/Modules/TrustedPlatformModule/TrustedPlatformModule.psd1 b/newton-cn/bin/Modules/TrustedPlatformModule/TrustedPlatformModule.psd1 deleted file mode 100644 index 7427bf4..0000000 --- a/newton-cn/bin/Modules/TrustedPlatformModule/TrustedPlatformModule.psd1 +++ /dev/null @@ -1,26 +0,0 @@ -@{ -GUID="{17fc1f02-cff3-45fb-ac4f-126594c70b1e}" -Author="Microsoft Corporation" -CompanyName="Microsoft Corporation" -Copyright="© Microsoft Corporation. All rights reserved." -ModuleVersion="2.0.0.0" -ModuleToProcess="Microsoft.Tpm.Commands" -PowerShellVersion = '5.1' -CLRVersion="4.0" -AliasesToExport = @() -FunctionsToExport = @() -CmdletsToExport= - "Get-Tpm", - "Initialize-Tpm", - "Clear-Tpm", - "Unblock-Tpm", - "Enable-TpmAutoProvisioning", - "Disable-TpmAutoProvisioning", - "Import-TpmOwnerAuth", - "Set-TpmOwnerAuth", - "ConvertTo-TpmOwnerAuth", - "Get-TpmEndorsementKeyInfo", - "Get-TpmSupportedFeature" -HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=390838" -CompatiblePSEditions = @('Desktop','Core') -} diff --git a/newton-cn/bin/Modules/UEV/Microsoft.Uev.Commands.dll b/newton-cn/bin/Modules/UEV/Microsoft.Uev.Commands.dll deleted file mode 100644 index 1f5a569..0000000 Binary files a/newton-cn/bin/Modules/UEV/Microsoft.Uev.Commands.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/UEV/UEV.Types.ps1xml b/newton-cn/bin/Modules/UEV/UEV.Types.ps1xml deleted file mode 100644 index 120e8c8..0000000 --- a/newton-cn/bin/Modules/UEV/UEV.Types.ps1xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - Microsoft.Uev.Commands.Template - - - PsStandardMembers - - - DefaultDisplayProperty - TemplateName - - - DefaultDisplayPropertySet - - TemplateId - TemplateName - TemplateDescription - TemplateVersion - TemplateType - Enabled - EnableStateLocation - TemplateProfile - - - - - - - diff --git a/newton-cn/bin/Modules/UEV/UEV.psd1 b/newton-cn/bin/Modules/UEV/UEV.psd1 deleted file mode 100644 index 9c19fa1..0000000 Binary files a/newton-cn/bin/Modules/UEV/UEV.psd1 and /dev/null differ diff --git a/newton-cn/bin/Modules/VpnClient/PS_EapConfiguration_v1.0.0.cdxml b/newton-cn/bin/Modules/VpnClient/PS_EapConfiguration_v1.0.0.cdxml deleted file mode 100644 index 2c7cfb0..0000000 --- a/newton-cn/bin/Modules/VpnClient/PS_EapConfiguration_v1.0.0.cdxml +++ /dev/null @@ -1,165 +0,0 @@ - - - - 1.0.0 - EapConfiguration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Pap - Chap - MSChap - MSChapv2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionIPsecConfiguration_v1.0.cdxml b/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionIPsecConfiguration_v1.0.cdxml deleted file mode 100644 index 2d998a2..0000000 --- a/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionIPsecConfiguration_v1.0.cdxml +++ /dev/null @@ -1,192 +0,0 @@ - - - - 1.0 - VpnConnectionIPsecConfiguration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionProxy_v1.0.cdxml b/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionProxy_v1.0.cdxml deleted file mode 100644 index 746a58e..0000000 --- a/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionProxy_v1.0.cdxml +++ /dev/null @@ -1,72 +0,0 @@ - - - - 1.0 - VpnConnectionProxy - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionRoute_v1.0.cdxml b/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionRoute_v1.0.cdxml deleted file mode 100644 index 8bcc14c..0000000 --- a/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionRoute_v1.0.cdxml +++ /dev/null @@ -1,112 +0,0 @@ - - - - 1.0 - VpnConnectionRoute - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionTriggerApplication_v1.0.cdxml b/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionTriggerApplication_v1.0.cdxml deleted file mode 100644 index aa8a630..0000000 --- a/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionTriggerApplication_v1.0.cdxml +++ /dev/null @@ -1,99 +0,0 @@ - - - - 1.0 - VpnConnectionTriggerApplication - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionTriggerDnsConfiguration_v1.0.cdxml b/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionTriggerDnsConfiguration_v1.0.cdxml deleted file mode 100644 index 28ef9a7..0000000 --- a/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionTriggerDnsConfiguration_v1.0.cdxml +++ /dev/null @@ -1,162 +0,0 @@ - - - - 1.0 - VpnConnectionTriggerDnsConfiguration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionTriggerTrustedNetwork_v1.0.cdxml b/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionTriggerTrustedNetwork_v1.0.cdxml deleted file mode 100644 index 8ade665..0000000 --- a/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionTriggerTrustedNetwork_v1.0.cdxml +++ /dev/null @@ -1,144 +0,0 @@ - - - - 1.0 - VpnConnectionTriggerTrustedNetwork - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionTrigger_v1.0.cdxml b/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionTrigger_v1.0.cdxml deleted file mode 100644 index 5b03745..0000000 --- a/newton-cn/bin/Modules/VpnClient/PS_VpnConnectionTrigger_v1.0.cdxml +++ /dev/null @@ -1,33 +0,0 @@ - - - - 1.0 - VpnConnectionTrigger - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/VpnClient/PS_VpnConnection_v1.0.0.cdxml b/newton-cn/bin/Modules/VpnClient/PS_VpnConnection_v1.0.0.cdxml deleted file mode 100644 index 517b729..0000000 --- a/newton-cn/bin/Modules/VpnClient/PS_VpnConnection_v1.0.0.cdxml +++ /dev/null @@ -1,590 +0,0 @@ - - - - 1.0.0 - VpnConnection - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Pptp - L2tp - Sstp - Ikev2 - Automatic - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Pap - Chap - MSChapv2 - Eap - MachineCertificate - - - - - - - - - - NoEncryption - Optional - Required - Maximum - Custom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Pptp - L2tp - Sstp - Ikev2 - Automatic - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Pap - Chap - MSChapv2 - Eap - MachineCertificate - - - - - - - - - - - - - - - - - - - - - - - - NoEncryption - Optional - Required - Maximum - Custom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - enable - disable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/VpnClient/PS_VpnServerAddress_v1.0.cdxml b/newton-cn/bin/Modules/VpnClient/PS_VpnServerAddress_v1.0.cdxml deleted file mode 100644 index 6599b99..0000000 --- a/newton-cn/bin/Modules/VpnClient/PS_VpnServerAddress_v1.0.cdxml +++ /dev/null @@ -1,40 +0,0 @@ - - - - 1.0 - VpnServerAddress - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/VpnClient/VpnClient.psd1 b/newton-cn/bin/Modules/VpnClient/VpnClient.psd1 deleted file mode 100644 index 0e11689..0000000 --- a/newton-cn/bin/Modules/VpnClient/VpnClient.psd1 +++ /dev/null @@ -1,20 +0,0 @@ -@{ - GUID = '3389cc73-daa3-4d25-bd50-b1730925d2df' - Author = 'Microsoft Corporation' - CompanyName = 'Microsoft Corporation' - Copyright = '© Microsoft Corporation. All rights reserved.' - ModuleVersion = '2.0.0.0' - PowerShellVersion = '5.1' - - FormatsToProcess = 'VpnClientPsProvider.Format.ps1xml' - TypesToProcess = 'VpnClientPSProvider.Types.ps1xml' - - HelpInfoUri="http://go.microsoft.com/fwlink/?linkid=390842" - - NestedModules = @("PS_VpnConnection_v1.0.0.cdxml", "PS_EapConfiguration_v1.0.0.cdxml", "PS_VpnConnectionProxy_v1.0.cdxml", "PS_VpnServerAddress_v1.0.cdxml", "PS_VpnConnectionRoute_v1.0.cdxml", "PS_VpnConnectionIPsecConfiguration_v1.0.cdxml", "PS_VpnConnectionTrigger_v1.0.cdxml", "PS_VpnConnectionTriggerApplication_v1.0.cdxml","PS_VpnConnectionTriggerDnsConfiguration_v1.0.cdxml","PS_VpnConnectionTriggerTrustedNetwork_v1.0.cdxml") - - AliasesToExport = @() - CmdletsToExport = @() - FunctionsToExport = @("Add-VpnConnection", "Set-VpnConnection", "Remove-VpnConnection", "Get-VpnConnection", "New-EapConfiguration", "Set-VpnConnectionProxy", "New-VpnServerAddress", "Add-VpnConnectionRoute", "Remove-VpnConnectionRoute", "Set-VpnConnectionIPsecConfiguration", "Add-VpnConnectionTriggerApplication","Remove-VpnConnectionTriggerApplication","Add-VpnConnectionTriggerDnsConfiguration","Remove-VpnConnectionTriggerDnsConfiguration","Set-VpnConnectionTriggerDnsConfiguration", "Get-VpnConnectionTrigger", "Add-VpnConnectionTriggerTrustedNetwork", "Remove-VpnConnectionTriggerTrustedNetwork", "Set-VpnConnectionTriggerTrustedNetwork") - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/VpnClient/VpnClientPSProvider.Format.ps1xml b/newton-cn/bin/Modules/VpnClient/VpnClientPSProvider.Format.ps1xml deleted file mode 100644 index 9d60f7b..0000000 --- a/newton-cn/bin/Modules/VpnClient/VpnClientPSProvider.Format.ps1xml +++ /dev/null @@ -1,838 +0,0 @@ - - - - - - VpnCommonConfig_Table - - Microsoft.Management.Infrastructure.CimInstance#VpnCommonConfig - - - - - 15 - - - 20 - - - 15 - - - 20 - - - 20 - - - - - - - Name - - - ServerAddress - - - ProfileType - - - ConnectionStatus - - - IsAutoTriggerEnabled - - - - - - - - VpnCommonConfig_Wide - - Microsoft.Management.Infrastructure.CimInstance#VpnCommonConfig - - - - - - Name - - - - - - - VpnConnection_List - - Microsoft.Management.Infrastructure.CimInstance#VpnConnection - - - - - - - Name - - - ServerAddress - - - AllUserConnection - - - Guid - - - TunnelType - - - AuthenticationMethod - - - EncryptionLevel - - - L2tpIPsecAuth - - - UseWinlogonCredential - - - EapConfigXmlStream - - - ConnectionStatus - - - RememberCredential - - - SplitTunneling - - - DnsSuffix - - - IdleDisconnectSeconds - - - - - - - - ThirdPartyVpnConnection_List - - Microsoft.Management.Infrastructure.CimInstance#ThirdPartyVpnConnection - - - - - - - Name - - - ServerAddress - - - Guid - - - ConnectionStatus - - - RememberCredential - - - SplitTunneling - - - DnsSuffix - - - IdleDisconnectSeconds - - - PlugInApplicationID - - - CustomConfiguration - - - - - - - - EapConfiguration_List - - Microsoft.Management.Infrastructure.CimInstance#EapConfiguration - - - - - - - EapConfigXmlStream - - - - - - - - EapConfiguration_Table - - Microsoft.Management.Infrastructure.CimInstance#EapConfiguration - - - - - 80 - - - - - - - EapConfigXmlStream - - - - - - - - EapConfiguration_Wide - - Microsoft.Management.Infrastructure.CimInstance#EapConfiguration - - - - - - EapConfigXmlStream - - - - - - - VpnServerAddress_List - - Microsoft.Management.Infrastructure.CimInstance#VpnServerAddress - - - - - - - ServerAddress - - - FriendlyName - - - - - - - - VpnServerAddress_Table - - Microsoft.Management.Infrastructure.CimInstance#VpnServerAddress - - - - - 20 - - - 20 - - - - - - - ServerAddress - - - FriendlyName - - - - - - - - VpnServerAddress_Wide - - Microsoft.Management.Infrastructure.CimInstance#VpnServerAddress - - - - - - FriendlyName - - - - - - - VpnConnectionIPsecConfiguration_List - - Microsoft.Management.Infrastructure.CimInstance#VpnConnectionIPsecConfiguration - - - - - - - AuthenticationTransformConstants - - - CipherTransformConstants - - - DHGroup - - - IntegrityCheckMethod - - - PfsGroup - - - EncryptionMethod - - - - - - - - VpnConnectionIPsecConfiguration_Table - - Microsoft.Management.Infrastructure.CimInstance#VpnConnectionIPsecConfiguration - - - - - 20 - - - 20 - - - 20 - - - 20 - - - 20 - - - 20 - - - - - - - AuthenticationTransformConstants - - - CipherTransformConstants - - - DHGroup - - - IntegrityCheckMethod - - - PfsGroup - - - EncryptionMethod - - - - - - - - VpnConnectionTriggerApplication_List - - Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTriggerApplication - - - - - - - ConnectionName - - - ApplicationID - - - - - - - - VpnConnectionTriggerApplication_Table - - Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTriggerApplication - - - - - 20 - - - 20 - - - - - - - ConnectionName - - - ApplicationID - - - - - - - - VpnConnectionTriggerApplication_List - - Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTriggerApplication - - - - - - - ConnectionName - - - ApplicationID - - - - - - - - VpnConnectionTriggerTrustedNetwork_List - - Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTriggerTrustedNetwork - - - - - - - ConnectionName - - - DnsSuffix - - - - - - - - VpnConnectionTriggerTrustedNetwork_Table - - Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTriggerTrustedNetwork - - - - - 20 - - - 40 - - - - - - - ConnectionName - - - DnsSuffix - - - - - - - - VpnConnectionTriggerTrustedNetwork_Wide - - Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTriggerTrustedNetwork - - - - - - - ConnectionName - - - - - - - - VpnConnectionTriggerDnsConfiguration_Table - - Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTriggerDnsConfiguration - - - - - 20 - - - 20 - - - 40 - - - 40 - - - - - - - ConnectionName - - - DnsSuffix - - - DnsIPAddress - - - DnsSuffixSearchList - - - - - - - - MSFT_NetRoute_ListView - - Microsoft.Management.Infrastructure.CimInstance#MSFT_NetRoute - - - - - - - DestinationPrefix - - - InterfaceIndex - - - InterfaceAlias - - - AddressFamily - - - NextHop - - - Publish - - - RouteMetric - - - - Store - - - - - - - - VpnConnectionTrigger_Custom - - Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTrigger - - - - - - - - - - $outputStr = ""; - $outputStr += "ConnectionName : " + $_.ConnectionName + "`r`n"; - - $appidlist = $null - foreach($appid in $_.ApplicationID) - { - if($appidlist -ne $null) - { - $appidlist += ", " ; - } - $appidlist += $appid; - } - - if($appidlist -ne $null) - { - $outputStr += "ApplicationID : {" + $appidlist + "} `r`n"; - } - - $trustednetworklist = $null - foreach($trustednetwork in $_.TrustedNetwork) - { - if($trustednetworklist -ne $null) - { - $trustednetworklist += ", " ; - } - $trustednetworklist += $trustednetwork; - } - if($trustednetworklist -ne $null) - { - $outputStr += "TrustedNetwork : {" + $trustednetworklist + "} `r`n"; - } - - $dnssuffixsearchlist = $null - foreach($dnssearchsuffix in $_.DnsSuffixSearchList) - { - if($dnssuffixsearchlist -ne $null) - { - $dnssuffixsearchlist += ", "; - } - $dnssuffixsearchlist += $dnssearchsuffix; - } - if($dnssuffixsearchlist -ne $null) - { - $outputStr += "Dns Suffix Search List : " + $dnssuffixsearchlist + "`r`n"; - } - - if($_.dnsConfig -ne $null) - { - $dnsSuffixColWidth = 50; - $dnsServerColWidth = 50; - $spaceBtwCols = 10; - - $outputStr += "`r`n"; - $name = "Dns Suffix"; - $outputStr += $name; - $temp = $dnsSuffixColWidth + $spaceBtwCols - $name.Length; - while($temp -gt 0) - { - $outputStr += " "; - $temp = $temp - 1; - } - $outputStr += "Dns Servers `r`n"; - - $temp = 0; - while($temp -lt $dnsSuffixColWidth) - { - $outputStr += "_ "; - $temp = $temp + 2; - } - - $temp = 0; - while($temp -lt $spaceBtwCols) - { - $outputStr += " "; - $temp = $temp + 1; - } - - $temp = 0; - while($temp -lt $dnsServerColWidth) - { - $outputStr += "_ "; - $temp = $temp + 2; - } - $outputStr += "`r`n"; - - $dnsConfig = $null; - foreach($a in $_.dnsConfig) - { - $suffix = $a.DnsSuffix; - if($suffix.Length -gt 50) - { - $suffix = $suffix.Substring(0, $dnsSuffixColWidth - 3); - $suffix += "..."; - } - $dnsConfig += $suffix; - - $temp = $dnsSuffixColWidth + $spaceBtwCols - $suffix.Length; - while($temp -gt 0) - { - $dnsConfig += " "; - $temp = $temp - 1; - } - - $ipaddrlist = $null; - foreach($ipaddr in $a.DnsIPAddress) - { - if($ipaddrlist -ne $null) - { - $ipaddrlist += ", " ; - } - $ipaddrlist += $ipaddr; - } - - if($ipaddrlist -ne $null) - { - if($ipaddrlist.Length -gt $dnsServerColWidth) - { - $ipaddrlist = $ipaddrlist.Substring(0, $dnsServerColWidth - 3); - $ipaddrlist += "..."; - } - $dnsConfig += "{" + $ipaddrlist + "}"; - } - $dnsConfig += "`r`n"; - $outputStr += $dnsConfig; - $dnsConfig = $null; - } - } - $outputStr; - - - - - - - - - - - VpnConnectionProxy_List - - Microsoft.Management.Infrastructure.CimInstance#VpnConnectionProxy - - - - - - - AutoDetect - - - AutoConfigurationScript - - - ProxyServer - - - BypassProxyForLocal - - - ExceptionPrefix - - - - - - - - VpnConnectionProxy_Table - - Microsoft.Management.Infrastructure.CimInstance#VpnConnectionProxy - - - - - 20 - - - 40 - - - 40 - - - 20 - - - 40 - - - - - - - AutoDetect - - - AutoConfigurationScript - - - ProxyServer - - - BypassProxyForLocal - - - ExceptionPrefix - - - - - - - - VpnConnectionProxy_Wide - - Microsoft.Management.Infrastructure.CimInstance#VpnConnectionProxy - - - - - - ProxyServer - - - - - - - - diff --git a/newton-cn/bin/Modules/VpnClient/VpnClientPSProvider.Types.ps1xml b/newton-cn/bin/Modules/VpnClient/VpnClientPSProvider.Types.ps1xml deleted file mode 100644 index bc9f758..0000000 --- a/newton-cn/bin/Modules/VpnClient/VpnClientPSProvider.Types.ps1xml +++ /dev/null @@ -1,272 +0,0 @@ - - - - - Microsoft.Management.Infrastructure.CimInstance#VpnConnection - - - EapConfigXmlStream - - [OutputType([System.Xml.XmlDocument])] - param() - [System.Xml.XmlDocument]($this.PSBase.CimInstanceProperties['EapConfigXmlStream'].value) - - - param([System.Xml.XmlDocument]$value) - $this.PSBase.CimInstanceProperties['EapConfigXmlStream'].value = $value - - - - VpnConfigurationXml - - [OutputType([System.Xml.XmlDocument])] - param() - [System.Xml.XmlDocument]($this.PSBase.CimInstanceProperties['VpnConfigurationXml'].value) - - - param([System.Xml.XmlDocument]$value) - $this.PSBase.CimInstanceProperties['VpnConfigurationXml'].value = $value - - - - IPSecCustomPolicy - - [OutputType([System.String[]])] - param() - $output = @() - foreach ($range in $this.PSBase.CimInstanceProperties['IPSecCustomPolicy'].value) - { - $output += $range - } - if ($output.Count -gt 0) - {,(@($output))} - else - {$null} - - - - MachineCertificateIssuerFilter - - [OutputType([System.Security.Cryptography.X509Certificates.X509Certificate2])] - param() - [System.Security.Cryptography.X509Certificates.X509Certificate2]($this.PSBase.CimInstanceProperties['MachineCertificateIssuerFilter'].Value) - - - param([System.Security.Cryptography.X509Certificates.X509Certificate2]$value) - $this.PSBase.CimInstanceProperties['MachineCertificateIssuerFilter'].Value = $value.RawData - - - - MachineCertificateEKUFilter - - [OutputType([System.String[]])] - param() - $output = @() - foreach ($range in $this.PSBase.CimInstanceProperties['MachineCertificateEKUFilter'].value) - { - $output += $range - } - if ($output.Count -gt 0) - {,(@($output))} - else - {$null} - - - - - - Microsoft.Management.Infrastructure.CimInstance#ThirdPartyVpnConnection - - - CustomConfiguration - - [OutputType([System.Xml.XmlDocument])] - param() - [System.Xml.XmlDocument]($this.PSBase.CimInstanceProperties['CustomConfiguration'].value) - - - param([System.Xml.XmlDocument]$value) - $this.PSBase.CimInstanceProperties['CustomConfiguration'].value = $value - - - - VpnConfigurationXml - - [OutputType([System.Xml.XmlDocument])] - param() - [System.Xml.XmlDocument]($this.PSBase.CimInstanceProperties['VpnConfigurationXml'].value) - - - param([System.Xml.XmlDocument]$value) - $this.PSBase.CimInstanceProperties['VpnConfigurationXml'].value = $value - - - - - - Microsoft.Management.Infrastructure.CimInstance#EapConfiguration - - - EapConfigXmlStream - - [OutputType([System.Xml.XmlDocument])] - param() - [System.Xml.XmlDocument]($this.PSBase.CimInstanceProperties['EapConfigXmlStream'].value) - - - param([System.Xml.XmlDocument]$value) - $this.PSBase.CimInstanceProperties['EapConfigXmlStream'].value = $value - - - - - - Microsoft.Management.Infrastructure.CimInstance#VpnConnectionIPsecConfiguration - - - AuthenticationTransformConstants - - [OutputType([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.AuthenticationTransformConstants])] - param() - [Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.AuthenticationTransformConstants]($this.PSBase.CimInstanceProperties['AuthenticationTransformConstants'].Value) - - - param([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.AuthenticationTransformConstants]$value) - $this.PSBase.CimInstanceProperties['AuthenticationTransformConstants'].Value = [System.Uint32]$value - - - - CipherTransformConstants - - [OutputType([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.CipherTransformConstants])] - param() - [Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.CipherTransformConstants]($this.PSBase.CimInstanceProperties['CipherTransformConstants'].Value) - - - param([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.CipherTransformConstants]$value) - $this.PSBase.CimInstanceProperties['CipherTransformConstants'].Value = [System.Uint32]$value - - - - DHGroup - - [OutputType([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.DHGroup])] - param() - [Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.DHGroup]($this.PSBase.CimInstanceProperties['DHGroup'].Value) - - - param([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.DHGroup]$value) - $this.PSBase.CimInstanceProperties['DHGroup'].Value = [System.Uint32]$value - - - - EncryptionMethod - - [OutputType([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.EncryptionMethod])] - param() - [Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.EncryptionMethod]($this.PSBase.CimInstanceProperties['EncryptionMethod'].Value) - - - param([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.EncryptionMethod]$value) - $this.PSBase.CimInstanceProperties['EncryptionMethod'].Value = [System.Uint32]$value - - - - IntegrityCheckMethod - - [OutputType([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.IntegrityCheckMethod])] - param() - [Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.IntegrityCheckMethod]($this.PSBase.CimInstanceProperties['IntegrityCheckMethod'].Value) - - - param([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.IntegrityCheckMethod]$value) - $this.PSBase.CimInstanceProperties['IntegrityCheckMethod'].Value = [System.Uint32]$value - - - - PfsGroup - - [OutputType([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.PfsGroup])] - param() - [Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.PfsGroup]($this.PSBase.CimInstanceProperties['PfsGroup'].Value) - - - param([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.PfsGroup]$value) - $this.PSBase.CimInstanceProperties['PfsGroup'].Value = [System.Uint32]$value - - - - - - Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTriggerApplication - - - ApplicationID - - [OutputType([System.String])] - param() - $output = @() - foreach($range in $this.PSBase.CimInstanceProperties['ApplicationID'].Value) - { - $output += $range - } - if ($output.Count -gt 0) - {,(@($output))} - else - {$null} - - - - - - Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTriggerDnsConfiguration - - - DnsIPAddress - - [OutputType([System.String])] - param() - $output = @() - foreach($range in $this.PSBase.CimInstanceProperties['DnsIPAddress'].Value) - { - $output += $range - } - if ($output.Count -gt 0) - {,(@($output))} - else - {$null} - - - - - - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/RemoteAccess/Client/MSFT_NetRoute - - - AddressFamily - - [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.AddressFamily]($this.PSBase.CimInstanceProperties['AddressFamily'].Value) - - - param($newValue) - $this.PSBase.CimInstanceProperties['AddressFamily'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.AddressFamily]$newValue - - - - - - diff --git a/newton-cn/bin/Modules/Wdac/MSFT_OdbcDriverTask_v1.0.cdxml b/newton-cn/bin/Modules/Wdac/MSFT_OdbcDriverTask_v1.0.cdxml deleted file mode 100644 index bec5302..0000000 --- a/newton-cn/bin/Modules/Wdac/MSFT_OdbcDriverTask_v1.0.cdxml +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - - - - - - 1.0 - OdbcDriver - - - - - - - - - - - - - - - - - - - - - - - - - 32-bit - 64-bit - All - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32-bit - 64-bit - All - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Wdac/MSFT_OdbcDsnTask_v1.0.cdxml b/newton-cn/bin/Modules/Wdac/MSFT_OdbcDsnTask_v1.0.cdxml deleted file mode 100644 index 5adcd4a..0000000 --- a/newton-cn/bin/Modules/Wdac/MSFT_OdbcDsnTask_v1.0.cdxml +++ /dev/null @@ -1,484 +0,0 @@ - - - - - - - - - - - 1.0 - OdbcDsn - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32-bit - 64-bit - - - - - - - - - - User - System - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32-bit - 64-bit - All - - - - - - - - - - User - System - All - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32-bit - 64-bit - All - - - - - - - - - - User - System - All - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32-bit - 64-bit - All - - - - - - - - - - User - System - All - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Wdac/MSFT_OdbcPerfCounterTask_v1.0.cdxml b/newton-cn/bin/Modules/Wdac/MSFT_OdbcPerfCounterTask_v1.0.cdxml deleted file mode 100644 index b2b24c3..0000000 --- a/newton-cn/bin/Modules/Wdac/MSFT_OdbcPerfCounterTask_v1.0.cdxml +++ /dev/null @@ -1,322 +0,0 @@ - - - - - - - - - - - 1.0 - OdbcPerfCounter - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32-bit - 64-bit - All - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32-bit - 64-bit - All - - - - - - - - - - - - - - - - - - - - - - - - - - - 32-bit - 64-bit - All - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Wdac/MSFT_WdacBidTraceTask_v1.0.cdxml b/newton-cn/bin/Modules/Wdac/MSFT_WdacBidTraceTask_v1.0.cdxml deleted file mode 100644 index 72e32c6..0000000 --- a/newton-cn/bin/Modules/Wdac/MSFT_WdacBidTraceTask_v1.0.cdxml +++ /dev/null @@ -1,589 +0,0 @@ - - - - - - - - - - - 1.0 - WdacBidTrace - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32-bit - 64-bit - All - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32-bit - 64-bit - All - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32-bit - 64-bit - All - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32-bit - 64-bit - All - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32-bit - 64-bit - All - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32-bit - 64-bit - All - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32-bit - 64-bit - All - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32-bit - 64-bit - All - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 32-bit - 64-bit - All - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Wdac/Wdac.format.ps1xml b/newton-cn/bin/Modules/Wdac/Wdac.format.ps1xml deleted file mode 100644 index 45b7f51..0000000 --- a/newton-cn/bin/Modules/Wdac/Wdac.format.ps1xml +++ /dev/null @@ -1,686 +0,0 @@ - - - - - - - - - - - - - - Formatting For MSFT_OdbcKeyValuePair (List View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcKeyValuePair - - - - - - - ParentKey - - - Key - - - Value - - - - - - - - - Formatting For MSFT_OdbcKeyValuePair (Table View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcKeyValuePair - - - - - 30 - - - - 30 - - - - 90 - - - - - - - - ParentKey - - - - Key - - - Value - - - - - - - - - - Formatting For MSFT_OdbcDriver (List View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcDriver - - - - - - - Name - - - Platform - - - Attribute - - - - - - - - - Formatting For MSFT_OdbcDriver (Table View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcDriver - - - - - 40 - - - - - 15 - - - - 65 - - - - - - - - Name - - - Platform - - - Attribute - - - - - - - - - Formatting For MSFT_OdbcDriver (Custom View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcDriver - - - - - - FmtAttribute - - - - - - 4 - - - - - [String]::Format( "{0,-20}= {1}", $_.Name, $_.Value ) - - - - - - - - - - - - - - - - - - - - [String]::Format( "{0,-11}: {1}", "Name", $_.Name ) - - - - - - - [String]::Format( "{0,-11}: {1}", "Platform", $_.Platform ) - - - - - - - [String]::Format( "{0,-11}:", "Attribute" ) - - - - - - - Attribute - - FmtAttribute - - - - - - - - - - - Formatting For MSFT_OdbcDsn (List View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcDsn - - - - - - - Name - - - DsnType - - - Platform - - - DriverName - - - Attribute - - - - - - - - - Formatting For MSFT_OdbcDsn (Table View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcDsn - - - - - 20 - - - - 15 - - - - 15 - - - 40 - - - 65 - - - - - - - - Name - - - DsnType - - - Platform - - - DriverName - - - Attribute - - - - - - - - - Formatting For MSFT_OdbcDsn (Custom View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcDsn - - - - - - FmtAttribute - - - - - - 4 - - - - - [String]::Format( "{0,-20}= {1}", $_.Name, $_.Value ) - - - - - - - - - - - - - - - - - - - - [String]::Format( "{0,-11}: {1}", "Name", $_.Name ) - - - - - - - [String]::Format( "{0,-11}: {1}", "DsnType", $_.DsnType ) - - - - - - - [String]::Format( "{0,-11}: {1}", "Platform", $_.Platform ) - - - - - - - [String]::Format( "{0,-11}: {1}", "DriverName", $_.DriverName ) - - - - - - - [String]::Format( "{0,-11}:", "Attribute" ) - - - - - - - Attribute - - FmtAttribute - - - - - - - - - - - Formatting For MSFT_OdbcPerfCounter (List View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcPerfCounter - - - - - - - Platform - - - IsEnabled - - - - - - - - - Formatting For MSFT_OdbcPerfCounter (Table View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcPerfCounter - - - - - - 15 - - - 20 - - - - - - - - Platform - - - IsEnabled - - - - - - - - - Formatting For MSFT_OdbcPerfCounter (Wide View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcPerfCounter - - - - - - - Platform - - - - - - - - - - Formatting For MSFT_WdacBidTrace (List View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_WdacBidTrace - - - - - - - TargetScope - - - TargetProcessId - - - Platform - - - IsEnabled - - - - - - - - - Formatting For MSFT_WdacBidTrace (Table View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_WdacBidTrace - - - - - 50 - - - 18 - - - - 15 - - - 20 - - - - - - - - TargetScope - - - TargetProcessId - - - Platform - - - IsEnabled - - - - - - - - - Formatting For MSFT_WdacBidTrace (Wide View) - - Microsoft.Management.Infrastructure.CimInstance#MSFT_WdacBidTrace - - - - - - - TargetScope - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Wdac/Wdac.psd1 b/newton-cn/bin/Modules/Wdac/Wdac.psd1 deleted file mode 100644 index ecebc74..0000000 --- a/newton-cn/bin/Modules/Wdac/Wdac.psd1 +++ /dev/null @@ -1,31 +0,0 @@ -@{ - GUID = '78a7a38c-a446-43fe-b643-9abacf843112' - Author = 'Microsoft Corporation' - CompanyName = 'Microsoft Corporation' - Copyright = '(C) Microsoft Corporation. All rights reserved.' - NestedModules = @('MSFT_OdbcDriverTask_v1.0.cdxml', - 'MSFT_OdbcDsnTask_v1.0.cdxml', - 'MSFT_OdbcPerfCounterTask_v1.0.cdxml', - 'MSFT_WdacBidTraceTask_v1.0.cdxml') - FormatsToProcess = @('Wdac.format.ps1xml') - TypesToProcess = @('Wdac.types.ps1xml') - ModuleVersion = '1.0.0.0' - AliasesToExport = @() - - FunctionsToExport = @('Get-OdbcDriver', - 'Set-OdbcDriver', - 'Get-OdbcDsn', - 'Add-OdbcDsn', - 'Set-OdbcDsn', - 'Remove-OdbcDsn', - 'Get-OdbcPerfCounter', - 'Enable-OdbcPerfCounter', - 'Disable-OdbcPerfCounter', - 'Get-WdacBidTrace', - 'Enable-WdacBidTrace', - 'Disable-WdacBidTrace') - - PowerShellVersion = '5.1' - HelpInfoUri = 'http://go.microsoft.com/fwlink/?linkid=390844' - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/Wdac/Wdac.types.ps1xml b/newton-cn/bin/Modules/Wdac/Wdac.types.ps1xml deleted file mode 100644 index fcc0d4b..0000000 --- a/newton-cn/bin/Modules/Wdac/Wdac.types.ps1xml +++ /dev/null @@ -1,239 +0,0 @@ - - - - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcDriver - - - Attribute - - $h = @{}; - foreach ($keyValue in $this.KeyValuePair) - { - $h.Add( $keyValue.Key, $keyValue.Value ) - } - $h - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcDsn - - - Attribute - - $h = @{}; - foreach ($keyValue in $this.KeyValuePair) - { - $h.Add( $keyValue.Key, $keyValue.Value ) - } - $h - - - - - PropertyValue - - $PropArray = @(); - foreach ($keyValue in $this.KeyValuePair) - { - $PropArray = $PropArray + ($keyValue.Key + "=" + $keyValue.Value) - } - $PropArray - - - - - - - - Microsoft.Management.Infrastructure.CimInstance#MSFT_WdacBidTrace - - - - TargetScope - - switch ($this.Mode) - { - 1 {$this.PathOrFolder} - 2 {$this.PathOrFolder + "\*"} - 3 {"*"} - default {"Unknown Mode"} - } - - - - - TargetProcessId - - if ($this.ProcessId -eq [System.UInt32]::maxvalue) - { - "*" - } - else - { - [System.String] $this.ProcessId - } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/Whea/Microsoft.Windows.Whea.WheaMemoryPolicy.dll b/newton-cn/bin/Modules/Whea/Microsoft.Windows.Whea.WheaMemoryPolicy.dll deleted file mode 100644 index c6adc43..0000000 Binary files a/newton-cn/bin/Modules/Whea/Microsoft.Windows.Whea.WheaMemoryPolicy.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/Whea/Whea.psd1 b/newton-cn/bin/Modules/Whea/Whea.psd1 deleted file mode 100644 index 187bfd1..0000000 --- a/newton-cn/bin/Modules/Whea/Whea.psd1 +++ /dev/null @@ -1,47 +0,0 @@ -# -# Module manifest for module 'WheaPolicyManagement' -# -# Generated by: Microsoft Corporation -# -# Generated on: 2/14/2011 -# - -@{ - -# These modules will be processed when the module manifest is loaded. -NestedModules = 'Microsoft.Windows.Whea.WheaMemoryPolicy' - -# This GUID is used to uniquely identify this module. -GUID = 'b7bf4d74-f837-430e-810f-234f26021253' - -# The author of this module. -Author = 'Microsoft Corporation' - -# The company or vendor for this module. -CompanyName = 'Microsoft Corporation' - -# The copyright statement for this module. -Copyright = '© Microsoft Corporation. All rights reserved.' - -# A description of this module (not be used because module manifest is not being localized). -# Description = 'Whea WMI Module for Memory Policy' - -# The version of this module. -ModuleVersion = '2.0.0.0' - -# The minimum version of PowerShell needed to use this module. -PowerShellVersion = '5.1' - -# The CLR version required to use this module. -CLRVersion = '4.0' - -# Request fwlink from UA -HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=390848" - -# Cmdlets to Export -CmdletsToExport="Get-WheaMemoryPolicy", "Set-WheaMemoryPolicy" - -# PowerShell editions this module is compatible with -CompatiblePSEditions = @('Core', 'Desktop') -} - diff --git a/newton-cn/bin/Modules/WindowsDeveloperLicense/WindowsDeveloperLicense.psd1 b/newton-cn/bin/Modules/WindowsDeveloperLicense/WindowsDeveloperLicense.psd1 deleted file mode 100644 index e6cc6bf..0000000 --- a/newton-cn/bin/Modules/WindowsDeveloperLicense/WindowsDeveloperLicense.psd1 +++ /dev/null @@ -1,15 +0,0 @@ -@{ - GUID = "{8AB5FE0D-DB4A-49F2-93A3-040CF12840CC}" - Author = "Microsoft Corporation" - CLRVersion = "4.0" - CompanyName = "Microsoft Corporation" - Copyright = "© Microsoft Corporation. All rights reserved." - AliasesToExport = @() - FunctionsToExport = @() - CmdletsToExport = "Get-WindowsDeveloperLicense", "Unregister-WindowsDeveloperLicense", "Show-WindowsDeveloperLicenseRegistration" - HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=285578" - PowerShellVersion = '5.1' - ModuleVersion = "1.0.0.0" - ModuleToProcess = "Microsoft.Windows.DeveloperLicense.Commands" - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/WindowsErrorReporting/Microsoft.WindowsErrorReporting.PowerShell.dll b/newton-cn/bin/Modules/WindowsErrorReporting/Microsoft.WindowsErrorReporting.PowerShell.dll deleted file mode 100644 index 5a3f7a6..0000000 Binary files a/newton-cn/bin/Modules/WindowsErrorReporting/Microsoft.WindowsErrorReporting.PowerShell.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/WindowsErrorReporting/WindowsErrorReporting.psd1 b/newton-cn/bin/Modules/WindowsErrorReporting/WindowsErrorReporting.psd1 deleted file mode 100644 index 4b9d145..0000000 --- a/newton-cn/bin/Modules/WindowsErrorReporting/WindowsErrorReporting.psd1 +++ /dev/null @@ -1,21 +0,0 @@ -@{ - GUID = "{4BC4DED7-249B-41AC-973F-83AF4D25D82B}" - Author = "Microsoft Corporation" - CompanyName = "Microsoft Corporation" - Copyright = "© Microsoft Corporation. All rights reserved." - HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=390850" - ModuleVersion = "1.0" - PowerShellVersion = '5.1' - ClrVersion = "4.0" - RootModule = "WindowsErrorReporting.psm1" - NestedModules = "Microsoft.WindowsErrorReporting.PowerShell.dll" - TypesToProcess = @() - FormatsToProcess = @() - CmdletsToExport = @( - 'Enable-WindowsErrorReporting', - 'Disable-WindowsErrorReporting', - 'Get-WindowsErrorReporting' - ) - AliasesToExport = @() - CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/WindowsErrorReporting/WindowsErrorReporting.psm1 b/newton-cn/bin/Modules/WindowsErrorReporting/WindowsErrorReporting.psm1 deleted file mode 100644 index c5fc3b7..0000000 --- a/newton-cn/bin/Modules/WindowsErrorReporting/WindowsErrorReporting.psm1 +++ /dev/null @@ -1,11 +0,0 @@ -# -# Script Module file for Wer module. -# -# Copyright (c) Microsoft Corporation -# - -# -# Cmdlet aliases -# - -Export-ModuleMember -Alias * -Function * -Cmdlet * diff --git a/newton-cn/bin/Modules/WindowsSearch/Microsoft.WindowsSearch.Commands.dll b/newton-cn/bin/Modules/WindowsSearch/Microsoft.WindowsSearch.Commands.dll deleted file mode 100644 index b33ae15..0000000 Binary files a/newton-cn/bin/Modules/WindowsSearch/Microsoft.WindowsSearch.Commands.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/WindowsSearch/WindowsSearch.Format.ps1xml b/newton-cn/bin/Modules/WindowsSearch/WindowsSearch.Format.ps1xml deleted file mode 100644 index 67bf6b4..0000000 --- a/newton-cn/bin/Modules/WindowsSearch/WindowsSearch.Format.ps1xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - PrintSetting - - Microsoft.WindowsSearch.Commands.PrintSetting - - - - - - - Setting - - - Value - - - - - - - - diff --git a/newton-cn/bin/Modules/WindowsSearch/WindowsSearch.psd1 b/newton-cn/bin/Modules/WindowsSearch/WindowsSearch.psd1 deleted file mode 100644 index c36c193..0000000 --- a/newton-cn/bin/Modules/WindowsSearch/WindowsSearch.psd1 +++ /dev/null @@ -1,13 +0,0 @@ -@{ -GUID="{562C6233-EAEE-4876-B36C-D6B1F256D4E6}" -Author="Microsoft Corporation" -CompanyName="Microsoft Corporation" -Copyright="© Microsoft Corporation. All rights reserved." -ModuleVersion="1.0.0.0" -PowerShellVersion="5.1" -CLRVersion="4.0" -NestedModules="Microsoft.WindowsSearch.Commands" -HelpInfoUri= "https://go.microsoft.com/fwlink/?LinkId=280243" -CmdletsToExport="Get-WindowsSearchSetting","Set-WindowsSearchSetting" -CompatiblePSEditions=@("Core","Desktop") -} diff --git a/newton-cn/bin/Modules/WindowsSearch/ko/Microsoft.WindowsSearch.Commands.Resources.dll b/newton-cn/bin/Modules/WindowsSearch/ko/Microsoft.WindowsSearch.Commands.Resources.dll deleted file mode 100644 index b72756d..0000000 Binary files a/newton-cn/bin/Modules/WindowsSearch/ko/Microsoft.WindowsSearch.Commands.Resources.dll and /dev/null differ diff --git a/newton-cn/bin/Modules/WindowsUpdate/WindowsUpdate.psd1 b/newton-cn/bin/Modules/WindowsUpdate/WindowsUpdate.psd1 deleted file mode 100644 index 0b79319..0000000 --- a/newton-cn/bin/Modules/WindowsUpdate/WindowsUpdate.psd1 +++ /dev/null @@ -1,40 +0,0 @@ -# -# Module manifest for module 'WindowsUpdate' -# - -@{ - -# Version number of this module. -ModuleVersion = '1.0.0.0' - -# ID used to uniquely identify this module -GUID = 'db6155f2-9e89-45cf-876a-f15141294f5b' - -# Author of this module -Author = 'Microsoft Corporation' - -# Company or vendor of this module -CompanyName = 'Microsoft Corporation' - -# Copyright statement for this module -Copyright = '(c) Microsoft Corporation. All rights reserved.' - -# Minimum version of the Windows PowerShell engine required by this module -PowerShellVersion = '5.1' - -# List of all modules packaged with this module -ModuleList = @('.\WindowsUpdateLog.psm1') - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -NestedModules = @('.\WindowsUpdateLog.psm1') - -# Functions to export from this module -FunctionsToExport = @('Get-WindowsUpdateLog') -AliasesToExport = @() -CmdletsToExport = @() - -# HelpInfo URI of this module -HelpInfoURI = 'https://go.microsoft.com/fwlink/?LinkId=614995' - -CompatiblePSEditions = @('Desktop', 'Core') -} diff --git a/newton-cn/bin/Modules/WindowsUpdate/WindowsUpdateLog.psm1 b/newton-cn/bin/Modules/WindowsUpdate/WindowsUpdateLog.psm1 deleted file mode 100644 index c1bfadc..0000000 --- a/newton-cn/bin/Modules/WindowsUpdate/WindowsUpdateLog.psm1 +++ /dev/null @@ -1,515 +0,0 @@ -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# Version: 1.0.0.0 -# Revision 2015.05.26 -# - -# -------------------------------------------------------------------------------------------------------------------------- -# CONSTANTS -# -------------------------------------------------------------------------------------------------------------------------- -$TIMESTAMP_FORMAT = "yyyy/MM/dd HH:mm:ss.fffffff" - -$WORKDIR = "$env:TEMP\WindowsUpdateLog" -$SYM_CACHE = "$WORKDIR\SymCache" -$SYSTEM32 = "$env:windir\System32" -$DEBUG_LOG_PATH = "$WORKDIR\debug.log" - -$BINLIST = @( - "wuaueng.dll", - "wuapi.dll", - "wuuhext.dll", - "wuuhmobile.dll", - "wuautoappupdate.dll", - "storewuauth.dll", - "wuauclt.exe") - -# TraceRpt.exe fails with "data area passed in too small" error which is really just insufficient buffer error. It happens -# when the total size of ETLs we're passing in is too huge. We're going to batch it every 10 ETLs to workaround the issue. -$MAX_ETL_PER_BATCH = 10 - -# Column headers in CSV produced by tracerpt.exe -$CSV_HEADER= "EventName, Type, Event ID, Version, Channel, Level, Opcode, Task, Keyword, PID, TID, ProcessorNumber, InstanceID, ParentInstanceID, ActivityID, RelatedActivityID, ClockTime, KernelTime, UserTime, UserData, Function, LogMessage, Ignore1, Ignore2, IgnoreGuid1, SourceLine, IgnoreTime, Ignore3, Category, LogLevel, TimeStamp, IgnoreGuid2" - -# -------------------------------------------------------------------------------------------------------------------------- -# FUNCTIONS -# -------------------------------------------------------------------------------------------------------------------------- - -# -# Given a path to single ETL file or a directory containing multiple ETL files, return a list containing the fullpaths of the ETLs. -# -function GetListOfETLs -{ - Param( - [string[]] $Paths = $(throw "'Paths' parameter is required.") - ) - - Write-Verbose "Gathering ETL files ..." - - $etlList = New-Object System.Collections.Generic.List[System.String] - - foreach ($path in $Paths) - { - # If user passes in a directory as $ETLPath, grabs all the ETLs in that folder. - if (Test-Path $path -PathType Container) - { - $etls = Get-ChildItem $path -Filter WindowsUpdate*.etl - - if ($etls.Length -eq 0) - { - throw "File not found: No Windows Update ETL file under $path" - } - - foreach ($etl in $etls) - { - $etlList.Add($etl.FullName.Trim()) - } - } - else - { - if (!(Test-Path $path)) - { - throw "File not found: $path" - } - - $etlList.Add($path.Trim()) - } - } - - if ($etlList.Count -gt 1) - { - Write-Verbose "Sorting ETLs numerically ..." - - # Pad the last decimal before .etl in WindowsUpdate.20150609.225042.704.1.etl so ETLs can be sorted numerically. - $etlList = $etlList | Sort-Object { [regex]::Replace($_, '\d+(?=.etl)', { $args[0].Value.PadLeft(10) }) } - } - - Write-Verbose "Found $($etlList.Count) ETLs." - - return $etlList -} - -# -# Given a list of ETLs, decode them into XML or CSV file using TraceRpt.exe -# -function DecodeETL -{ - Param( - [System.Collections.Generic.List[System.String]] $ETLList = $(throw "'ETLList' parameter is required."), - [string] $OutPath = $(throw "'OutPath' parameter is required."), - [ValidateSet('XML', 'CSV')] $Type = $(throw "'Type' parameter is required.") - ) - - Write-Verbose "Decoding $($ETLList.Count) ETLs to $OutPath using $Type processing ..." - - if (Test-Path $OutPath) - { - Remove-Item $OutPath -Force -ErrorAction Stop - } - - # - # Build tracerpt arguments. - # - $args = New-Object System.Collections.Generic.List[System.String] - - # ETL files - $args.AddRange($ETLList) - - # output format - $args.Add("-of") - $args.Add($Type) - - # output file - $args.Add("-o") - $args.Add($OutPath) - - # binary list - $binaries = "" - - foreach ($bin in $BINLIST) - { - $binaries = "$binaries$SYSTEM32\$bin;" - } - - $args.Add("-i") - $args.Add("$binaries") - - # no prompt - $args.Add("-y") - - # Switch directory to SymCache so that tracerpt.exe writes the TMF and MOF files there. - if (!(Test-Path $SYM_CACHE)) - { - New-Item -ItemType Directory -Path $SYM_CACHE -ErrorAction Stop - } - - $popd = Get-Location - Set-Location $SYM_CACHE - - # - # Decode ETLs to XML - # - $start = Get-Date - - & "tracerpt.exe" $args | Out-Default - - Write-Verbose "Done. Elapsed: $((Get-Date).Subtract($start).TotalMilliseconds) ms." - - Set-Location $popd - - if ($LastExitCode -ne 0) - { - throw "Failed to decode ETLs. TraceRpt.exe returned error= $LastExitCode" - } - - if (!(Test-Path $OutPath)) - { - throw "Failed to decode ETLs. TraceRpt.exe failed to produce $OutPath" - } -} - -# -# Given an XML file produced by tracerpt.exe, convert it to user friendly text log. -# -function ConvertXmlToLog -{ - Param( - [string] $XmlPath = $(throw "'XmlPath' parameter is required."), - [string] $LogPath = $(throw "'LogPath' parameter is required.") - ) - - Write-Verbose "Converting $XmlPath to $LogPath ..." - - if (Test-Path $LogPath) - { - Remove-Item $LogPath -Force -ErrorAction Stop - } - - [xml] $xml = Get-Content $XmlPath - - $writer = New-Object System.IO.StreamWriter $LogPath - $start = Get-Date - - try - { - $nodeNum = 0 - - $xml.Events.Event | ForEach-Object { - - $row = $_ - - try - { - $systemNode = $_.System - $providerNode = $systemNode.Provider - $providerName = $systemNode.Provider.Name - - if ($providerNode -ne $null -And $providerName -eq "WUTraceLogging") - { - $eventDataNode = $_.EventData - $executionNode = $systemNode.Execution - [DateTime] $datetime = $systemNode.TimeCreated.SystemTime - - $keywordNode = $_.RenderingInfo - - - # Log columns: - # Time ProcessID ThreadID Component Message - $writer.WriteLine("$($datetime.ToString($TIMESTAMP_FORMAT)) $($executionNode.ProcessID.ToString().PadRight(5)) $($executionNode.ThreadID.ToString().PadRight(5)) $($keywordNode.Task.ToString().PadRight(15)) $($eventDataNode.Data.'#text')") - } - } - catch - { - # Log exception, eat it, and process the rest of the log. - Write-Warning "Unable to process node $nodeNum." - - "Failed to process line:$nodeNum of $XmlPath`n$row`n$_`n---" | Out-File $DEBUG_LOG_PATH -Encoding ascii -Append - } - - $nodeNum++ - } # foreach - } - finally - { - $writer.Close() - } - - Write-Verbose "Done. Elapsed: $((Get-Date).Subtract($start).TotalMilliseconds) ms." -} - -# -# Given a CSV file produced by tracerpt.exe, convert it to user friendly text log. -# -function ConvertCsvToLog -{ - Param( - $CsvPath = $(throw "'CsvPath' parameter is required."), - $LogPath = $(throw "'LogPath' parameter is required.") - ) - - Write-Verbose "Converting $CsvPath to $LogPath ..." - - if (Test-Path $LogPath) - { - Remove-Item $LogPath -Force -ErrorAction Stop - } - - $csvText = Get-Content $CsvPath - $csvText[0] = $CSV_HEADER - - $csv = ConvertFrom-Csv $csvText - - $writer = New-Object System.IO.StreamWriter $LogPath - $start = Get-Date - - try - { - $lineNum = 0 - - $csv | ForEach-Object { - - $row = $_ - - try - { - if ($_.EventName -ne "EventTrace" -And !($_.EventName.StartsWith("{"))) - { - [DateTime] $datetime = [DateTime]::FromFileTimeUTC($_.ClockTime).ToLocalTime() - - # convert hex string to decimals - $processId = $_.PID -as [int] - $threadId = $_.TID -as [int] - - # Log columns: - # Time ProcessID ThreadID Component Message - $writer.WriteLine("$($datetime.ToString($TIMESTAMP_FORMAT)) $($processId.ToString().PadRight(5)) $($threadId.ToString().PadRight(5)) $($_.EventName.PadRight(15)) $($_.UserData)") - } - } - catch - { - # Log exception, eat it, and process the rest of the log. - Write-Warning "Unable to process line $lineNum." - - "Unable to process line:$lineNum of $CsvPath`n$row`n$_`n---" | Out-File $DEBUG_LOG_PATH -Encoding ascii -Append - } - - $lineNum++ - } # foreach - } - finally - { - $writer.Close() - } - - Write-Verbose "Done. Elapsed: $((Get-Date).Subtract($start).TotalMilliseconds) ms." -} - -function FlushWindowsUpdateETLs -{ - Write-Verbose "Flushing Windows Update ETLs ..." - - Stop-Service usosvc -ErrorAction Stop - Stop-Service wuauserv -ErrorAction Stop - - Write-Verbose "Done." -} - -# -# Given an ETL path, convert the ETL file(s) into text log. -# -function ConvertETLsToLog -{ - Param( - [string[]] $ETLPaths = $(throw "'etlPaths' parameter is required."), - [string] $LogPath = $(throw "'LogPath' parameter is required."), - [ValidateSet('XML', 'CSV')] $Type = $(throw "'type' parameter is required.") - ) - - if ($ETLPaths.Count -gt 1) - { - "`nMerging and converting $($ETLPaths.Count) ETLs into $LogPath ..." | Out-Default - } - elseif ($ETLPaths.Count -eq 1) - { - "`nConverting $($ETLPaths[0]) into $LogPath ..." | Out-Default - } - else - { - throw "No Windows Update ETL file found." - } - - $start = Get-Date - - [System.Collections.Generic.List[System.String]] $etlList = GetListOfETLs -path $ETLPaths - # Create Working Directory - New-Item -Path $WORKDIR -ItemType Directory -ErrorAction SilentlyContinue | Out-Null - - $tempFilePath = "$WORKDIR\wuetl.$Type.tmp" - $tempLogPath = "$WORKDIR\wuetl.log.tmp" - - Remove-Item "$tempFilePath.*" -Force -ErrorAction SilentlyContinue | Out-Null - Remove-Item "$tempLogPath.*" -Force -ErrorAction SilentlyContinue | Out-Null - Remove-Item $DEBUG_LOG_PATH -Force -ErrorAction SilentlyContinue | Out-Null - - $processed = 0; - $tempFileCount = 0 - - # Pad tempFileCount so files can be sorted numerically. - $NumFormat = "{0:00000}" - - while ($processed -lt $etlList.Count) - { - $remaining = $etlList.Count - $processed - - $numberedTempFile = "$tempFilePath.$NumFormat" -f $tempFileCount - $numberedLogFile = "$tempLogPath.$NumFormat" -f $tempFileCount - - if ($remaining -ge $MAX_ETL_PER_BATCH) - { - DecodeETL -ETLList $etlList.GetRange($processed, $MAX_ETL_PER_BATCH) -OutPath $numberedTempFile -Type $Type - $processed += $MAX_ETL_PER_BATCH - } - else - { - DecodeETL -ETLList $etlList.GetRange($processed, $remaining) -OutPath $numberedTempFile -Type $Type - $processed += $remaining - } - - if ($Type -eq 'XML') - { - ConvertXmlToLog -XmlPath $numberedTempFile -LogPath $numberedLogFile - } - else - { - ConvertCsvToLog -CsvPath $numberedTempFile -LogPath $numberedLogFile - } - - $tempFileCount++ - } - - if ($tempFileCount -gt 1) - { - Write-Verbose "Merging all temporary logs into one ..." - Get-Content "$tempLogPath.*" | Out-File $LogPath -Encoding ascii - } - else - { - $src = "$tempLogPath.$NumFormat" -f 0 - Copy-Item -Path $src -Destination $LogPath -ErrorAction Stop - } - - # Not removing $tempFilePath.* so users can use XML/CSVs to do more fancy stuff should they wish. - Remove-Item "$tempLogPath.*" -ErrorAction SilentlyContinue | Out-Null - - Write-Verbose "Total elapsed: $((Get-Date).Subtract($start).TotalMilliseconds) ms." - - "`nWindowsUpdate.log written to $LogPath`n" | Out-Default -} - -#.ExternalHelp WindowsUpdateLog.psm1-help.xml -function Get-WindowsUpdateLog -{ - [CmdLetBinding( - SupportsShouldProcess = $true, - ConfirmImpact = 'High')] - Param( - [parameter( - ValueFromPipeline = $true, - ValueFromPipelineByPropertyName = $true, - Position = 0)] - [Alias('PsPath')] - [string[]] $ETLPath = @("$env:windir\logs\WindowsUpdate"), - - [parameter( - Position = 1)] - [string] $LogPath = "$([System.Environment]::GetFolderPath("Desktop"))\WindowsUpdate.log", - - [ValidateSet('CSV', 'XML')] - [string] $ProcessingType = 'CSV', - - [switch] $ForceFlush - ) - - begin - { - $etls = New-Object System.Collections.ArrayList - } - - process - { - # - # Handles pipeline input. For e.g. get-childitem C:\temp | get-windowsupdatelog - # - if ($_ -ne $null) - { - if ($_.PsPath -eq $null -or !(Test-Path $_.PsPath)) - { - throw "ETL file cannot be found or is invalid: $_" - } - - $etls.Add($_.FullName) | Out-Null - } - # - # Handles regular input. For e.g. get-windowsupdate.log C:\temp\WindowsUpdate1.etl, C:\temp\WindowsUpdate2.etl - # - else - { - foreach ($p in $ETLPath) - { - if (!(Test-Path $p)) - { - throw "File not found: $p" - } - $etls.Add($p) | Out-Null - } - } - } - - end - { - if ($ForceFlush) - { - if ($PSCmdlet.ShouldProcess("$env:COMPUTERNAME", "Stopping Update Orchestrator and Windows Update services")) - { - FlushWindowsUpdateETLs - } - else - { - return - } - } - - # The rest of the function doesn't support -WhatIf, so just bail out if -WhatIf is specified - if ($WhatIfPreference) - { - return - } - - # - # Make sure we have permission to write log file to requested path. - # - $logDir = Split-Path -Parent $LogPath - - if (!(Test-Path $logDir)) - { - New-Item -Path $logDir -ErrorAction Stop - } - - try - { - "Checking write access" | Out-File -FilePath $LogPath -Encoding ascii - } - catch [System.UnauthorizedAccessException] - { - throw "No permission to write to $LogPath" - } - - # - # Do work now. - # - - ConvertETLsToLog -ETLPaths $etls -LogPath $LogPath -Type $ProcessingType - } -} - -Export-ModuleMember -Function Get-WindowsUpdateLog diff --git a/newton-cn/bin/Modules/WindowsUpdateProvider/MSFT_WUOperations.cdxml b/newton-cn/bin/Modules/WindowsUpdateProvider/MSFT_WUOperations.cdxml deleted file mode 100644 index fba0a7f..0000000 --- a/newton-cn/bin/Modules/WindowsUpdateProvider/MSFT_WUOperations.cdxml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - 1.0.0.1 - WUOperationsSession - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/WindowsUpdateProvider/MSFT_WUOperations.psm1 b/newton-cn/bin/Modules/WindowsUpdateProvider/MSFT_WUOperations.psm1 deleted file mode 100644 index 9518a31..0000000 --- a/newton-cn/bin/Modules/WindowsUpdateProvider/MSFT_WUOperations.psm1 +++ /dev/null @@ -1,32 +0,0 @@ -# This function's purpose is to take the output of the MI provider, an array of fixed size, and convert it to an array list of non-fixed size. -# The reason for this is so that a caller of this module is able to easily select which updates they wish to download & install -function Start-WUScan -{ - param - ( - [parameter(Mandatory = $false)] - $SearchCriteria - ) - - If($SearchCriteria -eq $null) - { - $scanres = Invoke-CimMethod -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperations -MethodName ScanForUpdates - } - else - { - $scanres = Invoke-CimMethod -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperations -MethodName ScanForUpdates -Arguments @{SearchCriteria=$SearchCriteria} - } - - if($scanres.ReturnValue -eq 0) - { - $arrlist = New-Object System.Collections.ArrayList - $arrlist.AddRange($scanres.Updates) | out-null - - # Comma is added to prevent powershell from converting return to an array - return ,$arrlist - } - else - { - Write-Error "Scan hit error: $scanres.ReturnValue" - } -} \ No newline at end of file diff --git a/newton-cn/bin/Modules/WindowsUpdateProvider/MSFT_WUSettings.cdxml b/newton-cn/bin/Modules/WindowsUpdateProvider/MSFT_WUSettings.cdxml deleted file mode 100644 index 2f26a8d..0000000 --- a/newton-cn/bin/Modules/WindowsUpdateProvider/MSFT_WUSettings.cdxml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - 1.0.0.1 - WUSettings - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/WindowsUpdateProvider/MSFT_WUUpdate.cdxml b/newton-cn/bin/Modules/WindowsUpdateProvider/MSFT_WUUpdate.cdxml deleted file mode 100644 index 2fcfe90..0000000 --- a/newton-cn/bin/Modules/WindowsUpdateProvider/MSFT_WUUpdate.cdxml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - 1.0.0.1 - WUUpdate - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/WindowsUpdateProvider/MSFT_WUUpdate.format.ps1xml b/newton-cn/bin/Modules/WindowsUpdateProvider/MSFT_WUUpdate.format.ps1xml deleted file mode 100644 index 21550a3..0000000 --- a/newton-cn/bin/Modules/WindowsUpdateProvider/MSFT_WUUpdate.format.ps1xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - MSFT_WUUpdate_ListView - - Microsoft.Management.Infrastructure.CimInstance#root\microsoft\windows\windowsupdate\MSFT_WUUpdate - Microsoft.Management.Infrastructure.CimInstance#MSFT_WUUpdate - - - - - - - - Title - - - - Description - - - - KBArticleID - - - - MsrcSeverity - - - - RevisionNumber - - - - UpdateID - - - - - - - - MSFT_WUUpdate_TableView - - Microsoft.Management.Infrastructure.CimInstance#root\microsoft\windows\windowsupdate\MSFT_WUUpdate - Microsoft.Management.Infrastructure.CimInstance#MSFT_WUUpdate - - - - - - 25 - - - - 50 - - - - 15 - - - - 15 - - - - 10 - - - - 39 - - - - - - - Title - - - Description - - - KBArticleID - - - MsrcSeverity - - - RevisionNumber - - - UpdateID - - - - - - - - diff --git a/newton-cn/bin/Modules/WindowsUpdateProvider/MSFT_WUUpdate.types.ps1xml b/newton-cn/bin/Modules/WindowsUpdateProvider/MSFT_WUUpdate.types.ps1xml deleted file mode 100644 index 849d824..0000000 --- a/newton-cn/bin/Modules/WindowsUpdateProvider/MSFT_WUUpdate.types.ps1xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/WindowsUpdate/MSFT_WUUpdate - - - UpdateID - - $this.PSBase.CimInstanceProperties['UpdateID'].Value - - - param($newValue) - $this.PSBase.CimInstanceProperties['UpdateID'].Value = [String][Microsoft.PowerShell.Cmdletization.GeneratedTypes.MSFT_WUUpdate.UpdateID] $newValue - - - - RevisionNumber - - $this.PSBase.CimInstanceProperties['RevisionNumber'].Value - - - param($newValue) - $this.PSBase.CimInstanceProperties['RevisionNumber'].Value = [UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.MSFT_WUUpdate.RevisionNumber] $newValue - - - - Title - - $this.PSBase.CimInstanceProperties['Title'].Value - - - param($newValue) - $this.PSBase.CimInstanceProperties['Title'].Value = [String][Microsoft.PowerShell.Cmdletization.GeneratedTypes.MSFT_WUUpdate.Title] $newValue - - - - Description - - $this.PSBase.CimInstanceProperties['Description'].Value - - - param($newValue) - $this.PSBase.CimInstanceProperties['Description'].Value = [System.String][Microsoft.PowerShell.Cmdletization.GeneratedTypes.MSFT_WUUpdate.Description] $newValue - - - - MsrcSeverity - - $this.PSBase.CimInstanceProperties['MsrcSeverity'].Value - - - param($newValue) - $this.PSBase.CimInstanceProperties['MsrcSeverity'].Value = [System.String][Microsoft.PowerShell.Cmdletization.GeneratedTypes.MSFT_WUUpdate.MsrcSeverity] $newValue - - - - KBArticleID - - $this.PSBase.CimInstanceProperties['KBArticleID'].Value - - - param($newValue) - $this.PSBase.CimInstanceProperties['KBArticleID'].Value = [System.String][Microsoft.PowerShell.Cmdletization.GeneratedTypes.MSFT_WUUpdate.KBArticleID] $newValue - - - - - diff --git a/newton-cn/bin/Modules/WindowsUpdateProvider/WindowsUpdateProvider.psd1 b/newton-cn/bin/Modules/WindowsUpdateProvider/WindowsUpdateProvider.psd1 deleted file mode 100644 index cb3eb79..0000000 --- a/newton-cn/bin/Modules/WindowsUpdateProvider/WindowsUpdateProvider.psd1 +++ /dev/null @@ -1,47 +0,0 @@ -<#++ - -Copyright (c) 2011 Microsoft Corporation - -Module Name: - - WindowsUpdateProvider.psd1 - -Abstract: - - This module is the container module definition for the MSFT_WU* CIM - object CmdLets. - ---#> - -@{ - GUID = 'faed25e4-6939-439d-8c13-4778ac5ac8a7' - Author = "Microsoft Corporation" - CompanyName = "Microsoft Corporation" - Copyright = "(c) Microsoft Corporation. All rights reserved." - HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=390794" - ModuleVersion = "1.0.0.2" - PowerShellVersion = '5.1' - NestedModules = @( - 'MSFT_WUOperations.psm1', - 'MSFT_WUUpdate.cdxml', - 'MSFT_WUSettings.cdxml', - 'MSFT_WUOperations.cdxml' - ) - - TypesToProcess = @('MSFT_WUUpdate.types.ps1xml') - - FormatsToProcess = @('MSFT_WUUpdate.Format.ps1xml') - - FunctionsToExport = @( - # MSFT_WUSettings.cdxml - 'Get-WUAVersion', - 'Get-WULastInstallationDate', - 'Get-WULastScanSuccessDate', - 'Get-WUIsPendingReboot', - # MSFT_WUOperations.cdxml - 'Install-WUUpdates' - # MSFT_WUOperations.psm1 - 'Start-WUScan' - ) - CompatiblePSEditions = @('Desktop','Core') -} diff --git a/newton-cn/bin/Modules/iSCSI/iSCSI.psd1 b/newton-cn/bin/Modules/iSCSI/iSCSI.psd1 deleted file mode 100644 index 7f509f7..0000000 --- a/newton-cn/bin/Modules/iSCSI/iSCSI.psd1 +++ /dev/null @@ -1,27 +0,0 @@ -@{ - GUID = '53E1C251-4283-4B07-AB02-FC492C7AB8C5' - Author="Microsoft Corporation" - CompanyName="Microsoft Corporation" - Copyright="© Microsoft Corporation. All rights reserved." - ModuleVersion = '1.0.0.0' - PowerShellVersion = '3.0' - FormatsToProcess = @() - TypesToProcess = @() - NestedModules = @("iSCSIConnection.cdxml", "iSCSISession.cdxml", "iSCSITarget.cdxml", "iSCSITargetPortal.cdxml") - AliasesToExport = @() - FunctionsToExport = @( - 'Get-IscsiTargetPortal', - 'New-IscsiTargetPortal', - 'Remove-IscsiTargetPortal', - 'Update-IscsiTargetPortal', - 'Get-IscsiTarget', - 'Connect-IscsiTarget', - 'Disconnect-IscsiTarget', - 'Update-IscsiTarget', - 'Get-IscsiSession', - 'Register-IscsiSession', - 'Unregister-IscsiSession', - 'Get-IscsiConnection', - 'Set-IscsiChapSecret') - HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=390778" -} diff --git a/newton-cn/bin/Modules/iSCSI/iSCSIConnection.cdxml b/newton-cn/bin/Modules/iSCSI/iSCSIConnection.cdxml deleted file mode 100644 index 6a5989e..0000000 --- a/newton-cn/bin/Modules/iSCSI/iSCSIConnection.cdxml +++ /dev/null @@ -1,93 +0,0 @@ - - - - 1.0 - IscsiConnection - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/iSCSI/iSCSISession.cdxml b/newton-cn/bin/Modules/iSCSI/iSCSISession.cdxml deleted file mode 100644 index 098a173..0000000 --- a/newton-cn/bin/Modules/iSCSI/iSCSISession.cdxml +++ /dev/null @@ -1,188 +0,0 @@ - - - - 1.0 - IscsiSession - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/newton-cn/bin/Modules/iSCSI/iSCSITarget.cdxml b/newton-cn/bin/Modules/iSCSI/iSCSITarget.cdxml deleted file mode 100644 index 4a0faa7..0000000 --- a/newton-cn/bin/Modules/iSCSI/iSCSITarget.cdxml +++ /dev/null @@ -1,326 +0,0 @@ - - - - 1.0 - IscsiTarget - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/Modules/iSCSI/iSCSITargetPortal.cdxml b/newton-cn/bin/Modules/iSCSI/iSCSITargetPortal.cdxml deleted file mode 100644 index 359b7b8..0000000 --- a/newton-cn/bin/Modules/iSCSI/iSCSITargetPortal.cdxml +++ /dev/null @@ -1,270 +0,0 @@ - - - - 1.0 - IscsiTargetPortal - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Certificate.format.ps1xml b/newton-cn/bin/v1.0/Certificate.format.ps1xml new file mode 100644 index 0000000..67ffc1a --- /dev/null +++ b/newton-cn/bin/v1.0/Certificate.format.ps1xml @@ -0,0 +1,289 @@ + + + + + + + + CertificateProviderTypes + + System.Security.Cryptography.X509Certificates.X509Certificate2 + System.Security.Cryptography.X509Certificates.X509Store + Microsoft.PowerShell.Commands.X509StoreLocation + + + + + + + SignatureTypes-GroupingFormat + + + + + + 4 + + + + split-path $_.Path + + + + + + + + + + + + + + ThumbprintTable + + System.Security.Cryptography.X509Certificates.X509Certificate2 + + + PSParentPath + FileSystemTypes-GroupingFormat + + + + + 41 + + + + + + + + Thumbprint + + + Subject + + + + + + + + ThumbprintList + + CertificateProviderTypes + + + + + + Microsoft.PowerShell.Commands.X509StoreLocation + + + + Location + + + StoreNames + + + + + + System.Security.Cryptography.X509Certificates.X509Store + + + + Name + + + + + + + $_.SubjectName.Name + + + + $_.IssuerName.Name + + + + Thumbprint + + + FriendlyName + + + NotBefore + + + NotAfter + + + Extensions + + + + + + + + ThumbprintWide + + CertificateProviderTypes + + + PSParentPath + FileSystemTypes-GroupingFormat + + + + + + ThumbPrint + + + + + + + PSThumbprintTable + + System.Management.Automation.Signature + + + split-path $_.Path + SignatureTypes-GroupingFormat + + + + + + 41 + + + + + + + + + + + $_.SignerCertificate.Thumbprint + + + Status + + + split-path $_.Path -leaf + + + + + + + + PSThumbprintWide + + System.Management.Automation.Signature + + + split-path $_.Path + SignatureTypes-GroupingFormat + + + + + + "$(split-path $_.Path -leaf): $($_.Status)" + + + + + + + PathOnly + + CertificateProviderTypes + + + + + + + PSPathPath + + + + + + Microsoft.PowerShell.Commands.X509StoreLocation + + + + PSPathPath + + + + + + System.Security.Cryptography.X509Certificates.X509Store + + + + PSPath + + + + + + + + System.Security.Cryptography.X509Certificates.X509CertificateEx + + System.Security.Cryptography.X509Certificates.X509CertificateEx + + + PSParentPath + FileSystemTypes-GroupingFormat + + + + + 41 + + + + + + + + Thumbprint + + + Subject + + + + + + + + diff --git a/newton-cn/bin/v1.0/Diagnostics.Format.ps1xml b/newton-cn/bin/v1.0/Diagnostics.Format.ps1xml new file mode 100644 index 0000000..6505b3e Binary files /dev/null and b/newton-cn/bin/v1.0/Diagnostics.Format.ps1xml differ diff --git a/newton-cn/bin/v1.0/DotNetTypes.format.ps1xml b/newton-cn/bin/v1.0/DotNetTypes.format.ps1xml new file mode 100644 index 0000000..63c34ec --- /dev/null +++ b/newton-cn/bin/v1.0/DotNetTypes.format.ps1xml @@ -0,0 +1,3453 @@ + + + + + + + System.CodeDom.Compiler.CompilerError + + System.CodeDom.Compiler.CompilerError + + + + + + + ErrorText + + + Line + + + Column + + + ErrorNumber + + + LineSource + + + + + + + + + System.Reflection.Assembly + + System.Reflection.Assembly + + + + + + + 6 + + + + 14 + + + + + + + + GlobalAssemblyCache + + + ImageRuntimeVersion + + + Location + + + + + + + + System.Reflection.AssemblyName + + System.Reflection.AssemblyName + + + + + + 14 + + + + + + + + Version + + + Name + + + + + + + + System.Globalization.CultureInfo + + System.Globalization.CultureInfo + + + + + + 16 + + + 16 + + + + + + + + LCID + + + Name + + + DisplayName + + + + + + + + System.Diagnostics.FileVersionInfo + + System.Diagnostics.FileVersionInfo + + + + + + 16 + + + 16 + + + + + + + + ProductVersion + + + FileVersion + + + FileName + + + + + + + + + System.Diagnostics.EventLogEntry + + System.Diagnostics.EventLogEntry + + + + + + + Right + 8 + + + + 13 + + + + 11 + + + + 20 + + + + Right + 12 + + + + + + + + + + Index + + + TimeGenerated + {0:MMM} {0:dd} {0:HH}:{0:mm} + + + $_.EntryType + + + Source + + + InstanceID + + + Message + + + + + + + + + System.Diagnostics.EventLog + + System.Diagnostics.EventLog + + + + + + + Right + 8 + + + + Right + 6 + + + + 18 + + + + Right + 10 + + + + + + + + + + + $_.MaximumKilobytes.ToString('N0') + + + MinimumRetentionDays + + + OverflowAction + + + $_.Entries.Count.ToString('N0') + + + Log + + + + + + + + + System.Version + + System.Version + + + + + 6 + + + 6 + + + 6 + + + 8 + + + + + + + Major + + + Minor + + + Build + + + Revision + + + + + + + + System.Drawing.Printing.PrintDocument + + System.Drawing.Printing.PrintDocument + + + + + + 10 + + + 10 + + + + + + + + Color + + + Duplex + + + Name + + + + + + + + + Dictionary + + System.Collections.DictionaryEntry + + + + + 30 + + + + + + + + Name + + + Value + + + + + + + + ProcessModule + + System.Diagnostics.ProcessModule + + + + + + 10 + right + + + 50 + + + + + + + + $_.Size + + + ModuleName + + + FileName + + + + + + + + process + + System.Diagnostics.Process + + + + + + 7 + right + + + + 7 + right + + + + 8 + right + + + + 10 + right + + + + 5 + right + + + + 8 + right + + + 6 + right + + + 3 + right + + + + + + + + HandleCount + + + [long]($_.NPM / 1024) + + + [long]($_.PM / 1024) + + + [long]($_.WS / 1024) + + + [long]($_.VM / 1048576) + + + +if ($_.CPU -ne $()) +{ + $_.CPU.ToString("N") +} + + + + Id + + + SI + + + ProcessName + + + + + + + + ProcessWithUserName + + System.Diagnostics.Process#IncludeUserName + + + + + + 7 + right + + + + 10 + right + + + + 5 + right + + + + 8 + right + + + 6 + right + + + 17 + + + + + + + + HandleCount + + + [long]($_.WS / 1024) + + + [long]($_.VM / 1048576) + + + + if ($_.CPU -ne $()) + { + $_.CPU.ToString("N") + } + + + + Id + + + UserName + + + ProcessName + + + + + + + + DirectoryEntry + + System.DirectoryServices.DirectoryEntry + + + + + + + + distinguishedName + + + + path + + + + + + + + PSSnapInInfo + + System.Management.Automation.PSSnapInInfo + + + + + + + + Name + + + + PSVersion + + + + Description + + + + + + + + PSSnapInInfo + + System.Management.Automation.PSSnapInInfo + + + + + + 30 + Left + + + + 20 + Left + + + + 30 + Left + + + + + + + Name + + + PSVersion + + + Description + + + + + + + + Priority + + System.Diagnostics.Process + + + PriorityClass + + + + + + 20 + + + 10 + right + + + 13 + right + + + 12 + right + + + + + + + ProcessName + + + Id + + + HandleCount + + + WorkingSet64 + + + + + + + + StartTime + + System.Diagnostics.Process + + + $_.StartTime.ToShortDateString() + + + + + + 20 + + + 10 + right + + + 13 + right + + + 12 + right + + + + + + + ProcessName + + + Id + + + HandleCount + + + WorkingSet64 + + + + + + + + service + + System.ServiceProcess.ServiceController + + + + + 8 + + + 18 + + + 38 + + + + + + + Status + + + Name + + + DisplayName + + + + + + + + System.Diagnostics.FileVersionInfo + + System.Diagnostics.FileVersionInfo + + + + + + + + + OriginalFileName + + + FileDescription + + + ProductName + + + Comments + + + CompanyName + + + FileName + + + FileVersion + + + ProductVersion + + + IsDebug + + + IsPatched + + + IsPreRelease + + + IsPrivateBuild + + + IsSpecialBuild + + + Language + + + LegalCopyright + + + LegalTrademarks + + + PrivateBuild + + + SpecialBuild + + + FileVersionRaw + + + ProductVersionRaw + + + + + + + + + + + System.Diagnostics.EventLogEntry + + System.Diagnostics.EventLogEntry + + + + + + + + + Index + + + EntryType + + + InstanceID + + + Message + + + Category + + + CategoryNumber + + + ReplacementStrings + + + Source + + + TimeGenerated + + + TimeWritten + + + UserName + + + + + + + + + + System.Diagnostics.EventLog + + System.Diagnostics.EventLog + + + + + + + + Log + + + EnableRaisingEvents + + + MaximumKilobytes + + + MinimumRetentionDays + + + OverflowAction + + + + + + + + System.TimeSpan + + System.TimeSpan + + + + + + + + + Days + + + Hours + + + Minutes + + + Seconds + + + Milliseconds + + + Ticks + + + TotalDays + + + TotalHours + + + TotalMinutes + + + TotalSeconds + + + TotalMilliseconds + + + + + + + + + System.TimeSpan + + System.TimeSpan + + + + + + + + + Days + + + Hours + + + Minutes + + + Seconds + + + Milliseconds + + + + + + + + + System.TimeSpan + + System.TimeSpan + + + + + + TotalMilliseconds + + + + + + + + System.AppDomain + + System.AppDomain + + + + + + + + + FriendlyName + + + Id + + + ApplicationDescription + + + BaseDirectory + + + DynamicDirectory + + + RelativeSearchPath + + + SetupInformation + + + ShadowCopyFiles + + + + + + + + + System.ServiceProcess.ServiceController + + System.ServiceProcess.ServiceController + + + + + + + + + Name + + + DisplayName + + + Status + + + DependentServices + + + ServicesDependedOn + + + CanPauseAndContinue + + + CanShutdown + + + CanStop + + + ServiceType + + + + + + + + + System.Reflection.Assembly + + System.Reflection.Assembly + + + + + + + CodeBase + + + EntryPoint + + + EscapedCodeBase + + + FullName + + + GlobalAssemblyCache + + + HostContext + + + ImageFileMachine + + + ImageRuntimeVersion + + + Location + + + ManifestModule + + + MetadataToken + + + PortableExecutableKind + + + ReflectionOnly + + + + + + + + System.Collections.DictionaryEntry + + System.Collections.DictionaryEntry + + + + + + + Name + + + Value + + + + + + + + process + + System.Diagnostics.Process + + + + + + ProcessName + + + + + + + DateTime + + System.DateTime + + + + + DateTime + + + + + + System.Security.AccessControl.ObjectSecurity + + System.Security.AccessControl.ObjectSecurity + + + + + + + + + + + + + + + + + Path + + + Owner + + + AccessToString + + + + + + + + System.Security.AccessControl.ObjectSecurity + + System.Security.AccessControl.ObjectSecurity + + + + + + + Path + + + Owner + + + Group + + + + AccessToString + + + + AuditToString + + + Sddl + + + + + + + + System.Management.ManagementClass + + System.Management.ManagementClass + + + __Namespace + + + + + + 35 + + + 20 + + + + + + + + + Name + + + Methods + + + Properties + + + + + + + + Microsoft.Management.Infrastructure.CimClass + + Microsoft.Management.Infrastructure.CimClass + + + $_.CimSystemProperties.Namespace + + + + + + + 35 + + + 20 + + + + + + + + + CimClassName + + + CimClassMethods + + + CimClassProperties + + + + + + + + System.Guid + + System.Guid + + + + + + + Guid + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_PingStatus + + System.Management.ManagementObject#root\cimv2\Win32_PingStatus + + + + + + 13 + + + + 15 + + + + 16 + + + + 40 + + + + 8 + + + + 9 + + + + + + + __Server + + + Address + + + IPV4Address + + + IPV6Address + + + BufferSize + + + ResponseTime + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_PingStatus + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_PingStatus + + + + + + 13 + + + + 15 + + + + 16 + + + + 40 + + + + 8 + + + + 9 + + + + + + + ComputerName + + + Address + + + IPV4Address + + + IPV6Address + + + BufferSize + + + ResponseTime + + + + + + + + System.Management.ManagementObject#root\default\SystemRestore + + System.Management.ManagementObject#root\default\SystemRestore + + + + + + 22 + + + + 30 + + + + 17 + + + + 17 + + + + 22 + + + + + + + + return $_.ConvertToDateTime($_.CreationTime) + + + + Description + + + SequenceNumber + + + + $eventType = $_.EventType; + if($_.EventType -eq 100) + {$eventType = "BEGIN_SYSTEM_CHANGE";} + if($_.EventType -eq 101) + {$eventType = "END_SYSTEM_CHANGE";} + if($_.EventType -eq 102) + {$eventType = "BEGIN_NESTED_SYSTEM_CHANGE";} + if($_.EventType -eq 103) + {$eventType = "END_NESTED_SYSTEM_CHANGE";} + return $eventType; + + + + + $RestorePointType = $_.RestorePointType; + if($_.RestorePointType -eq 0) + { $RestorePointType = "APPLICATION_INSTALL";} + if($_.RestorePointType -eq 1) + { $RestorePointType = "APPLICATION_UNINSTALL";} + if($_.RestorePointType -eq 10) + { $RestorePointType = "DEVICE_DRIVER_INSTALL";} + if($_.RestorePointType -eq 12) + { $RestorePointType = "MODIFY_SETTINGS";} + if($_.RestorePointType -eq 13) + { $RestorePointType = "CANCELLED_OPERATION";} + return $RestorePointType; + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/default/SystemRestore + + Microsoft.Management.Infrastructure.CimInstance#root/default/SystemRestore + + + + + + 22 + + + + 30 + + + + 17 + + + + 17 + + + + 22 + + + + + + + + return $_.ConvertToDateTime($_.CreationTime) + + + + Description + + + SequenceNumber + + + + $eventType = $_.EventType; + if($_.EventType -eq 100) + {$eventType = "BEGIN_SYSTEM_CHANGE";} + if($_.EventType -eq 101) + {$eventType = "END_SYSTEM_CHANGE";} + if($_.EventType -eq 102) + {$eventType = "BEGIN_NESTED_SYSTEM_CHANGE";} + if($_.EventType -eq 103) + {$eventType = "END_NESTED_SYSTEM_CHANGE";} + return $eventType; + + + + + $RestorePointType = $_.RestorePointType; + if($_.RestorePointType -eq 0) + { $RestorePointType = "APPLICATION_INSTALL";} + if($_.RestorePointType -eq 1) + { $RestorePointType = "APPLICATION_UNINSTALL";} + if($_.RestorePointType -eq 10) + { $RestorePointType = "DEVICE_DRIVER_INSTALL";} + if($_.RestorePointType -eq 12) + { $RestorePointType = "MODIFY_SETTINGS";} + if($_.RestorePointType -eq 13) + { $RestorePointType = "CANCELLED_OPERATION";} + return $RestorePointType; + + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_QuickFixEngineering + + System.Management.ManagementObject#root\cimv2\Win32_QuickFixEngineering + + + + + + 13 + + + + 16 + + + + 13 + + + + 20 + + + + 26 + + + + + + + __SERVER + + + Description + + + HotFixID + + + InstalledBy + + + InstalledOn + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_QuickFixEngineering + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_QuickFixEngineering + + + + + + 13 + + + + 16 + + + + 13 + + + + 20 + + + + 26 + + + + + + + ComputerName + + + Description + + + HotFixID + + + InstalledBy + + + InstalledOn + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Process + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Process + + + + + + + + + 16 + + + + + + + + + + + + + + + + ProcessId + + + Name + + + HandleCount + + + WorkingSetSize + + + VirtualSize + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_ComputerSystem + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_ComputerSystem + + + + + + 16 + + + + + + + + + + + + + + + + + + + + + + Name + + + PrimaryOwnerName + + + Domain + + + TotalPhysicalMemory + + + Model + + + Manufacturer + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/WIN32_PROCESSOR + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/WIN32_PROCESSOR + + + + + + + + + 16 + + + + + + + + + + + + + + + + + + + DeviceID + + + Name + + + Caption + + + MaxClockSpeed + + + SocketDesignation + + + Manufacturer + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/WIN32_DCOMApplication + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/WIN32_DCOMApplication + + + + + + + + + 16 + + + + + + + + + + AppID + + + Name + + + InstallDate + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/WIN32_DESKTOP + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/WIN32_DESKTOP + + + + + + + + + 16 + + + + + + + + + + + + + + + + SettingID + + + Name + + + ScreenSaverActive + + + ScreenSaverSecure + + + ScreenSaverTimeout + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/WIN32_DESKTOPMONITOR + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/WIN32_DESKTOPMONITOR + + + + + + + + + 16 + + + + + + + + + + + + + + + + + + + DeviceID + + + Name + + + DisplayType + + + MonitorManufacturer + + + ScreenHeight + + + ScreenWidth + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_DeviceMemoryAddress + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_DeviceMemoryAddress + + + + + + 16 + + + + + + + + + + + + + Name + + + MemoryType + + + Status + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_DiskDrive + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_DiskDrive + + + + + + + + + + + + + + + + + + + + + + + + DeviceID + + + Caption + + + Partitions + + + Size + + + Model + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_DiskQuota + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_DiskQuota + + + + + + + + + + + + + + + + + + + + + DiskSpaceUsed + + + Limit + + + QuotaVolume + + + User + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Environment + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Environment + + + + + + 16 + + + + + + + + + + + + + Name + + + UserName + + + VariableValue + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Directory + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Directory + + + + + + 16 + + + + + + + + + + + + + + + + + + + Name + + + Hidden + + + Archive + + + Writeable + + + LastModified + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Group + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Group + + + + + + + + + 16 + + + + + + + + + + + + + SID + + + Name + + + Caption + + + Domain + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_IDEController + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_IDEController + + + + + + 16 + + + + + + + + + + + + + + + + + + + Name + + + Status + + + StatusInfo + + + ProtocolSupported + + + Manufacturer + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_IRQResource + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_IRQResource + + + + + + 16 + + + + + + + + + + + + + + + + + + + Name + + + IRQNumber + + + Hardware + + + TriggerLevel + + + TriggerType + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_ScheduledJob + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_ScheduledJob + + + + + + + + + 16 + + + + + + + + + + + + + + + + JobId + + + Name + + + Owner + + + Priority + + + Command + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_LoadOrderGroup + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_LoadOrderGroup + + + + + + 16 + + + + + + + + + + Name + + + GroupOrder + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_LogicalDisk + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_LogicalDisk + + + + + + + + + + + + 16 + + + + 16 + + + + + + + + + + + + + DeviceID + + + DriveType + + + ProviderName + + + VolumeName + + + Size + + + FreeSpace + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_LogonSession + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_LogonSession + + + + + + + + + 16 + + + + + + + + + + + + + + + + + + + LogonId + + + Name + + + LogonType + + + StartTime + + + Status + + + AuthenticationPackage + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_PhysicalMemoryArray + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_PhysicalMemoryArray + + + + + + 16 + + + + + + + + + + + + + + + + Name + + + MemoryDevices + + + MaxCapacity + + + Model + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_OnBoardDevice + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_OnBoardDevice + + + + + + + + + + + + + + + + + + + + + DeviceType + + + SerialNumber + + + Enabled + + + Description + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_OperatingSystem + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_OperatingSystem + + + + + + + + + + + + + + + + + + + + + + + + + + + SystemDirectory + + + Organization + + + BuildNumber + + + RegisteredUser + + + SerialNumber + + + Version + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_DiskPartition + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_DiskPartition + + + + + + 16 + + + + + + + + + + + + + + + + + + + + + + Name + + + NumberOfBlocks + + + BootPartition + + + PrimaryPartition + + + Size + + + Index + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_PortConnector + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_PortConnector + + + + + + + + + + + + + + + + + + + + + + + + Tag + + + PortType + + + ConnectorType + + + SerialNumber + + + ExternalReferenceDesignator + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_QuotaSetting + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_QuotaSetting + + + + + + + + + + + + + + + + + + + + + + + + + + + SettingID + + + Caption + + + State + + + VolumePath + + + DefaultLimit + + + DefaultWarningLimit + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_SCSIController + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_SCSIController + + + + + + 16 + + + + 16 + + + + + + + + + + + + + + + + + + + Name + + + DriverName + + + Status + + + StatusInfo + + + ProtocolSupported + + + Manufacturer + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Service + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Service + + + + + + + + + 16 + + + + + + + + + + + + + + + + + + + ProcessId + + + Name + + + StartMode + + + State + + + Status + + + ExitCode + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_UserAccount + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_UserAccount + + + + + + 16 + + + + + + + + + + + + + + + + + + + Name + + + Caption + + + AccountType + + + SID + + + Domain + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_NetworkProtocol + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_NetworkProtocol + + + + + + 16 + + + + + + + + + + + + + Name + + + Caption + + + Status + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_NetworkAdapter + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_NetworkAdapter + + + + + + + + + 16 + + + + + + + + + + + + + DeviceID + + + Name + + + AdapterType + + + ServiceName + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_NetworkAdapterConfiguration + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_NetworkAdapterConfiguration + + + + + + 16 + + + + + + + + + + + + + + + + ServiceName + + + DHCPEnabled + + + Index + + + Description + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_NTDomain + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_NTDomain + + + + + + 16 + + + + + + + + + + + + + DomainName + + + DnsForestName + + + DomainControllerName + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Printer + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Printer + + + + + + 16 + + + + + + + + + + + + + + + + + + + + + + Name + + + ShareName + + + SystemName + + + PrinterState + + + PrinterStatus + + + Location + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_PrintJob + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_PrintJob + + + + + + + + + 16 + + + + + + + + + + + + + + + + + + + + + + JobId + + + Name + + + JobStatus + + + Owner + + + Priority + + + Size + + + Document + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Product + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Product + + + + + + 16 + + + + + + + + + + + + + + + + + + + Name + + + Caption + + + Vendor + + + Version + + + IdentifyingNumber + + + + + + + + System.Net.NetworkCredential + + System.Net.NetworkCredential + + + + + + + 50 + + + + 50 + + + + + + + UserName + + + Domain + + + + + + + + System.Management.Automation.PSMethod + + System.Management.Automation.PSMethod + + + + + + + + + + + + + + $_.OverloadDefinitions | Out-String + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#__PartialCIMInstance + + Microsoft.Management.Infrastructure.CimInstance#__PartialCIMInstance + + + + + + + + + + $str = $_ | Microsoft.PowerShell.Utility\Format-List -Property * | Microsoft.PowerShell.Utility\Out-String + $str + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Event.Format.ps1xml b/newton-cn/bin/v1.0/Event.Format.ps1xml new file mode 100644 index 0000000..510b04c Binary files /dev/null and b/newton-cn/bin/v1.0/Event.Format.ps1xml differ diff --git a/newton-cn/bin/v1.0/Examples/profile.ps1 b/newton-cn/bin/v1.0/Examples/profile.ps1 new file mode 100644 index 0000000..3c16665 --- /dev/null +++ b/newton-cn/bin/v1.0/Examples/profile.ps1 @@ -0,0 +1,7 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# THIS SAMPLE CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, +# WHETHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. +# IF THIS CODE AND INFORMATION IS MODIFIED, THE ENTIRE RISK OF USE OR RESULTS IN +# CONNECTION WITH THE USE OF THIS CODE AND INFORMATION REMAINS WITH THE USER. \ No newline at end of file diff --git a/newton-cn/bin/v1.0/FileSystem.format.ps1xml b/newton-cn/bin/v1.0/FileSystem.format.ps1xml new file mode 100644 index 0000000..f91b8dc Binary files /dev/null and b/newton-cn/bin/v1.0/FileSystem.format.ps1xml differ diff --git a/newton-cn/bin/v1.0/Help.format.ps1xml b/newton-cn/bin/v1.0/Help.format.ps1xml new file mode 100644 index 0000000..13c169a --- /dev/null +++ b/newton-cn/bin/v1.0/Help.format.ps1xml @@ -0,0 +1,2235 @@ + + + + + + TextPropertyControl + + + + + + Text + + + + + + + + MamlShortDescriptionControl + + + + + MamlParaTextItem + + + + Text + + + + + + + + + + + + + + MamlDetailsControl + + + + + + + + 4 + + + Name + + + + + + + + + 4 + + + Description + + MamlShortDescriptionControl + + + + + + + + + + + + MamlIndentedDescriptionControl + + + + + + + + 4 + + + description + + MamlDescriptionControl + + + + + + + + + + + + MamlDescriptionControl + + + + + MamlParaTextItem + + + + Text + + + + + + + MamlOrderedListTextItem + + + + 4 + + + Tag + + + Text + + + + + + + + + MamlUnorderedListTextItem + + + + 2 + + + Tag + + + Text + + + + + + + + + MamlDefinitionTextItem + + + + Term + + + + 4 + + + Definition + + + + + + + + + + + + + + + + MamlParameterControl + + + + + + +$optional = $_.required -ne "true" +$positional = (($_.position -ne $()) -and ($_.position -ne "") -and ($_.position -notmatch "named") -and ([int]$_.position -ne $())) +$parameterValue = if ($null -ne $_.psobject.Members['ParameterValue']) { + " <$($_.ParameterValue)>" +} elseif ($null -ne $_.psobject.Members['ParameterValueGroup']) { + " {$($_.ParameterValueGroup.ParameterValue -join ' | ')}" +} else { + "" +} +$(if ($optional -and $positional) { "[[-{0}]{1}] " } +elseif ($optional) { "[-{0}{1}] " } +elseif ($positional) { "[-{0}]{1} " } +else { "-{0}{1} " }) -f $_.Name, $parameterValue + + + + + + + + + MamlParameterValueControl + + + + + + if ($_.required -ne "true") { " [<$_>]" } else { " <$_>" } + + + + + + + + ExamplesControl + + + + + + Example + + MamlExampleControl + + + + + + + + MamlExampleControl + + + + + + Title + + + + + Introduction + + TextPropertyControl + + + Code + + + + + results + + + + remarks + + MamlShortDescriptionControl + + + + + + + + MamlTypeControl + + + + + + name + + + + + $_.uri + + + + + + + + 4 + + + uri + + + + + + + + + + + + $_.description + + + + + + + 4 + + + description + + MamlShortDescriptionControl + + + + + + + + + + + + + + + MamlTextItem + + + + + MamlParaTextItem + + + + Text + + + + + + + MamlOrderedListTextItem + + + + Tag + + + Text + + + + + + + MamlUnorderedListTextItem + + + + Tag + + + Text + + + + + + + MamlDefinitionTextItem + + + + Term + + + + 4 + + + Definition + + + + + + + + + MamlPreformattedTextItem + + + + Text + + + + + + + + + + + + + MamlAlertControl + + + + + + Text + + + + + + + + + MamlPossibleValuesControl + + + + + + possibleValues + MamlPossibleValueControl + + + + + + + + MamlPossibleValueControl + + + + + + possibleValue + + + + + + + Value + + + + 4 + + + Description + + MamlShortDescriptionControl + + + + + + + + + + + + + + + + MamlTrueFalseShortControl + + + + + + + $_.Equals("true", [System.StringComparison]::OrdinalIgnoreCase) + + ; + + + + + + + + + + + + + $_.Equals("false", [System.StringComparison]::OrdinalIgnoreCase) + + ; + + + + + + + + + + + + + + + + + MamlIndentedSyntaxControl + + + + + + + + 4 + + + Syntax + MamlSyntaxControl + + + + + + + + + + + CommonWorkflowParametersControl + + + + + + +$wfp = $_.psobject.Properties['WorkflowCommonParameters'] +if ($null -ne $wfp -and $wfp.Value) +{ + if ($psversiontable.psversion.Major -gt 2) + { + $assembly = [System.Reflection.Assembly]::Load("System.Management.Automation") + $resourceManager = New-Object System.Resources.ResourceManager -ArgumentList "HelpDisplayStrings", $assembly + "[{0}]" -f $resourceManager.GetString("CommonWorkflowParameters") + } + else + { + "[<WorkflowCommonParameters>]" + } +} + + + + + + + + + MamlSyntaxControl + + + + + + SyntaxItem + + + + + + + name + + + + Parameter + + MamlParameterControl + + + CommonWorkflowParametersControl + + [ + + ] + + + + + + + + + + + + + + MamlTypeWithDescriptionControl + + + + + + type + MamlTypeControl + + + + 4 + + + description + + MamlShortDescriptionControl + + + + + + + + + + + RelatedLinksHelpInfoControl + + + + + + 4 + + + + Set-StrictMode -Off + if(($psversiontable.psversion.Major -gt 2) -and ($_.relatedLinks -ne $()) -and ($_.relatedLinks.navigationLink -ne $()) -and ($_.relatedLinks.navigationLink.Length -ne 0)) + { + $assembly = [System.Reflection.Assembly]::Load("System.Management.Automation") + $resourceManager = New-Object System.Resources.ResourceManager -ArgumentList "HelpDisplayStrings", $assembly + [String]::Format(" {0}{1}", $resourceManager.GetString("RelatedLinksHelpInfo"), "`"get-help " + $_.Details.Name + " -online`"`n") + } + + + + + + + + + + + MamlRelatedLinksControl + + + + + + navigationLink + + + + + + + linkText + + + + $_.linkText.Length -ne 0 + + " " + + + uri + + + + + + + + + + + + + + ErrorControl + + + + + + errorId + + + + category + + ) + + + 4 + + + description + + MamlShortDescriptionControl + + + + + + + type + MamlTypeControl + + + + + targetObjectType + MamlTypeControl + + + + + recommendedAction + + MamlShortDescriptionControl + + + + + + + + + + MamlFullParameterControl + + + + + - + + name + + + ParameterValue + MamlParameterValueControl + + + + 4 + + + Description + + MamlDescriptionControl + + + + + $_.possibleValues -ne $() + + + MamlPossibleValuesControl + + + + required + MamlTrueFalseShortControl + + + + + + ($_.position -eq $()) -or ($_.position -eq "") + + + + + + + + + + + + + + + $_.position -ne $() + + $_.position + + + + + defaultValue + + + + + pipelineInput + + + + + globbing + MamlTrueFalseShortControl + + + + + + + + + + + + zzz + + + + + + + + + + + Parameter + + MamlFullParameterControl + + + + + + + + + + 4 + + + + + + + + + + + + + + + + + help + + HelpInfoShort + + + + + + 33 + left + + + + 9 + left + + + + 25 + left + + + + + + + + Name + + + Category + + + if ($_.ModuleName -ne $null) { $_.ModuleName } else {$_.PSSnapIn} + + + Synopsis + + + + + + + + + CmdletHelp + + CmdletHelpInfo + + + + + + + + + 4 + + + Name + + + + + + + + + 4 + + + Syntax + + + + + + + + + + + + DefaultCommandHelp + + MamlCommandHelpInfo + + + + + + + Details + MamlDetailsControl + + + $_ + MamlIndentedSyntaxControl + + + $_ + MamlIndentedDescriptionControl + + + + + 4 + + + relatedLinks + MamlRelatedLinksControl + + + + + + + + 4 + + + " + + "get-help " + $_.Details.Name + " -examples" + + ". + + + " + + "get-help " + $_.Details.Name + " -detailed" + + ". + + + " + + "get-help " + $_.Details.Name + " -full" + + ". + + + RelatedLinksHelpInfoControl + + + + + + + + + + + VerboseCommandHelp + + MamlCommandHelpInfo#DetailedView + + + + + + + Details + MamlDetailsControl + + + $_ + MamlIndentedSyntaxControl + + + $_ + MamlIndentedDescriptionControl + + + + + 4 + + + Parameters + + + + + + Parameter + + + + + + - + + name + + + ParameterValue + MamlParameterValueControl + + + + 4 + + + Description + + MamlDescriptionControl + + + + + + + + + + + + + + + + CommonWorkflowParametersControl + + + + + 4 + + + + + + + + + + + 4 + + + Examples + ExamplesControl + + + + + + + 4 + + + " + + "get-help " + $_.Details.Name + " -examples" + + ". + + + " + + "get-help " + $_.Details.Name + " -detailed" + + ". + + + " + + "get-help " + $_.Details.Name + " -full" + + ". + + + RelatedLinksHelpInfoControl + + + + + + + + + + + ExampleCommandHelp + + MamlCommandHelpInfo#ExamplesView + + + + + + + Details + MamlDetailsControl + + + + 4 + + + Examples + ExamplesControl + + + + + + + + + + + FullCommandHelp + + MamlCommandHelpInfo#FullView + + + + + + + Details + MamlDetailsControl + + + $_ + MamlIndentedSyntaxControl + + + $_ + MamlIndentedDescriptionControl + + + + + 4 + + + Parameters + zzz + + + + + + + 4 + + + InputTypes + + + + + + InputType + + MamlTypeWithDescriptionControl + + + + + + + + + + + + + 4 + + + ReturnValues + + + + + + ReturnValue + + MamlTypeWithDescriptionControl + + + + + + + + + + + + + + (($_.terminatingErrors -ne $null) -and + ($_.terminatingErrors.terminatingError -ne $null)) + + + terminatingErrors + + + + + + + + 4 + + + terminatingError + + ErrorControl + + + + + + + + + + + + + (($_.nonTerminatingErrors -ne $null) -and + ($_.nonTerminatingErrors.nonTerminatingError -ne $null)) + + + nonTerminatingErrors + + + + + + + + 4 + + + nonTerminatingError + + ErrorControl + + + + + + + + + + + + $_.alertSet -ne $null + + alertSet + + + + + + + + + + + + + + $_.alertSet -ne $null + + alertSet + + + + + + + 4 + + + title + + + + + 4 + + + alert + + MamlAlertControl + + + + + + + + + + + + + + 4 + + + Examples + ExamplesControl + + + + + + + + 4 + + + relatedLinks + MamlRelatedLinksControl + + + + + + + + + + ProviderHelpInfo + + ProviderHelpInfo + + + + ProviderTasks + + + + + + + Task + Task + + + + + + + + + TaskExamplesControl + + + + + + + Example + TaskExampleControl + + + + + + + + TaskExampleControl + + + + + + Title + + + + + Introduction + + TextPropertyControl + + + + + Code + + + + + results + + + + + remarks + + MamlTextItem + + + + + + + + Task + + + + + + + + + Title + + + + + + + 4 + + + + Description + MamlTextItem + + + + + + Examples + TaskExamplesControl + + + + + + + + + + + + DynamicPossibleValues + + + + + + 4 + + + Value + + + + + + 8 + + + + Description + MamlTextItem + + + + + + + + + + + DynamicParameterControl + + + + + + + - + + Name + + + + Type + + + + + + + "<" + $_.Name + ">" + + + + + + + + + + + 4 + + + Description + + + + + PossibleValues + + + + + + PossibleValue + + DynamicPossibleValues + + + + + + + + + + CmdletSupported + + + + + + + + + + + + + + + + + + + 4 + + + Name + + + + + + + + + 4 + + + + Drives + MamlTextItem + + + + + + + + 4 + + + + Synopsis + + + + + + + + + 4 + + + DetailedDescription + + MamlTextItem + + + + + + + + 4 + + + Capabilities + + MamlTextItem + + + + + + + + 4 + + + + Tasks + ProviderTasks + + + + + + + + 4 + + + DynamicParameters + + + + + + DynamicParameter + + DynamicParameterControl + + + + + + + + + + + + + 4 + + + Notes + + + + + + + + + 4 + + + relatedLinks + MamlRelatedLinksControl + + + + + + + + + + FaqHelpInfo + + FaqHelpInfo + + + + + + + + Title + + + + + Question + + + + + + 4 + + + Answer + + MamlTextItem + + + + + + + + + + + GeneralHelpInfo + + GeneralHelpInfo + + + + + + + + Title + + + + + + + 4 + + + Content + + MamlTextItem + + + + + + + + + + + GlossaryHelpInfo + + GlossaryHelpInfo + + + + + + + + Name + + + + + + 4 + + + Definition + + MamlTextItem + + + + + + + + + + + ScriptHelpInfo + + ScriptHelpInfo + + + + + + + + Title + + + + + + 4 + + + Content + + MamlTextItem + + + + + + + + + + + MamlCommandExamples + + MamlCommandHelpInfo#Examples + + + + + + + $_ + ExamplesControl + + + + + + + + MamlCommandExample + + MamlCommandHelpInfo#Example + + + + + + + Title + + + + + Introduction + + TextPropertyControl + + + Code + + + + + + results + + + + + remarks + + MamlShortDescriptionControl + + + + + + + + MamlCommandDetails + + MamlCommandHelpInfo#commandDetails + + + + + + + + + 4 + + + Name + + + + + + + + + 4 + + + commandDescription + + MamlShortDescriptionControl + + + + + + + + + + MamlCommandParameters + + MamlCommandHelpInfo#Parameters + + + + + + + 4 + + + zzz + + + + + + + + + + MamlCommandParameterView + + MamlCommandHelpInfo#Parameter + + + + + + + $_ + MamlFullParameterControl + + + + + + + + MamlCommandSyntax + + MamlCommandHelpInfo#Syntax + + + + + + + $_ + MamlSyntaxControl + + + + + + + + MamlText + + MamlParaTextItem + MamlOrderedListTextItem + MamlUnorderedListTextItem + MamlDefinitionTextItem + + + + + + + $_ + MamlDescriptionControl + + + + + + + + MamlInputTypes + + MamlCommandHelpInfo#inputTypes + + + + + + + InputType + + MamlTypeWithDescriptionControl + + + + + + + + MamlNonTerminatingErrors + + MamlCommandHelpInfo#nonTerminatingErrors + + + + + + + nonTerminatingError + + ErrorControl + + + + + + + + MamlTerminatingErrors + + MamlCommandHelpInfo#terminatingErrors + + + + + + + terminatingError + + ErrorControl + + + + + + + + MamlRelatedLinks + + MamlCommandHelpInfo#relatedLinks + + + + + + + $_ + MamlRelatedLinksControl + + + + + + + + MamlReturnTypes + + MamlCommandHelpInfo#returnValues + + + + + + + ReturnValue + + MamlTypeWithDescriptionControl + + + + + + + + MamlAlertSet + + MamlCommandHelpInfo#alertSet + + + + + + + title + + + + + 4 + + + alert + + MamlAlertControl + + + + + + + + + + MamlDetails + + MamlCommandHelpInfo#details + + + + + + + $_ + MamlDetailsControl + + + + + + + + diff --git a/newton-cn/bin/v1.0/HelpV3.format.ps1xml b/newton-cn/bin/v1.0/HelpV3.format.ps1xml new file mode 100644 index 0000000..969255a --- /dev/null +++ b/newton-cn/bin/v1.0/HelpV3.format.ps1xml @@ -0,0 +1,2760 @@ + + + + + + MamlParameterValueGroupControl + + + + + + + $_.ParameterValue.Length -ne $() + + " {$($_.ParameterValue -join ' | ')}" + + + + + + + + MamlParameterControl + + + + + + + $_.required -ne "true" + + "[" + + + + + (($_.position -ne $()) -and ($_.position -ne "") -and ($_.position -notmatch "named") -and ([int]$_.position -ne $())) + + "[" + + + Name + + + + + - + + $_ + + + + + + + + + + (($_.position -ne $()) -and ($_.position -ne "") -and ($_.position -notmatch "named") -and ([int]$_.position -ne $())) + + "]" + + + ParameterValue + MamlParameterValueControl + + + ParameterValueGroup + MamlParameterValueGroupControl + + + + $_.required -ne "true" + + "]" + + + + + + + + + MamlTypeControl + + + + + + name + + + + + + + + + MamlParameterValueControl + + + + + + + + $_.required -ne "true" + + "[" + + + "<" + $_ + ">" + + + + $_.required -ne "true" + + "]" + + + + + + + + MamlPossibleValueControl + + + + + + possibleValue + + + + + + + Value + + + + + + + + + + + + + + MamlShortDescriptionControl + + + + + MamlParaTextItem + + + + Text + + + + + + + + + + + + + + MamlDescriptionControl + + + + + MamlParaTextItem + + + + Text + + + + + + + MamlOrderedListTextItem + + + + 4 + + + Tag + + + Text + + + + + + + + + MamlUnorderedListTextItem + + + + 2 + + + Tag + + + Text + + + + + + + + + MamlDefinitionTextItem + + + + Term + + + + 4 + + + Definition + + + + + + + + + + + + + + + + MamlExampleControl + + + + + + Title + + + Introduction + + + + + + + Text + + + + + + + + Code + + + + + results + + + + remarks + + MamlShortDescriptionControl + + + + + + + + MamlFieldCustomControl + + + + + MamlPSClassHelpInfo#field + + + + "[" + $_.fieldData.type.name + "] $" + $_.fieldData.name + + + + $_.introduction.text + + + + + + + + + + + + + + + MamlMethodCustomControl + + + + + MamlPSClassHelpInfo#method + + + + + + + + function GetParam + { + if(-not $_.Parameters) + { + return $null + } + $_.Parameters.Parameter | + %{ + + if($_.type) + { + $param = "[$($_.type.name)] `$$($_.name), " + } + else + { + $param = "[object] `$$($_.name), " + } + + $params += $param + } + + $params = $params.Remove($params.Length - 2) + return $params + } + + $paramOutput = GetParam + + "[" + $_.returnValue.type.name + "] " + $_.title + "(" + $($paramOutput) + ")" + + + + + $_.introduction.text + + + + + + + + + + + + + + + + RelatedLinksHelpInfoControl + + + + + + 4 + + + + if(($psversiontable.psversion.Major -gt 2) -and ($_.relatedLinks -ne $()) -and ($_.relatedLinks.navigationLink -ne $()) -and ($_.relatedLinks.navigationLink.Length -ne 0)) + { + $assembly = [System.Reflection.Assembly]::Load("System.Management.Automation") + $resourceManager = New-Object System.Resources.ResourceManager -ArgumentList "HelpDisplayStrings", $assembly + [String]::Format(" {0}{1}", $resourceManager.GetString("RelatedLinksHelpInfo"), "`"get-help " + $_.Details.Name + " -online`"`n") + } + + + + + + + + + + + + + + ReducedDefaultCommandHelp + + ExtendedCmdletHelpInfo + + + + + + + Details + + + + + + + + 4 + + + Name + + + + + + + + + + + + + + 4 + + + Syntax + + + + + + SyntaxItem + + + + + + + name + + + + Parameter + + MamlParameterControl + + + + $_.WorkflowCommonParameters -eq $true + + + + + + + [ + + ] + + + + + + + + + $_.CommonParameters -eq $true + + + + + + + [ + + ] + + + + + + + + + + + + + + + + + + + + + + + + 4 + + + Aliases + + + + + + + + + 4 + + + Remarks + + + + + + + + + + + ReducedVerboseCommandHelp + + ExtendedCmdletHelpInfo#DetailedView + + + + + + + Details + + + + + + + + 4 + + + Name + + + + + + + + + + + + + + 4 + + + Syntax + + + + + + SyntaxItem + + + + + + + name + + + + Parameter + + MamlParameterControl + + + + $_.WorkflowCommonParameters -eq $true + + + + + + + [ + + ] + + + + + + + + + $_.CommonParameters -eq $true + + + + + + + [ + + ] + + + + + + + + + + + + + + + + + + + + + + + + 4 + + + Parameters + + + + + + Parameter + + + + + + - + + name + + + ParameterValue + MamlParameterValueControl + + + + + + + + + + + + + + + + $_.WorkflowCommonParameters -eq $true + + + + + + + + + + 4 + + + + + + + + + + + + + + $_.CommonParameters -eq $true + + + + + + + + + + 4 + + + + + + + + + + + + + + ($_.CommonParameters -eq $false) -and ($_.parameters.parameter.count -eq 0) + + + + + + + + + + + + + + + + + + + + + 4 + + + Aliases + + + + + + + + + 4 + + + Remarks + + + + + + + + + + + ReducedFullCommandHelp + + ExtendedCmdletHelpInfo#FullView + + + + + + + Details + + + + + + + + 4 + + + Name + + + + + + + + + + + + + + 4 + + + Syntax + + + + + + SyntaxItem + + + + + + + name + + + + Parameter + + MamlParameterControl + + + + $_.WorkflowCommonParameters -eq $true + + + + + + + [ + + ] + + + + + + + + + $_.CommonParameters -eq $true + + + + + + + [ + + ] + + + + + + + + + + + + + + + + + + + + + + + + 4 + + + Parameters + + + + + + Parameter + + + + + + - + + name + + + ParameterValue + MamlParameterValueControl + + + + 4 + + + + $_.description -ne $() + + description + + + + $_.possibleValues -ne $() + + + + + + + + possibleValues + MamlPossibleValueControl + + + + + + + + + + + $_.required.ToLower().Equals("true") + + + + + + + + + + + + + + + $_.required.ToLower().Equals("false") + + + + + + + + + + + + + + + + + ($_.position -eq $()) -or ($_.position -eq "") + + + + + + + + + + + + + + + $_.position -ne $() + + $_.position + + + + + pipelineInput + + + + + parameterSetName + + + + + aliases + + + + + isDynamic + + + + + + + + + + + + + + + + + + $_.WorkflowCommonParameters -eq $true + + + + + + + + + + 4 + + + + + + + + + + + + + + $_.CommonParameters -eq $true + + + + + + + + + + 4 + + + + + + + + + + + + + + ($_.CommonParameters -eq $false) -and ($_.parameters.parameter.count -eq 0) + + + + + + + + + + + + + + + + + + + + + 4 + + + InputTypes + + + + + + InputType + + + + + + + type + MamlTypeControl + + + + + + + + + + + + + + + + + + + 4 + + + ReturnValues + + + + + + ReturnValue + + + + + + + type + MamlTypeControl + + + + + + + + + + + + + + + + + + + 4 + + + Aliases + + + + + + + + + 4 + + + Remarks + + + + + + + + + + + ReducedExamplesCommandHelp + + ExtendedCmdletHelpInfo#ExamplesView + + + + + + + Details + + + + + + + + 4 + + + Name + + + + + + + + + + + + + + 4 + + + Aliases + + + + + + + + + 4 + + + Remarks + + + + + + + + + + + ReducedCommandHelpParameterView + + ExtendedCmdletHelpInfo#parameter + + + + + + + + + + + + - + + name + + + ParameterValue + MamlParameterValueControl + + + + 4 + + + + $_.description -ne $() + + description + + + + $_.possibleValues -ne $() + + + + + + + + possibleValues + MamlPossibleValueControl + + + + + + + + + + + $_.required.ToLower().Equals("true") + + + + + + + + + + + + + + + $_.required.ToLower().Equals("false") + + + + + + + + + + + + + + + + + ($_.position -eq $()) -or ($_.position -eq "") + + + + + + + + + + + + + + + $_.position -ne $() + + $_.position + + + + + pipelineInput + + + + + parameterSetName + + + + + aliases + + + + + isDynamic + + + + + + + + + + + + + + + + + VerboseRecord + + + System.Management.Automation.VerboseRecord + + + + + + + Message + + + + + + + + DeserializedVerboseRecord + + + Deserialized.System.Management.Automation.VerboseRecord + + + + + + + InformationalRecord_Message + + + + + + + + DebugRecord + + + System.Management.Automation.DebugRecord + + + + + + + Message + + + + + + + + DeserializedDebugRecord + + + Deserialized.System.Management.Automation.DebugRecord + + + + + + + InformationalRecord_Message + + + + + + + + DscResourceHelp + + DscResourceHelpInfo#FullView + + + + + + + Details + + + + + + + + 4 + + + Name + + + + + + + + + 4 + + + Description + + MamlShortDescriptionControl + + + + + + + + + + + + + 4 + + + description + + MamlDescriptionControl + + + + + + + + 4 + + + Properties + + + + + + Parameter + + + + + + + name + + + ParameterValue + MamlParameterValueControl + + + + 4 + + + Description + + MamlDescriptionControl + + + + $_.possibleValues -ne $() + + + + + + + + possibleValues + MamlPossibleValueControl + + + + + + + + + + + $_.required.ToLower().Equals("true") + + + + + + + + + + + + + + + $_.required.ToLower().Equals("false") + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 4 + + + Examples + + + + + + Example + + MamlExampleControl + + + + + + + + + + + + 4 + + + relatedLinks + + + + + + navigationLink + + + + + + + linkText + + + + $_.linkText.Length -ne 0 + + " " + + + uri + + + + + + + + + + + + + + + + + + + 4 + + + " + + "get-help " + $_.Details.Name + " -examples" + + ". + + + " + + "get-help " + $_.Details.Name + " -detailed" + + ". + + + " + + "get-help " + $_.Details.Name + " -full" + + ". + + + RelatedLinksHelpInfoControl + + + + + + + + + + DscResourceHelp + + DscResourceHelpInfo#DetailedView + + + + + + + Details + + + + + + + + 4 + + + Name + + + + + + + + + 4 + + + Description + + MamlShortDescriptionControl + + + + + + + + + + + + + 4 + + + description + + MamlDescriptionControl + + + + + + + + 4 + + + Properties + + + + + + Parameter + + + + + + + name + + + ParameterValue + MamlParameterValueControl + + + + 4 + + + Description + + MamlDescriptionControl + + + + + + + + + + + + + + + + + + + + + 4 + + + Examples + + + + + + Example + + MamlExampleControl + + + + + + + + + + + + 4 + + + relatedLinks + + + + + + navigationLink + + + + + + + linkText + + + + $_.linkText.Length -ne 0 + + " " + + + uri + + + + + + + + + + + + + + + + + + + 4 + + + " + + "get-help " + $_.Details.Name + " -examples" + + ". + + + " + + "get-help " + $_.Details.Name + " -detailed" + + ". + + + " + + "get-help " + $_.Details.Name + " -full" + + ". + + + RelatedLinksHelpInfoControl + + + + + + + + + + DscResourceHelp + + DscResourceHelpInfo + + + + + + + Details + + + + + + + + 4 + + + Name + + + + + + + + + 4 + + + Description + + MamlShortDescriptionControl + + + + + + + + + + + + + 4 + + + description + + MamlDescriptionControl + + + + + + + + 4 + + + relatedLinks + + + + + + navigationLink + + + + + + + linkText + + + + $_.linkText.Length -ne 0 + + " " + + + uri + + + + + + + + + + + + + + + + + + + 4 + + + " + + "get-help " + $_.Details.Name + " -examples" + + ". + + + " + + "get-help " + $_.Details.Name + " -detailed" + + ". + + + " + + "get-help " + $_.Details.Name + " -full" + + ". + + + + + + + + 4 + + + + if(($psversiontable.psversion.Major -gt 2) -and ($_.relatedLinks -ne $()) -and ($_.relatedLinks.navigationLink -ne $()) -and ($_.relatedLinks.navigationLink.Length -ne 0)) + { + $assembly = [System.Reflection.Assembly]::Load("System.Management.Automation") + $resourceManager = New-Object System.Resources.ResourceManager -ArgumentList "HelpDisplayStrings", $assembly + [String]::Format(" {0}{1}", $resourceManager.GetString("RelatedLinksHelpInfo"), "`"get-help " + $_.Details.Name + " -online`"`n") + } + + + + + + + + + + + + + + + + + + PSClassHelp + + PSClassHelpInfo#FullView + + + + + + + + + + + + + + 4 + + + Name + + + + + + + + + 4 + + + Introduction + + MamlShortDescriptionControl + + + + + + + + 4 + + + members + + + + + + member + + + + + + + MamlFieldCustomControl + + + + + + + + + + + + + + + + + + 4 + + + members + + + + + + member + + + + + + + MamlMethodCustomControl + + + + + + + + + + + + + + + + + + + 4 + + + Examples + + + + + + Example + + MamlExampleControl + + + + + + + + + + + + 4 + + + relatedLinks + + + + + + navigationLink + + + + + + + linkText + + + + $_.linkText.Length -ne 0 + + " " + + + uri + + + + + + + + + + + + + + + + + + + 4 + + + " + + "get-help " + $_.Details.Name + " -examples" + + ". + + + " + + "get-help " + $_.Details.Name + " -detailed" + + ". + + + " + + "get-help " + $_.Details.Name + " -full" + + ". + + + + + + + + 4 + + + + if(($psversiontable.psversion.Major -gt 2) -and ($_.relatedLinks -ne $()) -and ($_.relatedLinks.navigationLink -ne $()) -and ($_.relatedLinks.navigationLink.Length -ne 0)) + { + $assembly = [System.Reflection.Assembly]::Load("System.Management.Automation") + $resourceManager = New-Object System.Resources.ResourceManager -ArgumentList "HelpDisplayStrings", $assembly + [String]::Format(" {0}{1}", $resourceManager.GetString("RelatedLinksHelpInfo"), "`"get-help " + $_.Details.Name + " -online`"`n") + } + + + + + + + + + + + + + + + + + + + + + + + + PSClassHelp + + PSClassHelpInfo#DetailedView + + + + + + + + + + + + + + 4 + + + Name + + + + + + + + + 4 + + + Introduction + + MamlShortDescriptionControl + + + + + + + + 4 + + + members + + + + + + member + + + + + + + MamlFieldCustomControl + + + + + + + + + + + + + + + + + + 4 + + + members + + + + + + member + + + + + + + MamlMethodCustomControl + + + + + + + + + + + + + + + + + + + 4 + + + Examples + + + + + + Example + + MamlExampleControl + + + + + + + + + + + + 4 + + + relatedLinks + + + + + + navigationLink + + + + + + + linkText + + + + $_.linkText.Length -ne 0 + + " " + + + uri + + + + + + + + + + + + + + + + + + + 4 + + + " + + "get-help " + $_.Details.Name + " -examples" + + ". + + + " + + "get-help " + $_.Details.Name + " -detailed" + + ". + + + " + + "get-help " + $_.Details.Name + " -full" + + ". + + + + + + + + 4 + + + + if(($psversiontable.psversion.Major -gt 2) -and ($_.relatedLinks -ne $()) -and ($_.relatedLinks.navigationLink -ne $()) -and ($_.relatedLinks.navigationLink.Length -ne 0)) + { + $assembly = [System.Reflection.Assembly]::Load("System.Management.Automation") + $resourceManager = New-Object System.Resources.ResourceManager -ArgumentList "HelpDisplayStrings", $assembly + [String]::Format(" {0}{1}", $resourceManager.GetString("RelatedLinksHelpInfo"), "`"get-help " + $_.Details.Name + " -online`"`n") + } + + + + + + + + + + + + + + + + + + + + + + + PSClassHelp + + PSClassHelpInfo + + + + + + + + + + + + + + 4 + + + Name + + + + + + + + + 4 + + + Introduction + + MamlShortDescriptionControl + + + + + + + + + + + + + + 4 + + + relatedLinks + + + + + + navigationLink + + + + + + + linkText + + + + $_.linkText.Length -ne 0 + + " " + + + uri + + + + + + + + + + + + + + + + + + + 4 + + + " + + "get-help " + $_.Name + " -examples" + + ". + + + " + + "get-help " + $_.Name + " -detailed" + + ". + + + " + + "get-help " + $_.Name + " -full" + + ". + + + + + + + + 4 + + + + if(($psversiontable.psversion.Major -gt 2) -and ($_.relatedLinks -ne $()) -and ($_.relatedLinks.navigationLink -ne $()) -and ($_.relatedLinks.navigationLink.Length -ne 0)) + { + $assembly = [System.Reflection.Assembly]::Load("System.Management.Automation") + $resourceManager = New-Object System.Resources.ResourceManager -ArgumentList "HelpDisplayStrings", $assembly + [String]::Format(" {0}{1}", $resourceManager.GetString("RelatedLinksHelpInfo"), "`"get-help " + $_.Details.Name + " -online`"`n") + } + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/AppBackgroundTask/AppBackgroundTask.psd1 b/newton-cn/bin/v1.0/Modules/AppBackgroundTask/AppBackgroundTask.psd1 new file mode 100644 index 0000000..863a5cf --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/AppBackgroundTask/AppBackgroundTask.psd1 @@ -0,0 +1,35 @@ +@{ + GUID = '{eb40bd55-3bab-4fa6-88ee-0dcf3cad5a25}' + Author = 'Microsoft Corporation' + CompanyName = 'Microsoft Corporation' + Copyright = '© Microsoft Corporation. All rights reserved.' + ModuleVersion = '1.0.0.0' + PowerShellVersion = '5.1' + HelpInfoUri = "https://go.microsoft.com/fwlink/?LinkID=286813" + + NestedModules = @( + "PS_BackgroundTask.cdxml", + "microsoft.windows.appbackgroundtask.commands.dll") + FunctionsToExport = @( + "Unregister-AppBackgroundTask", + "Get-AppBackgroundTask", + "Start-AppBackgroundTask" + ) + AliasesToExport = @( + 'iru', + 'pfn', + 'tid' + ) + CmdletsToExport = @( + "Disable-AppBackgroundTaskDiagnosticLog", + "Enable-AppBackgroundTaskDiagnosticLog", + "Set-AppBackgroundTaskResourcePolicy" + ) + FormatsToProcess = @( + 'MSFT_BackgroundTask.Format.ps1xml' + ) + CompatiblePSEditions = @( + 'Core', + 'Desktop' + ) +} diff --git a/newton-cn/bin/v1.0/Modules/AppBackgroundTask/MSFT_BackgroundTask.Format.ps1xml b/newton-cn/bin/v1.0/Modules/AppBackgroundTask/MSFT_BackgroundTask.Format.ps1xml new file mode 100644 index 0000000..aec4c60 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/AppBackgroundTask/MSFT_BackgroundTask.Format.ps1xml @@ -0,0 +1,266 @@ + + + + + MSFT_BackgroundTask_TableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_BackgroundTask + + + + + 65 + + + + + + + + + + + + + + + PackageFullName + + + + try + { + $oldValue = $global:FormatEnumerationLimit + $global:FormatEnumerationLimit = 100 + $result="" + $result2="" + $rawUI = $Host.UI.RawUI.BufferSize.Width + if( $rawUI -gt 0 ) { + $maxLen = 0 + $finalLen = 0 + foreach($package in Get-AppxPackage) + { + $currPackage = $package.PackageFamilyName + if( $currPackage.Length -gt $maxLen ) { + $maxLen = $currPackage.Length + } + } + $finalLen = $maxLen + $rawUI = ($rawUI - 65) + $rawUI = ($rawUI / 2) + + for( $i = 0; $i -lt ($_.EntryPoint.Count); $i++ ) + { + if ( $rawUI -gt $_.EntryPoint[$i].Length ) { + $result2=$_.EntryPoint[$i] + $result2 = $result2.TrimStart("{") + $result2 = $result2.TrimEnd("}") + $result2 = $result2+"`r`n" + $result = $result+$result2 + } else { + $result2=$_.EntryPoint[$i] + $result2 = $result2.TrimStart("{") + $result2 = $result2.TrimEnd("}") + $result2 = $result2.Substring(0, ($rawUI - 7 ) )+"..." + $result2 = $result2+"`r`n" + $result = $result+$result2 + } + } + $result + + } else { + for( $i = 0; $i -lt ($_.EntryPoint.Count); $i++ ) + { + $result2=$_.EntryPoint[$i] + $result2 = $result2.TrimStart("{") + $result2 = $result2.TrimEnd("}") + $result2 = $result2.Substring(0, 22 )+"..." + $result2 = $result2+"`r`n" + $result = $result+$result2 + } + $result + } + + } + finally + { + $global:FormatEnumerationLimit = $oldvalue + } + + + + + try + { + $oldValue = $global:FormatEnumerationLimit + $global:FormatEnumerationLimit = 100 + $result="" + $result2="" + $rawUI = $Host.UI.RawUI.BufferSize.Width + + # Only dynamically resize if we're not in the default output layout + + if( $rawUI -gt 120) { + $maxLen = 0 + $finalLen = 0 + foreach($package in Get-AppxPackage) + { + $currPackage = $package.PackageFamilyName + if( $currPackage.Length -gt $maxLen ) { + $maxLen = $currPackage.Length + } + } + $finalLen = $maxLen + $rawUI = ($rawUI - 65) + $rawUI = ($rawUI / 2) + + for( $i = 0; $i -lt ($_.EntryPoint.Count); $i++ ) + { + if ( $rawUI -gt $_.TaskID[$i].Length ) { + $result2=$_.TaskID[$i] + $result2 = $result2.TrimStart("{") + $result2 = $result2.TrimEnd("}") + $result2 = $result2+"`r`n" + $result = $result+$result2 + } else { + $result2=$_.TaskID[$i] + $result2 = $result2.TrimStart("{") + $result2 = $result2.TrimEnd("}") + $result2 = $result2.Substring(0, ($rawUI - 5 ) )+"..." + $result2 = $result2+"`r`n" + $result = $result+$result2 + } + } + $result + + } else { + for( $i = 0; $i -lt ($_.EntryPoint.Count); $i++ ) + { + $result2=$_.TaskID[$i] + $result2 = $result2.TrimStart("{") + $result2 = $result2.TrimEnd("}") + $result2 = $result2.Substring(0, 22 )+"..." + $result2 = $result2+"`r`n" + $result = $result+$result2 + } + $result + } + + } + finally + { + $global:FormatEnumerationLimit = $oldvalue + } + + + + + + + + + MSFT_BackgroundTask_ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_BackgroundTask + + + + + + + + $_.PackageFullName + + + + + try + { + $oldValue = $global:FormatEnumerationLimit + $global:FormatEnumerationLimit = 100 + $result="" + $result2="" + $resultEntryPoint="" + $resultTaskID="" + for( $i = 0; $i -lt ($_.Taskname.Count); $i++ ) + { + $result2="TaskName: "+$_.TaskName[$i] + $result2 = $result2+"`r`n" + $result2 = $result2+"EntryPoint: " + $resultEntryPoint = $_.EntryPoint[$i] + $resultEntryPoint = $resultEntryPoint.TrimStart("{") + $resultEntryPoint = $resultEntryPoint.TrimEnd("}") + $result2= $result2+$resultEntryPoint+"`r`n" + $result2 = $result2+"TaskID: " + $resultTaskID = $_.TaskID[$i] + $resultTaskID = $resultTaskID.TrimStart("{") + $resultTaskID = $resultTaskID.TrimEnd("}") + $result2 = $result2+$resultTaskID + $result2 = $result2+"`r`n"+"`r`n" + $result = $result+$result2 + } + $result + } + finally + { + $global:FormatEnumerationLimit = $oldvalue + } + + + + + + PerfInfo + + + try + { + $oldValue = $global:FormatEnumerationLimit + $global:FormatEnumerationLimit = 100 + if($_.PerfInfo.Count -gt 0) + { + $result="" + $result2="" + for( $i = 0; $i -lt ($_.PerfInfo.Count); $i++ ) + { + $result2=$_.PerfInfo[$i] + $result2 = $result2+"`r`n" + $result = $result+$result2 + } + $result + } + else + { + $result="Resource usage not requested." + $result + } + } + finally + { + $global:FormatEnumerationLimit = $oldvalue + } + + + + + + + + + MSFT_BackgroundTask_WideView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_BackgroundTask + + + 2 + + + + PackageFullName + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/AppBackgroundTask/Microsoft.Windows.AppBackgroundTask.Commands.dll b/newton-cn/bin/v1.0/Modules/AppBackgroundTask/Microsoft.Windows.AppBackgroundTask.Commands.dll new file mode 100644 index 0000000..3e52a25 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/AppBackgroundTask/Microsoft.Windows.AppBackgroundTask.Commands.dll differ diff --git a/newton-cn/bin/v1.0/Modules/AppBackgroundTask/PS_BackgroundTask.cdxml b/newton-cn/bin/v1.0/Modules/AppBackgroundTask/PS_BackgroundTask.cdxml new file mode 100644 index 0000000..e98d4fb --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/AppBackgroundTask/PS_BackgroundTask.cdxml @@ -0,0 +1,79 @@ + + + + 1.0 + AppBackgroundTask + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/AppLocker/AppLocker.psd1 b/newton-cn/bin/v1.0/Modules/AppLocker/AppLocker.psd1 new file mode 100644 index 0000000..dcb4973 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/AppLocker/AppLocker.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/AppvClient/AppVClientCmdlets.format.ps1xml b/newton-cn/bin/v1.0/Modules/AppvClient/AppVClientCmdlets.format.ps1xml new file mode 100644 index 0000000..e014218 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/AppvClient/AppVClientCmdlets.format.ps1xml @@ -0,0 +1,109 @@ + + + + + + + VirtualProcess + + System.Diagnostics.Process#AppVVirtualProcess + + + + + + 7 + right + + + + 7 + right + + + + 8 + right + + + + 10 + right + + + + 5 + right + + + + 8 + right + + + + + 8 + right + + + + + 15 + right + + + + + left + + + + + + + + HandleCount + + + [int]($_.NPM / 1024) + + + [int]($_.PM / 1024) + + + [int]($_.WS / 1024) + + + [int]($_.VM / 1048576) + + + +if ($_.CPU -ne $()) +{ + $_.CPU.ToString("N") +} + + + + Id + + + ProcessName + + + $_.VirtualProcessInformation.UserSid + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/AppvClient/AppVClientCmdlets.psm1 b/newton-cn/bin/v1.0/Modules/AppvClient/AppVClientCmdlets.psm1 new file mode 100644 index 0000000..94e8bd3 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/AppvClient/AppVClientCmdlets.psm1 @@ -0,0 +1,242 @@ +# .ExternalHelp Microsoft.AppV.AppVClientPowerShell.dll-Help.xml + +function Get-AppvVirtualProcess +{ +[CmdletBinding(DefaultParameterSetName='Name')] +param( + [Parameter(ParameterSetName='Name', Position=0, ValueFromPipelineByPropertyName=$true)] + [Alias('ProcessName')] + [ValidateNotNullOrEmpty()] + [System.String[]] + ${Name}, + + [Parameter(ParameterSetName='Id', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] + [Alias('PID')] + [System.Int32[]] + ${Id}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [Alias('Cn')] + [ValidateNotNullOrEmpty()] + [System.String[]] + ${ComputerName}, + + [ValidateNotNull()] + [Switch] + ${Module}, + + [Alias('FV','FVI')] + [ValidateNotNull()] + [Switch] + ${FileVersionInfo}, + + [Parameter(ParameterSetName='InputObject', Mandatory=$true, ValueFromPipeline=$true)] + [System.Diagnostics.Process[]] + ${InputObject}) + +begin +{ + try { + $comConsumer = New-Object Microsoft.AppV.AppvClientFacade.ClientComConsumer + $processList = $null + try { + $processList = $comConsumer.GetAllVirtualProcesses() + } catch { + $processList = $comConsumer.GetUserVirtualProcesses() + } + + if ($FileVersionInfo) + { + $PSBoundParameters['FileVersionInfo'] = $false + } + + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) + { + $PSBoundParameters['OutBuffer'] = 1 + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Get-Process', [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters | foreach { + if ($processList.ContainsKey($_.Id)) { + Add-Member -InputObject $_ -MemberType NoteProperty -Name AppvPackageData -Value ($processList.Item($_.Id)) + if ($FileVersionInfo) { + $_.MainModule.FileVersionInfo + } else { + $_ + } + } + }} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process +{ + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end +{ + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# .ExternalHelp Microsoft.AppV.AppVClientPowerShell.dll-Help.xml + +function Start-AppvVirtualProcess +{ +[CmdletBinding(DefaultParameterSetName='Default')] +param( + [Parameter(Mandatory=$true, Position=0)] + [Alias('PSPath')] + [ValidateNotNullOrEmpty()] + [System.String] + ${FilePath}, + + [Parameter(Position=1)] + [Alias('Args')] + [ValidateNotNullOrEmpty()] + [System.String[]] + ${ArgumentList}, + + [Parameter(ParameterSetName='Default')] + [Alias('RunAs')] + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + ${Credential}, + + [ValidateNotNullOrEmpty()] + [System.String] + ${WorkingDirectory}, + + [Parameter(ParameterSetName='Default')] + [Alias('Lup')] + [Switch] + ${LoadUserProfile}, + + [Parameter(ParameterSetName='Default')] + [Alias('nnw')] + [Switch] + ${NoNewWindow}, + + [Switch] + ${PassThru}, + + [Parameter(ParameterSetName='Default')] + [Alias('RSE')] + [ValidateNotNullOrEmpty()] + [System.String] + ${RedirectStandardError}, + + [Parameter(ParameterSetName='Default')] + [Alias('RSI')] + [ValidateNotNullOrEmpty()] + [System.String] + ${RedirectStandardInput}, + + [Parameter(ParameterSetName='Default')] + [Alias('RSO')] + [ValidateNotNullOrEmpty()] + [System.String] + ${RedirectStandardOutput}, + + [Parameter(ParameterSetName='UseShellExecute')] + [ValidateNotNullOrEmpty()] + [System.String] + ${Verb}, + + [Switch] + ${Wait}, + + [Parameter(ParameterSetName='UseShellExecute')] + [ValidateNotNullOrEmpty()] + [System.Diagnostics.ProcessWindowStyle] + ${WindowStyle}, + + [Parameter(ParameterSetName='Default')] + [Switch] + ${UseNewEnvironment}, + + [Parameter(Mandatory=$true)] + ${AppvClientObject}) + +begin +{ + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) + { + $PSBoundParameters['OutBuffer'] = 1 + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand('Start-Process', [System.Management.Automation.CommandTypes]::Cmdlet) + + if($AppvClientObject -is [Microsoft.AppV.AppvClientPowerShell.AppvClientPackage]) + { + if (-not (Get-AppvClientPackage -PackageId $AppvClientObject.PackageId -VersionId $AppvClientObject.VersionId) ) + { + $message = [Microsoft.AppV.AppvClientPowerShell.ResourceRetriever]::GetString("VirtProcessCannotStartBecausePackageNotFound") + throw $message + } + + $PSBoundParameters['ArgumentList'] += "/AppvVe:$($AppvClientObject.PackageId)_$($AppvClientObject.VersionId)" + } + elseif($AppvClientObject -is [Microsoft.AppV.AppvClientPowerShell.AppvClientConnectionGroup]) + { + if (-not (Get-AppvClientConnectionGroup -GroupId $AppvClientObject.GroupId -VersionId $AppvClientObject.VersionId) ) + { + $message = [Microsoft.AppV.AppvClientPowerShell.ResourceRetriever]::GetString("VirtProcessCannotStartBecauseGroupNotFound") + throw $message + } + + $PSBoundParameters['ArgumentList'] += "/AppvVe:$($AppvClientObject.GroupId)_$($AppvClientObject.VersionId)" + } + else + { + $message = [Microsoft.AppV.AppvClientPowerShell.ResourceRetriever]::GetString("InvalidObjectTypeForStartVirtProcess") + throw $message + } + + [Void]$PSBoundParameters.Remove("AppvClientObject") + $scriptCmd = {& $wrappedCmd @PSBoundParameters } + + $steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process +{ + [Void][Microsoft.AppV.SharedPerformance.Tracing.PROVIDER_MICROSOFT_APPV_CLIENT_SHAREDPERFORMANCEEVENTS]::Write_ClientProgrammability_StartStartAppvVirtualProcess($FilePath) + + try { + $steppablePipeline.Process($_) + } catch { + throw + } + finally { + [Void][Microsoft.AppV.SharedPerformance.Tracing.PROVIDER_MICROSOFT_APPV_CLIENT_SHAREDPERFORMANCEEVENTS]::Write_ClientProgrammability_StopStartAppvVirtualProcess($FilePath) + } +} + +end +{ + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/newton-cn/bin/v1.0/Modules/AppvClient/AppvClient.psd1 b/newton-cn/bin/v1.0/Modules/AppvClient/AppvClient.psd1 new file mode 100644 index 0000000..9ca404e --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/AppvClient/AppvClient.psd1 @@ -0,0 +1,25 @@ +@{ +ModuleVersion = '1.0.0.0' + +GUID = '596D7B43-928B-44D4-89E7-17D34740ECC2' + +Author = 'Microsoft Corporation' + +CompanyName = 'Microsoft Corporation' + +Copyright = '© Microsoft Corporation. All rights reserved.' + +Description = 'Microsoft Application Virtualization Client Module' + +RequiredAssemblies = 'Microsoft.AppV.AppvClientComConsumer.dll' + +NestedModules = 'Microsoft.AppV.AppVClientPowerShell', 'AppVClientCmdlets.psm1' + +ProcessorArchitecture = 'AMD64' + +# Location from which to download updateable help +HelpInfoURI = "https://go.microsoft.com/fwlink/?LinkId=403112 " + +FunctionsToExport = 'Get-AppvVirtualProcess', 'Start-AppvVirtualProcess' + +} diff --git a/newton-cn/bin/v1.0/Modules/AppvClient/Microsoft.AppV.AppVClientPowerShell.dll b/newton-cn/bin/v1.0/Modules/AppvClient/Microsoft.AppV.AppVClientPowerShell.dll new file mode 100644 index 0000000..5bd4a31 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/AppvClient/Microsoft.AppV.AppVClientPowerShell.dll differ diff --git a/newton-cn/bin/v1.0/Modules/AppvClient/Microsoft.AppV.AppvClientComConsumer.dll b/newton-cn/bin/v1.0/Modules/AppvClient/Microsoft.AppV.AppvClientComConsumer.dll new file mode 100644 index 0000000..200f316 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/AppvClient/Microsoft.AppV.AppvClientComConsumer.dll differ diff --git a/newton-cn/bin/v1.0/Modules/AppvClient/Microsoft.AppV.ClientProgrammability.Eventing.dll b/newton-cn/bin/v1.0/Modules/AppvClient/Microsoft.AppV.ClientProgrammability.Eventing.dll new file mode 100644 index 0000000..21776b1 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/AppvClient/Microsoft.AppV.ClientProgrammability.Eventing.dll differ diff --git a/newton-cn/bin/v1.0/Modules/AppvClient/ko/Microsoft.AppV.AppVClientPowerShell.resources.dll b/newton-cn/bin/v1.0/Modules/AppvClient/ko/Microsoft.AppV.AppVClientPowerShell.resources.dll new file mode 100644 index 0000000..5096d5f Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/AppvClient/ko/Microsoft.AppV.AppVClientPowerShell.resources.dll differ diff --git a/newton-cn/bin/v1.0/Modules/AppvClient/ko/Microsoft.AppV.AppvClientComConsumer.resources.dll b/newton-cn/bin/v1.0/Modules/AppvClient/ko/Microsoft.AppV.AppvClientComConsumer.resources.dll new file mode 100644 index 0000000..cdcb8cc Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/AppvClient/ko/Microsoft.AppV.AppvClientComConsumer.resources.dll differ diff --git a/newton-cn/bin/v1.0/Modules/Appx/Appx.format.ps1xml b/newton-cn/bin/v1.0/Modules/Appx/Appx.format.ps1xml new file mode 100644 index 0000000..eb72ce6 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Appx/Appx.format.ps1xml @@ -0,0 +1,120 @@ + + + + + + TableView + + AppxDeploymentEventLog + + + + + + 25 + + + + 12 + + + + + + + + + + $_.timecreated + + + $_.id + + + $_.message + + + + + + + + + TableView + + Microsoft.Windows.Appx.PackageManager.Commands.AppxPackage + + + + + + + Name + + + Publisher + + + Architecture + + + ResourceId + + + Version + + + PackageFullName + + + InstallLocation + + + IsFramework + + + PackageFamilyName + + + PublisherId + + + PackageUserInformation + + ($_.PackageUserInformation.Count -gt 0) + + + + IsResourcePackage + + + IsBundle + + + IsDevelopmentMode + + + NonRemovable + + + Dependencies + + ($_.Dependencies.Count -gt 0) + + + + IsPartiallyStaged + + + SignatureKind + + + Status + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Appx/Appx.psd1 b/newton-cn/bin/v1.0/Modules/Appx/Appx.psd1 new file mode 100644 index 0000000..dba9f3b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Appx/Appx.psd1 @@ -0,0 +1,31 @@ +@{ + GUID = "{AEEF2BEF-EBA9-4A1D-A3D2-D0B52DF76DEB}" + AliasesToExport = @( + 'Add-AppPackage', + 'Get-AppPackage', + 'Get-AppPackageManifest', + 'Remove-AppPackage', + 'Get-AppPackageVolume', + 'Add-AppPackageVolume', + 'Remove-AppPackageVolume', + 'Mount-AppPackageVolume', + 'Dismount-AppPackageVolume', + 'Move-AppPackage', + 'Get-AppPackageDefaultVolume', + 'Set-AppPackageDefaultVolume', + 'Get-AppPackageLastError', + 'Get-AppPackageLog' + ) + Author = "Microsoft Corporation" + CmdletsToExport = 'Add-AppxPackage', 'Get-AppxPackage', 'Get-AppxPackageManifest', 'Remove-AppxPackage', 'Get-AppxVolume', 'Add-AppxVolume', 'Remove-AppxVolume', 'Mount-AppxVolume', 'Dismount-AppxVolume', 'Move-AppxPackage', 'Get-AppxDefaultVolume', 'Set-AppxDefaultVolume', 'Invoke-CommandInDesktopPackage' + CompanyName = "Microsoft Corporation" + Copyright = "© Microsoft Corporation. All rights reserved." + FunctionsToExport = 'Get-AppxLastError', 'Get-AppxLog' + HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=849912" + ModuleVersion = "2.0.1.0" + ModuleToProcess = 'Microsoft.Windows.Appx.PackageManager.Commands' + FormatsToProcess = 'Appx.format.ps1xml' + NestedModules = 'Appx.psm1' + CompatiblePSEditions = @('Desktop','Core') + PowerShellVersion="5.1" +} diff --git a/newton-cn/bin/v1.0/Modules/Appx/Appx.psm1 b/newton-cn/bin/v1.0/Modules/Appx/Appx.psm1 new file mode 100644 index 0000000..871a911 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Appx/Appx.psm1 @@ -0,0 +1,119 @@ +<# +Copyright (C) Microsoft. All rights reserved. +#> + +#requires -version 5.1 + +#.ExternalHelp Microsoft.Windows.Appx.PackageManager.Commands.dll-help.xml +Function Get-AppxLastError() +{ + [CmdletBinding(HelpUri="https://go.microsoft.com/fwlink/?LinkId=246401")] + param() + + Import-LocalizedData -bindingVariable msgTable + + # Search for last Add-AppxPackage related error + foreach ($err in $global:Error) + { + if ($err.FullyQualifiedErrorId -match + "DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand") + { + $command = (Get-History | ? {$_.CommandLine -imatch + "Add-AppxPackage"} |Select-Object -Last 1).CommandLine; + + # Read ActivityId from the Exception record + if ($err.Exception -imatch + "\[ActivityId\] ([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})") + { + Write-Host($msgTable.EventLogsFor + ' "' + $command + '"'); + # Retrieve Event Log messages for ActivityId + Get-WinEvent -LogName Microsoft-Windows-Appx* -Oldest | + Where-Object {$_.Activityid -eq $matches[1]} | + ForEach-Object{ + $null = $_.pstypenames.clear() + $null = $_.pstypenames.add('AppxDeploymentEventLog') + $_ + } + break; + } + } + } +} + +#.ExternalHelp Microsoft.Windows.Appx.PackageManager.Commands.dll-help.xml +Function Get-AppxLog() +{ + [CmdletBinding(DefaultParameterSetName="All", + HelpUri="https://go.microsoft.com/fwlink/?LinkId=246400")] + param([switch][parameter(parametersetname="All")]$All, + [string][parameter(parametersetname="ActivityId")]$ActivityId) + + switch($PsCmdlet.ParameterSetName) + { + "All" + { + if ($All) + { + # Get all deployment events + $logevents = Get-WinEvent -log Microsoft-Windows-AppxDeploy* + + # Select only unique activity IDs of deployment events + $activityids = $logevents |% {$_.activityid} | select -unique + + # Grab all logs associated with Appx Deployment + $logevents = Get-WinEvent -log Microsoft-Windows-Appx* + [array]::Reverse($logevents) + foreach($id in $activityids) + { + $logevents | + Where-Object {$_.activityid -eq $id} | + ForEach-Object{ + $null = $_.pstypenames.clear() + $null = $_.pstypenames.add('AppxDeploymentEventLog') + $_ + } + } + } + else + { + $ActivityId = get-winevent -log Microsoft-Windows-AppxDeploy* -max 1 |% {$_.ActivityId} + Get-WinEvent -log Microsoft-Windows-Appx* -oldest | + Where-Object {$_.activityid -eq $ActivityId} | + ForEach-Object{ + $null = $_.pstypenames.clear() + $null = $_.pstypenames.add('AppxDeploymentEventLog') + $_ + } + + } + } + "ActivityId" { Get-WinEvent -log Microsoft-Windows-Appx* -oldest | + Where-Object {$_.activityid -eq $ActivityId} | + ForEach-Object{ + $null = $_.pstypenames.clear() + $null = $_.pstypenames.add('AppxDeploymentEventLog') + $_ + } + } + + } +} + +Microsoft.PowerShell.Utility\Set-Alias Add-AppPackage Add-AppxPackage +Microsoft.PowerShell.Utility\Set-Alias Get-AppPackage Get-AppxPackage +Microsoft.PowerShell.Utility\Set-Alias Get-AppPackageManifest Get-AppxPackageManifest +Microsoft.PowerShell.Utility\Set-Alias Remove-AppPackage Remove-AppxPackage +Microsoft.PowerShell.Utility\Set-Alias Get-AppPackageVolume Get-AppxVolume +Microsoft.PowerShell.Utility\Set-Alias Add-AppPackageVolume Add-AppxVolume +Microsoft.PowerShell.Utility\Set-Alias Remove-AppPackageVolume Remove-AppxVolume +Microsoft.PowerShell.Utility\Set-Alias Mount-AppPackageVolume Mount-AppxVolume +Microsoft.PowerShell.Utility\Set-Alias Dismount-AppPackageVolume Dismount-AppxVolume +Microsoft.PowerShell.Utility\Set-Alias Move-AppPackage Move-AppxPackage +Microsoft.PowerShell.Utility\Set-Alias Get-AppPacakgeDefaultVolume Get-AppxDefaultVolume +Microsoft.PowerShell.Utility\Set-Alias Set-AppPackageDefaultVolume Set-AppxDefaultVolume +Microsoft.PowerShell.Utility\Set-Alias Get-AppPackageLastError Get-AppxLastError +Microsoft.PowerShell.Utility\Set-Alias Get-AppPackageLog Get-AppxLog + +Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-AppxLastError' +Microsoft.PowerShell.Core\Export-ModuleMember -Function 'Get-AppxLog' +Microsoft.PowerShell.Core\Export-ModuleMember -Alias * diff --git a/newton-cn/bin/v1.0/Modules/Appx/ko-KR/Appx.psd1 b/newton-cn/bin/v1.0/Modules/Appx/ko-KR/Appx.psd1 new file mode 100644 index 0000000..cf6bfd9 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Appx/ko-KR/Appx.psd1 @@ -0,0 +1,4 @@ +# Localized 12/07/2019 08:21 AM (GMT) 303:6.40.20520 AppxStrings.psd1 +ConvertFrom-StringData @' + EventLogsFor=Event logs for command: +'@ diff --git a/newton-cn/bin/v1.0/Modules/AssignedAccess/AssignedAccess.psd1 b/newton-cn/bin/v1.0/Modules/AssignedAccess/AssignedAccess.psd1 new file mode 100644 index 0000000..4612109 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/AssignedAccess/AssignedAccess.psd1 @@ -0,0 +1,13 @@ +@{ +RootModule = '.\AssignedAccess.psm1' +ModuleVersion = '1.0.0.0' +GUID = "{9E72217E-9E27-45F7-81FC-048763587E0A}" +Author = 'Microsoft Corporation' +CompanyName = 'Microsoft Corporation' +Copyright = '(c) Microsoft Corporation. All rights reserved.' +HelpInfoURI = "https://go.microsoft.com/fwlink/?linkid=311962" +FunctionsToExport = @("Clear-AssignedAccess", "Get-AssignedAccess", "Set-AssignedAccess") +CmdletsToExport = @() +AliasesToExport = @() +CompatiblePSEditions = @('Desktop','Core') +} diff --git a/newton-cn/bin/v1.0/Modules/AssignedAccess/AssignedAccess.psm1 b/newton-cn/bin/v1.0/Modules/AssignedAccess/AssignedAccess.psm1 new file mode 100644 index 0000000..b2c0700 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/AssignedAccess/AssignedAccess.psm1 @@ -0,0 +1,342 @@ +<# +Copyright (C) Microsoft. All rights reserved. +#> + +# String table for localizable messages to be returned to the user. +$SCStringTable = Data { + ConvertFrom-StringData @' + AppliedSettings = User and Application set, log on as this user to start Assigned Access + ClearedSettings = Cleared Assigned Access, settings reset to factory defaults + ErrorUserNotFound = User was not found. Enter a valid local account UserName or UserSID + ErrorAppNotFound = Application was not found. Enter either a valid AppName or AUMID + ErrorProvisionedAppNameUsed = The app couldn't be set for assigned access by name at this time, run the cmdlet again using the -AppUserModelId option + DeletingInstance = Deleting {0} + ErrorUserDoesNotExist = The assigned access user does not exist: {0}. Run Clear-AssignedAccess to clear assigned access. + ErrorAppDoesNotExist = The assigned access application does not exist: {0}. Run Clear-AssignedAccess to clear assigned access. + ErrorCurrentUserNotAllowed = The assigned access user cannot be set to the current logged in account. + ErrorConnectedUserNotAllowed = You can only set up assigned access for a local standard user account that does not have a Microsoft account associated with it. + ConfirmSet = Set assigned access application to {0} + ConfirmClear = Clear assigned access + ErrorInsufficientPrivilege = This script must be run with Administrator privileges. +'@ +} + +# C# Interop class/interface to check user connected info +$TypeDefinition = @" +using System; +using System.Runtime.InteropServices; +namespace LockdownWMI +{ + // Declare IEnumUnknown + [ + ComImport, + Guid("00000100-0000-0000-C000-000000000046"), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown) + ] + public interface IEnumUnknown + { + } + + // Declare IConnectedUser + [ + ComImport, + Guid("9D5F2149-DE8C-45F2-B313-6587A04F771D"), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown) + ] + public interface IConnectedUser + { + } + + // Declare IConnectedUserStore + [ + ComImport, + Guid("9EC044BC-B01D-4C18-8634-59BD3FF5DCC1"), + InterfaceType(ComInterfaceType.InterfaceIsIUnknown) + ] + public interface IConnectedUserStore + { + int GetConnectedUserEnum( + uint Options, + ref Guid pProviderGUID, + ref IEnumUnknown ppUserEnum + ); + + int CreateConnectedUser( + string LocalUserName, + string IdentityUserName, + ref Guid ProviderGUID, + bool IsAdmin, + IntPtr AuthBuffer, + uint AuthBufferSize + ); + + int ConnectLocalUser( + string LocalPassword, + ref Guid ProviderGUID, + IntPtr AuthBuffer, + uint AuthBufferSize + ); + + int FindConnectedUserByName( + string IdentityUserName, + string ProviderName, + ref Guid pProviderGUID, + ref IConnectedUser ppConnectedUser + ); + + int FindConnectedUserBySid( + IntPtr Sid, + uint SidLength, + ref IConnectedUser ppConnectedUser + ); + } + + // Declare CConnectedUserStore + [ + ComImport, + Guid("40AFA0B6-3B2F-4654-8C3F-161DE85CF80E") + ] + public class CConnectedUserStore {} + + public class UserCheck + { + public static bool IsConnectedUser(String userSid) + { + IConnectedUser connectedUser = null; + IntPtr intPtrSid = IntPtr.Zero; + IConnectedUserStore userStore = (IConnectedUserStore)new CConnectedUserStore(); + try { + bool success = ConvertStringSidToSid(userSid, ref intPtrSid); + if(success) + { + uint sidLength = GetLengthSid(intPtrSid); + userStore.FindConnectedUserBySid(intPtrSid, sidLength, ref connectedUser); + } + } catch (Exception) + { + connectedUser = null; + } + + Marshal.FreeHGlobal(intPtrSid); + return (connectedUser != null); + } + + [DllImport("Advapi32.dll", EntryPoint="ConvertStringSidToSid", CallingConvention=CallingConvention.Winapi, SetLastError=true)] + private static extern bool ConvertStringSidToSid(string strSID, ref IntPtr sid); + + [DllImport("Advapi32.dll", EntryPoint="GetLengthSid", CallingConvention = CallingConvention.Winapi, SetLastError=true)] + private static extern uint GetLengthSid(IntPtr pSid); + } +} +"@ + +try { Add-Type -TypeDefinition $TypeDefinition } catch {} + +$CommonArgs = @{"namespace"="root\standardcimv2\embedded"} + +Import-LocalizedData -BindingVariable SCStringTable -FileName "AssignedAccessMsg.psd1" + +function IsCurrentUserAdmin +{ + [bool](([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) +} + +# .EXTERNALHELP AssignedAccess-help.xml +function Get-AssignedAccess +{ + [CmdletBinding()] + param() + + if (-Not (IsCurrentUserAdmin)) + { + throw $SCStringTable.ErrorInsufficientPrivilege + } + + # Display the instances in WEDL_AssignedAccess + $instance = Get-CimInstance -ClassName WEDL_AssignedAccess @CommonArgs + if(!$instance) { + return + } + + try { + $objSID = New-Object System.Security.Principal.SecurityIdentifier($instance.UserSID) + $objUser = $objSID.Translate([System.Security.Principal.NTAccount]) + } catch { + Write-Error ($SCStringTable.ErrorUserDoesNotExist -f $instance.UserSID) + return + } + + # Tokenizing the app user model id to obtain the app package family name, at index [0] + # aumid = [appx.packagefamilyname]![appxmanifest.id] + $temp = $instance.AppUserModelId.split("!") + $appPackageFamilyName = $temp[0] + + # determining the app name by comparing the app package family name + $appName = (Get-AppxPackage -User $objUser.Value) | Where-Object -Property 'PackageFamilyName' -eq $appPackageFamilyName | Select-Object -Expand Name -First 1 + if(!$appName) { + $temp = $appPackageFamilyName.split("_") + $appName = $temp[0] + } + + # Outputting the details + [PSCustomObject] @{ + UserSID = $instance.UserSID; + UserName = $objUser.Value; + AppUserModelId = $instance.AppUserModelId; + AppName = $appName; + } +} + +# .EXTERNALHELP AssignedAccess-help.xml +function Set-AssignedAccess +{ + [CmdletBinding(DefaultParameterSetName="UserNameANDAppName", + SupportsShouldProcess=$True)] + param( + [parameter(ParameterSetName='UserNameANDAppName', Mandatory=$true)] + [parameter(ParameterSetName='UserNameANDAppId', Mandatory=$true)] + [String] + $UserName, + + [parameter(ParameterSetName='UserSidANDAppName', Mandatory=$true)] + [parameter(ParameterSetName='UserSidANDAppId', Mandatory=$true)] + [String] + $UserSID, + + [parameter(ParameterSetName='UserNameANDAppId', Mandatory=$true)] + [parameter(ParameterSetName='UserSidANDAppId', Mandatory=$true)] + [alias("AUMID")] + [String] + $AppUserModelId, + + [parameter(ParameterSetName='UserNameANDAppName', Mandatory=$true)] + [parameter(ParameterSetName='UserSidANDAppName', Mandatory=$true)] + [String] + $AppName + ) + + if (-Not (IsCurrentUserAdmin)) + { + throw $SCStringTable.ErrorInsufficientPrivilege + } + + try { + # Resolve the user name to its SID if it is passed + if ($UserName) { + $objUser = New-Object System.Security.Principal.NTAccount($UserName) + $UserSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier]).Value + } + + # Validate the SID + # For UserName passed in, convert it into the format Domain\UserName or MachineName\UserName + $objSID = New-Object System.Security.Principal.SecurityIdentifier($UserSID) + $UserName = $objSID.Translate([System.Security.Principal.NTAccount]) + + } catch { + throw $SCStringTable.ErrorUserNotFound + } + + # UserName has been converted to Domain\UserName or MachineName\UserName + # Throw error if UserNamePrefix is not the same as MachineName + # We do not allow configuring AssignedAccss to domain account from Powershell + + $UserNamePrefix = $UserName.Split("\")[0] + $UserNameSuffix = $UserName.Split("\")[1] + if(diff $UserNamePrefix $env:COMPUTERNAME) + { + throw $SCStringTable.ErrorUserNotFound + } + + # Parse output of the command "net localgroup administrators" and try to find $UserName + # if it's not found, it's not admin, we can move on + # otherwise throw an exception because we don't allow admin to be AA account + $NetEXE = $env:SystemDrive + "\windows\system32\net.exe localgroup administrators" + $UserStringFromNetCommand = Invoke-Expression $NetEXE | Where {$_ -eq $UserNameSuffix} + if(!([String]::IsNullOrEmpty($UserStringFromNetCommand))) + { + throw $SCStringTable.ErrorUserNotFound + } + + # If passed in UserSID is the same as current user, do not apply assigned access and return error + $CurrentUserSID = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value + if(!(diff $CurrentUserSID $UserSID)) + { + throw $SCStringTable.ErrorCurrentUserNotAllowed + } + + # If the UserSID represents a user with user connected info (bound with MS account), do not apply assigned access and return error + if([LockdownWMI.UserCheck]::IsConnectedUser($UserSID)) + { + throw $SCStringTable.ErrorConnectedUserNotAllowed + } + + # If the AppName is passed, resolve it to its AppUserModelId + if ($AppName) { + # Selects the first object in case Get-AppxPackage returns multiple packages (if multiple versions of the app exist). + $AppxPkg = ((Get-AppxPackage -User $UserSID -Name $AppName) | Select-Object -First 1) + + if (!$AppxPkg) { + # try to find a provisioned app (DismAppxPackage) based on $AppName + # - if we can find one, throw error and ask user to user -AppUserModelId option + # because for provisioned app, we cannot parse AppName into AUMID in powershell + # - if not, throw regular error + $provisionedApp = Get-AppxProvisionedPackage -online | Where-Object {$_.DisplayName -eq $AppName} + if($provisionedApp) { + throw $SCStringTable.ErrorProvisionedAppNameUsed + } + else { + throw $SCStringTable.ErrorAppNotFound + } + } + + $AppUserModelId = $AppxPkg.PackageFamilyName + "!" + ($AppxPkg | Get-AppxPackageManifest -User $UserSID).Package.Applications.Application.Id + } + + if ($PSCmdlet.ShouldProcess($UserName, ($SCStringTable.ConfirmSet -f $AppUserModelId))) { + + # Check if an instance already exists. We only allow a single instance of WEDL_AssignedAccess. + $instance = Get-CimInstance -ClassName WEDL_AssignedAccess @CommonArgs + if ($instance -and $instance.UserSID -eq $UserSID) { + # Update AppID of existing instance + $instance | Set-CimInstance -Property @{AppUserModelId=$AppUserModelId} -ErrorAction Stop -Confirm:$false + } else { + # If an instance already exists with a different username, + # delete it before creating a new one. + if ($instance) { + Write-Verbose ($SCStringTable.DeletingInstance -f $UserName) + $instance | Remove-CimInstance -Confirm:$false + } + + New-CimInstance -ClassName WEDL_AssignedAccess -Property @{UserSID=$UserSID; AppUserModelId=$AppUserModelId} @CommonArgs -ErrorAction Stop -Confirm:$false | Out-Null + } + Write-Verbose $SCStringTable.AppliedSettings + } +} + +# .EXTERNALHELP AssignedAccess-help.xml +function Clear-AssignedAccess +{ + [CmdletBinding(SupportsShouldProcess=$True)] + param() + + if (-Not (IsCurrentUserAdmin)) + { + throw $SCStringTable.ErrorInsufficientPrivilege + } + + $instance = Get-CimInstance -ClassName WEDL_AssignedAccess @CommonArgs + if ($instance) { + # attempt to translate SID to user name + try { + $objSID = New-Object System.Security.Principal.SecurityIdentifier($instance.UserSID) + $UserName = $objSID.Translate([System.Security.Principal.NTAccount]).Value + } catch { + $UserName = $instance.UserSID + } + + if ($PSCmdlet.ShouldProcess($UserName, $SCStringTable.ConfirmClear)) { + $instance | Remove-CimInstance -Confirm:$false + Write-Verbose $SCStringTable.ClearedSettings + } + } +} diff --git a/newton-cn/bin/v1.0/Modules/AssignedAccess/ko-KR/AssignedAccessMsg.psd1 b/newton-cn/bin/v1.0/Modules/AssignedAccess/ko-KR/AssignedAccessMsg.psd1 new file mode 100644 index 0000000..fd9d3c9 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/AssignedAccess/ko-KR/AssignedAccessMsg.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/BitLocker/BitLocker.Format.ps1xml b/newton-cn/bin/v1.0/Modules/BitLocker/BitLocker.Format.ps1xml new file mode 100644 index 0000000..a928461 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/BitLocker/BitLocker.Format.ps1xml differ diff --git a/newton-cn/bin/v1.0/Modules/BitLocker/BitLocker.psd1 b/newton-cn/bin/v1.0/Modules/BitLocker/BitLocker.psd1 new file mode 100644 index 0000000..5834d34 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/BitLocker/BitLocker.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/BitLocker/BitLocker.psm1 b/newton-cn/bin/v1.0/Modules/BitLocker/BitLocker.psm1 new file mode 100644 index 0000000..680cfd8 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/BitLocker/BitLocker.psm1 differ diff --git a/newton-cn/bin/v1.0/Modules/BitLocker/Microsoft.BitLocker.Structures.dll b/newton-cn/bin/v1.0/Modules/BitLocker/Microsoft.BitLocker.Structures.dll new file mode 100644 index 0000000..86b9e7a Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/BitLocker/Microsoft.BitLocker.Structures.dll differ diff --git a/newton-cn/bin/v1.0/Modules/BitLocker/ko-KR/BitLocker.psd1 b/newton-cn/bin/v1.0/Modules/BitLocker/ko-KR/BitLocker.psd1 new file mode 100644 index 0000000..5f96492 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/BitLocker/ko-KR/BitLocker.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/BitsTransfer/BitsTransfer.Format.ps1xml b/newton-cn/bin/v1.0/Modules/BitsTransfer/BitsTransfer.Format.ps1xml new file mode 100644 index 0000000..a5cf4c2 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/BitsTransfer/BitsTransfer.Format.ps1xml @@ -0,0 +1,149 @@ + + + + + + Microsoft.BackgroundIntelligentTransfer.Management.BitsJob + + Microsoft.BackgroundIntelligentTransfer.Management.BitsJob + + + + + + + + + + + + + + JobId + + + DisplayName + + + TransferType + + + JobState + + + OwnerAccount + + + + + + + + Microsoft.BackgroundIntelligentTransfer.Management.BitsJob + + Microsoft.BackgroundIntelligentTransfer.Management.BitsJob + + + + + + + JobId + + + DisplayName + + + TransferType + + + JobState + + + OwnerAccount + + + Priority + + + TransferPolicy + + + FilesTransferred + + + FilesTotal + + + BytesTransferred + + + BytesTotal + + + CreationTime + + + ModificationTime + + + MinimumRetryDelay + + + NoProgressTimeout + + + TransientErrorCount + + + ProxyUsage + + + ProxyList + + + ProxyBypassList + + + HttpMethod + + + ACLFlags + + + SecurityFlags + + + Dynamic + + + CustomHeaders + + + MaximumDownloadTime + + + NotifyFlags + + + NotifyCmdLine + + + CertificateStoreLocation + + + CertificateStoreName + + + CertificateHash + + + CertificateSubjectName + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/BitsTransfer/BitsTransfer.psd1 b/newton-cn/bin/v1.0/Modules/BitsTransfer/BitsTransfer.psd1 new file mode 100644 index 0000000..35aa5b6 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/BitsTransfer/BitsTransfer.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/BitsTransfer/Microsoft.BackgroundIntelligentTransfer.Management.Interop.dll b/newton-cn/bin/v1.0/Modules/BitsTransfer/Microsoft.BackgroundIntelligentTransfer.Management.Interop.dll new file mode 100644 index 0000000..4fee62b Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/BitsTransfer/Microsoft.BackgroundIntelligentTransfer.Management.Interop.dll differ diff --git a/newton-cn/bin/v1.0/Modules/BranchCache/BranchCache.format.ps1xml b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCache.format.ps1xml new file mode 100644 index 0000000..6e4f26c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCache.format.ps1xml @@ -0,0 +1,638 @@ + + + + + + + + MSFT_NetBranchCache_View + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheStatus + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheStatus + + + + + + + + ClientConfigurationControl + + + + + CurrentClientMode : + + CurrentClientMode + + + HostedCacheServerList : + + HostedCacheServerList + + + HostedCacheDiscoveryEnabled : + + HostedCacheDiscoveryEnabled + + + + + + + + + + + ContentServerConfigurationControl + + + + + ContentServerIsEnabled : + + ContentServerIsEnabled + + + + + + + + + + + HostedCacheServerConfigurationControl + + + + + HostedCacheServerIsEnabled : + + HostedCacheServerIsEnabled + + + ClientAuthenticationMode : + + ClientAuthenticationMode + + + HostedCacheScpRegistrationEnabled : + + HostedCacheScpRegistrationEnabled + + + + + + + + + + + NetworkConfigurationControl + + + + + ContentRetrievalUrlReservationEnabled : + + ContentRetrievalUrlReservationEnabled + + + HostedCacheHttpUrlReservationEnabled : + + HostedCacheHttpUrlReservationEnabled + + + HostedCacheHttpsUrlReservationEnabled : + + HostedCacheHttpsUrlReservationEnabled + + + ContentRetrievalFirewallRulesEnabled : + + ContentRetrievalFirewallRulesEnabled + + + PeerDiscoveryFirewallRulesEnabled : + + PeerDiscoveryFirewallRulesEnabled + + + HostedCacheServerFirewallRulesEnabled : + + HostedCacheServerFirewallRulesEnabled + + + HostedCacheClientFirewallRulesEnabled : + + HostedCacheClientFirewallRulesEnabled + + + + + + + + + + + CacheControl + + + + + CacheFileDirectoryPath : + + CacheFileDirectoryPath + + + MaxCacheSizeAsPercentageOfDiskVolume : + + MaxCacheSizeAsPercentageOfDiskVolume + + + MaxCacheSizeAsNumberOfBytes : + + MaxCacheSizeAsNumberOfBytes + + + CurrentSizeOnDiskAsNumberOfBytes : + + CurrentSizeOnDiskAsNumberOfBytes + + + + + + + + + + PrimaryCacheControl + + + + + + + + $_ + CacheControl + + + + + + + CurrentActiveCacheSize : + + CurrentActiveCacheSize + + + + + + + + + + + + DataCacheExtensionControl + + + + + + + + $_ + CacheControl + + + + + + + + + + + + + + DataCacheExtensionListControl + + + + + + DataCacheExtensions: + + + + 4 + + + DataCacheExtensions + + DataCacheExtensionControl + + + + + + + + + + + + HashCacheControl + + + + + + + + $_ + PrimaryCacheControl + + + + + + + + + + + + + DataCacheControl + + + + + + + + $_ + PrimaryCacheControl + + + + + + + + + + + + $_.DataCacheExtensions.Length -ne $() + + $_ + DataCacheExtensionListControl + + + + + + + + + + + + + + + + + + BranchCacheIsEnabled : + + BranchCacheIsEnabled + + + BranchCacheServiceStatus : + + BranchCacheServiceStatus + + + BranchCacheServiceStartType : + + BranchCacheServiceStartType + + + + + + + ClientConfiguration: + + + + 4 + + + ClientConfiguration + ClientConfigurationControl + + + + + + + + ContentServerConfiguration: + + + + 4 + + + ContentServerConfiguration + ContentServerConfigurationControl + + + + + + + + HostedCacheServerConfiguration: + + + + 4 + + + HostedCacheServerConfiguration + HostedCacheServerConfigurationControl + + + + + + + + NetworkConfiguration: + + + + 4 + + + NetworkConfiguration + NetworkConfigurationControl + + + + + + + + HashCache: + + + + 4 + + + HashCache + HashCacheControl + + + + + + + + DataCache: + + + + 4 + + + DataCache + DataCacheControl + + + + + + + + + + + + + MSFT_NetBranchCacheSettingData_View + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheClientSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheClientSettingData + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheContentServerSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheContentServerSettingData + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheHostedCacheServerSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheHostedCacheServerSettingData + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheNetworkSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheNetworkSettingData + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheClientSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheClientSettingData + + + + CurrentClientMode + + + HostedCacheServerList + + + HostedCacheDiscoveryEnabled + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheContentServerSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheContentServerSettingData + + + + ContentServerIsEnabled + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheHostedCacheServerSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheHostedCacheServerSettingData + + + + HostedCacheServerIsEnabled + + + ClientAuthenticationMode + + + HostedCacheScpRegistrationEnabled + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheNetworkSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheNetworkSettingData + + + + ContentRetrievalUrlReservationEnabled + + + HostedCacheHttpUrlReservationEnabled + + + HostedCacheHttpsUrlReservationEnabled + + + ContentRetrievalFirewallRulesEnabled + + + PeerDiscoveryFirewallRulesEnabled + + + HostedCacheServerFirewallRulesEnabled + + + HostedCacheClientFirewallRulesEnabled + + + + + + + + + + + + + MSFT_NetBranchCacheFile_View + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheHashCache + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheHashCache + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheDataCache + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheDataCache + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheDataCacheExtension + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheDataCacheExtension + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheHashCache + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheHashCache + + + + CacheFileDirectoryPath + + + MaxCacheSizeAsPercentageOfDiskVolume + + + MaxCacheSizeAsNumberOfBytes + + + CurrentSizeOnDiskAsNumberOfBytes + + + CurrentActiveCacheSize + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheDataCache + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheDataCache + + + + CacheFileDirectoryPath + + + MaxCacheSizeAsPercentageOfDiskVolume + + + MaxCacheSizeAsNumberOfBytes + + + CurrentSizeOnDiskAsNumberOfBytes + + + CurrentActiveCacheSize + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheDataCacheExtension + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheDataCacheExtension + + + + CacheFileDirectoryPath + + + MaxCacheSizeAsPercentageOfDiskVolume + + + MaxCacheSizeAsNumberOfBytes + + + CurrentSizeOnDiskAsNumberOfBytes + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/BranchCache/BranchCache.psd1 b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCache.psd1 new file mode 100644 index 0000000..0b6cb32 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCache.psd1 @@ -0,0 +1,22 @@ +@{ + PowerShellVersion = '5.1' + + GUID='d57aee1e-6fe7-4bbc-8c57-8675a3a83e0d' + ModuleVersion='1.0.0.0' + Author="Microsoft Corporation" + CompanyName="Microsoft Corporation" + Copyright="© Microsoft Corporation. All rights reserved." + + HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=390757" + + FormatsToProcess = 'BranchCache.format.ps1xml' + TypesToProcess = 'BranchCache.types.ps1xml' + + NestedModules = @('BranchCacheClientSettingData.cdxml', 'BranchCacheContentServerSettingData.cdxml', 'BranchCacheHostedCacheServerSettingData.cdxml', 'BranchCacheNetworkSettingData.cdxml', 'BranchCacheOrchestrator.cdxml', 'BranchCachePrimaryPublicationCacheFile.cdxml', 'BranchCachePrimaryRepublicationCacheFile.cdxml', 'BranchCacheSecondaryRepublicationCacheFile.cdxml', 'BranchCacheStatus.cdxml') + + FunctionsToExport = @('Add-BCDataCacheExtension', 'Clear-BCCache', 'Disable-BC', 'Disable-BCDowngrading', 'Disable-BCServeOnBattery', 'Enable-BCDistributed', 'Enable-BCDowngrading', 'Enable-BCHostedClient', 'Enable-BCHostedServer', 'Enable-BCLocal', 'Enable-BCServeOnBattery', 'Export-BCCachePackage', 'Export-BCSecretKey', 'Get-BCClientConfiguration', 'Get-BCContentServerConfiguration', 'Get-BCHostedCacheServerConfiguration', 'Get-BCNetworkConfiguration', 'Get-BCHashCache', 'Get-BCDataCache', 'Get-BCDataCacheExtension', 'Get-BCStatus', 'Import-BCCachePackage', 'Import-BCSecretKey', 'Publish-BCFileContent', 'Publish-BCWebContent', 'Remove-BCDataCacheExtension', 'Reset-BC', 'Set-BCAuthentication', 'Set-BCCache', 'Set-BCMinSMBLatency', 'Set-BCSecretKey', 'Set-BCDataCacheEntryMaxAge') + + CmdletsToExport = @() + AliasesToExport = @() + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/BranchCache/BranchCache.types.ps1xml b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCache.types.ps1xml new file mode 100644 index 0000000..9cf05f8 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCache.types.ps1xml @@ -0,0 +1,112 @@ + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheHostedCacheServerSettingData + + + ClientAuthenticationMode + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.HostedCacheServerSettingData.ClientAuthenticationMode]($this.PSBase.CimInstanceProperties['ClientAuthenticationMode'].Value) + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheHostedCacheServerSettingData + + + ClientAuthenticationMode + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.HostedCacheServerSettingData.ClientAuthenticationMode]($this.PSBase.CimInstanceProperties['ClientAuthenticationMode'].Value) + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheClientSettingData + + + CurrentClientMode + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ClientSettingData.CurrentClientMode]($this.PSBase.CimInstanceProperties['CurrentClientMode'].Value) + + + + PreferredContentInformationVersion + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ClientSettingData.PreferredContentInformationVersion]($this.PSBase.CimInstanceProperties['PreferredContentInformationVersion'].Value) + + + + HostedCacheVersion + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ClientSettingData.HostedCacheVersion]($this.PSBase.CimInstanceProperties['HostedCacheVersion'].Value) + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheClientSettingData + + + CurrentClientMode + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ClientSettingData.CurrentClientMode]($this.PSBase.CimInstanceProperties['CurrentClientMode'].Value) + + + + PreferredContentInformationVersion + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ClientSettingData.PreferredContentInformationVersion]($this.PSBase.CimInstanceProperties['PreferredContentInformationVersion'].Value) + + + + HostedCacheVersion + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ClientSettingData.HostedCacheVersion]($this.PSBase.CimInstanceProperties['HostedCacheVersion'].Value) + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetBranchCacheStatus + + + BranchCacheServiceStatus + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.BranchCacheStatus.BranchCacheServiceStatus]($this.PSBase.CimInstanceProperties['BranchCacheServiceStatus'].Value) + + + + BranchCacheServiceStartType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.BranchCacheStatus.BranchCacheServiceStartType]($this.PSBase.CimInstanceProperties['BranchCacheServiceStartType'].Value) + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetBranchCacheStatus + + + BranchCacheServiceStatus + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.BranchCacheStatus.BranchCacheServiceStatus]($this.PSBase.CimInstanceProperties['BranchCacheServiceStatus'].Value) + + + + BranchCacheServiceStartType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.BranchCacheStatus.BranchCacheServiceStartType]($this.PSBase.CimInstanceProperties['BranchCacheServiceStartType'].Value) + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheClientSettingData.cdxml b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheClientSettingData.cdxml new file mode 100644 index 0000000..2305fb7 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheClientSettingData.cdxml @@ -0,0 +1,10 @@ + + + + 1.0.0 + BCClientConfiguration + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheContentServerSettingData.cdxml b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheContentServerSettingData.cdxml new file mode 100644 index 0000000..de8f650 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheContentServerSettingData.cdxml @@ -0,0 +1,10 @@ + + + + 1.0.0 + BCContentServerConfiguration + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheHostedCacheServerSettingData.cdxml b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheHostedCacheServerSettingData.cdxml new file mode 100644 index 0000000..40c5018 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheHostedCacheServerSettingData.cdxml @@ -0,0 +1,10 @@ + + + + 1.0.0 + BCHostedCacheServerConfiguration + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheNetworkSettingData.cdxml b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheNetworkSettingData.cdxml new file mode 100644 index 0000000..fa399e4 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheNetworkSettingData.cdxml @@ -0,0 +1,10 @@ + + + + 1.0.0 + BCNetworkConfiguration + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheOrchestrator.cdxml b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheOrchestrator.cdxml new file mode 100644 index 0000000..ea9066e --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheOrchestrator.cdxml @@ -0,0 +1,817 @@ + + + + 1.0.0 + BC + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/BranchCache/BranchCachePrimaryPublicationCacheFile.cdxml b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCachePrimaryPublicationCacheFile.cdxml new file mode 100644 index 0000000..e1a94bb --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCachePrimaryPublicationCacheFile.cdxml @@ -0,0 +1,10 @@ + + + + 1.0.0 + BCHashCache + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/BranchCache/BranchCachePrimaryRepublicationCacheFile.cdxml b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCachePrimaryRepublicationCacheFile.cdxml new file mode 100644 index 0000000..d34b6d7 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCachePrimaryRepublicationCacheFile.cdxml @@ -0,0 +1,10 @@ + + + + 1.0.0 + BCDataCache + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheSecondaryRepublicationCacheFile.cdxml b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheSecondaryRepublicationCacheFile.cdxml new file mode 100644 index 0000000..09063be --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheSecondaryRepublicationCacheFile.cdxml @@ -0,0 +1,10 @@ + + + + 1.0.0 + BCDataCacheExtension + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheStatus.cdxml b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheStatus.cdxml new file mode 100644 index 0000000..1fe41ee --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/BranchCache/BranchCacheStatus.cdxml @@ -0,0 +1,10 @@ + + + + 1.0.0 + BCStatus + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/CimCmdlets/CimCmdlets.psd1 b/newton-cn/bin/v1.0/Modules/CimCmdlets/CimCmdlets.psd1 new file mode 100644 index 0000000..0517bbe Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/CimCmdlets/CimCmdlets.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/ConfigCI/ConfigCI.psd1 b/newton-cn/bin/v1.0/Modules/ConfigCI/ConfigCI.psd1 new file mode 100644 index 0000000..81b895d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ConfigCI/ConfigCI.psd1 @@ -0,0 +1,30 @@ +@{ +ModuleVersion = '1.0' +GUID = '28c9a37e-c849-4370-b672-e5563447b0e1' +Author="Microsoft Corporation" +CompanyName="Microsoft Corporation" +Copyright="© Microsoft Corporation. All rights reserved." +HelpInfoUri="http://go.microsoft.com/fwlink/?LinkId=626871" +ModuleToProcess="Microsoft.ConfigCI.Commands" +PowerShellVersion="3.0" +CLRVersion="4.0" +CmdletsToExport=@( + "Get-SystemDriver", + "New-CIPolicyRule", + "New-CIPolicy", + "Get-CIPolicy", + "Merge-CIPolicy", + "Remove-CIPolicyRule", + "Edit-CIPolicyRule", + "Set-RuleOption", + "Set-HVCIOptions", + "Set-CIPolicySetting", + "Set-CIPolicyIdInfo", + "Get-CIPolicyIdInfo", + "Get-CIPolicyInfo", + "Add-SignerRule", + "Set-CIPolicyVersion", + "ConvertFrom-CIPolicy") +FunctionsToExport=@() +AliasesToExport=@() +} diff --git a/newton-cn/bin/v1.0/Modules/ConfigDefender/ConfigDefender.psd1 b/newton-cn/bin/v1.0/Modules/ConfigDefender/ConfigDefender.psd1 new file mode 100644 index 0000000..9f438da --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ConfigDefender/ConfigDefender.psd1 @@ -0,0 +1,244 @@ +@{ + GUID = 'C46BE3DC-30A9-452F-A5FD-4BF9CA87A854' + Author="Microsoft Corporation" + CompanyName="Microsoft Corporation" + Copyright="Copyright (C) Microsoft Corporation. All rights reserved." + ModuleVersion = '1.0' + NestedModules = @( 'MSFT_MpComputerStatus.cdxml', + 'MSFT_MpPreference.cdxml', + 'MSFT_MpThreat.cdxml', + 'MSFT_MpThreatCatalog.cdxml', + 'MSFT_MpThreatDetection.cdxml', + 'MSFT_MpScan.cdxml', + 'MSFT_MpSignature.cdxml', + 'MSFT_MpWDOScan.cdxml', + 'MSFT_MpRollback.cdxml', + 'MSFT_MpBehavioralNetworkBlockingRules.cdxml' + ) + + FunctionsToExport = @( 'Get-MpPreference', + 'Set-MpPreference', + 'Add-MpPreference', + 'Remove-MpPreference', + 'Get-MpComputerStatus', + 'Get-MpThreat', + 'Get-MpThreatCatalog', + 'Get-MpThreatDetection', + 'Start-MpScan', + 'Update-MpSignature', + 'Remove-MpThreat', + 'Start-MpWDOScan', + 'Start-MpRollback', + 'Get-MpBehavioralNetworkBlockingRules', + 'Remove-MpBehavioralNetworkBlockingRules' + ) + HelpInfoUri="http://go.microsoft.com/fwlink/?linkid=390762" + PowerShellVersion = '3.0' +} + +# SIG # Begin signature block +# MIImEAYJKoZIhvcNAQcCoIImATCCJf0CAQExDzANBglghkgBZQMEAgEFADB5Bgor +# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG +# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAe8sW09SOrnGAk +# xHQAOKM6Sbd9kzILPBEO6kltXbC3OKCCC2IwggTvMIID16ADAgECAhMzAAALjRfo +# TozQcMmkAAAAAAuNMA0GCSqGSIb3DQEBCwUAMHkxCzAJBgNVBAYTAlVTMRMwEQYD +# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24xIzAhBgNVBAMTGk1pY3Jvc29mdCBXaW5kb3dzIFBD +# QSAyMDEwMB4XDTI0MDgyMjIxMzIwNVoXDTI1MDcwNDIxMzIwNVowcDELMAkGA1UE +# BhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAc +# BgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEaMBgGA1UEAxMRTWljcm9zb2Z0 +# IFdpbmRvd3MwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCh4E7Ri5OA +# yPmb7q3dyQb6toqfRY6QGGKDfulXYcupgGPKZu0dHFK4fKaOn60Z1Y1MoNaFWG3f +# e0mpQmrsAw93uYwwDqpMl6r7m1N5HLUkiOSaKO/meceKjprL7USMgRMiK3EWHnTB +# GKs9yqNzpwqvpwTRMnjJDLC35UD7s2Cfn3Yk9jMpTtSwBAeNc7XnS/Pp0GmsXSrZ +# YOOQ9B3GlUkCGoFlscIiYEK3JvJelhYYQAg33us2McxFJJQ+O/BFRko51u1alFzR +# U5ujbc+cr2SpHzlxkIULe4Fvfcv0HRyyeLNBgqunan9xJWf2rAJSMynVUnkgqWZN +# OzHaiYBd9fjZAgMBAAGjggF3MIIBczAfBgNVHSUEGDAWBgorBgEEAYI3CgMGBggr +# BgEFBQcDAzAdBgNVHQ4EFgQUlKchFWOmTlAgDUTsEik8hXWO4o4wVAYDVR0RBE0w +# S6RJMEcxLTArBgNVBAsTJE1pY3Jvc29mdCBJcmVsYW5kIE9wZXJhdGlvbnMgTGlt +# aXRlZDEWMBQGA1UEBRMNMjMwMDI4KzUwMjc5ODAfBgNVHSMEGDAWgBTRT6mKBwjO +# 9CQYmOUA//PWeR03vDBTBgNVHR8ETDBKMEigRqBEhkJodHRwOi8vY3JsLm1pY3Jv +# c29mdC5jb20vcGtpL2NybC9wcm9kdWN0cy9NaWNXaW5QQ0FfMjAxMC0wNy0wNi5j +# cmwwVwYIKwYBBQUHAQEESzBJMEcGCCsGAQUFBzAChjtodHRwOi8vd3d3Lm1pY3Jv +# c29mdC5jb20vcGtpL2NlcnRzL01pY1dpblBDQV8yMDEwLTA3LTA2LmNydDAMBgNV +# HRMBAf8EAjAAMA0GCSqGSIb3DQEBCwUAA4IBAQCaycnh5i2eis6RuXLbNRi3Bj4O +# 4EpM2wWQr1xABTgVNaKVDAi85hpJN/RsyGP0b4w4Mrf0+ALPSJ9Idowj1Mogd+2a +# dDXe55zNrrBo3rjP6ZWMWGA80ftwWhH5m9Aou9TVjiRw7j4MwVREpeihAf1Ih2m8 +# N/DknvQ3ygn0MuvQ549sBPKuB87pIvGzv0y53zjDqenk1DCSqRAZiNm26zr7+fTB +# cT9oOxKTLJXKWEN/ZEQy8nIcY6kGi3GuQxfD9tYfmACSAaVfTnqviXtEqQFHHBal +# s9ZDWp2dTlr3FGtZWeGg2Gb2coCvEyQoKlAHZePOcAHzY7tG65uAv+x1BaXSMIIG +# azCCBFOgAwIBAgIKYQxqGQAAAAAABDANBgkqhkiG9w0BAQsFADCBiDELMAkGA1UE +# BhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAc +# BgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEyMDAGA1UEAxMpTWljcm9zb2Z0 +# IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTAwHhcNMTAwNzA2MjA0MDIz +# WhcNMjUwNzA2MjA1MDIzWjB5MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGlu +# Z3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBv +# cmF0aW9uMSMwIQYDVQQDExpNaWNyb3NvZnQgV2luZG93cyBQQ0EgMjAxMDCCASIw +# DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMB5uzqx8A+EuK1kKnUWc9C7B/Y+ +# DZ0U5LGfwciUsDh8H9AzVfW6I2b1LihIU8cWg7r1Uax+rOAmfw90/FmV3MnGovdS +# cFosHZSrGb+vlX2vZqFvm2JubUu8LzVs3qRqY1pf+/MNTWHMCn4x62wK0E2XD/1/ +# OEbmisdzaXZVaZZM5NjwNOu6sR/OKX7ET50TFasTG3JYYlZsioGjZHeYRmUpnYMU +# pUwIoIPXIx/zX99vLM/aFtgOcgQo2Gs++BOxfKIXeU9+3DrknXAna7/b/B7HB9jA +# vguTHijgc23SVOkoTL9rXZ//XTMSN5UlYTRqQst8nTq7iFnho0JtOlBbSNECAwEA +# AaOCAeMwggHfMBAGCSsGAQQBgjcVAQQDAgEAMB0GA1UdDgQWBBTRT6mKBwjO9CQY +# mOUA//PWeR03vDAZBgkrBgEEAYI3FAIEDB4KAFMAdQBiAEMAQTALBgNVHQ8EBAMC +# AYYwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBTV9lbLj+iiXGJo0T2UkFvX +# zpoYxDBWBgNVHR8ETzBNMEugSaBHhkVodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20v +# cGtpL2NybC9wcm9kdWN0cy9NaWNSb29DZXJBdXRfMjAxMC0wNi0yMy5jcmwwWgYI +# KwYBBQUHAQEETjBMMEoGCCsGAQUFBzAChj5odHRwOi8vd3d3Lm1pY3Jvc29mdC5j +# b20vcGtpL2NlcnRzL01pY1Jvb0NlckF1dF8yMDEwLTA2LTIzLmNydDCBnQYDVR0g +# BIGVMIGSMIGPBgkrBgEEAYI3LgMwgYEwPQYIKwYBBQUHAgEWMWh0dHA6Ly93d3cu +# bWljcm9zb2Z0LmNvbS9QS0kvZG9jcy9DUFMvZGVmYXVsdC5odG0wQAYIKwYBBQUH +# AgIwNB4yIB0ATABlAGcAYQBsAF8AUABvAGwAaQBjAHkAXwBTAHQAYQB0AGUAbQBl +# AG4AdAAuIB0wDQYJKoZIhvcNAQELBQADggIBAC5Bpoa1Bm/wgIX6O8oX6cn65DnC +# lHDDZJTD2FamkI7+5Jr0bfVvjlONWqjzrttGbL5/HVRWGzwdccRRFVR+v+6llUIz +# /Q2QJCTj+dyWyvy4rL/0wjlWuLvtc7MX3X6GUCOLViTKu6YdmocvJ4XnobYKnA0b +# jPMAYkG6SHSHgv1QyfSHKcMDqivfGil56BIkmobt0C7TQIH1B18zBlRdQLX3sWL9 +# TUj3bkFHUhy7G8JXOqiZVpPUxt4mqGB1hrvsYqbwHQRF3z6nhNFbRCNjJTZ3b65b +# 3CLVFCNqQX/QQqbb7yV7BOPSljdiBq/4Gw+Oszmau4n1NQblpFvDjJ43X1PRozf9 +# pE/oGw5rduS4j7DC6v119yxBt5yj4R4F/peSy39ZA22oTo1OgBfU1XL2VuRIn6Mj +# ugagwI7RiE+TIPJwX9hrcqMgSfx3DF3Fx+ECDzhCEA7bAq6aNx1QgCkepKfZxpol +# Vf1Ayq1kEOgx+RJUeRryDtjWqx4z/gLnJm1hSY/xJcKLdJnf+ZMakBzu3ZQzDkJQ +# 239Q+J9iguymghZ8ZrzsmbDBWF2osJphFJHRmS9J5D6Bmdbm78rj/T7u7AmGAwcN +# Gw186/RayZXPhxIKXezFApLNBZlyyn3xKhAYOOQxoyi05kzFUqOcasd9wHEJBA1w +# 3gI/h+5WoezrtUyFMYIaBDCCGgACAQEwgZAweTELMAkGA1UEBhMCVVMxEzARBgNV +# BAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jv +# c29mdCBDb3Jwb3JhdGlvbjEjMCEGA1UEAxMaTWljcm9zb2Z0IFdpbmRvd3MgUENB +# IDIwMTACEzMAAAuNF+hOjNBwyaQAAAAAC40wDQYJYIZIAWUDBAIBBQCgga4wGQYJ +# KoZIhvcNAQkDMQwGCisGAQQBgjcCAQQwHAYKKwYBBAGCNwIBCzEOMAwGCisGAQQB +# gjcCARUwLwYJKoZIhvcNAQkEMSIEIOTf7eKrc94hoXGvCN+t/9wmIe3y91DbCELF +# WHjOrssCMEIGCisGAQQBgjcCAQwxNDAyoBSAEgBNAGkAYwByAG8AcwBvAGYAdKEa +# gBhodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20wDQYJKoZIhvcNAQEBBQAEggEAKwk6 +# 7GG0pU8oDPBJ9s4GNkjBBf4L5m5ilBSxIfbwWLO8tcbQmOZFhM5hJuOxrG9o9nHO +# XsEp/d0qNbkUqWALUP7F2wtHmGWYlDElAQvInYMvmI1nClVsbU9w79/HgEkfmuiq +# +z3IOs0oD7Ljz2wjJwsiblf+sR0CuBNahLrArQnBKhQIeCUOTTyon7c8a5ke8D0N +# vphG0d1MGlbmYhPn/GD99E4Mma0XDhinCTtgeE5sFKd6jud156wK7nEGmYfyigXO +# HGc2DdHhQk5fNbVAB4zZRgWqxs5CG6I1JQdb8pPz0RtO5nm2E/LFnm+3vohhB6VM +# EZSswzcrRyEkEHJ/IqGCF5MwghePBgorBgEEAYI3AwMBMYIXfzCCF3sGCSqGSIb3 +# DQEHAqCCF2wwghdoAgEDMQ8wDQYJYIZIAWUDBAIBBQAwggFRBgsqhkiG9w0BCRAB +# BKCCAUAEggE8MIIBOAIBAQYKKwYBBAGEWQoDATAxMA0GCWCGSAFlAwQCAQUABCCD +# r3BORPngiTkTcYbYvwFdu8anphEKdCYbtnl+gnC5xAIGZ7ejj0+AGBIyMDI1MDMx +# MjA1MDQwMS44MlowBIACAfSggdGkgc4wgcsxCzAJBgNVBAYTAlVTMRMwEQYDVQQI +# EwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3Nv +# ZnQgQ29ycG9yYXRpb24xJTAjBgNVBAsTHE1pY3Jvc29mdCBBbWVyaWNhIE9wZXJh +# dGlvbnMxJzAlBgNVBAsTHm5TaGllbGQgVFNTIEVTTjpBOTM1LTAzRTAtRDk0NzEl +# MCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZaCCEeowggcgMIIF +# CKADAgECAhMzAAACDLlk4zWc7PSuAAEAAAIMMA0GCSqGSIb3DQEBCwUAMHwxCzAJ +# BgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25k +# MR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jv +# c29mdCBUaW1lLVN0YW1wIFBDQSAyMDEwMB4XDTI1MDEzMDE5NDMwMFoXDTI2MDQy +# MjE5NDMwMFowgcsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAw +# DgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24x +# JTAjBgNVBAsTHE1pY3Jvc29mdCBBbWVyaWNhIE9wZXJhdGlvbnMxJzAlBgNVBAsT +# Hm5TaGllbGQgVFNTIEVTTjpBOTM1LTAzRTAtRDk0NzElMCMGA1UEAxMcTWljcm9z +# b2Z0IFRpbWUtU3RhbXAgU2VydmljZTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCC +# AgoCggIBAMoBViY95G2Br9TqPOrKosPQwCiiXbeBwE3nz5n9eyRjA0mxn477BXJB +# iXx09MrX8ELbECJzWb4m9ySqNVpDfYqZRGwRmi2KtBjg8pVb55fBG3evqzOAu6Jz +# qqgeVtejH+XQcm2BRGTMNdYyQqYZIvvPz9yupy+Ziq/y3+yUAXgn6anNv20wVWaP +# Apc41V1HCD1DdZo9kELta+iLs9Eg3aOCNIGcdjIBlKWy0o2ulhvr4a7qhIWRDMal +# Hrn5A0N2Q/i585/g9s6Dd9vi4Y+MjwQ8qWnAzBqLWRDJf5+ByAKhX0n6jwxhgJlR +# 63eTOGHBHOqHosx4ONpcs/vTVJdeJdzZkfO4MdtL+xm0nfrbtxWkKVcQhS+DbGmv +# Ss+Ui0fC2OjU/AwKldiqdgq9fxonydrBP1bwVS67Jk8bXznb6riORWV4ovvH7t6X +# wRN6Ft2TB2EBfJeKZoTNZ6001KYb8p8cCn1zPCwvW8qvhGCf6kgiRke6iZ1/l7jz +# Ur7EhaEsI92m5XzsSoY4r+NuE6dkSrB28DQCUxot+yYJ6Zma6l6Npi4STTn/pwJT +# GAXjMKeQl5h0wA/71niRWHu3NEWzD+VlKXYPsSEgDoqePpF98faTti1IZK/zoJKH +# N+JdrP3LqxO7xIaoXo5sv9678OSK/JWgJ9RdYuOJImytLrcPQQcdAgMBAAGjggFJ +# MIIBRTAdBgNVHQ4EFgQUdQ5FIf+wH+tD9t4PSXlXFDvToYgwHwYDVR0jBBgwFoAU +# n6cVXQBeYl2D9OXSZacbUzUZ6XIwXwYDVR0fBFgwVjBUoFKgUIZOaHR0cDovL3d3 +# dy5taWNyb3NvZnQuY29tL3BraW9wcy9jcmwvTWljcm9zb2Z0JTIwVGltZS1TdGFt +# cCUyMFBDQSUyMDIwMTAoMSkuY3JsMGwGCCsGAQUFBwEBBGAwXjBcBggrBgEFBQcw +# AoZQaHR0cDovL3d3dy5taWNyb3NvZnQuY29tL3BraW9wcy9jZXJ0cy9NaWNyb3Nv +# ZnQlMjBUaW1lLVN0YW1wJTIwUENBJTIwMjAxMCgxKS5jcnQwDAYDVR0TAQH/BAIw +# ADAWBgNVHSUBAf8EDDAKBggrBgEFBQcDCDAOBgNVHQ8BAf8EBAMCB4AwDQYJKoZI +# hvcNAQELBQADggIBANkw+viBWbDB/gYwHll8dKvfi6G6DrLO7gdRP4lYxmrP26Et +# kGhfkI+N0onPABW9ig24uZLT72UDlLviu8qp3+72+nzxUaTpTuAxx5q12qkqVtVF +# 2fZl+sxykjjM5zoG25ivMlXhwSzViZf3m6IDFoQPfjDTYGd+49lcDR52wMFt3iLE +# VTxf/UnQN8hSTVgVg86ubCYjaTXq7pNwo7RilGXBN0Kr287R4QgRHVIuZA0HNf2H +# ZxwK+2B6Q5oGghDdlFqLwOzV/7BwoI/MPioNffE2C8sWIqgDplIb1L/I6sZqJIYh +# 4PLk31VC6pM2OvK4DOO9/lbwBCnfWFXUZtQM6RtR137OQlYpfgWbN543nYQRvKSh +# ZwnlX0zgM8Y3nGkWpfL1o7T51HRRRha6p4uEPJGdV5lxMS7TGCaj6lAdq4VUBKxU +# 5EynxMXx2l6x362qSRDxU28jbSg5+dN8v7tmBQx/uo1XSWXRajmeWvUIm9rVt+TY +# dzkFjUz2x3duUGR7PK8k+fiPRt846sJhPBiw2yOJGX9ZbXw06mLCpyLAWVQ2q1YJ +# EzML2vzhhpQxDzYHLCTjx3i4GiflkDylddLuPAlOMmPlRJ5GX2+NP3w8NnIIU7Z4 +# VI4V0N1/pYGj9ZlQDaEZnSr4nuPXjR9tcJ85QibSPbcdoBXRyQNL+eYL+gXWMIIH +# cTCCBVmgAwIBAgITMwAAABXF52ueAptJmQAAAAAAFTANBgkqhkiG9w0BAQsFADCB +# iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1Jl +# ZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEyMDAGA1UEAxMp +# TWljcm9zb2Z0IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTAwHhcNMjEw +# OTMwMTgyMjI1WhcNMzAwOTMwMTgzMjI1WjB8MQswCQYDVQQGEwJVUzETMBEGA1UE +# CBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9z +# b2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNyb3NvZnQgVGltZS1TdGFtcCBQ +# Q0EgMjAxMDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAOThpkzntHIh +# C3miy9ckeb0O1YLT/e6cBwfSqWxOdcjKNVf2AX9sSuDivbk+F2Az/1xPx2b3lVNx +# WuJ+Slr+uDZnhUYjDLWNE893MsAQGOhgfWpSg0S3po5GawcU88V29YZQ3MFEyHFc +# UTE3oAo4bo3t1w/YJlN8OWECesSq/XJprx2rrPY2vjUmZNqYO7oaezOtgFt+jBAc +# nVL+tuhiJdxqD89d9P6OU8/W7IVWTe/dvI2k45GPsjksUZzpcGkNyjYtcI4xyDUo +# veO0hyTD4MmPfrVUj9z6BVWYbWg7mka97aSueik3rMvrg0XnRm7KMtXAhjBcTyzi +# YrLNueKNiOSWrAFKu75xqRdbZ2De+JKRHh09/SDPc31BmkZ1zcRfNN0Sidb9pSB9 +# fvzZnkXftnIv231fgLrbqn427DZM9ituqBJR6L8FA6PRc6ZNN3SUHDSCD/AQ8rdH +# GO2n6Jl8P0zbr17C89XYcz1DTsEzOUyOArxCaC4Q6oRRRuLRvWoYWmEBc8pnol7X +# KHYC4jMYctenIPDC+hIK12NvDMk2ZItboKaDIV1fMHSRlJTYuVD5C4lh8zYGNRiE +# R9vcG9H9stQcxWv2XFJRXRLbJbqvUAV6bMURHXLvjflSxIUXk8A8FdsaN8cIFRg/ +# eKtFtvUeh17aj54WcmnGrnu3tz5q4i6tAgMBAAGjggHdMIIB2TASBgkrBgEEAYI3 +# FQEEBQIDAQABMCMGCSsGAQQBgjcVAgQWBBQqp1L+ZMSavoKRPEY1Kc8Q/y8E7jAd +# BgNVHQ4EFgQUn6cVXQBeYl2D9OXSZacbUzUZ6XIwXAYDVR0gBFUwUzBRBgwrBgEE +# AYI3TIN9AQEwQTA/BggrBgEFBQcCARYzaHR0cDovL3d3dy5taWNyb3NvZnQuY29t +# L3BraW9wcy9Eb2NzL1JlcG9zaXRvcnkuaHRtMBMGA1UdJQQMMAoGCCsGAQUFBwMI +# MBkGCSsGAQQBgjcUAgQMHgoAUwB1AGIAQwBBMAsGA1UdDwQEAwIBhjAPBgNVHRMB +# Af8EBTADAQH/MB8GA1UdIwQYMBaAFNX2VsuP6KJcYmjRPZSQW9fOmhjEMFYGA1Ud +# HwRPME0wS6BJoEeGRWh0dHA6Ly9jcmwubWljcm9zb2Z0LmNvbS9wa2kvY3JsL3By +# b2R1Y3RzL01pY1Jvb0NlckF1dF8yMDEwLTA2LTIzLmNybDBaBggrBgEFBQcBAQRO +# MEwwSgYIKwYBBQUHMAKGPmh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9wa2kvY2Vy +# dHMvTWljUm9vQ2VyQXV0XzIwMTAtMDYtMjMuY3J0MA0GCSqGSIb3DQEBCwUAA4IC +# AQCdVX38Kq3hLB9nATEkW+Geckv8qW/qXBS2Pk5HZHixBpOXPTEztTnXwnE2P9pk +# bHzQdTltuw8x5MKP+2zRoZQYIu7pZmc6U03dmLq2HnjYNi6cqYJWAAOwBb6J6Gng +# ugnue99qb74py27YP0h1AdkY3m2CDPVtI1TkeFN1JFe53Z/zjj3G82jfZfakVqr3 +# lbYoVSfQJL1AoL8ZthISEV09J+BAljis9/kpicO8F7BUhUKz/AyeixmJ5/ALaoHC +# gRlCGVJ1ijbCHcNhcy4sa3tuPywJeBTpkbKpW99Jo3QMvOyRgNI95ko+ZjtPu4b6 +# MhrZlvSP9pEB9s7GdP32THJvEKt1MMU0sHrYUP4KWN1APMdUbZ1jdEgssU5HLcEU +# BHG/ZPkkvnNtyo4JvbMBV0lUZNlz138eW0QBjloZkWsNn6Qo3GcZKCS6OEuabvsh +# VGtqRRFHqfG3rsjoiV5PndLQTHa1V1QJsWkBRH58oWFsc/4Ku+xBZj1p/cvBQUl+ +# fpO+y/g75LcVv7TOPqUxUYS8vwLBgqJ7Fx0ViY1w/ue10CgaiQuPNtq6TPmb/wrp +# NPgkNWcr4A245oyZ1uEi6vAnQj0llOZ0dFtq0Z4+7X6gMTN9vMvpe784cETRkPHI +# qzqKOghif9lwY1NNje6CbaUFEMFxBmoQtB1VM1izoXBm8qGCA00wggI1AgEBMIH5 +# oYHRpIHOMIHLMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4G +# A1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSUw +# IwYDVQQLExxNaWNyb3NvZnQgQW1lcmljYSBPcGVyYXRpb25zMScwJQYDVQQLEx5u +# U2hpZWxkIFRTUyBFU046QTkzNS0wM0UwLUQ5NDcxJTAjBgNVBAMTHE1pY3Jvc29m +# dCBUaW1lLVN0YW1wIFNlcnZpY2WiIwoBATAHBgUrDgMCGgMVAO+7yGSEQy3lnwt1 +# 5+WzvPUtVTymoIGDMIGApH4wfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hp +# bmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jw +# b3JhdGlvbjEmMCQGA1UEAxMdTWljcm9zb2Z0IFRpbWUtU3RhbXAgUENBIDIwMTAw +# DQYJKoZIhvcNAQELBQACBQDrey0sMCIYDzIwMjUwMzExMjE0NDEyWhgPMjAyNTAz +# MTIyMTQ0MTJaMHQwOgYKKwYBBAGEWQoEATEsMCowCgIFAOt7LSwCAQAwBwIBAAIC +# LE0wBwIBAAICFG0wCgIFAOt8fqwCAQAwNgYKKwYBBAGEWQoEAjEoMCYwDAYKKwYB +# BAGEWQoDAqAKMAgCAQACAwehIKEKMAgCAQACAwGGoDANBgkqhkiG9w0BAQsFAAOC +# AQEASGokbXBYSTF6Awql1Y3U8KcEsxuoxaXdquci0BGl8KZuRblEvUKwQKjtT4Mv +# Z4CwlM+l6/rjMa5SUALn5muUTIggk3mFMLKTcXhgfGfAYlWHhzS+daoHpYn0k74n +# 4r4N+3fLMmr1/Xpfb/74Bfp8SOqoH0hn4J9mOkN658UKstvPve6mz2fcyHTR67QZ +# xoqcw3ePDixiukQ79ZMKmlHaFO5dykpl1X7tra2TIKBI9dmtf+aQSYouqju20DiJ +# zPElfqzoVYhPC6i/Of5dGzzGZrOvSW+qSptYPxtGq1ttrmhogVLL9E9LpePzlcrd +# PUwdR0t4ePPusIzgbJVRSVhVYzGCBA0wggQJAgEBMIGTMHwxCzAJBgNVBAYTAlVT +# MRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQK +# ExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1l +# LVN0YW1wIFBDQSAyMDEwAhMzAAACDLlk4zWc7PSuAAEAAAIMMA0GCWCGSAFlAwQC +# AQUAoIIBSjAaBgkqhkiG9w0BCQMxDQYLKoZIhvcNAQkQAQQwLwYJKoZIhvcNAQkE +# MSIEILKFLQe8IsGP/BfoLCKCv0TIzxCW1piRPWAr0mIck+thMIH6BgsqhkiG9w0B +# CRACLzGB6jCB5zCB5DCBvQQg1SjXtwUxk3jowjk18gCD1THlw7nEz2Ket7muK45n +# wi0wgZgwgYCkfjB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQ +# MA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9u +# MSYwJAYDVQQDEx1NaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMAITMwAAAgy5 +# ZOM1nOz0rgABAAACDDAiBCBCWzynFAlFH+ypR6v//k4WzoQqt9F24O8vKQMZaz7K +# qzANBgkqhkiG9w0BAQsFAASCAgCDgwnEGoP6qGPRHXDfpqPwg3ofERdfROHbqR// +# mBx1eJofolFOuEzGZ8unrh4rAcgj19xGl9wFwJ8rrBxmelenZ7XJhZiUbss/lYwR +# 0onOBnp5SmWcd881vnEHXdDa0rQUPrRTUIivZm6PcsZheBSro5QQzBN0RJdKb7dz +# iMmGvHfwySaBQkGJ0qD2Lrl74/F5YyOFjo/sytojlQ8VejNs6Ugv54dJvuohG7EF +# IvZnm65FNn1bS39kljdook5pDUayZUjgkA0RLxRIAVDA+Nfu7BJgI7+P06awi1US +# cDyNeMr4t9xmSsKuOEQEYFNV1puP6vFNCxGEXhTxCvhiaUaAmLsQ71Z4KUKYp9x1 +# n/5tg5vV1d2MV+0IqXwkAGBlPug2P6I3UiMsGuPlvNtVeiYsNTrxRWBUoBRjmXqV +# /11BNMViaiImWlHH0fPEzKtsXwu30wEQHbkidx+g3RioctXFgi2ehBrUoRBP0dkR +# K2Xl5Z2kykvAYrV3Sag4T78ITLeJHjlO21+6a2W60yhzx9V6xiSgm9NdqOOo0wke +# 3qei5AI3N0zw3eEWgo/7C+N/TccD+d8YlZsP/g5pOQ+IjDUSGyFca9a5AEddfwc6 +# ymb01sDm6M1N6t9aCswQ7FxAw6ixI8N1Nfk+orX2yROmwQkk8+V2sGgkAFxNwNVh +# 5+M55w== +# SIG # End signature block diff --git a/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpBehavioralNetworkBlockingRules.cdxml b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpBehavioralNetworkBlockingRules.cdxml new file mode 100644 index 0000000..b74ad97 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpBehavioralNetworkBlockingRules.cdxml @@ -0,0 +1,240 @@ + + + + 1.0 + MpBehavioralNetworkBlockingRules + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpComputerStatus.cdxml b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpComputerStatus.cdxml new file mode 100644 index 0000000..317a26c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpComputerStatus.cdxml @@ -0,0 +1,223 @@ + + + + 1.0 + MpComputerStatus + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpPreference.cdxml b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpPreference.cdxml new file mode 100644 index 0000000..0c6f973 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpPreference.cdxml @@ -0,0 +1,2449 @@ + + + + 1.0 + MpPreference + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Both + Incoming + Outcoming + + + + + + + + + + + + + + + + + Everyday + Sunday + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday + Never + + + + + + + + + + + + + + + NotConfigured + Block + Audit + Off + + + + + + + + + + + + + + + Low + Medium + High + + + + + + + + + + + + + + + NotConfigured + Block + Audit + Off + + + + + + + + + + + + + + + Low + Medium + High + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + QuickScan + FullScan + + + + + + + + + + Everyday + Sunday + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday + Never + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Everyday + Sunday + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday + Never + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Disabled + Basic + Advanced + + + + + + + + + + AlwaysPrompt + SendSafeSamples + NeverSend + SendAllSamples + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Disabled + Enabled + AuditMode + + + + + + + + + + Default + Moderate + High + HighPlus + ZeroTolerance + + + + + + + + + + + + + + + + + Disabled + Enabled + AuditMode + + + + + + + + + + Disabled + Enabled + AuditMode + BlockDiskModificationOnly + AuditDiskModificationOnly + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NotConfigured + Beta + Preview + Staged + Broad + Delayed + + + + + + + + + + NotConfigured + Beta + Preview + Staged + Broad + Delayed + + + + + + + + + + NotConfigured + Staged + Broad + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Enabled + Disabled + + + + + + + + + + Disabled + ScanRtpExclusions + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpRollback.cdxml b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpRollback.cdxml new file mode 100644 index 0000000..a8487fe --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpRollback.cdxml @@ -0,0 +1,241 @@ + + + + 1.0 + MpRollback + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpScan.cdxml b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpScan.cdxml new file mode 100644 index 0000000..f65a652 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpScan.cdxml @@ -0,0 +1,254 @@ + + + + 1.0 + MpScan + + + + + + + + + + + + + + + + + + + + + + + + + FullScan + QuickScan + CustomScan + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpSignature.cdxml b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpSignature.cdxml new file mode 100644 index 0000000..7303bc6 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpSignature.cdxml @@ -0,0 +1,251 @@ + + + + 1.0 + MpSignature + + + + + + + + + + + + + + + + + + + + InternalDefinitionUpdateServer + MicrosoftUpdateServer + MMPC + FileShares + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpThreat.cdxml b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpThreat.cdxml new file mode 100644 index 0000000..240f308 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpThreat.cdxml @@ -0,0 +1,239 @@ + + + + 1.0 + MpThreat + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpThreatCatalog.cdxml b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpThreatCatalog.cdxml new file mode 100644 index 0000000..2b070bb --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpThreatCatalog.cdxml @@ -0,0 +1,226 @@ + + + + 1.0 + MpThreatCatalog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpThreatDetection.cdxml b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpThreatDetection.cdxml new file mode 100644 index 0000000..ffc845b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpThreatDetection.cdxml @@ -0,0 +1,226 @@ + + + + 1.0 + MpThreatDetection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpWDOScan.cdxml b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpWDOScan.cdxml new file mode 100644 index 0000000..b0f6e8c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ConfigDefender/MSFT_MpWDOScan.cdxml @@ -0,0 +1,226 @@ + + + + 1.0 + MpWDOScan + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/ConfigDefenderPerformance/ConfigDefenderPerformance.psd1 b/newton-cn/bin/v1.0/Modules/ConfigDefenderPerformance/ConfigDefenderPerformance.psd1 new file mode 100644 index 0000000..705fd29 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ConfigDefenderPerformance/ConfigDefenderPerformance.psd1 @@ -0,0 +1,225 @@ +@{ + GUID = 'A51E6D9E-BC14-41A7-98A8-888195641250' + Author="Microsoft Corporation" + CompanyName="Microsoft Corporation" + Copyright="Copyright (C) Microsoft Corporation. All rights reserved." + ModuleVersion = '1.0' + NestedModules = @('MSFT_MpPerformanceRecording.psm1') + + FormatsToProcess = @('MSFT_MpPerformanceReport.Format.ps1xml') + + CompatiblePSEditions = @('Desktop', 'Core') + + FunctionsToExport = @( 'New-MpPerformanceRecording', + 'Get-MpPerformanceReport' + ) + HelpInfoUri="http://go.microsoft.com/fwlink/?linkid=390762" + PowerShellVersion = '5.1' +} + +# SIG # Begin signature block +# MIImKgYJKoZIhvcNAQcCoIImGzCCJhcCAQExDzANBglghkgBZQMEAgEFADB5Bgor +# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG +# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCC5QoGq9EV41ZN5 +# fnwNlxKx8aIBP8W7y/AxkQ4SrJmPcKCCC2IwggTvMIID16ADAgECAhMzAAALjRfo +# TozQcMmkAAAAAAuNMA0GCSqGSIb3DQEBCwUAMHkxCzAJBgNVBAYTAlVTMRMwEQYD +# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24xIzAhBgNVBAMTGk1pY3Jvc29mdCBXaW5kb3dzIFBD +# QSAyMDEwMB4XDTI0MDgyMjIxMzIwNVoXDTI1MDcwNDIxMzIwNVowcDELMAkGA1UE +# BhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAc +# BgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEaMBgGA1UEAxMRTWljcm9zb2Z0 +# IFdpbmRvd3MwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCh4E7Ri5OA +# yPmb7q3dyQb6toqfRY6QGGKDfulXYcupgGPKZu0dHFK4fKaOn60Z1Y1MoNaFWG3f +# e0mpQmrsAw93uYwwDqpMl6r7m1N5HLUkiOSaKO/meceKjprL7USMgRMiK3EWHnTB +# GKs9yqNzpwqvpwTRMnjJDLC35UD7s2Cfn3Yk9jMpTtSwBAeNc7XnS/Pp0GmsXSrZ +# YOOQ9B3GlUkCGoFlscIiYEK3JvJelhYYQAg33us2McxFJJQ+O/BFRko51u1alFzR +# U5ujbc+cr2SpHzlxkIULe4Fvfcv0HRyyeLNBgqunan9xJWf2rAJSMynVUnkgqWZN +# OzHaiYBd9fjZAgMBAAGjggF3MIIBczAfBgNVHSUEGDAWBgorBgEEAYI3CgMGBggr +# BgEFBQcDAzAdBgNVHQ4EFgQUlKchFWOmTlAgDUTsEik8hXWO4o4wVAYDVR0RBE0w +# S6RJMEcxLTArBgNVBAsTJE1pY3Jvc29mdCBJcmVsYW5kIE9wZXJhdGlvbnMgTGlt +# aXRlZDEWMBQGA1UEBRMNMjMwMDI4KzUwMjc5ODAfBgNVHSMEGDAWgBTRT6mKBwjO +# 9CQYmOUA//PWeR03vDBTBgNVHR8ETDBKMEigRqBEhkJodHRwOi8vY3JsLm1pY3Jv +# c29mdC5jb20vcGtpL2NybC9wcm9kdWN0cy9NaWNXaW5QQ0FfMjAxMC0wNy0wNi5j +# cmwwVwYIKwYBBQUHAQEESzBJMEcGCCsGAQUFBzAChjtodHRwOi8vd3d3Lm1pY3Jv +# c29mdC5jb20vcGtpL2NlcnRzL01pY1dpblBDQV8yMDEwLTA3LTA2LmNydDAMBgNV +# HRMBAf8EAjAAMA0GCSqGSIb3DQEBCwUAA4IBAQCaycnh5i2eis6RuXLbNRi3Bj4O +# 4EpM2wWQr1xABTgVNaKVDAi85hpJN/RsyGP0b4w4Mrf0+ALPSJ9Idowj1Mogd+2a +# dDXe55zNrrBo3rjP6ZWMWGA80ftwWhH5m9Aou9TVjiRw7j4MwVREpeihAf1Ih2m8 +# N/DknvQ3ygn0MuvQ549sBPKuB87pIvGzv0y53zjDqenk1DCSqRAZiNm26zr7+fTB +# cT9oOxKTLJXKWEN/ZEQy8nIcY6kGi3GuQxfD9tYfmACSAaVfTnqviXtEqQFHHBal +# s9ZDWp2dTlr3FGtZWeGg2Gb2coCvEyQoKlAHZePOcAHzY7tG65uAv+x1BaXSMIIG +# azCCBFOgAwIBAgIKYQxqGQAAAAAABDANBgkqhkiG9w0BAQsFADCBiDELMAkGA1UE +# BhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAc +# BgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEyMDAGA1UEAxMpTWljcm9zb2Z0 +# IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTAwHhcNMTAwNzA2MjA0MDIz +# WhcNMjUwNzA2MjA1MDIzWjB5MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGlu +# Z3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBv +# cmF0aW9uMSMwIQYDVQQDExpNaWNyb3NvZnQgV2luZG93cyBQQ0EgMjAxMDCCASIw +# DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMB5uzqx8A+EuK1kKnUWc9C7B/Y+ +# DZ0U5LGfwciUsDh8H9AzVfW6I2b1LihIU8cWg7r1Uax+rOAmfw90/FmV3MnGovdS +# cFosHZSrGb+vlX2vZqFvm2JubUu8LzVs3qRqY1pf+/MNTWHMCn4x62wK0E2XD/1/ +# OEbmisdzaXZVaZZM5NjwNOu6sR/OKX7ET50TFasTG3JYYlZsioGjZHeYRmUpnYMU +# pUwIoIPXIx/zX99vLM/aFtgOcgQo2Gs++BOxfKIXeU9+3DrknXAna7/b/B7HB9jA +# vguTHijgc23SVOkoTL9rXZ//XTMSN5UlYTRqQst8nTq7iFnho0JtOlBbSNECAwEA +# AaOCAeMwggHfMBAGCSsGAQQBgjcVAQQDAgEAMB0GA1UdDgQWBBTRT6mKBwjO9CQY +# mOUA//PWeR03vDAZBgkrBgEEAYI3FAIEDB4KAFMAdQBiAEMAQTALBgNVHQ8EBAMC +# AYYwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBTV9lbLj+iiXGJo0T2UkFvX +# zpoYxDBWBgNVHR8ETzBNMEugSaBHhkVodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20v +# cGtpL2NybC9wcm9kdWN0cy9NaWNSb29DZXJBdXRfMjAxMC0wNi0yMy5jcmwwWgYI +# KwYBBQUHAQEETjBMMEoGCCsGAQUFBzAChj5odHRwOi8vd3d3Lm1pY3Jvc29mdC5j +# b20vcGtpL2NlcnRzL01pY1Jvb0NlckF1dF8yMDEwLTA2LTIzLmNydDCBnQYDVR0g +# BIGVMIGSMIGPBgkrBgEEAYI3LgMwgYEwPQYIKwYBBQUHAgEWMWh0dHA6Ly93d3cu +# bWljcm9zb2Z0LmNvbS9QS0kvZG9jcy9DUFMvZGVmYXVsdC5odG0wQAYIKwYBBQUH +# AgIwNB4yIB0ATABlAGcAYQBsAF8AUABvAGwAaQBjAHkAXwBTAHQAYQB0AGUAbQBl +# AG4AdAAuIB0wDQYJKoZIhvcNAQELBQADggIBAC5Bpoa1Bm/wgIX6O8oX6cn65DnC +# lHDDZJTD2FamkI7+5Jr0bfVvjlONWqjzrttGbL5/HVRWGzwdccRRFVR+v+6llUIz +# /Q2QJCTj+dyWyvy4rL/0wjlWuLvtc7MX3X6GUCOLViTKu6YdmocvJ4XnobYKnA0b +# jPMAYkG6SHSHgv1QyfSHKcMDqivfGil56BIkmobt0C7TQIH1B18zBlRdQLX3sWL9 +# TUj3bkFHUhy7G8JXOqiZVpPUxt4mqGB1hrvsYqbwHQRF3z6nhNFbRCNjJTZ3b65b +# 3CLVFCNqQX/QQqbb7yV7BOPSljdiBq/4Gw+Oszmau4n1NQblpFvDjJ43X1PRozf9 +# pE/oGw5rduS4j7DC6v119yxBt5yj4R4F/peSy39ZA22oTo1OgBfU1XL2VuRIn6Mj +# ugagwI7RiE+TIPJwX9hrcqMgSfx3DF3Fx+ECDzhCEA7bAq6aNx1QgCkepKfZxpol +# Vf1Ayq1kEOgx+RJUeRryDtjWqx4z/gLnJm1hSY/xJcKLdJnf+ZMakBzu3ZQzDkJQ +# 239Q+J9iguymghZ8ZrzsmbDBWF2osJphFJHRmS9J5D6Bmdbm78rj/T7u7AmGAwcN +# Gw186/RayZXPhxIKXezFApLNBZlyyn3xKhAYOOQxoyi05kzFUqOcasd9wHEJBA1w +# 3gI/h+5WoezrtUyFMYIaHjCCGhoCAQEwgZAweTELMAkGA1UEBhMCVVMxEzARBgNV +# BAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jv +# c29mdCBDb3Jwb3JhdGlvbjEjMCEGA1UEAxMaTWljcm9zb2Z0IFdpbmRvd3MgUENB +# IDIwMTACEzMAAAuNF+hOjNBwyaQAAAAAC40wDQYJYIZIAWUDBAIBBQCgga4wGQYJ +# KoZIhvcNAQkDMQwGCisGAQQBgjcCAQQwHAYKKwYBBAGCNwIBCzEOMAwGCisGAQQB +# gjcCARUwLwYJKoZIhvcNAQkEMSIEICjaAYW6dpF96OECCa1j0HmEWEEdofGluuKS +# KwAnvISeMEIGCisGAQQBgjcCAQwxNDAyoBSAEgBNAGkAYwByAG8AcwBvAGYAdKEa +# gBhodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20wDQYJKoZIhvcNAQEBBQAEggEAPSUw +# uXOOzvVNkifKjBTVinJW7rdqj9J8oWF2ph6LhBx8Cf+GVhy4iiqjkOCR5HJGuXdu +# 2x8GRA+TDZuyc8GdSFc1Z0wuz1njQiqXXFLmCOjaGVpjVc10jSc1lA3BsNEehNax +# lPtIPW5J93z8t7TXEOSh7AZGQ3SmS12xKiusP6jfnDjNhzHgI0I+SgkX4QadjBIt +# QjGRkxrdE9dTJHiqmZKX351c287OQbQFvSCheF5VR5Ab9Tbm8Sw1feM5tRPP/gt0 +# vwW1PfdHPstKcufJEKfxjboBXOAzfKCaRqrj2kzRQfbMj5NjI22Y9YicSXzbJQu9 +# ygJfG1iulp12uxZl7qGCF60wghepBgorBgEEAYI3AwMBMYIXmTCCF5UGCSqGSIb3 +# DQEHAqCCF4YwgheCAgEDMQ8wDQYJYIZIAWUDBAIBBQAwggFaBgsqhkiG9w0BCRAB +# BKCCAUkEggFFMIIBQQIBAQYKKwYBBAGEWQoDATAxMA0GCWCGSAFlAwQCAQUABCDf +# p3n06ofTmz0YuKVhv/9rijFkkr8AB1PliqZjzdfZVwIGZ7YxybG5GBMyMDI1MDMx +# MjA1MDM1OS42ODRaMASAAgH0oIHZpIHWMIHTMQswCQYDVQQGEwJVUzETMBEGA1UE +# CBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9z +# b2Z0IENvcnBvcmF0aW9uMS0wKwYDVQQLEyRNaWNyb3NvZnQgSXJlbGFuZCBPcGVy +# YXRpb25zIExpbWl0ZWQxJzAlBgNVBAsTHm5TaGllbGQgVFNTIEVTTjozNjA1LTA1 +# RTAtRDk0NzElMCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZaCC +# EfswggcoMIIFEKADAgECAhMzAAAB91ggdQTK+8L0AAEAAAH3MA0GCSqGSIb3DQEB +# CwUAMHwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQH +# EwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNV +# BAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQSAyMDEwMB4XDTI0MDcyNTE4MzEw +# NloXDTI1MTAyMjE4MzEwNlowgdMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNo +# aW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29y +# cG9yYXRpb24xLTArBgNVBAsTJE1pY3Jvc29mdCBJcmVsYW5kIE9wZXJhdGlvbnMg +# TGltaXRlZDEnMCUGA1UECxMeblNoaWVsZCBUU1MgRVNOOjM2MDUtMDVFMC1EOTQ3 +# MSUwIwYDVQQDExxNaWNyb3NvZnQgVGltZS1TdGFtcCBTZXJ2aWNlMIICIjANBgkq +# hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0OdHTBNom6/uXKaEKP9rPITkT6QxF11t +# jzB0Nk1byDpPrFTHha3hxwSdTcr8Y0a3k6EQlwqy6ROz42e0R5eDW+dCoQapipDI +# FUOYp3oNuqwX/xepATEkY17MyXFx6rQW2NcWUJW3Qo2AuJ0HOtblSpItQZPGmHnG +# qkt/DB45Fwxk6VoSvxNcQKhKETkuzrt8U6DRccQm1FdhmPKgDzgcfDPM5o+Gnzbi +# Mu6y069A4EHmLMmkecSkVvBmcZ8VnzFHTDkGLdpnDV5FXjVObAgbSM0cnqYSGfRp +# 7VGHBRqyoscvR4bcQ+CV9pDjbJ6S5rZn1uA8hRhj09Hs33HRevt4oWAVYGItgEsG +# +BrCYbpgWMDEIVnAgPZEiPAaI8wBGemE4feEkuz7TAwgkRBcUzLgQ4uvPqRD1A+J +# kt26+pDqWYSn0MA8j0zacQk9q/AvciPXD9It2ez+mqEzgFRRsJGLtcf9HksvK8Js +# d6I5zFShlqi5bpzf1Y4NOiNOh5QwW1pIvA5irlal7qFhkAeeeZqmop8+uNxZXxFC +# QG3R3s5pXW89FiCh9rmXrVqOCwgcXFIJQAQkllKsI+UJqGq9rmRABJz5lHKTFYmF +# wcM52KWWjNx3z6odwz2h+sxaxewToe9GqtDx3/aU+yqNRcB8w0tSXUf+ylN4uk5x +# HEpLpx+ZNNsCAwEAAaOCAUkwggFFMB0GA1UdDgQWBBTfRqQzP3m9PZWuLf1p8/me +# FfkmmDAfBgNVHSMEGDAWgBSfpxVdAF5iXYP05dJlpxtTNRnpcjBfBgNVHR8EWDBW +# MFSgUqBQhk5odHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2NybC9NaWNy +# b3NvZnQlMjBUaW1lLVN0YW1wJTIwUENBJTIwMjAxMCgxKS5jcmwwbAYIKwYBBQUH +# AQEEYDBeMFwGCCsGAQUFBzAChlBodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtp +# b3BzL2NlcnRzL01pY3Jvc29mdCUyMFRpbWUtU3RhbXAlMjBQQ0ElMjAyMDEwKDEp +# LmNydDAMBgNVHRMBAf8EAjAAMBYGA1UdJQEB/wQMMAoGCCsGAQUFBwMIMA4GA1Ud +# DwEB/wQEAwIHgDANBgkqhkiG9w0BAQsFAAOCAgEAN0ajafILeL6SQIMIMAXM1Qd6 +# xaoci2mOrpR8vKWyyTsL3b83A7XGLiAbQxTrqnXvVWWeNst5YQD8saO+UTgOLJdT +# dfUADhLXoK+RlwjfndimIJT9MH9tUYXLzJXKhZM09ouPwNsrn8YOLIpdAi5TPyN8 +# Cl11OGZSlP9r8JnvomW00AoJ4Pl9rlg0G5lcQknAXqHa9nQdWp1ZxXqNd+0JsKml +# R8tcANX33ClM9NnaClJExLQHiKeHUUWtqyLMl65TW6wRM7XlF7Y+PTnC8duNWn4u +# Lng+ON/Z39GO6qBj7IEZxoq4o3avEh9ba43UU6TgzVZaBm8VaA0wSwUe/pqpTOYF +# WN62XL3gl/JC2pzfIPxP66XfRLIxafjBVXm8KVDn2cML9IvRK02s941Y5+RR4gSA +# OhLiQQ6A03VNRup+spMa0k+XTPAi+2aMH5xa1Zjb/K8u9f9M05U0/bUMJXJDP++y +# sWpJbVRDiHG7szaca+r3HiUPjQJyQl2NiOcYTGV/DcLrLCBK2zG503FGb04N5Kf1 +# 0XgAwFaXlod5B9eKh95PnXKx2LNBgLwG85anlhhGxxBQ5mFsJGkBn0PZPtAzZyfr +# 96qxzpp2pH9DJJcjKCDrMmZziXazpa5VVN36CO1kDU4ABkSYTXOM8RmJXuQm7mUF +# 3bWmj+hjAJb4pz6hT5UwggdxMIIFWaADAgECAhMzAAAAFcXna54Cm0mZAAAAAAAV +# MA0GCSqGSIb3DQEBCwUAMIGIMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGlu +# Z3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBv +# cmF0aW9uMTIwMAYDVQQDEylNaWNyb3NvZnQgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRo +# b3JpdHkgMjAxMDAeFw0yMTA5MzAxODIyMjVaFw0zMDA5MzAxODMyMjVaMHwxCzAJ +# BgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25k +# MR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jv +# c29mdCBUaW1lLVN0YW1wIFBDQSAyMDEwMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A +# MIICCgKCAgEA5OGmTOe0ciELeaLL1yR5vQ7VgtP97pwHB9KpbE51yMo1V/YBf2xK +# 4OK9uT4XYDP/XE/HZveVU3Fa4n5KWv64NmeFRiMMtY0Tz3cywBAY6GB9alKDRLem +# jkZrBxTzxXb1hlDcwUTIcVxRMTegCjhuje3XD9gmU3w5YQJ6xKr9cmmvHaus9ja+ +# NSZk2pg7uhp7M62AW36MEBydUv626GIl3GoPz130/o5Tz9bshVZN7928jaTjkY+y +# OSxRnOlwaQ3KNi1wjjHINSi947SHJMPgyY9+tVSP3PoFVZhtaDuaRr3tpK56KTes +# y+uDRedGbsoy1cCGMFxPLOJiss254o2I5JasAUq7vnGpF1tnYN74kpEeHT39IM9z +# fUGaRnXNxF803RKJ1v2lIH1+/NmeRd+2ci/bfV+AutuqfjbsNkz2K26oElHovwUD +# o9Fzpk03dJQcNIIP8BDyt0cY7afomXw/TNuvXsLz1dhzPUNOwTM5TI4CvEJoLhDq +# hFFG4tG9ahhaYQFzymeiXtcodgLiMxhy16cg8ML6EgrXY28MyTZki1ugpoMhXV8w +# dJGUlNi5UPkLiWHzNgY1GIRH29wb0f2y1BzFa/ZcUlFdEtsluq9QBXpsxREdcu+N +# +VLEhReTwDwV2xo3xwgVGD94q0W29R6HXtqPnhZyacaue7e3PmriLq0CAwEAAaOC +# Ad0wggHZMBIGCSsGAQQBgjcVAQQFAgMBAAEwIwYJKwYBBAGCNxUCBBYEFCqnUv5k +# xJq+gpE8RjUpzxD/LwTuMB0GA1UdDgQWBBSfpxVdAF5iXYP05dJlpxtTNRnpcjBc +# BgNVHSAEVTBTMFEGDCsGAQQBgjdMg30BATBBMD8GCCsGAQUFBwIBFjNodHRwOi8v +# d3d3Lm1pY3Jvc29mdC5jb20vcGtpb3BzL0RvY3MvUmVwb3NpdG9yeS5odG0wEwYD +# VR0lBAwwCgYIKwYBBQUHAwgwGQYJKwYBBAGCNxQCBAweCgBTAHUAYgBDAEEwCwYD +# VR0PBAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAU1fZWy4/oolxi +# aNE9lJBb186aGMQwVgYDVR0fBE8wTTBLoEmgR4ZFaHR0cDovL2NybC5taWNyb3Nv +# ZnQuY29tL3BraS9jcmwvcHJvZHVjdHMvTWljUm9vQ2VyQXV0XzIwMTAtMDYtMjMu +# Y3JsMFoGCCsGAQUFBwEBBE4wTDBKBggrBgEFBQcwAoY+aHR0cDovL3d3dy5taWNy +# b3NvZnQuY29tL3BraS9jZXJ0cy9NaWNSb29DZXJBdXRfMjAxMC0wNi0yMy5jcnQw +# DQYJKoZIhvcNAQELBQADggIBAJ1VffwqreEsH2cBMSRb4Z5yS/ypb+pcFLY+Tkdk +# eLEGk5c9MTO1OdfCcTY/2mRsfNB1OW27DzHkwo/7bNGhlBgi7ulmZzpTTd2YurYe +# eNg2LpypglYAA7AFvonoaeC6Ce5732pvvinLbtg/SHUB2RjebYIM9W0jVOR4U3Uk +# V7ndn/OOPcbzaN9l9qRWqveVtihVJ9AkvUCgvxm2EhIRXT0n4ECWOKz3+SmJw7wX +# sFSFQrP8DJ6LGYnn8AtqgcKBGUIZUnWKNsIdw2FzLixre24/LAl4FOmRsqlb30mj +# dAy87JGA0j3mSj5mO0+7hvoyGtmW9I/2kQH2zsZ0/fZMcm8Qq3UwxTSwethQ/gpY +# 3UA8x1RtnWN0SCyxTkctwRQEcb9k+SS+c23Kjgm9swFXSVRk2XPXfx5bRAGOWhmR +# aw2fpCjcZxkoJLo4S5pu+yFUa2pFEUep8beuyOiJXk+d0tBMdrVXVAmxaQFEfnyh +# YWxz/gq77EFmPWn9y8FBSX5+k77L+DvktxW/tM4+pTFRhLy/AsGConsXHRWJjXD+ +# 57XQKBqJC4822rpM+Zv/Cuk0+CQ1ZyvgDbjmjJnW4SLq8CdCPSWU5nR0W2rRnj7t +# fqAxM328y+l7vzhwRNGQ8cirOoo6CGJ/2XBjU02N7oJtpQUQwXEGahC0HVUzWLOh +# cGbyoYIDVjCCAj4CAQEwggEBoYHZpIHWMIHTMQswCQYDVQQGEwJVUzETMBEGA1UE +# CBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9z +# b2Z0IENvcnBvcmF0aW9uMS0wKwYDVQQLEyRNaWNyb3NvZnQgSXJlbGFuZCBPcGVy +# YXRpb25zIExpbWl0ZWQxJzAlBgNVBAsTHm5TaGllbGQgVFNTIEVTTjozNjA1LTA1 +# RTAtRDk0NzElMCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZaIj +# CgEBMAcGBSsOAwIaAxUAb28KDG/xXbNBjmM7/nqw3bgrEOaggYMwgYCkfjB8MQsw +# CQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9u +# ZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNy +# b3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMDANBgkqhkiG9w0BAQsFAAIFAOt7DJww +# IhgPMjAyNTAzMTExOTI1MTZaGA8yMDI1MDMxMjE5MjUxNlowdDA6BgorBgEEAYRZ +# CgQBMSwwKjAKAgUA63sMnAIBADAHAgEAAgINezAHAgEAAgIUbTAKAgUA63xeHAIB +# ADA2BgorBgEEAYRZCgQCMSgwJjAMBgorBgEEAYRZCgMCoAowCAIBAAIDB6EgoQow +# CAIBAAIDAYagMA0GCSqGSIb3DQEBCwUAA4IBAQByHXKsA3jwBMLStTX9YrUEKeUc +# iKhqb5t2dMmL//ddLgYa4aTMcR336U5cuVv0ei3pMKb+u0i9Khzn+yhGvQmXuS49 +# rvT/96xV3NPh4UtTFiOq32mbWdnPu2Dk/BMopiX3x4H4h4wbPwCyZuw/3I3fYziX +# C82nzfon4kWQGVLsFKPR76FvwKJfCdnORNcsjGHVC0I2dYldnOkXEOagD+HYuxxP +# TheSSsOjyr00FWJrq/+sJEW61k3e0YhiYUkt9xXz6Af941QarQtYUVZOkatiYfSO +# IbsqBNc0QiwhHL+MZfLtkTJby5ZkPGZVW4IpgvkUCP1OGPyfsT6MkX+hwf/9MYIE +# DTCCBAkCAQEwgZMwfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24x +# EDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlv +# bjEmMCQGA1UEAxMdTWljcm9zb2Z0IFRpbWUtU3RhbXAgUENBIDIwMTACEzMAAAH3 +# WCB1BMr7wvQAAQAAAfcwDQYJYIZIAWUDBAIBBQCgggFKMBoGCSqGSIb3DQEJAzEN +# BgsqhkiG9w0BCRABBDAvBgkqhkiG9w0BCQQxIgQg/yRDeNFKnwzs5Rt50bP3NG59 +# w0d+IBESDcY47TiFwVAwgfoGCyqGSIb3DQEJEAIvMYHqMIHnMIHkMIG9BCAh2pja +# a3ca0ecYuhu60uYHP/IKnPbedbVQJ5SoIH5Z4jCBmDCBgKR+MHwxCzAJBgNVBAYT +# AlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYD +# VQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBU +# aW1lLVN0YW1wIFBDQSAyMDEwAhMzAAAB91ggdQTK+8L0AAEAAAH3MCIEIAhgyovm +# 0hKpfTDqUSQodYmLea3PP/1DIDJ7Pag/qvJBMA0GCSqGSIb3DQEBCwUABIICAI3M +# wyyVZaZPcrXoNBl5mLAJ5MmRJDgU+6UCsXyoqNu7dcTCKWRbdOwbI7ha8NW+4rn6 +# yzYRGhgI+9baZsQKF3Uo/rcQH8OyRtqlC3KxaFvfsZ2icfBByjy0d7GZAZLSHe/F +# BXUWdZh9UbDotE9rupdHAzgSlSQDWGuO22zCJmlt7eY6TDoiSXdaqIMFIK4RMAZd +# dZ+OiZjBOIooLV4ATNV58Q/rIOrZ9XQ06km/LBsjQwf6PwEpvQZmZ79zSHcs2qwL +# cc8AXwVtvvAyy2XxGVRRi7WS77TUDyMs4g+ewCtw7zFMft/WPjUS2Mq1BZAbyoHD +# g2ZzsQoOLOD6J46P21Aon5E3RHC1DmuCjWKfYx/a5+myomFa81++yd24QqmG8oV0 +# xuPnxFzd89dtAl5+UIORVYhW15jQbvUjHRThTUo7tmAFx6mPuE6JP3C8921TY7Y/ +# ysNpZj6br46oGcDv86ACtDr7rWRYgLAvbPLacxfsVXC3YGVK7CmX03n7wVAOrFqr +# 0CKROmV8648RimNuSWtokfoSoi8lkb23NUaq4MNrM9j3uJIyts0uR6Bd881tlXIM +# ui+aTFRHo4MmoA6mmzTqV66NEhscgBET2nVUCqWu9pANtAieXwMVkRSykUzbGLb2 +# pigzqgudYrehlVfB6KDxIX7R++VavMqpqCZsNKZP +# SIG # End signature block diff --git a/newton-cn/bin/v1.0/Modules/ConfigDefenderPerformance/MSFT_MpPerformanceRecording.psm1 b/newton-cn/bin/v1.0/Modules/ConfigDefenderPerformance/MSFT_MpPerformanceRecording.psm1 new file mode 100644 index 0000000..6365e6d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ConfigDefenderPerformance/MSFT_MpPerformanceRecording.psm1 @@ -0,0 +1,1936 @@ +## Copyright (c) Microsoft Corporation. All rights reserved. + +<# +.SYNOPSIS +This cmdlet collects a performance recording of Microsoft Defender Antivirus +scans. + +.DESCRIPTION +This cmdlet collects a performance recording of Microsoft Defender Antivirus +scans. These performance recordings contain Microsoft-Antimalware-Engine +and NT kernel process events and can be analyzed after collection using the +Get-MpPerformanceReport cmdlet. + +This cmdlet requires elevated administrator privileges. + +The performance analyzer provides insight into problematic files that could +cause performance degradation of Microsoft Defender Antivirus. This tool is +provided "AS IS", and is not intended to provide suggestions on exclusions. +Exclusions can reduce the level of protection on your endpoints. Exclusions, +if any, should be defined with caution. + +.EXAMPLE +New-MpPerformanceRecording -RecordTo:.\Defender-scans.etl + +#> +function New-MpPerformanceRecording { + [CmdletBinding(DefaultParameterSetName='Interactive')] + param( + + # Specifies the location where to save the Microsoft Defender Antivirus + # performance recording. + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string]$RecordTo, + + # Specifies the duration of the performance recording in seconds. + [Parameter(Mandatory=$true, ParameterSetName='Timed')] + [ValidateRange(0,2147483)] + [int]$Seconds, + + # Specifies the PSSession object in which to create and save the Microsoft + # Defender Antivirus performance recording. When you use this parameter, + # the RecordTo parameter refers to the local path on the remote machine. + [Parameter(Mandatory=$false)] + [System.Management.Automation.Runspaces.PSSession[]]$Session, + + # Optional argument to specifiy a different tool for recording traces. Default is wpr.exe + # When $Session parameter is used this path represents a location on the remote machine. + [Parameter(Mandatory=$false)] + [string]$WPRPath = $null + + ) + + [bool]$interactiveMode = ($PSCmdlet.ParameterSetName -eq 'Interactive') + [bool]$timedMode = ($PSCmdlet.ParameterSetName -eq 'Timed') + + # Hosts + [string]$powerShellHostConsole = 'ConsoleHost' + [string]$powerShellHostISE = 'Windows PowerShell ISE Host' + [string]$powerShellHostRemote = 'ServerRemoteHost' + + if ($interactiveMode -and ($Host.Name -notin @($powerShellHostConsole, $powerShellHostISE, $powerShellHostRemote))) { + $ex = New-Object System.Management.Automation.ItemNotFoundException 'Cmdlet supported only on local PowerShell console, Windows PowerShell ISE and remote PowerShell console.' + $category = [System.Management.Automation.ErrorCategory]::NotImplemented + $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'NotImplemented',$category,$Host.Name + $psCmdlet.WriteError($errRecord) + return + } + + if ($null -ne $Session) { + [int]$RemotedSeconds = if ($timedMode) { $Seconds } else { -1 } + + Invoke-Command -Session:$session -ArgumentList:@($RecordTo, $RemotedSeconds) -ScriptBlock:{ + param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string]$RecordTo, + + [Parameter(Mandatory=$true)] + [ValidateRange(-1,2147483)] + [int]$RemotedSeconds + ) + + if ($RemotedSeconds -eq -1) { + New-MpPerformanceRecording -RecordTo:$RecordTo -WPRPath:$WPRPath + } else { + New-MpPerformanceRecording -RecordTo:$RecordTo -Seconds:$RemotedSeconds -WPRPath:$WPRPath + } + } + + return + } + + if (-not (Test-Path -LiteralPath:$RecordTo -IsValid)) { + $ex = New-Object System.Management.Automation.ItemNotFoundException "Cannot record Microsoft Defender Antivirus performance recording to path '$RecordTo' because the location does not exist." + $category = [System.Management.Automation.ErrorCategory]::InvalidArgument + $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'InvalidPath',$category,$RecordTo + $psCmdlet.WriteError($errRecord) + return + } + + # Resolve any relative paths + $RecordTo = $psCmdlet.SessionState.Path.GetUnresolvedProviderPathFromPSPath($RecordTo) + + # Dependencies: WPR Profile + [string]$wprProfile = "$PSScriptRoot\MSFT_MpPerformanceRecording.wprp" + + if (-not (Test-Path -LiteralPath:$wprProfile -PathType:Leaf)) { + $ex = New-Object System.Management.Automation.ItemNotFoundException "Cannot find dependency file '$wprProfile' because it does not exist." + $category = [System.Management.Automation.ErrorCategory]::ObjectNotFound + $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'PathNotFound',$category,$wprProfile + $psCmdlet.WriteError($errRecord) + return + } + + # Dependencies: WPR Version + try + { + # If user provides a valid string as $WPRPath we go with that. + [string]$wprCommand = $WPRPath + + if (!$wprCommand) { + $wprCommand = "wpr.exe" + $wprs = @(Get-Command -All "wpr" 2> $null) + + if ($wprs -and ($wprs.Length -ne 0)) { + $latestVersion = [System.Version]"0.0.0.0" + + $wprs | ForEach-Object { + $currentVersion = $_.Version + $currentFullPath = $_.Source + $currentVersionString = $currentVersion.ToString() + Write-Host "Found $currentVersionString at $currentFullPath" + + if ($currentVersion -gt $latestVersion) { + $latestVersion = $currentVersion + $wprCommand = $currentFullPath + } + } + } + } + } + catch + { + # Fallback to the old ways in case we encounter an error (ex: version string format change). + [string]$wprCommand = "wpr.exe" + } + finally + { + Write-Host "`nUsing $wprCommand version $((Get-Command $wprCommand).FileVersionInfo.FileVersion)`n" + } + + # + # Test dependency presence + # + if (-not (Get-Command $wprCommand -ErrorAction:SilentlyContinue)) { + $ex = New-Object System.Management.Automation.ItemNotFoundException "Cannot find dependency command '$wprCommand' because it does not exist." + $category = [System.Management.Automation.ErrorCategory]::ObjectNotFound + $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'PathNotFound',$category,$wprCommand + $psCmdlet.WriteError($errRecord) + return + } + + # Exclude versions that have known bugs or are not supported any more. + [int]$wprFileVersion = ((Get-Command $wprCommand).Version.Major) -as [int] + if ($wprFileVersion -le 6) { + $ex = New-Object System.Management.Automation.PSNotSupportedException "You are using an older and unsupported version of '$wprCommand'. Please download and install Windows ADK:`r`nhttps://docs.microsoft.com/en-us/windows-hardware/get-started/adk-install`r`nand try again." + $category = [System.Management.Automation.ErrorCategory]::NotInstalled + $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'NotSupported',$category,$wprCommand + $psCmdlet.WriteError($errRecord) + return + } + + function CancelPerformanceRecording { + Write-Host "`n`nCancelling Microsoft Defender Antivirus performance recording... " -NoNewline + + & $wprCommand -cancel -instancename MSFT_MpPerformanceRecording + $wprCommandExitCode = $LASTEXITCODE + + switch ($wprCommandExitCode) { + 0 {} + 0xc5583000 { + Write-Error "Cannot cancel performance recording because currently Windows Performance Recorder is not recording." + return + } + default { + Write-Error ("Cannot cancel performance recording: 0x{0:x08}." -f $wprCommandExitCode) + return + } + } + + Write-Host "ok.`n`nRecording has been cancelled." + } + + # + # Ensure Ctrl-C doesn't abort the app without cleanup + # + + # - local PowerShell consoles: use [Console]::TreatControlCAsInput; cleanup performed and output preserved + # - PowerShell ISE: use try { ... } catch { throw } finally; cleanup performed and output preserved + # - remote PowerShell: use try { ... } catch { throw } finally; cleanup performed but output truncated + + [bool]$canTreatControlCAsInput = $interactiveMode -and ($Host.Name -eq $powerShellHostConsole) + $savedControlCAsInput = $null + + $shouldCancelRecordingOnTerminatingError = $false + + try + { + if ($canTreatControlCAsInput) { + $savedControlCAsInput = [Console]::TreatControlCAsInput + [Console]::TreatControlCAsInput = $true + } + + # + # Start recording + # + + Write-Host "Starting Microsoft Defender Antivirus performance recording... " -NoNewline + + $shouldCancelRecordingOnTerminatingError = $true + + & $wprCommand -start "$wprProfile!Scans.Light" -filemode -instancename MSFT_MpPerformanceRecording + $wprCommandExitCode = $LASTEXITCODE + + switch ($wprCommandExitCode) { + 0 {} + 0xc5583001 { + $shouldCancelRecordingOnTerminatingError = $false + Write-Error "Cannot start performance recording because Windows Performance Recorder is already recording." + return + } + default { + $shouldCancelRecordingOnTerminatingError = $false + Write-Error ("Cannot start performance recording: 0x{0:x08}." -f $wprCommandExitCode) + return + } + } + + Write-Host "ok.`n`nRecording has started." -NoNewline + + if ($timedMode) { + Write-Host "`n`n Recording for $Seconds seconds... " -NoNewline + + Start-Sleep -Seconds:$Seconds + + Write-Host "ok." -NoNewline + } elseif ($interactiveMode) { + $stopPrompt = "`n`n=> Reproduce the scenario that is impacting the performance on your device.`n`n Press to stop and save recording or to cancel recording" + + if ($canTreatControlCAsInput) { + Write-Host "${stopPrompt}: " + + do { + $key = [Console]::ReadKey($true) + if (($key.Modifiers -eq [ConsoleModifiers]::Control) -and (($key.Key -eq [ConsoleKey]::C))) { + + CancelPerformanceRecording + + $shouldCancelRecordingOnTerminatingError = $false + + # + # Restore Ctrl-C behavior + # + + [Console]::TreatControlCAsInput = $savedControlCAsInput + + return + } + + } while (($key.Modifiers -band ([ConsoleModifiers]::Alt -bor [ConsoleModifiers]::Control -bor [ConsoleModifiers]::Shift)) -or ($key.Key -ne [ConsoleKey]::Enter)) + + } else { + Read-Host -Prompt:$stopPrompt + } + } + + # + # Stop recording + # + + Write-Host "`n`nStopping Microsoft Defender Antivirus performance recording... " + + & $wprCommand -stop $RecordTo -instancename MSFT_MpPerformanceRecording + $wprCommandExitCode = $LASTEXITCODE + + switch ($wprCommandExitCode) { + 0 { + $shouldCancelRecordingOnTerminatingError = $false + } + 0xc5583000 { + $shouldCancelRecordingOnTerminatingError = $false + Write-Error "Cannot stop performance recording because Windows Performance Recorder is not recording a trace." + return + } + default { + Write-Error ("Cannot stop performance recording: 0x{0:x08}." -f $wprCommandExitCode) + return + } + } + + Write-Host "ok.`n`nRecording has been saved to '$RecordTo'." + + Write-Host ` +' +The performance analyzer provides insight into problematic files that could +cause performance degradation of Microsoft Defender Antivirus. This tool is +provided "AS IS", and is not intended to provide suggestions on exclusions. +Exclusions can reduce the level of protection on your endpoints. Exclusions, +if any, should be defined with caution. +' +Write-Host ` +' +The trace you have just captured may contain personally identifiable information, +including but not necessarily limited to paths to files accessed, paths to +registry accessed and process names. Exact information depends on the events that +were logged. Please be aware of this when sharing this trace with other people. +' + } catch { + throw + } finally { + if ($shouldCancelRecordingOnTerminatingError) { + CancelPerformanceRecording + } + + if ($null -ne $savedControlCAsInput) { + # + # Restore Ctrl-C behavior + # + + [Console]::TreatControlCAsInput = $savedControlCAsInput + } + } +} + +function PadUserDateTime +{ + [OutputType([DateTime])] + param( + [Parameter(Mandatory = $true, Position = 0)] + [DateTime]$UserDateTime + ) + + # Padding user input to include all events up to the start of the next second. + if (($UserDateTime.Ticks % 10000000) -eq 0) + { + return $UserDateTime.AddTicks(9999999) + } + else + { + return $UserDateTime + } +} + +function ValidateTimeInterval +{ + [OutputType([PSCustomObject])] + param( + [DateTime]$MinStartTime = [DateTime]::MinValue, + [DateTime]$MinEndTime = [DateTime]::MinValue, + [DateTime]$MaxStartTime = [DateTime]::MaxValue, + [DateTime]$MaxEndTime = [DateTime]::MaxValue + ) + + $ret = [PSCustomObject]@{ + arguments = [string[]]@() + status = $false + } + + if ($MinStartTime -gt $MaxEndTime) + { + $ex = New-Object System.Management.Automation.ValidationMetadataException "MinStartTime '$MinStartTime' should have been lower than MaxEndTime '$MaxEndTime'" + $category = [System.Management.Automation.ErrorCategory]::InvalidArgument + $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'Invalid time interval',$category,"'$MinStartTime' .. '$MaxEndTime'" + $psCmdlet.WriteError($errRecord) + return $ret + } + + if ($MinStartTime -gt $MaxStartTime) + { + $ex = New-Object System.Management.Automation.ValidationMetadataException "MinStartTime '$MinStartTime' should have been lower than MaxStartTime '$MaxStartTime'" + $category = [System.Management.Automation.ErrorCategory]::InvalidArgument + $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'Invalid time interval',$category,"'$MinStartTime' .. '$MaxStartTime'" + $psCmdlet.WriteError($errRecord) + return $ret + } + + if ($MinEndTime -gt $MaxEndTime) + { + $ex = New-Object System.Management.Automation.ValidationMetadataException "MinEndTime '$MinEndTime' should have been lower than MaxEndTime '$MaxEndTime'" + $category = [System.Management.Automation.ErrorCategory]::InvalidArgument + $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'Invalid time interval',$category,"'$MinEndTime' .. '$MaxEndTime'" + $psCmdlet.WriteError($errRecord) + return $ret + } + + if ($MinStartTime -gt [DateTime]::MinValue) + { + try + { + $MinStartFileTime = $MinStartTime.ToFileTime() + } + catch + { + $ex = New-Object System.Management.Automation.ValidationMetadataException "MinStartTime '$MinStartTime' is not a valid timestamp." + $category = [System.Management.Automation.ErrorCategory]::InvalidArgument + $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'Value has to be a local DateTime between "January 1, 1601 12:00:00 AM UTC" and "December 31, 9999 11:59:59 PM UTC"',$category,"'$MinStartTime'" + $psCmdlet.WriteError($errRecord) + return $ret + } + + $ret.arguments += @('-MinStartTime', $MinStartFileTime) + } + + if ($MaxEndTime -lt [DateTime]::MaxValue) + { + try + { + $MaxEndFileTime = $MaxEndTime.ToFileTime() + } + catch + { + $ex = New-Object System.Management.Automation.ValidationMetadataException "MaxEndTime '$MaxEndTime' is not a valid timestamp." + $category = [System.Management.Automation.ErrorCategory]::InvalidArgument + $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'Value has to be a local DateTime between "January 1, 1601 12:00:00 AM UTC" and "December 31, 9999 11:59:59 PM UTC"',$category,"'$MaxEndTime'" + $psCmdlet.WriteError($errRecord) + return $ret + } + + $ret.arguments += @('-MaxEndTime', $MaxEndFileTime) + } + + if ($MaxStartTime -lt [DateTime]::MaxValue) + { + try + { + $MaxStartFileTime = $MaxStartTime.ToFileTime() + } + catch + { + $ex = New-Object System.Management.Automation.ValidationMetadataException "MaxStartTime '$MaxStartTime' is not a valid timestamp." + $category = [System.Management.Automation.ErrorCategory]::InvalidArgument + $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'Value has to be a local DateTime between "January 1, 1601 12:00:00 AM UTC" and "December 31, 9999 11:59:59 PM UTC"',$category,"'$MaxStartTime'" + $psCmdlet.WriteError($errRecord) + return $ret + } + + $ret.arguments += @('-MaxStartTime', $MaxStartFileTime) + } + + if ($MinEndTime -gt [DateTime]::MinValue) + { + try + { + $MinEndFileTime = $MinEndTime.ToFileTime() + } + catch + { + $ex = New-Object System.Management.Automation.ValidationMetadataException "MinEndTime '$MinEndTime' is not a valid timestamp." + $category = [System.Management.Automation.ErrorCategory]::InvalidArgument + $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'Value has to be a local DateTime between "January 1, 1601 12:00:00 AM UTC" and "December 31, 9999 11:59:59 PM UTC"',$category,"'$MinEndTime'" + $psCmdlet.WriteError($errRecord) + return $ret + } + + $ret.arguments += @('-MinEndTime', $MinEndFileTime) + } + + $ret.status = $true + return $ret +} + +function ParseFriendlyDuration +{ + [OutputType([TimeSpan])] + param( + [Parameter(Mandatory = $true, Position = 0)] + [string] + $FriendlyDuration + ) + + if ($FriendlyDuration -match '^(\d+)(?:\.(\d+))?(sec|ms|us)$') + { + [string]$seconds = $Matches[1] + [string]$decimals = $Matches[2] + [string]$unit = $Matches[3] + + [uint32]$magnitude = + switch ($unit) + { + 'sec' {7} + 'ms' {4} + 'us' {1} + } + + if ($decimals.Length -gt $magnitude) + { + throw [System.ArgumentException]::new("String '$FriendlyDuration' was not recognized as a valid Duration: $($decimals.Length) decimals specified for time unit '$unit'; at most $magnitude expected.") + } + + return [timespan]::FromTicks([int64]::Parse($seconds + $decimals.PadRight($magnitude, '0'))) + } + + [timespan]$result = [timespan]::FromTicks(0) + if ([timespan]::TryParse($FriendlyDuration, [ref]$result)) + { + return $result + } + + throw [System.ArgumentException]::new("String '$FriendlyDuration' was not recognized as a valid Duration; expected a value like '0.1234567sec' or '0.1234ms' or '0.1us' or a valid TimeSpan.") +} + +[scriptblock]$FriendlyTimeSpanToString = { '{0:0.0000}ms' -f ($this.Ticks / 10000.0) } + +function New-FriendlyTimeSpan +{ + param( + [Parameter(Mandatory = $true)] + [uint64]$Ticks, + + [bool]$Raw = $false + ) + + if ($Raw) { + return $Ticks + } + + $result = [TimeSpan]::FromTicks($Ticks) + $result.PsTypeNames.Insert(0, 'MpPerformanceReport.TimeSpan') + $result | Add-Member -Force -MemberType:ScriptMethod -Name:'ToString' -Value:$FriendlyTimeSpanToString + $result +} + +function New-FriendlyDateTime +{ + param( + [Parameter(Mandatory = $true)] + [uint64]$FileTime, + + [bool]$Raw = $false + ) + + if ($Raw) { + return $FileTime + } + + [DateTime]::FromFileTime($FileTime) +} + +function Add-DefenderCollectionType +{ + param( + [Parameter(Mandatory = $true)] + [ref]$CollectionRef + ) + + if ($CollectionRef.Value.Length -and ($CollectionRef.Value | Get-Member -Name:'Processes','Files','Extensions','Scans','Folder')) + { + $CollectionRef.Value.PSTypeNames.Insert(0, 'MpPerformanceReport.NestedCollection') + } +} + +[scriptblock]$FriendlyScanInfoToString = { + [PSCustomObject]@{ + ScanType = $this.ScanType + StartTime = $this.StartTime + EndTime = $this.EndTime + Duration = $this.Duration + Reason = $this.Reason + Path = $this.Path + ProcessPath = $this.ProcessPath + ProcessId = $this.ProcessId + Image = $this.Image + } +} + +function Get-ScanComments +{ + param( + [PSCustomObject[]]$SecondaryEvents, + [bool]$Raw = $false + ) + + $Comments = @() + + foreach ($item in @($SecondaryEvents | Sort-Object -Property:StartTime)) { + if (($item | Get-Member -Name:'Message' -MemberType:NoteProperty).Count -eq 1) { + if (($item | Get-Member -Name:'Duration' -MemberType:NoteProperty).Count -eq 1) { + $Duration = New-FriendlyTimeSpan -Ticks:$item.Duration -Raw:$Raw + $StartTime = New-FriendlyDateTime -FileTime:$item.StartTime -Raw:$Raw + + $Comments += "Expensive operation `"{0}`" started at {1} lasted {2}" -f ($item.Message, $StartTime, $Duration.ToString()) + + if (($item | Get-Member -Name:'Debug' -MemberType:NoteProperty).Count -eq 1) { + $item.Debug | ForEach-Object { + if ($_.EndsWith("is NOT trusted") -or $_.StartsWith("Not trusted, ") -or $_.ToLower().Contains("error") -or $_.Contains("Result of ValidateTrust")) { + $Comments += "$_" + } + } + } + } + else { + if ($item.Message.Contains("subtype=Lowfi")) { + $Comments += $item.Message.Replace("subtype=Lowfi", "Low-fidelity detection") + } + else { + $Comments += $item.Message + } + } + } + elseif (($item | Get-Member -Name:'ScanType' -MemberType:NoteProperty).Count -eq 1) { + $Duration = New-FriendlyTimeSpan -Ticks:$item.Duration -Raw:$Raw + $OpId = "Internal opertion" + + if (($item | Get-Member -Name:'Path' -MemberType:NoteProperty).Count -eq 1) { + $OpId = $item.Path + } + elseif (($item | Get-Member -Name:'ProcessPath' -MemberType:NoteProperty).Count -eq 1) { + $OpId = $item.ProcessPath + } + + $Comments += "{0} {1} lasted {2}" -f ($item.ScanType, $OpId, $Duration.ToString()) + } + } + + $Comments +} + +filter ConvertTo-DefenderScanInfo +{ + param( + [bool]$Raw = $false + ) + + $result = [PSCustomObject]@{ + ScanType = [string]$_.ScanType + StartTime = New-FriendlyDateTime -FileTime:$_.StartTime -Raw:$Raw + EndTime = New-FriendlyDateTime -FileTime:$_.EndTime -Raw:$Raw + Duration = New-FriendlyTimeSpan -Ticks:$_.Duration -Raw:$Raw + Reason = [string]$_.Reason + SkipReason = [string]$_.SkipReason + } + + if (($_ | Get-Member -Name:'Path' -MemberType:NoteProperty).Count -eq 1) { + $result | Add-Member -NotePropertyName:'Path' -NotePropertyValue:([string]$_.Path) + } + + if (($_ | Get-Member -Name:'ProcessPath' -MemberType:NoteProperty).Count -eq 1) { + $result | Add-Member -NotePropertyName:'ProcessPath' -NotePropertyValue:([string]$_.ProcessPath) + } + + if (($_ | Get-Member -Name:'Image' -MemberType:NoteProperty).Count -eq 1) { + $result | Add-Member -NotePropertyName:'Image' -NotePropertyValue:([string]$_.Image) + } + elseif ($_.ProcessPath -and (-not $_.ProcessPath.StartsWith("pid"))) { + try { + $result | Add-Member -NotePropertyName:'Image' -NotePropertyValue:([string]([System.IO.FileInfo]$_.ProcessPath).Name) + } catch { + # Silently ignore. + } + } + + $ProcessId = if ($_.ProcessId -gt 0) { [int]$_.ProcessId } elseif ($_.ScannedProcessId -gt 0) { [int]$_.ScannedProcessId } else { $null } + if ($ProcessId) { + $result | Add-Member -NotePropertyName:'ProcessId' -NotePropertyValue:([int]$ProcessId) + } + + if ($result.Image -and $result.ProcessId) { + $ProcessName = "{0} ({1})" -f $result.Image, $result.ProcessId + $result | Add-Member -NotePropertyName:'ProcessName' -NotePropertyValue:([string]$ProcessName) + } + + if ((($_ | Get-Member -Name:'Extra' -MemberType:NoteProperty).Count -eq 1) -and ($_.Extra.Count -gt 0)) { + $Comments = @(Get-ScanComments -SecondaryEvents:$_.Extra -Raw:$Raw) + $result | Add-Member -NotePropertyName:'Comments' -NotePropertyValue:$Comments + } + + if (-not $Raw) { + $result.PSTypeNames.Insert(0, 'MpPerformanceReport.ScanInfo') + } + + $result | Add-Member -Force -MemberType:ScriptMethod -Name:'ToString' -Value:$FriendlyScanInfoToString + $result +} + +filter ConvertTo-DefenderScanOverview +{ + param( + [bool]$Raw = $false + ) + + $vals = [ordered]@{} + + foreach ($entry in $_.PSObject.Properties) { + if ($entry.Value) { + $Key = $entry.Name.Replace("_", " ") + + if ($Key.EndsWith("Time")) { + $vals[$Key] = New-FriendlyDateTime -FileTime:$entry.Value -Raw:$Raw + } + elseif ($Key.EndsWith("Duration")) { + $vals[$Key] = New-FriendlyTimeSpan -Ticks:$entry.Value -Raw:$Raw + } + else { + $vals[$Key] = $entry.Value + } + } + } + + # Remove duplicates + if (($_ | Get-Member -Name:'PerfHints' -MemberType:NoteProperty).Count -eq 1) { + $hints = [ordered]@{} + foreach ($hint in $_.PerfHints) { + $hints[$hint] = $true + } + + $vals["PerfHints"] = @($hints.Keys) + } + + $result = New-Object PSCustomObject -Property:$vals + $result +} + +filter ConvertTo-DefenderScanStats +{ + param( + [bool]$Raw = $false + ) + + $result = [PSCustomObject]@{ + Count = $_.Count + TotalDuration = New-FriendlyTimeSpan -Ticks:$_.TotalDuration -Raw:$Raw + MinDuration = New-FriendlyTimeSpan -Ticks:$_.MinDuration -Raw:$Raw + AverageDuration = New-FriendlyTimeSpan -Ticks:$_.AverageDuration -Raw:$Raw + MaxDuration = New-FriendlyTimeSpan -Ticks:$_.MaxDuration -Raw:$Raw + MedianDuration = New-FriendlyTimeSpan -Ticks:$_.MedianDuration -Raw:$Raw + } + + if (-not $Raw) { + $result.PSTypeNames.Insert(0, 'MpPerformanceReport.ScanStats') + } + + $result +} + +[scriptblock]$FriendlyScannedFilePathStatsToString = { + [PSCustomObject]@{ + Count = $this.Count + TotalDuration = $this.TotalDuration + MinDuration = $this.MinDuration + AverageDuration = $this.AverageDuration + MaxDuration = $this.MaxDuration + MedianDuration = $this.MedianDuration + Path = $this.Path + } +} + +filter ConvertTo-DefenderScannedFilePathStats +{ + param( + [bool]$Raw = $false + ) + + $result = $_ | ConvertTo-DefenderScanStats -Raw:$Raw + + if (-not $Raw) { + $result.PSTypeNames.Insert(0, 'MpPerformanceReport.ScannedFilePathStats') + } + + $result | Add-Member -NotePropertyName:'Path' -NotePropertyValue:($_.Path) + $result | Add-Member -Force -MemberType:ScriptMethod -Name:'ToString' -Value:$FriendlyScannedFilePathStatsToString + + if ($null -ne $_.Scans) + { + $result | Add-Member -NotePropertyName:'Scans' -NotePropertyValue:@( + $_.Scans | ConvertTo-DefenderScanInfo -Raw:$Raw + ) + + if (-not $Raw) { + Add-DefenderCollectionType -CollectionRef:([ref]$result.Scans) + } + } + + if ($null -ne $_.Processes) + { + $result | Add-Member -NotePropertyName:'Processes' -NotePropertyValue:@( + $_.Processes | ConvertTo-DefenderScannedProcessStats -Raw:$Raw + ) + + if (-not $Raw) { + Add-DefenderCollectionType -CollectionRef:([ref]$result.Processes) + } + } + + $result +} + +[scriptblock]$FriendlyScannedPathsStatsToString = { + [PSCustomObject]@{ + Count = $this.Count + TotalDuration = $this.TotalDuration + MinDuration = $this.MinDuration + AverageDuration = $this.AverageDuration + MaxDuration = $this.MaxDuration + MedianDuration = $this.MedianDuration + Path = $this.Path + Folder = $this.Folder + } +} + +filter ConvertTo-DefenderScannedPathsStats +{ + param( + [bool]$Raw = $false + ) + + $result = $_ | ConvertTo-DefenderScanStats -Raw:$Raw + + if (-not $Raw) { + $result.PSTypeNames.Insert(0, 'MpPerformanceReport.ScannedPathStats') + } + + $result | Add-Member -NotePropertyName:'Path' -NotePropertyValue:($_.Path) + + if ($null -ne $_.Folder) + { + $result | Add-Member -NotePropertyName:'Folder' -NotePropertyValue:@( + $_.Folder | ConvertTo-DefenderScannedPathsStats -Raw:$Raw + ) + $result | Add-Member -Force -MemberType:ScriptMethod -Name:'ToString' -Value:$FriendlyScannedPathsStatsToString + + if (-not $Raw) { + Add-DefenderCollectionType -CollectionRef:([ref]$result.Folder) + } + } + + if ($null -ne $_.Files) + { + $result | Add-Member -NotePropertyName:'Files' -NotePropertyValue:@( + $_.Files | ConvertTo-DefenderScannedFilePathStats -Raw:$Raw + ) + + if (-not $Raw) { + Add-DefenderCollectionType -CollectionRef:([ref]$result.Files) + } + } + + if ($null -ne $_.Scans) + { + $result | Add-Member -NotePropertyName:'Scans' -NotePropertyValue:@( + $_.Scans | ConvertTo-DefenderScanInfo -Raw:$Raw + ) + + if (-not $Raw) { + Add-DefenderCollectionType -CollectionRef:([ref]$result.Scans) + } + } + + if ($null -ne $_.Processes) + { + $result | Add-Member -NotePropertyName:'Processes' -NotePropertyValue:@( + $_.Processes | ConvertTo-DefenderScannedProcessStats -Raw:$Raw + ) + + if (-not $Raw) { + Add-DefenderCollectionType -CollectionRef:([ref]$result.Processes) + } + } + + $result +} + +[scriptblock]$FriendlyScannedFileExtensionStatsToString = { + [PSCustomObject]@{ + Count = $this.Count + TotalDuration = $this.TotalDuration + MinDuration = $this.MinDuration + AverageDuration = $this.AverageDuration + MaxDuration = $this.MaxDuration + MedianDuration = $this.MedianDuration + Extension = $this.Extension + } +} + +filter ConvertTo-DefenderScannedFileExtensionStats +{ + param( + [bool]$Raw = $false + ) + + $result = $_ | ConvertTo-DefenderScanStats -Raw:$Raw + + if (-not $Raw) { + $result.PSTypeNames.Insert(0, 'MpPerformanceReport.ScannedFileExtensionStats') + } + + $result | Add-Member -NotePropertyName:'Extension' -NotePropertyValue:($_.Extension) + $result | Add-Member -Force -MemberType:ScriptMethod -Name:'ToString' -Value:$FriendlyScannedFileExtensionStatsToString + + if ($null -ne $_.Scans) + { + $result | Add-Member -NotePropertyName:'Scans' -NotePropertyValue:@( + $_.Scans | ConvertTo-DefenderScanInfo -Raw:$Raw + ) + + if (-not $Raw) { + Add-DefenderCollectionType -CollectionRef:([ref]$result.Scans) + } + } + + if ($null -ne $_.Files) + { + $result | Add-Member -NotePropertyName:'Files' -NotePropertyValue:@( + $_.Files | ConvertTo-DefenderScannedFilePathStats -Raw:$Raw + ) + + if (-not $Raw) { + Add-DefenderCollectionType -CollectionRef:([ref]$result.Files) + } + } + + if ($null -ne $_.Processes) + { + $result | Add-Member -NotePropertyName:'Processes' -NotePropertyValue:@( + $_.Processes | ConvertTo-DefenderScannedProcessStats -Raw:$Raw + ) + + if (-not $Raw) { + Add-DefenderCollectionType -CollectionRef:([ref]$result.Processes) + } + } + + + if ($null -ne $_.Folder) + { + $result | Add-Member -NotePropertyName:'Folder' -NotePropertyValue:@( + $_.Folder | ConvertTo-DefenderScannedPathsStats -Raw:$Raw + ) + + if (-not $Raw) { + Add-DefenderCollectionType -CollectionRef:([ref]$result.Folder) + } + } + + $result +} + +[scriptblock]$FriendlyScannedProcessStatsToString = { + [PSCustomObject]@{ + Count = $this.Count + TotalDuration = $this.TotalDuration + MinDuration = $this.MinDuration + AverageDuration = $this.AverageDuration + MaxDuration = $this.MaxDuration + MedianDuration = $this.MedianDuration + ProcessPath = $this.ProcessPath + } +} + +filter ConvertTo-DefenderScannedProcessStats +{ + param( + [bool]$Raw + ) + + $result = $_ | ConvertTo-DefenderScanStats -Raw:$Raw + + if (-not $Raw) { + $result.PSTypeNames.Insert(0, 'MpPerformanceReport.ScannedProcessStats') + } + + $result | Add-Member -NotePropertyName:'ProcessPath' -NotePropertyValue:($_.Process) + $result | Add-Member -Force -MemberType:ScriptMethod -Name:'ToString' -Value:$FriendlyScannedProcessStatsToString + + if ($null -ne $_.Scans) + { + $result | Add-Member -NotePropertyName:'Scans' -NotePropertyValue:@( + $_.Scans | ConvertTo-DefenderScanInfo -Raw:$Raw + ) + + if (-not $Raw) { + Add-DefenderCollectionType -CollectionRef:([ref]$result.Scans) + } + } + + if ($null -ne $_.Files) + { + $result | Add-Member -NotePropertyName:'Files' -NotePropertyValue:@( + $_.Files | ConvertTo-DefenderScannedFilePathStats -Raw:$Raw + ) + + if (-not $Raw) { + Add-DefenderCollectionType -CollectionRef:([ref]$result.Files) + } + } + + if ($null -ne $_.Extensions) + { + $result | Add-Member -NotePropertyName:'Extensions' -NotePropertyValue:@( + $_.Extensions | ConvertTo-DefenderScannedFileExtensionStats -Raw:$Raw + ) + + if (-not $Raw) { + Add-DefenderCollectionType -CollectionRef:([ref]$result.Extensions) + } + } + + if ($null -ne $_.Folder) + { + $result | Add-Member -NotePropertyName:'Folder' -NotePropertyValue:@( + $_.Folder | ConvertTo-DefenderScannedPathsStats -Raw:$Raw + ) + + if (-not $Raw) { + Add-DefenderCollectionType -CollectionRef:([ref]$result.Folder) + } + } + + $result +} + +<# +.SYNOPSIS +This cmdlet reports the file paths, file extensions, and processes that cause +the highest impact to Microsoft Defender Antivirus scans. + +.DESCRIPTION +This cmdlet analyzes a previously collected Microsoft Defender Antivirus +performance recording and reports the file paths, file extensions and processes +that cause the highest impact to Microsoft Defender Antivirus scans. + +The performance analyzer provides insight into problematic files that could +cause performance degradation of Microsoft Defender Antivirus. This tool is +provided "AS IS", and is not intended to provide suggestions on exclusions. +Exclusions can reduce the level of protection on your endpoints. Exclusions, +if any, should be defined with caution. + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopFiles:10 -TopExtensions:10 -TopProcesses:10 -TopScans:10 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopFiles:10 -TopExtensions:10 -TopProcesses:10 -TopScans:10 -Raw | ConvertTo-Json + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopFiles:10 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopFiles:10 -TopScansPerFile:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopFiles:10 -TopProcessesPerFile:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopFiles:10 -TopProcessesPerFile:3 -TopScansPerProcessPerFile:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopPathsDepth:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopPathsDepth:3 -TopScansPerPath:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopScansPerPath:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopPathsDepth:3 -TopFilesPerPath:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopFilesPerPath:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopPathsDepth:3 -TopFilesPerPath:3 -TopScansPerFilePerPath:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopFilesPerPath:3 -TopScansPerFilePerPath:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopPathsDepth:3 -TopExtensionsPerPath:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopExtensionsPerPath:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopPathsDepth:3 -TopExtensionsPerPath:3 -TopScansPerExtensionPerPath:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopExtensionsPerPath:3 -TopScansPerExtensionPerPath:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopPathsDepth:3 -TopProcessesPerPath:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopProcessesPerPath:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopPathsDepth:3 -TopProcessesPerPath:3 -TopScansPerProcessPerPath:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopPaths:10 -TopProcessesPerPath:3 -TopScansPerProcessPerPath:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 -TopScansPerExtension:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 -TopPathsPerExtension:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 -TopPathsPerExtension:3 -TopPathsDepth:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 -TopPathsPerExtension:3 -TopPathsDepth:3 -TopScansPerPathPerExtension:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 -TopPathsPerExtension:3 -TopScansPerPathPerExtension:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 -TopFilesPerExtension:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 -TopFilesPerExtension:3 -TopScansPerFilePerExtension:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 -TopProcessesPerExtension:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopExtensions:10 -TopProcessesPerExtension:3 -TopScansPerProcessPerExtension:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 -TopScansPerProcess:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 -TopExtensionsPerProcess:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 -TopExtensionsPerProcess:3 -TopScansPerExtensionPerProcess:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 -TopFilesPerProcess:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 -TopFilesPerProcess:3 -TopScansPerFilePerProcess:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 -TopPathsPerProcess:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 -TopPathsPerProcess:3 -TopPathsDepth:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 -TopPathsPerProcess:3 -TopPathsDepth:3 -TopScansPerPathPerProcess:3 + +.EXAMPLE +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopProcesses:10 -TopPathsPerProcess:3 -TopScansPerPathPerProcess:3 + +.EXAMPLE +# Find top 10 scans with longest durations that both start and end between MinStartTime and MaxEndTime: +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MinStartTime:"5/14/2022 7:01:11 AM" -MaxEndTime:"5/14/2022 7:01:41 AM" + +.EXAMPLE +# Find top 10 scans with longest durations between MinEndTime and MaxStartTime, possibly partially overlapping this period +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MinEndTime:"5/14/2022 7:01:11 AM" -MaxStartTime:"5/14/2022 7:01:41 AM" + +.EXAMPLE +# Find top 10 scans with longest durations between MinStartTime and MaxStartTime, possibly partially overlapping this period +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MinStartTime:"5/14/2022 7:01:11 AM" -MaxStartTime:"5/14/2022 7:01:41 AM" + +.EXAMPLE +# Find top 10 scans with longest durations that start at MinStartTime or later: +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MinStartTime:"5/14/2022 7:01:11 AM" + +.EXAMPLE +# Find top 10 scans with longest durations that start before or at MaxStartTime: +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MaxStartTime:"5/14/2022 7:01:11 AM" + +.EXAMPLE +# Find top 10 scans with longest durations that end at MinEndTime or later: +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MinEndTime:"5/14/2022 7:01:11 AM" + +.EXAMPLE +# Find top 10 scans with longest durations that end before or at MaxEndTime: +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MaxEndTime:"5/14/2022 7:01:11 AM" + +.EXAMPLE +# Find top 10 scans with longest durations, impacting the current interval, that did not start or end between MaxStartTime and MinEndTime. +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MaxStartTime:"5/14/2022 7:01:11 AM" -MinEndTime:"5/14/2022 7:01:41 AM" + +.EXAMPLE +# Find top 10 scans with longest durations, impacting the current interval, that started between MinStartTime and MaxStartTime, and ended later than MinEndTime. +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MinStartTime:"5/14/2022 7:00:00 AM" -MaxStartTime:"5/14/2022 7:01:11 AM" -MinEndTime:"5/14/2022 7:01:41 AM" + +.EXAMPLE +# Find top 10 scans with longest durations, impacting the current interval, that started before MaxStartTime, and ended between MinEndTime and MaxEndTime. +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MaxStartTime:"5/14/2022 7:01:11 AM" -MinEndTime:"5/14/2022 7:01:41 AM" -MaxEndTime:"5/14/2022 7:02:00 AM" + +.EXAMPLE +# Find top 10 scans with longest durations, impacting the current interval, that started between MinStartTime and MaxStartTime, and ended between MinEndTime and MaxEndTime. +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MinStartTime:"5/14/2022 7:00:00 AM" -MaxStartTime:"5/14/2022 7:01:11 AM" -MinEndTime:"5/14/2022 7:01:41 AM" -MaxEndTime:"5/14/2022 7:02:00 AM" + +.EXAMPLE +# Find top 10 scans with longest durations that both start and end between MinStartTime and MaxEndTime, using DateTime as raw numbers in FILETIME format, e.g. from -Raw report format: +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MinStartTime:([DateTime]::FromFileTime(132969744714304340)) -MaxEndTime:([DateTime]::FromFileTime(132969745000971033)) + +.EXAMPLE +# Find top 10 scans with longest durations between MinEndTime and MaxStartTime, possibly partially overlapping this period, using DateTime as raw numbers in FILETIME format, e.g. from -Raw report format: +Get-MpPerformanceReport -Path:.\Defender-scans.etl -TopScans:10 -MinEndTime:([DateTime]::FromFileTime(132969744714304340)) -MaxStartTime:([DateTime]::FromFileTime(132969745000971033)) + +.EXAMPLE +# Display a summary or overview of the scans captured in the trace, in addition to the information displayed regularly through other arguments. Output is influenced by time interval arguments MinStartTime and MaxEndTime. +Get-MpPerformanceReport -Path:.\Defender-scans.etl [other arguments] -Overview + +#> + +function Get-MpPerformanceReport { + [CmdletBinding()] + param( + # Specifies the location of Microsoft Defender Antivirus performance recording to analyze. + [Parameter(Mandatory=$true, + Position=0, + ValueFromPipeline=$true, + ValueFromPipelineByPropertyName=$true, + HelpMessage="Location of Microsoft Defender Antivirus performance recording.")] + [ValidateNotNullOrEmpty()] + [string]$Path, + + # Requests a top files report and specifies how many top files to output, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopFiles = 0, + + # Specifies how many top scans to output for each top file, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopScansPerFile = 0, + + # Specifies how many top processes to output for each top file, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopProcessesPerFile = 0, + + # Specifies how many top scans to output for each top process for each top file, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopScansPerProcessPerFile = 0, + + # Requests a top paths report and specifies how many top entries to output, sorted by "Duration". This is called recursively for each directory entry. Scans are grouped hierarchically per folder and sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopPaths = 0, + + # Specifies the maxmimum depth (path-wise) that will be used to grop scans when $TopPaths is used. + [ValidateRange(1,1024)] + [int]$TopPathsDepth = 0, + + # Specifies how many top scans to output for each top path, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopScansPerPath = 0, + + # Specifies how many top files to output for each top path, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopFilesPerPath = 0, + + # Specifies how many top scans to output for each top file for each top path, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopScansPerFilePerPath = 0, + + # Specifies how many top extensions to output for each top path, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopExtensionsPerPath = 0, + + # Specifies how many top scans to output for each top extension for each top path, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopScansPerExtensionPerPath = 0, + + # Specifies how many top processes to output for each top path, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopProcessesPerPath = 0, + + # Specifies how many top scans to output for each top process for each top path, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopScansPerProcessPerPath = 0, + + # Requests a top extensions report and specifies how many top extensions to output, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopExtensions = 0, + + # Specifies how many top scans to output for each top extension, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopScansPerExtension = 0, + + # Specifies how many top paths to output for each top extension, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopPathsPerExtension = 0, + + # Specifies how many top scans to output for each top path for each top extension, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopScansPerPathPerExtension = 0, + + # Specifies how many top files to output for each top extension, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopFilesPerExtension = 0, + + # Specifies how many top scans to output for each top file for each top extension, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopScansPerFilePerExtension = 0, + + # Specifies how many top processes to output for each top extension, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopProcessesPerExtension = 0, + + # Specifies how many top scans to output for each top process for each top extension, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopScansPerProcessPerExtension = 0, + + # Requests a top processes report and specifies how many top processes to output, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopProcesses = 0, + + # Specifies how many top scans to output for each top process in the Top Processes report, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopScansPerProcess = 0, + + # Specifies how many top files to output for each top process, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopFilesPerProcess = 0, + + # Specifies how many top scans to output for each top file for each top process, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopScansPerFilePerProcess = 0, + + # Specifies how many top extensions to output for each top process, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopExtensionsPerProcess = 0, + + # Specifies how many top scans to output for each top extension for each top process, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopScansPerExtensionPerProcess = 0, + + # Specifies how many top paths to output for each top process, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopPathsPerProcess = 0, + + # Specifies how many top scans to output for each top path for each top process, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopScansPerPathPerProcess = 0, + + # Requests a top scans report and specifies how many top scans to output, sorted by "Duration". + [ValidateRange(0,([int]::MaxValue))] + [int]$TopScans = 0, + + ## TimeSpan format: d | h:m | h:m:s | d.h:m | h:m:.f | h:m:s.f | d.h:m:s | d.h:m:.f | d.h:m:s.f => d | (d.)?h:m(:s(.f)?)? | ((d.)?h:m:.f) + + # Specifies the minimum duration of any scans or total scan durations of files, extensions and processes included in the report. + # Accepts values like '0.1234567sec' or '0.1234ms' or '0.1us' or a valid TimeSpan. + [ValidatePattern('^(?:(?:(\d+)(?:\.(\d+))?(sec|ms|us))|(?:\d+)|(?:(\d+\.)?\d+:\d+(?::\d+(?:\.\d+)?)?)|(?:(\d+\.)?\d+:\d+:\.\d+))$')] + [string]$MinDuration = '0us', + + # Specifies the minimum start time of scans included in the report. Accepts a valid DateTime. + [DateTime]$MinStartTime = [DateTime]::MinValue, + + # Specifies the minimum end time of scans included in the report. Accepts a valid DateTime. + [DateTime]$MinEndTime = [DateTime]::MinValue, + + # Specifies the maximum start time of scans included in the report. Accepts a valid DateTime. + [DateTime]$MaxStartTime = [DateTime]::MaxValue, + + # Specifies the maximum end time of scans included in the report. Accepts a valid DateTime. + [DateTime]$MaxEndTime = [DateTime]::MaxValue, + + # Adds an overview or summary of the scans captured in the trace to the regular output. + [switch]$Overview, + + # Specifies that the output should be machine readable and readily convertible to serialization formats like JSON. + # - Collections and elements are not be formatted. + # - TimeSpan values are represented as number of 100-nanosecond intervals. + # - DateTime values are represented as number of 100-nanosecond intervals since January 1, 1601 (UTC). + [switch]$Raw + ) + + # + # Validate performance recording presence + # + + if (-not (Test-Path -Path:$Path -PathType:Leaf)) { + $ex = New-Object System.Management.Automation.ItemNotFoundException "Cannot find path '$Path'." + $category = [System.Management.Automation.ErrorCategory]::ObjectNotFound + $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'PathNotFound',$category,$Path + $psCmdlet.WriteError($errRecord) + return + } + + function ParameterValidationError { + [CmdletBinding()] + param ( + [Parameter(Mandatory)] + [string] + $ParameterName, + + [Parameter(Mandatory)] + [string] + $ParentParameterName + ) + + $ex = New-Object System.Management.Automation.ValidationMetadataException "Parameter '$ParameterName' requires parameter '$ParentParameterName'." + $category = [System.Management.Automation.ErrorCategory]::MetadataError + $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'InvalidParameter',$category,$ParameterName + $psCmdlet.WriteError($errRecord) + } + + # + # Additional parameter validation + # + + if ($TopFiles -eq 0) + { + if ($TopScansPerFile -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerFile' -ParentParameterName:'TopFiles' + } + + if ($TopProcessesPerFile -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopProcessesPerFile' -ParentParameterName:'TopFiles' + } + } + + if ($TopProcessesPerFile -eq 0) + { + if ($TopScansPerProcessPerFile -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerProcessPerFile' -ParentParameterName:'TopProcessesPerFile' + } + } + + if ($TopPathsDepth -gt 0) + { + if (($TopPaths -eq 0) -and ($TopPathsPerProcess -eq 0) -and ($TopPathsPerExtension -eq 0)) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopPathsDepth' -ParentParameterName:'TopPaths or TopPathsPerProcess or TopPathsPerExtension' + } + } + + if ($TopPaths -eq 0) + { + if ($TopScansPerPath -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerPath' -ParentParameterName:'TopPaths' + } + + if ($TopFilesPerPath -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopFilesPerPath' -ParentParameterName:'TopPaths' + } + + if ($TopExtensionsPerPath -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopExtensionsPerPath' -ParentParameterName:'TopPaths' + } + + if ($TopProcessesPerPath -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopProcessesPerPath' -ParentParameterName:'TopPaths' + } + } + + if ($TopFilesPerPath -eq 0) + { + if ($TopScansPerFilePerPath -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerFilePerPath' -ParentParameterName:'TopFilesPerPath' + } + } + + if ($TopExtensionsPerPath -eq 0) + { + if ($TopScansPerExtensionPerPath -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerExtensionPerPath' -ParentParameterName:'TopExtensionsPerPath' + } + } + + if ($TopProcessesPerPath -eq 0) + { + if ($TopScansPerProcessPerPath -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerProcessPerPath' -ParentParameterName:'TopProcessesPerPath' + } + } + + if ($TopExtensions -eq 0) + { + if ($TopScansPerExtension -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerExtension' -ParentParameterName:'TopExtensions' + } + + if ($TopFilesPerExtension -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopFilesPerExtension' -ParentParameterName:'TopExtensions' + } + + if ($TopProcessesPerExtension -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopProcessesPerExtension' -ParentParameterName:'TopExtensions' + } + + if ($TopPathsPerExtension -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopPathsPerExtension' -ParentParameterName:'TopExtensions' + } + } + + if ($TopFilesPerExtension -eq 0) + { + if ($TopScansPerFilePerExtension -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerFilePerExtension' -ParentParameterName:'TopFilesPerExtension' + } + } + + if ($TopProcessesPerExtension -eq 0) + { + if ($TopScansPerProcessPerExtension -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerProcessPerExtension' -ParentParameterName:'TopProcessesPerExtension' + } + } + + if ($TopPathsPerExtension -eq 0) + { + if ($TopScansPerPathPerExtension -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerPathPerExtension' -ParentParameterName:'TopPathsPerExtension' + } + } + + if ($TopProcesses -eq 0) + { + if ($TopScansPerProcess -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerProcess' -ParentParameterName:'TopProcesses' + } + + if ($TopFilesPerProcess -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopFilesPerProcess' -ParentParameterName:'TopProcesses' + } + + if ($TopExtensionsPerProcess -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopExtensionsPerProcess' -ParentParameterName:'TopProcesses' + } + + if ($TopPathsPerProcess -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopPathsPerProcess' -ParentParameterName:'TopProcesses' + } + } + + if ($TopFilesPerProcess -eq 0) + { + if ($TopScansPerFilePerProcess -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerFilePerProcess' -ParentParameterName:'TopFilesPerProcess' + } + } + + if ($TopExtensionsPerProcess -eq 0) + { + if ($TopScansPerExtensionPerProcess -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerExtensionPerProcess' -ParentParameterName:'TopExtensionsPerProcess' + } + } + + if ($TopPathsPerProcess -eq 0) + { + if ($TopScansPerPathPerProcess -gt 0) + { + ParameterValidationError -ErrorAction:Stop -ParameterName:'TopScansPerPathPerProcess' -ParentParameterName:'TopPathsPerProcess' + } + } + + if (($TopFiles -eq 0) -and ($TopExtensions -eq 0) -and ($TopProcesses -eq 0) -and ($TopScans -eq 0) -and ($TopPaths -eq 0) -and (-not $Overview)) { + $ex = New-Object System.Management.Automation.ItemNotFoundException "At least one of the parameters 'TopFiles', 'TopPaths', 'TopExtensions', 'TopProcesses', 'TopScans' or 'Overview' must be present." + $category = [System.Management.Automation.ErrorCategory]::InvalidArgument + $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'InvalidArgument',$category,$wprProfile + $psCmdlet.WriteError($errRecord) + return + } + + # Dependencies + [string]$PlatformPath = (Get-ItemProperty -Path:'HKLM:\Software\Microsoft\Windows Defender' -Name:'InstallLocation' -ErrorAction:Stop).InstallLocation + + # + # Test dependency presence + # + [string]$mpCmdRunCommand = "${PlatformPath}MpCmdRun.exe" + + if (-not (Get-Command $mpCmdRunCommand -ErrorAction:SilentlyContinue)) { + $ex = New-Object System.Management.Automation.ItemNotFoundException "Cannot find '$mpCmdRunCommand'." + $category = [System.Management.Automation.ErrorCategory]::ObjectNotFound + $errRecord = New-Object System.Management.Automation.ErrorRecord $ex,'PathNotFound',$category,$mpCmdRunCommand + $psCmdlet.WriteError($errRecord) + return + } + + # assemble report arguments + + [string[]]$reportArguments = @( + $PSBoundParameters.GetEnumerator() | + Where-Object { $_.Key.ToString().StartsWith("Top") -and ($_.Value -gt 0) } | + ForEach-Object { "-$($_.Key)"; "$($_.Value)"; } + ) + + [timespan]$MinDurationTimeSpan = ParseFriendlyDuration -FriendlyDuration:$MinDuration + + if ($MinDurationTimeSpan -gt [TimeSpan]::FromTicks(0)) + { + $reportArguments += @('-MinDuration', ($MinDurationTimeSpan.Ticks)) + } + + $MaxEndTime = PadUserDateTime -UserDateTime:$MaxEndTime + $MaxStartTime = PadUserDateTime -UserDateTime:$MaxStartTime + + $ret = ValidateTimeInterval -MinStartTime:$MinStartTime -MaxEndTime:$MaxEndTime -MaxStartTime:$MaxStartTime -MinEndTime:$MinEndTime + if ($false -eq $ret.status) + { + return + } + + [string[]]$intervalArguments = $ret.arguments + if (($null -ne $intervalArguments) -and ($intervalArguments.Length -gt 0)) + { + $reportArguments += $intervalArguments + } + + if ($Overview) + { + $reportArguments += "-Overview" + } + + $report = (& $mpCmdRunCommand -PerformanceReport -RecordingPath $Path @reportArguments) | Where-Object { -not [string]::IsNullOrEmpty($_) } | ConvertFrom-Json + + $result = [PSCustomObject]@{} + + if (-not $Raw) { + $result.PSTypeNames.Insert(0, 'MpPerformanceReport.Result') + } + + if ($TopFiles -gt 0) + { + $reportTopFiles = @(if ($null -ne $report.TopFiles) { @($report.TopFiles | ConvertTo-DefenderScannedFilePathStats -Raw:$Raw) } else { @() }) + $result | Add-Member -NotePropertyName:'TopFiles' -NotePropertyValue:$reportTopFiles + + if (-not $Raw) { + Add-DefenderCollectionType -CollectionRef:([ref]$result.TopFiles) + } + } + + if ($TopPaths -gt 0) + { + $reportTopPaths = @(if ($null -ne $report.TopPaths) { @($report.TopPaths | ConvertTo-DefenderScannedPathsStats -Raw:$Raw) } else { @() }) + $result | Add-Member -NotePropertyName:'TopPaths' -NotePropertyValue:$reportTopPaths + + if (-not $Raw) { + Add-DefenderCollectionType -CollectionRef:([ref]$result.TopPaths) + } + } + + if ($TopExtensions -gt 0) + { + $reportTopExtensions = @(if ($null -ne $report.TopExtensions) { @($report.TopExtensions | ConvertTo-DefenderScannedFileExtensionStats -Raw:$Raw) } else { @() }) + $result | Add-Member -NotePropertyName:'TopExtensions' -NotePropertyValue:$reportTopExtensions + + if (-not $Raw) { + Add-DefenderCollectionType -CollectionRef:([ref]$result.TopExtensions) + } + } + + if ($TopProcesses -gt 0) + { + $reportTopProcesses = @(if ($null -ne $report.TopProcesses) { @($report.TopProcesses | ConvertTo-DefenderScannedProcessStats -Raw:$Raw) } else { @() }) + $result | Add-Member -NotePropertyName:'TopProcesses' -NotePropertyValue:$reportTopProcesses + + if (-not $Raw) { + Add-DefenderCollectionType -CollectionRef:([ref]$result.TopProcesses) + } + } + + if ($TopScans -gt 0) + { + $reportTopScans = @(if ($null -ne $report.TopScans) { @($report.TopScans | ConvertTo-DefenderScanInfo -Raw:$Raw) } else { @() }) + $result | Add-Member -NotePropertyName:'TopScans' -NotePropertyValue:$reportTopScans + + if (-not $Raw) { + Add-DefenderCollectionType -CollectionRef:([ref]$result.TopScans) + } + } + + if ($Overview) + { + if ($null -ne $report.Overview) { + $reportOverview = $report.Overview | ConvertTo-DefenderScanOverview -Raw:$Raw + $result | Add-Member -NotePropertyName:'Overview' -NotePropertyValue:$reportOverview + + if (-not $Raw) { + $result.Overview.PSTypeNames.Insert(0, 'MpPerformanceReport.Overview') + } + } + } + + $result +} + +$exportModuleMemberParam = @{ + Function = @( + 'New-MpPerformanceRecording' + 'Get-MpPerformanceReport' + ) +} + +Export-ModuleMember @exportModuleMemberParam + +# SIG # Begin signature block +# MIImGwYJKoZIhvcNAQcCoIImDDCCJggCAQExDzANBglghkgBZQMEAgEFADB5Bgor +# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG +# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCABOtUhuRLDSJsH +# 5LjfiBWymKYbjYNumRKF78V/LI3Gd6CCC1MwggTgMIIDyKADAgECAhMzAAALjqZI +# W414yEj+AAAAAAuOMA0GCSqGSIb3DQEBCwUAMHkxCzAJBgNVBAYTAlVTMRMwEQYD +# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24xIzAhBgNVBAMTGk1pY3Jvc29mdCBXaW5kb3dzIFBD +# QSAyMDEwMB4XDTI0MDgyMjIxMzIwNVoXDTI1MDcwNDIxMzIwNVowcDELMAkGA1UE +# BhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAc +# BgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEaMBgGA1UEAxMRTWljcm9zb2Z0 +# IFdpbmRvd3MwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrxl8EJfzA +# QclDL4nqroqJh8zn/bvwptnZ6a99GFLJ5GuBZxQloIPF+ZM+9D1QnH/xeQsnuh4e +# CtIztigcnWawfvQAgpsgS47ROqxM5IsMhoGdbmahsAO9ld46iG/7RsKvfDvFCyip +# SnaKR/Lz4YJl4diHhpSIAviRMkWBPoAXDZlcwIuGk0AeAuL8mxVYgBPuWUsq+MH5 +# HL6ut/M+uzFpfv3atwbdECzGoXERLeHzqtOnpKLkqq+43TJLLWFnz5arpMs0MbjJ +# o+40U3iarvp3hMIiM5O06++zz+PMoBO67yKqu9AcdQwJZ+jZ640qkYGDZeVJHNC4 +# 55PXywdmGqOtAgMBAAGjggFoMIIBZDAfBgNVHSUEGDAWBgorBgEEAYI3CgMGBggr +# BgEFBQcDAzAdBgNVHQ4EFgQU+rpJaEO0Uj4j7pcTCs301fdFu/gwRQYDVR0RBD4w +# PKQ6MDgxHjAcBgNVBAsTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEWMBQGA1UEBRMN +# MjMwMDI4KzUwMjc5NzAfBgNVHSMEGDAWgBTRT6mKBwjO9CQYmOUA//PWeR03vDBT +# BgNVHR8ETDBKMEigRqBEhkJodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpL2Ny +# bC9wcm9kdWN0cy9NaWNXaW5QQ0FfMjAxMC0wNy0wNi5jcmwwVwYIKwYBBQUHAQEE +# SzBJMEcGCCsGAQUFBzAChjtodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpL2Nl +# cnRzL01pY1dpblBDQV8yMDEwLTA3LTA2LmNydDAMBgNVHRMBAf8EAjAAMA0GCSqG +# SIb3DQEBCwUAA4IBAQBsZbDNo5NyFwckNKY3ZusiPl4vHyU0CzJKbaV1lLdwxU// +# ePCQRH0efL+g1HMnT0+3tYo3S+jcYYjbtVPhLT0V1jSIeYK5Raxwqm1Csb7B+zta +# Qt933J/50c+3IiSeWXrNhi4r9Q7/h6f8Fu+TpG0pG9XGF5LmMSQKL16GZTbdOT5R +# mqK5J/GW9+S20QDo5cMULRzoWvxRgYKbXIyQWQeUjIpXG4FdzLpPepPiybYpLztT +# X8Vpcu62J9k2nG6nth0ExLrX3YdfRIpaP+ALXD7qa7fEAuy8hV1mX5eYVJAVmvTu +# yyK779mXw0pqlIbCjbgRd7e0ohoIVzbEap3THr1RMIIGazCCBFOgAwIBAgIKYQxq +# GQAAAAAABDANBgkqhkiG9w0BAQsFADCBiDELMAkGA1UEBhMCVVMxEzARBgNVBAgT +# Cldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29m +# dCBDb3Jwb3JhdGlvbjEyMDAGA1UEAxMpTWljcm9zb2Z0IFJvb3QgQ2VydGlmaWNh +# dGUgQXV0aG9yaXR5IDIwMTAwHhcNMTAwNzA2MjA0MDIzWhcNMjUwNzA2MjA1MDIz +# WjB5MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMH +# UmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSMwIQYDVQQD +# ExpNaWNyb3NvZnQgV2luZG93cyBQQ0EgMjAxMDCCASIwDQYJKoZIhvcNAQEBBQAD +# ggEPADCCAQoCggEBAMB5uzqx8A+EuK1kKnUWc9C7B/Y+DZ0U5LGfwciUsDh8H9Az +# VfW6I2b1LihIU8cWg7r1Uax+rOAmfw90/FmV3MnGovdScFosHZSrGb+vlX2vZqFv +# m2JubUu8LzVs3qRqY1pf+/MNTWHMCn4x62wK0E2XD/1/OEbmisdzaXZVaZZM5Njw +# NOu6sR/OKX7ET50TFasTG3JYYlZsioGjZHeYRmUpnYMUpUwIoIPXIx/zX99vLM/a +# FtgOcgQo2Gs++BOxfKIXeU9+3DrknXAna7/b/B7HB9jAvguTHijgc23SVOkoTL9r +# XZ//XTMSN5UlYTRqQst8nTq7iFnho0JtOlBbSNECAwEAAaOCAeMwggHfMBAGCSsG +# AQQBgjcVAQQDAgEAMB0GA1UdDgQWBBTRT6mKBwjO9CQYmOUA//PWeR03vDAZBgkr +# BgEEAYI3FAIEDB4KAFMAdQBiAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw +# AwEB/zAfBgNVHSMEGDAWgBTV9lbLj+iiXGJo0T2UkFvXzpoYxDBWBgNVHR8ETzBN +# MEugSaBHhkVodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpL2NybC9wcm9kdWN0 +# cy9NaWNSb29DZXJBdXRfMjAxMC0wNi0yMy5jcmwwWgYIKwYBBQUHAQEETjBMMEoG +# CCsGAQUFBzAChj5odHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpL2NlcnRzL01p +# Y1Jvb0NlckF1dF8yMDEwLTA2LTIzLmNydDCBnQYDVR0gBIGVMIGSMIGPBgkrBgEE +# AYI3LgMwgYEwPQYIKwYBBQUHAgEWMWh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9Q +# S0kvZG9jcy9DUFMvZGVmYXVsdC5odG0wQAYIKwYBBQUHAgIwNB4yIB0ATABlAGcA +# YQBsAF8AUABvAGwAaQBjAHkAXwBTAHQAYQB0AGUAbQBlAG4AdAAuIB0wDQYJKoZI +# hvcNAQELBQADggIBAC5Bpoa1Bm/wgIX6O8oX6cn65DnClHDDZJTD2FamkI7+5Jr0 +# bfVvjlONWqjzrttGbL5/HVRWGzwdccRRFVR+v+6llUIz/Q2QJCTj+dyWyvy4rL/0 +# wjlWuLvtc7MX3X6GUCOLViTKu6YdmocvJ4XnobYKnA0bjPMAYkG6SHSHgv1QyfSH +# KcMDqivfGil56BIkmobt0C7TQIH1B18zBlRdQLX3sWL9TUj3bkFHUhy7G8JXOqiZ +# VpPUxt4mqGB1hrvsYqbwHQRF3z6nhNFbRCNjJTZ3b65b3CLVFCNqQX/QQqbb7yV7 +# BOPSljdiBq/4Gw+Oszmau4n1NQblpFvDjJ43X1PRozf9pE/oGw5rduS4j7DC6v11 +# 9yxBt5yj4R4F/peSy39ZA22oTo1OgBfU1XL2VuRIn6MjugagwI7RiE+TIPJwX9hr +# cqMgSfx3DF3Fx+ECDzhCEA7bAq6aNx1QgCkepKfZxpolVf1Ayq1kEOgx+RJUeRry +# DtjWqx4z/gLnJm1hSY/xJcKLdJnf+ZMakBzu3ZQzDkJQ239Q+J9iguymghZ8Zrzs +# mbDBWF2osJphFJHRmS9J5D6Bmdbm78rj/T7u7AmGAwcNGw186/RayZXPhxIKXezF +# ApLNBZlyyn3xKhAYOOQxoyi05kzFUqOcasd9wHEJBA1w3gI/h+5WoezrtUyFMYIa +# HjCCGhoCAQEwgZAweTELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24x +# EDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlv +# bjEjMCEGA1UEAxMaTWljcm9zb2Z0IFdpbmRvd3MgUENBIDIwMTACEzMAAAuOpkhb +# jXjISP4AAAAAC44wDQYJYIZIAWUDBAIBBQCgga4wGQYJKoZIhvcNAQkDMQwGCisG +# AQQBgjcCAQQwHAYKKwYBBAGCNwIBCzEOMAwGCisGAQQBgjcCARUwLwYJKoZIhvcN +# AQkEMSIEIP1nRydeaI+1iJEMHgjg/lvzEqkxTM+0Vgz1fU+wYXo6MEIGCisGAQQB +# gjcCAQwxNDAyoBSAEgBNAGkAYwByAG8AcwBvAGYAdKEagBhodHRwOi8vd3d3Lm1p +# Y3Jvc29mdC5jb20wDQYJKoZIhvcNAQEBBQAEggEAjI2LGBewNO0HMxBBEI15+iRe +# 1sx0dcBDsG00mCnkzIfWSUnKIigCoDdpTUTJBNo+lFpX/H6KXGPrJDRr+o7R67Lp +# FgtyI7SjU4vlSKNMiPkxzOXNP/6IJn2g74I6frSqmuN5cLUrp2UetAt7vop/Dqtz +# KGYDSQAU7uqXovUB0sg+55eo/vJ6UY7G18Cv5E9iGqdFifdJYE2oAJ7flEQdGvID +# 51Qezm83NfZZ+oif4xmn1LuH89vIc41zXVKnb8iG3zHYxMiq4WojI8mJOarGz3Sh +# tYRnLYa1mvm1bwuMLRscrnHvfJN81r2fTYFGoUzoGhof4tPl/cQu4kPa8hoXGqGC +# F60wghepBgorBgEEAYI3AwMBMYIXmTCCF5UGCSqGSIb3DQEHAqCCF4YwgheCAgED +# MQ8wDQYJYIZIAWUDBAIBBQAwggFaBgsqhkiG9w0BCRABBKCCAUkEggFFMIIBQQIB +# AQYKKwYBBAGEWQoDATAxMA0GCWCGSAFlAwQCAQUABCB7XA5tbZ0vYXbRJzULHHo8 +# Gt97peckynvmCFR00V8PWwIGZ7+2XoQYGBMyMDI1MDMxMjA1MDQwMS44MzNaMASA +# AgH0oIHZpIHWMIHTMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQ +# MA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9u +# MS0wKwYDVQQLEyRNaWNyb3NvZnQgSXJlbGFuZCBPcGVyYXRpb25zIExpbWl0ZWQx +# JzAlBgNVBAsTHm5TaGllbGQgVFNTIEVTTjo1NTFBLTA1RTAtRDk0NzElMCMGA1UE +# AxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZaCCEfswggcoMIIFEKADAgEC +# AhMzAAACAdFFWZgQzEJPAAEAAAIBMA0GCSqGSIb3DQEBCwUAMHwxCzAJBgNVBAYT +# AlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYD +# VQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBU +# aW1lLVN0YW1wIFBDQSAyMDEwMB4XDTI0MDcyNTE4MzEyMloXDTI1MTAyMjE4MzEy +# MlowgdMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQH +# EwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xLTArBgNV +# BAsTJE1pY3Jvc29mdCBJcmVsYW5kIE9wZXJhdGlvbnMgTGltaXRlZDEnMCUGA1UE +# CxMeblNoaWVsZCBUU1MgRVNOOjU1MUEtMDVFMC1EOTQ3MSUwIwYDVQQDExxNaWNy +# b3NvZnQgVGltZS1TdGFtcCBTZXJ2aWNlMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A +# MIICCgKCAgEAtWrf+HzDu7sk50y5YHheCIJG0uxRSFFcHNek+Td9ZmyJj20EEjaU +# 8JDJu5pWc4pPAsBI38NEAJ1b+KBnlStqU8uvXF4qnEShDdi8nPsZZQsTZDKWAgUM +# 2iZTOiWIuZcFs5ZC8/+GlrVLM5h1Y9nfMh5B4DnUQOXMremAT9MkvUhg3uaYgmqL +# lmYyODmba4lXZBu104SLAFsXOfl/TLhpToT46y7lI9sbI9uq3/Aerh3aPi2knHvE +# EazilXeooXNLCwdu+Is6o8kQLouUn3KwUQm0b7aUtsv1X/OgPmsOJi6yN3LYWyHI +# SvrNuIrJ4iYNgHdBBumQYK8LjZmQaTKFacxhmXJ0q2gzaIfxF2yIwM+V9sQqkHkg +# /Q+iSDNpMr6mr/OwknOEIjI0g6ZMOymivpChzDNoPz9hkK3gVHZKW7NV8+UBXN4G +# 0aBX69fKUbxBBLyk2cC+PhOoUjkl6UC8/c0huqj5xX8m+YVIk81e7t6I+V/E4yXR +# eeZgr0FhYqNpvTjGcaO2WrkP5XmsYS7IvMPIf4DCyIJUZaqoBMToAJJHGRe+DPqC +# Hg6bmGPm97MrOWv16/Co6S9cQDkXp9vMSSRQWXy4KtJhZfmuDz2vr1jw4NeixwuI +# DGw1mtV/TdSI+vpLJfUiLl/b9w/tJB92BALQT8e1YH8NphdOo1xCwkcCAwEAAaOC +# AUkwggFFMB0GA1UdDgQWBBSwcq9blqLoPPiVrym9mFmFWbyyUjAfBgNVHSMEGDAW +# gBSfpxVdAF5iXYP05dJlpxtTNRnpcjBfBgNVHR8EWDBWMFSgUqBQhk5odHRwOi8v +# d3d3Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2NybC9NaWNyb3NvZnQlMjBUaW1lLVN0 +# YW1wJTIwUENBJTIwMjAxMCgxKS5jcmwwbAYIKwYBBQUHAQEEYDBeMFwGCCsGAQUF +# BzAChlBodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpb3BzL2NlcnRzL01pY3Jv +# c29mdCUyMFRpbWUtU3RhbXAlMjBQQ0ElMjAyMDEwKDEpLmNydDAMBgNVHRMBAf8E +# AjAAMBYGA1UdJQEB/wQMMAoGCCsGAQUFBwMIMA4GA1UdDwEB/wQEAwIHgDANBgkq +# hkiG9w0BAQsFAAOCAgEAOjQAyz0cVztTFGqXX5JLRxFK/O/oMe55uDqEC8Vd1gbc +# M28KBUPgvUIPXm/vdDN2IVBkWHmwCp4AIcy4dZtkuUmd0fnu6aT9Mvo1ndsLp2YJ +# cMoFLEt3TtriLaO+i4Grv0ZULtWXUPAW/Mn5Scjgn0xZduGPBD/Xs3J7+get9+8Z +# vBipsg/N7poimYOVsHxLcem7V5XdMNsytTm/uComhM/wgR5KlDYTVNAXBxcSKMeJ +# aiD3V1+HhNkVliMl5VOP+nw5xWF55u9h6eF2G7eBPqT+qSFQ+rQCQdIrN0yG1QN9 +# PJroguK+FJQJdQzdfD3RWVsciBygbYaZlT1cGJI1IyQ74DQ0UBdTpfeGsyrEQ9PI +# 8QyqVLqb2q7LtI6DJMNphYu+jr//0spr1UVvyDPtuRnbGQRNi1COwJcj9OYmlkFg +# KNeCfbDT7U3uEOvWomekX60Y/m5utRcUPVeAPdhkB+DxDaev3J1ywDNdyu911nAV +# PgRkyKgMK3USLG37EdlatDk8FyuCrx4tiHyqHO3wE6xPw32Q8e/vmuQPoBZuX3qU +# eoFIsyZEenHq2ScMunhcqW32SUVAi5oZ4Z3nf7dAgNau21NEPwgW+2wkrNqDg7Hp +# 8yHyoOKbgEBu6REQbvSfZ5Kh4PV+S2gxf2uq6GoYDnlqABOMYwz309ISi0bPMh8w +# ggdxMIIFWaADAgECAhMzAAAAFcXna54Cm0mZAAAAAAAVMA0GCSqGSIb3DQEBCwUA +# MIGIMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMH +# UmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTIwMAYDVQQD +# EylNaWNyb3NvZnQgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgMjAxMDAeFw0y +# MTA5MzAxODIyMjVaFw0zMDA5MzAxODMyMjVaMHwxCzAJBgNVBAYTAlVTMRMwEQYD +# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1w +# IFBDQSAyMDEwMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA5OGmTOe0 +# ciELeaLL1yR5vQ7VgtP97pwHB9KpbE51yMo1V/YBf2xK4OK9uT4XYDP/XE/HZveV +# U3Fa4n5KWv64NmeFRiMMtY0Tz3cywBAY6GB9alKDRLemjkZrBxTzxXb1hlDcwUTI +# cVxRMTegCjhuje3XD9gmU3w5YQJ6xKr9cmmvHaus9ja+NSZk2pg7uhp7M62AW36M +# EBydUv626GIl3GoPz130/o5Tz9bshVZN7928jaTjkY+yOSxRnOlwaQ3KNi1wjjHI +# NSi947SHJMPgyY9+tVSP3PoFVZhtaDuaRr3tpK56KTesy+uDRedGbsoy1cCGMFxP +# LOJiss254o2I5JasAUq7vnGpF1tnYN74kpEeHT39IM9zfUGaRnXNxF803RKJ1v2l +# IH1+/NmeRd+2ci/bfV+AutuqfjbsNkz2K26oElHovwUDo9Fzpk03dJQcNIIP8BDy +# t0cY7afomXw/TNuvXsLz1dhzPUNOwTM5TI4CvEJoLhDqhFFG4tG9ahhaYQFzymei +# XtcodgLiMxhy16cg8ML6EgrXY28MyTZki1ugpoMhXV8wdJGUlNi5UPkLiWHzNgY1 +# GIRH29wb0f2y1BzFa/ZcUlFdEtsluq9QBXpsxREdcu+N+VLEhReTwDwV2xo3xwgV +# GD94q0W29R6HXtqPnhZyacaue7e3PmriLq0CAwEAAaOCAd0wggHZMBIGCSsGAQQB +# gjcVAQQFAgMBAAEwIwYJKwYBBAGCNxUCBBYEFCqnUv5kxJq+gpE8RjUpzxD/LwTu +# MB0GA1UdDgQWBBSfpxVdAF5iXYP05dJlpxtTNRnpcjBcBgNVHSAEVTBTMFEGDCsG +# AQQBgjdMg30BATBBMD8GCCsGAQUFBwIBFjNodHRwOi8vd3d3Lm1pY3Jvc29mdC5j +# b20vcGtpb3BzL0RvY3MvUmVwb3NpdG9yeS5odG0wEwYDVR0lBAwwCgYIKwYBBQUH +# AwgwGQYJKwYBBAGCNxQCBAweCgBTAHUAYgBDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud +# EwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAU1fZWy4/oolxiaNE9lJBb186aGMQwVgYD +# VR0fBE8wTTBLoEmgR4ZFaHR0cDovL2NybC5taWNyb3NvZnQuY29tL3BraS9jcmwv +# cHJvZHVjdHMvTWljUm9vQ2VyQXV0XzIwMTAtMDYtMjMuY3JsMFoGCCsGAQUFBwEB +# BE4wTDBKBggrBgEFBQcwAoY+aHR0cDovL3d3dy5taWNyb3NvZnQuY29tL3BraS9j +# ZXJ0cy9NaWNSb29DZXJBdXRfMjAxMC0wNi0yMy5jcnQwDQYJKoZIhvcNAQELBQAD +# ggIBAJ1VffwqreEsH2cBMSRb4Z5yS/ypb+pcFLY+TkdkeLEGk5c9MTO1OdfCcTY/ +# 2mRsfNB1OW27DzHkwo/7bNGhlBgi7ulmZzpTTd2YurYeeNg2LpypglYAA7AFvono +# aeC6Ce5732pvvinLbtg/SHUB2RjebYIM9W0jVOR4U3UkV7ndn/OOPcbzaN9l9qRW +# qveVtihVJ9AkvUCgvxm2EhIRXT0n4ECWOKz3+SmJw7wXsFSFQrP8DJ6LGYnn8Atq +# gcKBGUIZUnWKNsIdw2FzLixre24/LAl4FOmRsqlb30mjdAy87JGA0j3mSj5mO0+7 +# hvoyGtmW9I/2kQH2zsZ0/fZMcm8Qq3UwxTSwethQ/gpY3UA8x1RtnWN0SCyxTkct +# wRQEcb9k+SS+c23Kjgm9swFXSVRk2XPXfx5bRAGOWhmRaw2fpCjcZxkoJLo4S5pu +# +yFUa2pFEUep8beuyOiJXk+d0tBMdrVXVAmxaQFEfnyhYWxz/gq77EFmPWn9y8FB +# SX5+k77L+DvktxW/tM4+pTFRhLy/AsGConsXHRWJjXD+57XQKBqJC4822rpM+Zv/ +# Cuk0+CQ1ZyvgDbjmjJnW4SLq8CdCPSWU5nR0W2rRnj7tfqAxM328y+l7vzhwRNGQ +# 8cirOoo6CGJ/2XBjU02N7oJtpQUQwXEGahC0HVUzWLOhcGbyoYIDVjCCAj4CAQEw +# ggEBoYHZpIHWMIHTMQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQ +# MA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9u +# MS0wKwYDVQQLEyRNaWNyb3NvZnQgSXJlbGFuZCBPcGVyYXRpb25zIExpbWl0ZWQx +# JzAlBgNVBAsTHm5TaGllbGQgVFNTIEVTTjo1NTFBLTA1RTAtRDk0NzElMCMGA1UE +# AxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZaIjCgEBMAcGBSsOAwIaAxUA +# 1+26cR/yH100DiNFGWhuAv2rYBqggYMwgYCkfjB8MQswCQYDVQQGEwJVUzETMBEG +# A1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWlj +# cm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNyb3NvZnQgVGltZS1TdGFt +# cCBQQ0EgMjAxMDANBgkqhkiG9w0BAQsFAAIFAOt7V08wIhgPMjAyNTAzMTIwMDQz +# NTlaGA8yMDI1MDMxMzAwNDM1OVowdDA6BgorBgEEAYRZCgQBMSwwKjAKAgUA63tX +# TwIBADAHAgEAAgIkzjAHAgEAAgISezAKAgUA63yozwIBADA2BgorBgEEAYRZCgQC +# MSgwJjAMBgorBgEEAYRZCgMCoAowCAIBAAIDB6EgoQowCAIBAAIDAYagMA0GCSqG +# SIb3DQEBCwUAA4IBAQBgYY3roZdzNuxHIWXhLL+Gsirar0FWd87BAyGArtGKIp3c +# 2LUitjXEvZHJVaLdW0uWyhQF/X602dhGXVewjB6atjnw7xUU+2Q7EGCwKKDmeBHV +# CleToP5mbepnzOiwNwDLk3IXDLcY5BovU0uC3rsxNqqEP38TpHaC7F7iuIEPWgvw +# spqUj4pNzZl+lQNDZs2VWvPJWliJkEEM0q1yL3aGFbvjVntStN/b5xB3Sc7+FTIk +# FYjogUmwaX99WffaQOEedFy6Ab0GxHnx34fQh2rmQ9FCdXUpVQgxt/eYFTWDBeaz +# Mu4Ui1mkwDcRpu3oD9sfaML30OVnMxVwl1CJylDDMYIEDTCCBAkCAQEwgZMwfDEL +# MAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1v +# bmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEmMCQGA1UEAxMdTWlj +# cm9zb2Z0IFRpbWUtU3RhbXAgUENBIDIwMTACEzMAAAIB0UVZmBDMQk8AAQAAAgEw +# DQYJYIZIAWUDBAIBBQCgggFKMBoGCSqGSIb3DQEJAzENBgsqhkiG9w0BCRABBDAv +# BgkqhkiG9w0BCQQxIgQgcZh6+rjlPCra7Qi5xf+gF2cXhKH6zCiIlI46hjmrzFow +# gfoGCyqGSIb3DQEJEAIvMYHqMIHnMIHkMIG9BCBYa7I6TJQRcmx0HaSTWZdJgowd +# rl9+Zrr0pIdqHtc4IzCBmDCBgKR+MHwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpX +# YXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQg +# Q29ycG9yYXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQSAy +# MDEwAhMzAAACAdFFWZgQzEJPAAEAAAIBMCIEIPlERA11JlrxgZHhLSdtu1j7TQ02 +# veZ+JH4gXwxwpT8gMA0GCSqGSIb3DQEBCwUABIICAH95iFbRUn2vbIas/MdpGFkV +# tQ8vY+ii/JZEP/5Ivs7s8pAUDTY+40HUEVJHudLyOCfI/H3hpQASrjdA8xzHyqgU +# sX+bMPvSqKUMm0L98NPSYyPR3kVnuZMH2PklqdmCzd9SzaeK3/o+qPgekp9yR3jR +# crZVknbJCi+Vz8DhqePMYhLpaG/t/8u+Tj8+O5rx4t2igXD1IMEZZ25NHYgkCsJM +# wdxnvMlGE9h968q4nIksyZ8V1CSCEK7Xf/cUSajZL0/MyHxw1DVVMyyLs9bAngDW +# LR2RmYI5smZWKPU4D9unCkpgVus0ZcyjCRYkttTHzcoEQWTtjAMymXAfl+2ZcHHi +# APyH+w1FrpilgDHVnXyNNeenr7A4+ytQFQ6c0/DU9Kv7KJ/X1tN0Q+HwnzW8XAW8 +# bxYcoBZ4x65urKbZioEmSp21FsRCFEqL+CBpo79jSq1LOLbY0gl32Xml/D/Ix+Pp +# zEM68KigMDMI5XpRSAaIXkOJ6x1Xk8oiKsXap9z9qZrx6djO1SpBevVjAu2N+osC +# JQm2wCk4ZtefzMQsNSK1FfeeSbeO8UG6dEcNnv96LcE52+O7/lNV+XTfDhlS2m9/ +# gglLNXlhZZzxmXhmr/Bf/Q5V9gEnqRx/RBIEYDQCM9HK8IwM8Vol+xp+nmr+STm6 +# Vd3F7h/aQ3aBi10l1ARJ +# SIG # End signature block diff --git a/newton-cn/bin/v1.0/Modules/ConfigDefenderPerformance/MSFT_MpPerformanceRecording.wprp b/newton-cn/bin/v1.0/Modules/ConfigDefenderPerformance/MSFT_MpPerformanceRecording.wprp new file mode 100644 index 0000000..244520b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ConfigDefenderPerformance/MSFT_MpPerformanceRecording.wprp @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/ConfigDefenderPerformance/MSFT_MpPerformanceReport.Format.ps1xml b/newton-cn/bin/v1.0/Modules/ConfigDefenderPerformance/MSFT_MpPerformanceReport.Format.ps1xml new file mode 100644 index 0000000..ffc1222 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ConfigDefenderPerformance/MSFT_MpPerformanceReport.Format.ps1xml @@ -0,0 +1,1773 @@ + + + + + default + + MpPerformanceReport.Result + Deserialized.MpPerformanceReport.Result + + + + + + + Overview + + ($_ | gm -Name:'Overview' -MemberType:NoteProperty).Count -gt 0 + + + + + + + Overview + + ======== + + + + + + + + + ($_ | fl | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + + + + + + + TopFiles + + ($_ | gm -Name:'TopFiles' -MemberType:NoteProperty).Count -gt 0 + + + + + + + TopFiles + + ======== + + + + + + + + MpPerformanceReport.NestedCollection + Deserialized.MpPerformanceReport.NestedCollection + + + + ($_ | fc | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + + + + + + + TopExtensions + + ($_ | gm -Name:'TopExtensions' -MemberType:NoteProperty).Count -gt 0 + + + + + + + TopExtensions + + ============= + + + + + + + + MpPerformanceReport.NestedCollection + Deserialized.MpPerformanceReport.NestedCollection + + + + ($_ | fc | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + + + + + + + TopProcesses + + ($_ | gm -Name:'TopProcesses' -MemberType:NoteProperty).Count -gt 0 + + + + + + + TopProcesses + + ============ + + + + + + + + MpPerformanceReport.NestedCollection + Deserialized.MpPerformanceReport.NestedCollection + + + + ($_ | fc | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + + + + + + + TopPaths + + ($_ | gm -Name:'TopPaths' -MemberType:NoteProperty).Count -gt 0 + + + + + + + TopPaths + + ======== + + + + + + + + MpPerformanceReport.NestedCollection + Deserialized.MpPerformanceReport.NestedCollection + + + + ($_ | fc | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + + + + + + + Folder + + ($_ | gm -Name:'Folder' -MemberType:NoteProperty).Count -gt 0 + + + + + + + Folder + + ====== + + + + + + + + MpPerformanceReport.NestedCollection + Deserialized.MpPerformanceReport.NestedCollection + + + + ($_ | fc | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + + + + + + + TopScans + + ($_ | gm -Name:'TopScans' -MemberType:NoteProperty).Count -gt 0 + + + + + + + TopScans + + ======== + + + + + + + + + ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + + + + + + + + + + + + + default + + MpPerformanceReport.Result + Deserialized.MpPerformanceReport.Result + + + + + + + + + $null -ne $_.Overview + + ($_.Overview | fl | Out-String).TrimStart() + + + + + $null -ne $_.TopFiles + + ($_.TopFiles | fl | Out-String).TrimStart() + + + + + $null -ne $_.TopExtensions + + ($_.TopExtensions | fl | Out-String).TrimStart() + + + + + $null -ne $_.TopPaths + + ($_.TopPaths | fl | Out-String).TrimStart() + + + + + $null -ne $_.TopProcesses + + ($_.TopProcesses | fl | Out-String).TrimStart() + + + + + $null -ne $_.TopScans + + ($_.TopScans | fl | Out-String).TrimStart() + + + + + + + + + default + + MpPerformanceReport.Result + Deserialized.MpPerformanceReport.Result + + + + + + + ForEach($sectionName in @('TopFiles', 'TopExtensions', 'TopProcesses', 'TopScans', 'TopPaths')) { + if ($null -ne $_.$sectionName) { + $sectionName + } + } + + + + + + + + + default + + MpPerformanceReport.Result + Deserialized.MpPerformanceReport.Result + + + + + + + + + 13 + + + + + + + + + + + + + + + + + + + + ($_.Overview | fl | Out-String).TrimStart() + + + ($_.TopExtensions | fw -Column:1 | Out-String).TrimStart() + + + ($_.TopProcesses | fw -Column:1 | Out-String).TrimStart() + + + ($_.TopFiles | fw -Column:1 | Out-String).TrimStart() + + + ($_.TopScans | fw -Column:1 | Out-String).TrimStart() + + + ($_.TopPaths | fw -Column:1 | Out-String).TrimStart() + + + + + + + + + default + + MpPerformanceReport.ScannedFilePathStats + Deserialized.MpPerformanceReport.ScannedFilePathStats + MpPerformanceReport.ScannedFileExtensionStats + Deserialized.MpPerformanceReport.ScannedFileExtensionStats + MpPerformanceReport.ScannedPathStats + Deserialized.MpPerformanceReport.ScannedPathStats + MpPerformanceReport.ScannedProcessStats + Deserialized.MpPerformanceReport.ScannedProcessStats + + + + + + + ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) + + + + + 4 + + + Files + + ($_ | gm -Name:'Files' -MemberType:NoteProperty).Count -eq 1 + + + + + + Files: + + + + + + + + MpPerformanceReport.NestedCollection + Deserialized.MpPerformanceReport.NestedCollection + + + + + + + + + + ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) + + + + + 4 + + + Scans + + ($_ | gm -Name:'Scans' -MemberType:NoteProperty).Count -eq 1 + + + + + + Scans: + + + + + $properties = 'ScanType',@{Name='Duration'; Expression={$_.Duration}; Alignment='Right'},'Reason','SkipReason' + + if (($_ | gm -Name:'ProcessName' -MemberType:NoteProperty).Count -eq 1) { + $properties += 'ProcessName' + } + + if (($_ | gm -Name:'ProcessPath' -MemberType:NoteProperty).Count -eq 1) { + $properties += 'ProcessPath' + } + + ($_ | ft -Property:$properties | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + + + + + + + + + + + + + + ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + + + + + + + Extensions + + ($_ | gm -Name:'Extensions' -MemberType:NoteProperty).Count -eq 1 + + + + + + Extensions: + + + + + + + + MpPerformanceReport.NestedCollection + Deserialized.MpPerformanceReport.NestedCollection + + + + + + + + + + ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) + + + + + 4 + + + Scans + + ($_ | gm -Name:'Scans' -MemberType:NoteProperty).Count -eq 1 + + + + + + Scans: + + + + + $properties = 'ScanType',@{Name='Duration'; Expression={$_.Duration}; Alignment='Right'},'Reason','SkipReason','ProcessName','Path' + ($_ | ft -Property:$properties | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + + + + + + + + + + + + + + ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + + + + + + + Folder + + ($_ | gm -Name:'Folder' -MemberType:NoteProperty).Count -eq 1 + + + + + + Folder: + + + + + + + + MpPerformanceReport.NestedCollection + Deserialized.MpPerformanceReport.NestedCollection + + + + + + + + + + ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) + + + + + 4 + + + Scans + + ($_ | gm -Name:'Scans' -MemberType:NoteProperty).Count -eq 1 + + + + + + Scans: + + + + + $properties = 'ScanType',@{Name='Duration'; Expression={$_.Duration}; Alignment='Right'},'Reason','SkipReason','ProcessName','Path' + ($_ | ft -Property:$properties | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + + + + + 4 + + + Folder + + ($_ | gm -Name:'Folder' -MemberType:NoteProperty).Count -eq 1 + + + + + + Folder: + + + + + ($_ | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + + + + + + + + + + + + + + ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + + + + + + + Processes + + ($_ | gm -Name:'Processes' -MemberType:NoteProperty).Count -eq 1 + + + + + + Processes: + + + + + + + + MpPerformanceReport.NestedCollection + Deserialized.MpPerformanceReport.NestedCollection + + + + + + + + + + ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) + + + + + 4 + + + Scans + + ($_ | gm -Name:'Scans' -MemberType:NoteProperty).Count -eq 1 + + + + + + Scans: + + + + + $properties = 'ScanType',@{Name='Duration'; Expression={$_.Duration}; Alignment='Right'},'Reason','SkipReason','ProcessName','Path' + ($_ | ft -Property:$properties | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + + + + + + + + + + + + + + ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + + + + + + + Scans + + ($_ | gm -Name:'Scans' -MemberType:NoteProperty).Count -eq 1 + + + + + + Scans: + + + + + $properties = 'ScanType',@{Name='Duration'; Expression={$_.Duration}; Alignment='Right'},'Reason','SkipReason' + + if (($_ | gm -Name:'Comments' -MemberType:NoteProperty).Count -eq 1) { + $properties += @{Name='Comments'; Expression={$_.Comments.Count}; Alignment='Right'} + } + + if (($_ | gm -Name:'ProcessName' -MemberType:NoteProperty).Count -eq 1) { + $properties += 'ProcessName' + } + + if (($_ | gm -Name:'Path' -MemberType:NoteProperty).Count -eq 1) { + $properties += 'Path' + } + + ($_ | ft -Property:$properties | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + + + + + + + + + + + default + + MpPerformanceReport.ScanStats + Deserialized.MpPerformanceReport.ScanStats + + + + + + + + $null -ne $_.ProcessPath + + ProcessPath + + + + $null -ne $_.Path + + Path + + + + $null -ne $_.Extension + + Extension + + + Count + + + TotalDuration + + + MinDuration + + + AverageDuration + + + MaxDuration + + + MedianDuration + + + + + $null -ne $_.Extensions + + ($_.Extensions | fl | Out-String).Trim() + + + + + $null -ne $_.Files + + ($_.Files | fl | Out-String).Trim() + + + + + $null -ne $_.Processes + + ($_.Processes | fl | Out-String).Trim() + + + + + $null -ne $_.Scans + + ($_.Scans | fl | Out-String).Trim() + + + + + + + + + default + + MpPerformanceReport.ScannedFilePathStats + Deserialized.MpPerformanceReport.ScannedFilePathStats + + + + + Right + + + Right + + + Right + + + Right + + + Right + + + Right + + + + + + + + + Count + + + TotalDuration + + + MinDuration + + + AverageDuration + + + MaxDuration + + + MedianDuration + + + Path + + + + + + + + + default + + MpPerformanceReport.ScannedFileExtensionStats + Deserialized.MpPerformanceReport.ScannedFileExtensionStats + + + + + Right + + + Right + + + Right + + + Right + + + Right + + + Right + + + + + + + + + Count + + + TotalDuration + + + MinDuration + + + AverageDuration + + + MaxDuration + + + MedianDuration + + + Extension + + + + + + + + + default + + MpPerformanceReport.ScannedPathStats + Deserialized.MpPerformanceReport.ScannedPathStats + + + + + Right + + + Right + + + Right + + + Right + + + Right + + + Right + + + + + + + + + Count + + + TotalDuration + + + MinDuration + + + AverageDuration + + + MaxDuration + + + MedianDuration + + + Path + + + + + + + + + default + + MpPerformanceReport.ScannedProcessStats + Deserialized.MpPerformanceReport.ScannedProcessStats + + + + + Right + + + Right + + + Right + + + Right + + + Right + + + Right + + + + + + + + + Count + + + TotalDuration + + + MinDuration + + + AverageDuration + + + MaxDuration + + + MedianDuration + + + ProcessPath + + + + + + + + + default + + MpPerformanceReport.ScannedFilePathStats + Deserialized.MpPerformanceReport.ScannedFilePathStats + + + + + + Path + + + + + + + + default + + MpPerformanceReport.ScannedFileExtensionStats + Deserialized.MpPerformanceReport.ScannedFileExtensionStats + + + + + + Extension + + + + + + + + default + + MpPerformanceReport.ScannedPathStats + Deserialized.MpPerformanceReport.ScannedPathStats + + + + + + Path + + + + + + + + default + + MpPerformanceReport.ScannedProcessStats + Deserialized.MpPerformanceReport.ScannedProcessStats + + + + + + ProcessPath + + + + + + + + default + + MpPerformanceReport.ScanInfo + Deserialized.MpPerformanceReport.ScanInfo + + + + + + Right + + + + + + Right + + + + + + + + + + + + ScanType + + + Duration + + + Reason + + + SkipReason + + + $_.Comments.Count + + + ProcessName + + + Path + + + + + + + + + default + + MpPerformanceReport.ScanInfo + Deserialized.MpPerformanceReport.ScanInfo + + + + + + + ScanType + + + StartTime + + + EndTime + + + Duration + + + + ($null -ne $_.Reason) -and ($_.Reason.Length -gt 0) + + Reason + + + SkipReason + + + Path + + + + $null -ne $_.ProcessPath + + ProcessPath + + + + $null -ne $_.ProcessId + + ProcessId + + + + $null -ne $_.Image + + Image + + + + $null -ne $_.Comments + + + ($_.Comments | fl | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + default + + MpPerformanceReport.ScanInfo + Deserialized.MpPerformanceReport.ScanInfo + + + + + + Path + + + + + + + + default + + MpPerformanceReport.ScanInfo + Deserialized.MpPerformanceReport.ScanInfo + + + + + + + ($_ | ft | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + default + + MpPerformanceReport.Overview + Deserialized.MpPerformanceReport.Overview + + + + + + + ($_ | fl | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + default + + MpPerformanceReport.Overview + Deserialized.MpPerformanceReport.Overview + + + + + + + StartTime + + + EndTime + + + + ($null -ne $_.RealTimeScans) -and ($_.RealTimeScans -gt 0) + + RealTimeScans + + + + ($null -ne $_.OnDemandScans) -and ($_.OnDemandScans -gt 0) + + OnDemandScans + + + + ($null -ne $_.FileScans) -and ($_.FileScans -gt 0) + + FileScans + + + + ($null -ne $_.ProcessScans) -and ($_.ProcessScans -gt 0) + + ProcessScans + + + + ($null -ne $_.RealTimeScansDuration) -and ($_.RealTimeScansDuration -gt 0) + + RealTimeScansDuration + + + + ($null -ne $_.OnDemandScansDuration) -and ($_.OnDemandScansDuration -gt 0) + + OnDemandScansDuration + + + + ($null -ne $_.FileScansDuration) -and ($_.FileScansDuration -gt 0) + + FileScansDuration + + + + ($null -ne $_.ProcessScansDuration) -and ($_.ProcessScansDuration -gt 0) + + ProcessScansDuration + + + MaxScanDuration + + + MedianScanDuration + + + + ($null -ne $_.SkipScanCount) -and ($_.SkipScanCount -gt 0) + + SkipScanCount + + + + ($null -ne $_.PerfHints) -and ($_.PerfHints.Count -gt 0) + + + ($_.PerfHints | fl | Out-String).Trim("`r`n".ToCharArray()) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Defender/Defender.psd1 b/newton-cn/bin/v1.0/Modules/Defender/Defender.psd1 new file mode 100644 index 0000000..50ea7c5 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Defender/Defender.psd1 @@ -0,0 +1,221 @@ + +@{ + GUID = 'C46BE3DC-30A9-452F-A5FD-4BF9CA87A854' + Author="Microsoft Corporation" + CompanyName="Microsoft Corporation" + Copyright="© Microsoft Corporation. All rights reserved." + ModuleVersion = '1.0' + NestedModules = @( 'MSFT_MpComputerStatus.cdxml', + 'MSFT_MpPreference.cdxml', + 'MSFT_MpThreat.cdxml', + 'MSFT_MpThreatCatalog.cdxml', + 'MSFT_MpThreatDetection.cdxml', + 'MSFT_MpScan.cdxml', + 'MSFT_MpSignature.cdxml', + 'MSFT_MpWDOScan.cdxml') + + + AliasesToExport = @() + FunctionsToExport = @( 'Get-MpPreference', + 'Set-MpPreference', + 'Add-MpPreference', + 'Remove-MpPreference', + 'Get-MpComputerStatus', + 'Get-MpThreat', + 'Get-MpThreatCatalog', + 'Get-MpThreatDetection', + 'Start-MpScan', + 'Update-MpSignature', + 'Remove-MpThreat', + 'Start-MpWDOScan') + + PowerShellVersion = '5.1' + HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=390762" + CompatiblePSEditions = @('Desktop', 'Core') +} + +# SIG # Begin signature block +# MIIiMwYJKoZIhvcNAQcCoIIiJDCCIiACAQExDzANBglghkgBZQMEAgEFADB5Bgor +# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG +# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDUbZuRH+aG/7FW +# 9ezsmK3ZGa31rJ8d50nbQ/Xy2TfvNqCCC14wggTrMIID06ADAgECAhMzAAAGjjGX +# Mb+0zHDBAAAAAAaOMA0GCSqGSIb3DQEBCwUAMHkxCzAJBgNVBAYTAlVTMRMwEQYD +# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNy +# b3NvZnQgQ29ycG9yYXRpb24xIzAhBgNVBAMTGk1pY3Jvc29mdCBXaW5kb3dzIFBD +# QSAyMDEwMB4XDTE5MDUwMjIwMzUyN1oXDTIwMDUwMjIwMzUyN1owcDELMAkGA1UE +# BhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAc +# BgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEaMBgGA1UEAxMRTWljcm9zb2Z0 +# IFdpbmRvd3MwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCsvVYdcqx5 +# CYVMFPb/2EsJUc9P5loIBWf7HhHqFwFFQ0Fc7Alzdm/06Myx64qpVjCOwgmIA9x6 +# 2634vpYikMt46HFt5539uCkm3/HfX7oYDIIzqxX6EqBd8GLMRe09JMpg57fL0BIl +# do5l/LG60xFsnvBQNJ4mqi4C3TXvmV/vFqRruCXqP6FUejQlhGLEwbMNvgIWYJiK +# Tg16g/rdhlH25JL2jdrIvOrhmLngx3/1Vlh6+ypItfG3ml2mYK4CQYc04sZimz+B +# WzpM8TjP0DvVDddSGSry3sTQpDxZPgQQqTQmyOxTxHfhrUMzfL5XN4T6SpEGret/ +# qDJOT/80eN3DAgMBAAGjggFzMIIBbzAfBgNVHSUEGDAWBgorBgEEAYI3CgMGBggr +# BgEFBQcDAzAdBgNVHQ4EFgQUnC909vAOepLyCEG0Wl1Rzz+QiHMwUAYDVR0RBEkw +# R6RFMEMxKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVyYXRpb25zIFB1ZXJ0byBSaWNv +# MRYwFAYDVQQFEw0yMzAwMjgrNDU0MTM4MB8GA1UdIwQYMBaAFNFPqYoHCM70JBiY +# 5QD/89Z5HTe8MFMGA1UdHwRMMEowSKBGoESGQmh0dHA6Ly9jcmwubWljcm9zb2Z0 +# LmNvbS9wa2kvY3JsL3Byb2R1Y3RzL01pY1dpblBDQV8yMDEwLTA3LTA2LmNybDBX +# BggrBgEFBQcBAQRLMEkwRwYIKwYBBQUHMAKGO2h0dHA6Ly93d3cubWljcm9zb2Z0 +# LmNvbS9wa2kvY2VydHMvTWljV2luUENBXzIwMTAtMDctMDYuY3J0MAwGA1UdEwEB +# /wQCMAAwDQYJKoZIhvcNAQELBQADggEBAFz4krQX84TW3RbjHZj+QkVVwkvT6J46 +# F/s8HuNVxt/gfRHfvFLPIwU4VsDYbBmYv0Vy3hJ1/Eg1fdSgXMRNLW6kPT7bLx5z +# ucCx6JBgLYBDSq0auMm5liQrATrPEM0PoBDqMpE0zsqdQ/C2P8UlkKLNhUS/qD0f +# 6OmLwTp9spa+Y4CL+C1gT1knV4Olku5X5ZoCyWXs6k7D0dltiO4nZjq7eRne53Kr +# +Eo9ocfnUjDalgHpFWOkdwx+cSXpfvh2cI1T0Qug9eS5VQ1j+iLRPWEKhbljly/M +# UWcVFCv+gqGphEkHsBjyKs0TZ4HMfC4n9DonS04Hn+/BskGtHJE+leMwggZrMIIE +# U6ADAgECAgphDGoZAAAAAAAEMA0GCSqGSIb3DQEBCwUAMIGIMQswCQYDVQQGEwJV +# UzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UE +# ChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTIwMAYDVQQDEylNaWNyb3NvZnQgUm9v +# dCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgMjAxMDAeFw0xMDA3MDYyMDQwMjNaFw0y +# NTA3MDYyMDUwMjNaMHkxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9u +# MRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRp +# b24xIzAhBgNVBAMTGk1pY3Jvc29mdCBXaW5kb3dzIFBDQSAyMDEwMIIBIjANBgkq +# hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwHm7OrHwD4S4rWQqdRZz0LsH9j4NnRTk +# sZ/ByJSwOHwf0DNV9bojZvUuKEhTxxaDuvVRrH6s4CZ/D3T8WZXcycai91JwWiwd +# lKsZv6+Vfa9moW+bYm5tS7wvNWzepGpjWl/78w1NYcwKfjHrbArQTZcP/X84RuaK +# x3NpdlVplkzk2PA067qxH84pfsRPnRMVqxMbclhiVmyKgaNkd5hGZSmdgxSlTAig +# g9cjH/Nf328sz9oW2A5yBCjYaz74E7F8ohd5T37cOuSdcCdrv9v8HscH2MC+C5Me +# KOBzbdJU6ShMv2tdn/9dMxI3lSVhNGpCy3ydOruIWeGjQm06UFtI0QIDAQABo4IB +# 4zCCAd8wEAYJKwYBBAGCNxUBBAMCAQAwHQYDVR0OBBYEFNFPqYoHCM70JBiY5QD/ +# 89Z5HTe8MBkGCSsGAQQBgjcUAgQMHgoAUwB1AGIAQwBBMAsGA1UdDwQEAwIBhjAP +# BgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNX2VsuP6KJcYmjRPZSQW9fOmhjE +# MFYGA1UdHwRPME0wS6BJoEeGRWh0dHA6Ly9jcmwubWljcm9zb2Z0LmNvbS9wa2kv +# Y3JsL3Byb2R1Y3RzL01pY1Jvb0NlckF1dF8yMDEwLTA2LTIzLmNybDBaBggrBgEF +# BQcBAQROMEwwSgYIKwYBBQUHMAKGPmh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9w +# a2kvY2VydHMvTWljUm9vQ2VyQXV0XzIwMTAtMDYtMjMuY3J0MIGdBgNVHSAEgZUw +# gZIwgY8GCSsGAQQBgjcuAzCBgTA9BggrBgEFBQcCARYxaHR0cDovL3d3dy5taWNy +# b3NvZnQuY29tL1BLSS9kb2NzL0NQUy9kZWZhdWx0Lmh0bTBABggrBgEFBQcCAjA0 +# HjIgHQBMAGUAZwBhAGwAXwBQAG8AbABpAGMAeQBfAFMAdABhAHQAZQBtAGUAbgB0 +# AC4gHTANBgkqhkiG9w0BAQsFAAOCAgEALkGmhrUGb/CAhfo7yhfpyfrkOcKUcMNk +# lMPYVqaQjv7kmvRt9W+OU41aqPOu20Zsvn8dVFYbPB1xxFEVVH6/7qWVQjP9DZAk +# JOP53JbK/Lisv/TCOVa4u+1zsxfdfoZQI4tWJMq7ph2ahy8nheehtgqcDRuM8wBi +# QbpIdIeC/VDJ9IcpwwOqK98aKXnoEiSahu3QLtNAgfUHXzMGVF1AtfexYv1NSPdu +# QUdSHLsbwlc6qJlWk9TG3iaoYHWGu+xipvAdBEXfPqeE0VtEI2MlNndvrlvcItUU +# I2pBf9BCptvvJXsE49KWN2IGr/gbD46zOZq7ifU1BuWkW8OMnjdfU9GjN/2kT+gb +# Dmt25LiPsMLq/XX3LEG3nKPhHgX+l5LLf1kDbahOjU6AF9TVcvZW5EifoyO6BqDA +# jtGIT5Mg8nBf2GtyoyBJ/HcMXcXH4QIPOEIQDtsCrpo3HVCAKR6kp9nGmiVV/UDK +# rWQQ6DH5ElR5GvIO2NarHjP+AucmbWFJj/Elwot0md/5kxqQHO7dlDMOQlDbf1D4 +# n2KC7KaCFnxmvOyZsMFYXaiwmmEUkdGZL0nkPoGZ1ubvyuP9Pu7sCYYDBw0bDXzr +# 9FrJlc+HEgpd7MUCks0FmXLKffEqEBg45DGjKLTmTMVSo5xqx33AcQkEDXDeAj+H +# 7lah7Ou1TIUxghYrMIIWJwIBATCBkDB5MQswCQYDVQQGEwJVUzETMBEGA1UECBMK +# V2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0 +# IENvcnBvcmF0aW9uMSMwIQYDVQQDExpNaWNyb3NvZnQgV2luZG93cyBQQ0EgMjAx +# MAITMwAABo4xlzG/tMxwwQAAAAAGjjANBglghkgBZQMEAgEFAKCBrjAZBgkqhkiG +# 9w0BCQMxDAYKKwYBBAGCNwIBBDAcBgorBgEEAYI3AgELMQ4wDAYKKwYBBAGCNwIB +# FTAvBgkqhkiG9w0BCQQxIgQgqArPjADquL3us4fMnB/bsIuUMLm3ByQyJDbiEevp +# iwowQgYKKwYBBAGCNwIBDDE0MDKgFIASAE0AaQBjAHIAbwBzAG8AZgB0oRqAGGh0 +# dHA6Ly93d3cubWljcm9zb2Z0LmNvbTANBgkqhkiG9w0BAQEFAASCAQB1jByJbzaz +# oKR0xnnzkHGYsLSpOB+RHzoeuoqL6ApE6NwOjqbo2jnyCB087rmnGu9kzTRbmABY +# kQqOC6Zuc0aLat9cTnW4YkKYMiQe63dj24cr3VvVZOSpydsyPLuAH488brp7Ywwx +# UxKiU+nnVZ/9AHLT1Rk4KGAxH7GwkmbresWhYuLHX6DwURjD/cSPQiUDagLRCJyd +# cMNBuWNd8EyfCLmAimlbeewczksWd4v79AAq+8hVaVtG1Hk2aM3sWMTiXTDFkCHy +# XFPXJi/vhFJCtsn6ZvsLHfKLVLUdV4cLiVq6QbdYZXWciOdRzZhcDTgYybrXQ5X5 +# bDFw+Nnk11+qoYITujCCE7YGCisGAQQBgjcDAwExghOmMIITogYJKoZIhvcNAQcC +# oIITkzCCE48CAQMxDzANBglghkgBZQMEAgEFADCCAVgGCyqGSIb3DQEJEAEEoIIB +# RwSCAUMwggE/AgEBBgorBgEEAYRZCgMBMDEwDQYJYIZIAWUDBAIBBQAEIHlT+9kz +# AlxjMg5+TwvD98601ORheoJ647W22XKMh0vNAgZdiN620kUYEzIwMTkwOTI1MDIw +# NDQ0LjY2N1owBwIBAYACAfSggdSkgdEwgc4xCzAJBgNVBAYTAlVTMRMwEQYDVQQI +# EwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3Nv +# ZnQgQ29ycG9yYXRpb24xKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVyYXRpb25zIFB1 +# ZXJ0byBSaWNvMSYwJAYDVQQLEx1UaGFsZXMgVFNTIEVTTjpGNTI4LTM3NzctOEE3 +# NjElMCMGA1UEAxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZaCCDyIwggT1 +# MIID3aADAgECAhMzAAABApFjXMW0Wbk8AAAAAAECMA0GCSqGSIb3DQEBCwUAMHwx +# CzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRt +# b25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xJjAkBgNVBAMTHU1p +# Y3Jvc29mdCBUaW1lLVN0YW1wIFBDQSAyMDEwMB4XDTE5MDkwNjIwNDExNloXDTIw +# MTIwNDIwNDExNlowgc4xCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9u +# MRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRp +# b24xKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVyYXRpb25zIFB1ZXJ0byBSaWNvMSYw +# JAYDVQQLEx1UaGFsZXMgVFNTIEVTTjpGNTI4LTM3NzctOEE3NjElMCMGA1UEAxMc +# TWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZTCCASIwDQYJKoZIhvcNAQEBBQAD +# ggEPADCCAQoCggEBAMR9cB7FDTMrBI8h/TzUcyyH/WMnyW+TxPx308rF22K65K6d +# 0Cg/VQyr3xtoT+ir0MEhZ/hvXY5sO8F4HSu2frknt30PYRTQW0I1gzgNc7Tggbcx +# fY4JcXStqM0/3NGZusiKKDl8UvFV85irGYuiP/b36nqe6T5zk1gVIGHx5nFIdfPy +# HjsnoWX6gOxfqIDavfFeb/Ak7lKqZAHUgdAZU08KCYkVKYLtZbaRyQ2W1/KA7cPf +# cT17u+r6dJHZNfMqnCWriLZz9sTdkpTnQgvBr6LdLJ8b0e24taMX98ySqyenc1bB +# foa49rasKev/Ao17wc3sTO1POEkJQzOib6OwiNcCAwEAAaOCARswggEXMB0GA1Ud +# DgQWBBQ/AgaO19V67EZWg1gyCfv3uVC1tjAfBgNVHSMEGDAWgBTVYzpcijGQ80N7 +# fEYbxTNoWoVtVTBWBgNVHR8ETzBNMEugSaBHhkVodHRwOi8vY3JsLm1pY3Jvc29m +# dC5jb20vcGtpL2NybC9wcm9kdWN0cy9NaWNUaW1TdGFQQ0FfMjAxMC0wNy0wMS5j +# cmwwWgYIKwYBBQUHAQEETjBMMEoGCCsGAQUFBzAChj5odHRwOi8vd3d3Lm1pY3Jv +# c29mdC5jb20vcGtpL2NlcnRzL01pY1RpbVN0YVBDQV8yMDEwLTA3LTAxLmNydDAM +# BgNVHRMBAf8EAjAAMBMGA1UdJQQMMAoGCCsGAQUFBwMIMA0GCSqGSIb3DQEBCwUA +# A4IBAQCdMoMxXiGN6lYPaFv/uIVhdPr50PRE0H+4jZwUEOrTU8vJLF7ARizMeK/Z +# mxczuJPQhm7KSZBJXp+FmrX5jRE+gD7+gkPlTaRTiy+A/3jVOFJiPChh17Zxz/fS +# qtbKlejkG7LJv4Ptg/1u7qVI3bNGge85BkDt0xlTUsK8VxA2zGQSq4JfkF5TSPCG +# HQjmKdgJTfiZadCWQ2j/K5W0QAzPxNhrj3QetJp9Dqlr04EiV1IvZNAhY00TUByB +# GGhTlEclYTCzhGG7Agv2+qGkOv1tmeRjqLCETuF3/+WQWjxEzHfjMRsbDfhrcuAl +# AXZMrJktBr+87FwXNzt/81FwkOOkMIIGcTCCBFmgAwIBAgIKYQmBKgAAAAAAAjAN +# BgkqhkiG9w0BAQsFADCBiDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0 +# b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3Jh +# dGlvbjEyMDAGA1UEAxMpTWljcm9zb2Z0IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9y +# aXR5IDIwMTAwHhcNMTAwNzAxMjEzNjU1WhcNMjUwNzAxMjE0NjU1WjB8MQswCQYD +# VQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEe +# MBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNyb3Nv +# ZnQgVGltZS1TdGFtcCBQQ0EgMjAxMDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC +# AQoCggEBAKkdDbx3EYo6IOz8E5f1+n9plGt0VBDVpQoAgoX77XxoSyxfxcPlYcJ2 +# tz5mK1vwFVMnBDEfQRsalR3OCROOfGEwWbEwRA/xYIiEVEMM1024OAizQt2TrNZz +# MFcmgqNFDdDq9UeBzb8kYDJYYEbyWEeGMoQedGFnkV+BVLHPk0ySwcSmXdFhE24o +# xhr5hoC732H8RsEnHSRnEnIaIYqvS2SJUGKxXf13Hz3wV3WsvYpCTUBR0Q+cBj5n +# f/VmwAOWRH7v0Ev9buWayrGo8noqCjHw2k4GkbaICDXoeByw6ZnNPOcvRLqn9Nxk +# vaQBwSAJk3jN/LzAyURdXhacAQVPIk0CAwEAAaOCAeYwggHiMBAGCSsGAQQBgjcV +# AQQDAgEAMB0GA1UdDgQWBBTVYzpcijGQ80N7fEYbxTNoWoVtVTAZBgkrBgEEAYI3 +# FAIEDB4KAFMAdQBiAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAf +# BgNVHSMEGDAWgBTV9lbLj+iiXGJo0T2UkFvXzpoYxDBWBgNVHR8ETzBNMEugSaBH +# hkVodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpL2NybC9wcm9kdWN0cy9NaWNS +# b29DZXJBdXRfMjAxMC0wNi0yMy5jcmwwWgYIKwYBBQUHAQEETjBMMEoGCCsGAQUF +# BzAChj5odHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpL2NlcnRzL01pY1Jvb0Nl +# ckF1dF8yMDEwLTA2LTIzLmNydDCBoAYDVR0gAQH/BIGVMIGSMIGPBgkrBgEEAYI3 +# LgMwgYEwPQYIKwYBBQUHAgEWMWh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9QS0kv +# ZG9jcy9DUFMvZGVmYXVsdC5odG0wQAYIKwYBBQUHAgIwNB4yIB0ATABlAGcAYQBs +# AF8AUABvAGwAaQBjAHkAXwBTAHQAYQB0AGUAbQBlAG4AdAAuIB0wDQYJKoZIhvcN +# AQELBQADggIBAAfmiFEN4sbgmD+BcQM9naOhIW+z66bM9TG+zwXiqf76V20ZMLPC +# xWbJat/15/B4vceoniXj+bzta1RXCCtRgkQS+7lTjMz0YBKKdsxAQEGb3FwX/1z5 +# Xhc1mCRWS3TvQhDIr79/xn/yN31aPxzymXlKkVIArzgPF/UveYFl2am1a+THzvbK +# egBvSzBEJCI8z+0DpZaPWSm8tv0E4XCfMkon/VWvL/625Y4zu2JfmttXQOnxzplm +# kIz/amJ/3cVKC5Em4jnsGUpxY517IW3DnKOiPPp/fZZqkHimbdLhnPkd/DjYlPTG +# pQqWhqS9nhquBEKDuLWAmyI4ILUl5WTs9/S/fmNZJQ96LjlXdqJxqgaKD4kWumGn +# Ecua2A5HmoDF0M2n0O99g/DhO3EJ3110mCIIYdqwUB5vvfHhAN/nMQekkzr3ZUd4 +# 6PioSKv33nJ+YWtvd6mBy6cJrDm77MbL2IK0cs0d9LiFAR6A+xuJKlQ5slvayA1V +# mXqHczsI5pgt6o3gMy4SKfXAL1QnIffIrE7aKLixqduWsqdCosnPGUFN4Ib5Kpqj +# EWYw07t0MkvfY3v1mYovG8chr1m1rtxEPJdQcdeh0sVV42neV8HR3jDA/czmTfsN +# v11P6Z0eGTgvvM9YBS7vDaBQNdrvCScc1bN+NR4Iuto229Nfj950iEkSoYIDsDCC +# ApgCAQEwgf6hgdSkgdEwgc4xCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5n +# dG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9y +# YXRpb24xKTAnBgNVBAsTIE1pY3Jvc29mdCBPcGVyYXRpb25zIFB1ZXJ0byBSaWNv +# MSYwJAYDVQQLEx1UaGFsZXMgVFNTIEVTTjpGNTI4LTM3NzctOEE3NjElMCMGA1UE +# AxMcTWljcm9zb2Z0IFRpbWUtU3RhbXAgU2VydmljZaIlCgEBMAkGBSsOAwIaBQAD +# FQAX6b/thBTl/jMeKcc4lhOUcT39r6CB3jCB26SB2DCB1TELMAkGA1UEBhMCVVMx +# EzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoT +# FU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEpMCcGA1UECxMgTWljcm9zb2Z0IE9wZXJh +# dGlvbnMgUHVlcnRvIFJpY28xJzAlBgNVBAsTHm5DaXBoZXIgTlRTIEVTTjo0REU5 +# LTBDNUUtM0UwOTErMCkGA1UEAxMiTWljcm9zb2Z0IFRpbWUgU291cmNlIE1hc3Rl +# ciBDbG9jazANBgkqhkiG9w0BAQUFAAIFAOE0jQowIhgPMjAxOTA5MjQyMDM5Mzha +# GA8yMDE5MDkyNTIwMzkzOFowdzA9BgorBgEEAYRZCgQBMS8wLTAKAgUA4TSNCgIB +# ADAKAgEAAgIjIQIB/zAHAgEAAgIavTAKAgUA4TXeigIBADA2BgorBgEEAYRZCgQC +# MSgwJjAMBgorBgEEAYRZCgMBoAowCAIBAAIDFuNgoQowCAIBAAIDB6EgMA0GCSqG +# SIb3DQEBBQUAA4IBAQBrASVU9pdcR4F7/4tTy4Ua1pgXaHZeS+WxCk/Y27lXPjX3 +# AXc10+sWzfY399sHeIxloGNPGE2dAbreedpWNUOdASpH4NcmdBIV9Lw+rzINRfDk +# kXnmuMTBCNXUBheACk5PMBJkFmIb3pzS1ltL0VrBjIqrhEHcAODb084kqkowqnLy +# pXjqbqXhtgtCUYb4R3YW4UHh2fELgND4b137hiif1uYPml2eYJF3NkWEx+Yy1bnO +# BoO1HGGOVVkYl0haK9KYO477Aat/W3RXLCi9ZWvUF1zzIzmgEGpmg0IJ0+gc4O/u +# qL4fjQ+v7dr4XZGprDk4K/vnHJuXP6Zx+V9AQYt5MYIC9TCCAvECAQEwgZMwfDEL +# MAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1v +# bmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEmMCQGA1UEAxMdTWlj +# cm9zb2Z0IFRpbWUtU3RhbXAgUENBIDIwMTACEzMAAAECkWNcxbRZuTwAAAAAAQIw +# DQYJYIZIAWUDBAIBBQCgggEyMBoGCSqGSIb3DQEJAzENBgsqhkiG9w0BCRABBDAv +# BgkqhkiG9w0BCQQxIgQgmh0X5htwm7cgRCt/4kIReiD7scc2/3H2LKoBpDH4A6Mw +# geIGCyqGSIb3DQEJEAIMMYHSMIHPMIHMMIGxBBQX6b/thBTl/jMeKcc4lhOUcT39 +# rzCBmDCBgKR+MHwxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAw +# DgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24x +# JjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQSAyMDEwAhMzAAABApFj +# XMW0Wbk8AAAAAAECMBYEFE6aCa5er+HPJ0ZM96o0ARtMskdiMA0GCSqGSIb3DQEB +# CwUABIIBADdGN5qukcEbkhbQS5sWxBsxHk9pqERW8f6V+ZHN2z562v9ZUmfLo4TX +# yAZtjbbsqSGTezz/YPziqebgXZP6Xo0akk372tSN7kVFtB9YEWru6/1hgYVHJ50r +# G6ti7OwweZRyUIOdJysSO2p3lzV06FiHQvLtsVtAt/BVFcVLh3i/hv+94Ew7D262 +# 5JiV28qyVTJRoJXChDT1q+tlR7ajbie3YyEKHuxLIa06IvbLayjsULRtTMfTXsS3 +# KCopbN0xpYvkLdWjyOrfc7XXs64UpyCvyQf468lVABcTOfKT/HLlEeIRn8bZZ+Oh +# okD3McQngz1Tv6rjlTi6OPhh4Z6ivFM= +# SIG # End signature block diff --git a/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpComputerStatus.cdxml b/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpComputerStatus.cdxml new file mode 100644 index 0000000..f2cb5ea --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpComputerStatus.cdxml @@ -0,0 +1,202 @@ + + + + 1.0 + MpComputerStatus + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpPreference.cdxml b/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpPreference.cdxml new file mode 100644 index 0000000..51a31ca --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpPreference.cdxml @@ -0,0 +1,1046 @@ + + + + 1.0 + MpPreference + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Both + Incoming + Outcoming + + + + + + + + + + + + + + + + + Everyday + Sunday + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday + Never + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + QuickScan + FullScan + + + + + + + + + + Everyday + Sunday + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday + Never + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Everyday + Sunday + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday + Never + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Disabled + Basic + Advanced + + + + + + + + + + AlwaysPrompt + SendSafeSamples + NeverSend + SendAllSamples + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Disabled + Enabled + AuditMode + + + + + + + + + + Default + Moderate + High + HighPlus + ZeroTolerance + + + + + + + + + + + + + + + + + Disabled + Enabled + AuditMode + + + + + + + + + + Disabled + Enabled + AuditMode + BlockDiskModificationOnly + AuditDiskModificationOnly + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpScan.cdxml b/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpScan.cdxml new file mode 100644 index 0000000..671f9db --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpScan.cdxml @@ -0,0 +1,233 @@ + + + + 1.0 + MpScan + + + + + + + + + + + + + + + + + + + + + + + + + FullScan + QuickScan + CustomScan + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpSignature.cdxml b/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpSignature.cdxml new file mode 100644 index 0000000..a97a324 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpSignature.cdxml @@ -0,0 +1,230 @@ + + + + 1.0 + MpSignature + + + + + + + + + + + + + + + + + + + + InternalDefinitionUpdateServer + MicrosoftUpdateServer + MMPC + FileShares + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpThreat.cdxml b/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpThreat.cdxml new file mode 100644 index 0000000..ec817d9 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpThreat.cdxml @@ -0,0 +1,218 @@ + + + + 1.0 + MpThreat + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpThreatCatalog.cdxml b/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpThreatCatalog.cdxml new file mode 100644 index 0000000..b48296d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpThreatCatalog.cdxml @@ -0,0 +1,205 @@ + + + + 1.0 + MpThreatCatalog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpThreatDetection.cdxml b/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpThreatDetection.cdxml new file mode 100644 index 0000000..8e2d85c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpThreatDetection.cdxml @@ -0,0 +1,205 @@ + + + + 1.0 + MpThreatDetection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpWDOScan.cdxml b/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpWDOScan.cdxml new file mode 100644 index 0000000..6955cad --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Defender/MSFT_MpWDOScan.cdxml @@ -0,0 +1,205 @@ + + + + 1.0 + MpWDOScan + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/DeliveryOptimization/DeliveryOptimization.psd1 b/newton-cn/bin/v1.0/Modules/DeliveryOptimization/DeliveryOptimization.psd1 new file mode 100644 index 0000000..ec077c4 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DeliveryOptimization/DeliveryOptimization.psd1 @@ -0,0 +1,28 @@ +@{ + GUID = "{B9AF2675-4726-42FD-ADAB-38228176A516}" + Author = "Microsoft Corporation" + CLRVersion = "4.0" + CompanyName = "Microsoft Corporation" + Copyright = "(c) Microsoft Corporation. All rights reserved." + AliasesToExport = @() + FunctionsToExport = "Disable-DeliveryOptimizationVerboseLogs", + "Enable-DeliveryOptimizationVerboseLogs", + "Get-DeliveryOptimizationStatus", + "Get-DeliveryOptimizationPerfSnap", + "Get-DeliveryOptimizationPerfSnapThisMonth", + "Get-DOConfig", + "Get-DODownloadMode", + "Get-DOPercentageMaxForegroundBandwidth", + "Get-DOPercentageMaxBackgroundBandwidth" + CmdletsToExport = "Delete-DeliveryOptimizationCache", + "Set-DeliveryOptimizationStatus", + "Get-DeliveryOptimizationLog", + "Get-DeliveryOptimizationLogAnalysis", + "Set-DODownloadMode", + "Set-DOPercentageMaxForegroundBandwidth", + "Set-DOPercentageMaxBackgroundBandwidth" + PowerShellVersion = '5.1' + ModuleVersion = "1.0.2.0" + NestedModules = @('Microsoft.Windows.DeliveryOptimization.AdminCommands', 'DeliveryOptimizationVerboseLogs.psm1', 'DeliveryOptimizationStatus.psm1') + CompatiblePSEditions = @('Core','Desktop') +} diff --git a/newton-cn/bin/v1.0/Modules/DeliveryOptimization/DeliveryOptimizationStatus.psm1 b/newton-cn/bin/v1.0/Modules/DeliveryOptimization/DeliveryOptimizationStatus.psm1 new file mode 100644 index 0000000..8b09da3 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DeliveryOptimization/DeliveryOptimizationStatus.psm1 @@ -0,0 +1,513 @@ + +$global:DONamespace = "root/Microsoft/Windows/DeliveryOptimization" + +enum DownloadMode +{ + CdnOnly = 0 + Lan = 1 + Group = 2 + Internet = 3 + Simple = 99 + Bypass = 100 +} + +enum SwarmStatus +{ + Downloading = 0 + Complete + Caching + Paused +} + +enum Priority +{ + Background + Foreground +} + +enum ConfigProvider +{ + RegistryProvider = 5 + MdmProvider = 7 + SettingsProvider # Settings (UX) provider + AdminProvider # Admin provider (powershell, WMI, etc.) + + DefaultProvider = 99 # Also considered as InvalidProvider +} + +enum PeerType +{ + PeerType_none = 0 + PeerType_LAN + PeerType_CDN + PeerType_Internet + PeerType_Group + PeerType_DOINC + PeerType_LocalCache + PeerType_LinkLocal +} + +class DOPeerInfo +{ + [string] $IP; + [PeerType] $PeerType; + [bool] $ConnectionEstablished; + [uint64] $BytesSent; + [uint64] $BytesReceived; + [uint32] $UploadRateBytes; + [uint32] $DownloadRateBytes; +} + +class DOSwarmStats +{ + [string] $FileId + [uint64] $FileSize + [uint64] $FileSizeInCache + [uint64] $TotalBytesDownloaded + [double] $PercentPeerCaching + [uint64] $BytesFromPeers + [uint64] $BytesFromHttp + [SwarmStatus] $Status + [Priority] $Priority + [uint64] $BytesFromCacheServer + [uint64] $BytesFromLanPeers + [uint64] $BytesFromGroupPeers + [uint64] $BytesFromInternetPeers + [uint64] $BytesToLanPeers + [uint64] $BytesToGroupPeers + [uint64] $BytesToInternetPeers + [timespan] $DownloadDuration + [uint32] $HttpConnectionCount + [uint32] $LanConnectionCount + [uint32] $GroupConnectionCount + [uint32] $InternetConnectionCount + [DownloadMode] $DownloadMode + [uri] $SourceURL + [uri] $CacheHost + [uint32] $NumPeers + [string] $PredefinedCallerApplication + [Nullable[datetime]] $ExpireOn + [bool] $IsPinned +} + +class DOFilePeerInfo +{ + [string] $FileId + [DOPeerInfo[]] $PeersInfo +} + +class DOPerfSnap +{ + [uint32] $FilesDownloaded + [uint32] $FilesUploaded + [uint32] $Files + [uint64] $TotalBytesDownloaded + [uint64] $TotalBytesUploaded + [uint64] $AverageDownloadSize + [uint64] $AverageUploadSize + [DownloadMode] $DownloadMode + [uint64] $CacheSizeBytes + [uint64] $TotalDiskBytes + [uint64] $AvailableDiskBytes + [float] $CpuUsagePct + [uint64] $MemUsageKB + [uint32] $NumberOfPeers + [uint32] $CacheHostConnections + [uint32] $CdnConnections + [uint32] $LanConnections + [uint32] $LinkLocalConnections + [uint32] $GroupConnections + [uint32] $InternetConnections + [uint32] $DownlinkBps + [uint32] $DownlinkUsageBps + [uint32] $UplinkBps + [uint32] $UplinkUsageBps + [uint32] $ForegroundDownloadRatePct + [uint32] $BackgroundDownloadRatePct + [uint32] $UploadRatePct + [uint32] $UploadCount + [uint32] $ForegroundDownloadCount + [uint32] $ForegroundDownloadsPending + [uint32] $BackgroundDownloadCount + [uint32] $BackgroundDownloadsPending +} + +class DOMonthlyPerfSnap +{ + [uint64] $UploadLanBytes + [uint64] $UploadInternetBytes + [uint64] $DownloadHttpBytes + [uint64] $DownloadCacheHostBytes + [uint64] $DownloadLanBytes + [uint64] $DownloadInternetBytes + [uint64] $DownloadFgRateKbps + [uint64] $DownloadBgRateKbps + [bool] $UploadLimitReached + [datetime] $MonthStartDate +} + +class DOConfig +{ + [DownloadMode] $DownloadMode + [ConfigProvider] $DownloadModeProvider + [uint32] $DownBackLimitBps + [ConfigProvider] $DownBackLimitBpsProvider + [uint32] $DownloadForegroundLimitBps + [ConfigProvider] $DownloadForegroundLimitBpsProvider + [uint32] $DownBackLimitPct + [ConfigProvider] $DownBackLimitPctProvider + [uint16] $DownloadForegroundLimitPct + [ConfigProvider] $DownloadForegroundLimitPctProvider + [uint16] $MaxUploadRatePct + [ConfigProvider] $MaxUploadRateProvider + [double] $UploadLimitMonthlyGB + [ConfigProvider] $UploadLimitMonthlyGBProvider +} + +class DOExtendedConfig : DOConfig +{ + [uint16] $BatteryPctToSeed + [ConfigProvider] $BatteryPctToSeedProvider + [string] $WorkingDirectory + [ConfigProvider] $WorkingDirectoryProvider + [uint32] $MinTotalDiskSize + [ConfigProvider] $MinTotalDiskSizeProvider + [uint32] $MinTotalRAM + [ConfigProvider] $MinTotalRAMProvider + [bool] $VpnPeerCachingAllowed + [ConfigProvider] $VpnPeerCachingAllowedProvider + [string] $VpnKeywords + [ConfigProvider] $VpnKeywordsProvider +} + +function Get-DeliveryOptimizationStatus +{ + <# + .LINK + https://aka.ms/do-cmdlets + #> + [CmdletBinding()] + [OutputType([DOSwarmStats],[DOFilePeerInfo],[string],[DOPeerInfo])] + Param( + [Parameter(ParameterSetName="PeerInfo")] + [switch] $PeerInfo, + [Parameter(ParameterSetName="PeerInfo")] + [switch] $AsObject, + [Parameter(ParameterSetName="PeerInfo")] + [int] $SelectPeerCount = 5 + ) + + if ($PeerInfo) + { + $swarms = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DeliveryOptimizationFilePeerInfo + foreach ($swarm in $swarms) + { + $doSwarmInfo = [DOFilePeerInfo]@{ + FileId=$swarm.FileId + PeersInfo=@() + } + if ($swarm.IPs) + { + for ($i = 0; $i -lt $swarm.IPs.Length; $i++) + { + $doSwarmInfo.PeersInfo += [DOPeerInfo]@{ + IP=$swarm.IPs[$i] + PeerType=$swarm.PeerTypes[$i] + ConnectionEstablished=$swarm.ConnectionEstablished[$i] + BytesSent=$swarm.BytesSent[$i] + BytesReceived=$swarm.BytesReceived[$i] + UploadRateBytes=$swarm.UploadRates[$i] + DownloadRateBytes=$swarm.DownloadRates[$i] + } + } + $doSwarmInfo.PeersInfo = $($doSwarmInfo.PeersInfo | Sort-Object BytesReceived -Descending)[0..$($SelectPeerCount-1)] + } + if ($AsObject) + { + Write-output $doSwarmInfo + } + else + { + Write-Output $doSwarmInfo.FileId + Write-Output $doSwarmInfo.PeersInfo[0..$($SelectPeerCount-1)] + } + } + } + else + { + $swarms = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DeliveryOptimizationFile + foreach ($swarm in $swarms) + { + $doSwarmStats = [DOSwarmStats]@{ + FileId=$swarm.FileId + FileSize=$swarm.FileSize + FileSizeInCache=$swarm.FileSizeInCache + TotalBytesDownloaded=$swarm.TotalBytesDownloaded + PercentPeerCaching=0 + BytesFromHttp=$swarm.BytesFromHttp + Status=$swarm.Status + BytesFromCacheServer=$swarm.BytesFromCacheServer + BytesFromLanPeers=$swarm.BytesFromLanPeers + BytesFromGroupPeers=$swarm.BytesFromGroupPeers + BytesFromInternetPeers=$swarm.BytesFromInternetPeers + BytesToLanPeers=$swarm.BytesToLanPeers + BytesToGroupPeers=$swarm.BytesToGroupPeers + DownloadDuration=[TimeSpan]::FromMilliseconds($swarm.DownloadDurationMsecs) + HttpConnectionCount=$swarm.HttpConnectionCount + LanConnectionCount=$swarm.LanConnectionCount + GroupConnectionCount=$swarm.GroupConnectionCount + InternetConnectionCount=$swarm.InternetConnectionCount + DownloadMode=$swarm.DownloadMode + SourceURL=$swarm.SourceURL + CacheHost=$swarm.CacheHost + NumPeers=$swarm.PeerCount + PredefinedCallerApplication=$swarm.PredefinedCallerApplication + ExpireOn=$swarm.ExpireOn + IsPinned=$swarm.IsPinned + } + $doSwarmStats.BytesFromPeers = $doSwarmStats.BytesFromLanPeers + $doSwarmStats.BytesFromGroupPeers + $doSwarmStats.BytesFromInternetPeers + if ($doSwarmStats.TotalBytesDownloaded -ne 0) + { + $doSwarmStats.PercentPeerCaching = (100.0 * $doSwarmStats.BytesFromPeers) / $doSwarmStats.TotalBytesDownloaded + } + if ($swarm.IsBackground) + { + $doSwarmStats.Priority = [Priority]::Background + } + else + { + $doSwarmStats.Priority = [Priority]::Foreground + } + Write-Output $doSwarmStats + } + } +} + +function Get-DeliveryOptimizationPerfSnap +{ + <# + .LINK + https://aka.ms/do-cmdlets + #> + [CmdletBinding()] + [OutputType([DOPerfSnap])] + Param() + + $allStats = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DOBaseStatus + $basicConfig = $allStats | where {($_.CimClass).CimClassName -eq "MSFT_DeliveryOptimizationConfig"} + $currentStatus = $allStats | where {($_.CimClass).CimClassName -eq "MSFT_DOCurrentStatus"} + $downloadUsage = $allStats | where {($_.CimClass).CimClassName -eq "MSFT_DODownloadUsage"} + $uploadUsage = $allStats | where {($_.CimClass).CimClassName -eq "MSFT_DOUploadUsage"} + $snapInfo = [DOPerfSnap]@{ + DownloadMode=$basicConfig.DownloadMode + Files=$currentStatus.Swarms + CacheSizeBytes=$currentStatus.CacheSizeBytes + TotalDiskBytes=$currentStatus.DiskTotalBytes + AvailableDiskBytes=$currentStatus.DiskAvailableBytes + CpuUsagePct=$currentStatus.CpuUsagePct + MemUsageKB=$currentStatus.MemUsageKBytes + NumberOfPeers=$currentStatus.PeerInfoCount + CacheHostConnections=$currentStatus.CacheServerConnections + CdnConnections=$currentStatus.CdnConnections + LanConnections=$currentStatus.LanConnections + LinkLocalConnections=$currentStatus.LinkLocalConnections + GroupConnections=$currentStatus.GroupConnections + InternetConnections=$currentStatus.InternetConnections + DownlinkBps=$downloadUsage.LinkBps + DownlinkUsageBps=$downloadUsage.LinkUsageBps + UplinkBps=$uploadUsage.LinkBps + UplinkUsageBps=$uploadUsage.LinkUsageBps + ForegroundDownloadRatePct=$downloadUsage.ForegroundRatePct + BackgroundDownloadRatePct=$downloadUsage.BackgroundRatePct + UploadRatePct=$uploadUsage.UploadRatePct + UploadCount=$uploadUsage.Uploads + ForegroundDownloadCount=$downloadUsage.PriorityDownloads + ForegroundDownloadsPending=$downloadUsage.PriorityDownloadsPending + BackgroundDownloadCount=$downloadUsage.NormalDownloads + BackgroundDownloadsPending=$downloadUsage.NormalDownloadsPending + } + foreach ($swarmStats in (Get-DeliveryOptimizationStatus)) + { + if ($swarmStats.TotalBytesDownloaded -gt 0) + { + $snapInfo.FilesDownloaded++ + $snapInfo.TotalBytesDownloaded += $swarmStats.TotalBytesDownloaded + $bytesToPeers = $swarmStats.BytesToLanPeers + $swarmStats.BytesToGroupPeers + $swarmStats.BytesToInternetPeers + $snapInfo.TotalBytesUploaded += $bytesToPeers + if ($bytesToPeers -gt 0) + { + $snapInfo.FilesUploaded++ + } + } + + if ($snapInfo.FilesDownloaded -gt 0) + { + $snapInfo.AverageDownloadSize = $snapInfo.TotalBytesDownloaded / $snapInfo.FilesDownloaded; + } + + if ($snapInfo.FilesUploaded -gt 0) + { + $snapInfo.AverageUploadSize = $snapInfo.TotalBytesUploaded / $snapInfo.FilesUploaded + } + } + return $snapInfo +} + +function Get-DeliveryOptimizationPerfSnapThisMonth +{ + <# + .LINK + https://aka.ms/do-cmdlets + #> + [CmdletBinding()] + [OutputType([DOMonthlyPerfSnap])] + Param() + + $usage = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DOBaseStatus + $downloadUsage = $usage | where {($_.CimClass).CimClassName -eq "MSFT_DODownloadUsage"} + $uploadUsage = $usage | where {($_.CimClass).CimClassName -eq "MSFT_DOUploadUsage"} + + $snapInfo = [DOMonthlyPerfSnap]@{ + UploadLanBytes=$uploadUsage.MonthlyLanBytes + UploadInternetBytes=$uploadUsage.MonthlyInternetBytes + DownloadHttpBytes=$downloadUsage.MonthlyCdnBytes + DownloadCacheHostBytes=$downloadUsage.MonthlyCacheHostBytes + DownloadLanBytes=$downloadUsage.MonthlyLanBytes + DownloadInternetBytes=$downloadUsage.MonthlyInternetBytes + DownloadFgRateKbps=$downloadUsage.MonthlyFrRateBps * 8 / 1Kb + DownloadBgRateKbps=$downloadUsage.MonthlyBkRateBps * 8 / 1Kb + UploadLimitReached=$false + MonthStartDate=Get-Date -Day 1 -Hour 0 -Minute 0 -Second 0 + } + if ($uploadUsage.MonthlyUploadRestriction -ne 0) + { + $snapInfo.MonthlyUploadLimitReached = $true + } + + return $snapInfo +} + +function Get-DODownloadMode +{ + <# + .LINK + https://aka.ms/do-cmdlets + #> + [CmdletBinding()] + [OutputType([DownloadMode])] + Param() + + $config = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DeliveryOptimizationConfig + return [DownloadMode]($config.DownloadMode) +} + +function Get-DOMaxBackgroundBandwidth +{ + <# + .LINK + https://aka.ms/do-cmdlets + #> + [CmdletBinding()] + [OutputType([uint32])] + Param() + + $config = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DeliveryOptimizationConfig + return $config.DownBackLimitBps +} + +function Get-DOMaxForegroundBandwidth +{ + <# + .LINK + https://aka.ms/do-cmdlets + #> + [CmdletBinding()] + [OutputType([uint32])] + Param() + + $config = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DeliveryOptimizationConfig + return $config.DownForeLimitBps +} + +function Get-DOPercentageMaxBackgroundBandwidth +{ + <# + .LINK + https://aka.ms/do-cmdlets + #> + [CmdletBinding()] + [OutputType([uint8])] + Param() + + $config = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DeliveryOptimizationConfig + return $config.DownBackLimitPct +} + +function Get-DOPercentageMaxForegroundBandwidth +{ + <# + .LINK + https://aka.ms/do-cmdlets + #> + [CmdletBinding()] + [OutputType([uint32])] + Param() + + $config = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DeliveryOptimizationConfig + return $config.DownForeLimitPct +} + +function PopulateBaseConfig([DOConfig] $outConfig) +{ + $config = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DeliveryOptimizationConfig -verbose:$false + $outConfig.DownloadMode = $config.DownloadMode + $outConfig.DownloadModeProvider = $config.DownloadModeProvider + $outConfig.DownBackLimitBps = $config.DownBackLimitBps + $outConfig.DownBackLimitBpsProvider = $config.DownBackLimitBpsProvider + $outConfig.DownloadForegroundLimitBps = $config.DownForeLimitBps + $outConfig.DownloadForegroundLimitBpsProvider = $config.DownForeLimitBpsProvider + $outConfig.DownBackLimitPct = $config.DownBackLimitPct + $outConfig.DownBackLimitPctProvider = $config.DownBackLimitPctProvider + $outConfig.DownloadForegroundLimitPct = $config.DownForeLimitPct + $outConfig.DownloadForegroundLimitPctProvider = $config.DownForeLimitPctProvider + $outConfig.MaxUploadRatePct = $config.MaxUploadRatePct + $outConfig.MaxUploadRateProvider = $config.MaxUploadRateProvider + $outConfig.UploadLimitMonthlyGB = $config.UpLimitMonthlyGB + $outConfig.UploadLimitMonthlyGBProvider = $config.UpLimitMonthlyGBProvider +} + +function Get-DOConfig +{ + <# + .LINK + https://aka.ms/do-cmdlets + #> + [CmdletBinding()] + [OutputType([DOConfig],[DOExtendedConfig])] + Param() + + if ($VerbosePreference -ne "SilentlyContinue") + { + $extendedConfig = Get-CimInstance -Namespace $global:DONamespace -ClassName MSFT_DeliveryOptimizationExtendedConfig -verbose:$false + $config = [DOExtendedConfig]@{ + BatteryPctToSeed=$extendedConfig.BatteryPctToSeed + BatteryPctToSeedProvider=$extendedConfig.BatteryPctToSeedProvider + WorkingDirectory=$extendedConfig.WorkingDirectory + WorkingDirectoryProvider=$extendedConfig.WorkingDirectoryProvider + MinTotalDiskSize=$extendedConfig.MinTotalDiskSize + MinTotalDiskSizeProvider=$extendedConfig.MinTotalDiskSizeProvider + MinTotalRAM=$extendedConfig.MinTotalRAM + MinTotalRAMProvider=$extendedConfig.MinTotalRAMProvider + VpnPeerCachingAllowed=$extendedConfig.VpnPeerCachingAllowed + VpnPeerCachingAllowedProvider=$extendedConfig.VpnPeerCachingAllowedProvider + VpnKeywords=$extendedConfig.VpnKeywords + VpnKeywordsProvider=$extendedConfig.VpnKeywordsProvider + } + } + else + { + $config = [DOConfig]@{} + } + PopulateBaseConfig($config) + return $config +} diff --git a/newton-cn/bin/v1.0/Modules/DeliveryOptimization/DeliveryOptimizationVerboseLogs.psm1 b/newton-cn/bin/v1.0/Modules/DeliveryOptimization/DeliveryOptimizationVerboseLogs.psm1 new file mode 100644 index 0000000..a3fda16 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DeliveryOptimization/DeliveryOptimizationVerboseLogs.psm1 @@ -0,0 +1,96 @@ +$g_traceRegRoot = "HKU:\S-1-5-20\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Trace" + +function VerifyIsAdmin() +{ + $principal = New-Object System.Security.Principal.WindowsPrincipal([System.Security.Principal.WindowsIdentity]::GetCurrent()) + if (!$principal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)) + { + throw "The command must run with Administrator privileges" + } +} + +function AttemptRestartIfNeeded([bool] $Force) +{ + $shouldRestart = $false + $svc = Get-Service dosvc + if ($svc.Status -eq "Running") + { + # We run as admin so we know we can restart the service + if ($Force) + { + $shouldRestart = $true + } + else + { + $input = Read-Host "Do you want to restart Delivery Optimization? (this will interrupt active downloads) [y/n]" + switch ($input) + { + {$_.ToLower() -eq "n"} { Write-Host "Changes will take effect the next time the Delivery Optimization service starts."; return } + {$_.ToLower() -eq "y"} { $shouldRestart = $true; break } + } + } + } + + if ($shouldRestart) + { + Stop-Service dosvc + Start-Service dosvc + } + Write-Host "Changes successfully applied." +} + +function Enable-DeliveryOptimizationVerboseLogs +{ + <# + .LINK + https://aka.ms/do-cmdlets + #> + [CmdletBinding()] + Param ( + [Switch] + $Force = $false + ) + VerifyIsAdmin + New-PSDrive -Name HKU -PSProvider Registry -Root Registry::HKEY_USERS | Out-Null + + if (!$(Test-Path $g_traceRegRoot)) + { + New-Item $g_traceRegRoot | Out-Null + } + + $traceFileSize = 150 * 1000 + $traceFolderSize = 200 * 1000 + Write-Host "Setting Delivery Optimization tracing to Verbose and increasing the log limits..." + New-ItemProperty -Path $g_traceRegRoot -Name "TraceLevel_Override" -PropertyType Dword -Value 5 -Force | out-null + New-ItemProperty -Path $g_traceRegRoot -Name "TraceFileSizeKBytes" -PropertyType Dword -Value $traceFileSize -Force | out-null + New-ItemProperty -Path $g_traceRegRoot -Name "TraceFolderSizeKBytes" -PropertyType Dword -Value $traceFolderSize -Force | out-null + AttemptRestartIfNeeded $Force +} + +function Disable-DeliveryOptimizationVerboseLogs +{ + <# + .LINK + https://aka.ms/do-cmdlets + #> + [CmdletBinding()] + Param ( + [Switch] + $Force = $false + ) + + VerifyIsAdmin + New-PSDrive -Name HKU -PSProvider Registry -Root Registry::HKEY_USERS | Out-Null + + if (!$(Test-Path $g_traceRegRoot)) + { + Write-Host "Verbose logging is already disabled, exiting." + return + } + Write-Host "Disabling Delivery Optimization verbose logging..." + Remove-ItemProperty -Path $g_traceRegRoot -Name "TraceLevel_Override" -Force | out-null + Remove-ItemProperty -Path $g_traceRegRoot -Name "TraceFileSizeKBytes" -Force | out-null + Remove-ItemProperty -Path $g_traceRegRoot -Name "TraceFolderSizeKBytes" -Force | out-null + + AttemptRestartIfNeeded $Force +} diff --git a/newton-cn/bin/v1.0/Modules/DeliveryOptimization/Microsoft.Windows.DeliveryOptimization.AdminCommands.dll b/newton-cn/bin/v1.0/Modules/DeliveryOptimization/Microsoft.Windows.DeliveryOptimization.AdminCommands.dll new file mode 100644 index 0000000..6097c26 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/DeliveryOptimization/Microsoft.Windows.DeliveryOptimization.AdminCommands.dll differ diff --git a/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/DirectAccessClientComponents.psd1 b/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/DirectAccessClientComponents.psd1 new file mode 100644 index 0000000..93ff153 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/DirectAccessClientComponents.psd1 @@ -0,0 +1,17 @@ + +@{ + ModuleVersion = '1.0.0.0' + NestedModules = @("MSFT_DASiteTableEntry.cdxml", "MSFT_DAClientExperienceConfiguration.cdxml") + FormatsToProcess = @("MSFT_DASiteTableEntry.format.ps1xml", "MSFT_DAClientExperienceConfiguration.format.ps1xml") + TypesToProcess = @("MSFT_DASiteTableEntry.types.ps1xml", "MSFT_DAClientExperienceConfiguration.types.ps1xml") + HelpInfoUri = "http://go.microsoft.com/fwlink/?LinkID=285546" + GUID = '{244F8FC0-A410-4b87-8237-7496F557E6D4}' + Author = 'Microsoft Corporation' + CompanyName = 'Microsoft Corporation' + PowerShellVersion = '5.1' + Copyright = '© Microsoft Corporation. All rights reserved.' + FunctionsToExport = @("Disable-DAManualEntryPointSelection", "Enable-DAManualEntryPointSelection", "Get-DAClientExperienceConfiguration", "Get-DAEntryPointTableItem", "New-DAEntryPointTableItem", "Remove-DAEntryPointTableItem", "Rename-DAEntryPointTableItem", "Reset-DAClientExperienceConfiguration", "Reset-DAEntryPointTableItem", "Set-DAClientExperienceConfiguration", "Set-DAEntryPointTableItem") + AliasesToExport = @() + CmdletsToExport = @() + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/MSFT_DAClientExperienceConfiguration.cdxml b/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/MSFT_DAClientExperienceConfiguration.cdxml new file mode 100644 index 0000000..5d15f6c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/MSFT_DAClientExperienceConfiguration.cdxml @@ -0,0 +1,191 @@ + + + + 1.0 + DAClientExperienceConfiguration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/MSFT_DAClientExperienceConfiguration.format.ps1xml b/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/MSFT_DAClientExperienceConfiguration.format.ps1xml new file mode 100644 index 0000000..fd6d641 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/MSFT_DAClientExperienceConfiguration.format.ps1xml @@ -0,0 +1,56 @@ + + + + + MSFT_DAClientExperienceConfiguration + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_DAClientExperienceConfiguration + + + + + + + Description + + + CorporateResources + + + IPsecTunnelEndpoints + + + CustomCommands + + + PreferLocalNamesAllowed + + + UserInterface + + + PassiveMode + + + SupportEmail + + + FriendlyName + + + ManualEntryPointSelectionAllowed + + + GslbFqdn + + + ForceTunneling + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/MSFT_DAClientExperienceConfiguration.types.ps1xml b/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/MSFT_DAClientExperienceConfiguration.types.ps1xml new file mode 100644 index 0000000..30b2eb9 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/MSFT_DAClientExperienceConfiguration.types.ps1xml @@ -0,0 +1,18 @@ + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_DAClientExperienceConfiguration + + + ForceTunneling + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.DAClientExperienceConfiguration.ForceTunneling]($this.PSBase.CimInstanceProperties['ForceTunneling'].Value) + + + $this.PSBase.CimInstanceProperties['ForceTunneling'].Value = [System.UInt32]$_ + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/MSFT_DASiteTableEntry.cdxml b/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/MSFT_DASiteTableEntry.cdxml new file mode 100644 index 0000000..46ab2c4 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/MSFT_DASiteTableEntry.cdxml @@ -0,0 +1,333 @@ + + + + 1.0 + DAEntryPointTableItem + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/MSFT_DASiteTableEntry.format.ps1xml b/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/MSFT_DASiteTableEntry.format.ps1xml new file mode 100644 index 0000000..83faf28 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/MSFT_DASiteTableEntry.format.ps1xml @@ -0,0 +1,51 @@ + + + + + MSFT_DASiteTableEntry + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_DASiteTableEntry + Microsoft.Management.Infrastructure.CimInstance#MSFT_DASiteTableEntry + + + + + + + PolicyStore + + + EntryPointName + + + State + + + ADSite + + + TeredoServerIP + + + EntryPointRange + + + EntryPointIPAddress + + + IPHttpsProfile + + + GslbIP + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/MSFT_DASiteTableEntry.types.ps1xml b/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/MSFT_DASiteTableEntry.types.ps1xml new file mode 100644 index 0000000..686c500 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DirectAccessClientComponents/MSFT_DASiteTableEntry.types.ps1xml @@ -0,0 +1,32 @@ + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_DASiteTableEntry + + + State + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.DASiteTableEntry.State]($this.PSBase.CimInstanceProperties['State'].Value) + + + $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_DASiteTableEntry + + + State + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.DASiteTableEntry.State]($this.PSBase.CimInstanceProperties['State'].Value) + + + $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Dism/Dism.Format.ps1xml b/newton-cn/bin/v1.0/Modules/Dism/Dism.Format.ps1xml new file mode 100644 index 0000000..d41d4d7 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Dism/Dism.Format.ps1xml @@ -0,0 +1,745 @@ + + + + BaseDismObjectList + + Microsoft.Dism.Commands.BaseDismObject + + + + + + + LogPath + + + + + + + + ImageObjectList + + Microsoft.Dism.Commands.ImageObject + + + + + + + Path + + + Online + + + RestartNeeded + + + + + + + + ImageObjectWithStateList + + Microsoft.Dism.Commands.ImageObjectWithState + + + + + + + Path + + + Online + + + ImageHealthState + + + RestartNeeded + + + + + + + + EditionObjectList + + Microsoft.Dism.Commands.EditionObject + + + + + + + Edition + + + + + + + + MountedImageInfoObjectList + + Microsoft.Dism.Commands.MountedImageInfoObject + + + + + + + Path + + + ImagePath + + + ImageIndex + + + MountMode + + + MountStatus + + + + + + + + AppxPackageObjectList + + Microsoft.Dism.Commands.AppxPackageObject + + + + + + + DisplayName + + + Version + + + + + $a = "Unknown" + if($_.Architecture -eq 0){ $a="x86" } + elseif($_.Architecture -eq 5) {$a="arm"} + elseif($_.Architecture -eq 9) {$a="x64"} + elseif($_.Architecture -eq 6) {$a="ia64"} + elseif($_.Architecture -eq 11) {$a="neutral"} + return $a + + + + ResourceId + + + PackageName + + + + + $r = "" + if($_.Regions){ $r=$_.Regions } + return $r + + + + + + + + + BasicImageInfoObjectList + + Microsoft.Dism.Commands.BasicImageInfoObject + + + + + + + ImageIndex + + + ImageName + + + ImageDescription + + + + return $_.ImageSize.ToString("N0", [System.Threading.Thread]::CurrentThread.CurrentCulture) + " bytes" + + + + + + + + ImageInfoObjectList + + Microsoft.Dism.Commands.ImageInfoObject + + + + + + + ImageIndex + + + ImageName + + + ImageDescription + + + + return $_.ImageSize.ToString("N0", [System.Threading.Thread]::CurrentThread.CurrentCulture) + " bytes" + + + + + $a = "Unknown" + if($_.Architecture -eq 0){ $a="x86" } + elseif($_.Architecture -eq 5) {$a="arm"} + elseif($_.Architecture -eq 9) {$a="x64"} + elseif($_.Architecture -eq 6) {$a="ia64"} + return $a + + + + Hal + + + Version + + + SPBuild + + + SPLevel + + + EditionId + + + InstallationType + + + ProductType + + + ProductSuite + + + SystemRoot + + + + + $out = "" + $i=0 + foreach($a in $_.Languages) { + $out = $out + $a + if($i -eq $_.DefaultLanguageIndex) { $out=$out+" (Default)"} + if($i -lt ($_.Languages.count-1)) {$out=$out+"`r`n"} + $i=$i+1 + } + return $out; + + + + + + + + + WimImageInfoObjectList + + Microsoft.Dism.Commands.WimImageInfoObject + + + + + + + ImageIndex + + + ImageName + + + ImageDescription + + + + return $_.ImageSize.ToString("N0", [System.Threading.Thread]::CurrentThread.CurrentCulture) + " bytes" + + + WIMBoot + + + + + $a = "Unknown" + if($_.Architecture -eq 0){ $a="x86" } + elseif($_.Architecture -eq 5) {$a="arm"} + elseif($_.Architecture -eq 9) {$a="x64"} + elseif($_.Architecture -eq 6) {$a="ia64"} + return $a + + + + Hal + + + Version + + + SPBuild + + + SPLevel + + + EditionId + + + InstallationType + + + ProductType + + + ProductSuite + + + SystemRoot + + + DirectoryCount + + + FileCount + + + CreatedTime + + + ModifiedTime + + + + + $out = "" + $i=0 + foreach($a in $_.Languages) { + $out = $out + $a + if($i -eq $_.DefaultLanguageIndex) { $out=$out+" (Default)"} + if($i -lt ($_.Languages.count-1)) {$out=$out+"`r`n"} + $i=$i+1 + } + return $out; + + + + + + + + + BasicFeatureObjectList + + Microsoft.Dism.Commands.BasicFeatureObject + + + + + + + FeatureName + + + State + + + + + + + + AdvancedFeatureObjectList + + Microsoft.Dism.Commands.AdvancedFeatureObject + + + + + + + FeatureName + + + DisplayName + + + Description + + + RestartRequired + + + State + + + + + $a = "`r`n" + $_.CustomProperties | foreach { $a = $a + $_.Path + "\" + $_.Name + " : " + $_.Value + "`r`n" } + return $a + + + + + + + + + BasicPackageObjectList + + Microsoft.Dism.Commands.BasicPackageObject + + + + + + + PackageName + + + PackageState + + + ReleaseType + + + + + if ([System.DateTime]::Equals($_.InstallTime,[System.DateTime]::MinValue)) { return "" } else { return $_.InstallTime } + + + + + + + + + AdvancedPackageObjectList + + Microsoft.Dism.Commands.AdvancedPackageObject + + + + + + + PackageName + + + Applicable + + + Copyright + + + Company + + + + + if ([System.DateTime]::Equals($_.CreationTime,[System.DateTime]::MinValue)) { return "" } else { return $_.CreationTime } + + + + Description + + + InstallClient + + + InstallPackageName + + + + + if ([System.DateTime]::Equals($_.InstallTime,[System.DateTime]::MinValue)) { return "" } else { return $_.InstallTime } + + + + + + if ([System.DateTime]::Equals($_.LastUpdateTime,[System.DateTime]::MinValue)) { return "" } else { return $_.LastUpdateTime } + + + + DisplayName + + + ProductName + + + ProductVersion + + + ReleaseType + + + RestartRequired + + + SupportInformation + + + PackageState + + + CompletelyOfflineCapable + + + CapabilityId + + + + + $a = "`r`n" + $_.CustomProperties | foreach { $a = $a + $_.Path + "\" + $_.Name + " : " + $_.Value + "`r`n" } + return $a + + + + Features + + + + + + + + BasicCapabilityObjectList + + Microsoft.Dism.Commands.BasicCapabilityObject + + + + + + + Name + + + State + + + + + + + + AdvancedCapabilityObjectList + + Microsoft.Dism.Commands.AdvancedCapabilityObject + + + + + + + Name + + + State + + + DisplayName + + + Description + + + DownloadSize + + + InstallSize + + + + + + + + BasicDriverObjectList + + Microsoft.Dism.Commands.BasicDriverObject + + + + + + + Driver + + + OriginalFileName + + + InBox + + + ClassName + + + BootCritical + + + ProviderName + + + + + if ([System.DateTime]::Equals($_.Date,[System.DateTime]::MinValue)) { return "" } else { return $_.Date } + + + + Version + + + + + + + + AdvancedDriverObjectList + + Microsoft.Dism.Commands.AdvancedDriverObject + + + + + + + Driver + + + OriginalFileName + + + InBox + + + ClassName + + + ClassDescription + + + ClassGuid + + + BootCritical + + + ProviderName + + + + + if ([System.DateTime]::Equals($_.Date,[System.DateTime]::MinValue)) { return "" } else { return $_.Date } + + + + Version + + + ManufacturerName + + + HardwareDescription + + + + + $a = "Unknown" + if($_.Architecture -eq 0){ $a="x86" } + elseif($_.Architecture -eq 5) {$a="arm"} + elseif($_.Architecture -eq 9) {$a="x64"} + elseif($_.Architecture -eq 6) {$a="ia64"} + return $a + + + + HardwareId + + + ServiceName + + + CompatibleIds + + + ExcludeIds + + + + + + + + WimBootEntryObjectList + + Microsoft.Dism.Commands.WimBootEntryObject + + + + + + + DataSourceID + + + ImageFile + + + + + + + + ReservedStorageStateObjectList + + Microsoft.Dism.Commands.ReservedStorageStateObject + + + + + + + ReservedStorageState + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Dism/Dism.Types.ps1xml b/newton-cn/bin/v1.0/Modules/Dism/Dism.Types.ps1xml new file mode 100644 index 0000000..4b2802b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Dism/Dism.Types.ps1xml @@ -0,0 +1,586 @@ + + + + Microsoft.Dism.Commands.BasicImageInfoObject + + + PsStandardMembers + + + DefaultDisplayProperty + ImagePath + + + DefaultDisplayPropertySet + + ImagePath + ImageName + ImageIndex + ImageDescription + ImageSize + + + + DefaultKeyPropertySet + + ImagePath + + + + + + + + Microsoft.Dism.Commands.ImageInfoObject + + + Version + "{0}.{1}.{2}.{3}" -f $this.MajorVersion, $this.MinorVersion, $this.Build, $this.SPBuild + + + PsStandardMembers + + + DefaultDisplayProperty + ImagePath + + + DefaultDisplayPropertySet + + ImagePath + ImageName + ImageIndex + ImageDescription + ImageSize + Architecture + ProductName + EditionId + InstallationType + Hal + ProductType + ProductSuite + Version + SPLevel + SystemRoot + Languages + DefaultLanguageIndex + + + + DefaultKeyPropertySet + + ImagePath + + + + + + + + Microsoft.Dism.Commands.WimImageInfoObject + + + Version + "{0}.{1}.{2}.{3}" -f $this.MajorVersion, $this.MinorVersion, $this.Build, $this.SPBuild + + + PsStandardMembers + + + DefaultDisplayProperty + ImagePath + + + DefaultDisplayPropertySet + + ImagePath + ImageName + ImageIndex + ImageDescription + ImageSize + WIMBoot + Architecture + ProductName + EditionId + InstallationType + Hal + ProductType + ProductSuite + Version + SPLevel + SystemRoot + Languages + DefaultLanguageIndex + DirectoryCount + FileCount + CreatedTime + ModifiedTime + + + + DefaultKeyPropertySet + + ImagePath + + + + + + + + Microsoft.Dism.Commands.ImageObject + + + PsStandardMembers + + + DefaultDisplayProperty + Path + + + DefaultDisplayPropertySet + + Path + Online + + + + DefaultKeyPropertySet + + Path + + + + + + + + Microsoft.Dism.Commands.MountedImageInfoObject + + + MountPath + Path + + + PsStandardMembers + + + DefaultDisplayProperty + MountPath + + + DefaultDisplayPropertySet + + MountPath + ImagePath + ImageIndex + MountMode + MountStatus + + + + DefaultKeyPropertySet + + MountPath + + + + + + + + Microsoft.Dism.Commands.BasicPackageObject + + + PsStandardMembers + + + DefaultDisplayProperty + PackageName + + + DefaultDisplayPropertySet + + PackageName + PackageState + ReleaseType + InstallTime + + + + DefaultKeyPropertySet + + PackageName + + + + + + + + Microsoft.Dism.Commands.BasicCapabilityObject + + + PsStandardMembers + + + DefaultDisplayProperty + Name + + + DefaultDisplayPropertySet + + Name + State + + + + DefaultKeyPropertySet + + Name + + + + + + + + Microsoft.Dism.Commands.AdvancedPackageObject + + + PsStandardMembers + + + DefaultDisplayProperty + PackageName + + + DefaultDisplayPropertySet + + PackageName + PackageState + ReleaseType + InstallTime + Applicable + Copyright + Company + CreationTime + DisplayName + Description + InstallClient + InstallPackageName + LastUpdateTime + ProductName + ProductVersion + RestartRequired + CompletelyOfflineCapable + CapabilityId + SupportInformation + CustomProperties + Features + + + + DefaultKeyPropertySet + + PackageName + + + + + + + + Microsoft.Dism.Commands.AdvancedCapabilityObject + + + PsStandardMembers + + + DefaultDisplayProperty + Name + + + DefaultDisplayPropertySet + + Name + State + DisplayName + Description + DownloadSize + InstallSize + + + + DefaultKeyPropertySet + + Name + + + + + + + + Microsoft.Dism.Commands.ImageObjectWithState + + + PsStandardMembers + + + DefaultDisplayProperty + ImageHealthState + + + DefaultDisplayPropertySet + + ImageHealthState + + + + DefaultKeyPropertySet + + ImageHealthState + + + + + + + + Microsoft.Dism.Commands.BasicFeatureObject + + + PsStandardMembers + + + DefaultDisplayProperty + FeatureName + + + DefaultDisplayPropertySet + + FeatureName + State + + + + DefaultKeyPropertySet + + FeatureName + + + + + + + + Microsoft.Dism.Commands.AdvancedFeatureObject + + + PsStandardMembers + + + DefaultDisplayProperty + FeatureName + + + DefaultDisplayPropertySet + + FeatureName + State + DisplayName + Description + RestartRequired + CustomProperties + + + + DefaultKeyPropertySet + + FeatureName + + + + + + + + Microsoft.Dism.Commands.EditionObject + + + PsStandardMembers + + + DefaultDisplayProperty + Edition + + + DefaultDisplayPropertySet + + Edition + + + + DefaultKeyPropertySet + + Edition + + + + + + + + Microsoft.Dism.Commands.BasicDriverObject + + + Version + "{0}.{1}.{2}.{3}" -f $this.MajorVersion, $this.MinorVersion, $this.Build, $this.Revision + + + PsStandardMembers + + + DefaultDisplayProperty + Driver + + + DefaultDisplayPropertySet + + Driver + OriginalFileName + InBox + CatalogFile + ClassName + ClassGuid + ClassDescription + BootCritical + DriverSignature + ProviderName + Date + Version + + + + DefaultKeyPropertySet + + Driver + + + + + + + + Microsoft.Dism.Commands.AdvancedDriverObject + + + Version + "{0}.{1}.{2}.{3}" -f $this.MajorVersion, $this.MinorVersion, $this.Build, $this.Revision + + + PsStandardMembers + + + DefaultDisplayProperty + Driver + + + DefaultDisplayPropertySet + + Driver + OriginalFileName + InBox + CatalogFile + ClassName + ClassGuid + ClassDescription + BootCritical + DriverSignature + ProviderName + Date + Version + ManufacturerName + HardwareDescription + HardwareId + Architecture + ServiceName + CompatibleIds + ExcludeIds + + + + DefaultKeyPropertySet + + Driver + + + + + + + + Microsoft.Dism.Commands.AppxPackageObject + + + Version + "{0}.{1}.{2}.{3}" -f $this.MajorVersion, $this.MinorVersion, $this.Build, $this.Revision + + + PsStandardMembers + + + DefaultDisplayProperty + DisplayName + + + DefaultDisplayPropertySet + + DisplayName + PackageName + PublisherId + Version + Architecture + ResourceId + InstallLocation + Region + + + + DefaultKeyPropertySet + + DisplayName + + + + + + + + Microsoft.Dism.Commands.ReservedStorageStateObject + + + PsStandardMembers + + + DefaultDisplayProperty + ReservedStorageState + + + DefaultDisplayPropertySet + + ReservedStorageState + + + + DefaultKeyPropertySet + + ReservedStorageState + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Dism/Dism.psd1 b/newton-cn/bin/v1.0/Modules/Dism/Dism.psd1 new file mode 100644 index 0000000..896d5aa --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Dism/Dism.psd1 @@ -0,0 +1,86 @@ +@{ + GUID = "{389c464d-8b8d-48e9-aafe-6d8a590d6798}" + Author = "Microsoft Corporation" + CompanyName = "Microsoft Corporation" + Copyright = "© Microsoft Corporation. All rights reserved." + HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=390767" + ModuleVersion = "3.0" + PowerShellVersion = "5.1" + ClrVersion = "4.0" + RootModule = "Dism.psm1" + NestedModules = "Microsoft.Dism.PowerShell.dll" + TypesToProcess = "Dism.Types.ps1xml" + FormatsToProcess = "Dism.Format.ps1xml" + CmdletsToExport = @( + 'Add-AppxProvisionedPackage', + 'Add-WindowsDriver', + 'Add-WindowsCapability', + 'Add-WindowsImage', + 'Add-WindowsPackage', + 'Clear-WindowsCorruptMountPoint', + 'Disable-WindowsOptionalFeature', + 'Dismount-WindowsImage', + 'Enable-WindowsOptionalFeature', + 'Expand-WindowsImage', + 'Expand-WindowsCustomDataImage', + 'Export-WindowsCapabilitySource', + 'Export-WindowsDriver', + 'Export-WindowsImage', + 'Get-AppxProvisionedPackage', + 'Get-NonRemovableAppsPolicy', + 'Get-WIMBootEntry', + 'Get-WindowsDriver', + 'Get-WindowsEdition', + 'Get-WindowsCapability', + 'Get-WindowsImage', + 'Get-WindowsImageContent' + 'Get-WindowsOptionalFeature', + 'Get-WindowsPackage', + 'Get-WindowsReservedStorageState', + 'Mount-WindowsImage', + 'New-WindowsImage', + 'New-WindowsCustomImage', + 'Optimize-AppxProvisionedPackages', + 'Optimize-WindowsImage', + 'Remove-AppxProvisionedPackage', + 'Remove-WindowsDriver', + 'Remove-WindowsCapability', + 'Remove-WindowsImage', + 'Remove-WindowsPackage', + 'Repair-WindowsImage', + 'Save-WindowsImage', + 'Set-AppXProvisionedDataFile', + 'Set-NonRemovableAppsPolicy', + 'Set-WindowsEdition', + 'Set-WindowsProductKey', + 'Set-WindowsReservedStorageState', + 'Start-OSUninstall', + 'Split-WindowsImage', + 'Use-WindowsUnattend', + 'Update-WIMBootEntry' + ) + AliasesToExport = @( + 'Apply-WindowsUnattend', + 'Add-ProvisionedAppxPackage', + 'Remove-ProvisionedAppxPackage', + 'Get-ProvisionedAppxPackage', + 'Optimize-ProvisionedAppxPackages', + 'Set-ProvisionedAppXDataFile', + 'Add-AppProvisionedPackage', + 'Remove-AppProvisionedPackage', + 'Get-AppProvisionedPackage', + 'Optimize-AppProvisionedPackages', + 'Set-AppPackageProvisionedDataFile', + 'Add-ProvisionedAppPackage', + 'Remove-ProvisionedAppPackage', + 'Get-ProvisionedAppPackage', + 'Optimize-ProvisionedAppPackages', + 'Set-ProvisionedAppPackageDataFile' + ) + FunctionsToExport = @( + ) + CompatiblePSEditions = @( + 'Desktop', + 'Core' + ) +} diff --git a/newton-cn/bin/v1.0/Modules/Dism/Dism.psm1 b/newton-cn/bin/v1.0/Modules/Dism/Dism.psm1 new file mode 100644 index 0000000..de2b93d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Dism/Dism.psm1 @@ -0,0 +1,30 @@ +# +# Script Module file for Dism module. +# +# Copyright (c) Microsoft Corporation +# + +# +# Cmdlet aliases +# + +Set-Alias Apply-WindowsUnattend Use-WindowsUnattend +Set-Alias Add-ProvisionedAppxPackage Add-AppxProvisionedPackage +Set-Alias Remove-ProvisionedAppxPackage Remove-AppxProvisionedPackage +Set-Alias Get-ProvisionedAppxPackage Get-AppxProvisionedPackage +Set-Alias Optimize-ProvisionedAppxPackages Optimize-AppxProvisionedPackages +Set-Alias Set-ProvisionedAppXDataFile Set-AppXProvisionedDataFile + +# Below are aliases for Appx related cmdlets and aliases +Set-Alias Add-AppProvisionedPackage Add-AppxProvisionedPackage +Set-Alias Remove-AppProvisionedPackage Remove-AppxProvisionedPackage +Set-Alias Get-AppProvisionedPackage Get-AppxProvisionedPackage +Set-Alias Optimize-AppProvisionedPackages Optimize-AppxProvisionedPackages +Set-Alias Set-AppPackageProvisionedDataFile Set-AppXProvisionedDataFile +Set-Alias Add-ProvisionedAppPackage Add-AppxProvisionedPackage +Set-Alias Remove-ProvisionedAppPackage Remove-AppxProvisionedPackage +Set-Alias Get-ProvisionedAppPackage Get-AppxProvisionedPackage +Set-Alias Optimize-ProvisionedAppPackages Optimize-AppxProvisionedPackages +Set-Alias Set-ProvisionedAppPackageDataFile Set-AppXProvisionedDataFile + +Export-ModuleMember -Alias * -Function * -Cmdlet * diff --git a/newton-cn/bin/v1.0/Modules/Dism/Microsoft.Dism.PowerShell.dll b/newton-cn/bin/v1.0/Modules/Dism/Microsoft.Dism.PowerShell.dll new file mode 100644 index 0000000..c85582e Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/Dism/Microsoft.Dism.PowerShell.dll differ diff --git a/newton-cn/bin/v1.0/Modules/Dism/ko/Microsoft.Dism.Powershell.Resources.dll b/newton-cn/bin/v1.0/Modules/Dism/ko/Microsoft.Dism.Powershell.Resources.dll new file mode 100644 index 0000000..43797b7 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/Dism/ko/Microsoft.Dism.Powershell.Resources.dll differ diff --git a/newton-cn/bin/v1.0/Modules/DnsClient/DnsClient.psd1 b/newton-cn/bin/v1.0/Modules/DnsClient/DnsClient.psd1 new file mode 100644 index 0000000..680938c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DnsClient/DnsClient.psd1 @@ -0,0 +1,53 @@ +@{ + GUID = "5696d5ef-fa2d-4997-94f1-0bc13daa2ac5" + Author = "Microsoft Corporation" + CompanyName = "Microsoft Corporation" + Copyright = "© Microsoft Corporation. All rights reserved." + ModuleVersion = "1.0.0.0" + PowerShellVersion = '5.1' + ClrVersion = "4.0" + NestedModules = @( + "dnslookup", + "MSFT_DnsClient.cdxml", + "MSFT_DnsClientCache.cdxml", + "MSFT_DnsClientGlobalSetting.cdxml", + "MSFT_DnsClientServerAddress.cdxml", + "PS_DnsClientNrptPolicy_v1.0.0.cdxml", + "PS_DnsClientNRPTGlobal_v1.0.0.cdxml", + "PS_DnsClientNRPTRule_v1.0.0.cdxml" + ) + TypesToProcess = @( + "DnsCmdlets.Types.ps1xml", + "DnsConfig.Types.ps1xml", + "DnsClientPSProvider.Types.ps1xml" + ) + FormatsToProcess = @( + "DnsCmdlets.Format.ps1xml", + "DnsConfig.Format.ps1xml", + "DnsClientPSProvider.Format.ps1xml" + ) + CmdletsToExport = @( + "Resolve-DnsName" + ) + FunctionsToExport = @( + "Clear-DnsClientCache", + "Get-DnsClient", + "Get-DnsClientCache", + "Get-DnsClientGlobalSetting", + "Get-DnsClientServerAddress", + "Register-DnsClient", + "Set-DnsClient", + "Set-DnsClientGlobalSetting", + "Set-DnsClientServerAddress", + "Add-DnsClientNrptRule", + "Get-DnsClientNrptPolicy", + "Get-DnsClientNrptGlobal", + "Get-DnsClientNrptRule", + "Remove-DnsClientNrptRule", + "Set-DnsClientNrptGlobal", + "Set-DnsClientNrptRule" + ) + AliasesToExport = @() + HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=390768" + CompatiblePSEditions = @('Desktop','Core') +} diff --git a/newton-cn/bin/v1.0/Modules/DnsClient/DnsClientPSProvider.Format.ps1xml b/newton-cn/bin/v1.0/Modules/DnsClient/DnsClientPSProvider.Format.ps1xml new file mode 100644 index 0000000..cd26b7b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DnsClient/DnsClientPSProvider.Format.ps1xml @@ -0,0 +1,350 @@ + + + + + + + + DnsClientNRPTRule_ListView + + Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule + + + + + + + Name + + + Version + + + Namespace + + + IPsecCARestriction + + + DirectAccessDnsServers + + + DirectAccessEnabled + + + DirectAccessProxyType + + + DirectAccessProxyName + + + DirectAccessQueryIPsecEncryption + + + DirectAccessQueryIPsecRequired + + + NameServers + + + DnsSecEnabled + + + DnsSecQueryIPsecEncryption + + + DnsSecQueryIPsecRequired + + + DnsSecValidationRequired + + + NameEncoding + + + DisplayName + + + Comment + + + + + + + + DnsClientNRPTRule_TableView + + Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule + + + + + + 25 + + + + 6 + + + + 30 + + + + 6 + + + + 35 + + + + 20 + + + + + + + Namespace + + + DirectAccessEnabled + + + DirectAccessDnsServers + + + DnsSecEnabled + + + NameServers + + + NameEncoding + + + + + + + + DnsClientNRPTRule_WideView + + Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule + + + + + + Namespace + + + + + + + + + DnsClientNRPTGlobal_TableView + + Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptGlobal + + + + + + + + + EnableDAForAllNetworks + + + QueryPolicy + + + SecureNameQueryFallback + + + + + + + + + DnsClientNRPTGlobal_ListView + + Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptGlobal + + + + + + + EnableDAForAllNetworks + + + QueryPolicy + + + SecureNameQueryFallback + + + + + + + + + DnsClientPolicyConfiguration_ListView + + Microsoft.Management.Infrastructure.CimInstance#DnsClientPolicyConfiguration + + + + + + + Namespace + + + QueryPolicy + + + SecureNameQueryFallback + + + DirectAccessIPsecCARestriction + + + DirectAccessProxyName + + + DirectAccessDnsServers + + + DirectAccessEnabled + + + DirectAccessProxyType + + + DirectAccessQueryIPsecEncryption + + + DirectAccessQueryIPsecRequired + + + NameServers + + + DnsSecIPsecCARestriction + + + DnsSecQueryIPsecEncryption + + + DnsSecQueryIPsecRequired + + + DnsSecValidationRequired + + + NameEncoding + + + + + + + + DnsClientPolicyConfiguration_TableView + + Microsoft.Management.Infrastructure.CimInstance#DnsClientPolicyConfiguration + + + + + + 25 + + + + 6 + + + + 30 + + + + 6 + + + + 35 + + + + 20 + + + + + + + Namespace + + + DirectAccessEnabled + + + DirectAccessDnsServers + + + DnsSecValidationRequired + + + NameServers + + + NameEncoding + + + + + + + + DnsClientPolicyConfiguration_WideView + + Microsoft.Management.Infrastructure.CimInstance#DnsClientPolicyConfiguration + + + + + + Namespace + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/DnsClient/DnsClientPSProvider.Types.ps1xml b/newton-cn/bin/v1.0/Modules/DnsClient/DnsClientPSProvider.Types.ps1xml new file mode 100644 index 0000000..7f844e2 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DnsClient/DnsClientPSProvider.Types.ps1xml @@ -0,0 +1,100 @@ + + + + + Microsoft.Management.Infrastructure.CimInstance#DnsClientNrptRule + + + DA + DirectAccessEnabled + + + DADnsServers + DirectAccessDnsServers + + + DnsSec + DnsSecEnabled + + + DirectAccessDnsServers + + [OutputType([System.Net.IPAddress[]])] + param() + [System.Net.IPAddress[]]($this.PSBase.CimInstanceProperties['DirectAccessDnsServers'].Value) + + + param([System.Net.IPAddress[]]$value) + $this.PSBase.CimInstanceProperties['DirectAccessDnsServers'].Value = [System.String[]]$value + + + + NameServers + + [OutputType([System.Net.IPAddress[]])] + param() + [System.Net.IPAddress[]]($this.PSBase.CimInstanceProperties['NameServers'].Value) + + + param([System.Net.IPAddress[]]$value) + $this.PSBase.CimInstanceProperties['NameServers'].Value = [System.String[]]$value + + + + + + Microsoft.Management.Infrastructure.CimInstance#DnsClientPolicyConfiguration + + + DA + DirectAccessEnabled + + + DADnsServers + DirectAccessDnsServers + + + DnsSec + DnsSecValidationRequired + + + DirectAccessDnsServers + + [OutputType([System.Net.IPAddress[]])] + param() + [System.Net.IPAddress[]]($this.PSBase.CimInstanceProperties['DirectAccessDnsServers'].Value) + + + param([System.Net.IPAddress[]]$value) + $this.PSBase.CimInstanceProperties['DirectAccessDnsServers'].Value = [System.String[]]$value + + + + NameServers + + [OutputType([System.Net.IPAddress[]])] + param() + [System.Net.IPAddress[]]($this.PSBase.CimInstanceProperties['NameServers'].Value) + + + param([System.Net.IPAddress[]]$value) + $this.PSBase.CimInstanceProperties['NameServers'].Value = [System.String[]]$value + + + + + diff --git a/newton-cn/bin/v1.0/Modules/DnsClient/DnsCmdlets.Format.ps1xml b/newton-cn/bin/v1.0/Modules/DnsClient/DnsCmdlets.Format.ps1xml new file mode 100644 index 0000000..b9da15f --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DnsClient/DnsCmdlets.Format.ps1xml @@ -0,0 +1,1748 @@ + + + + + + Microsoft.DnsClient.Commands.DnsRecord + + Microsoft.DnsClient.Commands.DnsRecord + + + + + + + left + + + + 6 + left + + + + 5 + left + + + + 10 + left + + + + + + + + Name + + + Type + + + TTL + + + Section + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord + + Microsoft.DnsClient.Commands.DnsRecord + + + + + + + Name + + + + Type + + + TTL + + + DataLength + + + Section + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_A_AAAA + + Microsoft.DnsClient.Commands.DnsRecord_A + Microsoft.DnsClient.Commands.DnsRecord_AAAA + + + + + + + 46 + left + + + + 6 + left + + + + 5 + left + + + + 10 + left + + + + 41 + left + + + + + + + + Name + + + Type + + + TTL + + + Section + + + IPAddress + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_A_AAAA + + Microsoft.DnsClient.Commands.DnsRecord_A + Microsoft.DnsClient.Commands.DnsRecord_AAAA + + + + + + + Name + + + + Type + + + TTL + + + DataLength + + + Section + + + IPAddress + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_PTR + + Microsoft.DnsClient.Commands.DnsRecord_PTR + + + + + + 30 + left + + + + 6 + left + + + + 5 + left + + + + 10 + left + + + + + left + + + + + + + + Name + + + Type + + + TTL + + + Section + + + NameHost + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_PTR + + Microsoft.DnsClient.Commands.DnsRecord_PTR + + + + + + + Name + + + + Type + + + TTL + + + Section + + + NameHost + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_MX + + Microsoft.DnsClient.Commands.DnsRecord_MX + + + + + + 40 + left + + + + 6 + left + + + + 5 + left + + + + 10 + left + + + + 41 + left + + + + 41 + left + + + + + + + + Name + + + Type + + + TTL + + + Section + + + NameExchange + + + Preference + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_MX + + Microsoft.DnsClient.Commands.DnsRecord_MX + + + + + + + Name + + + + Type + + + TTL + + + NameExchange + + + Preference + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_SOA + + Microsoft.DnsClient.Commands.DnsRecord_SOA + + + + + + 27 + left + + + + 4 + left + + + + 5 + left + + + + 10 + left + + + + 27 + left + + + + 27 + left + + + + 12 + left + + + + + + + + Name + + + Type + + + TTL + + + Section + + + PrimaryServer + + + NameAdministrator + + + SerialNumber + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_SOA + + Microsoft.DnsClient.Commands.DnsRecord_SOA + + + + + + + Name + + + + Type + + + TTL + + + PrimaryServer + + + NameAdministrator + + + SerialNumber + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_MINFO + + Microsoft.DnsClient.Commands.DnsRecord_MINFO + + + + + + 40 + left + + + + 6 + left + + + + 5 + left + + + + 10 + left + + + + 20 + left + + + + 20 + left + + + + + + + + Name + + + Type + + + TTL + + + Section + + + NameMailbox + + + NameErrorsMailbox + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_MINFO + + Microsoft.DnsClient.Commands.DnsRecord_MINFO + + + + + + + Name + + + + Type + + + TTL + + + NameMailbox + + + NameErrorsMailbox + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_TXT + + Microsoft.DnsClient.Commands.DnsRecord_TXT + + + + + + 40 + left + + + + 6 + left + + + + 5 + left + + + + 10 + left + + + + 41 + left + + + + + + + + Name + + + Type + + + TTL + + + Section + + + Strings + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_TXT + + Microsoft.DnsClient.Commands.DnsRecord_TXT + + + + + + + Name + + + + Type + + + TTL + + + Strings + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_NULL + + Microsoft.DnsClient.Commands.DnsRecord_NULL + + + + + + 40 + left + + + + 6 + left + + + + 5 + left + + + + 10 + left + + + + 41 + left + + + + + + + + Name + + + Type + + + TTL + + + Section + + + Data + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_NULL + + Microsoft.DnsClient.Commands.DnsRecord_NULL + + + + + + + Name + + + + Type + + + TTL + + + Data + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_WKS + + Microsoft.DnsClient.Commands.DnsRecord_WKS + + + + + + 40 + left + + + + 6 + left + + + + 5 + left + + + + 10 + left + + + + 16 + left + + + + 8 + left + + + + left + + + + + + + + Name + + + Type + + + TTL + + + Section + + + IP4Address + + + Protocol + + + Bitmask + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_WKS + + Microsoft.DnsClient.Commands.DnsRecord_WKS + + + + + + + Name + + + + Type + + + TTL + + + IP4Address + + + Protocol + + + + + $output = "{" + $_.Bitmask | foreach { $output = $output + $_ + ", " } + $output = $output.TrimEnd(", ") + "}" + echo $output + + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_SRV + + Microsoft.DnsClient.Commands.DnsRecord_SRV + + + + + + 40 + left + + + + 6 + left + + + + 5 + left + + + + 10 + left + + + + 30 + left + + + + 8 + left + + + + 6 + left + + + + 4 + left + + + + + + + + Name + + + Type + + + TTL + + + Section + + + NameTarget + + + Priority + + + Weight + + + Port + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_SRV + + Microsoft.DnsClient.Commands.DnsRecord_SRV + + + + + + + Name + + + + Type + + + TTL + + + NameTarget + + + Priority + + + Weight + + + Port + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_DS + + Microsoft.DnsClient.Commands.DnsRecord_DS + + + + + + 40 + left + + + + 6 + left + + + + 5 + left + + + + 10 + left + + + + 5 + left + + + + 14 + left + + + + 4 + left + + + + left + + + + + + + Name + + + Type + + + TTL + + + Section + + + KeyTag + + + Algorithm + + + DType + + + Digest + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_DS + + Microsoft.DnsClient.Commands.DnsRecord_DS + + + + + + + Name + + + + Type + + + TTL + + + Section + + + KeyTag + + + Algorithm + + + DType + + + Digest + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_WINS + + Microsoft.DnsClient.Commands.DnsRecord_WINS + + + + + + 40 + left + + + + 6 + left + + + + 5 + left + + + + 10 + left + + + + 11 + left + + + + left + + + + + + + + Name + + + Type + + + TTL + + + Section + + + MappingFlag + + + IP4Addresses + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_WINS + + Microsoft.DnsClient.Commands.DnsRecord_WINS + + + + + + + Name + + + + Type + + + TTL + + + MappingFlag + + + LookupTimeout + + + CacheTimeout + + + + + $output = "{" + $_.IP4Addresses | foreach { $output = $output + $_ + ", " } + $output = $output.TrimEnd(", ") + "}" + echo $output + + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_DNSKEY + + Microsoft.DnsClient.Commands.DnsRecord_DNSKEY + + + + + + 40 + left + + + + 6 + left + + + + 5 + left + + + + 10 + left + + + + 6 + left + + + + 8 + left + + + + 14 + left + + + + 20 + left + + + + + + + + Name + + + Type + + + TTL + + + Section + + + Flags + + + Protocol + + + Algorithm + + + Key + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_DNSKEY + + Microsoft.DnsClient.Commands.DnsRecord_DNSKEY + + + + + + + Name + + + + Type + + + TTL + + + Section + + + Flags + + + Protocol + + + Algorithm + + + + + $output = "{" + $_.Key | foreach { $output = $output + $_ + ", " } + $output = $output.TrimEnd(", ") + "}" + echo $output + + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_RRSIG + + Microsoft.DnsClient.Commands.DnsRecord_RRSIG + + + + + + + Name + + + + Type + + + TTL + + + TypeCovered + + + Algorithm + + + LabelCount + + + OriginalTtl + + + Expiration + + + Signed + + + KeyTag + + + Signer + + + + + $output = "{" + $_.Signature | foreach { $output = $output + $_ + ", " } + $output = $output.TrimEnd(", ") + "}" + echo $output + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_RRSIG + + Microsoft.DnsClient.Commands.DnsRecord_RRSIG + + + + + + 30 + left + + + + 5 + left + + + + 4 + left + + + + 8 + left + + + + 14 + left + + + + 10 + left + + + + 10 + left + + + + 20 + left + + + + left + + + + + + + + Name + + + Type + + + TTL + + + TypeCovered + + + Algorithm + + + Expiration + + + Signed + + + Signer + + + Signature + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_NSEC + + Microsoft.DnsClient.Commands.DnsRecord_NSEC + + + + + + 40 + left + + + + 6 + left + + + + 5 + left + + + + 10 + left + + + + 41 + left + + + + left + + + + + + + + Name + + + Type + + + TTL + + + Section + + + NextDomainName + + + TypeBitMap + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_NSEC + + Microsoft.DnsClient.Commands.DnsRecord_NSEC + + + + + + + Name + + + + Type + + + TTL + + + Section + + + NextDomainName + + + + + $output = "{" + $_.TypeBitMap | foreach { $output = $output + $_ + ", " } + $output = $output.TrimEnd(", ") + "}" + echo $output + + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_DHCID + + Microsoft.DnsClient.Commands.DnsRecord_DHCID + + + + + + 40 + left + + + + 6 + left + + + + 5 + left + + + + 10 + left + + + + left + + + + + + + + Name + + + Type + + + TTL + + + Section + + + Dhcid + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_DHCID + + Microsoft.DnsClient.Commands.DnsRecord_DHCID + + + + + + + Name + + + + Type + + + TTL + + + Section + + + Dhcid + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_OPT + + Microsoft.DnsClient.Commands.DnsRecord_Default + Microsoft.DnsClient.Commands.DnsRecord_OPT + + + + + + 40 + left + + + + 6 + left + + + + 5 + left + + + + 10 + left + + + + left + + + + + + + + Name + + + Type + + + TTL + + + Section + + + Data + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_OPT + + Microsoft.DnsClient.Commands.DnsRecord_OPT + + + + + + + Name + + + + Type + + + TTL + + + Section + + + Protocol + + + Data + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/DnsClient/DnsCmdlets.Types.ps1xml b/newton-cn/bin/v1.0/Modules/DnsClient/DnsCmdlets.Types.ps1xml new file mode 100644 index 0000000..784b0ce --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DnsClient/DnsCmdlets.Types.ps1xml @@ -0,0 +1,699 @@ + + + + + Microsoft.DnsClient.Commands.DnsRecord + + + QueryType + Type + + + PsStandardMembers + + + DefaultDisplayPropertySet + + Name + QueryType + TTL + Section + + + + DefaultDisplayProperty + Name + + + DefaultKeyPropertySet + + Name + QueryType + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_A + + + Address + IP4Address + + + IPAddress + IP4Address + + + QueryType + Type + + + PsStandardMembers + + + DefaultDisplayPropertySet + + Name + QueryType + TTL + Section + IP4Address + + + + DefaultDisplayProperty + PrimaryDomainSuffix + + + DefaultKeyPropertySet + + IP4Address + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_AAAA + + + Address + IP6Address + + + IPAddress + IP6Address + + + QueryType + Type + + + PsStandardMembers + + + DefaultDisplayPropertySet + + Name + QueryType + TTL + Section + IP6Address + + + + DefaultDisplayProperty + IP6Address + + + DefaultKeyPropertySet + + IP6Address + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_TXT + + + Text + Strings + + + PsStandardMembers + + + DefaultDisplayPropertySet + + Name + QueryType + TTL + Section + Strings + + + + DefaultDisplayProperty + Strings + + + DefaultKeyPropertySet + + Strings + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_MX + + + Exchange + NameExchange + + + PsStandardMembers + + + DefaultDisplayPropertySet + + Name + QueryType + TTL + Section + NameExchange + Preference + + + + DefaultDisplayProperty + NameExchange + + + DefaultKeyPropertySet + + NameExchange + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_PTR + + + Server + NameHost + + + PsStandardMembers + + + DefaultDisplayPropertySet + + Name + QueryType + TTL + Section + NameHost + + + + DefaultDisplayProperty + NameHost + + + DefaultKeyPropertySet + + NameHost + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_SOA + + + Administrator + NameAdministrator + + + PsStandardMembers + + + DefaultDisplayPropertySet + + Name + QueryType + TTL + Section + NameAdministrator + SerialNumber + TimeToZoneRefresh + TimeToZoneFailureRetry + TimeToExpiration + DefaultTTL + + + + DefaultDisplayProperty + SerialNumber + + + DefaultKeyPropertySet + + SerialNumber + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_MINFO + + + Mailbox + NameMailbox + + + ErrorsMailbox + NameErrorsMailbox + + + PsStandardMembers + + + DefaultDisplayPropertySet + + Name + QueryType + TTL + Section + NameMailbox + NameErrorsMailbox + + + + DefaultDisplayProperty + NameMailbox + + + DefaultKeyPropertySet + + NameMailbox + NameErrorsMailbox + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_NULL + + + PsStandardMembers + + + DefaultDisplayPropertySet + + Name + QueryType + TTL + Section + Data + + + + DefaultDisplayProperty + Data + + + DefaultKeyPropertySet + + Data + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_WKS + + + PsStandardMembers + + + DefaultDisplayPropertySet + + Name + QueryType + TTL + Section + IP4Address + Protocol + Bitmask + + + + DefaultDisplayProperty + IP4Address + + + DefaultKeyPropertySet + + IP4Address + Protocol + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_SRV + + + Target + NameTarget + + + PsStandardMembers + + + DefaultDisplayPropertySet + + Name + QueryType + TTL + Section + NameTarget + Priority + Weight + Port + + + + DefaultDisplayProperty + NameTarget + + + DefaultKeyPropertySet + + NameTarget + Priority + Port + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_DS + + + Key + KeyTag + + + DigestType + DType + + + PsStandardMembers + + + DefaultDisplayPropertySet + + Name + QueryType + TTL + Section + KeyTag + Algorithm + DigestType + Digest + + + + DefaultDisplayProperty + KeyTag + + + DefaultKeyPropertySet + + KeyTag + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_RRSIG + + + Key + KeyTag + + + PsStandardMembers + + + DefaultDisplayPropertySet + + Name + QueryType + TTL + Section + TypeCovered + Algorithm + LabelCount + OriginalTtl + Expiration + Signed + Signer + Signature + + + + DefaultDisplayProperty + Signer + + + DefaultKeyPropertySet + + KeyTag + Signer + Signature + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_DNSKEY + + + PsStandardMembers + + + DefaultDisplayPropertySet + + Name + QueryType + TTL + Section + Protocol + Flags + Algorithm + Key + + + + DefaultDisplayProperty + Key + + + DefaultKeyPropertySet + + Algorithm + Key + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_NSEC + + + BitMap + TypeBitMap + + + PsStandardMembers + + + DefaultDisplayPropertySet + + Name + QueryType + TTL + Section + NextDomainName + TypeBitMap + + + + DefaultDisplayProperty + NextDomainName + + + DefaultKeyPropertySet + + NextDomainName + TypeBitMap + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_WINS + + + PsStandardMembers + + + DefaultDisplayPropertySet + + Name + QueryType + TTL + Section + MappingFlag + IP4Addresses + + + + DefaultDisplayProperty + IP4Addresses + + + DefaultKeyPropertySet + + IP4Addresses + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_DHCID + + + PsStandardMembers + + + DefaultDisplayPropertySet + + Name + QueryType + TTL + Section + Dhcid + + + + DefaultDisplayProperty + Dhcid + + + DefaultKeyPropertySet + + Dhcid + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_OPT + + + PsStandardMembers + + + DefaultDisplayPropertySet + + Name + QueryType + TTL + Section + Data + + + + DefaultDisplayProperty + Data + + + DefaultKeyPropertySet + + Data + + + + + + + + + Microsoft.DnsClient.Commands.DnsRecord_Default + + + PsStandardMembers + + + DefaultDisplayPropertySet + + Name + QueryType + TTL + Section + Data + + + + DefaultDisplayProperty + Data + + + DefaultKeyPropertySet + + Data + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/DnsClient/DnsConfig.Format.ps1xml b/newton-cn/bin/v1.0/Modules/DnsClient/DnsConfig.Format.ps1xml new file mode 100644 index 0000000..d13add9 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DnsClient/DnsConfig.Format.ps1xml @@ -0,0 +1,566 @@ + + + + + + DnsClientTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClient + + + + + + 28 + + + + 9 + Left + + + + 24 + + + + 24 + + + + 16 + + + + 13 + + + + + + + + + $alias = $_.InterfaceAlias + $width = 28 + $out = $alias + if ($alias.Length -gt $width) + { + $idpresent = $alias -match "(\d+$)" + if ($idpresent -and ($width -gt ($matches[0].length + 3))) + { + $base = $alias.substring(0, $width - ($matches[0].length + 3)) + $out = $base + "..." + $matches[0] + } + } + return $out + + + + InterfaceIndex + Right + + + ConnectionSpecificSuffix + + + ConnectionSpecificSuffixSearchList + + + RegisterThisConnectionsAddress + + + UseSuffixWhenRegistering + + + + + + + + DnsClientListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClient + + + + + + + + InterfaceAlias + + + + InterfaceIndex + + + + ConnectionSpecificSuffix + + + + ConnectionSpecificSuffixSearchList + + + + RegisterThisConnectionsAddress + + + + UseSuffixWhenRegistering + + + + + + + + + DnsClientCacheTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientCache + + + + + + 25 + + + + 25 + + + + 6 + Left + + + + 9 + + + + 7 + + + + 6 + Left + + + + 6 + Left + + + + + + + + + + Entry + + + Name + + + + $type = $_.Type + $typefmt = switch ($type) + { + 0 {"ZERO"} + 1 {"A"} + 2 {"NS"} + 5 {"CNAME"} + 6 {"SOA"} + 12 {"PTR"} + 15 {"MX"} + 16 {"TEXT"} + 24 {"SIG"} + 25 {"KEY"} + 28 {"AAAA"} + 30 {"NXT"} + 33 {"SRV"} + 35 {"NAPTR"} + 37 {"CERT"} + 39 {"DNAME"} + 41 {"OPT"} + 43 {"DS"} + 46 {"RRSIG"} + 47 {"NSEC"} + 48 {"DNSKEY"} + 49 {"DHCID"} + 50 {"NSEC3"} + 51 {"NSEC3PARAM"} + 255 {""} + default {$type} + } + return $typefmt + + + + + $status = $_.Status + $statusfmt = switch ($status) + { + 0 {"Success"} + 1460 {"Timeout"} + 9002 {"ServFail"} + 9003 {"NotExist"} + 9501 {"NoRecords"} + default {$status} + } + return $statusfmt + + + + + $section = $_.Section + $sectionfmt = switch ($section) + { + 0 {""} + 1 {"Answer"} + 2 {"Authority"} + 3 {"Additional"} + default {$section} + } + return $sectionfmt + + + + + $ttl = $_.TimeToLive + $ttlfmt = switch ($ttl) + { + 0 {""} + default {$ttl} + } + return $ttlfmt + + Right + + + + $length = $_.DataLength + $lengthfmt = switch ($length) + { + 0 {""} + default {$length} + } + return $lengthfmt + + Right + + + Data + + + + + + + + DnsClientCacheListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientCache + + + + + + + + Entry + + + + Name + + + + + $type = $_.Type + $typefmt = switch ($type) + { + 0 {"ZERO"} + 1 {"A"} + 2 {"NS"} + 5 {"CNAME"} + 6 {"SOA"} + 12 {"PTR"} + 15 {"MX"} + 16 {"TEXT"} + 24 {"SIG"} + 25 {"KEY"} + 28 {"AAAA"} + 30 {"NXT"} + 33 {"SRV"} + 35 {"NAPTR"} + 37 {"CERT"} + 39 {"DNAME"} + 41 {"OPT"} + 43 {"DS"} + 46 {"RRSIG"} + 47 {"NSEC"} + 48 {"DNSKEY"} + 49 {"DHCID"} + 50 {"NSEC3"} + 51 {"NSEC3PARAM"} + 255 {""} + default {$type} + } + return $typefmt + + + + + + $status = $_.Status + $statusfmt = switch ($status) + { + 0 {"Success"} + 1460 {"Timeout"} + 9002 {"ServFail"} + 9003 {"NotExist"} + 9501 {"NoRecords"} + default {$status} + } + return $statusfmt + + + + + + $section = $_.Section + $sectionfmt = switch ($section) + { + 0 {""} + 1 {"Answer"} + 2 {"Authority"} + 3 {"Additional"} + default {$section} + } + return $sectionfmt + + + + + + $ttl = $_.TimeToLive + $ttlfmt = switch ($ttl) + { + 0 {""} + default {$ttl} + } + return $ttlfmt + + + + + + $length = $_.DataLength + $lengthfmt = switch ($length) + { + 0 {""} + default {$length} + } + return $lengthfmt + + + + + Data + + + + + + + + + DnsClientGlobalSettingListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientGlobalSetting + + + + + + + + UseSuffixSearchList + + + + SuffixSearchList + + + + UseDevolution + + + + DevolutionLevel + + + + + + + + DnsClientGlobalSettingTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientGlobalSetting + + + + + + + + + + + + + + + + + + + + + UseSuffixSearchList + + + SuffixSearchList + + + UseDevolution + + + DevolutionLevel + + + + + + + + + DnsClientServerAddressTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientServerAddress + + + + + + 28 + + + + 9 + Left + + + + 7 + Left + + + + + + + + + + + + $alias = $_.InterfaceAlias + $width = 28 + $out = $alias + if ($alias.Length -gt $width) + { + $idpresent = $alias -match "(\d+$)" + if ($idpresent -and ($width -gt ($matches[0].length + 3))) + { + $base = $alias.substring(0, $width - ($matches[0].length + 3)) + $out = $base + "..." + $matches[0] + } + } + return $out + + + + InterfaceIndex + Right + + + + $family = $_.AddressFamily + $familyfmt = switch ($family) + { + 2 {"IPv4"} + 23 {"IPv6"} + default {$family} + } + return $familyfmt + + + + ServerAddresses + + + + + + + + DnsClientServerAddressListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientServerAddress + + + + + + + + InterfaceAlias + + + + InterfaceIndex + + + + + $family = $_.AddressFamily + $familyfmt = switch ($family) + { + 2 {"IPv4"} + 23 {"IPv6"} + default {$family} + } + return $familyfmt + + + + + ServerAddresses + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/DnsClient/DnsConfig.Types.ps1xml b/newton-cn/bin/v1.0/Modules/DnsClient/DnsConfig.Types.ps1xml new file mode 100644 index 0000000..3703662 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DnsClient/DnsConfig.Types.ps1xml @@ -0,0 +1,38 @@ + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClient + + + Suffix + ConnectionSpecificSuffix + + + SuffixSearchList + ConnectionSpecificSuffixSearchList + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientCache + + + TTL + TimeToLive + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_DNSClientServerAddress + + + Address + ServerAddresses + + + + + diff --git a/newton-cn/bin/v1.0/Modules/DnsClient/MSFT_DnsClient.cdxml b/newton-cn/bin/v1.0/Modules/DnsClient/MSFT_DnsClient.cdxml new file mode 100644 index 0000000..a3eab88 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DnsClient/MSFT_DnsClient.cdxml @@ -0,0 +1,95 @@ + + + + 1.0.0 + DnsClient + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/DnsClient/MSFT_DnsClientCache.cdxml b/newton-cn/bin/v1.0/Modules/DnsClient/MSFT_DnsClientCache.cdxml new file mode 100644 index 0000000..9f9960f --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DnsClient/MSFT_DnsClientCache.cdxml @@ -0,0 +1,96 @@ + + + + 1.0.0 + DnsClientCache + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/DnsClient/MSFT_DnsClientGlobalSetting.cdxml b/newton-cn/bin/v1.0/Modules/DnsClient/MSFT_DnsClientGlobalSetting.cdxml new file mode 100644 index 0000000..80335fe --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DnsClient/MSFT_DnsClientGlobalSetting.cdxml @@ -0,0 +1,31 @@ + + + + 1.0.0 + DnsClientGlobalSetting + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/DnsClient/MSFT_DnsClientServerAddress.cdxml b/newton-cn/bin/v1.0/Modules/DnsClient/MSFT_DnsClientServerAddress.cdxml new file mode 100644 index 0000000..2c327a8 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DnsClient/MSFT_DnsClientServerAddress.cdxml @@ -0,0 +1,72 @@ + + + + 1.0.0 + DnsClientServerAddress + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/DnsClient/PS_DnsClientNRPTGlobal_v1.0.0.cdxml b/newton-cn/bin/v1.0/Modules/DnsClient/PS_DnsClientNRPTGlobal_v1.0.0.cdxml new file mode 100644 index 0000000..db55738 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DnsClient/PS_DnsClientNRPTGlobal_v1.0.0.cdxml @@ -0,0 +1,116 @@ + + + + 1.0.0 + DnsClientNrptGlobal + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EnableOnNetworkID + EnableAlways + Disable + DisableDA + + + + + + + + + + + + + + + + + Disable + FallbackSecure + FallbackUnsecure + FallbackPrivate + + + + + + + + + + Disable + QueryIPv6Only + QueryBoth + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/DnsClient/PS_DnsClientNRPTRule_v1.0.0.cdxml b/newton-cn/bin/v1.0/Modules/DnsClient/PS_DnsClientNRPTRule_v1.0.0.cdxml new file mode 100644 index 0000000..de6f322 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DnsClient/PS_DnsClientNRPTRule_v1.0.0.cdxml @@ -0,0 +1,382 @@ + + + + 1.0.0 + DnsClientNrptRule + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + Low + Medium + High + + + + + + + + + + + + + + + + + + + + + + + None + Low + Medium + High + + + + + + + + + + + + Disable + Utf8WithMapping + Utf8WithoutMapping + Punycode + + + + + + + + + + + + + + + + + + + + + + NoProxy + UseDefault + UseProxyName + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + Low + Medium + High + + + + + + + + + + + + + + + + + + + + + + + NoProxy + UseDefault + UseProxyName + + + + + + + + + + + + + + + + + + + None + Low + Medium + High + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Disable + Utf8WithMapping + Utf8WithoutMapping + Punycode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/DnsClient/PS_DnsClientNrptPolicy_v1.0.0.cdxml b/newton-cn/bin/v1.0/Modules/DnsClient/PS_DnsClientNrptPolicy_v1.0.0.cdxml new file mode 100644 index 0000000..5b7b6a9 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/DnsClient/PS_DnsClientNrptPolicy_v1.0.0.cdxml @@ -0,0 +1,40 @@ + + + + 1.0.0 + DnsClientNrptPolicy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/DnsClient/dnslookup.dll b/newton-cn/bin/v1.0/Modules/DnsClient/dnslookup.dll new file mode 100644 index 0000000..7c62cc1 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/DnsClient/dnslookup.dll differ diff --git a/newton-cn/bin/v1.0/Modules/EventTracingManagement/EventTracingManagement.Types.ps1xml b/newton-cn/bin/v1.0/Modules/EventTracingManagement/EventTracingManagement.Types.ps1xml new file mode 100644 index 0000000..0282648 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/EventTracingManagement/EventTracingManagement.Types.ps1xml @@ -0,0 +1,185 @@ + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/EventTracingManagement/MSFT_EtwTraceProvider + + + Level + + $this.PSBase.CimInstanceProperties['Level'].Value + + + + LevelName + + $constants = @{ + 0 = "WINEVENT_LEVEL_LOG_ALWAYS"; + 1 = "WINEVENT_LEVEL_CRITICAL"; + 2 = "WINEVENT_LEVEL_ERROR"; + 3 = "WINEVENT_LEVEL_WARNING"; + 4 = "WINEVENT_LEVEL_INFO"; + 5 = "WINEVENT_LEVEL_VERBOSE";} + + $level = $this.PSBase.CimInstanceProperties['Level'].Value + + $namedLevel = $constants[[Convert]::ToInt32($level)] + + if ($namedLevel) + { + "{0} ({1})" -f $level, $namedLevel + } + else + { + $level.ToString() + } + + + + MatchAnyKeyword + + "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAnyKeyword'].Value + + + + MatchAllKeyword + + "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAllKeyword'].Value + + + + Property + + $this.PSBase.CimInstanceProperties['Property'].Value + + + + EnableProperty + + $constants = @{ + 0x00000001 = "EVENT_ENABLE_PROPERTY_SID"; + 0x00000002 = "EVENT_ENABLE_PROPERTY_TS_ID"; + 0x00000004 = "EVENT_ENABLE_PROPERTY_STACK_TRACE"; + 0x00000008 = "EVENT_ENABLE_PROPERTY_PSM_KEY"; + 0x00000010 = "EVENT_ENABLE_PROPERTY_IGNORE_KEYWORD_0"; + 0x00000020 = "EVENT_ENABLE_PROPERTY_PROVIDER_GROUP"; + 0x00000040 = "EVENT_ENABLE_PROPERTY_ENABLE_KEYWORD_0"; + 0x00000080 = "EVENT_ENABLE_PROPERTY_PROCESS_START_KEY"; + 0x00000100 = "EVENT_ENABLE_PROPERTY_EVENT_KEY"; + 0x00000200 = "EVENT_ENABLE_PROPERTY_EXCLUDE_INPRIVATE";} + + $enableProperty = $this.PSBase.CimInstanceProperties['Property'].Value + + $constants.Keys | where { $_ -band $enableProperty } | foreach { $constants.Get_Item($_) } + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/EventTracingManagement/MSFT_EtwTraceSession + + + LogFileMode + + "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['LogFileMode'].Value + + + + LoggingModeNames + + $constants = @{ + 0x00000000 = "EVENT_TRACE_FILE_MODE_NONE"; + 0x00000001 = "EVENT_TRACE_FILE_MODE_SEQUENTIAL"; + 0x00000002 = "EVENT_TRACE_FILE_MODE_CIRCULAR"; + 0x00000004 = "EVENT_TRACE_FILE_MODE_APPEND"; + 0x00000100 = "EVENT_TRACE_REAL_TIME_MODE"; + 0x00000200 = "EVENT_TRACE_DELAY_OPEN_FILE_MODE"; + 0x00000400 = "EVENT_TRACE_BUFFERING_MODE"; + 0x00000800 = "EVENT_TRACE_PRIVATE_LOGGER_MODE"; + 0x00001000 = "EVENT_TRACE_ADD_HEADER_MODE"; + 0x00004000 = "EVENT_TRACE_USE_GLOBAL_SEQUENCE"; + 0x00008000 = "EVENT_TRACE_USE_LOCAL_SEQUENCE"; + 0x00010000 = "EVENT_TRACE_RELOG_MODE"; + 0x01000000 = "EVENT_TRACE_USE_PAGED_MEMORY"; + 0x00000008 = "EVENT_TRACE_FILE_MODE_NEWFILE"; + 0x00000020 = "EVENT_TRACE_FILE_MODE_PREALLOCATE"; + 0x00000040 = "EVENT_TRACE_NONSTOPPABLE_MODE"; + 0x00000080 = "EVENT_TRACE_SECURE_MODE"; + 0x00002000 = "EVENT_TRACE_USE_KBYTES_FOR_SIZE"; + 0x00020000 = "EVENT_TRACE_PRIVATE_IN_PROC"; + 0x00100000 = "EVENT_TRACE_MODE_RESERVED"; + 0x10000000 = "EVENT_TRACE_NO_PER_PROCESSOR_BUFFERING"; + 0x02000000 = "EVENT_TRACE_SYSTEM_LOGGER_MODE"; + 0x80000000 = "EVENT_TRACE_ADDTO_TRIAGE_DUMP"; + 0x00400000 = "EVENT_TRACE_STOP_ON_HYBRID_SHUTDOWN"; + 0x00800000 = "EVENT_TRACE_PERSIST_ON_HYBRID_SHUTDOWN"; + 0x08000000 = "EVENT_TRACE_INDEPENDENT_SESSION_MODE"; + 0x04000000 = "EVENT_TRACE_COMPRESSED_MODE"} + + $logfilemode = $this.PSBase.CimInstanceProperties['LogFileMode'].Value + + $constants.Keys | where { $_ -band $logfilemode } | foreach { $constants.Get_Item($_) } + + + + ClockType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.EtwTraceSession.ClockType]($this.PSBase.CimInstanceProperties['ClockType'].Value) + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/EventTracingManagement/MSFT_AutologgerConfig + + + LogFileMode + + "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['LogFileMode'].Value + + + + LoggingModeNames + + $constants = @{ + 0x00000000 = "EVENT_TRACE_FILE_MODE_NONE"; + 0x00000001 = "EVENT_TRACE_FILE_MODE_SEQUENTIAL"; + 0x00000002 = "EVENT_TRACE_FILE_MODE_CIRCULAR"; + 0x00000004 = "EVENT_TRACE_FILE_MODE_APPEND"; + 0x00000100 = "EVENT_TRACE_REAL_TIME_MODE"; + 0x00000200 = "EVENT_TRACE_DELAY_OPEN_FILE_MODE"; + 0x00000400 = "EVENT_TRACE_BUFFERING_MODE"; + 0x00000800 = "EVENT_TRACE_PRIVATE_LOGGER_MODE"; + 0x00001000 = "EVENT_TRACE_ADD_HEADER_MODE"; + 0x00004000 = "EVENT_TRACE_USE_GLOBAL_SEQUENCE"; + 0x00008000 = "EVENT_TRACE_USE_LOCAL_SEQUENCE"; + 0x00010000 = "EVENT_TRACE_RELOG_MODE"; + 0x01000000 = "EVENT_TRACE_USE_PAGED_MEMORY"; + 0x00000008 = "EVENT_TRACE_FILE_MODE_NEWFILE"; + 0x00000020 = "EVENT_TRACE_FILE_MODE_PREALLOCATE"; + 0x00000040 = "EVENT_TRACE_NONSTOPPABLE_MODE"; + 0x00000080 = "EVENT_TRACE_SECURE_MODE"; + 0x00002000 = "EVENT_TRACE_USE_KBYTES_FOR_SIZE"; + 0x00020000 = "EVENT_TRACE_PRIVATE_IN_PROC"; + 0x00100000 = "EVENT_TRACE_MODE_RESERVED"; + 0x10000000 = "EVENT_TRACE_NO_PER_PROCESSOR_BUFFERING"; + 0x02000000 = "EVENT_TRACE_SYSTEM_LOGGER_MODE"; + 0x80000000 = "EVENT_TRACE_ADDTO_TRIAGE_DUMP"; + 0x00400000 = "EVENT_TRACE_STOP_ON_HYBRID_SHUTDOWN"; + 0x00800000 = "EVENT_TRACE_PERSIST_ON_HYBRID_SHUTDOWN"; + 0x08000000 = "EVENT_TRACE_INDEPENDENT_SESSION_MODE"; + 0x04000000 = "EVENT_TRACE_COMPRESSED_MODE"} + + $logfilemode = $this.PSBase.CimInstanceProperties['LogFileMode'].Value + + $constants.Keys | where { $_ -band $logfilemode } | foreach { $constants.Get_Item($_) } + + + + ClockType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.AutologgerConfig.ClockType]($this.PSBase.CimInstanceProperties['ClockType'].Value) + + + + + diff --git a/newton-cn/bin/v1.0/Modules/EventTracingManagement/EventTracingManagement.psd1 b/newton-cn/bin/v1.0/Modules/EventTracingManagement/EventTracingManagement.psd1 new file mode 100644 index 0000000..796b508 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/EventTracingManagement/EventTracingManagement.psd1 @@ -0,0 +1,45 @@ +@{ + GUID = "80CB11CF-96B5-4D48-84BD-F85F65DE78AE" + Author = "Microsoft Corporation" + CompanyName = "Microsoft Corporation" + Copyright = "© Microsoft Corporation. All rights reserved." + ModuleVersion = "1.0.0.0" + PowerShellVersion = '5.1' + HelpInfoUri = "http://go.microsoft.com/fwlink/?linkid=524348" + + NestedModules = @( + 'MSFT_EtwTraceSession_v1.0.cdxml', + 'MSFT_EtwTraceProvider_v1.0.cdxml', + 'MSFT_AutologgerConfig_v1.0.cdxml', + 'EventTracingManagement.psm1') + + FormatsToProcess = @( + 'MSFT_AutologgerConfig_v1.0.format.ps1xml', + 'MSFT_EtwTraceProvider_v1.0.format.ps1xml', + 'MSFT_EtwTraceSession_v1.0.format.ps1xml') + + TypesToProcess = @('EventTracingManagement.Types.ps1xml') + + FunctionsToExport = @( + 'Start-EtwTraceSession', + 'New-EtwTraceSession', + 'Get-EtwTraceSession', + 'Update-EtwTraceSession', + 'Set-EtwTraceSession', + 'Send-EtwTraceSession', + 'Save-EtwTraceSession', + 'Flush-EtwTraceSession', + 'Stop-EtwTraceSession', + 'Remove-EtwTraceSession', + 'Add-EtwTraceProvider', + 'Get-EtwTraceProvider', + 'Set-EtwTraceProvider', + 'Remove-EtwTraceProvider', + 'New-AutologgerConfig', + 'Get-AutologgerConfig', + 'Update-AutologgerConfig', + 'Set-AutologgerConfig', + 'Start-AutologgerConfig', + 'Remove-AutologgerConfig') + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/EventTracingManagement/EventTracingManagement.psm1 b/newton-cn/bin/v1.0/Modules/EventTracingManagement/EventTracingManagement.psm1 new file mode 100644 index 0000000..46c8f6a --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/EventTracingManagement/EventTracingManagement.psm1 @@ -0,0 +1,228 @@ +function Start-EtwTraceSession +{ + [CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')] + + param( + [Parameter(Position=0, + Mandatory=$true)] + [System.String]$Name, + + [Parameter()] + [System.UInt32]$LogFileMode = 0x09000000, + + [Parameter()] + [System.String]$LocalFilePath, + + [Parameter()] + [System.UInt32]$MaximumFileSize, + + [Parameter()] + [System.UInt32]$BufferSize, + + [Parameter()] + [System.UInt32]$MinimumBuffers, + + [Parameter()] + [System.UInt32]$MaximumBuffers, + + [Parameter()] + [System.UInt32]$FlushTimer, + + [Parameter()] + [ValidateSet('Performance','System', 'Cycle')] + [System.String]$ClockType, + + [Parameter()] + [ValidateSet('File','Buffering', 'Sequential', 'Circular')] + [System.String]$FileMode, + + [Parameter()] + [Switch] + $Compress, + + [Parameter()] + [Switch] + $RealTime, + + [Parameter()] + [Switch] + $NonPaged, + + [Parameter()] + [Microsoft.Management.Infrastructure.CimSession]$CimSession + ) + + $mode = $LogFileMode + + if ($FileMode.Length -gt 0) + { + switch($FileMode.ToLowerInvariant()) + { + {($_ -eq "file")} {} + {($_ -eq "buffering")} { $mode = $mode -bor 0x400} + {($_ -eq "sequential")} { $mode = $mode -bor 0x1} + {($_ -eq "circular")} { $mode = $mode -bor 0x2} + } + + $x = $PSBoundParameters.Remove("FileMode") + } + + if ($NonPaged -eq $true) + { + $mode = $mode -bxor 0x01000000 + $x = $PSBoundParameters.Remove("NonPaged") + } + + if ($RealTime -eq $true) + { + $mode = $mode -bor 0x00000100 + $x = $PSBoundParameters.Remove("RealTime") + } + + if ($Compress -eq $true) + { + $mode = $mode -bor 0x04000000 + $x = $PSBoundParameters.Remove("Compress") + } + + if ($mode -ne 0) + { + $PSBoundParameters["LogFileMode"] = $mode + } + + New-EtwTraceSession @PSBoundParameters +} + +function Save-EtwTraceSession +{ + [CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')] + + param( + [Parameter(Position=0, + Mandatory=$true)] + [System.String]$Name, + + [Parameter(ValueFromPipeLine=$True)] + [System.IO.FileInfo]$OutputFile, + + [Parameter(ValueFromPipeLine=$True)] + [System.IO.DirectoryInfo]$OutputFolder, + + [Parameter()] + [Switch] + $Stop, + + [Parameter()] + [Switch] + $Overwrite, + + [Parameter()] + [Microsoft.Management.Infrastructure.CimSession]$CimSession + ) + + if ($PSBoundParameters.ContainsKey("DeleteAfterSend") -eq $true) + { + $x = $PSBoundParameters.Remove("DeleteAfterSend") + } + + if ($PSBoundParameters.ContainsKey("DestinationFolder") -eq $true) + { + $x = $PSBoundParameters.Remove("DestinationFolder") + } + + $file = "$Name.etl" + $pathSet = 0 + + if ($PSBoundParameters.ContainsKey("CimSession") -eq $true) + { + $session = Get-EtwTraceSession $Name -CimSession $CimSession + } + else + { + $session = Get-EtwTraceSession $Name + } + + if ($session -eq $null) + { + # Error message would have already come from Get-EtwTraceSession + return $null + } + + if ($PSBoundParameters.ContainsKey("OutputFile") -eq $true) + { + $file = $OutputFile.FullName + $pathSet = $pathSet + 1 + $x = $PSBoundParameters.Remove("OutputFile") + } + + if ($PSBoundParameters.ContainsKey("OutputFolder") -eq $true) + { + if (($session.LocalFilePath -ne $null) -and (test-path $session.LocalFilePath)) + { + $existingTrace = get-item $session.LocalFilePath + $file = $existingTrace.Name + } + + $file = join-path $OutputFolder.FullName $file + $pathSet = $pathSet + 1 + $x = $PSBoundParameters.Remove("OutputFolder") + } + + if ($PSBoundParameters.ContainsKey("Overwrite") -eq $true) + { + $x = $PSBoundParameters.Remove("Overwrite") + } + + if ($pathSet -gt 1) + { + throw "Only 1 file parameter can be set" + # TODO: Localize + } + + if ($PSBoundParameters.ContainsKey("CimSession") -eq $true) + { + $exists = get-ciminstance -classname CIM_DataFile -filter ("Name='$file'".replace("\", "\\")) -CimSession $CimSession + if ($exists -ne $null -and $Overwrite -eq $false) + { + throw "Output file already exists. Use -Overwrite to overwrite." + # TODO: Localize + } + } + else + { + $exists = test-path $file + if ($exists -eq $true -and $Overwrite -eq $false) + { + throw "Output file already exists. Use -Overwrite to overwrite." + # TODO: Localize + } + } + + $result = Send-EtwTraceSession -DestinationFolder $file @PSBoundParameters + + if ($result -ne $null -and $result.ReturnValue -ne $null -and ($result.ReturnValue.ToString() -eq "Success")) + { + if ($PSBoundParameters.ContainsKey("CimSession") -eq $true) + { + if ($Stop -eq $true) + { + Remove-EtwTraceSession $Name -CimSession $CimSession + } + + return get-ciminstance -classname CIM_DataFile -filter ("Name='$file'".replace("\", "\\")) -CimSession $CimSession + } + else + { + if ($Stop -eq $true) + { + Remove-EtwTraceSession $Name + } + + return get-item $file + } + } + else + { + return $null + } +} diff --git a/newton-cn/bin/v1.0/Modules/EventTracingManagement/MSFT_AutologgerConfig_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/EventTracingManagement/MSFT_AutologgerConfig_v1.0.cdxml new file mode 100644 index 0000000..0d3c4c0 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/EventTracingManagement/MSFT_AutologgerConfig_v1.0.cdxml @@ -0,0 +1,187 @@ + + + + 1.1.0.0 + AutologgerConfig + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/EventTracingManagement/MSFT_AutologgerConfig_v1.0.format.ps1xml b/newton-cn/bin/v1.0/Modules/EventTracingManagement/MSFT_AutologgerConfig_v1.0.format.ps1xml new file mode 100644 index 0000000..885b203 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/EventTracingManagement/MSFT_AutologgerConfig_v1.0.format.ps1xml @@ -0,0 +1,170 @@ + + + + + MSFT_AutologgerConfig_ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_AutologgerConfig + + + + + + + Name + + + BufferSize + + + ClockType + + + DisableRealtimePersistence + + + FileCount + + + LocalFilePath + + + FileMax + + + FlushTimer + + + Guid + + + LoggingModeNames + + + MaximumFileSize + + + MaximumBuffers + + + MinimumBuffers + + + Start + + + InitStatus + + + + + + + + MSFT_AutologgerConfig_TableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_AutologgerConfig + + + + + 15 + + + 15 + + + 15 + + + 15 + + + 15 + + + 15 + + + 15 + + + 15 + + + 15 + + + 15 + + + 15 + + + 15 + + + 15 + + + 15 + + + 15 + + + + + + + Name + + + BufferSize + + + ClockType + + + DisableRealtimePersistence + + + FileCount + + + LocalFilePath + + + FileMax + + + FlushTimer + + + Guid + + + LoggingModeNames + + + MaximumFileSize + + + MaximumBuffers + + + MinimumBuffers + + + Start + + + InitStatus + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/EventTracingManagement/MSFT_EtwTraceProvider_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/EventTracingManagement/MSFT_EtwTraceProvider_v1.0.cdxml new file mode 100644 index 0000000..7303a1e --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/EventTracingManagement/MSFT_EtwTraceProvider_v1.0.cdxml @@ -0,0 +1,137 @@ + + + + 1.0.0.0 + EtwTraceProvider + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/EventTracingManagement/MSFT_EtwTraceProvider_v1.0.format.ps1xml b/newton-cn/bin/v1.0/Modules/EventTracingManagement/MSFT_EtwTraceProvider_v1.0.format.ps1xml new file mode 100644 index 0000000..4559f8c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/EventTracingManagement/MSFT_EtwTraceProvider_v1.0.format.ps1xml @@ -0,0 +1,100 @@ + + + + + MSFT_EtwTraceProvider_ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_EtwTraceProvider + + + + + + + SessionName + + -not [System.String]::IsNullOrEmpty($_.SessionName) + + + + AutologgerName + + -not [System.String]::IsNullOrEmpty($_.AutologgerName) + + + + Guid + + + LevelName + + + + MatchAnyKeyword + + + MatchAllKeyword + + + EnableProperty + + + + + + + + MSFT_EtwTraceProvider_TableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_EtwTraceProvider + + + + + 10 + + + 15 + + + 15 + + + 10 + + + + 15 + + + 15 + + + + + + + Guid + + + SessionName + + + AutologgerName + + + LevelName + + + MatchAnyKeyword + + + MatchAllKeyword + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/EventTracingManagement/MSFT_EtwTraceSession_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/EventTracingManagement/MSFT_EtwTraceSession_v1.0.cdxml new file mode 100644 index 0000000..28fb5c7 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/EventTracingManagement/MSFT_EtwTraceSession_v1.0.cdxml @@ -0,0 +1,156 @@ + + + + 1.1.0.0 + EtwTraceSession + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/EventTracingManagement/MSFT_EtwTraceSession_v1.0.format.ps1xml b/newton-cn/bin/v1.0/Modules/EventTracingManagement/MSFT_EtwTraceSession_v1.0.format.ps1xml new file mode 100644 index 0000000..a55eda9 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/EventTracingManagement/MSFT_EtwTraceSession_v1.0.format.ps1xml @@ -0,0 +1,107 @@ + + + + + MSFT_EtwTraceSession_ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_EtwTraceSession + + + + + + + Name + + + LoggingModeNames + + + LocalFilePath + + + MaximumFileSize + + + MinimumBuffers + + + MaximumBuffers + + + FlushTimer + + + ClockType + + + + + + + + MSFT_EtwTraceSession_TableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_EtwTraceSession + + + + + 10 + + + 15 + + + 15 + + + 14 + + + 14 + + + 10 + + + 9 + + + 16 + + + + + + + Name + + + LocalFilePath + + + MaximumFileSize + + + MinimumBuffers + + + MaximumBuffers + + + FlushTimer + + + ClockType + + + LoggingModeNames + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/ISE/ise.psd1 b/newton-cn/bin/v1.0/Modules/ISE/ise.psd1 new file mode 100644 index 0000000..95765f8 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ISE/ise.psd1 @@ -0,0 +1,16 @@ +@{ +GUID = 'bae93d8e-782c-4a23-b87f-8699bfc17ee0' +Author = 'Microsoft Corporation' +CompanyName = 'Microsoft Corporation' +Copyright = '(c) Microsoft Corporation. All rights reserved.' +ModuleVersion = '1.0.0.0' +PowerShellVersion = '5.1' +CLRVersion='4.0' +RootModule='ISE.psm1' +FunctionsToExport='New-IseSnippet', 'Import-IseSnippet', 'Get-IseSnippet' +CmdletsToExport = @() +AliasesToExport = @() +HelpInfoUri='https://go.microsoft.com/fwlink/?linkid=390780' +PowerShellHostName = 'Windows PowerShell ISE Host' +CompatiblePSEditions = @('Desktop') +} diff --git a/newton-cn/bin/v1.0/Modules/ISE/ise.psm1 b/newton-cn/bin/v1.0/Modules/ISE/ise.psm1 new file mode 100644 index 0000000..d957d77 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ISE/ise.psm1 @@ -0,0 +1,185 @@ +# .Link +# https://go.microsoft.com/fwlink/?LinkID=225298 +# .ExternalHelp ISE.psm1-help.xml +function New-IseSnippet +{ + [CmdletBinding()] + param( + + [Parameter(Mandatory=$true, Position=0)] + [String] + $Title, + + [Parameter(Mandatory=$true, Position=1)] + [String] + $Description, + + [Parameter(Mandatory=$true, Position=2)] + [String] + $Text, + + [String] + $Author, + + [Int32] + [ValidateRange(0, [Int32]::MaxValue)] + $CaretOffset = 0, + + [Switch] + $Force + ) + + Begin + { + $snippetPath = Join-Path (Split-Path $profile.CurrentUserCurrentHost) "Snippets" + + if($Text.IndexOf("]]>") -ne -1) + { + throw [Microsoft.PowerShell.Host.ISE.SnippetStrings]::SnippetsNoCloseCData -f "Text","]]>" + } + + if (-not (Test-Path $snippetPath)) + { + $null = mkdir $snippetPath + } + } + + End + { + $snippet = @" + + + +
+ $([System.Security.SecurityElement]::Escape($Title)) + $([System.Security.SecurityElement]::Escape($Description)) + $([System.Security.SecurityElement]::Escape($Author)) + + Expansion + +
+ + + + + +
+
+ +"@ + + $pathCharacters = '/\`*?[]:><"|.'; + $fileName=new-object text.stringBuilder + for($ix=0; $ix -lt $Title.Length; $ix++) + { + $titleChar=$Title[$ix] + if($pathCharacters.IndexOf($titleChar) -ne -1) + { + $titleChar = "_" + } + + $null = $fileName.Append($titleChar) + } + + $params = @{ + FilePath = "$snippetPath\$fileName.snippets.ps1xml"; + Encoding = "UTF8" + } + + if ($Force) + { + $params["Force"] = $true + } + else + { + $params["NoClobber"] = $true + } + + $snippet | Out-File @params + + $psise.CurrentPowerShellTab.Snippets.Load($params["FilePath"]) + } +} + +# .Link +# https://go.microsoft.com/fwlink/?LinkId=242050 +# .ExternalHelp ISE.psm1-help.xml +function Import-IseSnippet +{ + [CmdletBinding(DefaultParameterSetName="FromFolder")] + param( + + [Parameter(Mandatory=$true, Position=0, ParameterSetName="FromFolder")] + [String] + $Path, + + [Parameter()] + [Switch] + $Recurse, + + [Parameter(Mandatory=$true, ParameterSetName="FromModule")] + [String] + $Module, + + [Parameter(ParameterSetName="FromModule")] + [Switch] + $ListAvailable + ) + + End + { + if ($Path) + { + dir "$Path\*.snippets.ps1xml" -Recurse:$Recurse | + % {$psise.CurrentPowerShellTab.Snippets.Load($_)} + } + elseif ($Module) + { + if($ListAvailable) + { + $m = Get-Module $module -ListAvailable + } + else + { + $m = Get-Module $module + } + + if (-not $m) + { + Write-Error ([Microsoft.PowerShell.Host.ISE.SnippetStrings]::ModuleNotFound) + } + + foreach ($x in $m) + { + # Get the module path and validate that there is a Snippets folder + $snipPath = Split-Path ($x.Path) -Parent + if (Test-Path "$snipPath\Snippets") + { + dir "$snipPath\Snippets\*.snippets.ps1xml" -Recurse:$Recurse | + % {$psise.CurrentPowerShellTab.Snippets.Load($_)} + } + else + { + Write-Verbose ([Microsoft.PowerShell.Host.ISE.SnippetStrings]::NoSnippetsInModule -f $x.Name,"Snippets") + } + } + } + } +} + +# .Link +# https://go.microsoft.com/fwlink/?LinkID=238787 +# .ExternalHelp ISE.psm1-help.xml +function Get-IseSnippet +{ + [CmdletBinding()] + [OutputType([System.IO.FileInfo])] + param() + $snippetPath = Join-Path (Split-Path $profile.CurrentUserCurrentHost) "Snippets" + if (Test-Path $snippetPath) + { + dir $snippetPath + } +} diff --git a/newton-cn/bin/v1.0/Modules/International/International.psd1 b/newton-cn/bin/v1.0/Modules/International/International.psd1 new file mode 100644 index 0000000..b444c92 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/International/International.psd1 @@ -0,0 +1,13 @@ +@{ +GUID="{561544E6-3A83-4D24-B140-78AD771EAF10}" +Author="Microsoft Corporation" +CompanyName="Microsoft Corporation" +Copyright="© Microsoft Corporation. All rights reserved." +ModuleVersion="2.0.0.0" +PowerShellVersion="5.1" +CLRVersion="4.0" +NestedModules="Microsoft.InternationalSettings.Commands" +HelpInfoUri= "https://go.microsoft.com/fwlink/?linkid=285548" +CmdletsToExport="Get-WinDefaultInputMethodOverride","Set-WinDefaultInputMethodOverride","Get-WinHomeLocation","Set-WinHomeLocation","Get-WinLanguageBarOption","Set-WinLanguageBarOption","Get-WinSystemLocale","Set-WinSystemLocale","Get-WinUILanguageOverride","Set-WinUILanguageOverride","Get-WinUserLanguageList","Set-WinUserLanguageList","New-WinUserLanguageList","Set-Culture","Get-WinAcceptLanguageFromLanguageListOptOut","Set-WinAcceptLanguageFromLanguageListOptOut","Get-WinCultureFromLanguageListOptOut","Set-WinCultureFromLanguageListOptOut" +CompatiblePSEditions=@("Core","Desktop") +} diff --git a/newton-cn/bin/v1.0/Modules/Kds/Kds.psd1 b/newton-cn/bin/v1.0/Modules/Kds/Kds.psd1 new file mode 100644 index 0000000..967f3f4 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Kds/Kds.psd1 @@ -0,0 +1,21 @@ +@{ +GUID="{176542F6-2A6B-11E0-AB18-D010E0D72085}" +Author="Microsoft Corporation" +CompanyName="Microsoft Corporation" +Copyright="© Microsoft Corporation. All rights reserved." +ModuleVersion="1.0.0.0" +PowerShellVersion="5.1" +CLRVersion="4.0" +ModuleToProcess="Microsoft.KeyDistributionService.Cmdlets" +HelpInfoUri="http://go.microsoft.com/fwlink/?linkid=390781" +CmdletsToExport= + "Add-KdsRootKey", + "Get-KdsRootKey", + "Test-KdsRootKey", + "Set-KdsConfiguration", + "Get-KdsConfiguration", + "Clear-KdsCache" +CompatiblePSEditions= + "Core", + "Desktop" +} diff --git a/newton-cn/bin/v1.0/Modules/LanguagePackManagement/LanguagePackManagement.psd1 b/newton-cn/bin/v1.0/Modules/LanguagePackManagement/LanguagePackManagement.psd1 new file mode 100644 index 0000000..0c111e5 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/LanguagePackManagement/LanguagePackManagement.psd1 @@ -0,0 +1,131 @@ +# +# Module manifest for module 'LanguagePackManagement' +# +# Generated on: 10/11/2021 +# + +@{ + +# Script module or binary module file associated with this manifest. +#RootModule = '' + +# Version number of this module. +ModuleVersion = '1.0' + +# Supported PSEditions +CompatiblePSEditions = @('Desktop', 'Core') + +# ID used to uniquely identify this module +GUID = 'f42dbdd4-4358-4067-8155-a4567a0aaee5' + +# Author of this module +Author = 'Microsoft Corporation' + +# Company or vendor of this module +CompanyName = 'Microsoft Corporation' + +# Copyright statement for this module +Copyright = '© Microsoft Corporation. All rights reserved.' + +# Description of the functionality provided by this module +Description = "This module allows for programmatic management of a device's languages. Users can install and uninstall language packs and features, as well as manage and query the language settings on the device." + +# Minimum version of the Windows PowerShell engine required by this module +PowerShellVersion = '5.1' + +# Name of the Windows PowerShell host required by this module +# PowerShellHostName = '' + +# Minimum version of the Windows PowerShell host required by this module +# PowerShellHostVersion = '' + +# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. +# DotNetFrameworkVersion = '' + +# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. +# CLRVersion = '' + +# Processor architecture (None, X86, Amd64) required by this module +# ProcessorArchitecture = '' + +# Modules that must be imported into the global environment prior to importing this module +# RequiredModules = @() + +# Assemblies that must be loaded prior to importing this module +# RequiredAssemblies = @() + +# Script files (.ps1) that are run in the caller's environment prior to importing this module. +# ScriptsToProcess = @() + +# Type files (.ps1xml) to be loaded when importing this module +# TypesToProcess = @() + +# Format files (.ps1xml) to be loaded when importing this module +FormatsToProcess = @("LanguagePackManagementViews.ps1xml") + +# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess +NestedModules = @('Microsoft.LanguagePackManagement.Powershell.Commands') + +# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. +FunctionsToExport = @() + +# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. +CmdletsToExport = @('Install-Language', + 'Uninstall-Language', + 'Get-InstalledLanguage', + 'Set-SystemPreferredUILanguage', + 'Get-SystemPreferredUILanguage' + ) + +# Variables to export from this module +VariablesToExport = '*' + +# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. +AliasesToExport = @("Get-Language", + "Get-PreferredLanguage", + "Get-SystemLanguage", + "Set-PreferredLanguage", + "Set-SystemLanguage" + ) + +# DSC resources to export from this module +# DscResourcesToExport = @() + +# List of all modules packaged with this module +# ModuleList = @() + +# List of all files packaged with this module +# FileList = @() + +# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. +PrivateData = @{ + + PSData = @{ + + # Tags applied to this module. These help with module discovery in online galleries. + Tags = @("Language", "LanguagePacks", "LXP", "LanguageManagement", "LanguageSettings", "International", "InternationalSettings") + + # A URL to the license for this module. + # LicenseUri = '' + + # A URL to the main website for this project. + # ProjectUri = '' + + # A URL to an icon representing this module. + # IconUri = '' + + # ReleaseNotes of this module + # ReleaseNotes = '' + + } # End of PSData hashtable + +} # End of PrivateData hashtable + +# HelpInfo URI of this module +HelpInfoURI = 'https://aka.ms/winsvr-2022-pshelp' + +# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. +# DefaultCommandPrefix = '' + +} + diff --git a/newton-cn/bin/v1.0/Modules/LanguagePackManagement/LanguagePackManagementViews.ps1xml b/newton-cn/bin/v1.0/Modules/LanguagePackManagement/LanguagePackManagementViews.ps1xml new file mode 100644 index 0000000..d2c94a4 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/LanguagePackManagement/LanguagePackManagementViews.ps1xml @@ -0,0 +1,47 @@ + + + + + + InstalledLanguage + + Microsoft.LanguagePackManagement.Powershell.Commands.InstalledLanguage + + + + + 8 + + Left + + + 15 + + Left + + + 70 + + Left + + + + + + + LanguageId + + + LanguagePacks + + + LanguageFeatures + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/LanguagePackManagement/Microsoft.LanguagePackManagement.Powershell.Commands.dll b/newton-cn/bin/v1.0/Modules/LanguagePackManagement/Microsoft.LanguagePackManagement.Powershell.Commands.dll new file mode 100644 index 0000000..68b79b3 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/LanguagePackManagement/Microsoft.LanguagePackManagement.Powershell.Commands.dll differ diff --git a/newton-cn/bin/v1.0/Modules/LanguagePackManagement/en/Microsoft.LanguagePackManagement.Powershell.Commands.Resources.dll b/newton-cn/bin/v1.0/Modules/LanguagePackManagement/en/Microsoft.LanguagePackManagement.Powershell.Commands.Resources.dll new file mode 100644 index 0000000..eee4323 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/LanguagePackManagement/en/Microsoft.LanguagePackManagement.Powershell.Commands.Resources.dll differ diff --git a/newton-cn/bin/v1.0/Modules/MMAgent/MMAgent.psd1 b/newton-cn/bin/v1.0/Modules/MMAgent/MMAgent.psd1 new file mode 100644 index 0000000..87f380e --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/MMAgent/MMAgent.psd1 @@ -0,0 +1,21 @@ +@{ + GUID = 'e1383a06-d48b-45e0-81e4-5ead146e81a8' + + NestedModules = @('ps_mmagent_v1.0.cdxml') + + Author = "Microsoft Corporation" + CompanyName = "Microsoft Corporation" + Copyright = "© Microsoft Corporation. All rights reserved." + PowerShellVersion = '5.1' + HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=285551" + + FormatsToProcess = @() + TypesToProcess = @() + + ModuleVersion = '1.0' + + AliasesToExport = @() + CmdletsToExport = @() + FunctionsToExport = @('Disable-MMAgent', 'Enable-MMAgent', 'Set-MMAgent', 'Get-MMAgent', 'Debug-MMAppPrelaunch') + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/MMAgent/ps_mmagent_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/MMAgent/ps_mmagent_v1.0.cdxml new file mode 100644 index 0000000..48becbc --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/MMAgent/ps_mmagent_v1.0.cdxml @@ -0,0 +1,165 @@ + + + + 1.0 + MMAgent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psd1 b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psd1 new file mode 100644 index 0000000..acc0910 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psd1 @@ -0,0 +1,13 @@ +@{ +GUID="eb74e8da-9ae2-482a-a648-e96550fb8733" +Author="Microsoft Corporation" +CompanyName="Microsoft Corporation" +Copyright="© Microsoft Corporation. All rights reserved." +ModuleVersion="1.0.1.0" +FunctionsToExport = @('Compress-Archive', 'Expand-Archive') +DotNetFrameworkVersion = 4.5 +CmdletsToExport = @() +AliasesToExport = @() +NestedModules="Microsoft.PowerShell.Archive.psm1" +HelpInfoURI = 'https://go.microsoft.com/fwlink/?LinkId=393254' +} diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psm1 b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psm1 new file mode 100644 index 0000000..b76a89b Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psm1 differ diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Archive/ko-KR/ArchiveResources.psd1 b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Archive/ko-KR/ArchiveResources.psd1 new file mode 100644 index 0000000..eee2b4e Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Archive/ko-KR/ArchiveResources.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Diagnostics/Microsoft.PowerShell.Diagnostics.psd1 b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Diagnostics/Microsoft.PowerShell.Diagnostics.psd1 new file mode 100644 index 0000000..6867cc0 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Diagnostics/Microsoft.PowerShell.Diagnostics.psd1 @@ -0,0 +1,17 @@ +@{ +GUID="CA046F10-CA64-4740-8FF9-2565DBA61A4F" +Author="Microsoft Corporation" +CompanyName="Microsoft Corporation" +Copyright="© Microsoft Corporation. All rights reserved." +ModuleVersion="3.0.0.0" +PowerShellVersion = '5.1' +CLRVersion="4.0" +AliasesToExport = @() +FunctionsToExport = @() +CmdletsToExport="Get-WinEvent", "Get-Counter", "Import-Counter", "Export-Counter", "New-WinEvent" +NestedModules="Microsoft.PowerShell.Commands.Diagnostics.dll" +TypesToProcess="..\..\GetEvent.types.ps1xml" +FormatsToProcess="..\..\Event.format.ps1xml","..\..\Diagnostics.format.ps1xml" +HelpInfoURI = 'https://go.microsoft.com/fwlink/?linkid=390783' +CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Host/Microsoft.PowerShell.Host.psd1 b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Host/Microsoft.PowerShell.Host.psd1 new file mode 100644 index 0000000..8ad693d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Host/Microsoft.PowerShell.Host.psd1 @@ -0,0 +1,14 @@ +@{ +GUID="56D66100-99A0-4FFC-A12D-EEE9A6718AEF" +Author="Microsoft Corporation" +CompanyName="Microsoft Corporation" +Copyright="© Microsoft Corporation. All rights reserved." +ModuleVersion="3.0.0.0" +PowerShellVersion="3.0" +CLRVersion="4.0" +AliasesToExport = @() +FunctionsToExport = @() +CmdletsToExport="Start-Transcript", "Stop-Transcript" +NestedModules="Microsoft.PowerShell.ConsoleHost.dll" +HelpInfoURI = 'https://go.microsoft.com/fwlink/?linkid=390784' +} diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/LocalAccounts.format.ps1xml b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/LocalAccounts.format.ps1xml new file mode 100644 index 0000000..91b3b35 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/LocalAccounts.format.ps1xml @@ -0,0 +1,93 @@ + + + + + Microsoft.PowerShell.Commands.LocalUser + + Microsoft.PowerShell.Commands.LocalUser + + + + + + + + + + + + + + + Name + + + Enabled + + + Description + + + + + + + + Microsoft.PowerShell.Commands.LocalGroup + + Microsoft.PowerShell.Commands.LocalGroup + + + + + + + + + + + + + Name + + + Description + + + + + + + + Microsoft.PowerShell.Commands.LocalPrincipal + + Microsoft.PowerShell.Commands.LocalPrincipal + + + + + + + + + + + + + + + ObjectClass + + + Name + + + PrincipalSource + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/Microsoft.PowerShell.LocalAccounts.dll b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/Microsoft.PowerShell.LocalAccounts.dll new file mode 100644 index 0000000..22fd512 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/Microsoft.PowerShell.LocalAccounts.dll differ diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/Microsoft.PowerShell.LocalAccounts.psd1 b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/Microsoft.PowerShell.LocalAccounts.psd1 new file mode 100644 index 0000000..4c5f249 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/Microsoft.PowerShell.LocalAccounts.psd1 @@ -0,0 +1,32 @@ +@{ +RootModule = 'Microsoft.Powershell.LocalAccounts' +ModuleVersion = '1.0.0.0' +GUID = '8e362604-2c0b-448f-a414-a6a690a644e2' +Author = 'Microsoft Corporation' +CompanyName = 'Microsoft Corporation' +Copyright = '© Microsoft Corporation. All rights reserved.' +Description = 'Provides cmdlets to work with local users and local groups' +PowerShellVersion = '5.1' +CLRVersion = '4.0' +FormatsToProcess = @('LocalAccounts.format.ps1xml') +CmdletsToExport = @( + 'Add-LocalGroupMember', + 'Disable-LocalUser', + 'Enable-LocalUser', + 'Get-LocalGroup', + 'Get-LocalGroupMember', + 'Get-LocalUser', + 'New-LocalGroup', + 'New-LocalUser', + 'Remove-LocalGroup', + 'Remove-LocalGroupMember', + 'Remove-LocalUser', + 'Rename-LocalGroup', + 'Rename-LocalUser', + 'Set-LocalGroup', + 'Set-LocalUser' + ) +AliasesToExport= @( "algm", "dlu", "elu", "glg", "glgm", "glu", "nlg", "nlu", "rlg", "rlgm", "rlu", "rnlg", "rnlu", "slg", "slu") +HelpInfoURI = 'https://go.microsoft.com/fwlink/?LinkId=717973' +CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/ko/Microsoft.PowerShell.LocalAccounts.Resources.dll b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/ko/Microsoft.PowerShell.LocalAccounts.Resources.dll new file mode 100644 index 0000000..203512c Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.LocalAccounts/1.0.0.0/ko/Microsoft.PowerShell.LocalAccounts.Resources.dll differ diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1 b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1 new file mode 100644 index 0000000..0b09587 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1 @@ -0,0 +1,103 @@ +@{ +GUID="EEFCB906-B326-4E99-9F54-8B4BB6EF3C6D" +Author="Microsoft Corporation" +CompanyName="Microsoft Corporation" +Copyright="© Microsoft Corporation. All rights reserved." +ModuleVersion="3.1.0.0" +PowerShellVersion="5.1" +CLRVersion="4.0" +NestedModules="Microsoft.PowerShell.Commands.Management.dll" +HelpInfoURI = 'https://go.microsoft.com/fwlink/?linkid=390785' +AliasesToExport = @("gcb", "scb", "gin", "gtz", "stz") +FunctionsToExport = @() +CmdletsToExport=@("Add-Content", + "Clear-Content", + "Clear-ItemProperty", + "Join-Path", + "Convert-Path", + "Copy-ItemProperty", + "Get-EventLog", + "Clear-EventLog", + "Write-EventLog", + "Limit-EventLog", + "Show-EventLog", + "New-EventLog", + "Remove-EventLog", + "Get-ChildItem", + "Get-Content", + "Get-ItemProperty", + "Get-ItemPropertyValue", + "Get-WmiObject", + "Invoke-WmiMethod", + "Move-ItemProperty", + "Get-Location", + "Set-Location", + "Push-Location", + "Pop-Location", + "New-PSDrive", + "Remove-PSDrive", + "Get-PSDrive", + "Get-Item", + "New-Item", + "Set-Item", + "Remove-Item", + "Move-Item", + "Rename-Item", + "Copy-Item", + "Clear-Item", + "Invoke-Item", + "Get-PSProvider", + "New-ItemProperty", + "Split-Path", + "Test-Path", + "Get-Process", + "Stop-Process", + "Wait-Process", + "Debug-Process", + "Start-Process", + "Remove-ItemProperty", + "Remove-WmiObject", + "Rename-ItemProperty", + "Register-WmiEvent", + "Resolve-Path", + "Get-Service", + "Stop-Service", + "Start-Service", + "Suspend-Service", + "Resume-Service", + "Restart-Service", + "Set-Service", + "New-Service", + "Set-Content", + "Set-ItemProperty", + "Set-WmiInstance", + "Get-Transaction", + "Start-Transaction", + "Complete-Transaction", + "Undo-Transaction", + "Use-Transaction", + "New-WebServiceProxy", + "Get-HotFix", + "Test-Connection", + "Enable-ComputerRestore", + "Disable-ComputerRestore", + "Checkpoint-Computer", + "Get-ComputerRestorePoint", + "Restart-Computer", + "Stop-Computer", + "Restore-Computer", + "Add-Computer", + "Remove-Computer", + "Test-ComputerSecureChannel", + "Reset-ComputerMachinePassword", + "Rename-Computer", + "Get-ControlPanelItem", + "Show-ControlPanelItem", + "Clear-Recyclebin", + "Get-Clipboard", + "Set-Clipboard", + "Get-ComputerInfo", + "Get-TimeZone", + "Set-TimeZone") +CompatiblePSEditions = @('Desktop','Core') +} diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataAdapter.ps1 b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataAdapter.ps1 new file mode 100644 index 0000000..00b21e6 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataAdapter.ps1 differ diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtils.psd1 b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtils.psd1 new file mode 100644 index 0000000..842177f Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtils.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtils.psm1 b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtils.psm1 new file mode 100644 index 0000000..27fa9fb Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtils.psm1 differ diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtilsHelper.ps1 b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtilsHelper.ps1 new file mode 100644 index 0000000..9a258a3 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataUtilsHelper.ps1 differ diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataV4Adapter.ps1 b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataV4Adapter.ps1 new file mode 100644 index 0000000..7ee88ff --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.ODataUtils/Microsoft.PowerShell.ODataV4Adapter.ps1 @@ -0,0 +1,2668 @@ +Import-LocalizedData LocalizedData -FileName Microsoft.PowerShell.ODataUtilsStrings.psd1 + +# Add .NET classes used by the module +Add-Type -TypeDefinition $script:BaseClassDefinitions + +######################################################### +# Generates PowerShell module containing client side +# proxy cmdlets that can be used to interact with an +# OData based server side endpoint. +######################################################### +function ExportODataEndpointProxy +{ + param + ( + [string] $Uri, + [string] $OutputModule, + [string] $MetadataUri, + [PSCredential] $Credential, + [string] $CreateRequestMethod, + [string] $UpdateRequestMethod, + [string] $CmdletAdapter, + [Hashtable] $ResourceNameMapping, + [switch] $Force, + [Hashtable] $CustomData, + [switch] $AllowClobber, + [switch] $AllowUnsecureConnection, + [Hashtable] $Headers, + [string] $ProgressBarStatus, + [System.Management.Automation.PSCmdlet] $PSCmdlet + ) + + # Record of all metadata XML files which have been opened for parsing + # used to avoid parsing the same file twice, if referenced in multiple + # metadata files + $script:processedFiles = @() + + # Record of all referenced and parsed metadata files (including entry point metadata) + $script:GlobalMetadata = New-Object System.Collections.ArrayList + + # The namespace name might have invalid characters or might be conflicting with class names in inheritance scenarios + # We will be normalizing these namespaces and saving them into $normalizedNamespaces, where key is the original namespace and value is normalized namespace + $script:normalizedNamespaces = @{} + + # This information will be used during recursive referenced metadata files loading + $ODataEndpointProxyParameters = [ODataUtils.ODataEndpointProxyParameters] @{ + "MetadataUri" = $MetadataUri; + "Uri" = $Uri; + "Credential" = $Credential; + "OutputModule" = $OutputModule; + "Force" = $Force; + "AllowClobber" = $AllowClobber; + "AllowUnsecureConnection" = $AllowUnsecureConnection; + } + + # Recursively fetch all metadatas (referenced by entry point metadata) + $GlobalMetadata = GetTypeInfo -callerPSCmdlet $pscmdlet -MetadataUri $MetadataUri -ODataEndpointProxyParameters $ODataEndpointProxyParameters -Headers $Headers + # Now that we are done with recursive metadata references parsing we can get rid of this variable + $script:GlobalMetadata = $null + + VerifyMetadata $GlobalMetadata $AllowClobber.IsPresent $PSCmdlet $ProgressBarStatus + + # Get Uri Resource path key format. It can be either 'EmbeddedKey' or 'SeparateKey'. + # If not provided, deault value will be set to 'EmbeddedKey'. + $UriResourcePathKeyFormat = 'EmbeddedKey' + if ($CustomData -and $CustomData.ContainsKey("UriResourcePathKeyFormat")) + { + $UriResourcePathKeyFormat = $CustomData."UriResourcePathKeyFormat" + } + + GenerateClientSideProxyModule $GlobalMetadata $ODataEndpointProxyParameters $OutputModule $CreateRequestMethod $UpdateRequestMethod $CmdletAdapter $ResourceNameMapping $CustomData $UriResourcePathKeyFormat $ProgressBarStatus $script:normalizedNamespaces +} + +######################################################### +# GetTypeInfo is a helper method used to get all the types +# from metadata files in a recursive manner +######################################################### +function GetTypeInfo +{ + param + ( + [System.Management.Automation.PSCmdlet] $callerPSCmdlet, + [string] $MetadataUri, + [ODataUtils.ODataEndpointProxyParameters] $ODataEndpointProxyParameters, + [Hashtable] $Headers + ) + + if($callerPSCmdlet -eq $null) { throw ($LocalizedData.ArguementNullError -f "callerPSCmdlet", "GetTypeInfo") } + + $metadataSet = New-Object System.Collections.ArrayList + $metadataXML = GetMetaData $MetadataUri $callerPSCmdlet $ODataEndpointProxyParameters.Credential $Headers $ODataEndpointProxyParameters.AllowUnsecureConnection + $script:processedFiles += $MetadataUri + + # parses all referenced metadata XML files recursively + foreach ($reference in $metadataXML.Edmx.Reference) + { + if (-not $script:processedFiles.Contains($reference.Uri)) + { + $tmpMetadataSet = $null + $tmpMetadataSet = GetTypeInfo -callerPSCmdlet $callerPSCmdlet -MetadataUri $reference.Uri -ODataEndpointProxyParameters $ODataEndpointProxyParameters + AddMetadataToMetadataSet -Metadatas $metadataSet -NewMetadata $tmpMetadataSet + } + } + + $metadatas = ParseMetadata -MetadataXML $metadataXML -ODataVersion $metadataXML.Edmx.Version -MetadataUri $MetadataUri -Uri $ODataEndpointProxyParameters.Uri -MetadataSet $script:GlobalMetadata + AddMetadataToMetadataSet -Metadatas $script:GlobalMetadata -NewMetadata $metadatas + AddMetadataToMetadataSet -Metadatas $metadataSet -NewMetadata $metadatas + + return $metadataSet +} + +function AddMetadataToMetadataSet +{ + param + ( + [System.Collections.ArrayList] $Metadatas, + $NewMetadata + ) + + if($NewMetadata -eq $null) { throw ($LocalizedData.ArguementNullError -f "NewMetadata", "AddMetadataToMetadataSet") } + + if ($NewMetadata.GetType().Name -eq 'MetadataV4') + { + $Metadatas.Add($NewMetadata) | Out-Null + } + else + { + $Metadatas.AddRange($NewMetadata) | Out-Null + } +} + +######################################################### +# Normalization of Namespace name will be required in following scenarios: +# 1. Namespace name contains combination of dots and numbers +# 2. Namespace name collides with Class name (EntityType, EntitySet, etc.) +# If normalization is needed, all dots will be replaced with underscores and Ns suffix added +# User will receive warning notifying her about the namespace name change +######################################################### +function NormalizeNamespace +{ + param + ( + [string] $MetadataNamespace, + [string] $MetadataUri, + [Hashtable] $NormalizedNamespaces, + [boolean] $DoesNamespaceConflictsWithClassName + ) + + $doesNamespaceContainsInvalidChars = $false + + # Check if namespace name contains invalid combination if dots and numbers + if ($MetadataNamespace -match '\.[0-9]' -or $MetadataNamespace -match '[0-9]\.') + { + # Normalization needed + $doesNamespaceContainsInvalidChars = $true + } + + # Normalize if needed + if ($doesNamespaceContainsInvalidChars -or $DoesNamespaceConflictsWithClassName) + { + if ($NormalizedNamespaces.ContainsKey($MetadataNamespace)) + { + # It's possible we've already attemted to normalize that namespace. In that case we'll update normalized name. + $NormalizedNamespaces[$MetadataNamespace] = NormalizeNamespaceHelper $NormalizedNamespaces[$MetadataNamespace] $doesNamespaceContainsInvalidChars $DoesNamespaceConflictsWithClassName + } + else + { + $NormalizedNamespaces.Add($MetadataNamespace, (NormalizeNamespaceHelper $MetadataNamespace $doesNamespaceContainsInvalidChars $DoesNamespaceConflictsWithClassName)) + } + } + + # Print warning + if ($doesNamespaceContainsInvalidChars) + { + # Normalization needed + $warningMessage = ($LocalizedData.InValidSchemaNamespaceContainsInvalidChars -f $MetadataUri, $MetadataNamespace, $NormalizedNamespaces[$MetadataNamespace]) + Write-Warning $warningMessage + } + if ($DoesNamespaceConflictsWithClassName) + { + # Collision between namespace name and type name detected (example: namespace TaskService { class Service : Service.BasicService { ... } ... }) + # Normalization needed + $warningMessage = ($LocalizedData.InValidSchemaNamespaceConflictWithClassName -f $MetadataUri, $MetadataNamespace, $NormalizedNamespaces[$MetadataNamespace]) + Write-Warning $warningMessage + } +} + +function NormalizeNamespaceCollisionWithClassName +{ + param + ( + [string] $InheritingType, + [string] $BaseTypeName, + [string] $MetadataUri + ) + + if (![string]::IsNullOrEmpty($BaseTypeName)) + { + $dotNetNamespace = '' + if ($BaseTypeName.LastIndexOf(".") -gt 0) + { + # BaseTypeStr contains Namespace and TypeName. Extract Namespace name. + $dotNetNamespace = $BaseTypeName.SubString(0, $BaseTypeName.LastIndexOf(".")) + } + + if (![string]::IsNullOrEmpty($dotNetNamespace) -and $InheritingType -eq $dotNetNamespace) + { + # Collision between namespace name and type name detected (example: namespace TaskService { class Service : Service.BasicService { ... } ... }) + # Normalization needed + NormalizeNamespace $dotNetNamespace $MetadataUri $script:normalizedNamespaces $true + break + } + } +} + +######################################################### +# This helper method is used by functions, +# writing directly to CDXML files or to .Net namespace/class definitions CompplexTypes file +######################################################### +function GetNamespace +{ + param + ( + [string] $Namespace, + $NormalizedNamespaces, + [boolean] $isClassNameIncluded = $false + ) + + $dotNetNamespace = $Namespace + $dotNetClassName = '' + + # Extract only namespace name + if ($isClassNameIncluded) + { + if ($Namespace.LastIndexOf(".") -gt 0) + { + # For example, from following namespace (Namespace.TypeName) Service.1.0.0.Service we'll extract only namespace name, which is Service.1.0.0 + $dotNetNamespace = $Namespace.SubString(0, $Namespace.LastIndexOf(".")) + $dotNetClassName = $Namespace.SubString($Namespace.LastIndexOf(".") + 1, $Namespace.Length - $Namespace.LastIndexOf(".") - 1) + } + } + + # Check if the namespace has to be normalized. + if ($NormalizedNamespaces.ContainsKey($dotNetNamespace)) + { + $dotNetNamespace = $NormalizedNamespaces.Get_Item($dotNetNamespace) + } + + if (![string]::IsNullOrEmpty($dotNetClassName)) + { + return ($dotNetNamespace + "." + $dotNetClassName) + } + else + { + return $dotNetNamespace + } +} + +function NormalizeNamespaceHelper +{ + param + ( + [string] $Namespace, + [boolean] $DoesNamespaceContainsInvalidChars, + [boolean] $DoesNamespaceConflictsWithClassName + ) + + # For example, following namespace: Service.1.0.0 + # Will change to: Service_1_0_0 + # Ns postfix in Namespace name will allow to diffirintiate between this namespace + # and a colliding type name from different namespace + $updatedNs = $Namespace + if ($DoesNamespaceContainsInvalidChars) + { + $updatedNs = $updatedNs.Replace('.', '_') + } + if ($DoesNamespaceConflictsWithClassName) + { + $updatedNs = $updatedNs + "Ns" + } + + $updatedNs +} + +######################################################### +# Processes EntityTypes (OData V4 schema) from plain text +# xml metadata into our custom structure +######################################################### +function ParseEntityTypes +{ + param + ( + [System.Xml.XmlElement] $SchemaXML, + [ODataUtils.MetadataV4] $Metadata, + [System.Collections.ArrayList] $GlobalMetadata, + [hashtable] $EntityAndComplexTypesQueue, + [string] $CustomNamespace, + [AllowEmptyString()] + [string] $Alias + ) + + if($SchemaXML -eq $null) { throw ($LocalizedData.ArguementNullError -f "SchemaXML", "ParseEntityTypes") } + + foreach ($entityType in $SchemaXML.EntityType) + { + $baseType = $null + + if ($entityType.BaseType -ne $null) + { + # add it to the processing queue + $baseType = GetBaseType $entityType $Metadata $SchemaXML.Namespace $GlobalMetadata + if ($baseType -eq $null) + { + $EntityAndComplexTypesQueue[$entityType.BaseType] += @(@{type='EntityType'; value=$entityType}) + } + + # Check if Namespace has to be normalized because of the collision with the inheriting Class name + NormalizeNamespaceCollisionWithClassName -InheritingType $entityType.Name -BaseTypeName $entityType.BaseType -MetadataUri $Metadata.Uri + } + + [ODataUtils.EntityTypeV4] $newType = ParseMetadataTypeDefinition $entityType $baseType $Metadata $schema.Namespace $Alias $true $entityType.BaseType + $Metadata.EntityTypes += $newType + AddDerivedTypes $newType $entityAndComplexTypesQueue $Metadata $SchemaXML.Namespace + } +} + +######################################################### +# Processes ComplexTypes from plain text xml metadata +# into our custom structure +######################################################### +function ParseComplexTypes +{ + param + ( + [System.Xml.XmlElement] $SchemaXML, + [ODataUtils.MetadataV4] $Metadata, + [System.Collections.ArrayList] $GlobalMetadata, + [hashtable] $EntityAndComplexTypesQueue, + [string] $CustomNamespace, + [AllowEmptyString()] + [string] $Alias + ) + + if($SchemaXML -eq $null) { throw ($LocalizedData.ArguementNullError -f "SchemaXML", "ParseComplexTypes") } + + foreach ($complexType in $SchemaXML.ComplexType) + { + $baseType = $null + + if ($complexType.BaseType -ne $null) + { + # add it to the processing queue + $baseType = GetBaseType $complexType $metadata $SchemaXML.Namespace $GlobalMetadata + if ($baseType -eq $null -and $entityAndComplexTypesQueue -ne $null -and $entityAndComplexTypesQueue.ContainsKey($complexType.BaseType)) + { + $entityAndComplexTypesQueue[$complexType.BaseType] += @(@{type='ComplexType'; value=$complexType}) + continue + } + + # Check if Namespace has to be normalized because of the collision with the inheriting Class name + NormalizeNamespaceCollisionWithClassName -InheritingType $complexType.Name -BaseTypeName $complexType.BaseType -MetadataUri $Metadata.Uri + } + + [ODataUtils.EntityTypeV4] $newType = ParseMetadataTypeDefinition $complexType $baseType $Metadata $schema.Namespace -Alias $Alias $false $complexType.BaseType + $Metadata.ComplexTypes += $newType + AddDerivedTypes $newType $entityAndComplexTypesQueue $metadata $schema.Namespace + } +} + +######################################################### +# Processes TypeDefinition from plain text xml metadata +# into our custom structure +######################################################### +function ParseTypeDefinitions +{ + param + ( + [System.Xml.XmlElement] $SchemaXML, + [ODataUtils.MetadataV4] $Metadata, + [System.Collections.ArrayList] $GlobalMetadata, + [string] $CustomNamespace, + [AllowEmptyString()] + [string] $Alias + ) + + if($SchemaXML -eq $null) { throw ($LocalizedData.ArguementNullError -f "SchemaXML", "ParseTypeDefinitions") } + + + foreach ($typeDefinition in $SchemaXML.TypeDefinition) + { + $newType = [ODataUtils.EntityTypeV4] @{ + "Namespace" = $Metadata.Namespace; + "Alias" = $Metadata.Alias; + "Name" = $typeDefinition.Name; + "BaseTypeStr" = $typeDefinition.UnderlyingType; + } + $Metadata.TypeDefinitions += $newType + } +} + +######################################################### +# Processes EnumTypes from plain text xml metadata +# into our custom structure +######################################################### +function ParseEnumTypes +{ + param + ( + [System.Xml.XmlElement] $SchemaXML, + [ODataUtils.MetadataV4] $Metadata + ) + + if($SchemaXML -eq $null) { throw ($LocalizedData.ArguementNullError -f "SchemaXML", "ParseEnumTypes") } + + foreach ($enum in $SchemaXML.EnumType) + { + $newEnumType = [ODataUtils.EnumType] @{ + "Namespace" = $Metadata.Namespace; + "Alias" = $Metadata.Alias; + "Name" = $enum.Name; + "UnderlyingType" = $enum.UnderlyingType; + "IsFlags" = $enum.IsFlags; + "Members" = @() + } + + if (!$newEnumType.UnderlyingType) + { + # If no type specified set the default type which is Edm.Int32 + $newEnumType.UnderlyingType = "Edm.Int32" + } + + if ($newEnumType.IsFlags -eq $null) + { + # If no value is specified for IsFlags, its value defaults to false. + $newEnumType.IsFlags = $false + } + + $enumValue = 0 + $currentEnumValue = 0 + + # Now parse EnumType elements + foreach ($element in $enum.Member) + { + + if ($element.Value -eq "" -and $newEnumType.IsFlags -eq $true) + { + # When IsFlags set to true each edm:Member element MUST specify a non-negative integer Value in the value attribute + $errorMessage = ($LocalizedData.InValidMetadata) + $detailedErrorMessage = "When IsFlags set to true each edm:Member element MUST specify a non-negative integer Value in the value attribute in " + $newEnumType.Name + " EnumType" + $exception = [System.InvalidOperationException]::new($errorMessage, $detailedErrorMessage) + $errorRecord = CreateErrorRecordHelper "InValidMetadata" $null ([System.Management.Automation.ErrorCategory]::InvalidData) $detailedErrorMessage nu + $PSCmdlet.ThrowTerminatingError($errorRecord) + } + elseif (($element.Value -eq $null) -or ($element.Value.GetType().Name -eq "Int32" -and $element.Value -eq "")) + { + # If no values are specified, the members are assigned consecutive integer values in the order of their appearance, + # starting with zero for the first member. + $currentEnumValue = $enumValue + } + else + { + $currentEnumValue = $element.Value + } + + $tmp = [ODataUtils.EnumMember] @{ + "Name" = $element.Name; + "Value" = $currentEnumValue; + } + + $newEnumType.Members += $tmp + $enumValue++ + } + + $Metadata.EnumTypes += $newEnumType + } +} + +######################################################### +# Processes SingletonTypes from plain text xml metadata +# into our custom structure +######################################################### +function ParseSingletonTypes +{ + param + ( + [System.Xml.XmlElement] $SchemaEntityContainerXML, + [ODataUtils.MetadataV4] $Metadata + ) + + if($SchemaEntityContainerXML -eq $null) { throw ($LocalizedData.ArguementNullError -f "SchemaEntityContainerXML", "ParseSingletonTypes") } + + foreach ($singleton in $SchemaEntityContainerXML.Singleton) + { + $navigationPropertyBindings = @() + + foreach ($navigationPropertyBinding in $singleton.NavigationPropertyBinding) + { + $tmp = [ODataUtils.NavigationPropertyBinding] @{ + "Path" = $navigationPropertyBinding.Path; + "Target" = $navigationPropertyBinding.Target; + } + + $navigationPropertyBindings += $tmp + } + + $newSingletonType = [ODataUtils.SingletonType] @{ + "Namespace" = $Metadata.Namespace; + "Alias" = $Metadata.Alias; + "Name" = $singleton.Name; + "Type" = $singleton.Type; + "NavigationPropertyBindings" = $navigationPropertyBindings; + } + + $Metadata.SingletonTypes += $newSingletonType + } +} + +######################################################### +# Processes EntitySets from plain text xml metadata +# into our custom structure +######################################################### +function ParseEntitySets +{ + param + ( + [System.Xml.XmlElement] $SchemaEntityContainerXML, + [ODataUtils.MetadataV4] $Metadata, + [string] $Namespace, + [AllowEmptyString()] + [string] $Alias + ) + + if($SchemaEntityContainerXML -eq $null) { throw ($LocalizedData.ArguementNullError -f "SchemaEntityContainerXML", "ParseEntitySets") } + + $entityTypeToEntitySetMapping = @{}; + foreach ($entitySet in $SchemaEntityContainerXML.EntitySet) + { + $entityType = $metadata.EntityTypes | Where-Object { $_.Name -eq $entitySet.EntityType.Split('.')[-1] } + $entityTypeName = $entityType.Name + + if($entityTypeToEntitySetMapping.ContainsKey($entityTypeName)) + { + $existingEntitySetName = $entityTypeToEntitySetMapping[$entityTypeName] + throw ($LocalizedData.EntityNameConflictError -f $entityTypeName, $existingEntitySetName, $entitySet.Name, $entityTypeName ) + } + else + { + $entityTypeToEntitySetMapping.Add($entityTypeName, $entitySet.Name) + } + + $newEntitySet = [ODataUtils.EntitySetV4] @{ + "Namespace" = $Namespace; + "Alias" = $Alias; + "Name" = $entitySet.Name; + "Type" = $entityType; + } + + $Metadata.EntitySets += $newEntitySet + } +} + +######################################################### +# Processes Actions from plain text xml metadata +# into our custom structure +######################################################### +function ParseActions +{ + param + ( + [System.Object[]] $SchemaActionsXML, + [ODataUtils.MetadataV4] $Metadata + ) + + if($SchemaActionsXML -eq $null) { throw ($LocalizedData.ArguementNullError -f "SchemaActionsXML", "ParseActions") } + + foreach ($action in $SchemaActionsXML) + { + # HttpMethod is only used for legacy Service Operations + if ($action.HttpMethod -eq $null) + { + $newAction = [ODataUtils.ActionV4] @{ + "Namespace" = $Metadata.Namespace; + "Alias" = $Metadata.Alias; + "Name" = $action.Name; + "Action" = $Metadata.Namespace + '.' + $action.Name; + } + + # Actions are always SideEffecting, otherwise it's an OData function + foreach ($parameter in $action.Parameter) + { + if ($parameter.Nullable -ne $null) + { + $parameterIsNullable = [System.Convert]::ToBoolean($parameter.Nullable); + } + else + { + $parameterIsNullable = $true + } + + $newParameter = [ODataUtils.TypeProperty] @{ + "Name" = $parameter.Name; + "TypeName" = $parameter.Type; + "IsNullable" = $parameterIsNullable; + } + + $newAction.Parameters += $newParameter + } + + if ($action.EntitySet -ne $null) + { + $newAction.EntitySet = $metadata.EntitySets | Where-Object { $_.Name -eq $action.EntitySet } + } + + $Metadata.Actions += $newAction + } + } +} + +######################################################### +# Processes Functions from plain text xml metadata +# into our custom structure +######################################################### +function ParseFunctions +{ + param + ( + [System.Object[]] $SchemaFunctionsXML, + [ODataUtils.MetadataV4] $Metadata + ) + + if($SchemaFunctionsXML -eq $null) { throw ($LocalizedData.ArguementNullError -f "SchemaFunctionsXML", "ParseFunctions") } + + foreach ($function in $SchemaFunctionsXML) + { + # HttpMethod is only used for legacy Service Operations + if ($function.HttpMethod -eq $null) + { + $newFunction = [ODataUtils.FunctionV4] @{ + "Namespace" = $Metadata.Namespace; + "Alias" = $Metadata.Alias; + "Name" = $function.Name; + "Function" = $Metadata.Namespace + '.' + $function.Name; + "EntitySet" = $function.EntitySetPath; + "ReturnType" = $function.ReturnType; + } + + # Future TODO - consider removing this hack once all the service we run against fix this issue + # Hack - sometimes service does not return ReturnType, however this information can be found in InnerXml + if ($newFunction.ReturnType -eq '' -or $newFunction.ReturnType -eq 'System.Xml.XmlElement') + { + try + { + [xml] $innerXML = '' + $function.InnerXml + '' + $newFunction.Returntype = $innerXML.Params.ReturnType.Type + } + catch + { + # Do nothing + } + } + + # Keep only EntityType name + $newFunction.ReturnType = $newFunction.ReturnType.Replace('Collection(', '') + $newFunction.ReturnType = $newFunction.ReturnType.Replace(')', '') + + # Actions are always SideEffecting, otherwise it's an OData function + foreach ($parameter in $function.Parameter) + { + if ($parameter.Nullable -ne $null) + { + $parameterIsNullable = [System.Convert]::ToBoolean($parameter.Nullable); + } + + $newParameter = [ODataUtils.Parameter] @{ + "Name" = $parameter.Name; + "Type" = $parameter.Type; + "Nullable" = $parameterIsNullable; + } + + $newFunction.Parameters += $newParameter + } + + $Metadata.Functions += $newFunction + } + } +} + +######################################################### +# Processes plain text xml metadata (OData V4 schema version) into our custom structure +# MetadataSet contains all parsed so far referenced Metadatas (for base class lookup) +######################################################### +function ParseMetadata +{ + param + ( + [xml] $MetadataXML, + [string] $ODataVersion, + [string] $MetadataUri, + [string] $Uri, + [System.Collections.ArrayList] $MetadataSet + ) + + if($MetadataXML -eq $null) { throw ($LocalizedData.ArguementNullError -f "MetadataXML", "ParseMetadata") } + + # This is a processing queue for those types that require base types that haven't been defined yet + $entityAndComplexTypesQueue = @{} + [System.Collections.ArrayList] $metadatas = [System.Collections.ArrayList]::new() + + foreach ($schema in $MetadataXML.Edmx.DataServices.Schema) + { + if ($schema -eq $null) + { + Write-Error $LocalizedData.EmptySchema + continue + } + + [ODataUtils.MetadataV4] $metadata = [ODataUtils.MetadataV4]::new() + $metadata.ODataVersion = $ODataVersion + $metadata.MetadataUri = $MetadataUri + $metadata.Uri = $Uri + $metadata.Namespace = $schema.Namespace + $metadata.Alias = $schema.Alias + + ParseEntityTypes -SchemaXML $schema -metadata $metadata -GlobalMetadata $MetadataSet -EntityAndComplexTypesQueue $entityAndComplexTypesQueue -CustomNamespace $CustomNamespace -Alias $metadata.Alias + ParseComplexTypes -SchemaXML $schema -metadata $metadata -GlobalMetadata $MetadataSet -EntityAndComplexTypesQueue $entityAndComplexTypesQueue -CustomNamespace $CustomNamespace -Alias $metadata.Alias + ParseTypeDefinitions -SchemaXML $schema -metadata $metadata -GlobalMetadata $MetadataSet -CustomNamespace $CustomNamespace -Alias $metadata.Alias + ParseEnumTypes -SchemaXML $schema -metadata $metadata + + foreach ($entityContainer in $schema.EntityContainer) + { + if ($entityContainer.IsDefaultEntityContainer) + { + $metadata.DefaultEntityContainerName = $entityContainer.Name + } + + ParseSingletonTypes -SchemaEntityContainerXML $entityContainer -Metadata $metadata + ParseEntitySets -SchemaEntityContainerXML $entityContainer -Metadata $metadata -Namespace $schema.Namespace -Alias $schema.Alias + } + + if ($schema.Action) + { + ParseActions -SchemaActionsXML $schema.Action -Metadata $metadata + } + + if ($schema.Function) + { + ParseFunctions -SchemaFunctionsXML $schema.Function -Metadata $metadata + } + + # In this call we check if the Namespace or Alias have to be normalized because it has invalid combination of dots and numbers. + # Note: In ParseEntityTypes and ParseComplexTypes we check for scenario where namespace/alias collide with inheriting class name. + NormalizeNamespace $metadata.Namespace $metadata.Uri $script:normalizedNamespaces $false + NormalizeNamespace $metadata.Alias $metadata.Uri $script:normalizedNamespaces $false + + $metadatas.Add($metadata) | Out-Null + } + + $metadatas +} + +######################################################### +# Verifies processed metadata for correctness +######################################################### +function VerifyMetadata +{ + param + ( + [System.Collections.ArrayList] $metadataSet, + [boolean] $allowClobber, + $callerPSCmdlet, + [string] $progressBarStatus + ) + + if($callerPSCmdlet -eq $null) { throw ($LocalizedData.ArguementNullError -f "PSCmdlet", "VerifyMetaData") } + if($progressBarStatus -eq $null) { throw ($LocalizedData.ArguementNullError -f "ProgressBarStatus", "VerifyMetaData") } + + Write-Verbose $LocalizedData.VerboseVerifyingMetadata + + $reservedProperties = @("Filter", "OrderBy", "Skip", "Top", "ConnectionUri", "CertificateThumbPrint", "Credential") + $validEntitySets = @() + $sessionCommands = Get-Command -All + + + foreach ($metadata in $metadataSet) + { + foreach ($entitySet in $metadata.EntitySets) + { + if ($entitySet.Type -eq $null) + { + $errorMessage = ($LocalizedData.EntitySetUndefinedType -f $metadata.MetadataUri, $entitySet.Name) + $exception = [System.InvalidOperationException]::new($errorMessage) + $errorRecord = CreateErrorRecordHelper "ODataEndpointProxyInvalidMetaDataUri" $null ([System.Management.Automation.ErrorCategory]::InvalidArgument) $exception $metadata.MetadataUri + $callerPSCmdlet.ThrowTerminatingError($errorRecord) + } + + $hasConflictingProperty = $false + $hasConflictingCommand = $false + $entityAndNavigationProperties = $entitySet.Type.EntityProperties + $entitySet.Type.NavigationProperties + foreach($entityProperty in $entityAndNavigationProperties) + { + if($reservedProperties.Contains($entityProperty.Name)) + { + $hasConflictingProperty = $true + if(!$allowClobber) + { + # Write Error message and skip current Entity Set. + $errorMessage = ($LocalizedData.SkipEntitySetProxyCreation -f $entitySet.Name, $entitySet.Type.Name, $entityProperty.Name) + $exception = [System.InvalidOperationException]::new($errorMessage) + $errorRecord = CreateErrorRecordHelper "ODataEndpointDefaultPropertyCollision" $null ([System.Management.Automation.ErrorCategory]::InvalidOperation) $exception $metadata.MetadataUri + $callerPSCmdlet.WriteError($errorRecord) + } + else + { + $warningMessage = ($LocalizedData.EntitySetProxyCreationWithWarning -f $entitySet.Name, $entityProperty.Name, $entitySet.Type.Name) + $callerPSCmdlet.WriteWarning($warningMessage) + } + } + } + + foreach($currentCommand in $sessionCommands) + { + if(($null -ne $currentCommand.Noun -and $currentCommand.Noun -eq $entitySet.Name) -and + ($currentCommand.Verb -eq "Get" -or + $currentCommand.Verb -eq "Set" -or + $currentCommand.Verb -eq "New" -or + $currentCommand.Verb -eq "Remove")) + { + $hasConflictingCommand = $true + VerifyMetadataHelper $LocalizedData.SkipEntitySetConflictCommandCreation ` + $LocalizedData.EntitySetConflictCommandCreationWithWarning ` + $entitySet.Name $currentCommand.Name $metadata.MetadataUri $allowClobber $callerPSCmdlet + } + } + + foreach($currentAction in $metadata.Actions) + { + $actionCommand = "Invoke-" + "$($entitySet.Name)$($currentAction.Verb)" + + foreach($currentCommand in $sessionCommands) + { + if($actionCommand -eq $currentCommand.Name) + { + $hasConflictingCommand = $true + VerifyMetadataHelper $LocalizedData.SkipEntitySetConflictCommandCreation ` + $LocalizedData.EntitySetConflictCommandCreationWithWarning $entitySet.Name ` + $currentCommand.Name $metadata.MetadataUri $allowClobber $callerPSCmdlet + } + } + } + + if(!($hasConflictingProperty -or $hasConflictingCommand)-or $allowClobber) + { + $validEntitySets += $entitySet + } + } + + $metadata.EntitySets = $validEntitySets + + $validServiceActions = @() + $hasConflictingServiceActionCommand + foreach($currentAction in $metadata.Actions) + { + $serviceActionCommand = "Invoke-" + "$($currentAction.Verb)" + + foreach($currentCommand in $sessionCommands) + { + if($serviceActionCommand -eq $currentCommand.Name) + { + $hasConflictingServiceActionCommand = $true + VerifyMetadataHelper $LocalizedData.SkipConflictServiceActionCommandCreation ` + $LocalizedData.ConflictServiceActionCommandCreationWithWarning $entitySet.Name ` + $currentCommand.Name $metadata.MetadataUri $allowClobber $callerPSCmdlet + } + } + + if(!$hasConflictingServiceActionCommand -or $allowClobber) + { + $validServiceActions += $currentAction + } + } + + $metadata.Actions = $validServiceActions + } + + # Update Progress bar. + ProgressBarHelper "Export-ODataEndpointProxy" $progressBarStatus 5 20 1 1 +} + +######################################################### +# Takes xml definition of a class from metadata document, +# plus existing metadata structure and finds its base class +######################################################### +function GetBaseType +{ + param + ( + [System.Xml.XmlElement] $MetadataEntityDefinition, + [ODataUtils.MetadataV4] $Metadata, + [string] $Namespace, + [System.Collections.ArrayList] $GlobalMetadata + ) + + if ($metadataEntityDefinition -ne $null -and + $metaData -ne $null -and + $MetadataEntityDefinition.BaseType -ne $null) + { + $baseType = $Metadata.EntityTypes | Where { $_.Namespace + "." + $_.Name -eq $MetadataEntityDefinition.BaseType -or $_.Alias + "." + $_.Name -eq $MetadataEntityDefinition.BaseType } + if ($baseType -eq $null) + { + $baseType = $Metadata.ComplexTypes | Where { $_.Namespace + "." + $_.Name -eq $MetadataEntityDefinition.BaseType -or $_.Alias + "." + $_.Name -eq $MetadataEntityDefinition.BaseType } + } + + if ($baseType -eq $null) + { + # Look in other metadatas, since the class can be defined in referenced metadata + foreach ($referencedMetadata in $GlobalMetadata) + { + if (($baseType = $referencedMetadata.EntityTypes | Where { $_.Namespace + "." + $_.Name -eq $MetadataEntityDefinition.BaseType -or $_.Alias + "." + $_.Name -eq $MetadataEntityDefinition.BaseType }) -ne $null -or + ($baseType = $referencedMetadata.ComplexTypes | Where { $_.Namespace + "." + $_.Name -eq $MetadataEntityDefinition.BaseType -or $_.Alias + "." + $_.Name -eq $MetadataEntityDefinition.BaseType }) -ne $null) + { + # Found base class + break + } + } + } + } + + if ($baseType -ne $null) + { + $baseType[0] + } +} + +######################################################### +# Takes base class name and global metadata structure +# and finds its base class +######################################################### +function GetBaseTypeByName +{ + param + ( + [String] $BaseTypeStr, + [System.Collections.ArrayList] $GlobalMetadata + ) + + if ($BaseTypeStr -ne $null) + { + + # Look for base class definition in all referenced metadatas (including entry point) + foreach ($referencedMetadata in $GlobalMetadata) + { + if (($baseType = $referencedMetadata.EntityTypes | Where { $_.Namespace + "." + $_.Name -eq $BaseTypeStr -or $_.Alias + "." + $_.Name -eq $BaseTypeStr }) -ne $null -or + ($baseType = $referencedMetadata.ComplexTypes | Where { $_.Namespace + "." + $_.Name -eq $BaseTypeStr -or $_.Alias + "." + $_.Name -eq $BaseTypeStr }) -ne $null) + { + # Found base class + break + } + } + } + + if ($baseType -ne $null) + { + $baseType[0] + } + else + { + $null + } +} + +######################################################### +# Processes derived types of a newly added type, +# that were previously waiting in the queue +######################################################### +function AddDerivedTypes { + param( + [ODataUtils.EntityTypeV4] $baseType, + $entityAndComplexTypesQueue, + [ODataUtils.MetadataV4] $metadata, + [string] $namespace + ) + + if($baseType -eq $null) { throw ($LocalizedData.ArguementNullError -f "BaseType", "AddDerivedTypes") } + if($entityAndComplexTypesQueue -eq $null) { throw ($LocalizedData.ArguementNullError -f "EntityAndComplexTypesQueue", "AddDerivedTypes") } + if($namespace -eq $null) { throw ($LocalizedData.ArguementNullError -f "Namespace", "AddDerivedTypes") } + + $baseTypeFullName = $baseType.Namespace + '.' + $baseType.Name + $baseTypeShortName = $baseType.Alias + '.' + $baseType.Name + + if ($entityAndComplexTypesQueue.ContainsKey($baseTypeFullName) -or $entityAndComplexTypesQueue.ContainsKey($baseTypeShortName)) + { + $types = $entityAndComplexTypesQueue[$baseTypeFullName] + $entityAndComplexTypesQueue[$baseTypeShortName] + + foreach ($type in $types) + { + if ($type.type -eq 'EntityType') + { + $newType = ParseMetadataTypeDefinition ($type.value) $baseType $metadata $namespace $true + $metadata.EntityTypes += $newType + } + else + { + $newType = ParseMetadataTypeDefinition ($type.value) $baseType $metadata $namespace $false + $metadata.ComplexTypes += $newType + } + + AddDerivedTypes $newType $entityAndComplexTypesQueue $metadata $namespace + } + } +} + +######################################################### +# Parses types definitions element of metadata xml +######################################################### +function ParseMetadataTypeDefinitionHelper +{ + param + ( + [System.Xml.XmlElement] $metadataEntityDefinition, + [ODataUtils.EntityTypeV4] $baseType, + [string] $baseTypeStr, + [ODataUtils.MetadataV4] $metadata, + [string] $namespace, + [AllowEmptyString()] + [string] $alias, + [bool] $isEntity + ) + + if($metadataEntityDefinition -eq $null) { throw ($LocalizedData.ArguementNullError -f "MetadataEntityDefinition", "ParseMetadataTypeDefinition") } + if($namespace -eq $null) { throw ($LocalizedData.ArguementNullError -f "Namespace", "ParseMetadataTypeDefinition") } + + [ODataUtils.EntityTypeV4] $newEntityType = CreateNewEntityType -metadataEntityDefinition $metadataEntityDefinition -baseType $baseType -baseTypeStr $baseTypeStr -namespace $namespace -alias $alias -isEntity $isEntity + + if ($baseType -ne $null) + { + # Add properties inherited from BaseType + ParseMetadataBaseTypeDefinitionHelper $newEntityType $baseType + } + + # properties defined on EntityType + $newEntityType.EntityProperties += $metadataEntityDefinition.Property | % { + if ($_ -ne $null) + { + if ($_.Nullable -ne $null) + { + $newPropertyIsNullable = [System.Convert]::ToBoolean($_.Nullable) + } + else + { + $newPropertyIsNullable = $true + } + + [ODataUtils.TypeProperty] @{ + "Name" = $_.Name; + "TypeName" = $_.Type; + "IsNullable" = $newPropertyIsNullable; + } + } + } + + # odataId property will be inherited from base type, if it exists. + # Otherwise, it should be added to current type + if ($baseType -eq $null) + { + # @odata.Id property (renamed to odataId) is required for dynamic Uri creation + # This property is only available when user executes auto-generated cmdlet with -AllowAdditionalData, + # but ODataAdapter needs it to construct Uri to access navigation properties. + # Thus, we need to fetch this info for scenario when -AllowAdditionalData isn't used. + $newEntityType.EntityProperties += [ODataUtils.TypeProperty] @{ + "Name" = "odataId"; + "TypeName" = "Edm.String"; + "IsNullable" = $True; + } + } + + # Property name can't be identical to entity type name. + # If such property exists, "Property" suffix will be added to its name. + foreach ($property in $newEntityType.EntityProperties) + { + if ($property.Name -eq $newEntityType.Name) + { + $property.Name += "Property" + } + } + + if ($metadataEntityDefinition -ne $null -and $metadataEntityDefinition.Key -ne $null) + { + foreach ($entityTypeKey in $metadataEntityDefinition.Key.PropertyRef) + { + ($newEntityType.EntityProperties | Where-Object { $_.Name -eq $entityTypeKey.Name }).IsKey = $true + } + } + + $newEntityType +} + +######################################################### +# Add base class entity and navigation properties to inheriting class +######################################################### +function ParseMetadataBaseTypeDefinitionHelper +{ + param + ( + [ODataUtils.EntityTypeV4] $EntityType, + [ODataUtils.EntityTypeV4] $BaseType + ) + + if ($EntityType -ne $null -and $BaseType -ne $null) + { + # Add properties inherited from BaseType + $EntityType.EntityProperties += $BaseType.EntityProperties + $EntityType.NavigationProperties += $BaseType.NavigationProperties + } +} + +######################################################### +# Create new EntityType object +######################################################### +function CreateNewEntityType +{ + param + ( + [System.Xml.XmlElement] $metadataEntityDefinition, + [ODataUtils.EntityTypeV4] $baseType, + [string] $baseTypeStr, + [string] $namespace, + [AllowEmptyString()] + [string] $alias, + [bool] $isEntity + ) + $newEntityType = [ODataUtils.EntityTypeV4] @{ + "Namespace" = $namespace; + "Alias" = $alias; + "Name" = $metadataEntityDefinition.Name; + "IsEntity" = $isEntity; + "BaseType" = $baseType; + "BaseTypeStr" = $baseTypeStr; + } + + $newEntityType +} + +######################################################### +# Parses navigation properties from metadata xml +######################################################### +function ParseMetadataTypeDefinitionNavigationProperties +{ + param + ( + [System.Xml.XmlElement] $metadataEntityDefinition, + [ODataUtils.EntityTypeV4] $entityType + ) + + # navigation properties defined on EntityType + $newEntityType.NavigationProperties = @{} + $newEntityType.NavigationProperties.Clear() + + foreach ($navigationProperty in $metadataEntityDefinition.NavigationProperty) + { + $tmp = [ODataUtils.NavigationPropertyV4] @{ + "Name" = $navigationProperty.Name; + "Type" = $navigationProperty.Type; + "Nullable" = $navigationProperty.Nullable; + "Partner" = $navigationProperty.Partner; + "ContainsTarget" = $navigationProperty.ContainsTarget; + "OnDelete" = $navigationProperty.OnDelete; + } + + $referentialConstraints = @{} + foreach ($constraint in $navigationProperty.ReferentialConstraints) + { + $tmp = [ODataUtils.ReferencedConstraint] @{ + "Property" = $constraint.Property; + "ReferencedProperty" = $constraint.ReferencedProperty; + } + } + + $newEntityType.NavigationProperties += $tmp + } +} + +######################################################### +# Parses types definitions element of metadata xml for OData V4 schema +######################################################### +function ParseMetadataTypeDefinition +{ + param + ( + [System.Xml.XmlElement] $metadataEntityDefinition, + [ODataUtils.EntityTypeV4] $baseType, + [ODataUtils.MetadataV4] $metadata, + [string] $namespace, + [AllowEmptyString()] + [string] $alias, + [bool] $isEntity, + [string] $baseTypeStr + ) + + if($metadataEntityDefinition -eq $null) { throw ($LocalizedData.ArguementNullError -f "MetadataEntityDefinition", "ParseMetadataTypeDefinition") } + if($namespace -eq $null) { throw ($LocalizedData.ArguementNullError -f "Namespace", "ParseMetadataTypeDefinition") } + + [ODataUtils.EntityTypeV4] $newEntityType = ParseMetadataTypeDefinitionHelper -metadataEntityDefinition $metadataEntityDefinition -baseType $baseType -baseTypeStr $baseTypeStr -metadata $metadata -namespace $namespace -alias $alias -isEntity $isEntity + ParseMetadataTypeDefinitionNavigationProperties -metadataEntityDefinition $metadataEntityDefinition -entityType $newEntityType + + $newEntityType +} + +######################################################### +# Create psd1 and cdxml files required to auto-generate +# cmdlets for given service. +######################################################### +function GenerateClientSideProxyModule +{ + param + ( + [System.Collections.ArrayList] $GlobalMetadata, + [ODataUtils.ODataEndpointProxyParameters] $ODataEndpointProxyParameters, + [string] $OutputModule, + [string] $CreateRequestMethod, + [string] $UpdateRequestMethod, + [string] $CmdletAdapter, + [Hashtable] $resourceNameMappings, + [Hashtable] $CustomData, + [string] $UriResourcePathKeyFormat, + [string] $progressBarStatus, + $NormalizedNamespaces + ) + + if($progressBarStatus -eq $null) { throw ($LocalizedData.ArguementNullError -f "ProgressBarStatus", "GenerateClientSideProxyModule") } + + Write-Verbose ($LocalizedData.VerboseSavingModule -f $OutputModule) + + # Save ComplexTypes for all metadata schemas in single file + $typeDefinationFileName = "ComplexTypeDefinitions.psm1" + $complexTypeMapping = GenerateComplexTypeDefinition $GlobalMetadata $OutputModule $typeDefinationFileName $NormalizedNamespaces + + ProgressBarHelper "Export-ODataEndpointProxy" $progressBarStatus 20 20 1 1 + + $actions = @() + $functions = @() + + $currentEntryCount = 0 + foreach ($Metadata in $GlobalMetadata) + { + foreach ($entitySet in $Metadata.EntitySets) + { + $currentEntryCount += 1 + SaveCDXML $entitySet $Metadata $GlobalMetadata $Metadata.Uri $OutputModule $CreateRequestMethod $UpdateRequestMethod $CmdletAdapter $resourceNameMappings $CustomData $complexTypeMapping $UriResourcePathKeyFormat $NormalizedNamespaces + + ProgressBarHelper "Export-ODataEndpointProxy" $progressBarStatus 40 20 $Metadata.EntitySets.Count $currentEntryCount + } + + $currentEntryCount = 0 + foreach ($singleton in $Metadata.SingletonTypes) + { + $currentEntryCount += 1 + SaveCDXMLSingletonCmdlets $singleton $Metadata $GlobalMetadata $Metadata.Uri $OutputModule $CreateRequestMethod $UpdateRequestMethod $CmdletAdapter $resourceNameMappings $CustomData $complexTypeMapping $NormalizedNamespaces + + ProgressBarHelper "Export-ODataEndpointProxy" $progressBarStatus 40 20 $Metadata.Singletons.Count $currentEntryCount + } + + $actions += $Metadata.Actions | Where-Object { $_.EntitySet -eq '' -or $_.EntitySet -eq $null } + $functions += $Metadata.Functions | Where-Object { $_.EntitySet -eq '' -or $_.EntitySet -eq $null } + } + + if ($actions.Count -gt 0 -or $functions.Count -gt 0) + { + # Save Service Actions for all metadata schemas in single file + SaveServiceActionsCDXML $GlobalMetadata $ODataEndpointProxyParameters "$OutputModule\ServiceActions.cdxml" $complexTypeMapping $progressBarStatus $CmdletAdapter + } + + $moduleDirInfo = [System.IO.DirectoryInfo]::new($OutputModule) + $moduleManifestName = $moduleDirInfo.Name + ".psd1" + + if ($actions.Count -gt 0 -or $functions.Count -gt 0) + { + $additionalModules = @($typeDefinationFileName, 'ServiceActions.cdxml') + } + else + { + $additionalModules = @($typeDefinationFileName) + } + + GenerateModuleManifest $GlobalMetadata $OutputModule\$moduleManifestName $additionalModules $resourceNameMappings $progressBarStatus +} + +######################################################### +# Generates CDXML module for a specific OData EntitySet +######################################################### +function SaveCDXML +{ + param + ( + [ODataUtils.EntitySetV4] $EntitySet, + [ODataUtils.MetadataV4] $Metadata, + [System.Collections.ArrayList] $GlobalMetadata, + [string] $Uri, + [string] $OutputModule, + [string] $CreateRequestMethod, + [string] $UpdateRequestMethod, + [string] $CmdletAdapter, + [Hashtable] $resourceNameMappings, + [Hashtable] $CustomData, + [Hashtable] $compexTypeMapping, + [string] $UriResourcePathKeyFormat, + $normalizedNamespaces + ) + + if($EntitySet -eq $null) { throw ($LocalizedData.ArguementNullError -f "EntitySet", "GenerateClientSideProxyModule") } + if($Metadata -eq $null) { throw ($LocalizedData.ArguementNullError -f "metadata", "GenerateClientSideProxyModule") } + + $entitySetName = $EntitySet.Name + if(($null -ne $resourceNameMappings) -and + $resourceNameMappings.ContainsKey($entitySetName)) + { + $entitySetName = $resourceNameMappings[$entitySetName] + } + else + { + $entitySetName = $EntitySet.Type.Name + } + + $Path = "$OutputModule\$entitySetName.cdxml" + + $xmlWriter = New-Object System.XMl.XmlTextWriter($Path,$Null) + + if ($xmlWriter -eq $null) + { + throw ($LocalizedData.XmlWriterInitializationError -f $EntitySet.Name) + } + + $xmlWriter = SaveCDXMLHeader $xmlWriter $Uri $EntitySet.Name $entitySetName $CmdletAdapter + + # Get the keys + $keys = $EntitySet.Type.EntityProperties | Where-Object { $_.IsKey } + + $navigationProperties = $EntitySet.Type.NavigationProperties + + SaveCDXMLInstanceCmdlets $xmlWriter $Metadata $GlobalMetadata $EntitySet.Type $keys $navigationProperties $CmdletAdapter $compexTypeMapping $false + + $nonKeyProperties = $EntitySet.Type.EntityProperties | ? { -not $_.isKey } + $nullableProperties = $nonKeyProperties | ? { $_.isNullable } + $nonNullableProperties = $nonKeyProperties | ? { -not $_.isNullable } + + $xmlWriter.WriteStartElement('StaticCmdlets') + + $keyProperties = $keys + + SaveCDXMLNewCmdlet $xmlWriter $Metadata $GlobalMetadata $keyProperties $nonNullableProperties $nullableProperties $navigationProperties $CmdletAdapter $compexTypeMapping + + GenerateSetProxyCmdlet $xmlWriter $keyProperties $nonKeyProperties $compexTypeMapping + + SaveCDXMLRemoveCmdlet $xmlWriter $Metadata $GlobalMetadata $keyProperties $navigationProperties $CmdletAdapter $compexTypeMapping + + $entityActions = $Metadata.Actions | Where-Object { ($_.EntitySet.Namespace -eq $EntitySet.Namespace) -and ($_.EntitySet.Name -eq $EntitySet.Name) } + + if ($entityActions.Length -gt 0) + { + foreach($action in $entityActions) + { + $xmlWriter = SaveCDXMLAction $xmlWriter $Metadata $action $EntitySet.Name $true $keys $complexTypeMapping + } + } + + $entityFunctions = $Metadata.Functions | Where-Object { ($_.EntitySet.Namespace -eq $EntitySet.Namespace) -and ($_.EntitySet.Name -eq $EntitySet.Name) } + + if ($entityFunctions.Length -gt 0) + { + foreach($function in $entityFunctions) + { + $xmlWriter = SaveCDXMLFunction $xmlWriter $Metadata $function $EntitySet.Name $true $keys $complexTypeMapping + } + } + + $xmlWriter.WriteEndElement() + + $normalizedDotNetNamespace = GetNamespace $EntitySet.Type.Namespace $normalizedNamespaces + $normalizedDotNetAlias = GetNamespace $EntitySet.Alias $normalizedNamespaces + $normalizedDotNetEntitySetNamespace = $normalizedDotNetNamespace + + $xmlWriter.WriteStartElement('CmdletAdapterPrivateData') + + $xmlWriter.WriteStartElement('Data') + $xmlWriter.WriteAttributeString('Name', 'EntityTypeName') + $xmlWriter.WriteString("$($normalizedDotNetNamespace).$($EntitySet.Type.Name)") + $xmlWriter.WriteEndElement() + $xmlWriter.WriteStartElement('Data') + $xmlWriter.WriteAttributeString('Name', 'EntityTypeAliasName') + if (!$EntitySet.Alias) + { + $xmlWriter.WriteString("") + } + else + { + $xmlWriter.WriteString("$($normalizedDotNetAlias).$($EntitySet.Type.Name)") + } + $xmlWriter.WriteEndElement() + $xmlWriter.WriteStartElement('Data') + $xmlWriter.WriteAttributeString('Name', 'EntitySetName') + $xmlWriter.WriteString("$($normalizedDotNetEntitySetNamespace).$($EntitySet.Name)") + $xmlWriter.WriteEndElement() + + # Add URI resource path format (webservice.svc/ResourceName/ResourceId vs webservice.svc/ResourceName(QueryKeyName=ResourceId)) + if ($UriResourcePathKeyFormat -ne $null -and $UriResourcePathKeyFormat -ne '') + { + $xmlWriter.WriteStartElement('Data') + $xmlWriter.WriteAttributeString('Name', 'UriResourcePathKeyFormat') + $xmlWriter.WriteString("$UriResourcePathKeyFormat") + $xmlWriter.WriteEndElement() + } + + # Add information about navigation properties and their types + # Used in scenario where user requests navigation property in -Select query + foreach ($navProperty in $navigationProperties) + { + if ($navProperty) + { + $xmlWriter.WriteStartElement('Data') + $xmlWriter.WriteAttributeString('Name', $navProperty.Name + 'NavigationProperty') + $xmlWriter.WriteString($navProperty.Type) + $xmlWriter.WriteEndElement() + } + } + + # Add CreateRequestMethod and UpdateRequestMethod to privateData + $xmlWriter.WriteStartElement('Data') + $xmlWriter.WriteAttributeString('Name', 'CreateRequestMethod') + $xmlWriter.WriteString("$CreateRequestMethod") + $xmlWriter.WriteEndElement() + + $xmlWriter.WriteStartElement('Data') + $xmlWriter.WriteAttributeString('Name', 'UpdateRequestMethod') + $xmlWriter.WriteString("$UpdateRequestMethod") + $xmlWriter.WriteEndElement() + + $xmlWriter.WriteEndElement() + + SaveCDXMLFooter $xmlWriter + + Write-Verbose ($LocalizedData.VerboseSavedCDXML -f $($entitySetName), $Path) +} + +######################################################### +# Save Singleton Cmdlets to CDXML +######################################################### +function SaveCDXMLSingletonCmdlets +{ + param + ( + [ODataUtils.SingletonType] $Singleton, + [ODataUtils.MetadataV4] $Metadata, + [System.Collections.ArrayList] $GlobalMetadata, + [string] $Uri, + [string] $OutputModule, + [string] $CreateRequestMethod, + [string] $UpdateRequestMethod, + [string] $CmdletAdapter, + [Hashtable] $resourceNameMappings, + [Hashtable] $CustomData, + [Hashtable] $compexTypeMapping, + $normalizedNamespaces + ) + + if($Singleton -eq $null) { throw ($LocalizedData.ArguementNullError -f "Singleton", "SaveCDXMLSingletonCmdlets") } + if($Metadata -eq $null) { throw ($LocalizedData.ArguementNullError -f "Metadata", "SaveCDXMLSingletonCmdlets") } + + $singletonName = $singleton.Name + $singletonType = $singleton.Type + + $Path = "$OutputModule\$singletonName" + "Singleton" + ".cdxml" + + $xmlWriter = New-Object System.XMl.XmlTextWriter($Path,$Null) + + if ($xmlWriter -eq $null) + { + throw ($LocalizedData.XmlWriterInitializationError -f $singletonName) + } + + # Get associated EntityType + $associatedEntityType = $Metadata.EntityTypes | Where-Object { $_.Namespace + "." + $_.Name -eq $singletonType -or $_.Alias + "." + $_.Name -eq $singletonType} + + if ($associatedEntityType -eq $null) + { + # Look in other metadatas, since the class can be defined in referenced metadata + foreach ($referencedMetadata in $GlobalMetadata) + { + if (($associatedEntityType = $referencedMetadata.EntityTypes | Where { $_.Namespace + "." + $_.Name -eq $singletonType -or $_.Alias + "." + $_.Name -eq $singletonType }) -ne $null) + { + # Found associated class + break + } + } + } + + if ($associatedEntityType -ne $null) + { + $xmlWriter = SaveCDXMLHeader $xmlWriter $Uri $singletonName $singletonName $CmdletAdapter + + if ($associatedEntityType.BaseType -eq $null -and $associatedEntityType.BaseTypeStr -ne $null -and $associatedEntityType.BaseTypeStr -ne '') + { + $associatedEntitybaseType = GetBaseTypeByName $associatedEntityType.BaseTypeStr $GlobalMetadata + + # Make another pass on base class to make sure its properties were added to associated entity type + ParseMetadataBaseTypeDefinitionHelper $associatedEntityType $associatedEntitybaseType + } + + # Get the keys depending on whether the url contains variables or not + $keys = $associatedEntityType.EntityProperties | Where-Object { $_.IsKey } + + $navigationProperties = $associatedEntityType.NavigationProperties + + SaveCDXMLInstanceCmdlets $xmlWriter $Metadata $GlobalMetadata $associatedEntityType $keys $navigationProperties $CmdletAdapter $compexTypeMapping $true + + $nonKeyProperties = $associatedEntityType.EntityProperties | ? { -not $_.isKey } + $nullableProperties = $nonKeyProperties | ? { $_.isNullable } + $nonNullableProperties = $nonKeyProperties | ? { -not $_.isNullable } + + $xmlWriter.WriteStartElement('StaticCmdlets') + + $keyProperties = $keys + + GenerateSetProxyCmdlet $xmlWriter $keyProperties $nonKeyProperties $compexTypeMapping + + $entityActions = $Metadata.Actions | Where-Object { $_.EntitySet.Name -eq $associatedEntityType.Name } + + if ($entityActions.Length -gt 0) + { + foreach($action in $entityActions) + { + $xmlWriter = SaveCDXMLAction $xmlWriter $Metadata $action $EntitySet.Name $true $keys $complexTypeMapping + } + } + + $entityFunctions = $Metadata.Functions | Where-Object { $_.EntitySet.Name -eq $associatedEntityType.Name } + + if ($entityFunctions.Length -gt 0) + { + foreach($function in $entityFunctions) + { + $xmlWriter = SaveCDXMLFunction $xmlWriter $Metadata $function $associatedEntityType.Name $true $keys $complexTypeMapping + } + } + + $xmlWriter.WriteEndElement() + + $normalizedDotNetNamespace = GetNamespace $associatedEntityType.Namespace $normalizedNamespaces + $normalizedDotNetAlias = GetNamespace $associatedEntityType.Alias $normalizedNamespaces + + $xmlWriter.WriteStartElement('CmdletAdapterPrivateData') + + $xmlWriter.WriteStartElement('Data') + $xmlWriter.WriteAttributeString('Name', 'EntityTypeAliasName') + if (!$associatedEntityType.Alias) + { + $xmlWriter.WriteString("") + } + else + { + $xmlWriter.WriteString("$($normalizedDotNetAlias).$($associatedEntityType.Name)") + } + $xmlWriter.WriteEndElement() + $xmlWriter.WriteStartElement('Data') + $xmlWriter.WriteAttributeString('Name', 'EntityTypeName') + $xmlWriter.WriteString("$($normalizedDotNetNamespace).$($associatedEntityType.Name)") + $xmlWriter.WriteEndElement() + $xmlWriter.WriteStartElement('Data') + $xmlWriter.WriteAttributeString('Name', 'IsSingleton') + $xmlWriter.WriteString("True") + $xmlWriter.WriteEndElement() + + # Add information about navigation properties and their types + # Used in scenario where user requests navigation property in -Select query + foreach ($navProperty in $navigationProperties) + { + if ($navProperty) + { + $xmlWriter.WriteStartElement('Data') + $xmlWriter.WriteAttributeString('Name', $navProperty.Name + 'NavigationProperty') + $xmlWriter.WriteString($navProperty.Type) + $xmlWriter.WriteEndElement() + } + } + + # Add UpdateRequestMethod to privateData + $xmlWriter.WriteStartElement('Data') + $xmlWriter.WriteAttributeString('Name', 'UpdateRequestMethod') + $xmlWriter.WriteString("$UpdateRequestMethod") + $xmlWriter.WriteEndElement() + + $xmlWriter.WriteEndElement() + + SaveCDXMLFooter $xmlWriter + + Write-Verbose ($LocalizedData.VerboseSavedCDXML -f $($associatedEntityType.Name), $Path) + } +} + +######################################################### +# Saves InstanceCmdlets node to CDXML +######################################################### +function SaveCDXMLInstanceCmdlets +{ + param + ( + [System.XMl.XmlTextWriter] $xmlWriter, + [ODataUtils.MetadataV4] $Metadata, + [System.Collections.ArrayList] $GlobalMetadata, + [ODataUtils.EntityTypeV4] $EntityType, + $keys, + $navigationProperties, + $CmdletAdapter, + [Hashtable] $complexTypeMapping, + [bool] $isSingleton + ) + + if($xmlWriter -eq $null) { throw ($LocalizedData.ArguementNullError -f "xmlWriter", "SaveCDXMLInstanceCmdlets") } + if($Metadata -eq $null) { throw ($LocalizedData.ArguementNullError -f "Metadata", "SaveCDXMLInstanceCmdlets") } + + $xmlWriter.WriteStartElement('InstanceCmdlets') + $xmlWriter.WriteStartElement('GetCmdletParameters') + # adding key parameters and association parameters to QueryableProperties, each in a different parameter set + # to be used by GET cmdlet + if (($keys.Length -gt 0) -or ($navigationProperties.Length -gt 0)) + { + $querableNavProperties = @{} + + if ($isSingleton -eq $false) + { + foreach ($navProperty in $navigationProperties) + { + if ($navProperty -ne $null) + { + $associatedType = GetAssociatedType $Metadata $GlobalMetadata $navProperty + $associatedTypeKeyProperties = $associatedType.EntityProperties | ? { $_.IsKey } + + # Make sure associated parameter (based on navigation property) has EntitySet or Singleton, which makes it accessible from the service root + # Otherwise the Uri for associated navigation property won't be valid + if ($associatedTypeKeyProperties.Length -gt 0 -and (ShouldBeAssociatedParameter $GlobalMetadata $EntityType $associatedType $isSingleton)) + { + $querableNavProperties.Add($navProperty, $associatedTypeKeyProperties) + } + } + } + } + + $defaultCmdletParameterSet = 'Default' + if ($isSingleton -eq $true -and $querableNavProperties.Count -gt 0) + { + foreach($item in $querableNavProperties.GetEnumerator()) + { + $defaultCmdletParameterSet = $item.Key.Name + break + } + } + $xmlWriter.WriteAttributeString('DefaultCmdletParameterSet', $defaultCmdletParameterSet) + + + $xmlWriter.WriteStartElement('QueryableProperties') + + $position = 0 + + if ($isSingleton -eq $false) + { + $keys | ? { $_ -ne $null } | % { + $xmlWriter.WriteStartElement('Property') + $xmlWriter.WriteAttributeString('PropertyName', $_.Name) + + $xmlWriter.WriteStartElement('Type') + $PSTypeName = Convert-ODataTypeToCLRType $_.TypeName $complexTypeMapping + $xmlWriter.WriteAttributeString('PSType', $PSTypeName) + $xmlWriter.WriteEndElement() + + $xmlWriter.WriteStartElement('RegularQuery') + $xmlWriter.WriteStartElement('CmdletParameterMetadata') + $xmlWriter.WriteAttributeString('PSName', $_.Name) + $xmlWriter.WriteAttributeString('CmdletParameterSets', 'Default') + $xmlWriter.WriteAttributeString('IsMandatory', $_.IsMandatory.ToString().ToLower()) + $xmlWriter.WriteAttributeString('Position', $position) + $xmlWriter.WriteEndElement() + $xmlWriter.WriteEndElement() + $xmlWriter.WriteEndElement() + + $position++ + } + } + + if ($querableNavProperties.Count -gt 0) + { + foreach($item in $querableNavProperties.GetEnumerator()) + { + $xmlWriter.WriteStartElement('Property') + $xmlWriter.WriteAttributeString('PropertyName', $item.Key.Name + ':' + $item.Value.Name + ':Key') + + $xmlWriter.WriteStartElement('Type') + $PSTypeName = Convert-ODataTypeToCLRType $item.Value.TypeName $complexTypeMapping + $xmlWriter.WriteAttributeString('PSType', $PSTypeName) + $xmlWriter.WriteEndElement() + + $xmlWriter.WriteStartElement('RegularQuery') + $xmlWriter.WriteStartElement('CmdletParameterMetadata') + $xmlWriter.WriteAttributeString('PSName', 'Associated' + $item.Key.Name + $item.Value.Name) + $xmlWriter.WriteAttributeString('CmdletParameterSets', $item.Key.Name) + $xmlWriter.WriteAttributeString('IsMandatory', 'false') + $xmlWriter.WriteEndElement() + $xmlWriter.WriteEndElement() + $xmlWriter.WriteEndElement() + } + } + + if ($isSingleton -eq $false) + { + # Add Query Parameters (i.e., Top, Skip, OrderBy, Filter) to the generated Get-* cmdlets. + $queryParameters = + @{ + "Filter" = "Edm.String"; + "IncludeTotalResponseCount" = "switch"; + "OrderBy" = "Edm.String"; + "Select" = "Edm.String"; + "Skip" = "Edm.Int32"; + "Top" = "Edm.Int32"; + } + } + else + { + $queryParameters = + @{ + "Select" = "Edm.String"; + } + } + + foreach($currentQueryParameter in $queryParameters.Keys) + { + $xmlWriter.WriteStartElement('Property') + $xmlWriter.WriteAttributeString('PropertyName', "QueryOption:" + $currentQueryParameter) + $xmlWriter.WriteStartElement('Type') + $PSTypeName = Convert-ODataTypeToCLRType $queryParameters[$currentQueryParameter] + $xmlWriter.WriteAttributeString('PSType', $PSTypeName) + $xmlWriter.WriteEndElement() + $xmlWriter.WriteStartElement('RegularQuery') + $xmlWriter.WriteStartElement('CmdletParameterMetadata') + $xmlWriter.WriteAttributeString('PSName', $currentQueryParameter) + + if($queryParameters[$currentQueryParameter] -eq "Edm.String") + { + $xmlWriter.WriteStartElement('ValidateNotNullOrEmpty') + $xmlWriter.WriteEndElement() + } + + if($queryParameters[$currentQueryParameter] -eq "Edm.Int32") + { + $xmlWriter.WriteStartElement('ValidateRange') + $xmlWriter.WriteAttributeString('Min', "1") + $xmlWriter.WriteAttributeString('Max', [int]::MaxValue) + $xmlWriter.WriteEndElement() + } + + $xmlWriter.WriteEndElement() + $xmlWriter.WriteEndElement() + $xmlWriter.WriteEndElement() + } + + + $xmlWriter.WriteEndElement() + } + + $xmlWriter.WriteEndElement() + + $xmlWriter.WriteStartElement('GetCmdlet') + $xmlWriter.WriteStartElement('CmdletMetadata') + $xmlWriter.WriteAttributeString('Verb', 'Get') + $xmlWriter.WriteEndElement() + $xmlWriter.WriteEndElement() + + $xmlWriter.WriteEndElement() +} + +# Helper Method +# Returns true if navigation property of $AssociatedType has coresponding EntitySet or Singleton +# If yes, then it should become an associated parameter in CDXML +function ShouldBeAssociatedParameter +{ + param + ( + [System.Collections.ArrayList] $GlobalMetadata, + [ODataUtils.EntityTypeV4] $EntityType, + [ODataUtils.EntityTypeV4] $AssociatedType + ) + + # Check if associated type has navigation property, which links back to current type + $associatedTypeNavProperties = $AssociatedType.NavigationProperties | ? { + $_.Type -eq ($EntityType.Namespace + "." + $EntityType.Name) -or + $_.Type -eq ($EntityType.Alias + "." + $EntityType.Name) -or + $_.Type -eq ("Collection(" + $EntityType.Namespace + "." + $EntityType.Name + ")") -or + $_.Type -eq ("Collection(" + $EntityType.Alias + "." + $EntityType.Name + ")") + } + + if ($associatedTypeNavProperties.Length -lt 1) + { + return $false + } + + # Now check if associated parameter type (i.e, type of navigation property) has corresponding EntitySet or Singleton, + # which makes it accessible from the service root. + # Otherwise the Uri for associated navigation property won't be valid + foreach ($currentMetadata in $GlobalMetadata) + { + # Look for EntitySet with given type + foreach ($currentEntitySet in $currentMetadata.EntitySets) + { + if ($currentEntitySet.Type.Namespace -eq $EntityType.Namespace -and + $currentEntitySet.Type.Name -eq $EntityType.Name) + { + return $true + } + } + + # Look for Singleton with given type + foreach ($currentSingleton in $currentMetadata.Singletons) + { + if ($currentSingleton.Type.Namespace -eq $EntityType.Namespace -and + $currentSingleton.Type.Name -eq $EntityType.Name) + { + return $true + } + } + } + + return $false +} + +######################################################### +# Saves NewCmdlet node to CDXML +######################################################### +function SaveCDXMLNewCmdlet +{ + param + ( + [System.XMl.XmlTextWriter] $xmlWriter, + [ODataUtils.MetadataV4] $Metadata, + [System.Collections.ArrayList] $GlobalMetadata, + $keyProperties, + $nonNullableProperties, + $nullableProperties, + $navigationProperties, + $CmdletAdapter, + $complexTypeMapping + ) + + if($xmlWriter -eq $null) { throw ($LocalizedData.ArguementNullError -f "xmlWriter", "SaveCDXMLNewCmdlet") } + if($Metadata -eq $null) { throw ($LocalizedData.ArguementNullError -f "Metadata", "SaveCDXMLNewCmdlet") } + + $xmlWriter.WriteStartElement('Cmdlet') + $xmlWriter.WriteStartElement('CmdletMetadata') + $xmlWriter.WriteAttributeString('Verb', 'New') + $xmlWriter.WriteAttributeString('DefaultCmdletParameterSet', 'Default') + $xmlWriter.WriteAttributeString('ConfirmImpact', 'Medium') + $xmlWriter.WriteEndElement() + + $xmlWriter.WriteStartElement('Method') + $xmlWriter.WriteAttributeString('MethodName', 'Create') + $xmlWriter.WriteAttributeString('CmdletParameterSet', 'Default') + + AddParametersNode $xmlWriter $keyProperties $nonNullableProperties $nullableProperties $null $true $true $complexTypeMapping + + $xmlWriter.WriteEndElement() + + $navigationProperties | ? { $_ -ne $null } | % { + $associatedType = GetAssociatedType $Metadata $GlobalMetadata $_ + $associatedEntitySet = GetEntitySetForEntityType $Metadata $associatedType + + $xmlWriter.WriteStartElement('Method') + $xmlWriter.WriteAttributeString('MethodName', "Association:Create:$($associatedEntitySet.Name)") + $xmlWriter.WriteAttributeString('CmdletParameterSet', $_.Name) + + $associatedKeys = ($associatedType.EntityProperties | ? { $_.isKey }) + + AddParametersNode $xmlWriter $associatedKeys $keyProperties $null "Associated$($_.Name)" $true $true $complexTypeMapping + + $xmlWriter.WriteEndElement() + } + + $xmlWriter.WriteEndElement() +} + +######################################################### +# Get corresponding EntityType for given EntitySet +######################################################### +function GetEntitySetForEntityType { + param( + [ODataUtils.MetadataV4] $Metadata, + [ODataUtils.EntityTypeV4] $entityType + ) + + if($entityType -eq $null) { throw ($LocalizedData.ArguementNullError -f "EntityType", "GetEntitySetForEntityType") } + + $result = $Metadata.EntitySets | ? { ($_.Type.Namespace -eq $entityType.Namespace) -and ($_.Type.Name -eq $entityType.Name) } + + if (($result.Count -eq 0) -and ($entityType.BaseType -ne $null)) + { + GetEntitySetForEntityType $Metadata $entityType.BaseType + } + elseif ($result.Count -gt 1) + { + throw ($LocalizedData.WrongCountEntitySet -f (($entityType.Namespace + "." + $entityType.Name), $result.Count)) + } + + $result +} + +######################################################### +# Saves RemoveCmdlet node to CDXML +######################################################### +function SaveCDXMLRemoveCmdlet +{ + param + ( + [System.XMl.XmlTextWriter] $xmlWriter, + [ODataUtils.MetadataV4] $Metadata, + [System.Collections.ArrayList] $GlobalMetadata, + $keyProperties, + $navigationProperties, + $CmdletAdapter, + $complexTypeMapping + ) + + if($xmlWriter -eq $null) { throw ($LocalizedData.ArguementNullError -f "xmlWriter", "SaveCDXMLRemoveCmdlet") } + if($Metadata -eq $null) { throw ($LocalizedData.ArguementNullError -f "Metadata", "SaveCDXMLRemoveCmdlet") } + + $xmlWriter.WriteStartElement('Cmdlet') + $xmlWriter.WriteStartElement('CmdletMetadata') + $xmlWriter.WriteAttributeString('Verb', 'Remove') + $xmlWriter.WriteAttributeString('DefaultCmdletParameterSet', 'Default') + $xmlWriter.WriteAttributeString('ConfirmImpact', 'Medium') + $xmlWriter.WriteEndElement() + + $xmlWriter.WriteStartElement('Method') + $xmlWriter.WriteAttributeString('MethodName', 'Delete') + $xmlWriter.WriteAttributeString('CmdletParameterSet', 'Default') + + AddParametersNode $xmlWriter $keyProperties $nul $null $null $true $true $complexTypeMapping + + $xmlWriter.WriteEndElement() + + $navigationPrperties | ? { $_ -ne $null } | % { + + $associatedType = GetAssociatedType $Metadata $GlobalMetadata $_ + $associatedEntitySet = GetEntitySetForEntityType $Metadata $associatedType + + $xmlWriter.WriteStartElement('Method') + $xmlWriter.WriteAttributeString('MethodName', "Association:Delete:$($associatedEntitySet.Name)") + $xmlWriter.WriteAttributeString('CmdletParameterSet', $_.Name) + + $associatedType = GetAssociatedType $Metadata $GlobalMetadata $_ + $associatedKeys = ($associatedType.EntityProperties | ? { $_.isKey }) + + AddParametersNode $xmlWriter $associatedKeys $keyProperties $null "Associated$($_.Name)" $true $true $complexTypeMapping + + $xmlWriter.WriteEndElement() + } + $xmlWriter.WriteEndElement() +} + +######################################################### +# Gets associated instance's EntityType for a given navigation property +######################################################### +function GetAssociatedType { + param( + [ODataUtils.MetadataV4] $Metadata, + [System.Collections.ArrayList] $GlobalMetadata, + [ODataUtils.NavigationPropertyV4] $navProperty + ) + + $associationType = $navProperty.Type + $associationType = $associationType.Replace($Metadata.Namespace + ".", "") + $associationType = $associationType.Replace($Metadata.Alias + ".", "") + $associationType = $associationType.Replace("Collection(", "") + $associationType = $associationType.Replace(")", "") + + $associatedType = $Metadata.EntityTypes | ? { $_.Name -eq $associationType } + + if (!$associatedType -and $GlobalMetadata -ne $null) + { + $associationFullTypeName = $navProperty.Type.Replace("Collection(", "").Replace(")", "") + + foreach ($referencedMetadata in $GlobalMetadata) + { + if (($associatedType = $referencedMetadata.EntityTypes | Where { $_.Namespace + "." + $_.Name -eq $associationFullTypeName -or $_.Alias + "." + $_.Name -eq $associationFullTypeName }) -ne $null -or + ($associatedType = $referencedMetadata.ComplexTypes | Where { $_.Namespace + "." + $_.Name -eq $associationFullTypeName -or $_.Alias + "." + $_.Name -eq $associationFullTypeName }) -ne $null -or + ($associatedType = $referencedMetadata.EnumTypes | Where { $_.Namespace + "." + $_.Name -eq $associationFullTypeName -or $_.Alias + "." + $_.Name -eq $associationFullTypeName }) -ne $null) + { + # Found associated class + break + } + } + } + + if ($associatedType.Count -lt 1) + { + throw ($LocalizedData.AssociationNotFound -f $associationType) + } + elseif ($associatedType.Count -gt 1) + { + throw ($LocalizedData.TooManyMatchingAssociationTypes -f $associatedType.Count, $associationType) + } + + # return associated EntityType + $associatedType +} + +######################################################### +# Saves CDXML for Instance/Service level actions +######################################################### +function SaveCDXMLAction +{ + param + ( + [System.Xml.XmlWriter] $xmlWriter, + [ODataUtils.ActionV4] $action, + [AllowEmptyString()] + [string] $noun, + [bool] $isInstanceAction, + [ODataUtils.TypeProperty] $keys, + [Hashtable] $complexTypeMapping + ) + + if($xmlWriter -eq $null) { throw ($LocalizedData.ArguementNullError -f "xmlWriter", "SaveCDXMLAction") } + if($action -eq $null) { throw ($LocalizedData.ArguementNullError -f "action", "SaveCDXMLAction") } + + $xmlWriter.WriteStartElement('Cmdlet') + + $xmlWriter.WriteStartElement('CmdletMetadata') + $xmlWriter.WriteAttributeString('Verb', 'Invoke') + $xmlWriter.WriteAttributeString('Noun', "$($noun)$($action.Name)") + $xmlWriter.WriteAttributeString('ConfirmImpact', 'Medium') + $xmlWriter.WriteEndElement() + + $xmlWriter.WriteStartElement('Method') + $xmlWriter.WriteAttributeString('MethodName', "Action:$($action.Name):$($action.EntitySet.Name)") + + $xmlWriter.WriteStartElement('Parameters') + + $keys | ? { $_ -ne $null } | % { + $xmlWriter.WriteStartElement('Parameter') + $xmlWriter.WriteAttributeString('ParameterName', $_.Name + ':Key') + + $xmlWriter.WriteStartElement('Type') + $PSTypeName = Convert-ODataTypeToCLRType $_.TypeName $complexTypeMapping + $xmlWriter.WriteAttributeString('PSType', $PSTypeName) + $xmlWriter.WriteEndElement() + + $xmlWriter.WriteStartElement('CmdletParameterMetadata') + $xmlWriter.WriteAttributeString('PSName', $_.Name) + $xmlWriter.WriteAttributeString('IsMandatory', 'true') + $xmlWriter.WriteEndElement() + $xmlWriter.WriteEndElement() + } + + $i = -1 + foreach ($parameter in $action.Parameters) + { + $i++ + + # for Instance actions, first parameter is Entity Set which we refer to using keys + if ($isInstanceAction -and ($i -eq 0)) + { + continue + } + + $xmlWriter.WriteStartElement('Parameter') + $xmlWriter.WriteAttributeString('ParameterName', $parameter.Name) + + $xmlWriter.WriteStartElement('Type') + $PSTypeName = Convert-ODataTypeToCLRType $parameter.TypeName + $xmlWriter.WriteAttributeString('PSType', $PSTypeName) + $xmlWriter.WriteEndElement() + + $xmlWriter.WriteStartElement('CmdletParameterMetadata') + $xmlWriter.WriteAttributeString('PSName', $parameter.Name) + if (-not $parameter.IsNullable) + { + $xmlWriter.WriteAttributeString('IsMandatory', 'true') + } + $xmlWriter.WriteEndElement() + $xmlWriter.WriteEndElement() + } + + # Add -Force parameter to Service Action cmdlets. + AddParametersNode $xmlWriter $null $null $null $null $true $false $complexTypeMapping + + $xmlWriter.WriteEndElement() + $xmlWriter.WriteEndElement() + + $xmlWriter.WriteEndElement() + + $xmlWriter +} + +######################################################### +# Saves CDXML for Instance/Service level functions +######################################################### +function SaveCDXMLFunction +{ + param + ( + [System.Xml.XmlWriter] $xmlWriter, + [ODataUtils.FunctionV4] $function, + [AllowEmptyString()] + [string] $noun, + [bool] $isInstanceAction, + [ODataUtils.TypeProperty] $keys, + [Hashtable] $complexTypeMapping + ) + + if($xmlWriter -eq $null) { throw ($LocalizedData.ArguementNullError -f "xmlWriter", "SaveCDXMLFunction") } + if($function -eq $null) { throw ($LocalizedData.ArguementNullError -f "function", "SaveCDXMLFunction") } + + $xmlWriter.WriteStartElement('Cmdlet') + + $xmlWriter.WriteStartElement('CmdletMetadata') + $xmlWriter.WriteAttributeString('Verb', 'Invoke') + $xmlWriter.WriteAttributeString('Noun', "$($noun)$($function.Name)") + $xmlWriter.WriteAttributeString('ConfirmImpact', 'Medium') + $xmlWriter.WriteEndElement() + + $xmlWriter.WriteStartElement('Method') + if (!$function.EntitySet) + { + $xmlWriter.WriteAttributeString('MethodName', "Action:$($function.Name):$($function.ReturnType)") + } + else + { + $xmlWriter.WriteAttributeString('MethodName', "Action:$($function.Name):$($function.EntitySet)") + } + + $xmlWriter.WriteStartElement('Parameters') + + $keys | ? { $_ -ne $null } | % { + $xmlWriter.WriteStartElement('Parameter') + $xmlWriter.WriteAttributeString('ParameterName', $_.Name + ':Key') + + $xmlWriter.WriteStartElement('Type') + $PSTypeName = Convert-ODataTypeToCLRType $_.TypeName $complexTypeMapping + $xmlWriter.WriteAttributeString('PSType', $PSTypeName) + $xmlWriter.WriteEndElement() + + $xmlWriter.WriteStartElement('CmdletParameterMetadata') + $xmlWriter.WriteAttributeString('PSName', $_.Name) + $xmlWriter.WriteAttributeString('IsMandatory', 'true') + $xmlWriter.WriteEndElement() + $xmlWriter.WriteEndElement() + } + + $i = -1 + foreach ($parameter in $function.Parameters) + { + $i++ + + # for Instance actions, first parameter is Entity Set which we refer to using keys + if ($isInstanceAction -and ($i -eq 0)) + { + continue + } + + $xmlWriter.WriteStartElement('Parameter') + $xmlWriter.WriteAttributeString('ParameterName', $parameter.Name) + + $xmlWriter.WriteStartElement('Type') + $PSTypeName = Convert-ODataTypeToCLRType $parameter.Type + $xmlWriter.WriteAttributeString('PSType', $PSTypeName) + $xmlWriter.WriteEndElement() + + $xmlWriter.WriteStartElement('CmdletParameterMetadata') + $xmlWriter.WriteAttributeString('PSName', $parameter.Name) + if (-not $parameter.IsNullable) + { + $xmlWriter.WriteAttributeString('IsMandatory', 'true') + } + $xmlWriter.WriteEndElement() + $xmlWriter.WriteEndElement() + } + + # Add -Force parameter to Service Function cmdlets. + AddParametersNode $xmlWriter $null $null $null $null $true $false $complexTypeMapping + + $xmlWriter.WriteEndElement() + $xmlWriter.WriteEndElement() + + $xmlWriter.WriteEndElement() + + $xmlWriter +} + +######################################################### +# Saves CDXML for Service-level actions and functions +######################################################### +function SaveServiceActionsCDXML +{ + param + ( + [System.Collections.ArrayList] $GlobalMetadata, + [ODataUtils.ODataEndpointProxyParameters] $ODataEndpointProxyParameters, + [string] $Path, + [Hashtable] $complexTypeMapping, + [string] $progressBarStatus, + [string] $CmdletAdapter + ) + + $xmlWriter = New-Object System.XMl.XmlTextWriter($Path,$Null) + + if ($xmlWriter -eq $null) + { + throw $LocalizedData.XmlWriterInitializationError -f "ServiceActions" + } + + $xmlWriter = SaveCDXMLHeader $xmlWriter $ODataEndpointProxyParameters.Uri 'ServiceActions' 'ServiceActions' -CmdletAdapter $CmdletAdapter + + $actions = @() + $functions = @() + + foreach ($Metadata in $GlobalMetadata) + { + $actions += $Metadata.Actions | Where-Object { $_.EntitySet -eq '' -or $_.EntitySet -eq $null } + $functions += $Metadata.Functions | Where-Object { $_.EntitySet -eq '' -or $_.EntitySet -eq $null } + } + + if ($actions.Length -gt 0 -or $functions.Length -gt 0) + { + $xmlWriter.WriteStartElement('StaticCmdlets') + } + + # Save actions + if ($actions.Length -gt 0) + { + foreach ($action in $actions) + { + if ($action -ne $null) + { + $xmlWriter = SaveCDXMLAction $xmlWriter $action '' $false $null $complexTypeMapping + } + } + } + + # Save functions + if ($functions.Length -gt 0) + { + foreach ($function in $functions) + { + if ($function -ne $null) + { + $xmlWriter = SaveCDXMLFunction $xmlWriter $function '' $false $null $complexTypeMapping + } + } + } + + if ($actions.Length -gt 0 -or $functions.Length -gt 0) + { + $xmlWriter.WriteEndElement() + } + + $xmlWriter.WriteStartElement('CmdletAdapterPrivateData') + $xmlWriter.WriteStartElement('Data') + $xmlWriter.WriteAttributeString('Name', 'Namespace') + $xmlWriter.WriteString("$($EntitySet.Namespace)") + $xmlWriter.WriteEndElement() + $xmlWriter.WriteStartElement('Data') + $xmlWriter.WriteAttributeString('Name', 'Alias') + if (!$EntitySet.Alias) + { + $xmlWriter.WriteString("") + } + else + { + $xmlWriter.WriteString("$($EntitySet.Alias)") + } + $xmlWriter.WriteEndElement() + + $xmlWriter.WriteStartElement('Data') + $xmlWriter.WriteAttributeString('Name', 'CreateRequestMethod') + $xmlWriter.WriteString("Post") + $xmlWriter.WriteEndElement() + $xmlWriter.WriteEndElement() + + SaveCDXMLFooter $xmlWriter + + Write-Verbose ($LocalizedData.VerboseSavedServiceActions -f $Path) + + # Write progress bar message + ProgressBarHelper "Export-ODataEndpointProxy" $progressBarStatus 60 20 1 1 +} + +######################################################### +# GenerateModuleManifest is a helper function used +# to generate a wrapper module manifest file. The +# generated module manifest is persisted to the disk at +# the specified OutputModule path. When the module +# manifest is imported, the following comands will +# be imported: +# 1. Get, Set, New & Remove proxy cmdlets for entity +# sets and singletons. +# 2. If the server side Odata endpoint exposes complex +# types, enum types, type definitions, then the corresponding +# client side proxy types imported. +# 3. Service Action/Function proxy cmdlets. +######################################################### +function GenerateModuleManifest +{ + param + ( + [System.Collections.ArrayList] $GlobalMetadata, + [String] $ModulePath, + [string[]] $AdditionalModules, + [Hashtable] $resourceNameMappings, + [string] $progressBarStatus + ) + + if($progressBarStatus -eq $null) { throw ($LocalizedData.ArguementNullError -f "progressBarStatus", "GenerateModuleManifest") } + + $NestedModules = @() + + foreach ($Metadata in $GlobalMetadata) + { + foreach ($entitySet in $Metadata.EntitySets) + { + $entitySetName = $entitySet.Name + if(($null -ne $resourceNameMappings) -and + $resourceNameMappings.ContainsKey($entitySetName)) + { + $entitySetName = $resourceNameMappings[$entitySetName] + } + else + { + $entitySetName = $entitySet.Type.Name + } + + $NestedModules += "$OutputModule\$($entitySetName).cdxml" + } + + foreach ($singleton in $Metadata.SingletonTypes) + { + $singletonName = $singleton.Name + $NestedModules += "$OutputModule\$($singletonName)" + "Singleton" + ".cdxml" + } + } + + New-ModuleManifest -Path $ModulePath -NestedModules ($AdditionalModules + $NestedModules) + + Write-Verbose ($LocalizedData.VerboseSavedModuleManifest -f $ModulePath) + + # Update the Progress Bar. + ProgressBarHelper "Export-ODataEndpointProxy" $progressBarStatus 80 20 1 1 +} + +######################################################### +# This is a helper function used to generate comlplex +# type defination from the metadata. +######################################################### +function GenerateComplexTypeDefinition +{ + param + ( + [System.Collections.ArrayList] $GlobalMetadata, + [string] $OutputModule, + [string] $typeDefinationFileName, + $normalizedNamespaces + ) + + $Path = "$OutputModule\$typeDefinationFileName" + $date = Get-Date + + $output = @" +# This module was generated by PSODataUtils on $date. + +`$typeDefinitions = @" +using System; +using System.Management.Automation; +using System.ComponentModel; + +"@ + # We are currently generating classes for EntityType & ComplexType + # defination exposed in the metadata. + + $complexTypeMapping = @{} + + # First, create complex type mappings for all metadata files at once + foreach ($metadata in $GlobalMetadata) + { + $typesToBeGenerated = $metadata.EntityTypes+$metadata.ComplexTypes + $enumTypesToBeGenerated = $metadata.EnumTypes + $typeDefinitionsToBeGenerated = $metadata.TypeDefinitions + + foreach ($entityType in $typesToBeGenerated) + { + if ($entityType -ne $null) + { + $entityTypeFullName = $entityType.Namespace + '.' + $entityType.Name + if(!$complexTypeMapping.ContainsKey($entityTypeFullName)) + { + $complexTypeMapping.Add($entityTypeFullName, $entityType.Name) + } + + # In short name we use Alias instead of Namespace + # We will add short name to $complexTypeMapping to enable Alias based search + if ($entityType.Alias -ne $null -and $entityType.Alias -ne "") + { + $entityTypeShortName = $entityType.Alias + '.' + $entityType.Name + if(!$complexTypeMapping.ContainsKey($entityTypeShortName)) + { + $complexTypeMapping.Add($entityTypeShortName, $entityType.Name) + } + } + } + } + + foreach ($enumType in $enumTypesToBeGenerated) + { + if ($enumType -ne $null) + { + $enumTypeFullName = $enumType.Namespace + '.' + $enumType.Name + if(!$complexTypeMapping.ContainsKey($enumTypeFullName)) + { + $complexTypeMapping.Add($enumTypeFullName, $enumType.Name) + } + + if (($enumType.Alias -ne $null -and $enumType.Alias -ne "") -or ($metadata.Alias -ne $null -and $metadata.Alias -ne "")) + { + if ($enumType.Alias -ne $null -and $enumType.Alias -ne "") + { + $alias = $enumType.Alias + } + else + { + $alias = $metadata.Alias + } + + $enumTypeShortName = $alias + '.' + $enumType.Name + if(!$complexTypeMapping.ContainsKey($enumTypeShortName)) + { + $complexTypeMapping.Add($enumTypeShortName, $enumType.Name) + } + } + } + } + + foreach ($typeDefinition in $typeDefinitionsToBeGenerated) + { + if ($typeDefinition -ne $null) + { + $typeDefinitionFullName = $typeDefinition.Namespace + '.' + $typeDefinition.Name + if(!$complexTypeMapping.ContainsKey($typeDefinitionFullName)) + { + $complexTypeMapping.Add($typeDefinitionFullName, $typeDefinition.Name) + } + + # In short name we use Alias instead of Namespace + # We will add short name to $complexTypeMapping to enable Alias based search + if ($typeDefinition.Alias) + { + $typeDefinitionShortName = $typeDefinition.Alias + '.' + $typeDefinition.Name + if(!$complexTypeMapping.ContainsKey($typeDefinitionShortName)) + { + $complexTypeMapping.Add($typeDefinitionShortName, $typeDefinition.Name) + } + } + } + } + } + + # Now classes definitions will be generated + foreach ($metadata in $GlobalMetadata) + { + $typesToBeGenerated = $metadata.EntityTypes+$metadata.ComplexTypes + $enumTypesToBeGenerated = $metadata.EnumTypes + $typeDefinitionsToBeGenerated = $metadata.TypeDefinitions + + if($typesToBeGenerated.Count -gt 0 -or $enumTypesToBeGenerated.Count -gt 0) + { + if ($metadata.Alias -ne $null -and $metadata.Alias -ne "") + { + # Check if this namespace has to be normalized in the .Net namespace/class definitions file. + $dotNetAlias = GetNamespace $metadata.Alias $normalizedNamespaces + + $output += @" + +namespace $($dotNetAlias) +{ +"@ + } + else + { + # Check if this namespace has to be normalized in the .Net namespace/class definitions file. + $dotNetNamespace = GetNamespace $metadata.Namespace $normalizedNamespaces + + $output += @" + +namespace $($dotNetNamespace) +{ +"@ + } + + foreach ($typeDefinition in $typeDefinitionsToBeGenerated) + { + if ($typeDefinition -ne $null) + { + Write-Verbose ($LocalizedData.VerboseAddingTypeDefinationToGeneratedModule -f $typeDefinitionFullName, "$OutputModule\$typeDefinationFileName") + + $output += "`n public class $($typeDefinition.Name)`n {" + $typeName = Convert-ODataTypeToCLRType $typeDefinition.BaseTypeStr $complexTypeMapping + $dotNetPropertyNamespace = GetNamespace $typeName $normalizedNamespaces $true + $output += "`n public $dotNetPropertyNamespace value;" + $output += @" +`n } +"@ + } + } + + $DotNETKeywords = ("abstract", "as", "base", "bool", "break", "byte", "case", "catch", "char", "checked", "class", "const", "continue", "decimal", "default", "delegate", "do", "double", "else", "enum", "event", "explicit", "extern", "false", "finally", "fixed", "float", "for", "foreach", "goto", "if", "implicit", "in", "in", "int", "interface", "internal", "is", "lock", "long", "namespace", "new", "null", "object", "operator", "out", "out", "override", "params", "private", "protected", "public", "readonly", "ref", "return", "sbyte", "sealed", "short", "sizeof", "stackalloc", "static", "string", "struct", "switch", "this", "throw", "true", "try", "typeof", "uint", "ulong", "unchecked", "unsafe", "ushort", "using", "virtual", "void", "volatile", "while", "add", "alias", "ascending", "async", "await", "descending", "dynamic", "from", "get", "global", "group", "into", "join", "let", "orderby", "partial", "partial", "remove", "select", "set", "value", "var", "where", "yield") + + foreach ($enumType in $enumTypesToBeGenerated) + { + if ($enumType -ne $null) + { + $enumTypeFullName = $enumType.Namespace + '.' + $enumType.Name + + Write-Verbose ($LocalizedData.VerboseAddingTypeDefinationToGeneratedModule -f $enumTypeFullName, "$OutputModule\$typeDefinationFileName") + + $output += "`n public enum $($enumType.Name)`n {" + + $properties = $null + + for($index = 0; $index -lt $enumType.Members.Count; $index++) + { + $memberName = $enumType.Members[$index].Name + $formattedMemberName = [System.Text.RegularExpressions.Regex]::Replace($memberName, "[^0-9a-zA-Z]", "_"); + $memberValue = $enumType.Members[$index].Value + + if ($DotNETKeywords -contains $formattedMemberName) + { + # If member name is a known keyword in .Net, add '@' prefix + $formattedMemberName = '@' + $formattedMemberName + } + + if ($formattedMemberName -match "^[0-9]*$") + { + # If member name is a numeric value, add 'm_' prefix + $formattedMemberName = 'm_' + $formattedMemberName + } + + if ($memberName -ne $formattedMemberName -or $formattedMemberName -like '@*' -or $formattedMemberName -like 'm_*') + { + # Add Description attribute to preserve original value + $properties += "`n [Description(`"$($memberName)`")]$formattedMemberName" + } + else + { + $properties += "`n $memberName" + } + + if ($memberValue) + { + $properties += " = $memberValue," + } + else + { + $properties += "," + } + } + + $output += $properties + $output += @" +`n } +"@ + } + } + + foreach ($entityType in $typesToBeGenerated) + { + if ($entityType -ne $null) + { + $entityTypeFullName = $entityType.Namespace + '.' + $entityType.Name + + Write-Verbose ($LocalizedData.VerboseAddingTypeDefinationToGeneratedModule -f $entityTypeFullName, "$OutputModule\$typeDefinationFileName") + + if ($entityType.BaseTypeStr -ne $null -and $entityType.BaseTypeStr -ne '' -and $entityType.BaseType -eq $null) + { + # This class inherits from another class, but we were not able to find base class during Parsing. + # We'll make another attempt. + foreach ($referencedMetadata in $GlobalMetadata) + { + if (($baseType = $referencedMetadata.EntityTypes | Where { $_.Namespace + "." + $_.Name -eq $entityType.BaseTypeStr -or $_.Alias + "." + $_.Name -eq $entityType.BaseTypeStr }) -ne $null -or + ($baseType = $referencedMetadata.ComplexTypes | Where { $_.Namespace + "." + $_.Name -eq $entityType.BaseTypeStr -or $_.Alias + "." + $_.Name -eq $entityType.BaseTypeStr }) -ne $null) + { + # Found base class + $entityType.BaseType = $baseType + break + } + } + } + + if($null -ne $entityType.BaseType) + { + if ((![string]::IsNullOrEmpty($entityType.BaseType.Alias) -and $entityType.BaseType.Alias -eq $entityType.Alias) -or + (![string]::IsNullOrEmpty($entityType.BaseType.Namespace) -and $entityType.BaseType.Namespace -eq $entityType.Namespace)) + { + $fullBaseTypeName = $entityType.BaseType.Name + } + else + { + # Base type can be defined in different namespace. For that reason we include namespace or alias. + if (![string]::IsNullOrEmpty($entityType.BaseType.Alias)) + { + # Check if derived alias has to be normalized. + $normalizedDotNetAlias = GetNamespace $entityType.BaseType.Alias $normalizedNamespaces + $fullBaseTypeName = $normalizedDotNetAlias + "." + $entityType.BaseType.Name + } + else + { + # Check if derived namespace has to be normalized. + $normalizedDotNetNamespace = GetNamespace $entityType.BaseType.Namespace $normalizedNamespaces + $fullBaseTypeName = $normalizedDotNetNamespace + "." + $entityType.BaseType.Name + } + } + + $output += "`n public class $($entityType.Name) : $($fullBaseTypeName)`n {" + } + else + { + $output += "`n public class $($entityType.Name)`n {" + } + + $properties = $null + + for($index = 0; $index -lt $entityType.EntityProperties.Count; $index++) + { + $property = $entityType.EntityProperties[$index] + $typeName = Convert-ODataTypeToCLRType $property.TypeName $complexTypeMapping + + if ($typeName.StartsWith($metadata.Namespace + ".")) + { + $dotNetPropertyNamespace = $typeName.Replace($metadata.Namespace + ".", "") + } + elseif ($typeName.StartsWith($metadata.Alias + ".")) + { + $dotNetPropertyNamespace = $typeName.Replace($metadata.Alias + ".", "") + } + else + { + $dotNetPropertyNamespace = GetNamespace $typeName $normalizedNamespaces $true + } + + $properties += "`n public $dotNetPropertyNamespace $($property.Name);" + } + + $output += $properties + $output += @" +`n } +"@ + } + } + + $output += "`n}`n" + } + } + $output += """@`n" + $output += "Add-Type -TypeDefinition `$typeDefinitions -IgnoreWarnings`n" + $output | Out-File -FilePath $Path + Write-Verbose ($LocalizedData.VerboseSavedTypeDefinationModule -f $typeDefinationFileName, $OutputModule) + + return $complexTypeMapping +} \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.ODataUtils/ko-KR/Microsoft.PowerShell.ODataUtilsStrings.psd1 b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.ODataUtils/ko-KR/Microsoft.PowerShell.ODataUtilsStrings.psd1 new file mode 100644 index 0000000..82cadd4 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.ODataUtils/ko-KR/Microsoft.PowerShell.ODataUtilsStrings.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1 b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1 new file mode 100644 index 0000000..72f97b4 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Security/Microsoft.PowerShell.Security.psd1 @@ -0,0 +1,15 @@ +@{ +GUID="A94C8C7E-9810-47C0-B8AF-65089C13A35A" +Author="Microsoft Corporation" +CompanyName="Microsoft Corporation" +Copyright="© Microsoft Corporation. All rights reserved." +ModuleVersion="3.0.0.0" +PowerShellVersion = '5.1' +CLRVersion="4.0" +AliasesToExport = @() +FunctionsToExport = @() +CmdletsToExport="Get-Acl", "Set-Acl", "Get-PfxCertificate", "Get-Credential", "Get-ExecutionPolicy", "Set-ExecutionPolicy", "Get-AuthenticodeSignature", "Set-AuthenticodeSignature", "ConvertFrom-SecureString", "ConvertTo-SecureString", "Get-CmsMessage", "Unprotect-CmsMessage", "Protect-CmsMessage" , "New-FileCatalog" , "Test-FileCatalog" +NestedModules="Microsoft.PowerShell.Security.dll" +HelpInfoURI = 'https://go.microsoft.com/fwlink/?linkid=390786' +CompatiblePSEditions = @('Desktop') +} diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1 b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1 new file mode 100644 index 0000000..ab00f7a --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1 @@ -0,0 +1,34 @@ +@{ +GUID="1DA87E53-152B-403E-98DC-74D7B4D63D59" +Author="Microsoft Corporation" +CompanyName="Microsoft Corporation" +Copyright="© Microsoft Corporation. All rights reserved." +ModuleVersion="3.1.0.0" +PowerShellVersion = '5.1' +CLRVersion="4.0" +CmdletsToExport= "Format-List", "Format-Custom", "Format-Table", "Format-Wide", + "Out-File", "Out-Printer", "Out-String", + "Out-GridView", "Get-FormatData", "Export-FormatData", "ConvertFrom-Json", "ConvertTo-Json", + "Invoke-RestMethod", "Invoke-WebRequest", "Register-ObjectEvent", "Register-EngineEvent", + "Wait-Event", "Get-Event", "Remove-Event", "Get-EventSubscriber", "Unregister-Event", + "New-Event", "Add-Member", "Add-Type", "Compare-Object", "ConvertTo-Html", "ConvertFrom-StringData", + "Export-Csv", "Import-Csv", "ConvertTo-Csv", "ConvertFrom-Csv", "Export-Alias", "Invoke-Expression", + "Get-Alias", "Get-Culture", "Get-Date", "Get-Host", "Get-Member", "Get-Random", "Get-UICulture", + "Get-Unique", "Export-PSSession", "Import-PSSession", "Import-Alias", "Import-LocalizedData", + "Select-String", "Measure-Object", "New-Alias", "New-TimeSpan", "Read-Host", "Set-Alias", "Set-Date", + "Start-Sleep", "Tee-Object", "Measure-Command", "Update-List", "Update-TypeData", "Update-FormatData", + "Remove-TypeData", "Get-TypeData", "Write-Host", "Write-Progress", "New-Object", "Select-Object", + "Group-Object", "Sort-Object", "Get-Variable", "New-Variable", "Set-Variable", "Remove-Variable", + "Clear-Variable", "Export-Clixml", "Import-Clixml", "ConvertTo-Xml", "Select-Xml", "Write-Debug", + "Write-Verbose", "Write-Warning", "Write-Error", "Write-Information", "Write-Output", "Set-PSBreakpoint", "Get-PSBreakpoint", + "Remove-PSBreakpoint", "Enable-PSBreakpoint", "Disable-PSBreakpoint", "Get-PSCallStack", + "Send-MailMessage", "Get-TraceSource", "Set-TraceSource", "Trace-Command", "Show-Command", "Unblock-File", + "Get-Runspace", "Debug-Runspace", "Enable-RunspaceDebug", "Disable-RunspaceDebug", "Get-RunspaceDebug", "Wait-Debugger", + "ConvertFrom-String", "Convert-String" +FunctionsToExport= "Get-FileHash", "New-TemporaryFile", "New-Guid", "Format-Hex", "Import-PowerShellDataFile", + "ConvertFrom-SddlString" +AliasesToExport= "CFS", "fhx" +NestedModules="Microsoft.PowerShell.Commands.Utility.dll","Microsoft.PowerShell.Utility.psm1" +HelpInfoURI = 'https://go.microsoft.com/fwlink/?linkid=390787' +CompatiblePSEditions = @('Desktop') +} diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psm1 b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psm1 new file mode 100644 index 0000000..d702a30 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psm1 @@ -0,0 +1,740 @@ +function Get-FileHash +{ + [CmdletBinding(DefaultParameterSetName = "Path", HelpURI = "https://go.microsoft.com/fwlink/?LinkId=517145")] + param( + [Parameter(Mandatory, ParameterSetName="Path", Position = 0)] + [System.String[]] + $Path, + + [Parameter(Mandatory, ParameterSetName="LiteralPath", ValueFromPipelineByPropertyName = $true)] + [Alias("PSPath")] + [System.String[]] + $LiteralPath, + + [Parameter(Mandatory, ParameterSetName="Stream")] + [System.IO.Stream] + $InputStream, + + [ValidateSet("SHA1", "SHA256", "SHA384", "SHA512", "MACTripleDES", "MD5", "RIPEMD160")] + [System.String] + $Algorithm="SHA256" + ) + + begin + { + # Construct the strongly-typed crypto object + + # First see if it has a FIPS algorithm + $hasherType = "System.Security.Cryptography.${Algorithm}CryptoServiceProvider" -as [Type] + if ($hasherType) + { + $hasher = $hasherType::New() + } + else + { + # Check if the type is supported in the current system + $algorithmType = "System.Security.Cryptography.${Algorithm}" -as [Type] + if ($algorithmType) + { + if ($Algorithm -eq "MACTripleDES") + { + $hasher = $algorithmType::New() + } + else + { + $hasher = $algorithmType::Create() + } + } + else + { + $errorId = "AlgorithmTypeNotSupported" + $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidArgument + $errorMessage = [Microsoft.PowerShell.Commands.UtilityResources]::AlgorithmTypeNotSupported -f $Algorithm + $exception = [System.InvalidOperationException]::New($errorMessage) + $errorRecord = [System.Management.Automation.ErrorRecord]::New($exception, $errorId, $errorCategory, $null) + $PSCmdlet.ThrowTerminatingError($errorRecord) + } + } + + function GetStreamHash + { + param( + [System.IO.Stream] + $InputStream, + + [System.String] + $RelatedPath, + + [System.Security.Cryptography.HashAlgorithm] + $Hasher) + + # Compute file-hash using the crypto object + [Byte[]] $computedHash = $Hasher.ComputeHash($InputStream) + [string] $hash = [BitConverter]::ToString($computedHash) -replace '-','' + + if ($RelatedPath -eq $null) + { + $retVal = [PSCustomObject] @{ + Algorithm = $Algorithm.ToUpperInvariant() + Hash = $hash + } + } + else + { + $retVal = [PSCustomObject] @{ + Algorithm = $Algorithm.ToUpperInvariant() + Hash = $hash + Path = $RelatedPath + } + } + $retVal.psobject.TypeNames.Insert(0, "Microsoft.Powershell.Utility.FileHash") + $retVal + } + } + + process + { + if($PSCmdlet.ParameterSetName -eq "Stream") + { + GetStreamHash -InputStream $InputStream -RelatedPath $null -Hasher $hasher + } + else + { + $pathsToProcess = @() + if($PSCmdlet.ParameterSetName -eq "LiteralPath") + { + $pathsToProcess += Resolve-Path -LiteralPath $LiteralPath | Foreach-Object ProviderPath + } + if($PSCmdlet.ParameterSetName -eq "Path") + { + $pathsToProcess += Resolve-Path $Path | Foreach-Object ProviderPath + } + + foreach($filePath in $pathsToProcess) + { + if(Test-Path -LiteralPath $filePath -PathType Container) + { + continue + } + + try + { + # Read the file specified in $FilePath as a Byte array + [system.io.stream]$stream = [system.io.file]::OpenRead($filePath) + GetStreamHash -InputStream $stream -RelatedPath $filePath -Hasher $hasher + } + catch [Exception] + { + $errorMessage = [Microsoft.PowerShell.Commands.UtilityResources]::FileReadError -f $FilePath, $_ + Write-Error -Message $errorMessage -Category ReadError -ErrorId "FileReadError" -TargetObject $FilePath + return + } + finally + { + if($stream) + { + $stream.Dispose() + } + } + } + } + } +} + +<# This cmdlet is used to create a new temporary file in $env:temp #> +function New-TemporaryFile +{ + [CmdletBinding( + HelpURI='https://go.microsoft.com/fwlink/?LinkId=526726', + SupportsShouldProcess=$true)] + [OutputType([System.IO.FileInfo])] + Param() + + Begin + { + try + { + if($PSCmdlet.ShouldProcess($env:TEMP)) + { + $tempFilePath = [System.IO.Path]::GetTempFileName() + } + } + catch + { + $errorRecord = [System.Management.Automation.ErrorRecord]::new($_.Exception,"NewTemporaryFileWriteError", "WriteError", $env:TEMP) + Write-Error -ErrorRecord $errorRecord + return + } + + if($tempFilePath) + { + Get-Item $tempFilePath + } + } +} + +<# This cmdlet is used to generate a new guid #> +function New-Guid +{ + [CmdletBinding(HelpURI='https://go.microsoft.com/fwlink/?LinkId=526920')] + [OutputType([System.Guid])] + Param() + + Begin + { + [Guid]::NewGuid() + } +} + +<############################################################################################ +# Format-Hex cmdlet helps in displaying the Hexadecimal equivalent of the input data. +############################################################################################> +function Format-Hex +{ + [CmdletBinding( + DefaultParameterSetName="Path", + HelpUri="https://go.microsoft.com/fwlink/?LinkId=526919")] + [Alias("fhx")] + [OutputType("Microsoft.PowerShell.Commands.ByteCollection")] + param + ( + [Parameter (Mandatory=$true, Position=0, ParameterSetName="Path")] + [ValidateNotNullOrEmpty()] + [string[]] $Path, + + [Parameter (Mandatory=$true, ParameterSetName="LiteralPath")] + [ValidateNotNullOrEmpty()] + [Alias("PSPath")] + [string[]] $LiteralPath, + + [Parameter(Mandatory=$true, ParameterSetName="ByInputObject", ValueFromPipeline=$true)] + [Object] $InputObject, + + [Parameter (ParameterSetName="ByInputObject")] + [ValidateSet("Ascii", "UTF32", "UTF7", "UTF8", "BigEndianUnicode", "Unicode")] + [string] $Encoding = "Ascii", + + [Parameter(ParameterSetName="ByInputObject")] + [switch]$Raw + ) + + begin + { + $bufferSize = 16 + $inputStreamArray = [System.Collections.ArrayList]::New() + <############################################################################################ + # The ConvertToHexadecimalHelper is a helper method used to fetch unicode bytes from the + # input data and display the hexadecimial representaion of the of the input data in bytes. + ############################################################################################> + function ConvertToHexadecimalHelper + { + param + ( + [Byte[]] $inputBytes, + [string] $path, + [Uint32] $offset + ) + + # This section is used to display the hexadecimal + # representaion of the of the input data in bytes. + if($inputBytes -ne $null) + { + $byteCollectionObject = [Microsoft.PowerShell.Commands.ByteCollection]::new($offset, $inputBytes, $path) + Write-Output -InputObject $byteCollectionObject + } + } + + <############################################################################################ + # The ProcessFileContent is a helper method used to fetch file contents in blocks and + # process it to support displaying hexadecimal formating of the fetched content. + ############################################################################################> + function ProcessFileContent + { + param + ( + [string] $filePath, + [boolean] $isLiteralPath + ) + + if($isLiteralPath) + { + $resolvedPaths = Resolve-Path -LiteralPath $filePath + } + else + { + $resolvedPaths = Resolve-Path -Path $filePath + } + + # If Path resolution has failed then a corresponding non-terminating error is + # written to the pipeline. We continue processing any remaining files. + if($resolvedPaths -eq $null) + { + return + } + + if($resolvedPaths.Count -gt 1) + { + # write a non-terminating error message indicating that path specified is resolving to multiple file system paths. + $errorMessage = [Microsoft.PowerShell.Commands.UtilityResources]::FormatHexResolvePathError -f $filePath + Write-Error -Message $errorMessage -Category ([System.Management.Automation.ErrorCategory]::InvalidData) -ErrorId "FormatHexResolvePathError" + } + + $targetFilePath = $resolvedPaths.ProviderPath + + + if($targetFilePath -ne $null) + { + $buffer = [byte[]]::new($bufferSize) + + try + { + try + { + $currentFileStream = [System.IO.File]::Open($targetFilePath, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read) + } + catch + { + # Failed to access the file. Write a non terminating error to the pipeline + # and move on with the remaining files. + $exception = $_.Exception + if($null -ne $_.Exception -and + $null -ne $_.Exception.InnerException) + { + $exception = $_.Exception.InnerException + } + + $errorRecord = [System.Management.Automation.ErrorRecord]::new($exception,"FormatHexFileAccessError", ([System.Management.Automation.ErrorCategory]::ReadError), $targetFilePath) + $PSCmdlet.WriteError($errorRecord) + } + + if($null -ne $currentFileStream) + { + $srcStream = [System.IO.BinaryReader]::new($currentFileStream) + $displayHeader = $true + $offset = 0 + $blockCounter = 0 + while($numberOfBytesRead = $srcStream.Read($buffer, 0, $bufferSize)) + { + # send only the bytes that have been read + # if we send the whole buffer, we'll have extraneous bytes + # at the end of an incomplete group of 16 bytes + if ( $numberOfBytesRead -eq $bufferSize ) + { + # under some circumstances if we don't copy the buffer + # and the results are stored to a variable, the results are not + # correct and one object replicated in all the output objects + ConvertToHexadecimalHelper ($buffer.Clone()) $targetFilePath $offset + } + else + { + # handle the case of the partial (and probably last) buffer + $bytesReadBuffer = [byte[]]::New($numberOfBytesRead) + [Array]::Copy($buffer,0, $bytesReadBuffer,0,$numberOfBytesRead) + ConvertToHexadecimalHelper $bytesReadBuffer $targetFilePath $offset + } + $displayHeader = $false + $blockCounter++; + + # Updating the offset value. + $offset = $blockCounter*0x10 + } + } + } + finally + { + If($null -ne $currentFileStream) + { + $currentFileStream.Dispose() + } + If($null -ne $srcStream) + { + $srcStream.Dispose() + } + } + } + } + } + + process + { + switch($PSCmdlet.ParameterSetName) + { + "Path" + { + ProcessFileContent $Path $false + } + "LiteralPath" + { + ProcessFileContent $LiteralPath $true + } + "ByInputObject" + { + # If it's an actual byte array, then we directly use it for hexadecimal formatting. + if($InputObject -is [Byte[]]) + { + ConvertToHexadecimalHelper $InputObject $null + return + } + # if it's a single byte, we'll assume streaming + elseif($InputObject -is [byte]) + { + $null = $inputStreamArray.Add($InputObject) + } + # If the input data is of string type then directly get bytes out of it. + elseif($InputObject -is [string]) + { + # The ValidateSet arribute on the Encoding paramter makes sure that only + # valid values (supported on all paltforms where Format-Hex is avaliable) + # are allowed through user input. + $inputBytes = [Text.Encoding]::$Encoding.GetBytes($InputObject) + ConvertToHexadecimalHelper $inputBytes $null + return + } + elseif($InputObject -is [System.IO.FileSystemInfo]) + { + # If file path is provided as an input, use the file contents to show the hexadecimal format. + $filePath = ([System.IO.FileSystemInfo]$InputObject).FullName + ProcessFileContent $filePath $false + return + } + elseif($InputObject -is [int64]) + { + $inputBytes = [BitConverter]::GetBytes($InputObject) + $null = $inputStreamArray.AddRange($inputBytes) + } + elseif($InputObject -is [int64[]]) + { + foreach($i64 in $InputObject) + { + $inputBytes = [BitConverter]::GetBytes($i64) + $null = $inputStreamArray.AddRange($inputBytes) + } + } + elseif($InputObject -is [int]) + { + # If we get what appears as ints, it may not be what the user really wants. + # for example, if the user types a small set of numbers just to get their + # character representations, as follows: + # + # 170..180 | format-hex + # Path: + # 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + #00000000 AA AB AC AD AE AF B0 B1 B2 B3 B4 ª«¬­®¯°±²³´ + # + # any integer padding is likely to be more confusing than this + # fairly compact representation. + # + # However, some might like to see the results with the raw data, + # -Raw exists to provide that behavior: + # PS# 170..180 | format-hex -Raw + # + # Path: + # + # 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + # + # 00000000 AA 00 00 00 AB 00 00 00 AC 00 00 00 AD 00 00 00 ª...«...¬...­... + # 00000010 AE 00 00 00 AF 00 00 00 B0 00 00 00 B1 00 00 00 ®...¯...°...±... + # 00000020 B2 00 00 00 B3 00 00 00 B4 00 00 00 ²...³...´... + # + # this provides a representation of the piped numbers which includes all + # of the bytes which are in an int32 + if ( $Raw ) + { + $inputBytes = [BitConverter]::GetBytes($InputObject) + $null = $inputStreamArray.AddRange($inputBytes) + } + else + { + # first determine whether we can represent this as a byte + $possibleByte = $InputObject -as [byte] + # first determine whether we can represent this as a int16 + $possibleInt16 = $InputObject -as [int16] + if ( $possibleByte -ne $null ) + { + $null = $inputStreamArray.Add($possibleByte) + } + elseif ( $possibleint16 -ne $null ) + { + $inputBytes = [BitConverter]::GetBytes($possibleInt16) + $null = $inputStreamArray.AddRange($inputBytes) + } + else + { + # now int + $inputBytes = [BitConverter]::GetBytes($InputObject) + $null = $inputStreamArray.AddRange($inputBytes) + } + } + } + else + { + # Otherwise, write a non-terminating error message indicating that input object type is not supported. + $errorMessage = [Microsoft.PowerShell.Commands.UtilityResources]::FormatHexTypeNotSupported -f $InputObject.GetType() + Write-Error -Message $errorMessage -Category ([System.Management.Automation.ErrorCategory]::ParserError) -ErrorId "FormatHexFailureTypeNotSupported" + } + # Handle streaming case here + # during this process we may not have enough characters to create a ByteCollection + # if we do, create as many ByteCollections as necessary, each being 16 bytes in length + if ( $inputStreamArray.Count -ge $bufferSize ) + { + $rowCount = [math]::Floor($inputStreamArray.Count/$bufferSize) + $arrayLength = $bufferSize * $rowCount + for($i = 0; $i -lt $rowCount; $i++) + { + $rowOffset = $i * $bufferSize + ConvertToHexadecimalHelper -inputBytes $inputStreamArray.GetRange($rowOffset, $bufferSize) -path ' ' -offset $offset + $offset += $bufferSize + } + # We use RemoveRange because of the pathological case of having + # streamed combination of bytes, int16, int32, int64 which are greater + # than 16 bytes. Consider the case: + # $i = [int16]::MaxValue + 3 + # $i64=[int64]::MaxValue -5 + # .{ $i;$i;$i;$i64 } | format-hex + # which create an arraylist 20 bytes + # we need to remove only the bytes from the array which we emitted + $inputStreamArray.RemoveRange(0,$arrayLength) + } + } + } + } + end + { + # now manage any left over bytes in the $inputStreamArray + if ( $PSCmdlet.ParameterSetName -eq "ByInputObject" ) + { + ConvertToHexadecimalHelper $inputStreamArray $null -path ' ' -offset $offset + } + } + +} + +## Imports a PowerShell Data File - a PowerShell hashtable defined in +## a file (such as a Module manifest, session configuration file) +function Import-PowerShellDataFile +{ + [CmdletBinding(DefaultParameterSetName = "ByPath", HelpUri = "https://go.microsoft.com/fwlink/?LinkID=623621")] + [OutputType("System.Collections.Hashtable")] + param( + [Parameter(ParameterSetName = "ByPath", Position = 0)] + [String[]] $Path, + + [Parameter(ParameterSetName = "ByLiteralPath", ValueFromPipelineByPropertyName = $true)] + [Alias("PSPath")] + [String[]] $LiteralPath + ) + + begin + { + function ThrowInvalidDataFile + { + param($resolvedPath, $extraError) + + $errorId = "CouldNotParseAsPowerShellDataFile$extraError" + $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidData + $errorMessage = [Microsoft.PowerShell.Commands.UtilityResources]::CouldNotParseAsPowerShellDataFile -f $resolvedPath + $exception = [System.InvalidOperationException]::New($errorMessage) + $errorRecord = [System.Management.Automation.ErrorRecord]::New($exception, $errorId, $errorCategory, $null) + $PSCmdlet.WriteError($errorRecord) + } + } + + process + { + foreach($resolvedPath in (Resolve-Path @PSBoundParameters)) + { + $parseErrors = $null + $ast = [System.Management.Automation.Language.Parser]::ParseFile(($resolvedPath.ProviderPath), [ref] $null, [ref] $parseErrors) + if ($parseErrors.Length -gt 0) + { + ThrowInvalidDataFile $resolvedPath + } + else + { + $data = $ast.Find( { $args[0] -is [System.Management.Automation.Language.HashtableAst] }, $false ) + if($data) + { + $data.SafeGetValue() + } + else + { + ThrowInvalidDataFile $resolvedPath "NoHashtableRoot" + } + } + } + } +} + +## Converts a SDDL string into an object-based representation of a security +## descriptor +function ConvertFrom-SddlString +{ + [CmdletBinding(HelpUri = "https://go.microsoft.com/fwlink/?LinkId=623636")] + param( + ## The string representing the security descriptor in SDDL syntax + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [String] $Sddl, + + ## The type of rights that this SDDL string represents, if any. + [Parameter()] + [ValidateSet( + "FileSystemRights", "RegistryRights", "ActiveDirectoryRights", + "MutexRights", "SemaphoreRights", "CryptoKeyRights", + "EventWaitHandleRights")] + $Type + ) + + Begin + { + # On CoreCLR CryptoKeyRights and ActiveDirectoryRights are not supported. + if ($PSEdition -eq "Core" -and ($Type -eq "CryptoKeyRights" -or $Type -eq "ActiveDirectoryRights")) + { + $errorId = "TypeNotSupported" + $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidArgument + $errorMessage = [Microsoft.PowerShell.Commands.UtilityResources]::TypeNotSupported -f $Type + $exception = [System.ArgumentException]::New($errorMessage) + $errorRecord = [System.Management.Automation.ErrorRecord]::New($exception, $errorId, $errorCategory, $null) + $PSCmdlet.ThrowTerminatingError($errorRecord) + } + + ## Translates a SID into a NT Account + function ConvertTo-NtAccount + { + param($Sid) + + if($Sid) + { + $securityIdentifier = [System.Security.Principal.SecurityIdentifier] $Sid + + try + { + $ntAccount = $securityIdentifier.Translate([System.Security.Principal.NTAccount]).ToString() + } + catch{} + + $ntAccount + } + } + + ## Gets the access rights that apply to an access mask, preferring right types + ## of 'Type' if specified. + function Get-AccessRights + { + param($AccessMask, $Type) + + if ($PSEdition -eq "Core") + { + ## All the types of access rights understood by .NET Core + $rightTypes = [Ordered] @{ + "FileSystemRights" = [System.Security.AccessControl.FileSystemRights] + "RegistryRights" = [System.Security.AccessControl.RegistryRights] + "MutexRights" = [System.Security.AccessControl.MutexRights] + "SemaphoreRights" = [System.Security.AccessControl.SemaphoreRights] + "EventWaitHandleRights" = [System.Security.AccessControl.EventWaitHandleRights] + } + } + else + { + ## All the types of access rights understood by .NET + $rightTypes = [Ordered] @{ + "FileSystemRights" = [System.Security.AccessControl.FileSystemRights] + "RegistryRights" = [System.Security.AccessControl.RegistryRights] + "ActiveDirectoryRights" = [System.DirectoryServices.ActiveDirectoryRights] + "MutexRights" = [System.Security.AccessControl.MutexRights] + "SemaphoreRights" = [System.Security.AccessControl.SemaphoreRights] + "CryptoKeyRights" = [System.Security.AccessControl.CryptoKeyRights] + "EventWaitHandleRights" = [System.Security.AccessControl.EventWaitHandleRights] + } + } + $typesToExamine = $rightTypes.Values + + ## If they know the access mask represents a certain type, prefer its names + ## (i.e.: CreateLink for the registry over CreateDirectories for the filesystem) + if($Type) + { + $typesToExamine = @($rightTypes[$Type]) + $typesToExamine + } + + + ## Stores the access types we've found that apply + $foundAccess = @() + + ## Store the access types we've already seen, so that we don't report access + ## flags that are essentially duplicate. Many of the access values in the different + ## enumerations have the same value but with different names. + $foundValues = @{} + + ## Go through the entries in the different right types, and see if they apply to the + ## provided access mask. If they do, then add that to the result. + foreach($rightType in $typesToExamine) + { + foreach($accessFlag in [Enum]::GetNames($rightType)) + { + $longKeyValue = [long] $rightType::$accessFlag + if(-not $foundValues.ContainsKey($longKeyValue)) + { + $foundValues[$longKeyValue] = $true + if(($AccessMask -band $longKeyValue) -eq ($longKeyValue)) + { + $foundAccess += $accessFlag + } + } + } + } + + $foundAccess | Sort-Object + } + + ## Converts an ACE into a string representation + function ConvertTo-AceString + { + param( + [Parameter(ValueFromPipeline)] + $Ace, + $Type + ) + + process + { + foreach($aceEntry in $Ace) + { + $AceString = (ConvertTo-NtAccount $aceEntry.SecurityIdentifier) + ": " + $aceEntry.AceQualifier + if($aceEntry.AceFlags -ne "None") + { + $AceString += " " + $aceEntry.AceFlags + } + + if($aceEntry.AccessMask) + { + $foundAccess = Get-AccessRights $aceEntry.AccessMask $Type + + if($foundAccess) + { + $AceString += " ({0})" -f ($foundAccess -join ", ") + } + } + + $AceString + } + } + } + } + + Process + { + $rawSecurityDescriptor = [Security.AccessControl.CommonSecurityDescriptor]::new($false,$false,$Sddl) + + $owner = ConvertTo-NtAccount $rawSecurityDescriptor.Owner + $group = ConvertTo-NtAccount $rawSecurityDescriptor.Group + $discretionaryAcl = ConvertTo-AceString $rawSecurityDescriptor.DiscretionaryAcl $Type + $systemAcl = ConvertTo-AceString $rawSecurityDescriptor.SystemAcl $Type + + [PSCustomObject] @{ + Owner = $owner + Group = $group + DiscretionaryAcl = @($discretionaryAcl) + SystemAcl = @($systemAcl) + RawDescriptor = $rawSecurityDescriptor + } + } +} diff --git a/newton-cn/bin/v1.0/Modules/Microsoft.WSMan.Management/Microsoft.WSMan.Management.psd1 b/newton-cn/bin/v1.0/Modules/Microsoft.WSMan.Management/Microsoft.WSMan.Management.psd1 new file mode 100644 index 0000000..56bca97 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Microsoft.WSMan.Management/Microsoft.WSMan.Management.psd1 @@ -0,0 +1,16 @@ +@{ +GUID="766204A6-330E-4263-A7AB-46C87AFC366C" +Author="Microsoft Corporation" +CompanyName="Microsoft Corporation" +Copyright="© Microsoft Corporation. All rights reserved." +ModuleVersion="3.0.0.0" +PowerShellVersion = '5.1' +CLRVersion="4.0" +AliasesToExport = @() +FunctionsToExport = @() +CmdletsToExport="Disable-WSManCredSSP", "Enable-WSManCredSSP", "Get-WSManCredSSP", "Set-WSManQuickConfig", "Test-WSMan", "Invoke-WSManAction", "Connect-WSMan", "Disconnect-WSMan", "Get-WSManInstance", "Set-WSManInstance", "Remove-WSManInstance", "New-WSManInstance", "New-WSManSessionOption" +NestedModules="Microsoft.WSMan.Management.dll" +FormatsToProcess="..\..\WSMan.format.ps1xml" +HelpInfoURI = 'https://go.microsoft.com/fwlink/?linkid=390788' +CompatiblePSEditions = @('Desktop') +} diff --git a/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcAdvancedHostSettingTask_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcAdvancedHostSettingTask_v1.0.cdxml new file mode 100644 index 0000000..a40f80d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcAdvancedHostSettingTask_v1.0.cdxml @@ -0,0 +1,86 @@ + + + + 1.0 + DtcAdvancedHostSetting + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + String + DWORD + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcAdvancedSettingTask_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcAdvancedSettingTask_v1.0.cdxml new file mode 100644 index 0000000..2be0a63 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcAdvancedSettingTask_v1.0.cdxml @@ -0,0 +1,100 @@ + + + + 1.0 + DtcAdvancedSetting + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + String + DWORD + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcClusterDefaultTask_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcClusterDefaultTask_v1.0.cdxml new file mode 100644 index 0000000..035572f --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcClusterDefaultTask_v1.0.cdxml @@ -0,0 +1,46 @@ + + + + 1.0 + DtcClusterDefault + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcClusterTMMappingTask_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcClusterTMMappingTask_v1.0.cdxml new file mode 100644 index 0000000..ea48f2b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcClusterTMMappingTask_v1.0.cdxml @@ -0,0 +1,372 @@ + + + + 1.0 + DtcClusterTMMapping + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcDefaultTask_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcDefaultTask_v1.0.cdxml new file mode 100644 index 0000000..e6b9926 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcDefaultTask_v1.0.cdxml @@ -0,0 +1,46 @@ + + + + 1.0 + DtcDefault + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcLogTask_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcLogTask_v1.0.cdxml new file mode 100644 index 0000000..bc14331 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcLogTask_v1.0.cdxml @@ -0,0 +1,94 @@ + + + + 1.0 + DtcLog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcNetworkSettingTask_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcNetworkSettingTask_v1.0.cdxml new file mode 100644 index 0000000..1ccbe4e --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcNetworkSettingTask_v1.0.cdxml @@ -0,0 +1,130 @@ + + + + 1.0 + DtcNetworkSetting + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NoAuth + Incoming + Mutual + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcTask_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcTask_v1.0.cdxml new file mode 100644 index 0000000..2f6132c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcTask_v1.0.cdxml @@ -0,0 +1,125 @@ + + + + 1.0 + Dtc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BootStart + SystemStart + AutoStart + DemandStart + Disabled + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcTransactionTask_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcTransactionTask_v1.0.cdxml new file mode 100644 index 0000000..00c2a1b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcTransactionTask_v1.0.cdxml @@ -0,0 +1,148 @@ + + + + 1.0 + DtcTransaction + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcTransactionsStatisticsTask_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcTransactionsStatisticsTask_v1.0.cdxml new file mode 100644 index 0000000..65ff3c7 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcTransactionsStatisticsTask_v1.0.cdxml @@ -0,0 +1,33 @@ + + + + 1.0 + DtcTransactionsStatistics + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcTransactionsTraceSessionTask_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcTransactionsTraceSessionTask_v1.0.cdxml new file mode 100644 index 0000000..d3d0a32 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcTransactionsTraceSessionTask_v1.0.cdxml @@ -0,0 +1,80 @@ + + + + 1.0 + DtcTransactionsTraceSession + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcTransactionsTraceSettingTask_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcTransactionsTraceSettingTask_v1.0.cdxml new file mode 100644 index 0000000..df42497 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/MsDtc/MSFT_DtcTransactionsTraceSettingTask_v1.0.cdxml @@ -0,0 +1,70 @@ + + + + 1.0 + DtcTransactionsTraceSetting + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/MsDtc/MsDtc.Formats.ps1xml b/newton-cn/bin/v1.0/Modules/MsDtc/MsDtc.Formats.ps1xml new file mode 100644 index 0000000..9f1026d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/MsDtc/MsDtc.Formats.ps1xml @@ -0,0 +1,207 @@ + + + + + Dtc + + Microsoft.Management.Infrastructure.CimInstance#DtcInstance + + + + + + + DtcName + + + VirtualServerName + + + Status + + + OleTxEndpointCid + + + XAEndpointCid + + + UisEndpointCid + + + KtmRmEndpointCid + + + + + + + + DtcClusterTMMapping + + Microsoft.Management.Infrastructure.CimInstance#DtcClusterTMMapping + + + + + + + Name + + + ApplicationType + + + Application + + + Local + + + ClusterResourceName + + + + + + + + DtcTransactionsStatistics + + Microsoft.Management.Infrastructure.CimInstance#DtcTransactionsStatistics + + + + + + + Open + + + Committed + + + Aborted + + + ForcedAbort + + + InDoubt + + + Heuristic + + + SinglePhaseInDoubt + + + OpenMax + + + CommittedMax + + + AbortedMax + + + InDoubtMax + + + HeuristicMax + + + + + + + + DtcNetworkSetting + + Microsoft.Management.Infrastructure.CimInstance#DtcNetworkSettings + + + + + + + AuthenticationLevel + + + InboundTransactionsEnabled + + + OutboundTransactionsEnabled + + + RemoteClientAccessEnabled + + + RemoteAdministrationAccessEnabled + + + XATransactionsEnabled + + + LUTransactionsEnabled + + + + + + + + DtcTransactionInfo + + Microsoft.Management.Infrastructure.CimInstance#DtcTransactionInfo + + + + + + + TransactionId + + + Description + + + State + + + IsolationLevel + + + Parent + + + + + + + + DtcLog + + Microsoft.Management.Infrastructure.CimInstance#DtcLogFileSettings + + + + + + + Path + + + SizeInMB + + + MaxSizeInMB + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/MsDtc/MsDtc.Types.ps1xml b/newton-cn/bin/v1.0/Modules/MsDtc/MsDtc.Types.ps1xml new file mode 100644 index 0000000..e0cac8c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/MsDtc/MsDtc.Types.ps1xml @@ -0,0 +1,65 @@ + + + + + Microsoft.Dtc.PowerShell.Diagnostics.DtcDiagnosticTransaction + + + PsStandardMembers + + + DefaultDisplayProperty + Id + + + DefaultDisplayPropertySet + + Id + + + + DefaultKeyPropertySet + + Id + + + + + + + + Microsoft.Dtc.PowerShell.Diagnostics.DtcDiagnosticResourceManagerJob + + + PsStandardMembers + + + DefaultDisplayProperty + Name + + + DefaultDisplayPropertySet + + Name + InstanceId + + + + DefaultKeyPropertySet + + Name + InstanceId + State + Location + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/MsDtc/MsDtc.psd1 b/newton-cn/bin/v1.0/Modules/MsDtc/MsDtc.psd1 new file mode 100644 index 0000000..4459632 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/MsDtc/MsDtc.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/MsDtc/TestDtc.psm1 b/newton-cn/bin/v1.0/Modules/MsDtc/TestDtc.psm1 new file mode 100644 index 0000000..066b3d7 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/MsDtc/TestDtc.psm1 @@ -0,0 +1,752 @@ +Import-Module netsecurity + +$Strings = DATA { + @{ + FirewallRuleEnabled = "{0}: Firewall rule for {1} is enabled." + FirewallRuleDisabled = "{0}: Firewall rule for {1} is disabled. This computer cannot participate in network transactions." + CmdletFailed = "The {0} cmdlet failed. Please make sure the {1} module is installed." + InvalidLocalComputer = "{0} is not a valid local computer name." + RPCEndpointMapper = "RPC Endpoint Mapper" + DtcIncomingConnection = "DTC incoming connections" + DtcOutgoingConnection = "DTC outgoing connections" + MatchingDtcNotFound = "A DTC instance with VirtualServerName {0} does not exist." + InboundDisabled = "{0}: Inbound transactions are not allowed and this computer cannot participate in network transactions." + OutboundDisabled = "{0}: Outbound transactions are not allowed and this computer cannot participate in network transactions." + OSVersion = "{0} Operating System Version: {1}." + OSQueryFailed = "Failed to query operating system of {0}." + VersionNotSupported = "Testing DTC on Windows versions below {0} is not supported with this cmdlet." + FailedToCreateCimSession = "Failed to create a CIM Session to {0}." + NotARemoteComputer = "{0} is not a remote computer." + PingingSucceeded = "Pinging computer {0} from {1} succeeded. " + PingingFailed = "Pinging computer {0} from {1} failed." + SameCids = "The {0} CID on {1} and {2} is the same. The CID should be unique to each computer." + DiagnosticTestPrompt = "This diagnostic test will attempt to carry out a transaction propagation between {0} and {1}. It requires that a TCP port is opened on {0} so that a Test Resource Manager can participate in network transactions." + DefaultPortDescription = "The default port is {0} and you can change it using the 'ResourceManagerPort' parameter and rerunning the test. " + PortDescription = "You have specified {0} as the 'ResourceManagerPort'." + FirewallRequest = "Please open port {0} in the firewall to proceed with the test." + QueryText = "Do you want to proceed with the test?" + InvalidDefaultCluster = "{0} is not the Virtual Server Name of the default DTC configured on this computer. You can use 'Set-DtcClusterDefault' cmdlet configure the default DTC on this computer." + InvalidDefault = "{0} is not the Virtual Server Name of the default DTC configured on this computer. You can use 'Set-DtcDefault' cmdlet to configure the default DTC on this computer." + NeedDtcSecurityFix = "DTC security settings and firewall settings should be fixed in order to complete the transactions propagation test." + StartResourceManagerFailed = "Test resource manager creation failed." + ResourceManagerStarted = "Test resource manager started." + PSSessionCreated = "A new PSSession to {0} created." + TransactionPropagated = "Transaction propagated from {0} to {1} using {2} propagation." + TransactionPropagationFailed = "Transaction propagation {0} to {1} failed using {2} propagation." + TestRMVerboseLog = "Test Resource Manager Verbose Log:" + TestRMWarningLog = "Test Resource Manager Warning Log:" + InvalidParameters = "At least one of LocalComputerName or RemoteComputerName parameters should be specified." + } +} + + +function IsLocalComputer +{ + param( + $computerName = $null + ) + PROCESS + { + $found = $false + $dtcs = Get-Dtc + if ($dtcs -eq $null) + { + throw + } + else + { + if ($dtcs.GetType().IsArray) + { + foreach ($dtc in $dtcs) + { + if ([string]::Compare($dtc.VirtualServerName, $computerName, $true) -eq 0) + { + $found = $true + break + } + } + } + else + { + if ([string]::Compare($dtcs.VirtualServerName, $computerName, $true) -eq 0) + { + $found = $true + } + } + } + return $found + } +} + +function CheckFirewallRule +{ + param( + $computerName = $null, + $ruleId = $null, + $ruleDesription = $null + ) + PROCESS + { + $success = $false + $errorVariable = $null + if ($computerName -eq $null) + { + $rule = Get-NetFirewallRule -ID $ruleId -ErrorVariable errorVariable + } + else + { + $rule = Get-NetFirewallRule -ID $ruleId -CimSession $computerName -ErrorVariable errorVariable + } + + if ($rule -eq $null) + { + if ($errorVariable -ne $null) + { + throw $errorVariable + } + else + { + throw ([string]::Format($Strings.CmdletFailed, "Get-NetFirewallRule", "networksecurity")) + } + + } + else + { + if ($rule.Enabled -eq 1) + { + Write-Verbose ([string]::Format($Strings.FirewallRuleEnabled, $computerName, $ruleDesription)) + $success = $true + } + else + { + Write-Warning ([string]::Format($Strings.FirewallRuleDisabled, $computerName, $ruleDesription)) + } + } + return $success + } +} + +function CheckFirewallRules +{ + param( + $ComputerName = $null + ) + $rpcEPRuleId = "MSDTC-RPCSS-In-TCP" + $dtcOutRule = "MSDTC-Out-TCP" + $dtcInRule = "MSDTC-In-TCP" + + $rpcOutcss = CheckFirewallRule $ComputerName $rpcEPRuleId $Strings.RPCEndpointMapper + $dtcIn = CheckFirewallRule $ComputerName $dtcInRule $Strings.DtcIncomingConnection + $dtcOut = CheckFirewallRule $ComputerName $dtcOutRule $Strings.DtcOutgoingConnection + + return ($rpcOutcss -and $dtcOutRule -and $dtcInRule) +} + +function FindDtc +{ + param( + $ComputerName = $null, + $CimSession = $null + ) + + $matchedDtc = $null + $errorVariable = $null + if ($cimsession -eq $null) + { + $dtcs = Get-Dtc -ErrorVariable $errorVariable + } + else + { + $dtcs = Get-Dtc -CimSession $CimSession -ErrorVariable errorVariable + } + + if ($dtcs -eq $null) + { + if ($errorVariable -ne $null) + { + throw $errorVariable + } + else + { + throw ([string]::Format($Strings.CmdletFailed, "Get-Dtc", "MSDTC")) + } + } + else + { + if ($dtcs.GetType().IsArray -eq $true) + { + foreach ($dtc in $dtcs) + { + if ($dtc.VirtualServerName -eq $computerName) + { + $matchedDtc = $dtc + break + } + } + } + else + { + $matchedDtc = $dtcs + } + } + + if ($matchedDtc -eq $null) + { + throw ([string]::Format($Strings.MatchingDtcNotFound, $computerName)) + } + + return $matchedDtc +} + +function CheckDtcSecurity +{ + param( + $DtcNetworkSetting = $null, + $ComputerName = $nul + ) + PROCESS + { + Write-Verbose ([string]::Format("{0}: AuthenticationLevel: {1}", $ComputerName, $DtcNetworkSetting.AuthenticationLevel)) + Write-Verbose ([string]::Format("{0}: InboundTransactionsEnabled: {1}", $ComputerName, $DtcNetworkSetting.InboundTransactionsEnabled)) + if ($DtcNetworkSetting.InboundTransactionsEnabled -eq $false) + { + Write-Warning ([string]::Format($Strings.InboundDisabled, $ComputerName)) + } + + Write-Verbose ([string]::Format("{0}: OutboundTransactionsEnabled: {1}", $ComputerName, $DtcNetworkSetting.OutboundTransactionsEnabled)) + if ($DtcNetworkSetting.OutboundTransactionsEnabled -eq $false) + { + Write-Warning ([string]::Format($Strings.OutboundDisabled, $ComputerName)) + } + + Write-Verbose ([string]::Format("{0}: RemoteClientAccessEnabled: {1}", $ComputerName, $DtcNetworkSetting.RemoteClientAccessEnabled)) + Write-Verbose ([string]::Format("{0}: RemoteAdministrationAccessEnabled: {1}", $ComputerName, $DtcNetworkSetting.RemoteAdministrationAccessEnabled)) + Write-Verbose ([string]::Format("{0}: XATransactionsEnabled: {1}", $ComputerName, $DtcNetworkSetting.XATransactionsEnabled)) + Write-Verbose ([string]::Format("{0}: LUTransactionsEnabled: {1}", $ComputerName, $DtcNetworkSetting.LUTransactionsEnabled)) + + return $DtcNetworkSetting.InboundTransactionsEnabled -and $DtcNetworkSetting.OutboundTransactionsEnabled + } +} + + +function DoPingTest +{ + param( + $ToComputerName = $null, + $FromComputerName = $null + ) + + + $filter = "Address='$ToComputerName'" + $pingingResult = Get-WmiObject -Class Win32_PingStatus -Filter $filter -ComputerName $FromComputerName + + if ($pingingResult.StatusCode -eq 0) + { + Write-Verbose ([string]::Format($Strings.PingingSucceeded, $ToComputerName, $FromComputerName)) + return $true; + } + else + { + Write-Warning ([string]::Format($Strings.PingingFailed, $ToComputerName, $FromComputerName)) + return $false; + } +} + +function CompareCids +{ + param( + $LocalDtc = $null, + $RemoteDtc = $null + ) + + Write-Verbose ([string]::Format("{0}: OleTx: {1}", $LocalDtc.VirtualServerName, $LocalDtc.OleTxEndpointCid)) + Write-Verbose ([string]::Format("{0}: OleTx: {1}", $RemoteDtc.VirtualServerName, $RemoteDtc.OleTxEndpointCid)) + if ([string]::Compare($LocalDtc.OleTxEndpointCid, $RemoteDtc.OleTxEndpointCid, $true) -eq 0) + { + throw ([string]::Format($Strings.SameCids, "OleTx", $LocalDtc.VirtualServerName, $RemoteDtc.VirtualServerName)) + } + Write-Verbose ([string]::Format("{0}: XA: {1}", $LocalDtc.VirtualServerName, $LocalDtc.XAEndpointCid)) + Write-Verbose ([string]::Format("{0}: XA: {1}", $RemoteDtc.VirtualServerName, $RemoteDtc.XAEndpointCid)) + if ([string]::Compare($LocalDtc.XAEndpointCid, $RemoteDtc.XAEndpointCid, $true) -eq 0) + { + throw ([string]::Format($Strings.SameCids, "XA", $LocalDtc.VirtualServerName, $RemoteDtc.VirtualServerName)) + } + Write-Verbose ([string]::Format("{0}: UIS: {1}", $LocalDtc.VirtualServerName, $LocalDtc.UisEndpointCid)) + Write-Verbose ([string]::Format("{0}: UIS: {1}", $RemoteDtc.VirtualServerName, $RemoteDtc.UisEndpointCid)) + if ([string]::Compare($LocalDtc.UisEndpointCid, $RemoteDtc.UisEndpointCid, $true) -eq 0) + { + throw ([string]::Format($Strings.SameCids, "UIS", $LocalDtc.VirtualServerName, $RemoteDtc.VirtualServerName)) + } +} + +function CheckIfDefaultDtcConfigured +{ + param( + $ComputerName = $null, + $Cimsession = $null + ) + + $errorVariable = $null + $cluster = $false + if ($Cimsession -eq $null) + { + $dtcs = Get-Dtc -ErrorVariable errorVariable + } + else + { + $dtcs = Get-Dtc -ErrorVariable errorVariable -CimSession $Cimsession + } + + if ($dtcs -eq $null) + { + if ($errorvariable -ne $null) + { + throw $errorVariable + } + else + { + throw ([string]::Format($Strings.CmdletFailed, "Get-Dtc","MSDTC")) + } + } + $errorVariable = $null + if ($dtcs.GetType().IsArray) + { + $cluster = $true + if ($Cimsession -eq $null) + { + $defaultDtc = Get-DtcClusterDefault -ErrorVariable errorVariable + } + else + { + $defaultDtcResource = Get-DtcClusterDefault -ErrorVariable errorVariable -CimSession $Cimsession + } + + foreach ($dtc in $dtcs) + { + if ([string]::Compare($dtc.DtcName, $defaultDtcResource, $true) -eq 0) + { + $defaultDtc = $dtc.VirtualServerName + } + } + + } + elseif ([string]::Compare($dtcs.DtcName, "Local", $true) -ne 0) + { + $cluster = $true + #there is only one dtc instance and it is clustered + $defaultDtc = $dtc.VirtualServerName + } + else + { + + if ($Cimsession -eq $null) + { + $defaultDtc = Get-DtcDefault -ErrorVariable errorVariable + } + else + { + $defaultDtc = Get-DtcDefault -ErrorVariable errorVariable -CimSession $Cimsession + } + + } + + if ($defaultDtc -eq $null) + { + if ($errorvariable -ne $null) + { + throw $errorVariable + } + else + { + if ($cluster -eq $true) + { + throw ([string]::Format($Strings.CmdletFailed, "Get-DtcClusterDefault", "MSDTC")) + } + else + { + throw ([string]::Format($Strings.CmdletFailed, "Get-DtcDefault", "MSDTC")) + } + } + } + else + { + if ([string]::Compare($defaultDtc, $ComputerName, $true) -ne 0) + { + if ($cluster -eq $true) + { + throw ([string]::Format($Strings.InvalidDefaultCluster, $ComputerName)) + } + else + { + throw ([string]::Format($Strings.InvalidDefault, $ComputerName)) + } + } + } +} + +function DoPingTest +{ + param( + $ToComputerName = $null, + $FromComputerName = $null + ) + + $filter = "Address='$ToComputerName'" + $pingingResult = Get-WmiObject -Class Win32_PingStatus -Filter $filter -ComputerName $FromComputerName + + if ($pingingResult.StatusCode -eq 0) + { + Write-Verbose ([string]::Format($Strings.PingingSucceeded, $ToComputerName, $FromComputerName)) + return $true; + } + else + { + Write-Warning ([string]::Format($Strings.PingingFailed, $ToComputerName, $FromComputerName)) + return $false; + } +} + +function IsVersionSupported +{ + param( + $ComputerName = $null + ) + + $minSupportedVersion = New-Object -TypeName System.Version -ArgumentList "6.2" + $errorVariable = $null + $operatngSystem = Get-WmiObject -ComputerName $ComputerName -Class WIn32_OperatingSystem -ErrorVariable errorVariable + if ($operatngSystem -eq $null) + { + if ($errorVariable -ne $null) + { + throw $errorVariable + } + else + { + throw ([string]::Format($Strings.OSQueryFailed, $ComputerName)) + } + } + else + { + $version = New-Object -TypeName System.Version -ArgumentList $operatngSystem.Version + Write-Verbose ([string]::Format($Strings.OSVersion, $ComputerName, $version)) + if ($version -ge $minSupportedVersion) + { + return $true; + } + else + { + return $false; + } + } +} + +function TestLocalComputer +{ + param( + $ComputerName = $null + ) + PROCESS + { + $errorVariable = $null + $firewallOK = CheckFirewallRules $null + $dtc = FindDtc $ComputerName $null + $networkSetting = Get-DtcNetworkSetting -DtcName $dtc.DtcName -ErrorVariable errorVariable + if ($networkSetting -eq $null) + { + if ($errorVariable -ne $null) + { + throw $errorVariable + } + else + { + throw ([string]::Format($Strings.CmdletFailed, "Get-DtcNetworkSetting", "MSDTC")) + } + } + $networkOk = CheckDtcSecurity $networkSetting $ComputerName + return $networkOk -and $firewallOK + } +} + +function TestRemoteComputer +{ + param( + $ComputerName = $null, + $CimSession = $null + ) + PROCESS + { + if ((IsVersionSupported $ComputerName) -eq $false) + { + throw ([string]::Format($Strings.VersionNotSupported, "6.2")) + } + + $firewallOK = CheckFirewallRules $ComputerName + $dtc = FindDtc $ComputerName $CimSession + $networkSetting = Get-DtcNetworkSetting -DtcName $dtc.DtcName -CimSession $CimSession -ErrorVariable errorVariable + if ($networkSetting -eq $null) + { + if ($errorVariable -ne $null) + { + throw $errorVariable + } + else + { + throw ([string]::Format($Strings.CmdletFailed, "Get-DtcNetworkSetting", "MSDTC")) + } + } + + $networkOk = CheckDtcSecurity $networkSetting $ComputerName + return $networkOk -and $firewallOK + + } +} + +function TestTransactionsPropagation +{ + param( + $LocalComputerName = $null, + $RemoteComputerName = $null, + $ResourceManagerPort = $null + ) + + $rm = $null; + $pssession = $null; + try + { + $errorVariable + $rm = Start-DtcDiagnosticResourceManager -Port $ResourceManagerPort -ErrorVariable errorVariable + if ($rm -eq $null) + { + if ($errorVariable -ne $null) + { + throw $errorVariable + } + else + { + throw ([string]::Format($Strings.StartResourceManagerFailed)) + } + } + + Write-Verbose $Strings.ResourceManagerStarted + + $pssession = New-PSSession -ComputerName $RemoteComputerName + Write-Verbose ([string]::Format($Strings.PSSessionCreated, $RemoteComputerName)) + + + Invoke-Command -Session $pssession -ScriptBlock {Import-Module msdtc} -ErrorVariable errorVariable + if ($errorVariable -ne $null) + { + throw $errorVariable + } + + $errorVariable = $null + $tx = Invoke-Command -Session $pssession -ScriptBlock {Receive-DtcDiagnosticTransaction -ComputerName $args[0] -Port $args[1] -PropagationMethod Pull} -args $LocalComputerName,$ResourceManagerPort -ErrorVariable errorVariable + + if ($tx -eq $null) + { + if ($errorVariable -ne $null) + { + throw $errorVariable + } + else + { + throw ([string]::Format($Strings.TransactionPropagationFailed, $LocalComputerName, $RemoteComputerName, "PULL")) + } + } + + Write-Verbose ([string]::Format($Strings.TransactionPropagated, $LocalComputerName, $RemoteComputerName, "PULL")) + + $tx = $null + $tx=Invoke-Command -Session $pssession -ScriptBlock {Receive-DtcDiagnosticTransaction -ComputerName $args[0] -Port $args[1] -PropagationMethod Push} -args $LocalComputerName,$ResourceManagerPort -ErrorVariable errorVariable + if ($tx -eq $null) + { + if ($errorVariable -ne $null) + { + throw $errorVariable + } + else + { + throw ([string]::Format($Strings.TransactionPropagationFailed, $LocalComputerName, $RemoteComputerName, "PUSH")) + } + } + + Write-Verbose ([string]::Format($Strings.TransactionPropagated, $LocalComputerName, $RemoteComputerName, "PUSH")) + } + finally + { + if ($rm -ne $null) + { + Write-Verbose $Strings.TestRMVerboseLog + foreach ( $verbose in $rm.Verbose) + { + Write-Verbose $verbose + } + + if ($rm.Warning -ne $null) + { + Write-Warning $Strings.TestRMWarningLog + foreach ( $warning in $rm.Warning) + { + Write-Warning $warning + } + } + Stop-DtcDiagnosticResourceManager -Job $rm + } + + if ($pssession -ne $null) + { + Remove-PSSession $pssession + } + } +} + +# .Link +# http://go.microsoft.com/fwlink/?LinkID=253754 +# .ExternalHelp TestDtc.psm1-help.xml +function Test-Dtc { + [CmdletBinding( + SupportsShouldProcess=$true, + ConfirmImpact="Low" + )] + [cmdletbinding(PositionalBinding=$false)] + + param( + [ValidateNotNullOrEmpty()] + [string] + $LocalComputerName = $null, + + [ValidateNotNullOrEmpty()] + [string] + $RemoteComputerName = $null, + + [ValidateNotNullOrEmpty()] + [int] + [ValidateRange(0, 65535)] + $ResourceManagerPort = $null + ) + BEGIN { + } + PROCESS { + Import-LocalizedData -bindingVariable Strings -ErrorAction SilentlyContinue + + if ([string]::IsNullOrEmpty($LocalComputerName)) + { + if ([string]::IsNullOrEmpty($RemoteComputerName)) + { + throw $Strings.InvalidParameters + } + else + { + if (IsLocalComputer $RemoteComputerName) + { + throw ([string]::Format($Strings.NotARemoteComputer, $RemoteComputerName)) + } + + $errorvariabe = $null + $cimSession = New-CimSession -ComputerName $RemoteComputerName + if ($cimSession -eq $null) + { + throw ([string]::Format($Strings.FailedToCreateCimSession, $ComputerName)) + } + try + { + $remoteTest = TestRemoteComputer $RemoteComputerName $cimSession + } + finally + { + Remove-CimSession -CimSession $cimSession + } + } + } + else + { + if ([string]::IsNullOrEmpty($RemoteComputerName)) + { + if (IsLocalComputer $LocalComputerName) + { + $localTest = TestLocalComputer $LocalComputerName + } + else + { + throw ([string]::Format($Strings.InvalidLocalComputer, $LocalComputerName)) + } + } + else + { + if ((IsLocalComputer $LocalComputerName) -eq $false) + { + throw ([string]::Format($Strings.InvalidLocalComputer, $LocalComputerName)) + } + + $DefaultResourceManagerPort = 3002 + $remoteComputerTestable = $false + $localToRemotePinging = $false + $remoteToLocalPinging = $false + $localComputerTestable = $false + $port = $DefaultResourceManagerPort + + $localComputerTestable = TestLocalComputer $LocalComputerName + + if (IsLocalComputer $RemoteComputerName) + { + throw ([string]::Format($Strings.NotARemoteComputer, $RemoteComputerName)) + } + + $errorvariabe = $null + $cimSession = New-CimSession -ComputerName $RemoteComputerName + if ($cimSession -eq $null) + { + throw ([string]::Format($Strings.FailedToCreateCimSession, $RemoteComputerName)) + } + + try + { + $remoteComputerTestable = TestRemoteComputer $RemoteComputerName $cimSession + + $localToRemotePinging = DoPingTest $LocalComputerName $RemoteComputerName + $remoteToLocalPinging = DoPingTest $RemoteComputerName $LocalComputerName + $localDtc = FindDtc $LocalComputerName $null + $remoteDtc = FindDtc $RemoteComputerName $cimSession + CompareCids $localDtc $remoteDtc + + if (($localComputerTestable -and $remoteComputerTestable -and $localToRemotePinging -and $remoteToLocalPinging) -eq $false) + { + throw $Strings.NeedDtcSecurityFix + } + + $diagnosticTestPrompt = ([string]::Format($Strings.DiagnosticTestPrompt, $LocalComputerName, $RemoteComputerName)) + $portDescription = $null + if ($ResourceManagerPort -eq $null) + { + $portDescription = ([string]::Format($Strings.DefaultPortDescription, $port)) + } + else + { + $port = $ResourceManagerPort + $portDescription = ([string]::Format($Strings.PortDescription, $port)) + } + + $firewallRequest = ([string]::Format($Strings.FirewallRequest, $port)) + $completePrompt = ([string]::Format("{0} {1} {2}", $diagnosticTestPrompt, $portDescription, $firewallRequest)) + + if ($pscmdlet.ShouldProcess($completePrompt, $Strings.QueryText, $completePrompt)) + { + CheckIfDefaultDtcConfigured $LocalComputerName $null + CheckIfDefaultDtcConfigured $RemoteComputerName $cimSession + TestTransactionsPropagation $LocalComputerName $RemoteComputerName $port + } + + + } + finally + { + Remove-CimSession -CimSession $cimSession + } + + } + } + } + END { + } +} \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/MsDtc/ko-KR/TestDtc.psd1 b/newton-cn/bin/v1.0/Modules/MsDtc/ko-KR/TestDtc.psd1 new file mode 100644 index 0000000..a6bc527 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/MsDtc/ko-KR/TestDtc.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/MsDtc/ko/Microsoft.Dtc.PowerShell.Resources.dll b/newton-cn/bin/v1.0/Modules/MsDtc/ko/Microsoft.Dtc.PowerShell.Resources.dll new file mode 100644 index 0000000..26e5061 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/MsDtc/ko/Microsoft.Dtc.PowerShell.Resources.dll differ diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapter.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapter.Format.ps1xml new file mode 100644 index 0000000..9b080da --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapter.Format.ps1xml @@ -0,0 +1,299 @@ + + + + + + Default + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter + + + + + + 25 + + + + 39 + + + + 7 + Left + + + + 12 + + + + 17 + + + + 14 + + + + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterName $_.Name 25 + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterInstanceID $_.InterfaceDescription 39 + + + + InterfaceIndex + Right + + + Status + + + MacAddress + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-LinkSpeed $_.TransmitLinkSpeed + + Right + + + + + + + + MSFT_NetAdapter_Listview + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter + + + + + + + + Name + + + + InterfaceDescription + + + + InterfaceIndex + + + + MacAddress + + + + MediaType + + + + PhysicalMediaType + + + + ifOperStatus + + + + AdminStatus + + + + + $_.TransmitLinkSpeed -lt 1000000000 + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + $val = $_.TransmitLinkSpeed / 1000000 + Format-LinkSpeed $val 1 $false + + + + + $_.TransmitLinkSpeed -ge 1000000000 + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + $val = $_.TransmitLinkSpeed / 1000000000 + Format-LinkSpeed $val 1 $false + + + + + MediaConnectionState + + + + ConnectorPresent + + + + $_.VlanID -ne $null + + VlanID + + + + DriverInformation + + + + + + + + Names + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter + + + + + + 25 + + + + 35 + + + + 7 + + + + 15 + + + + 33 + + + + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterName $_.Name 25 + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterInstanceID $_.InterfaceDescription 35 + + + + ifIndex + {0,7} + + + NetLuid + 0x{0:X} + + + DeviceID + + + + + + + + Driver + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter + + + + + + 25 + + + + 40 + + + + 15 + + + + 10 + + + + 13 + + + + 11 + + + + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterName $_.Name 25 + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterInstanceID $_.InterfaceDescription 40 + + + + DriverFileName + + + DriverDate + + + DriverVersion + + + NdisVersion + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapter.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapter.cmdletDefinition.cdxml new file mode 100644 index 0000000..3847758 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapter.cmdletDefinition.cdxml @@ -0,0 +1,258 @@ + + + + 1.0 + NetAdapter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterAdvancedProperty.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterAdvancedProperty.Format.ps1xml new file mode 100644 index 0000000..6992ff3 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterAdvancedProperty.Format.ps1xml @@ -0,0 +1,230 @@ + + + + + + MSFT_NetAsapterAdvProperty_TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterAdvancedPropertySettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterAdvancedPropertySettingData + + + + + + 25 + + + + 30 + + + + 30 + + + + 15 + + + + 15 + + + + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterName $_.Name 25 + + + + + if ($_.DisplayName -ne $null) + { + $out = $_.DisplayName + } + else + { + $out = "--" + } + $out + + + + + + if ($_.DisplayValue -ne $null) + { + $out = $_.DisplayValue + } + else + { + $out = "--" + } + $out + + + + RegistryKeyword + + + + if (($_.RegistryValue) -and ($_.RegistryValue.length -ge 1)) + { + if ($_.RegistryValue.length -eq 1) + { + $out = "{$($_.RegistryValue[0])}" + } + else + { + $out = "{'"+($_.RegistryValue -join "', '")+"'}" + } + } + else + { + $out = "{--}" + } + $out; + + + + + + + + + Advanced + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterAdvancedPropertySettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterAdvancedPropertySettingData + + + + + + 25 + + + + 25 + + + + 20 + + + + 26 + + + + 20 + + + + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterName $_.Name 25 + + + + DisplayName + + + DisplayValue + + + + $out = if ($_.DisplayParameterType -eq 5) + { + $_.ValidDisplayValues + } + if (($_.DisplayParameterType -eq 1) -or + ($_.DisplayParameterType -eq 2) -or + ($_.DisplayParameterType -eq 3) -or + ($_.DisplayParameterType -eq 4)) + { + "Min $($_.NumericParameterMinValue), Max $($_.NumericParameterMaxValue), " + "Step $($_.NumericParameterStepValue)" + + } + if ($_.DisplayParameterType -eq 6) + { + "" + } + $out + + + + DefaultDisplayValue + + + + + + + + MSFT_NetAsapterAdvProperty_ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterAdvancedPropertySettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterAdvancedPropertySettingData + + + + + + + + Name + + + + InterfaceDescription + + + + DisplayName + + + + DisplayValue + + + + DefaultDisplayValue + + + + ValidDisplayValues + + + + RegistryKeyword + + + + RegistryValue + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterAdvancedProperty.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterAdvancedProperty.cmdletDefinition.cdxml new file mode 100644 index 0000000..c8b64d8 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterAdvancedProperty.cmdletDefinition.cdxml @@ -0,0 +1,287 @@ + + + + 1.0 + NetAdapterAdvancedProperty + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterBinding.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterBinding.Format.ps1xml new file mode 100644 index 0000000..6795664 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterBinding.Format.ps1xml @@ -0,0 +1,68 @@ + + + + + + MSFT_NetAsapterBinding_TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterBindingSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterBindingSettingData + + + + + + 30 + + + + 50 + + + + 20 + + + + 12 + + + + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterName $_.Name 25 + + + + DisplayName + + + ComponentID + + + + $out="" + $out = if($_.Enabled -eq $true) {"True"} else {"False"} + $out + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterBinding.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterBinding.cmdletDefinition.cdxml new file mode 100644 index 0000000..c898d58 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterBinding.cmdletDefinition.cdxml @@ -0,0 +1,197 @@ + + + + 1.0 + NetAdapterBinding + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterChecksumOffload.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterChecksumOffload.Format.ps1xml new file mode 100644 index 0000000..3e383f5 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterChecksumOffload.Format.ps1xml @@ -0,0 +1,177 @@ + + + + + + MSFT_NetAsapterChecksumOffload_TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterChecksumOffloadSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterChecksumOffloadSettingData + + + + + 30 + + + 15 + + + 15 + + + 15 + + + 15 + + + 15 + + + + + + + Name + + + IpIPv4Enabled + + + TcpIPv4Enabled + + + TcpIPv6Enabled + + + UdpIPv4Enabled + + + UdpIPv6Enabled + + + + + + + + MSFT_NetAsapterChecksumOffload_ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterChecksumOffloadSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterChecksumOffloadSettingData + + + + + + + Name + + + InterfaceDescription + + + IpIPv4Enabled + + + TcpIPv4Enabled + + + TcpIPv6Enabled + + + UdpIPv4Enabled + + + UdpIPv6Enabled + + + + $_.ChecksumOffloadHardwareCapabilities.IPv4TransmitIpOptionsSupported + + + + $_.ChecksumOffloadHardwareCapabilities.IPv4TransmitTcpOptionsSupported + + + + $_.ChecksumOffloadHardwareCapabilities.IPv4TransmitTcpChecksumSupported + + + + $_.ChecksumOffloadHardwareCapabilities.IPv4TransmitUdpChecksumSupported + + + + $_.ChecksumOffloadHardwareCapabilities.IPv4TransmitIpChecksumSupported + + + + $_.ChecksumOffloadHardwareCapabilities.IPv4ReceiveIpOptionsSupported + + + + $_.ChecksumOffloadHardwareCapabilities.IPv4ReceiveTcpOptionsSupported + + + + $_.ChecksumOffloadHardwareCapabilities.IPv4ReceiveTcpChecksumSupported + + + + $_.ChecksumOffloadHardwareCapabilities.IPv4ReceiveUdpChecksumSupported + + + + $_.ChecksumOffloadHardwareCapabilities.IPv4ReceiveIpChecksumSupported + + + + $_.ChecksumOffloadHardwareCapabilities.IPv6TransmitIpExtensionHeadersSupported + + + + $_.ChecksumOffloadHardwareCapabilities.IPv6TransmitTcpOptionsSupported + + + + $_.ChecksumOffloadHardwareCapabilities.IPv6TransmitTcpChecksumSupported + + + + $_.ChecksumOffloadHardwareCapabilities.IPv6TransmitUdpChecksumSupported + + + + $_.ChecksumOffloadHardwareCapabilities.IPv6ReceiveIpExtensionHeadersSupported + + + + $_.ChecksumOffloadHardwareCapabilities.IPv6ReceiveTcpOptionsSupported + + + + $_.ChecksumOffloadHardwareCapabilities.IPv6ReceiveTcpChecksumSupported + + + + $_.ChecksumOffloadHardwareCapabilities.IPv6ReceiveUdpChecksumSupported + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterChecksumOffload.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterChecksumOffload.cdxml new file mode 100644 index 0000000..5598506 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterChecksumOffload.cdxml @@ -0,0 +1,258 @@ + + + + 1.0 + NetAdapterChecksumOffload + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterEncapsulatedPacketTaskOffload.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterEncapsulatedPacketTaskOffload.Format.ps1xml new file mode 100644 index 0000000..3a96ad8 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterEncapsulatedPacketTaskOffload.Format.ps1xml @@ -0,0 +1,154 @@ + + + + + + MSFT_NetAsapterEncapsulatedPacketTaskOffload_TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData + + + + + 30 + + + + 20 + + + + 20 + + + + + + + Name + + + NvgreEncapsulatedPacketTaskOffloadEnabled + + + VxlanEncapsulatedPacketTaskOffloadEnabled + + + + + + + + MSFT_NetAsapterEncapsulatedPacketTaskOffload_ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData + + + + + + + Name + + + InterfaceDescription + + + + NvgreEncapsulatedPacketTaskOffloadEnabled + + + + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesNvgre.TransmitChecksumOffloadSupported + + + + + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesNvgre.ReceiveChecksumOffloadSupported + + + + + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesNvgre.LsoV2Supported + + + + + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesNvgre.RssSupported + + + + + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesNvgre.VmqSupported + + + + + VxlanEncapsulatedPacketTaskOffloadEnabled + + + + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesVxlan.TransmitChecksumOffloadSupported + + + + + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesVxlan.ReceiveChecksumOffloadSupported + + + + + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesVxlan.LsoV2Supported + + + + + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesVxlan.RssSupported + + + + + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterEncapsulatedPacketTaskOffload.OffloadType]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesVxlan.VmqSupported + + + + + + [System.Boolean]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesVxlan.IsVxlanUDPPortConfigurable + + + + + + [System.UInt16]$_.EncapsulatedPacketTaskOffloadHardwareCapabilitiesVxlan.VxlanUDPPortNumber + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterEncapsulatedPacketTaskOffload.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterEncapsulatedPacketTaskOffload.cdxml new file mode 100644 index 0000000..172f358 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterEncapsulatedPacketTaskOffload.cdxml @@ -0,0 +1,180 @@ + + + + 1.0 + NetAdapterEncapsulatedPacketTaskOffload + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterHardwareInfo.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterHardwareInfo.Format.ps1xml new file mode 100644 index 0000000..406127e --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterHardwareInfo.Format.ps1xml @@ -0,0 +1,209 @@ + + + + + + MSFT_NetAsapterHardwareInfo_TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterHardwareInfoSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterHardwareInfoSettingData + + + + + + 30 + + + + 7 + Left + + + + 3 + Left + + + + 6 + Left + + + + 8 + Left + + + + 4 + Left + + + + 8 + Left + + + + 13 + Left + + + + 13 + Left + + + + 7 + + + + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterName $_.Name 30 + + + + SegmentNumber + Right + + + BusNumber + Right + + + DeviceNumber + Right + + + FunctionNumber + Right + + + SlotNumber + Right + + + NumaNode + Right + + + PcieLinkSpeed + Right + + + PciExpressCurrentLinkWidth + Right + + + Version + + + + + + + + MSFT_NetAsapterHardwareInfo_ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterHardwareInfoSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterHardwareInfoSettingData + + + + + + + + Name + + + + InterfaceDescription + + + + DeviceType + + + + SegmentNumber + + + + BusNumber + + + + DeviceNumber + + + + FunctionNumber + + + + SlotNumber + + + + NumaNode + + + + PciCurrentSpeedAndMode + + + + PcieLinkSpeed + + + + PciExpressCurrentLinkWidth + + + + PcieMaxLinkSpeed + + + + PciExpressMaxLinkWidth + + + + Version + + + + LineBasedInterruptSupported + + + + MsiInterruptSupported + + + + MsiXInterruptSupported + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterHardwareInfo.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterHardwareInfo.cmdletDefinition.cdxml new file mode 100644 index 0000000..f6c02c6 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterHardwareInfo.cmdletDefinition.cdxml @@ -0,0 +1,30 @@ + + + + 1.0 + NetAdapterHardwareInfo + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterIPsecOffload.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterIPsecOffload.Format.ps1xml new file mode 100644 index 0000000..df0e930 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterIPsecOffload.Format.ps1xml @@ -0,0 +1,156 @@ + + + + + + MSFT_NetAdapterIPsecOffload_TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterIPsecOffloadV2SettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterIPsecOffloadV2SettingData + + + + + 30 + + + 15 + + + 25 + + + + + + + Name + + + Enabled + + + SaOffloadCapacityEnabled + + + + + + + + MSFT_NetAdapterIPsecOffload_ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterIPsecOffloadV2SettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterIPsecOffloadV2SettingData + + + + + + + Name + + + InterfaceDescription + + + Source + + + AhEnabled + + + AhEspCombinedEnabled + + + AhEspCombinedSupported + + + AhSupported + + + AuthenticationAlgorithmsEnabled + + + AuthenticationAlgorithmsSupported + + + Enabled + + + EncryptionAlgorithmsEnabled + + + EncryptionAlgorithmsSupported + + + EspEnabled + + + EspSupported + + + IPv4OptionsEnabled + + + IPv4OptionsSupported + + + IPv6Enabled + + + IPv6NonIPsecExtensionHeadersEnabled + + + IPv6NonIPsecExtensionHeadersSupported + + + IPv6Supported + + + LsoEnabled + + + LsoSupported + + + SaOffloadCapacityEnabled + + + SaOffloadCapacitySupported + + + TransportEnabled + + + TransportSupported + + + TunnelEnabled + + + TunnelSupported + + + UdpEspEnabled + + + UdpEspSupported + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterIPsecOffload.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterIPsecOffload.cdxml new file mode 100644 index 0000000..49cea8b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterIPsecOffload.cdxml @@ -0,0 +1,196 @@ + + + + 1.0 + NetAdapterIPsecOffload + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterLso.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterLso.Format.ps1xml new file mode 100644 index 0000000..ff2af1c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterLso.Format.ps1xml @@ -0,0 +1,146 @@ + + + + + + MSFT_NetAsapterLso_TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterLsoSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterLsoSettingData + + + + + 30 + + + + 15 + + + 14 + + + 12 + + + 12 + + + + + + + Name + + + + $out="" + if ($_.MaximumLsoVersionSupported -ge 2) {$out+="LSO Version 2"} else { if ($_.MaximumLsoVersionSupported -eq 1) {$out+="LSO Version 1"} else {$out+="None"} } + $out + + + + V1IPv4Enabled + + + IPv4Enabled + + + IPv6Enabled + + + + + + + + MSFT_NetAsapterLso_ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterLsoSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterLsoSettingData + + + + + + + Name + + + InterfaceDescription + + + + + $out="" + if ($_.MaximumLsoVersionSupported -ge 2) {$out+="LSO Version 2"} else { if ($_.MaximumLsoVersionSupported -eq 1) {$out+="LSO Version 1"} else {$out+="None"} } + $out + + + + V1IPv4Enabled + + + IPv4Enabled + + + IPv6Enabled + + + + $_.LargeSendOffloadV1HardwareCapabilities.IPv4MaxOffloadSizeSupported + + + + $_.LargeSendOffloadV1HardwareCapabilities.IPv4MinSegmentCountSupported + + + + $_.LargeSendOffloadV1HardwareCapabilities.IPv4TcpOptionsSupported + + + + $_.LargeSendOffloadV1HardwareCapabilities.IPv4IpOptionsSupported + + + + $_.LargeSendOffloadV2HardwareCapabilities.IPv4MaxOffloadSizeSupported + + + + $_.LargeSendOffloadV2HardwareCapabilities.IPv4MinSegmentCountSupported + + + + $_.LargeSendOffloadV2HardwareCapabilities.IPv6MaxOffLoadSizeSupported + + + + $_.LargeSendOffloadV2HardwareCapabilities.IPv6MinSegmentCountSupported + + + + $_.LargeSendOffloadV2HardwareCapabilities.IPv6IpExtensionHeadersSupported + + + + $_.LargeSendOffloadV2HardwareCapabilities.IPv6TcpOptionsSupported + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterLso.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterLso.cdxml new file mode 100644 index 0000000..9011f42 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterLso.cdxml @@ -0,0 +1,191 @@ + + + + 1.0 + NetAdapterLso + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterPacketDirect.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterPacketDirect.Format.ps1xml new file mode 100644 index 0000000..21037f8 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterPacketDirect.Format.ps1xml @@ -0,0 +1,188 @@ + + + + + + + MSFT_NetAdapterPacketDirectSettingData_TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT\StandardCimv2\MSFT_NetAdapterPacketDirectSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPacketDirectSettingData + + + + + + 12 + + + + 20 + + + + 8 + + + + 12 + + + + 10 + + + + 15 + + + + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterName $_.Name 12 + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterInstanceID $_.InterfaceDescription 20 + + + + Enabled + + + Operational + + + DomainId + + + + [Convert]::ToString($_.DiagnosticCode, 16) + + + + + + + + + + MSFT_NetAdapterPacketDirectSettingData_ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPacketDirectSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPacketDirectSettingData + + + + + + + Name + + + Enabled + + + Operational + + + DomainId + + + + + [Convert]::ToString($_.DiagnosticCode, 16) + + + + + + ($_.Capabilities|fl|out-string).Trim() + + + + + + + + + + MSFT_NetAdapter_PacketDirectCapabilities + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter_PacketDirectCapabilities + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter_PacketDirectCapabilities + + + + + + + DrainNotificationSupported + + + ModerationByIntervalSupported + + + ModerationByCountSupported + + + MinimumModerationInterval + + + MaximumModerationInterval + + + ModerationIntervalGranularity + + + MaximumTxPartialBufferCount + + + MaximumRxPartialBufferCount + + + MaximumNumberOfRxQueues + + + MaximumNumberOfTxQueues + + + MaximumNumberOfRxQueuesForDefaultVPort + + + MaximumNumberOfTxQueuesForDefaultVPort + + + MaximumNumberOfRxQueuesPerNonDefaultVPort + + + MaximumNumberOfTxQueuesPerNonDefaultVPort + + + MaximumRxQueueSize + + + MaximumTxQueueSize + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterPacketDirect.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterPacketDirect.cdxml new file mode 100644 index 0000000..6cee482 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterPacketDirect.cdxml @@ -0,0 +1,161 @@ + + + + 1.0 + NetAdapterPacketDirect + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterPowerManagement.Format.Helper.psm1 b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterPowerManagement.Format.Helper.psm1 new file mode 100644 index 0000000..1d281ce --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterPowerManagement.Format.Helper.psm1 @@ -0,0 +1,166 @@ +<# + +Copyright (c) 2011 Microsoft Corporation. All Rights Reserved. + +Module Name: + + MSFT_NetAdapterPowerManagement.Format.Helper.psm1 + +Description: + + Provides helper routines for formatting the output of + NetAdapterPowerManagement CmdLets. + +#> + +function Format-NdisConfigurationValue() + +<# + +Function Description: + + Converts an enumerated configuration value into human readable text. + +Arguments: + + $ConfigurationValue - Supplies the configuration value to format. + +Return Value: + + Returns a string corresponding to the integer configuration value. + +#> + +{ + param ($ConfigurationValue) + + switch ($ConfigurationValue) + { + 0 { $temp = "Unsupported" } + 1 { $temp = "Disabled" } + 2 { $temp = "Enabled" } + 3 { $temp = "Inactive" } + default { $temp = "Invalid ($($ConfigurationValue))" } + } + + return $temp +} + +function Format-WakePatternType() + +<# + +Function Description: + + Converts a wake pattern type into a friendly name. + +Arguments: + + $WakePatternType - Supplies an NDIS_PM_WOL_PACKET enumeration value. + +Return Value: + + Returns a friendly string representation of the wake pattern type. + +#> + +{ + param ($WakePatternType) + + switch ($WakePatternType) + { + 1 { $temp = "Bitmap Pattern" } + 2 { $temp = "Magic Packet" } + 3 { $temp = "IPv4 TCP SYN" } + 4 { $temp = "IPv6 TCP SYN" } + 5 { $temp = "EAPOL Request Id Message" } + 6 { $temp = "Wildcard" } + 7 { $temp = "WFD Invitation Request" } + default { $temp = "Invalid ($($ConfigurationValue))" } + } + + return $temp +} + +function Format-BitmapWakePattern() + +<# + +Function Description: + + Converts a Pattern and Mask array to a string. + +Arguments: + + $Pattern - Supplies an array of bytes defining a pattern match. + + $Mask - Supplies an array of bytes masking the pattern. The nth bit of the + $Mask array indicates whether the nth byte in the Pattern should be + matched (1) or ignored (0). + +Return Value: + + Returns a string containing the bytes of the pattern match. Bytes that are + ignored are represented by "--". + +#> + +{ + param( + [byte[]] ${Pattern}, + [byte[]] ${Mask} + ) + + $Width = 16 + $out = "" + + $PatternLength = $Pattern.Length + $Bit = 1 + $MaskIndex = 0 + for ($i = 0; $i -lt $PatternLength; $i++) + { + # + # Print offset at the beginning of each line + # + + if (($i % $Width) -eq 0) + { + $out += "{0:x2} : " -f $i + } + + # + # Check whether the pattern byte is masked + # + + if ($Mask[$MaskIndex] -band $Bit) + { + $out += "{0:x2} " -f $Pattern[$i] + } + else + { + $out += "-- " -f $Pattern[$i] + } + + # + # Newline if this is the last element on the line. + # + + if (($i % $Width) -eq ($Width - 1)) + { + $out += "`n" + } + + # + # Walk through the mask bits. + # + + $Bit = $Bit * 2 + if ($Bit -gt 128) + { + $MaskIndex++ + $Bit = 1 + } + } + + $out +} diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterPowerManagement.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterPowerManagement.Format.ps1xml new file mode 100644 index 0000000..bd6f3c7 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterPowerManagement.Format.ps1xml @@ -0,0 +1,193 @@ + + + + + + + + NetAdapterPowerManagement ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagementSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagementSettingData + + + + + + + InterfaceDescription + + + Name + + + ArpOffload + + + NSOffload + + + RsnRekeyOffload + + + D0PacketCoalescing + + + SelectiveSuspend + + + DeviceSleepOnDisconnect + + + WakeOnMagicPacket + + + WakeOnPattern + + + + + + + + NetAdapterPowerManagement_WakePattern Default ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagement_WakePattern + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagement_WakePattern + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagement_WakePattern_MagicPacket + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagement_WakePattern_MagicPacket + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagement_WakePattern_EapolRequestId + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagement_WakePattern_EapolRequestId + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagement_WakePattern_WildCard + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagement_WakePattern_WildCard + + + + + + + + + Import-Module NetAdapter\MSFT_NetAdapterPowerManagement.Format.Helper.psm1 + Format-WakePatternType $_.WakePacketType + + + + ID + + + + + "{0:x8}" -f ($_.Priority) + + + + FriendlyName + + + + + + + + NetAdapterPowerManagement_WakePattern_TcpSyn ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagement_WakePattern_TcpSyn + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagement_WakePattern_TcpSyn + + + + + + + + + Import-Module NetAdapter\MSFT_NetAdapterPowerManagement.Format.Helper.psm1 + Format-WakePatternType $_.WakePacketType + + + + ID + + + + + "{0:x8}" -f ($_.Priority) + + + + FriendlyName + + + SourceAddress + + + SourcePort + + + DestinationAddress + + + DestinationPort + + + + + + + + NetAdapterPowerManagement_WakePattern_Bitmap ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagement_WakePattern_Bitmap + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterPowerManagement_WakePattern_Bitmap + + + + + + + + + Import-Module NetAdapter\MSFT_NetAdapterPowerManagement.Format.Helper.psm1 + Format-WakePatternType $_.WakePacketType + + + + ID + + + + + "{0:x8}" -f ($_.Priority) + + + + FriendlyName + + + + + Import-Module NetAdapter\MSFT_NetAdapterPowerManagement.Format.Helper.psm1 + Format-BitmapWakePattern $_.Pattern $_.Mask + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterPowerManagement.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterPowerManagement.cmdletDefinition.cdxml new file mode 100644 index 0000000..1a99a04 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterPowerManagement.cmdletDefinition.cdxml @@ -0,0 +1,304 @@ + + + + 1.0 + NetAdapterPowerManagement + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Enabled + Disabled + + + + + + + + + + Enabled + Disabled + + + + + + + + + + Enabled + Disabled + + + + + + + + + + Enabled + Disabled + + + + + + + + + + Enabled + Disabled + + + + + + + + + + Enabled + Disabled + + + + + + + + + + Enabled + Disabled + + + + + + + + + + Enabled + Disabled + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterQos.Format.Helper.psm1 b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterQos.Format.Helper.psm1 new file mode 100644 index 0000000..9aefcc2 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterQos.Format.Helper.psm1 @@ -0,0 +1,179 @@ +<# + +Copyright (c) 2011 Microsoft Corporation. All Rights Reserved. + +Module Name: + + MSFT_NetAdapterQos.Format.Helper.psm1 + +Description: + + Provides helper routines for formatting the output of NetAdapterQos cmdlets. + +#> + +# +# This function accepts a PRE-SORTED array of integers and returns a formatted +# string that groups these numbers as follows: +# +# In: {0,1,2,4,6,7} +# Out: "0-2, 4, 6-7" +# +function Format-NetAdapterQosIntegerArray( + $array +) +{ + $out = "" + $first = $array[0] + $previous = $array[0] + + for ($i = 1; $i -le $array.count; $i++) + { + $previous++ + + if ($i -eq $array.count -or $array[$i] -ne $previous) + { + if ($out[0]) { $out += "," } + + if ($previous - $first -gt 1) + { + $out += "$($first)-$($previous - 1)" + } + else + { + $out += "$($first)" + } + + if ($i -ne $array.count) + { + $first = $array[$i] + $previous = $array[$i] + } + } + } + + return $out +} + +# +# This function accepts an MSFT_NetAdapter_QosSettings and generates formatted +# output using the information from the PriorityAssignmentTable, +# BandwidthAssignmentTable, and TsaAssignmentTable fields. +# +function Format-NetAdapterQosTrafficClass( + $settings +) +{ + $template = "{0,2} {1,-6} {2,-9} {3}`n" + + $out = "" + $out += $template -f "TC", "TSA", "Bandwidth", "Priorities" + $out += $template -f "--", "---", "---------", "----------" + + $tcprimap = @(@(),@(),@(),@(),@(),@(),@(),@()) + for ($tc = 0; $tc -lt $tcprimap.count; $tc++) + { + $tcprimap[$tc] = @() + } + + for ($pri = 0; $pri -lt $settings.PriorityAssignmentTable.count; $pri++) + { + $tc = $settings.PriorityAssignmentTable[$pri] + $tcprimap[$tc] += @($pri) + } + + $actual_cnt = 0 + + for ($tc = 0; $tc -lt $settings.TsaAssignmentTable.count; $tc++) + { + if ($tcprimap[$tc].count -eq 0) { continue } + + $actual_cnt++ + + $tsa = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterQos.Tsa]$settings.TsaAssignmentTable[$tc] + $temp = Format-NetAdapterQosIntegerArray $tcprimap[$tc] + + $bw_str = "" + if ($tsa -eq [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterQos.Tsa]::ETS) + { + $bw = $settings.BandwidthAssignmentTable[$tc] + $bw_str = "$($bw)%" + } + + $out += $template -f $tc, $tsa, $bw_str, $temp + } + + if ($actual_cnt -eq 0) + { + $out = "" + } + + return $out +} + +# +# This function accepts an MSFT_NetAdapter_QosSettings and generates formatted +# output using the information from the PriorityFlowControlEnableArray field. +# +function Format-NetAdapterQosFlowControl( + $settings +) +{ + $enablecnt = 0 + $enablearray = @() + + for ($pri = 0; $pri -lt $settings.PriorityFlowControlEnableArray.count; $pri++) + { + if ($settings.PriorityFlowControlEnableArray[$pri]) + { + $enablecnt++ + $enablearray += @($pri) + } + } + + if ($enablecnt -eq $settings.PriorityFlowControlEnableArray.count) { $out = "All Priorities Enabled" } + elseif ($enablecnt -eq 0) { $out = "All Priorities Disabled" } + elseif ($enablecnt -eq 1) { $out = "Priority $($enablearray[0]) Enabled" } + else { $out = "Priorities $(Format-NetAdapterQosIntegerArray $enablearray) Enabled" } + + return $out +} + +# +# This function accepts an MSFT_NetAdapter_QosSettings and generates formatted +# output using the information from the ClassificationTable field. +# +function Format-NetAdapterQosClassification( + $settings +) +{ + if ($settings.ClassificationTable.count -eq 0) + { + return "" + } + + $template = "{0,-9} {1,-9} {2}`n" + + $out = "" + $out += $template -f "Protocol", "Port/Type", "Priority" + $out += $template -f "--------", "---------", "--------" + + foreach ($element in $settings.ClassificationTable) + { + switch ($element.ProtocolSelector) + { + 0 { $protocol_str = "Reserved"; $port_str = "" } + 1 { $protocol_str = "Default"; $port_str = "" } + 2 { $protocol_str = "TCP"; $port_str = "$($element.ProtocolSpecificValue)" } + 3 { $protocol_str = "UDP"; $port_str = "$($element.ProtocolSpecificValue)" } + 4 { $protocol_str = "TCP/UDP"; $port_str = "$($element.ProtocolSpecificValue)" } + 5 { $protocol_str = "Ethertype"; $port_str = "0x{0:X0}" -f $element.ProtocolSpecificValue } + 6 { $protocol_str = "NetDirect"; $port_str = "$($element.ProtocolSpecificValue)" } + default { $protocol_str = "($($element.ProtocolSelector))"; $port_str = "0x{0:X0}" -f $element.ProtocolSpecificValue } + } + + $out += $template -f $protocol_str, $port_str, $element.Priority + } + + return $out +} diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterQos.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterQos.Format.ps1xml new file mode 100644 index 0000000..d0cf409 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterQos.Format.ps1xml @@ -0,0 +1,173 @@ + + + + + + MSFT_NetAdapterQosSettingData + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterQosSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterQosSettingData + + + + + + + Name + + + Enabled + + + + $_.HardwareCapabilities -and $_.CurrentCapabilities + + Capabilities + + + + $_.OperationalSettings + + OperationalTrafficClasses + + + + $_.OperationalSettings + + OperationalFlowControl + + + + $_.OperationalSettings + + OperationalClassifications + + + + $_.RemoteSettings + + RemoteTrafficClasses + + + + $_.RemoteSettings + + RemoteFlowControl + + + + $_.RemoteSettings + + RemoteClassifications + + + + + + + + + MSFT_NetAdapter_QosSettings + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter_QosSettings + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter_QosSettings + + + + + + + TransmissionSelectionEnabled + + + PriorityAssignmentTable + + + TsaAssignmentTable + + + BandwidthAssignmentTable + + + FlowControlEnabled + + + PriorityFlowControlEnableArray + + + ClassificationEnabled + + + NumberOfClassificationElements + + + ClassificationTable + + + + + + + + + MSFT_NetAdapter_QosClassificationElement + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter_QosClassificationElement + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter_QosClassificationElement + + + + + + + ProtocolSelector + + + ProtocolSpecificValue + + + Priority + + + + + + + + + MSFT_NetAdapter_QosCapabilities + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter_QosCapabilities + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter_QosCapabilities + + + + + + + MacSecBypass + + + DcbxSupport + + + + NumTCs + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterQos.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterQos.cdxml new file mode 100644 index 0000000..127e61f --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterQos.cdxml @@ -0,0 +1,173 @@ + + + + 1.0 + NetAdapterQos + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterRdma.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterRdma.Format.ps1xml new file mode 100644 index 0000000..3babab4 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterRdma.Format.ps1xml @@ -0,0 +1,288 @@ + + + + + + Default + + Microsoft.Management.Infrastructure.CimInstance#ROOT\StandardCimv2\MSFT_NetAdapterRdmaSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRdmaSettingData + + + + + + 25 + + + + 40 + + + + 11 + + + + 10 + + + + 10 + + + + + + + Name + + + InterfaceDescription + + + Enabled + + + PFC + + + ETS + + + + + + + + MSFT_NetAdapterRdma_AdapterInfo_Listview + + Microsoft.Management.Infrastructure.CimInstance#ROOT\StandardCimv2\MSFT_NetAdapter_RdmaAdapterInfo + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter_RdmaAdapterInfo + + + + + + + MajorVersionNumber + + + MinorVersionNumber + + + VendorId + + + DeviceId + + + MaxRegistrationSize + + + MaxWindowSize + + + FRMRPageCount + + + MaxInitiatorRequestSge + + + MaxReceiveRequestSge + + + MaxReadRequestSge + + + MaxTransferLength + + + MaxInlineDataSize + + + MaxInboundReadLimit + + + MaxOutboundReadLimit + + + MaxReceiveQueueDepth + + + MaxInitiatorQueueDepth + + + MaxSharedReceiveQueueDepth + + + MaxCompletionQueueDepth + + + LargeRequestThreshold + + + MaxCallerData + + + MaxCalleeData + + + InOrderDMA + + + SupportsCompletionQueueResize + + + SupportsLoopbackConnections + + + RdmaReadSinkFlagNotRequired + + + SupportsCompletionQueueInterruptModeration + + + SupportsMultiEngine + + + RdmaTechnology + + + + + + + + MSFT_NetAdapterRdma_MissingCounterInfo_Listview + + Microsoft.Management.Infrastructure.CimInstance#ROOT\StandardCimv2\MSFT_NetAdapter_RdmaMissingCounterInfo + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter_RdmaMissingCounterInfo + + + + + + + $_.ConnectPerformanceCounterMissing + ConnectPerformanceCounterMissing + + + $_.AcceptPerformanceCounterMissing + AcceptPerformanceCounterMissing + + + $_.ConnectFailurePerformanceCounterMissing + ConnectFailurePerformanceCounterMissing + + + $_.ConnectionErrorPerformanceCounterMissing + ConnectionErrorPerformanceCounterMissing + + + $_.ActiveConnectionPerformanceCounterMissing + ActiveConnectionPerformanceCounterMissing + + + $_.CompletionQueueErrorPerformanceCounterMissing + CompletionQueueErrorPerformanceCounterMissing + + + $_.RDMAInOctetsPerformanceCounterMissing + RDMAInOctetsPerformanceCounterMissing + + + $_.RDMAOutOctetsPerformanceCounterMissing + RDMAOutOctetsPerformanceCounterMissing + + + $_.RDMAInFramesPerformanceCounterMissing + RDMAInFramesPerformanceCounterMissing + + + $_.RDMAOutFramesPerformanceCounterMissing + RDMAOutFramesPerformanceCounterMissing + + + + + + + + MSFT_NetAdapterRdma_Listview + + Microsoft.Management.Infrastructure.CimInstance#ROOT\StandardCimv2\MSFT_NetAdapterRdmaSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRdmaSettingData + + + + + + + Name + + + InterfaceDescription + + + Enabled + + + MaxQueuePairCount + + + MaxCompletionQueueCount + + + MaxMemoryRegionCount + + + MaxProtectionDomainCount + + + MaxInboundReadLimit + + + MaxOutboundReadLimit + + + MaxMemoryWindowCount + + + MaxSharedReceiveQueueCount + + + PFC + + + ETS + + + + + ($_.RdmaAdapterInfo|fl|out-string).Trim() + + + + + + ($_.RdmaMissingCounterInfo|fl|out-string).Trim() + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterRdma.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterRdma.cdxml new file mode 100644 index 0000000..77a71df --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterRdma.cdxml @@ -0,0 +1,165 @@ + + + + 1.0 + NetAdapterRdma + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterRsc.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterRsc.Format.ps1xml new file mode 100644 index 0000000..08d09a4 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterRsc.Format.ps1xml @@ -0,0 +1,122 @@ + + + + + + MSFT_NetAsapterRsc_TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRscSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRscSettingData + + + + + 30 + + + 12 + + + 12 + + + 15 + + + 15 + + + 17 + + + 17 + + + + + + + Name + + + IPv4Enabled + + + IPv6Enabled + + + IPv4OperationalState + + + IPv6OperationalState + + + IPv4FailureReason + + + IPv6FailureReason + + + + + + + + MSFT_NetAsapterRsc_ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRscSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRscSettingData + + + + + + + Name + + + InterfaceDescription + + + IPv4Enabled + + + IPv6Enabled + + + + $_.RscHardwareCapabilities.IPv4Supported + + + + $_.RscHardwareCapabilities.IPv6Supported + + + IPv4OperationalState + + + IPv6OperationalState + + + IPv4FailureReason + + + IPv6FailureReason + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterRsc.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterRsc.cdxml new file mode 100644 index 0000000..1d72c71 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterRsc.cdxml @@ -0,0 +1,222 @@ + + + + 1.0 + NetAdapterRsc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterRss.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterRss.Format.ps1xml new file mode 100644 index 0000000..51868c6 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterRss.Format.ps1xml @@ -0,0 +1,169 @@ + + + + + + MSFT_NetAsapterRss_ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRssSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRssSettingData + + + + + + + + Name + + + + InterfaceDescription + + + + Enabled + + + + NumberOfReceiveQueues + + + + Profile + + + + + "$($_.BaseProcessorGroup):$($_.BaseProcessorNumber)" + + + + + + "$($_.MaxProcessorGroup):$($_.MaxProcessorNumber)" + + + + + MaxProcessors + + + + + $out="" + for ($i = 0; $i -lt $_.RssProcessorArraySize;) + { + $out+="$($_.RssProcessorArray[$i].ProcessorGroup):$($_.RssProcessorArray[$i].ProcessorNumber)/" + $out+="$($_.RssProcessorArray[$i].PreferenceIndex)" + $i++; + if (($i % 8) -eq 0) {if($i -ne $_.RssProcessorArraySize){$out+="`n"}} else {$out+=" "} + } + $out + + + + + + $out="" + for ($i = 0; $i -lt $_.IndirectionTableEntryCount;) + { + $out+="$($_.IndirectionTable[$i].ProcessorGroup):$($_.IndirectionTable[$i].ProcessorNumber)`t" + $i++; + if ((($i % 8) -eq 0) -and ($i -ne $_.IndirectionTableEntryCount)) {$out+="`n"} + } + $out + + + + + + + + + MSFT_NetAsapterRss_TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRssSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterRssSettingData + + + + + + 30 + + + + 7 + + + + 24 + + + + 13 + + + + 12 + + + + 13 + + + + 6 + + + + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterName $_.Name 30 + + + + Enabled + + + Profile + + + + $out = "$($_.BaseProcessorGroup):$($_.BaseProcessorNumber)" + $out + + + + + $out = "$($_.MaxProcessorGroup):$($_.MaxProcessorNumber)" + $out + + + + MaxProcessors + + + NumberOfReceiveQueues + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterRss.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterRss.cmdletDefinition.cdxml new file mode 100644 index 0000000..12d320b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterRss.cmdletDefinition.cdxml @@ -0,0 +1,214 @@ + + + + 1.0 + NetAdapterRss + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterSriov.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterSriov.Format.ps1xml new file mode 100644 index 0000000..394aa50 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterSriov.Format.ps1xml @@ -0,0 +1,103 @@ + + + + + + MSFT_NetAdapterSriov_ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterSriovSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterSriovSettingData + + + + + + + + Name + + + + InterfaceDescription + + + + Enabled + + + + SriovSupport + + + + SwitchName + + + + NumVFs + + + + + + + + MSFT_NetAdapterSriov_TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterSriovSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterSriovSettingData + + + + + + 30 + + + + 20 + + + + 20 + + + + 10 + + + + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterName $_.Name 30 + + + + SwitchName + + + SriovSupport + + + NumVFs + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterSriov.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterSriov.cdxml new file mode 100644 index 0000000..ffd637c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterSriov.cdxml @@ -0,0 +1,168 @@ + + + + 1.0 + NetAdapterSriov + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterSriovVf.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterSriovVf.Format.ps1xml new file mode 100644 index 0000000..71147f3 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterSriovVf.Format.ps1xml @@ -0,0 +1,86 @@ + + + + + + MSFT_NetAsapterVPort_TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterSriovVfSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterSriovVfSettingData + + + + + + 30 + + + + 10 + + + + 7 + + + + 17 + + + + 30 + + + + 20 + + + + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterName $_.Name 30 + + + + FunctionID + + + VPortID + + + + $out="" + if ($_.CurrentMacAddress) + { + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + $out = Format-MacAddress $_.CurrentMacAddress + } + $out + + + + VmID + + + VmFriendlyName + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterSriovVf.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterSriovVf.cmdletDefinition.cdxml new file mode 100644 index 0000000..ebf1285 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterSriovVf.cmdletDefinition.cdxml @@ -0,0 +1,42 @@ + + + + 1.0 + NetAdapterSriovVf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterStatistics.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterStatistics.Format.ps1xml new file mode 100644 index 0000000..97216e2 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterStatistics.Format.ps1xml @@ -0,0 +1,75 @@ + + + + + + MSFT_NetAsapterStatistics_TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterStatisticsSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterStatisticsSettingData + + + + + + 30 + + + + 15 + Right + + + + 22 + Right + + + + 15 + Right + + + + 18 + Right + + + + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterName $_.Name 25 + + + + ReceivedBytes + + + ReceivedUnicastPackets + + + SentBytes + + + SentUnicastPackets + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterStatistics.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterStatistics.cmdletDefinition.cdxml new file mode 100644 index 0000000..ca71d42 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterStatistics.cmdletDefinition.cdxml @@ -0,0 +1,30 @@ + + + + 1.0 + NetAdapterStatistics + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterUso.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterUso.Format.ps1xml new file mode 100644 index 0000000..8515eec --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterUso.Format.ps1xml @@ -0,0 +1,106 @@ + + + + + + MSFT_NetAsapterUso_TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterUsoSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterUsoSettingData + + + + + 30 + + + 12 + + + 12 + + + + + + + Name + + + IPv4Enabled + + + IPv6Enabled + + + + + + + + MSFT_NetAsapterUso_ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterUsoSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterUsoSettingData + + + + + + + Name + + + InterfaceDescription + + + IPv4Enabled + + + IPv6Enabled + + + + $_.UdpSegmentationOffloadHardwareCapabilities.IPv4MaxOffloadSizeSupported + + + + $_.UdpSegmentationOffloadHardwareCapabilities.IPv4MinSegmentCountSupported + + + + $_.UdpSegmentationOffloadHardwareCapabilities.IPv4SubMssFinalSegmentSupported + + + + $_.UdpSegmentationOffloadHardwareCapabilities.IPv6MaxOffLoadSizeSupported + + + + $_.UdpSegmentationOffloadHardwareCapabilities.IPv6MinSegmentCountSupported + + + + $_.UdpSegmentationOffloadHardwareCapabilities.IPv6SubMssFinalSegmentSupported + + + + $_.UdpSegmentationOffloadHardwareCapabilities.IPv6IpExtensionHeadersSupported + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterUso.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterUso.cdxml new file mode 100644 index 0000000..edeaef2 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterUso.cdxml @@ -0,0 +1,184 @@ + + + + 1.0 + NetAdapterUso + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterVPort.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterVPort.Format.ps1xml new file mode 100644 index 0000000..f43b091 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterVPort.Format.ps1xml @@ -0,0 +1,166 @@ + + + + + + MSFT_NetAsapterVPort_TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVPortSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterVPortSettingData + + + + + + 25 + + + + 6 + + + + 25 + + + + 5 + + + + 10 + + + + 9 + + + + 11 + + + + 9 + + + + 6 + + + + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterName $_.Name 25 + + + + VPortID + + + + $out="" + if ($_.FilterList -and ($_.FilterList.Length -ge 1)) + { + $MacAddress=$_.FilterList[0].MacAddress + if ($MacAddress) + { + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + $out = Format-MacAddress $MacAddress + } + } + $out + + + + + $out="" + if ($_.FilterList -and ($_.FilterList.Length -ge 1)) + { + if ($_.FilterList[0].VlanID -ne $null) + { + $out = "$($_.FilterList[0].VlanID)" + } + } + $out + + + + + $out="" + if($_.ProcessorAffinityMask -ne $null) + { + $affinity = $_.ProcessorAffinityMask + $ProcNumber = 0 + while($affinity -and !($affinity%2)){$affinity=$affinity/2;$ProcNumber++} + $out="$($_.ProcessorGroup):$ProcNumber" + } + $out + + + + + $out = "" + if ($_.FunctionID -ne $null) + { + if($_.FunctionID -eq 65535) + { + $out="PF" + } + else + { + $out=$_.FunctionID + } + } + $out + + + + + $out=switch ($_.VPortState) + { + 0 {"Unknown"} + 1 {"Activated"} + 2 {"DeActivated"} + default {"Unknown"} + } + $out + + + + + $out=switch ($_.InterruptModeration) + { + 0 {"Unknown"} + 1 {"Adaptive"} + 2 {"Off"} + 100 {"Low"} + 200 {"Medium"} + 300 {"High"} + default {"Unknown"} + } + $out + + + + NumQueuePairs + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterVPort.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterVPort.cmdletDefinition.cdxml new file mode 100644 index 0000000..54fa29a --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterVPort.cmdletDefinition.cdxml @@ -0,0 +1,52 @@ + + + + 1.0 + NetAdapterVPort + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterVmq.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterVmq.Format.ps1xml new file mode 100644 index 0000000..c764e33 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterVmq.Format.ps1xml @@ -0,0 +1,84 @@ + + + + + + MSFT_NetAsapterVmq_TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVmqSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterVmqSettingData + + + + + + 30 + + + + 33 + + + + 7 + + + + 16 + + + + 13 + + + + 16 + + + + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterName $_.Name 30 + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterInstanceID $_.InterfaceDescription 33 + + + + Enabled + + + + $out = "$($_.BaseProcessorGroup):$($_.BaseProcessorNumber)" + $out + + + + MaxProcessors + + + NumberOfReceiveQueues + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterVmq.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterVmq.cmdletDefinition.cdxml new file mode 100644 index 0000000..4ce4f8c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterVmq.cmdletDefinition.cdxml @@ -0,0 +1,184 @@ + + + + 1.0 + NetAdapterVmq + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterVmqQueue.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterVmqQueue.Format.ps1xml new file mode 100644 index 0000000..ae4dd67 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterVmqQueue.Format.ps1xml @@ -0,0 +1,106 @@ + + + + + + MSFT_NetAsapterVmqQueue_TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVmqQueueSettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapterVmqQueueSettingData + + + + + + 30 + + + + 7 + + + + 17 + + + + 6 + + + + 9 + + + + 38 + + + + + + + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-AdapterName $_.Name 30 + + + + QueueID + + + + $out="" + if ($_.FilterList -and ($_.FilterList.Length -ge 1)) + { + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + $out = Format-MacAddress $_.FilterList[0].MacAddress + } + $out + + + + + $out="" + if ($_.FilterList -and ($_.FilterList.Length -ge 1)) + { + if ($_.FilterList[0].VlanID -ne $null) + { + $out = "$($_.FilterList[0].VlanID)" + } + } + $out + + + + + $out="" + if($_.ProcessorAffinityMask -ne $null) + { + $affinity = $_.ProcessorAffinityMask + $ProcNumber = 0 + while($affinity -and !($affinity%2)){$affinity=$affinity/2;$ProcNumber++} + $out="$($_.ProcessorGroup):$ProcNumber" + } + $out + + + + VmFriendlyName + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterVmqQueue.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterVmqQueue.cmdletDefinition.cdxml new file mode 100644 index 0000000..f7ab043 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/MSFT_NetAdapterVmqQueue.cmdletDefinition.cdxml @@ -0,0 +1,36 @@ + + + + 1.0 + NetAdapterVmqQueue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/NetAdapter.Format.Helper.psm1 b/newton-cn/bin/v1.0/Modules/NetAdapter/NetAdapter.Format.Helper.psm1 new file mode 100644 index 0000000..92f0dca --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/NetAdapter.Format.Helper.psm1 @@ -0,0 +1,137 @@ +<# + +Copyright (c) 2011 Microsoft Corporation. All Rights Reserved. + +Module Name: + + NetAdapter.Format.Helper.psm1 + +Description: + + Provides helper routines for formatting the output of + NetAdapter CmdLets. + +#> + +function Format-MacAddress($MacAddress) +<# +Function Description: + This function formats a MAC address + +Arguments: + $MacAddress + +Return Value: + Formatted MAC address +#> +{ + $out = "" + if($MacAddress -ne $null) + { + for($i = 0; $i -lt $MacAddress.Length; ) + { + $out += $MacAddress[$i++]; + if($i -eq $MacAddress.Length) + { + break; + } + $out += $MacAddress[$i++]; + if ($i -lt $MacAddress.Length) + { + $out += '-'; + } + } + } + return $out +} + +function Format-AdapterName($Name, $Width) +<# +Function Description: + This function formats a network adapter name (ifAlias) + by fitting the name in specified column width. + If the name contains a number at the end, this function + makes sure that the number is preserved. + +Arguments: + $Name + $Width + +Return Value: + Formatted name +#> +{ + $out = $Name + if ($Name.length -gt $width) + { + $idpresent = $Name -match "(\d+$)" + if ($idpresent -and ($width -gt ($matches[0].length+3))) + { + $base = $Name.substring(0, $width - ($matches[0].length+3)) + $out=$base+"..."+$matches[0] + } + } + + return $out +} + +function Format-AdapterInstanceID($InstanceID, $Width) +<# +Function Description: + This function formats a network adapter InstanceID (ifDeesc) + by fitting the InstanceID in specified column width. + If the InstanceID contains a number at the end, this function + makes sure that the number is preserved. + +Arguments: + $InstanceID + $Width + +Return Value: + Formatted InstanceID +#> +{ + $out = $InstanceID + if ($InstanceID.length -gt $width) + { + $idpresent = $InstanceID -match "(#\d+$)" + if ($idpresent -and ($width -gt ($matches[0].length+3))) + { + $base = $InstanceID.substring(0, $width - ($matches[0].length+3)) + $out=$base+"..."+$matches[0] + } + } + return $out +} + +function Format-LinkSpeed([Decimal]$LinkSpeed, $Precision = 1, $AutoFormat = $true) +<# +Function Description: + This function returns the link speed of a network adapter + +Arguments: + $LinkSpeed - LinkSpeed + $Precision - Precision to use when rounding + $AutoFormat - Automatically format the number and display units after + +Return Value: + Formatted link speed +#> +{ + if ($LinkSpeed -eq $null) { + return "Unknown" + } + + if ($AutoFormat -eq $true) { + $Postfixes = @("", "K", "M", "G", "T") + for ($i = 0; $LinkSpeed -ge 1000 -and $i -lt $Postfixes.Length - 1; $i++) { + $LinkSpeed /= 1000 + } + $ps = " " + $Postfixes[$i] + "bps" + } else { + $ps = $null + } + + $LinkSpeed = [Math]::Round([Decimal]$LinkSpeed, $Precision) + return "$LinkSpeed" + $ps +} diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/NetAdapter.Types.ps1xml b/newton-cn/bin/v1.0/Modules/NetAdapter/NetAdapter.Types.ps1xml new file mode 100644 index 0000000..150feb6 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/NetAdapter.Types.ps1xml @@ -0,0 +1,1267 @@ + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter + + + MacAddress + + $out = "" + if (($this.NetworkAddresses -ne $null) -and + ($this.NetworkAddresses.length -ge 1)) + { + $MacAddress = $this.NetworkAddresses[0]; + } + if($MacAddress -ne $null) + { + for($i = 0; $i -lt $MacAddress.Length; ) + { + $out += $MacAddress[$i++]; + if($i -eq $MacAddress.Length) + { + break; + } + $out += $MacAddress[$i++]; + if ($i -lt $MacAddress.Length) + { + $out += '-'; + } + } + } + $out + + + param($newValue) + $MacAddress = $newValue -replace '(:|-)' + $this.NetworkAddresses = $MacAddress + + + + Status + + $NetAdapter = $this; + $out = switch ($NetAdapter.InterfaceOperationalStatus) + { + 1 {"Up"} + 3 {"Testing"} + 4 {"Unknown"} + 5 {"Dormant"} + 6 {"Not Present"} + 7 {"Lower Layer Down"} + } + if ($NetAdapter.InterfaceOperationalStatus -eq 2) + { + if ($NetAdapter.InterfaceAdminStatus -eq 2) + { + $out = "Disabled" + } + else + { + $first = $true; + if ($NetAdapter.OperationalStatusDownDefaultPortNotAuthenticated) + { + $out = "Not Authenticated" + $first = $false; + } + if ($NetAdapter.OperationalStatusDownMediaDisconnected) + { + if (-not $first) {$out += ", "} + $out += "Disconnected" + $first = $false; + } + + if ($NetAdapter.OperationalStatusDownLowPowerState) + { + if (-not $first) {$out += ", "} + $out += "Low Power State" + $first = $false; + } + } + } + $out + + + + LinkSpeed + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-LinkSpeed $this.TransmitLinkSpeed + + + + MediaType + + $out = switch ($this.NdisMedium) + { + 0 {"802.3"} + 3 {"WAN"} + 9 {"Wireless WAN"} + 12 {"Connection Oriented WAN"} + 15 {"Tunnel"} + 16 {"Native 802.11"} + 17 {"Loopback"} + 18 {"WiMAX"} + 19 {"IP"} + default {"Unknown"} + } + $out + + + + PhysicalMediaType + + $out = switch ($this.NdisPhysicalMedium) + { + 0 {"Unspecified"} + 1 {"Wireless LAN"} + 2 {"Cable Modem"} + 8 {"Wireless WAN"} + 9 {"Native 802.11"} + 10 {"BlueTooth"} + 11 {"Infiniband"} + 12 {"WiMAX"} + 13 {"UWB"} + 14 {"802.3"} + 16 {"IRDA"} + 17 {"Wired WAN"} + 18 {"Wired Connection Oriented WAN"} + 19 {"Other"} + default {"Unknown"} + } + $out + + + + AdminStatus + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapter.NET_IF_ADMIN_STATUS][System.UInt32]$this.InterfaceAdminStatus + + + + MediaConnectionState + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapter.NET_IF_MEDIA_CONNECT_STATE][System.UInt32]$this.MediaConnectState + + + + DriverInformation + + $out="Driver Date $($this.DriverDate) Version $($this.DriverVersionString)" + if ($this.DriverMajorNdisVersion -ne $null) + { + $out +=" NDIS $($this.DriverMajorNdisVersion).$($this.DriverMinorNdisVersion)" + } + $out + + + + DriverFileName + + (Split-Path $this.DriverName -Leaf) + + + + NdisVersion + + $out = if ($this.DriverMajorNdisVersion) + { + "$($this.DriverMajorNdisVersion).$($this.DriverMinorNdisVersion)" + } + else + { + $out = "Unknown" + } + $out + + + + ifOperStatus + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapter.IF_OPER_STATUS][System.UInt32]$this.InterfaceOperationalStatus + + + + ifAlias + Name + + + InterfaceAlias + Name + + + ifIndex + InterfaceIndex + + + ifDesc + InterfaceDescription + + + ifName + InterfaceName + + + DriverVersion + DriverVersionString + + + LinkLayerAddress + MacAddress + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterHardwareInfoSettingData + + + SriovSupport + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterSriov.SriovSupport]($this.PSBase.CimInstanceProperties['SriovSupport'].Value) + + + + PcieLinkSpeed + + $out = switch ($this.PciExpressCurrentLinkSpeedEncoded) + { + 1 {"2.5 GT/s"} + 2 {"5.0 GT/s"} + 3 {"8.0 GT/s"} + default {"Unknown"} + } + $out + + + + PcieMaxLinkSpeed + + $out = switch ($this.PciExpressMaxLinkSpeedEncoded) + { + 1 {"2.5 GT/s"} + 2 {"5.0 GT/s"} + 3 {"8.0 GT/s"} + default {"Unknown"} + } + $out + + + + Version + + $out= switch ($this.PciExpressVersion) + { + 1 {"1.0"} + 2 {"1.1"} + } + $out + + + + DeviceType + + $out= switch ($this.PciDeviceType) + { + 0 {"Conventional PCI"} + 1 {"PCI-X"} + 2 {"PCI Express endpoint"} + 3 {"PCI Express legacy endpoint"} + 4 {"PCI Express Root Complex integrated endpoint"} + 5 {"PCI Express treated as PCI"} + default {"Unknown"} + } + $out + + + + CurrentSpeedAndMode + + $out = if ($this.PciDeviceType -eq 0) + { + switch ($this.PciCurrentSpeedAndMode) + { + 0 {"Conventional PCI 33MHz"} + 1 {"Conventional PCI 66MHz"} + default {"Unknown"} + } + } + else + { + if ($this.PciDeviceType -eq 1) + { + switch ($this.PciXCurrentSpeedAndMode) + { + 0 {"PCI-X Mode conventional PCI"} + 1 {"PCI-X Mode1 66MHz"} + 2 {"PCI-X Mode1 100MHz"} + 3 {"PCI-X Mode1 133MHz"} + 5 {"PCI-X Mode1 ECC 66MHz"} + 6 {"PCI-X Mode1 ECC 100MHz"} + 7 {"PCI-X Mode1 ECC 133MHz"} + 9 {"PCI-X Mode2 266 66MHz"} + 10 {"PCI-X Mode2 266 100MHz"} + 11 {"PCI-X Mode2 266 133MHz"} + 13 {"PCI-X Mode2 533 66MHz"} + 14 {"PCI-X Mode2 533 100MHz"} + 15 {"PCI-X Mode2 533 133MHz"} + default {"Unknown"} + } + + } + else + { + "NA" + } + } + $out + + + + ifAlias + Name + + + InterfaceAlias + Name + + + ifDesc + InterfaceDescription + + + Segment + SegmentNumber + + + Bus + BusNumber + + + Device + DeviceNumber + + + Function + FunctionNumber + + + Slot + SlotNumber + + + PcieLinkWidth + PciExpressCurrentLinkWidth + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterAdvancedPropertySettingData + + + ValueName + RegistryKeyword + + + ValueData + RegistryValue + + + ifAlias + Name + + + InterfaceAlias + Name + + + ifDesc + InterfaceDescription + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterBindingSettingData + + + ifAlias + Name + + + InterfaceAlias + Name + + + ifDesc + InterfaceDescription + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRssSettingData + + + Profile + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRss.Profile]($this.PSBase.CimInstanceProperties['Profile'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Profile'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRss.Profile]$newValue + + + + ifAlias + Name + + + InterfaceAlias + Name + + + ifDesc + InterfaceDescription + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVmqSettingData + + + ifAlias + Name + + + InterfaceAlias + Name + + + ifDesc + InterfaceDescription + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVmqQueueSettingData + + + ifAlias + Name + + + InterfaceAlias + Name + + + ifDesc + InterfaceDescription + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterSriovSettingData + + + SriovSupport + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterSriov.SriovSupport]($this.PSBase.CimInstanceProperties['SriovSupport'].Value) + + + + ifAlias + Name + + + InterfaceAlias + Name + + + ifDesc + InterfaceDescription + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterSriovVfSettingData + + + ifAlias + Name + + + InterfaceAlias + Name + + + ifDesc + InterfaceDescription + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterVPortSettingData + + + ifAlias + Name + + + InterfaceAlias + Name + + + ifDesc + InterfaceDescription + + + QPairs + NumQueuePairs + + + ITR + InterruptModeration + + + FID + FunctionID + + + ProcMask + ProcessorAffinityMask + + + State + VPortState + + + ID + VPortID + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterStatisticsSettingData + + + ifAlias + Name + + + InterfaceAlias + Name + + + ifDesc + InterfaceDescription + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterLsoSettingData + + + ifAlias + Name + + + InterfaceAlias + Name + + + ifDesc + InterfaceDescription + + + Version + MaximumLsoVersionSupported + + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterChecksumOffloadSettingData + + + IpIPv4Enabled + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]($this.PSBase.CimInstanceProperties['IpIPv4Enabled'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['IpIPv4Enabled'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]$newValue + + + + TcpIPv4Enabled + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]($this.PSBase.CimInstanceProperties['TcpIPv4Enabled'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['TcpIPv4Enabled'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]$newValue + + + + TcpIPv6Enabled + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]($this.PSBase.CimInstanceProperties['TcpIPv6Enabled'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['TcpIPv6Enabled'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]$newValue + + + + UdpIPv4Enabled + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]($this.PSBase.CimInstanceProperties['UdpIPv4Enabled'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['UdpIPv4Enabled'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]$newValue + + + + UdpIPv6Enabled + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]($this.PSBase.CimInstanceProperties['UdpIPv6Enabled'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['UdpIPv6Enabled'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterChecksumOffload.Direction]$newValue + + + + ifAlias + Name + + + InterfaceAlias + Name + + + ifDesc + InterfaceDescription + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterQosSettingData + + + Name + + [System.String]($this.PSBase.CimInstanceProperties['Name'].Value) + + + + Enabled + + [System.Boolean]($this.PSBase.CimInstanceProperties['Enabled'].Value) + + + + Capabilities + + $hwCaps = $this.PSBase.CimInstanceProperties['HardwareCapabilities'].Value + $curCaps = $this.PSBase.CimInstanceProperties['CurrentCapabilities'].Value + + $template = "{0,-21} {1,-12} {2,-12}`n" + $out = "" + $out += $template -f "", "Hardware", "Current" + $out += $template -f "", "--------", "-------" + + $template = "{0,-19} : {1,-12} {2,-12}`n" + $out += $template -f "MacSecBypass", $hwCaps.MacSecBypass, $curCaps.MacSecBypass + $out += $template -f "DcbxSupport", $hwCaps.DcbxSupport, $curCaps.DcbxSupport + $out += $template -f "NumTCs(Max/ETS/PFC)", $hwCaps.NumTCs, $curCaps.NumTCs + $out + + + + HardwareCapabilities + + $this.PSBase.CimInstanceProperties['HardwareCapabilities'].Value + + + + CurrentCapabilities + + $this.PSBase.CimInstanceProperties['CurrentCapabilities'].Value + + + + OperationalTrafficClasses + + import-module netadapter\msft_netadapterqos.format.helper.psm1 + + $settings = $this.PSBase.CimInstanceProperties['OperationalSettings'].Value + $out = "" + + if ($settings -and $settings.TransmissionSelectionEnabled) { + $out = Format-NetAdapterQosTrafficClass $settings + } + + if (!$out[0]) { + $out = "Not Available" + } + + $out + + + + OperationalFlowControl + + import-module netadapter\msft_netadapterqos.format.helper.psm1 + + $settings = $this.PSBase.CimInstanceProperties['OperationalSettings'].Value + $out = "" + + if ($settings -and $settings.FlowControlEnabled) { + $out = Format-NetAdapterQosFlowControl $settings + } + + if (!$out[0]) { + $out = "Not Available" + } + + $out + + + + OperationalClassifications + + import-module netadapter\msft_netadapterqos.format.helper.psm1 + + $settings = $this.PSBase.CimInstanceProperties['OperationalSettings'].Value + $out = "" + + if ($settings -and $settings.ClassificationEnabled) { + $out = Format-NetAdapterQosClassification $settings + } + + if (!$out[0]) { + $out = "Not Available" + } + + $out + + + + RemoteTrafficClasses + + import-module netadapter\msft_netadapterqos.format.helper.psm1 + + $settings = $this.PSBase.CimInstanceProperties['RemoteSettings'].Value + $out = "" + + if ($settings -and $settings.TransmissionSelectionEnabled) { + $out = Format-NetAdapterQosTrafficClass $settings + } + + if (!$out[0]) { + $out = "Not Available" + } + + $out + + + + RemoteFlowControl + + import-module netadapter\msft_netadapterqos.format.helper.psm1 + + $settings = $this.PSBase.CimInstanceProperties['RemoteSettings'].Value + $out = "" + + if ($settings -and $settings.FlowControlEnabled) { + $out = Format-NetAdapterQosFlowControl $settings + } + + if (!$out[0]) { + $out = "Not Available" + } + + $out + + + + RemoteClassifications + + import-module netadapter\msft_netadapterqos.format.helper.psm1 + + $settings = $this.PSBase.CimInstanceProperties['RemoteSettings'].Value + $out = "" + + if ($settings -and $settings.ClassificationEnabled) { + $out = Format-NetAdapterQosClassification $settings + } + + if (!$out[0]) { + $out = "Not Available" + } + + $out + + + + OperationalSettings + + $this.PSBase.CimInstanceProperties['OperationalSettings'].Value + + + + RemoteSettings + + $this.PSBase.CimInstanceProperties['RemoteSettings'].Value + + + + AdminStatus + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterQos.AdminStatus]($this.PSBase.CimInstanceProperties['AdminStatus'].Value) + + + + ifAlias + Name + + + InterfaceAlias + Name + + + ifDesc + InterfaceDescription + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter_QosCapabilities + + + MacSecBypassSupported + + [System.Boolean]($this.PSBase.CimInstanceProperties['MacSecBypassSupported'].Value) + + + + MacSecBypass + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterQos.Supported][System.UInt32]($this.PSBase.CimInstanceProperties['MacSecBypassSupported'].Value) + + + + CeeDcbxSupported + + [System.Boolean]($this.PSBase.CimInstanceProperties['CeeDcbxSupported'].Value) + + + + IeeeDcbxSupported + + [System.Boolean]($this.PSBase.CimInstanceProperties['IeeeDcbxSupported'].Value) + + + + DcbxSupport + + $Flags = 0 + if ($this.PSBase.CimInstanceProperties['CeeDcbxSupported'].Value -ne 0) { + $Flags += 1 + } + if ($this.PSBase.CimInstanceProperties['IeeeDcbxSupported'].Value -ne 0) { + $Flags += 2 + } + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterQos.DcbxSupport]$Flags + + + + NumberOfTrafficClasses + + [System.Byte]($this.PSBase.CimInstanceProperties['NumberOfTrafficClasses'].Value) + + + + NumberOfEtsCapableTrafficClasses + + [System.Byte]($this.PSBase.CimInstanceProperties['NumberOfEtsCapableTrafficClasses'].Value) + + + + NumberOfPfcEnabledTrafficClasses + + [System.Byte]($this.PSBase.CimInstanceProperties['NumberOfPfcEnabledTrafficClasses'].Value) + + + + NumTCs + + $tcMax = $this.PSBase.CimInstanceProperties['NumberOfTrafficClasses'].Value + $tcEts = $this.PSBase.CimInstanceProperties['NumberOfEtsCapableTrafficClasses'].Value + $tcPfc = $this.PSBase.CimInstanceProperties['NumberOfPfcEnabledTrafficClasses'].Value + "$($tcMax)/$($tcEts)/$($tcPfc)" + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAdapter_QosSettings + + + TransmissionSelectionEnabled + + [System.Boolean]($this.PSBase.CimInstanceProperties['TransmissionSelectionEnabled'].Value) + + + + PriorityAssignmentTable + + $this.PSBase.CimInstanceProperties['PriorityAssignmentTable'].Value + + + + TsaAssignmentTable + + $this.PSBase.CimInstanceProperties['TsaAssignmentTable'].Value + + + + BandwidthAssignmentTable + + $this.PSBase.CimInstanceProperties['BandwidthAssignmentTable'].Value + + + + FlowControlEnabled + + [System.Boolean]($this.PSBase.CimInstanceProperties['FlowControlEnabled'].Value) + + + + PriorityFlowControlEnableArray + + $this.PSBase.CimInstanceProperties['PriorityFlowControlEnableArray'].Value + + + + ClassificationEnabled + + [System.Boolean]($this.PSBase.CimInstanceProperties['ClassificationEnabled'].Value) + + + + NumberOfClassificationElements + + [System.UInt32]($this.PSBase.CimInstanceProperties['NumberOfClassificationElements'].Value) + + + + ClassificationTable + + $this.PSBase.CimInstanceProperties['ClassificationTable'].Value + + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterPowerManagementSettingData + + + + AllowComputerToTurnOffDevice + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]($this.PSBase.CimInstanceProperties['AllowComputerToTurnOffDevice'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['AllowComputerToTurnOffDevice'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]$newValue + + + + + D0PacketCoalescing + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]($this.PSBase.CimInstanceProperties['D0PacketCoalescing'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['D0PacketCoalescing'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]$newValue + + + + + DeviceSleepOnDisconnect + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]($this.PSBase.CimInstanceProperties['DeviceSleepOnDisconnect'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['DeviceSleepOnDisconnect'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]$newValue + + + + + ArpOffload + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]($this.PSBase.CimInstanceProperties['ArpOffload'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['ArpOffload'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]$newValue + + + + + NSOffload + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]($this.PSBase.CimInstanceProperties['NSOffload'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['NSOffload'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]$newValue + + + + + RsnRekeyOffload + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]($this.PSBase.CimInstanceProperties['RsnRekeyOffload'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['RsnRekeyOffload'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]$newValue + + + + + SelectiveSuspend + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]($this.PSBase.CimInstanceProperties['SelectiveSuspend'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['SelectiveSuspend'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]$newValue + + + + + WakeOnMagicPacket + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]($this.PSBase.CimInstanceProperties['WakeOnMagicPacket'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['WakeOnMagicPacket'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]$newValue + + + + + WakeOnPattern + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]($this.PSBase.CimInstanceProperties['WakeOnPattern'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['WakeOnPattern'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterPowerManagement.Setting]$newValue + + + + + ifAlias + Name + + + + InterfaceAlias + Name + + + + ifDesc + InterfaceDescription + + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRscSettingData + + + IPv4FailureReason + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRsc.FailureReason]($this.PSBase.CimInstanceProperties['IPv4FailureReason'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['IPv4FailureReason'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRsc.FailureReason]$newValue + + + + IPv6FailureReason + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRsc.FailureReason]($this.PSBase.CimInstanceProperties['IPv6FailureReason'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['IPv6FailureReason'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRsc.FailureReason]$newValue + + + + ifAlias + Name + + + InterfaceAlias + Name + + + ifDesc + InterfaceDescription + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterIPsecOffloadV2SettingData + + + AuthenticationAlgorithmsEnabled + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterIPsecOffloadV2.AuthenticationAlgos]($this.PSBase.CimInstanceProperties['AuthenticationAlgorithmsEnabled'].Value) + + + + AuthenticationAlgorithmsSupported + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterIPsecOffloadV2.AuthenticationAlgos]($this.PSBase.CimInstanceProperties['AuthenticationAlgorithmsSupported'].Value) + + + + EncryptionAlgorithmsEnabled + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterIPsecOffloadV2.EncryptionAlgos]($this.PSBase.CimInstanceProperties['EncryptionAlgorithmsEnabled'].Value) + + + + EncryptionAlgorithmsSupported + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterIPsecOffloadV2.EncryptionAlgos]($this.PSBase.CimInstanceProperties['EncryptionAlgorithmsSupported'].Value) + + + + ifAlias + Name + + + InterfaceAlias + Name + + + ifDesc + InterfaceDescription + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterRdmaSettingData + + + ifAlias + Name + + + InterfaceAlias + Name + + + ifDesc + InterfaceDescription + + + PFC + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRdma.QosConfiguration]($this.PSBase.CimInstanceProperties['PFC'].Value) + + + + ETS + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRdma.QosConfiguration]($this.PSBase.CimInstanceProperties['ETS'].Value) + + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapter_RdmaAdapterInfo + + + RdmaTechnology + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetAdapterRdma.Technology]($this.PSBase.CimInstanceProperties['RdmaTechnology'].Value) + + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterEncapsulatedPacketTaskOffloadSettingData + + + ifAlias + Name + + + InterfaceAlias + Name + + + ifDesc + InterfaceDescription + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetAdapterUsoSettingData + + + ifAlias + Name + + + InterfaceAlias + Name + + + ifDesc + InterfaceDescription + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetAdapter/NetAdapter.psd1 b/newton-cn/bin/v1.0/Modules/NetAdapter/NetAdapter.psd1 new file mode 100644 index 0000000..34b545f --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetAdapter/NetAdapter.psd1 @@ -0,0 +1,153 @@ +<#++ + +Copyright (c) 2011 Microsoft Corporation + +Module Name: + + NetAdapter.psd1 + +Abstract: + + This module is the container module definition for the MSFT_NetAdapter* CIM + object CmdLets. + +--#> + +@{ + GUID = '1042b422-63a8-4016-a6d6-293e19e8f8a6' + Author = "Microsoft Corporation" + CompanyName = "Microsoft Corporation" + Copyright = "© Microsoft Corporation. All rights reserved." + HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=390794" + ModuleVersion = "2.0.0.0" + PowerShellVersion = '5.1' + NestedModules = @( + 'MSFT_NetAdapter.cmdletDefinition.cdxml', + 'MSFT_NetAdapterAdvancedProperty.cmdletDefinition.cdxml', + 'MSFT_NetAdapterBinding.cmdletDefinition.cdxml', + 'MSFT_NetAdapterChecksumOffload.cdxml', + 'MSFT_NetAdapterEncapsulatedPacketTaskOffload.cdxml', + 'MSFT_NetAdapterHardwareInfo.cmdletDefinition.cdxml', + 'MSFT_NetAdapterIPsecOffload.cdxml', + 'MSFT_NetAdapterLso.cdxml', + 'MSFT_NetAdapterPowerManagement.cmdletDefinition.cdxml', + 'MSFT_NetAdapterQos.cdxml', + 'MSFT_NetAdapterRdma.cdxml', + 'MSFT_NetAdapterRsc.cdxml', + 'MSFT_NetAdapterRss.cmdletDefinition.cdxml', + 'MSFT_NetAdapterSriov.cdxml', + 'MSFT_NetAdapterSriovVf.cmdletDefinition.cdxml', + 'MSFT_NetAdapterStatistics.cmdletDefinition.cdxml', + 'MSFT_NetAdapterVmq.cmdletDefinition.cdxml', + 'MSFT_NetAdapterVmqQueue.cmdletDefinition.cdxml', + 'MSFT_NetAdapterVPort.cmdletDefinition.cdxml', + 'MSFT_NetAdapterPacketDirect.cdxml', + 'MSFT_NetAdapterUso.cdxml' + ) + + TypesToProcess = @('NetAdapter.Types.ps1xml') + + FormatsToProcess = @( + 'MSFT_NetAdapter.Format.ps1xml', + 'MSFT_NetAdapterAdvancedProperty.Format.ps1xml', + 'MSFT_NetAdapterBinding.Format.ps1xml', + 'MSFT_NetAdapterChecksumOffload.Format.ps1xml', + 'MSFT_NetAdapterEncapsulatedPacketTaskOffload.Format.ps1xml', + 'MSFT_NetAdapterHardwareInfo.Format.ps1xml', + 'MSFT_NetAdapterIPsecOffload.Format.ps1xml', + 'MSFT_NetAdapterLso.Format.ps1xml', + 'MSFT_NetAdapterPowerManagement.Format.ps1xml', + 'MSFT_NetAdapterQos.Format.ps1xml', + 'MSFT_NetAdapterRdma.Format.ps1xml', + 'MSFT_NetAdapterRsc.Format.ps1xml', + 'MSFT_NetAdapterRss.Format.ps1xml', + 'MSFT_NetAdapterSriov.Format.ps1xml', + 'MSFT_NetAdapterSriovVf.Format.ps1xml', + 'MSFT_NetAdapterStatistics.Format.ps1xml', + 'MSFT_NetAdapterVmq.Format.ps1xml', + 'MSFT_NetAdapterVmqQueue.Format.ps1xml', + 'MSFT_NetAdapterVPort.Format.ps1xml', + 'MSFT_NetAdapterPacketDirect.Format.ps1xml', + 'MSFT_NetAdapterUso.Format.ps1xml' + ) + + FunctionsToExport = @( + 'Disable-NetAdapter', + 'Disable-NetAdapterBinding', + 'Disable-NetAdapterChecksumOffload', + 'Disable-NetAdapterEncapsulatedPacketTaskOffload', + 'Disable-NetAdapterIPsecOffload', + 'Disable-NetAdapterLso', + 'Disable-NetAdapterPowerManagement', + 'Disable-NetAdapterQos', + 'Disable-NetAdapterRdma', + 'Disable-NetAdapterRsc', + 'Disable-NetAdapterRss', + 'Disable-NetAdapterSriov', + 'Disable-NetAdapterVmq', + 'Disable-NetAdapterPacketDirect', + 'Disable-NetAdapterUso', + 'Enable-NetAdapter', + 'Enable-NetAdapterBinding', + 'Enable-NetAdapterChecksumOffload', + 'Enable-NetAdapterEncapsulatedPacketTaskOffload', + 'Enable-NetAdapterIPsecOffload', + 'Enable-NetAdapterLso', + 'Enable-NetAdapterPowerManagement', + 'Enable-NetAdapterQos', + 'Enable-NetAdapterRdma', + 'Enable-NetAdapterRsc', + 'Enable-NetAdapterRss', + 'Enable-NetAdapterSriov', + 'Enable-NetAdapterVmq', + 'Enable-NetAdapterPacketDirect', + 'Enable-NetAdapterUso', + 'Get-NetAdapter', + 'Get-NetAdapterAdvancedProperty', + 'Get-NetAdapterBinding', + 'Get-NetAdapterChecksumOffload', + 'Get-NetAdapterEncapsulatedPacketTaskOffload', + 'Get-NetAdapterHardwareInfo', + 'Get-NetAdapterIPsecOffload', + 'Get-NetAdapterLso', + 'Get-NetAdapterPowerManagement', + 'Get-NetAdapterQos', + 'Get-NetAdapterRdma', + 'Get-NetAdapterRsc', + 'Get-NetAdapterRss', + 'Get-NetAdapterSriov', + 'Get-NetAdapterSriovVf', + 'Get-NetAdapterStatistics', + 'Get-NetAdapterVmq', + 'Get-NetAdapterVMQQueue', + 'Get-NetAdapterVPort', + 'Get-NetAdapterPacketDirect', + 'Get-NetAdapterUso', + 'New-NetAdapterAdvancedProperty', + 'Remove-NetAdapterAdvancedProperty', + 'Rename-NetAdapter', + 'Reset-NetAdapterAdvancedProperty', + 'Restart-NetAdapter', + 'Set-NetAdapter', + 'Set-NetAdapterAdvancedProperty', + 'Set-NetAdapterBinding', + 'Set-NetAdapterChecksumOffload', + 'Set-NetAdapterEncapsulatedPacketTaskOffload', + 'Set-NetAdapterIPsecOffload', + 'Set-NetAdapterLso', + 'Set-NetAdapterPowerManagement', + 'Set-NetAdapterQos', + 'Set-NetAdapterRdma', + 'Set-NetAdapterRsc', + 'Set-NetAdapterRss', + 'Set-NetAdapterSriov', + 'Set-NetAdapterVmq', + 'Set-NetAdapterPacketDirect', + 'Set-NetAdapterUso' + ) + + CmdletsToExport = @() + + AliasesToExport = @() + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/NetConnection/MSFT_NetConnectionProfile.cdxml b/newton-cn/bin/v1.0/Modules/NetConnection/MSFT_NetConnectionProfile.cdxml new file mode 100644 index 0000000..2ed6921 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetConnection/MSFT_NetConnectionProfile.cdxml @@ -0,0 +1,129 @@ + + + + + 1.0 + NetConnectionProfile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetConnection/MSFT_NetConnectionProfile.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetConnection/MSFT_NetConnectionProfile.format.ps1xml new file mode 100644 index 0000000..df752b1 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetConnection/MSFT_NetConnectionProfile.format.ps1xml @@ -0,0 +1,39 @@ + + + + + MSFT_NetConnectionProfile + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetConnectionProfile + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetConnectionProfile + + + + + + + Name + + + InterfaceAlias + + + InterfaceIndex + + + NetworkCategory + + + IPv4Connectivity + + + IPv6Connectivity + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetConnection/MSFT_NetConnectionProfile.types.ps1xml b/newton-cn/bin/v1.0/Modules/NetConnection/MSFT_NetConnectionProfile.types.ps1xml new file mode 100644 index 0000000..2102fea --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetConnection/MSFT_NetConnectionProfile.types.ps1xml @@ -0,0 +1,38 @@ + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetConnectionProfile + + + NetworkCategory + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetConnectionProfile.NetworkCategory]($this.PSBase.CimInstanceProperties['NetworkCategory'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['NetworkCategory'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetConnectionProfile.NetworkCategory]$newValue + + + + IPv4Connectivity + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetConnectionProfile.IPv4Connectivity]($this.PSBase.CimInstanceProperties['IPv4Connectivity'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['IPv4Connectivity'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetConnectionProfile.IPv4Connectivity]$newValue + + + + IPv6Connectivity + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetConnectionProfile.IPv6Connectivity]($this.PSBase.CimInstanceProperties['IPv6Connectivity'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['IPv6Connectivity'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetConnectionProfile.IPv6Connectivity]$newValue + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetConnection/NetConnection.psd1 b/newton-cn/bin/v1.0/Modules/NetConnection/NetConnection.psd1 new file mode 100644 index 0000000..a8ebec4 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetConnection/NetConnection.psd1 @@ -0,0 +1,15 @@ + +@{ + ModuleVersion = '1.0.0.0' + NestedModules = @("MSFT_NetConnectionProfile.cdxml") + FormatsToProcess = @("MSFT_NetConnectionProfile.format.ps1xml") + TypesToProcess = @("MSFT_NetConnectionProfile.types.ps1xml") + HelpInfoUri = "http://go.microsoft.com/fwlink/?linkid=390795" + GUID = '{CE4FF86E-9416-4f2d-A869-C860AC543B5E}' + Author = 'Microsoft Corporation' + CompanyName = 'Microsoft Corporation' + PowerShellVersion = '5.1' + Copyright = '© Microsoft Corporation. All rights reserved.' + FunctionsToExport = @("Get-NetConnectionProfile", "Set-NetConnectionProfile") + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/NetDiagnostics/Get-NetView.psm1 b/newton-cn/bin/v1.0/Modules/NetDiagnostics/Get-NetView.psm1 new file mode 100644 index 0000000..95b4a58 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetDiagnostics/Get-NetView.psm1 @@ -0,0 +1,2500 @@ +<# +.SYNOPSIS + Collects data on system and network configuration for diagnosing Microsoft Networking. +.DESCRIPTION + Collects comprehensive configuration data to aid in troubleshooting Microsoft Network issues. + Data is collected from the following sources: + - Get-NetView metadata (path, args, etc.) + - Environment (OS, hardware, etc.) + - Physical, virtual, Container, NICs + - Virtual Machine configuration + - Virtual Switches, Bridges, NATs + - Device Drivers + - Performance Counters + - Logs, Traces, etc. + + The data is collected in a folder on the Desktop (by default), which is zipped + on completion. Send only the .zip file to Microsoft. + + The output is most easily viewed with Visual Studio Code or similar editor with a navigation panel. + + This module is a stable snapshot that's updated with each Windows feature update. + The latest changes can be found on GitHub at https://github.com/Microsoft/SDN/ +.PARAMETER OutputDirectory + Optional path to the directory where the output should be saved. Can be either a relative or an absolute path. + If unspecified, the current user's Desktop will be used by default. +.PARAMETER ExtraCommands + List of additional commands to run, formatted as Strings. Output is saved to the CustomModule directory. You can + use {0} as a placeholder for the CustomModule directory location, and it will be formatted in. This allows you to + copy or save additional files to the final output. + For example, 'echo "Hello, World!" > {0}\MyFile.txt' will save to \CustomModule\MyFile.txt +.PARAMETER SkipAdminCheck + If this switch is present, then the check for administrator privileges will be skipped. + Note that less data may be collected and the results may be of limited use. +.EXAMPLE + Get-NetView -OutputDirectory ".\" + Runs Get-NetView and outputs to the current working directory. +.EXAMPLE + Get-NetView -SkipAdminCheck + Runs Get-NetView without verifying administrator privileges and outputs to the Desktop. +.NOTES + Feature Request List + - Get-WinEvent and system logs: https://technet.microsoft.com/en-us/library/dd367894.aspx?f=255&MSPPError=-2147217396 + - Convert NetSH to NetEvent PS calls. + - Perf Profile acqusition + - Remote powershell support + - Cluster member execution support via remote powershell + - See this command to get VFs on vSwitch (see text in below functions) + > Get-NetAdapterSriovVf -SwitchId 2 +.LINK + https://github.com/Microsoft/SDN +#> + +# +# Common Functions +# + +$ExecFunctions = { + # Global vars + $columns = 4096 + + function ExecCommandText { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String] $Command, + [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String] $Output + ) + + # Mirror command execution context + $context = "$env:USERNAME @ ${env:COMPUTERNAME}:" + Write-Output $context | Out-File -Encoding ascii -Append $Output + + # Mirror command to execute + $cmdMirror = "$(prompt)$Command" + Write-Output $cmdMirror | Out-File -Encoding ascii -Append $Output + } # ExecCommandText() + + function ExecCommandPrivate { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String] $Command, + [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String] $Output + ) + + ExecCommandText -Command ($Command) -Output $Output + + # Execute Command and redirect to file. Useful so users know what to run!!! + Invoke-Expression $Command | Out-File -Encoding ascii -Append $Output + } #ExecCommandPrivate() + + enum CommandStatus { + NotTested # Indicates problem with TestCommand + Unavailable # [Part of] the command doesn't exist + Failed # An error prevented successful execution + Succeeded # No errors or exceptions + } + + function TestCommand { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String] $Command + ) + + $oldGlobalErrorActionPreference = $Global:ErrorActionPreference + $result = [CommandStatus]::NotTested + $failure = $null + + try { + # pre-execution cleanup + $error.clear() + + # Instrument the validate command for silent output + #$tmp = "$Command -ErrorAction 'SilentlyContinue' | Out-Null" + $tmp = "$Command | Out-Null" + + # ErrorAction MUST be Stop for try catch to work. + $Global:ErrorActionPreference = "Stop" + + # Redirect all error output to $null to encompass all possible errors + #Write-Host $tmp -ForegroundColor Yellow + Invoke-Expression $tmp 2> $null + if ($error -ne $null) { + # Some PS commands are incorrectly implemented in return code + # and require detecting SilentlyContinue + if (-not ($tmp -like "*SilentlyContinue*")) { + throw $error[0] + } + } + + # This is only reachable in success case + $result = [CommandStatus]::Succeeded + } catch [Management.Automation.CommandNotFoundException] { + $result = [CommandStatus]::Unavailable + } catch { + $result = [CommandStatus]::Failed + $failure = $error[0] | Out-String + } finally { + # post-execution cleanup to avoid false positives + $Global:ErrorActionPreference = $oldGlobalErrorActionPreference + $error.clear() + } + + return $result, $failure + } # TestCommand() + + # Powershell cmdlets have inconsistent implementations in command error handling. This function + # performs a validation of the command prior to formal execution and will log any failures. + function ExecCommand { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String] $Command, + [parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [String] $Output, + [parameter(Mandatory=$false)] [Switch] $Trusted + ) + + if ($Trusted) { + # Skip command validation + Write-Host -ForegroundColor Cyan "$Command" + ExecCommandPrivate -Command $Command -Output $Output + } else { + $result, $failure = TestCommand -Command $Command + + if ($result -eq [CommandStatus]::Succeeded) { + Write-Host -ForegroundColor Green "$Command" + ExecCommandPrivate -Command $Command -Output $Output + } else { + Write-Warning "[Command $result] $Command" + + Write-Output "[Command $result]" | Out-File -Encoding ascii -Append $Output + Write-Output "$Command" | Out-File -Encoding ascii -Append $Output + Write-Output "$failure" | Out-File -Encoding ascii -Append $Output + Write-Output "`n`n" | Out-File -Encoding ascii -Append $Output + } + } + } # ExecCommand() + + function TryCmd { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [ScriptBlock] $ScriptBlock + ) + + try { + $out = &$ScriptBlock + } catch { + $out = $null + } + + # Returning $null will cause foreach to iterate once + # unless TryCmd call is in parentheses. + if ($out -eq $null) { + $out = @() + } + + return $out + } +} # $ExecFunctions + +. $ExecFunctions # import into script context + +function Start-Thread { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [ScriptBlock] $ScriptBlock, + [parameter(Mandatory=$false)] [ValidateScript({Test-Path $_ -PathType Container})] [String] $StartPath = ".", + [parameter(Mandatory=$false)] [Hashtable] $Params = @{} + ) + + $ps = [PowerShell]::Create() + + $ps.Runspace = [RunspaceFactory]::CreateRunspace() + $ps.Runspace.Open() + $null = $ps.AddScript("Set-Location ""$(Resolve-Path $StartPath)""") + $null = $ps.AddScript($ExecFunctions) # import into thread context + $null = $ps.AddScript($ScriptBlock).AddParameters($Params) + + $async = $ps.BeginInvoke() + + return @{Name=$ScriptBlock.Ast.Name; AsyncResult=$async; PowerShell=$ps} +} # Start-Thread() + +function Remove-Thread { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [Hashtable] $Thread + ) + Write-Host "Stopping thread $($Thread.Name)..." + $Thread.PowerShell.Stop() + $Thread.PowerShell.Dispose() + $Thread.PowerShell.Runspace.Close() +} # Remove-Thread + +function StreamThread { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [Hashtable] $Thread + ) + + Write-Host "`nOn thread: $($Thread.Name)" + Write-Host "----------------------------------------------" + + do { + Start-Sleep -Milliseconds 50 + # TODO output errors/other streams + $Thread.PowerShell.Streams.Information | Out-Host + $Thread.PowerShell.Streams.Information.Clear() + } until ($Thread.AsyncResult.IsCompleted) + + $Thread.PowerShell.EndInvoke($Thread.AsyncResult) +} # StreamThread() + +# +# Data Collection Functions +# + +function NetIpNicWorker { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $NicName, + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $name = $NicName + $dir = $OutDir + + $file = "Get-NetIpAddress.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetIpAddress -InterfaceAlias ""$name"" | Format-Table -AutoSize | Out-String -Width $columns", + "Get-NetIpAddress -InterfaceAlias ""$name"" | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetIpAddress -InterfaceAlias ""$name"" | Format-List", + "Get-NetIpAddress -InterfaceAlias ""$name"" | Format-List -Property *", + "Get-NetIpAddress | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetIPInterface.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetIPInterface -InterfaceAlias ""$name"" | Out-String -Width $columns", + "Get-NetIPInterface -InterfaceAlias ""$name"" | Format-Table -AutoSize", + "Get-NetIPInterface -InterfaceAlias ""$name"" | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetIPInterface | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetNeighbor.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetNeighbor -InterfaceAlias ""$name"" | Out-String -Width $columns", + "Get-NetNeighbor -InterfaceAlias ""$name"" | Format-Table -AutoSiz | Out-String -Width $columns", + "Get-NetNeighbor -InterfaceAlias ""$name"" | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetNeighbor | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetRoute.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetRoute -InterfaceAlias ""$name"" | Format-Table -AutoSize | Out-String -Width $columns", + "Get-NetRoute -InterfaceAlias ""$name"" | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetRoute | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } +} # NetIpNicWorker() + +function NetIpNic { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $NicName, + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $name = $NicName + + $dir = (Join-Path -Path $OutDir -ChildPath ("NetIp")) + New-Item -ItemType directory -Path $dir | Out-Null + NetIpNicWorker -NicName $name -OutDir $dir +} # NetIpNic() + +function NetIpWorker { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $dir = $OutDir + + $file = "Get-NetIpAddress.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetIpAddress | Format-Table -AutoSize | Out-String -Width $columns", + "Get-NetIpAddress | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetIpAddress | Format-List", + "Get-NetIpAddress | Format-List -Property *", + "Get-NetIpAddress | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetIPInterface.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetIPInterface | Out-String -Width $columns", + "Get-NetIPInterface | Format-Table -AutoSize | Out-String -Width $columns", + "Get-NetIPInterface | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetIPInterface | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetNeighbor.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetNeighbor | Format-Table -AutoSize | Out-String -Width $columns", + "Get-NetNeighbor | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetNeighbor | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetIPv4Protocol.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetIPv4Protocol | Out-String -Width $columns", + "Get-NetIPv4Protocol | Format-List -Property *", + "Get-NetIPv4Protocol | Format-Table -Property * -AutoSize", + "Get-NetIPv4Protocol | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetIPv4Protocol | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetIPv6Protocol.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetIPv6Protocol | Out-String -Width $columns", + "Get-NetIPv6Protocol | Format-List -Property *", + "Get-NetIPv6Protocol | Format-Table -Property * -AutoSize", + "Get-NetIPv6Protocol | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetIPv6Protocol | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetOffloadGlobalSetting.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetOffloadGlobalSetting | Out-String -Width $columns", + "Get-NetOffloadGlobalSetting | Format-List -Property *", + "Get-NetOffloadGlobalSetting | Format-Table -AutoSize", + "Get-NetOffloadGlobalSetting | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetOffloadGlobalSetting | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetPrefixPolicy.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetPrefixPolicy | Format-Table -AutoSize", + "Get-NetPrefixPolicy | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetPrefixPolicy | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetRoute.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetRoute | Format-Table -AutoSize", + "Get-NetRoute | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetRoute | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetTCPConnection.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetTCPConnection | Format-Table -AutoSize", + "Get-NetTCPConnection | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetTCPConnection | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Trusted -Command ($cmd) -Output $out + } + + $file = "Get-NetTcpSetting.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetTcpSetting | Format-Table -AutoSize", + "Get-NetTcpSetting | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetTcpSetting | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Trusted -Command ($cmd) -Output $out + } + + $file = "Get-NetTransportFilter.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetTransportFilter | Format-Table -AutoSize", + "Get-NetTransportFilter | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetTransportFilter | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetUDPEndpoint.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetUDPEndpoint | Format-Table -AutoSize", + "Get-NetUDPEndpoint | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetUDPEndpoint | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetUDPSetting.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetUDPSetting | Format-Table -AutoSize", + "Get-NetUDPSetting | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetUDPSetting | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } +} # NetIpWorker() + +function NetIp { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $dir = (Join-Path -Path $OutDir -ChildPath ("NetIp")) + New-Item -ItemType directory -Path $dir | Out-Null + NetIpWorker -OutDir $dir +} # NetIp() + +function NetNatWorker { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $dir = $OutDir + + $file = "Get-NetNat.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetNat | Format-Table -AutoSize | Out-String -Width $columns", + "Get-NetNat | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetNat | Format-List", + "Get-NetNat | Format-List -Property *", + "Get-NetNat | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetNatExternalAddress.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetNatExternalAddress | Format-Table -AutoSize | Out-String -Width $columns", + "Get-NetNatExternalAddress | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetNatExternalAddress | Format-List", + "Get-NetNatExternalAddress | Format-List -Property *", + "Get-NetNatExternalAddress | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetNatGlobal.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetNatGlobal | Format-Table -AutoSize | Out-String -Width $columns", + "Get-NetNatGlobal | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetNatGlobal | Format-List", + "Get-NetNatGlobal | Format-List -Property *", + "Get-NetNatGlobal | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetNatSession.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetNatSession | Format-Table -AutoSize | Out-String -Width $columns", + "Get-NetNatSession | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetNatSession | Format-List", + "Get-NetNatSession | Format-List -Property *", + "Get-NetNatSession | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetNatStaticMapping.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetNatStaticMapping | Format-Table -AutoSize | Out-String -Width $columns", + "Get-NetNatStaticMapping | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetNatStaticMapping | Format-List", + "Get-NetNatStaticMapping | Format-List -Property *", + "Get-NetNatStaticMapping | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + +} # NetNatWorker + +function NetNat { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $dir = (Join-Path -Path $OutDir -ChildPath ("NetNat")) + New-Item -ItemType directory -Path $dir | Out-Null + NetNatWorker -OutDir $dir +} # NetNat() + +function NetAdapterWorker { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $NicName, + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $name = $NicName + $dir = $OutDir + + $file = "Get-NetAdapter.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapter -Name ""$name"" -IncludeHidden | Out-String -Width $columns", + "Get-NetAdapter -Name ""$name"" -IncludeHidden | Format-List -Property *", + "Get-NetAdapter | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetAdapterAdvancedProperty.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterAdvancedProperty -Name ""$name"" -AllProperties | Sort-Object RegistryKeyword | Format-Table -AutoSize | Out-String -Width $columns", + "Get-NetAdapterAdvancedProperty -Name ""$name"" -AllProperties -IncludeHidden | Sort-Object RegistryKeyword | Format-Table -AutoSize | Out-String -Width $columns", + "Get-NetAdapterAdvancedProperty -Name ""$name"" -AllProperties -IncludeHidden | Format-List -Property *", + "Get-NetAdapterAdvancedProperty -Name ""$name"" -AllProperties -IncludeHidden | Format-Table -Property * | Out-String -Width $columns", + "Get-NetAdapterAdvancedProperty | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetAdapterBinding.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterBinding -Name ""$name"" -AllBindings -IncludeHidden | Sort-Object ComponentID | Out-String -Width $columns", + "Get-NetAdapterBinding -Name ""$name"" -AllBindings -IncludeHidden | Format-List -Property *", + "Get-NetAdapterBinding | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetAdapterChecksumOffload.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterChecksumOffload -Name ""$name"" -IncludeHidden | Out-String -Width $columns", + "Get-NetAdapterChecksumOffload -Name ""$name"" -IncludeHidden | Format-List -Property *", + "Get-NetAdapterChecksumOffload | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetAdapterLso.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterLso -Name ""$name"" -IncludeHidden | Out-String -Width $columns", + "Get-NetAdapterLso -Name ""$name"" -IncludeHidden | Format-List -Property *", + "Get-NetAdapterLso | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetAdapterRss.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterRss -Name ""$name"" -IncludeHidden | Out-String -Width $columns", + "Get-NetAdapterRss -Name ""$name"" -IncludeHidden | Format-List -Property *", + "Get-NetAdapterRss | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetAdapterStatistics.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterStatistics -Name ""$name"" -IncludeHidden | Out-String -Width $columns", + "Get-NetAdapterStatistics -Name ""$name"" -IncludeHidden | Format-List -Property *", + "Get-NetAdapterStatistics | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetAdapterEncapsulatedPacketTaskOffload.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterEncapsulatedPacketTaskOffload -Name ""$name"" -IncludeHidden | Out-String -Width $columns", + "Get-NetAdapterEncapsulatedPacketTaskOffload -Name ""$name"" -IncludeHidden | Format-List -Property *", + "Get-NetAdapterEncapsulatedPacketTaskOffload | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetAdapterHardwareInfo.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterHardwareInfo -Name ""$name"" -IncludeHidden | Out-String -Width $columns", + "Get-NetAdapterHardwareInfo -Name ""$name"" -IncludeHidden | Format-List -Property *", + "Get-NetAdapterHardwareInfo | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetAdapterIPsecOffload.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterIPsecOffload -Name ""$name"" -IncludeHidden | Out-String -Width $columns", + "Get-NetAdapterIPsecOffload -Name ""$name"" -IncludeHidden | Format-List -Property *", + "Get-NetAdapterIPsecOffload | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetAdapterPowerManagement.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterPowerManagement -Name ""$name"" -IncludeHidden | Out-String -Width $columns", + "Get-NetAdapterPowerManagement -Name ""$name"" -IncludeHidden | Format-List -Property *", + "Get-NetAdapterPowerManagement | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetAdapterQos.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterQos -Name ""$name"" -IncludeHidden -ErrorAction SilentlyContinue | Out-String -Width $columns", + "Get-NetAdapterQos -Name ""$name"" -IncludeHidden -ErrorAction SilentlyContinue | Format-List -Property *", + "Get-NetAdapterQos | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetAdapterRdma.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterRdma -Name ""$name"" -IncludeHidden | Out-String -Width $columns", + "Get-NetAdapterRdma -Name ""$name"" -IncludeHidden | Format-List -Property *", + "Get-NetAdapterRdma | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetAdapterPacketDirect.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterPacketDirect -Name ""$name"" -IncludeHidden | Out-String -Width $columns", + "Get-NetAdapterPacketDirect -Name ""$name"" -IncludeHidden | Format-List -Property *", + "Get-NetAdapterPacketDirect | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetAdapterRsc.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterRsc -Name ""$name"" -IncludeHidden | Out-String -Width $columns", + "Get-NetAdapterRsc -Name ""$name"" -IncludeHidden | Format-List -Property *", + "Get-NetAdapterRsc | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetAdapterSriov.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterSriov -Name ""$name"" -IncludeHidden | Out-String -Width $columns", + "Get-NetAdapterSriov -Name ""$name"" -IncludeHidden | Format-List -Property *", + "Get-NetAdapterSriov | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetAdapterSriovVf.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterSriovVf -Name ""$name"" -IncludeHidden | Out-String -Width $columns", + "Get-NetAdapterSriovVf -Name ""$name"" -IncludeHidden | Format-List -Property *", + "Get-NetAdapterSriovVf | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetAdapterVmq.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterVmq -Name ""$name"" -IncludeHidden | Out-String -Width $columns", + "Get-NetAdapterVmq -Name ""$name"" -IncludeHidden | Format-List -Property *", + "Get-NetAdapterVmq | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetAdapterVmqQueue.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterVmqQueue -Name ""$name"" -IncludeHidden | Out-String -Width $columns", + "Get-NetAdapterVmqQueue -Name ""$name"" -IncludeHidden | Format-List -Property *", + "Get-NetAdapterVmqQueue | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetAdapterVPort.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterVPort -Name ""$name"" -IncludeHidden | Out-String -Width $columns", + "Get-NetAdapterVPort -Name ""$name"" -IncludeHidden | Format-List -Property *", + "Get-NetAdapterVPort | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } +} # NetAdapterWorker() + +function NetAdapterWorkerPrepare { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $NicDesc, + [parameter(Mandatory=$true)] [String] $OutDir + ) + + # Normalize Variables + $out = $OutDir + $desc = $NicDesc + + # Create dir for each NIC + $nic = Get-NetAdapter -InterfaceDescription $desc + $idx = $nic.IfIndex + $name = $nic.Name + $desc = $NicDesc + $nictype = "pNic" + $title = "$nictype.$idx.$name.$desc" + $dir = (Join-Path -Path $out -ChildPath "$title") + New-Item -ItemType directory -Path $dir | Out-Null + + Write-Host "" + Write-Host "Processing: $title" + Write-Host "----------------------------------------------" + NetIpNic -NicName $name -OutDir $dir + NetAdapterWorker -NicName $name -OutDir $dir + NicVendor -NicName $name -OutDir $dir +} # NetAdapterWorkerPrepare() + + +function LbfoWorker { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $LbfoName, + [parameter(Mandatory=$true)] [String] $OutDir + ) + + # Normalize Names + $name = $LbfoName + $out = $OutDir + + $file = "Get-NetLbfoTeam.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetLbfoTeam -Name ""$name""", + "Get-NetLbfoTeam -Name ""$name"" | Format-List -Property *", + "Get-NetLbfoTeam | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetLbfoTeamNic.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetLbfoTeamNic -Team ""$name""", + "Get-NetLbfoTeamNic -Team ""$name"" | Format-List -Property *", + "Get-NetLbfoTeamNic | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-NetLbfoTeamMember.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetLbfoTeamMember -Team ""$name""", + "Get-NetLbfoTeamMember -Team ""$name"" | Format-List -Property *", + "Get-NetLbfoTeamMember | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + # Report the TNIC(S) + foreach ($tnic in TryCmd {Get-NetLbfoTeamNic -Team $name}) { + NetAdapterWorkerPrepare -NicDesc $tnic.InterfaceDescription -OutDir $OutDir + } + + # Report the NIC Members + foreach ($mnic in TryCmd {Get-NetLbfoTeamMember -Team $name}) { + NetAdapterWorkerPrepare -NicDesc $mnic.InterfaceDescription -OutDir $OutDir + } +} # LbfoWorker() + +function LbfoWorkerPrepare { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $LbfoName, + [parameter(Mandatory=$true)] [String] $OutDir + ) + + # Normalize Variable + $name = $LbfoName + + $dir = (Join-Path -Path $OutDir -ChildPath ("LBFO.$name")) + New-Item -ItemType directory -Path $dir | Out-Null + + Write-Host "Processing: $name" + Write-Host "----------------------------------------------" + LbfoWorker -LbfoName $name -OutDir $dir +} # LbfoWorkerPrepare() + +function LbfoDetail { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + # Normalize variables + $out = $OutDir + + foreach ($lbfo in TryCmd {Get-NetLbfoTeam}) { + $name = $lbfo.Name + + # Skip all vSwitch Protocol NICs since the LBFO and member reporting will occur as part of + # vSwitch reporting. + $match = $false + + foreach ($vms in TryCmd {Get-VMSwitch | where {$_.SwitchType -ne "Internal"}}) { + if ($vms.NetAdapterInterfaceDescriptions -contains (Get-NetAdapter -Name $name).InterfaceDescription) { + $match = $true + break + } + } + + if (-not $match) { + LbfoWorkerPrepare -LbfoName $name -OutDir $out + } + } +} # LbfoDetail() + +function ProtocolNicDetail { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $VMSwitchName, + [parameter(Mandatory=$true)] [String] $OutDir + ) + + # Normalize Variables + $out = $OutDir + + # Distinguish between LBFO from standard PTNICs and create the hierarchies accordingly + foreach ($desc in TryCmd {(Get-VMSwitch -Name "$VMSwitchName").NetAdapterInterfaceDescriptions}) { + $nic = Get-NetAdapter -InterfaceDescription $desc + if ($nic.DriverFileName -like "NdisImPlatform.sys") { + LbfoWorkerPrepare -LbfoName $nic.Name -OutDir $out + } else { + NetAdapterWorkerPrepare -NicDesc $desc -OutDir $out + } + } +} # ProtocolNicDetail() + +function NativeNicDetail { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + # Normalize Variables + $out = $OutDir + + foreach ($nic in Get-NetAdapter) { + $native = $true + + # Skip vSwitch Host vNICs by checking the driver + if ($nic.DriverFileName -like "vmswitch.sys") { + continue + } + + # Skip LBFO TNICs by checking the driver + if ($nic.DriverFileName -like "NdisImPlatform.sys") { + continue + } + + # Skip all vSwitch Protocol NICs + foreach ($vms in TryCmd {Get-VMSwitch | where {$_.SwitchType -ne "Internal"}}) { + if ($vms.NetAdapterInterfaceDescriptions -contains $nic.InterfaceDescription) { + $native = $false + break + } + } + + # Skip LBFO Team Member Adapters + foreach ($lbfonic in TryCmd {Get-NetLbfoTeamMember}) { + if ($nic.InterfaceDescription -eq $lbfonic.InterfaceDescription) { + $native = $false + break + } + } + + if ($native) { + NetAdapterWorkerPrepare -NicDesc $nic.InterfaceDescription -OutDir $out + } + } +} # NativeNicDetail() + +function ChelsioDetail { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $NicName, + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $dir = (Join-Path -Path $OutDir -ChildPath "ChelsioDetail") + New-Item -ItemType Directory -Path $dir | Out-Null + + # Collect Chelsio related event logs and miscellaneous details + $file = "ChelsioDetail-Eventlog-BusDevice.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-EventLog -LogName System -Source ""*chvbd*"" -ErrorAction SilentlyContinue | Format-List", + "Get-EventLog -LogName System -Source ""*cht4vbd*"" -ErrorAction SilentlyContinue | Format-List" + foreach ($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "ChelsioDetail-Eventlog-NetDevice.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-EventLog -LogName System -Source ""*chndis*"" -ErrorAction SilentlyContinue | Format-List", + "Get-EventLog -LogName System -Source ""*chnet*"" -ErrorAction SilentlyContinue | Format-List", + "Get-EventLog -LogName System -Source ""*cht4ndis*"" -ErrorAction SilentlyContinue | Format-List" + foreach ($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "ChelsioDetail-Misc.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "verifier /query", + "Get-PnpDevice -FriendlyName ""*Chelsio*Enumerator*"" | Get-PnpDeviceProperty -KeyName DEVPKEY_Device_DriverVersion | Format-Table -Autosize" + foreach ($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + # Basic sanity check. Most of Chelsio related logs are collected using cxgbtool.exe. + # So if cxgbtool.exe is not there in System32 forlder, then exit from the function. + $cxgbtool = Get-Item "$env:windir\System32\cxgbtool.exe" -ErrorAction SilentlyContinue + if ($cxgbtool.Exists -eq $null) { + Write-Warning "Unable to collect Chelsio debug logs as cxgbtool is not present in $env:windir\system32" + return $null + } + + $ifName = $NicName + $ifIndex = (Get-NetAdapter $NicName).ifIndex + $ifHwInfo = Get-NetAdapterHardwareInfo -Name "$ifName" + $dirBusName = "BusDev_$($ifHwInfo.Bus)_$($ifHwInfo.Device)_$($ifHwInfo.Function)" + $dirBus = (Join-Path -Path $dir -ChildPath $dirBusName) + + if ($Global:ChelsioOncePerASIC -notcontains $dirBusName) { + $Global:ChelsioOncePerASIC += @($dirBusName) # expensive, avoid duplicate effort + New-Item -ItemType Directory -Path $dirBus | Out-Null + + # Enumerate VBD + [String] $ifNameVbd = $null + [Array] $PnPDevices = Get-PnpDevice -FriendlyName "*Chelsio*Enumerator*" | where {$_.Status -eq "OK"} + for ($i = 0; $i -lt $PnPDevices.Count; $i++) { + $instanceId = $PnPDevices[$i].InstanceId + $locationInfo = (Get-PnpDeviceProperty -InstanceId "$instanceId" -KeyName "DEVPKEY_Device_LocationInfo").Data + if ($ifHwInfo.LocationInformationString -eq $locationInfo) { + $ifNameVbd = "vbd$i" + break + } + } + + if ([String]::IsNullOrEmpty($ifNameVbd)) { + Write-Warning "Couldn't resolve interface name for bus device" + return $null + } + + $file = "ChelsioDetail-Cudbg.txt" + $CollectFile = "Cudbg-Collect.dmp" + $ReadFlashFile = "Cudbg-Readflash.dmp" + $out = (Join-Path -Path $dirBus -ChildPath $file) + $OutCollect = (Join-Path -Path $dirBus -ChildPath $CollectFile) + $OutReadFlash = (Join-Path -Path $dirBus -ChildPath $ReadFlashFile) + [String []] $cmds = "cxgbtool.exe $ifNameVbd cudbg collect all ""$OutCollect""", + "cxgbtool.exe $ifNameVbd cudbg readflash ""$OutReadFlash""" + foreach ($cmd in $cmds) { + ExecCommand -Trusted -Command $cmd -Output $out + } + + $file = "ChelsioDetail-Firmware-BusDevice$i.txt" + $out = (Join-Path -Path $dirBus -ChildPath $file) + [String []] $cmds = "cxgbtool.exe $ifNameVbd firmware mbox 1", + "cxgbtool.exe $ifNameVbd firmware mbox 2", + "cxgbtool.exe $ifNameVbd firmware mbox 3", + "cxgbtool.exe $ifNameVbd firmware mbox 4", + "cxgbtool.exe $ifNameVbd firmware mbox 5", + "cxgbtool.exe $ifNameVbd firmware mbox 6", + "cxgbtool.exe $ifNameVbd firmware mbox 7" + foreach ($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "ChelsioDetail-Hardware-BusDevice$i.txt" + $flashFile = "Hardware-BusDevice$i-flash.dmp" + $out = (Join-Path -Path $dirBus -ChildPath $file) + $OutFlash = (Join-Path -Path $dirBus -ChildPath $flashFile) + [String []] $cmds = "cxgbtool.exe $ifNameVbd hardware sgedbg", + "cxgbtool.exe $ifNameVbd hardware flash ""$OutFlash""" + foreach ($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + } # $Global:ChelsioOncePerASIC + + $dirNetName = "NetDev_$ifIndex" + $dirNet = (Join-Path -Path $dir -ChildPath $dirNetName) + New-Item -ItemType Directory -Path $dirNet | Out-Null + + # Enumerate NIC + [Array] $NetDevices = Get-NetAdapter -InterfaceDescription "*Chelsio*" | where {$_.Status -eq "Up"} | Sort-Object -Property MacAddress + $ifNameNic = $null + for ($i = 0; $i -lt $NetDevices.Count; $i++) { + if ($ifName -eq $NetDevices[$i].Name) { + $ifNameNic = "nic$i" + break + } + } + + if ([String]::IsNullOrEmpty($ifNameNic)) { + Write-Warning "Couldn't resolve interface name for Network device(ifIndex:$ifIndex)" + return $null + } + + $file = "ChelsioDetail-Debug.txt" + $out = (Join-Path -Path $dirNet -ChildPath $file) + [String []] $cmds = "cxgbtool.exe $ifNameNic debug filter", + "cxgbtool.exe $ifNameNic debug qsets", + "cxgbtool.exe $ifNameNic debug qstats txeth rxeth txvirt rxvirt txrdma rxrdma txnvgre rxnvgre", + "cxgbtool.exe $ifNameNic debug dumpctx", + "cxgbtool.exe $ifNameNic debug version", + "cxgbtool.exe $ifNameNic debug eps", + "cxgbtool.exe $ifNameNic debug qps", + "cxgbtool.exe $ifNameNic debug rdma_stats", + "cxgbtool.exe $ifNameNic debug stags", + "cxgbtool.exe $ifNameNic debug l2t" + foreach ($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "ChelsioDetail-Hardware.txt" + $out = (Join-Path -Path $dirNet -ChildPath $file) + [String []] $cmds = "cxgbtool.exe $ifNameNic hardware tid_info", + "cxgbtool.exe $ifNameNic hardware fec", + "cxgbtool.exe $ifNameNic hardware link_cfg", + "cxgbtool.exe $ifNameNic hardware pktfilter", + "cxgbtool.exe $ifNameNic hardware sensor" + foreach ($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } +} # ChelsioDetail() + +# ======================================================================== +# function stub for extension by IHV +# Copy and rename it, add your commands, and call it in NicVendor() below +# ======================================================================== +function MyVendorDetail { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $NicName, + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $dir = Join-Path -Path $OutDir -ChildPath "MyVendorDetail" + + # Try to keep the layout of this block of code + # Feel free to copy it or wrap it in other control structures + # See other functions in this file for examples + $file = "$NicName.MyVendor.txt" + $out = Join-Path $dir $file + [String []] $cmds = "Command 1", + "Command 2", + "Command 3", + "etc." + foreach ($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } +} # MyVendorDetail() + +function NicVendor { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $NicName, # Get-NetAdapter output + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $dir = $OutDir + + # Call appropriate vendor specific function + $pciId = (Get-NetAdapterAdvancedProperty -Name $NicName -AllProperties -RegistryKeyword "ComponentID").RegistryValue + switch -Wildcard($pciId) { + "CHT*BUS\chnet*" { + ChelsioDetail $NicName $dir + } + # Not implemented. See MyVendorDetail() for examples. + # + #"PCI\VEN_15B3*" { + # MellanoxDetail $Nic $dir + # + #} + #"PCI\VEN_8086*" { + # IntelDetail $Nic $dir + #} + default { + # Not implemented, not native, or N/A + } + } +} # NicVendor() + +function HostVNicWorker { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $HostVNicName, + [parameter(Mandatory=$true)] [String] $OutDir + ) + + # Normalize Names + $name = $HostVNicName + $dir = $OutDir + + $file = "Get-VMNetworkAdapter.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMNetworkAdapter -ManagementOS -VMNetworkAdapterName ""$name"" | Out-String -Width $columns", + "Get-VMNetworkAdapter -ManagementOS -VMNetworkAdapterName ""$name"" | Format-List -Property *", + "Get-VMNetworkAdapter -ManagementOS| Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMNetworkAdapterAcl.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMNetworkAdapterAcl -ManagementOS -VMNetworkAdapterName ""$name"" | Out-String -Width $columns", + "Get-VMNetworkAdapterAcl -ManagementOS -VMNetworkAdapterName ""$name"" | Format-List -Property *", + "Get-VMNetworkAdapterAcl -ManagementOS | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMNetworkAdapterExtendedAcl.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMNetworkAdapterExtendedAcl -ManagementOS -VMNetworkAdapterName ""$name"" | Out-String -Width $columns", + "Get-VMNetworkAdapterExtendedAcl -ManagementOS -VMNetworkAdapterName ""$name"" | Format-List -Property *", + "Get-VMNetworkAdapterExtendedAcl -ManagementOS | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMNetworkAdapterFailoverConfiguration.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMNetworkAdapterFailoverConfiguration -ManagementOS -VMNetworkAdapterName ""$name"" | Out-String -Width $columns", + "Get-VMNetworkAdapterFailoverConfiguration -ManagementOS -VMNetworkAdapterName ""$name"" | Format-List -Property *", + "Get-VMNetworkAdapterFailoverConfiguration -ManagementOS | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMNetworkAdapterIsolation.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMNetworkAdapterIsolation -ManagementOS -VMNetworkAdapterName ""$name"" | Out-String -Width $columns", + "Get-VMNetworkAdapterIsolation -ManagementOS -VMNetworkAdapterName ""$name"" | Format-List -Property *", + "Get-VMNetworkAdapterIsolation -ManagementOS | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMNetworkAdapterRoutingDomainMapping.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMNetworkAdapterRoutingDomainMapping -ManagementOS -VMNetworkAdapterName ""$name"" | Out-String -Width $columns", + "Get-VMNetworkAdapterRoutingDomainMapping -ManagementOS -VMNetworkAdapterName ""$name"" | Format-List -Property *", + "Get-VMNetworkAdapterRoutingDomainMapping -ManagementOS | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMNetworkAdapterTeamMapping.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMNetworkAdapterTeamMapping -ManagementOS -VMNetworkAdapterName ""$name"" | Out-String -Width $columns", + "Get-VMNetworkAdapterTeamMapping -ManagementOS -VMNetworkAdapterName ""$name"" | Format-List -Property *", + "Get-VMNetworkAdapterTeamMapping -ManagementOS | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMNetworkAdapterVlan.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName ""$name"" | Out-String -Width $columns", + "Get-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName ""$name"" | Format-List -Property *", + "Get-VMNetworkAdapterVlan -ManagementOS | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } +} # HostVNicWorker() + +function HostVNicDetail { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $VMSwitchName, + [parameter(Mandatory=$true)] [String] $OutDir + ) + + foreach ($nic in TryCmd {Get-VMNetworkAdapter -ManagementOS -SwitchName $VMSwitchName}) { + <# + Correlate to VMNic instance to NetAdapter instance view + Physical to Virtual Mapping. + ----------------------------- + Get-NetAdapter uses: + Name : vEthernet (VMS-Ext-Public) 2 + Get-VMNetworkAdapter uses: + Name : VMS-Ext-Public + + Thus we need to match the corresponding devices via DeviceID such that + we can execute VMNetworkAdapter and NetAdapter information for this hNIC + #> + $idx = 0 + foreach($pnic in (Get-NetAdapter -IncludeHidden)) { + if ($pnic.DeviceID -eq $nic.DeviceId) { + $pnicname = $pnic.Name + $idx = $pnic.IfIndex + } + } + + # Create dir for each NIC + $name = $nic.Name + $nictype = "hNic" + $title = "$nictype.$idx.$name" + $dir = (Join-Path -Path $OutDir -ChildPath "$title") + New-Item -ItemType directory -Path $dir | Out-Null + + Write-Host "Processing: $title" + Write-Host "----------------------------------------------" + NetIpNic -NicName $pnicname -OutDir $dir + HostVNicWorker -HostVNicName $name -OutDir $dir + NetAdapterWorker -NicName $pnicname -OutDir $dir + } +} # HostVNicDetail() + + +function VMNetworkAdapterWorker { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $VMName, + [parameter(Mandatory=$true)] [String] $VMNicName, + [parameter(Mandatory=$true)] [String] $OutDir + ) + + # Normalize Names + $name = $VMNicName + $dir = $OutDir + + $file = "Get-VMNetworkAdapter.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMNetworkAdapter -Name ""$name"" -VMName ""$VMName"" | Out-String -Width $columns", + "Get-VMNetworkAdapter -Name ""$name"" -VMName ""$VMName"" | Format-List -Property *", + "Get-VMNetworkAdapter * | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMNetworkAdapterAcl.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMNetworkAdapterAcl -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Out-String -Width $columns", + "Get-VMNetworkAdapterAcl -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Format-List -Property *", + "Get-VMNetworkAdapterAcl | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMNetworkAdapterExtendedAcl.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMNetworkAdapterExtendedAcl -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Out-String -Width $columns", + "Get-VMNetworkAdapterExtendedAcl -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Format-List -Property *", + "Get-VMNetworkAdapterExtendedAcl | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMNetworkAdapterFailoverConfiguration.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMNetworkAdapterFailoverConfiguration -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Out-String -Width $columns", + "Get-VMNetworkAdapterFailoverConfiguration -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Format-List -Property *", + "Get-VMNetworkAdapterFailoverConfiguration -VMName * | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMNetworkAdapterIsolation.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMNetworkAdapterIsolation -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Out-String -Width $columns", + "Get-VMNetworkAdapterIsolation -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Format-List -Property *", + "Get-VMNetworkAdapterIsolation | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMNetworkAdapterRoutingDomainMapping.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMNetworkAdapterRoutingDomainMapping -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Out-String -Width $columns", + "Get-VMNetworkAdapterRoutingDomainMapping -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Format-List -Property *", + "Get-VMNetworkAdapterRoutingDomainMapping | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMNetworkAdapterTeamMapping.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMNetworkAdapterTeamMapping -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Out-String -Width $columns", + "Get-VMNetworkAdapterTeamMapping -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Format-List -Property *", + "Get-VMNetworkAdapterTeamMapping -VMName * | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMNetworkAdapterVlan.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMNetworkAdapterVlan -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Out-String -Width $columns", + "Get-VMNetworkAdapterVlan -VMNetworkAdapterName ""$name"" -VMName ""$VMName"" | Format-List -Property *", + "Get-VMNetworkAdapterVlan | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } +} # VMNetworkAdapterWorker() + +function VmNetworkAdapterDetail { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $VMName, + [parameter(Mandatory=$true)] [String] $VmNicName, + [parameter(Mandatory=$true)] [String] $VmNicMac, + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $dir = (Join-Path -Path $OutDir -ChildPath ("VMNic.$VmNicName.$VmNicMac")) + New-Item -ItemType directory -Path $dir | Out-Null + + Write-Host "Processing: VMNic.$VmNicName.$VmNicMac" + Write-Host "--------------------------------------" + VMNetworkAdapterWorker -VMName $VMName -VMNicName $VmNicName -OutDir $dir +} # VmNetworkAdapterDetail() + +function VmWorker { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $VMName, + [parameter(Mandatory=$true)] [String] $OutDir + ) + + # Normalize Names + $dir = $OutDir + + $file = "Get-VM.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VM -VMName ""$VMName"" | Out-String -Width $columns", + "Get-VM -VMName ""$VMName"" | Format-List -Property *", + "Get-VM | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMBios.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMBios -VMName ""$VMName"" | Out-String -Width $columns", + "Get-VMBios -VMName ""$VMName"" | Format-List -Property *" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMFirmware.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMFirmware -VMName ""$VMName"" | Out-String -Width $columns", + "Get-VMFirmware -VMName ""$VMName"" | Format-List -Property *" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMProcessor.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMProcessor -VMName ""$VMName"" | Out-String -Width $columns", + "Get-VMProcessor -VMName ""$VMName"" | Format-List -Property *" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMMemory.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMMemory -VMName ""$VMName"" | Out-String -Width $columns", + "Get-VMMemory -VMName ""$VMName"" | Format-List -Property *" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMVideo.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMVideo -VMName ""$VMName"" | Out-String -Width $columns", + "Get-VMVideo -VMName ""$VMName"" | Format-List -Property *" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMHardDiskDrive.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMHardDiskDrive -VMName ""$VMName"" | Out-String -Width $columns", + "Get-VMHardDiskDrive -VMName ""$VMName"" | Format-List -Property *" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMComPort.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMComPort -VMName ""$VMName"" | Out-String -Width $columns", + "Get-VMComPort -VMName ""$VMName"" | Format-List -Property *" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMSecurity.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMSecurity -VMName ""$VMName"" | Out-String -Width $columns", + "Get-VMSecurity -VMName ""$VMName"" | Format-List -Property *" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + +} # VmWorker() + +function VMNetworkAdapterPerVM { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $VMSwitchName, + [parameter(Mandatory=$true)] [String] $OutDir + ) + + foreach ($vm in TryCmd {Get-VM}) { + $vmname = $vm.Name + $vmid = $vm.VMId + + Write-Host "Processing: VM.$vmname.$vmid" + Write-Host "--------------------------------------" + foreach ($nic in TryCmd {Get-VMNetworkAdapter -VMName $vmname}) { + if ($nic.SwitchName -eq $VMSwitchName) { + $vmquery = 0 + $dir = (Join-Path -Path $OutDir -ChildPath ("VM.$vmname")) + if (-not (Test-Path $dir)) { + New-Item -ItemType directory -Path $dir | Out-Null + $vmquery = 1 + } + + if ($vmquery) { + VmWorker -VMName $vmname -OutDir $dir + } + VmNetworkAdapterDetail -VMName $vmname -VmNicName $nic.Name -VmNicMac $nic.MacAddress -OutDir $dir + } + } + } +} # VMNetworkAdapterPerVM() + +function VMSwitchWorker { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $VMSwitchName, + [parameter(Mandatory=$true)] [String] $OutDir + ) + + # Normalize Names + $name = $VMSwitchName + $dir = $OutDir + + $file = "Get-VMSwitch.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMSwitch -Name ""$name""", + "Get-VMSwitch -Name ""$name"" | Format-List -Property *", + "Get-VMSwitch -Name ""$name"" | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMSwitchExtension.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMSwitch -Name ""$name"" | Get-VMSwitchExtension | Format-List -Property *", + "Get-VMSwitch -Name ""$name"" | Get-VMSwitchExtension | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMSwitchExtensionSwitchData.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMSwitchExtensionSwitchData -SwitchName ""$name"" | Format-List -Property *", + "Get-VMSwitchExtensionSwitchData -SwitchName ""$name"" | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMSwitchExtensionSwitchFeature.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMSwitchExtensionSwitchFeature -SwitchName ""$name"" | Format-List -Property *" + #"Get-VMSwitchExtensionSwitchFeature -SwitchName ""$name"" | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMSwitchTeam.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMSwitchTeam -SwitchName ""$name"" | Format-List -Property *", + "Get-VMSwitchTeam -SwitchName ""$name"" | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMSystemSwitchExtension.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMSystemSwitchExtension | Format-List -Property *", + "Get-VMSystemSwitchExtension | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMSwitchExtensionPortFeature.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMSwitchExtensionPortFeature * | Format-List -Property *", + "Get-VMSwitchExtensionPortFeature * | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMSystemSwitchExtensionSwitchFeature.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMSystemSwitchExtensionSwitchFeature", + "Get-VMSystemSwitchExtensionSwitchFeature | Format-List -Property *", + "Get-VMSystemSwitchExtensionSwitchFeature | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + <# + #Get-VMSwitchExtensionPortData -ComputerName $env:computername * + # Execute command list + $file = "Get-VMSwitchExtensionPortData.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-VMSwitchExtensionPortData -SwitchName ""$name"" | Format-List -Property *", + "Get-VMSwitchExtensionPortData -SwitchName ""$name"" | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + #> +} # VMSwitchWorker() + +function VfpExtensionWorker { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $VMSwitchName, + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $name = $VMSwitchName + $out = $OutDir + + $dir = (Join-Path -Path $out -ChildPath ("VFP")) + New-Item -ItemType directory -Path $dir | Out-Null + + $file = "VfpCtrl.help.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "vfpctrl.exe /h" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + + $switches = Get-WmiObject -Namespace root\virtualization\v2 -Class Msvm_VirtualEthernetSwitch + foreach ($switch in $switches) { + if ($switch.ElementName -eq $name) { + $currswitch = $switch + break + } + } + $ports = $currswitch.GetRelated("Msvm_EthernetSwitchPort", "Msvm_SystemDevice", $null, $null, $null, $null, $false, $null) + foreach ($port in $ports) { + $portGuid = $port.Name + $file = "VfpCtrl.PortGuid.$portGuid.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "vfpctrl.exe /list-space /port $portGuid", + "vfpctrl.exe /list-mapping /port $portGuid", + "vfpctrl.exe /list-rule /port $portGuid", + "vfpctrl.exe /port $portGuid /get-port-state" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + } + +} # VfpExtensionWorker() + +function VfpExtensionDetail { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $VMSwitchName, + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $name = $VMSwitchName + $out = $OutDir + + foreach ($ext in TryCmd {Get-VMSwitch -Name $name | Get-VMSwitchExtension}) { + if (($ext.Name -like "Microsoft Azure VFP Switch Extension") -and ($ext.Enabled -like "True")) { + VfpExtensionWorker -VMSwitchName $name -OutDir $out + } + } + +} # VfpExtensionDetail() + +function VMSwitchDetail { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + # FIXME!!! + ##See this command to get VFs on vSwitch + #Get-NetAdapterSriovVf -SwitchId 2 + + foreach ($switch in TryCmd {Get-VMSwitch}) { + $name = $switch.Name + $type = $switch.SwitchType + + $dir = (Join-Path -Path $OutDir -ChildPath ("VMSwitch.$type.$name")) + New-Item -ItemType directory -Path $dir | Out-Null + + Write-Host "Processing: $name" + Write-Host "----------------------------------------------" + VfpExtensionDetail -VMSwitchName $name -OutDir $dir + VMSwitchWorker -VMSwitchName $name -OutDir $dir + ProtocolNicDetail -VMSwitchName $name -OutDir $dir + HostVNicDetail -VMSwitchName $name -OutDir $dir + VMNetworkAdapterPerVM -VMSwitchName $name -OutDir $dir + } +} # VMSwitchDetail() + +function NetworkSummary { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $file = "Get-VMSwitch.txt" + $out = (Join-Path -Path $OutDir -ChildPath $file) + [String []] $cmds = "Get-VMSwitch | Sort-Object Name", + "Get-VMSwitch | Sort-Object Name | Format-Table -Property * -AutoSize | Out-String -Width $columns" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "Get-VMNetworkAdapter.txt" + $out = (Join-Path -Path $OutDir -ChildPath $file) + [String []] $cmds = "Get-VMNetworkAdapter -All | Sort-Object Name | Format-Table -AutoSize", + "Get-VMNetworkAdapter -All | Sort-Object Name | Format-Table -Property * -AutoSize | Out-String -Width $columns" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "Get-NetAdapter.txt" + $out = (Join-Path -Path $OutDir -ChildPath $file) + [String []] $cmds = "Get-NetAdapter -IncludeHidden | Sort-Object InterfaceDescription | Format-Table -AutoSize", + "Get-NetAdapter -IncludeHidden | Sort-Object InterfaceDescription | Format-Table -Property * -AutoSize | Out-String -Width $columns" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "Get-NetAdapterStatistics.txt" + $out = (Join-Path -Path $OutDir -ChildPath $file) + [String []] $cmds = "Get-NetAdapterStatistics -IncludeHidden | Sort-Object InterfaceDescription | Format-Table -Autosize | Out-String -Width $columns", + "Get-NetAdapterStatistics -IncludeHidden | Sort-Object InterfaceDescription | Format-Table -Property * -Autosize | Out-String -Width $columns" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "Get-NetLbfoTeam.txt" + $out = (Join-Path -Path $OutDir -ChildPath $file) + [String []] $cmds = "Get-NetLbfoTeam | Sort-Object InterfaceDescription", + "Get-NetLbfoTeam | Sort-Object InterfaceDescription | Format-Table -Property * -AutoSize | Out-String -Width $columns" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "Get-NetIpAddress.txt" + $out = (Join-Path -Path $OutDir -ChildPath $file) + [String []] $cmds = "Get-NetIpAddress | Format-Table -Autosize", + "Get-NetIpAddress | Format-Table -Property * -AutoSize | Out-String -Width $columns" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "ipconfig.txt" + $out = (Join-Path -Path $OutDir -ChildPath $file) + [String []] $cmds = "ipconfig", + "ipconfig /allcompartments /all" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } +} # NetworkSummary() + +function SMBDetail { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $dir = (Join-Path -Path $OutDir -ChildPath ("SMB")) + New-Item -ItemType directory -Path $dir | Out-Null + + $file = "Get-SmbClientNetworkInterface.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-SmbClientNetworkInterface | Sort-Object FriendlyName | Format-Table -AutoSize | Out-String -Width $columns", + "Get-SmbClientNetworkInterface | Format-List -Property *", + "Get-SmbClientNetworkInterface | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-SmbServerNetworkInterface.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-SmbServerNetworkInterface | Sort-Object FriendlyName | Format-Table -AutoSize | Out-String -Width $columns", + "Get-SmbServerNetworkInterface | Format-List -Property *", + "Get-SmbServerNetworkInterface | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-SmbClientConfiguration.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-SmbClientConfiguration", + "Get-SmbClientConfiguration | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-SmbMultichannelConnection.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-SmbMultichannelConnection | Sort-Object Name | Format-Table -AutoSize | Out-String -Width $columns", + "Get-SmbMultichannelConnection -IncludeNotSelected | Format-List -Property *", + "Get-SmbMultichannelConnection -SmbInstance CSV -IncludeNotSelected | Format-List -Property *", + "Get-SmbMultichannelConnection -SmbInstance SBL -IncludeNotSelected | Format-List -Property *", + "Get-SmbMultichannelConnection | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-SmbMultichannelConstraint.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-SmbMultichannelConstraint", + "Get-SmbMultichannelConstraint | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Smb-WindowsEvents.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-WinEvent -ListLog ""*SMB*"" | Format-List -Property *", + "Get-WinEvent -ListLog ""*SMB*"" | Get-WinEvent | ? Message -like ""*RDMA*"" | Format-List -Property *" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } +} # SMBDetail() + +function NetSetupDetail { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $dir = (Join-Path -Path $OutDir -ChildPath ("NetSetup")) + New-Item -ItemType directory -Path $dir | Out-Null + + $file = "NetSetup.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Test-Path $env:SystemRoot\System32\NetSetupMig.log", + "Test-Path $env:SystemRoot\Panther\setupact.log", + "Test-Path $env:SystemRoot\INF\setupapi.*", + "Test-Path $env:SystemRoot\logs\NetSetup" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + # Copy over the logs + [String []] $cmds = "$env:SystemRoot\System32\NetSetupMig.log", + "$env:SystemRoot\Panther\setupact.log", + "$env:SystemRoot\INF\setupapi.*", + "$env:SystemRoot\logs\NetSetup" + ForEach($cmd in $cmds) { + if (Test-Path $cmd) { + $tcmd = "Copy-Item $cmd $dir -recurse -verbose 4>&1" + ExecCommand -Trusted -Command ($tcmd) -Output $out + } + } +} # NetSetupDetail() + +function HNSDetail { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $dir = (Join-Path -Path $OutDir -ChildPath "HNS") + New-Item -ItemType Directory -Path $dir | Out-Null + + $file = "HNSRegistry-1.txt" + $out = (Join-Path $dir $file) + [String []] $cmds = "Get-ChildItem HKLM:\SYSTEM\CurrentControlSet\Services\hns -Recurse", + "Get-ChildItem HKLM:\SYSTEM\CurrentControlSet\Services\vmsmp -Recurse" + foreach ($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-HNSNetwork-1.txt" + $out = (Join-Path $dir $file) + [String []] $cmds = "Get-HNSNetwork | ConvertTo-Json -Depth 10", + "Get-HNSNetwork | Get-Member" + foreach ($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-HNSEndpoint-1.txt" + $out = (Join-Path $dir $file) + [String []] $cmds = "Get-HNSEndpoint | ConvertTo-Json -Depth 10", + "Get-HNSEndpoint | Get-Member" + foreach ($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + # HNS service stop -> start occurs after capturing the current HNS state info. + $hnsRunning = (Get-Service hns).Status -eq "Running" + try { + if ($hnsRunning) { + # Force stop to avoid command line prompt + net stop hns /y + } + + $file = "HNSData.txt" + $out = (Join-Path $dir $file) + [String []] $cmds = "Copy-Item ""$env:ProgramData\Microsoft\Windows\HNS\HNS.data"" $dir 4>&1" + foreach ($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + } finally { + if ($hnsRunning) { + net start hns + } + } + + + # Acquire all settings again after stop -> start services + $file = "HNSRegistry-2.txt" + $out = (Join-Path $dir $file) + [String []] $cmds = "Get-ChildItem HKLM:\SYSTEM\CurrentControlSet\Services\hns -Recurse", + "Get-ChildItem HKLM:\SYSTEM\CurrentControlSet\Services\vmsmp -Recurse" + foreach ($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-HNSNetwork-2.txt" + $out = (Join-Path $dir $file) + [String []] $cmds = "Get-HNSNetwork | ConvertTo-Json -Depth 10", + "Get-HNSNetwork | Get-Member" + foreach ($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-HNSEndpoint-2.txt" + $out = (Join-Path $dir $file) + [String []] $cmds = "Get-HNSEndpoint | ConvertTo-Json -Depth 10", + "Get-HNSEndpoint | Get-Member" + foreach ($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + + #netsh trace start scenario=Virtualization provider=Microsoft-Windows-tcpip provider=Microsoft-Windows-winnat capture=yes captureMultilayer=yes capturetype=both report=disabled tracefile=$dir\server.etl overwrite=yes + #Start-Sleep 120 + #netsh trace stop +} # HNSDetail() + +function QosDetail { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $dir = (Join-Path -Path $OutDir -ChildPath ("NetQoS")) + New-Item -ItemType directory -Path $dir | Out-Null + + $file = "Get-NetQosDcbxSetting.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetQosDcbxSetting", + "Get-NetQosDcbxSetting | Format-List -Property *", + "Get-NetQosDcbxSetting | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetQosDcbxSetting | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "Get-NetQosFlowControl.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetQosFlowControl", + "Get-NetQosFlowControl | Format-List -Property *", + "Get-NetQosFlowControl | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetQosFlowControl | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "Get-NetQosPolicy.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetQosPolicy", + "Get-NetQosPolicy | Format-List -Property *", + "Get-NetQosPolicy | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetQosPolicy | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "Get-NetQosTrafficClass.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-NetQosTrafficClass", + "Get-NetQosTrafficClass | Format-List -Property *", + "Get-NetQosTrafficClass | Format-Table -Property * -AutoSize | Out-String -Width $columns", + "Get-NetQosTrafficClass | Get-Member" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } +} # QosDetail() + +function ServicesDrivers { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $dir = (Join-Path -Path $OutDir -ChildPath ("ServicesDrivers")) + New-Item -ItemType directory -Path $dir | Out-Null + + $file = "sc.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "sc.exe queryex vmsp", + "sc.exe queryex vmsproxy" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "Get-Service.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-Service ""*"" | Sort-Object Name | Format-Table -AutoSize", + "Get-Service ""*"" | Sort-Object Name | Format-Table -Property * -AutoSize" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "Get-WindowsDriver.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-WindowsDriver -Online -All" # very slow, -Trusted to skip validation + ForEach($cmd in $cmds) { + ExecCommand -Trusted -Command $cmd -Output $out + } + + $file = "Get-WindowsEdition.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-WindowsEdition -Online" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "Get-WmiObject.Win32_PnPSignedDriver.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-WmiObject Win32_PnPSignedDriver| select devicename, driverversion" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } +} # ServicesDrivers() + +function NetshTrace { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $dir = (Join-Path -Path $OutDir -ChildPath ("Netsh")) + New-Item -ItemType directory -Path $dir | Out-Null + + <# Deprecated / DELETEME + #Figure out how to get this netsh rundown command executing under Powershell with logging... + $ndiswpp = "{DD7A21E6-A651-46D4-B7C2-66543067B869}" + $vmswpp = "{1F387CBC-6818-4530-9DB6-5F1058CD7E86}" + netsh trace start provider=$vmswpp level=1 keywords=0x00010000 provider=$ndiswpp level=1 keywords=0x02 correlation=disabled report=disabled overwrite=yes tracefile=$dir\NetRundown.etl + netsh trace stop + #> + + #$wpp_vswitch = "{1F387CBC-6818-4530-9DB6-5F1058CD7E86}" + #$wpp_ndis = "{DD7A21E6-A651-46D4-B7C2-66543067B869}" + + + # The sequence below triggers the ETW providers to dump their internal traces when the session starts. Thus allowing for capturing a + # snapshot of their logs/traces. + # + # NOTE: This does not cover IFR (in-memory) traces. More work needed to address said traces. + $file = "NetRundown.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "New-NetEventSession NetRundown -CaptureMode SaveToFile -LocalFilePath $dir\NetRundown.etl", + "Add-NetEventProvider ""{1F387CBC-6818-4530-9DB6-5F1058CD7E86}"" -SessionName NetRundown -Level 1 -MatchAnyKeyword 0x10000", + "Add-NetEventProvider ""{DD7A21E6-A651-46D4-B7C2-66543067B869}"" -SessionName NetRundown -Level 1 -MatchAnyKeyword 0x2", + "Start-NetEventSession NetRundown", + "Stop-NetEventSession NetRundown", + "Remove-NetEventSession NetRundown" + ForEach($cmd in $cmds) { + ExecCommand -Trusted -Command $cmd -Output $out + } + + # + # The ETL file can be converted to text using the following command: + # netsh trace convert NetRundown.etl tmfpath=\\winbuilds\release\RS_ONECORE_STACK_SDN_DEV1\15014.1001.170117-1700\amd64fre\symbols.pri\TraceFormat + # Specifying a path to the TMF symbols. Output is attached. + + $file = "NetshDump.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "netsh dump" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "NetshStatistics.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "netsh interface ipv4 show icmpstats", + "netsh interface ipv4 show ipstats", + "netsh interface ipv4 show tcpstats", + "netsh interface ipv4 show udpstats", + "netsh interface ipv6 show ipstats", + "netsh interface ipv6 show tcpstats", + "netsh interface ipv6 show udpstats" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + #NetSetup, binding map, setupact logs amongst other things needed by NDIS folks. + Write-Host "`n" + Write-Host "Processing..." + $file = "NetshTrace.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "netsh -?", + "netsh trace show scenarios", + "netsh trace show providers", + "netsh trace diagnose scenario=NetworkSnapshot mode=Telemetry saveSessionTrace=yes report=yes ReportFile=$dir\Snapshot.cab" + ForEach($cmd in $cmds) { + ExecCommand -Trusted -Command $cmd -Output $out + } +} # NetshTrace() + +function OneX { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $dir = (Join-Path -Path $OutDir -ChildPath ("OneX")) + New-Item -ItemType directory -Path $dir | Out-Null + + $file = "OneX.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "netsh lan show interface", + "netsh lan show profile" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } +} + +function Counters { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $dir = (Join-Path -Path $OutDir -ChildPath ("Counters")) + New-Item -ItemType directory -Path $dir | Out-Null + + $file = "CounterSetName.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-Counter -ListSet * | Sort-Object CounterSetName | Select-Object CounterSetName | Out-String -Width $columns" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "CounterSetName.Paths.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "(Get-Counter -ListSet * | Sort-Object CounterSetName).Paths | Out-String -Width $columns" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "CounterSetName.PathsWithInstances.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "(Get-Counter -ListSet * | Sort-Object CounterSetName).PathsWithInstances | Out-String -Width $columns" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "CounterSet.Property.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "(Get-Counter -ListSet * | Sort-Object CounterSetName) | Format-List -Property * | Out-String -Width $columns", + "(Get-Counter -ListSet * | Sort-Object CounterSetName) | Format-Table -Property * | Out-String -Width $columns" + ForEach($cmd in $cmds) { + ExecCommand -Command $cmd -Output $out + } + + $file = "CounterDetail" # used with 2 different extensions + $out = (Join-Path -Path $dir -ChildPath $file) + # Get paths for counters of interest + $cntrList = @("*Hyper*", "*vfp*", "*ip*", "*udp*", "*tcp*", "*icmp*", "*nat*", "*network*", "*rdma*", "*smb*", "*wfp*", "*Mellanox*", "*intel*") + $cntrPaths = Get-Counter -ListSet $cntrList -ErrorAction SilentlyContinue | Sort-Object CounterSetName | ForEach-Object { $_.Paths } + + Write-Host "Querying Perf Counters..." + # TODO should keep taking samples until all other jobs complete + $cntrReadings = Get-Counter -Counter $cntrPaths -MaxSamples 5 -SampleInterval 10 -ErrorAction SilentlyContinue + Write-Host "Exporting Results..." + $cntrReadings | Export-Counter -Path "$out.blg" -FileFormat BLG + $cntrReadings | Export-Counter -Path "$out.csv" -FileFormat CSV +} # Counters() + +function HwErrorReport { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $file = "WER.txt" + $out = (Join-Path -Path $OutDir -ChildPath $file) + [String []] $cmds = "copy-item $env:ProgramData\Microsoft\Windows\WER $outdir -recurse -verbose 4>&1" + ForEach($cmd in $cmds) { + ExecCommand -Trusted -Command ($cmd) -Output $out + } +} # HwErrorReport() + +function LogsReport { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $file = "WinEVT.txt" + $out = (Join-Path -Path $OutDir -ChildPath $file) + [String []] $cmds = "Copy-Item $env:SystemRoot\System32\winevt $outdir -Recurse -Verbose 4>&1" + ForEach($cmd in $cmds) { + ExecCommand -Trusted -Command ($cmd) -Output $out + } +} # LogsReport() + +function Metadata { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir, + [parameter(Mandatory=$true)] [Hashtable] $Params + ) + + $paramStr = if ($Params.Count -eq 0) {"None"} else {Write-Output @Params} + + $file = "Metadata.txt" + $out = (Join-Path -Path $OutDir -ChildPath $file) + [String []] $cmds = "Write-Output ""Version: $version"", ""Parameters: $paramStr"" | Out-String -Width $columns", + "Get-FileHash -Path $PSCommandPath -Algorithm ""SHA256"" | Format-List -Property * | Out-String -Width $columns" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } +} # Metadata() + +function Environment { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $file = "Environment.txt" + $out = (Join-Path -Path $OutDir -ChildPath $file) + [String []] $cmds = "Get-ItemProperty -Path ""HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion""", + "date", + #"Get-WinEvent -ProviderName eventlog | Where-Object {$_.Id -eq 6005 -or $_.Id -eq 6006}", + "wmic os get lastbootuptime", + "wmic cpu get name", + "systeminfo" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Verifier.txt" + $out = (Join-Path -Path $OutDir -ChildPath $file) + [String []] $cmds = "verifier /querysettings" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } +} # Environment() + +function HostInfo { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $file = "Get-HotFix.txt" + $out = (Join-Path -Path $OutDir -ChildPath $file) + [String []] $cmds = "get-hotfix | Sort-Object InstalledOn | Format-Table -AutoSize | Out-String -Width $columns", + "get-hotfix | Sort-Object InstalledOn | Format-Table -Property * -AutoSize | Out-String -Width $columns" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMHostSupportedVersion.txt" + $out = (Join-Path -Path $OutDir -ChildPath $file) + [String []] $cmds = "Get-VMHostSupportedVersion | Format-Table -AutoSize | Out-String -Width $columns", + "Get-VMHostSupportedVersion | Format-List -Property *" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + $file = "Get-VMHostNumaNode.txt" + $out = (Join-Path -Path $OutDir -ChildPath $file) + [String []] $cmds = "Get-VMHostNumaNode" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + + <# + $file = "Get-VMHostNumaNodeStatus.txt" + $out = (Join-Path -Path $OutDir -ChildPath $file) + [String []] $cmds = "Get-VMHostNumaNodeStatus" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + #> +} # HostInfo() + +function CustomModule { + [CmdletBinding()] + Param( + [parameter(Mandatory=$false)] [String[]] $Commands, + [parameter(Mandatory=$true)] [String] $OutDir + ) + + if ($Commands.Count -eq 0) { + return + } + + $dir = (Join-Path $OutDir "CustomModule") + New-Item -ItemType Directory -Path $dir | Out-Null + + $file = "ExtraCommands.txt" + $out = (Join-Path $dir $file) + foreach ($cmd in $Commands) { + ExecCommand -Command ($cmd -f $dir) -Output $out + } +} # CustomModule() + +# +# Setup & Validation Functions +# + +function CheckAdminPrivileges { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [Bool] $SkipAdminCheck + ) + + if (-not $SkipAdminCheck) { + # Yep, this is the easiest way to do this. + $isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") + if (-not $isAdmin) { + throw "Get-NetView : You do not have the required permission to complete this task. Please run this command in an Administrator PowerShell window or specify the -SkipAdminCheck option." + } + } +} # CheckAdminPrivileges() + +function NormalizeWorkDir { + [CmdletBinding()] + Param( + [parameter(Mandatory=$false)] [String] $OutputDirectory + ) + + # Output dir priority - $OutputDirectory, Desktop, Temp + $baseDir = if ($OutputDirectory) { + if (Test-Path $OutputDirectory) { + (Resolve-Path $OutputDirectory).Path # full path + } else { + throw "Get-NetView : The directory ""$OutputDirectory"" does not exist." + } + } elseif (($desktop = [Environment]::GetFolderPath("Desktop"))) { + $desktop + } else { + $env:TEMP + } + $workDirName = "msdbg.$env:COMPUTERNAME" + + return (Join-Path $baseDir $workDirName).TrimEnd("\") +} # NormalizeWorkDir() + +function EnvDestroy { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + If (Test-Path $OutDir) { + Remove-Item $OutDir -Recurse # Careful - Deletes $OurDir and all its contents + } +} # EnvDestroy() + +function EnvCreate { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + # Attempt to create working directory, fail gracefully otherwise + try { + New-Item -ItemType directory -Path $OutDir -ErrorAction Stop | Out-Null + } catch { + throw "Get-NetView : Failed to create directory ""$OutDir"" because " + $error[0] + } +} # EnvCreate() + +function EnvSetup { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + EnvDestroy $OutDir + EnvCreate $OutDir +} # EnvSetup() + +function CreateZip { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $Src, + [parameter(Mandatory=$true)] [String] $Out + ) + + If(Test-path $Out) { + Remove-item $Out + } + + Add-Type -assembly "system.io.compression.filesystem" + [io.compression.zipfile]::CreateFromDirectory($Src, $Out) +} # CreateZip() + + +function Sanity { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $OutDir + ) + + $dir = (Join-Path -Path $OutDir -ChildPath ("Sanity")) + New-Item -ItemType directory -Path $dir | Out-Null + + $file = "Get-ChildItem.txt" + $out = (Join-Path -Path $dir -ChildPath $file) + [String []] $cmds = "Get-ChildItem -Path $OutDir -Exclude $file -Recurse | Get-FileHash | Format-Table -AutoSize | Out-String -Width $columns" + ForEach($cmd in $cmds) { + ExecCommand -Command ($cmd) -Output $out + } + +} # Sanity() + +function Completion { + [CmdletBinding()] + Param( + [parameter(Mandatory=$true)] [String] $Src + ) + + $timestamp = $start | Get-Date -f yyyy.MM.dd_hh.mm.ss + + # Zip output folder + $outzip = "$Src-$timestamp.zip" + CreateZip -Src $Src -Out $outzip + + $dirs = (Get-ChildItem $Src -Recurse | Measure-Object -Property length -Sum) # out folder size + $hash = (Get-FileHash -Path $MyInvocation.PSCommandPath -Algorithm "SHA256").Hash # script hash + + # Display version and file save location + Write-Host "`n" + Write-Host "Diagnostics Data:" + Write-Host "-----------------" + Write-Host "Get-NetView" + Write-Host "Version: $version" + Write-Host "SHA256: $(if ($hash) {$hash} else {"N/A"})" + Write-Host "" + Write-Host $outzip + Write-Host "Size: $("{0:N2} MB" -f ((Get-Item $outzip).Length / 1MB))" + Write-Host "" + Write-Host $Src + Write-Host "Size: $("{0:N2} MB" -f ($dirs.sum / 1MB))" + Write-Host "Dirs: $((Get-ChildItem $Src -Directory -Recurse | Measure-Object).Count)" + Write-Host "Files: $((Get-ChildItem $Src -File -Recurse | Measure-Object).Count)" + Write-Host "" + Write-Host "Execution Time:" + Write-Host "---------------" + $delta = (Get-Date) - $Start + Write-Host "$($delta.Minutes) Min $($delta.Seconds) Sec" + Write-Host "`n" +} # Completion() + + +#=============================================== +# Main Program +#=============================================== +function Get-NetView { + [CmdletBinding()] + Param( + [parameter(Mandatory=$false)] + [ValidateScript({Test-Path $_ -PathType Container})] + [String] $OutputDirectory, + + [parameter(Mandatory=$false)] + [String[]] $ExtraCommands, + + [parameter(Mandatory=$false)] + [Switch] $SkipAdminCheck + ) + + $start = Get-Date + $version = "2018.05.03.0m" # Version within date context + + # Input Validation + CheckAdminPrivileges $SkipAdminCheck + $workDir = NormalizeWorkDir -OutputDirectory $OutputDirectory + + EnvSetup $workDir + Clear-Host + + # Start Run + try { + CustomModule -OutDir $workDir -Commands $ExtraCommands + + # concurrent execution of slow commands + $threads = if ($true) { + Start-Thread ${function:ServicesDrivers} -Params @{OutDir=$workDir} + Start-Thread ${function:NetshTrace} -Params @{OutDir=$workDir} + Start-Thread ${function:Counters} -Params @{OutDir=$workDir} + } + + Metadata -OutDir $workDir -Params $PSBoundParameters + Environment -OutDir $workDir + + NetworkSummary -OutDir $workDir + HwErrorReport -OutDir $workDir + LogsReport -OutDir $workDir + + NetSetupDetail -OutDir $workDir + VMSwitchDetail -OutDir $workDir + LbfoDetail -OutDir $workDir + NativeNicDetail -OutDir $workDir + OneX -OutDir $workDir + + QosDetail -OutDir $workDir + SMBDetail -OutDir $workDir + NetIp -OutDir $workDir + NetNat -OutDir $workDir + HNSDetail -OutDir $workDir + + # show thread output + $threads | foreach {StreamThread $_} + + # Tamper Detection + Sanity -OutDir $workDir + } catch { + throw $error[0] # try finally obfuscates error + } finally { + Write-Host "Removing background threads..." + $threads | foreach {Remove-Thread $_} + } + + Completion -Src $workDir +} # Get-NetView() diff --git a/newton-cn/bin/v1.0/Modules/NetDiagnostics/NetDiagnostics.psd1 b/newton-cn/bin/v1.0/Modules/NetDiagnostics/NetDiagnostics.psd1 new file mode 100644 index 0000000..afa3069 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetDiagnostics/NetDiagnostics.psd1 @@ -0,0 +1,122 @@ +# +# Module manifest for module 'Get-NetView' +# +# Generated by: Microsoft Corporation +# +# Generated on: 12/11/2017 +# + +@{ + +# Script module or binary module file associated with this manifest. +# RootModule = '' + +# Version number of this module. +ModuleVersion = '1.0.0.0' + +# Supported PSEditions +CompatiblePSEditions = @('Desktop') + +# ID used to uniquely identify this module +GUID = 'dfe3b632-99cf-4998-b06c-fdc71b4f2db3' + +# Author of this module +Author = 'Microsoft Corporation' + +# Company or vendor of this module +CompanyName = 'Microsoft Corporation' + +# Copyright statement for this module +Copyright = '© Microsoft Corporation. All rights reserved.' + +# Description of the functionality provided by this module +# Description = '' + +# Minimum version of the Windows PowerShell engine required by this module +PowerShellVersion = '5.1' + +# Name of the Windows PowerShell host required by this module +# PowerShellHostName = '' + +# Minimum version of the Windows PowerShell host required by this module +# PowerShellHostVersion = '' + +# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. +# DotNetFrameworkVersion = '' + +# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. +# CLRVersion = '' + +# Processor architecture (None, X86, Amd64) required by this module +# ProcessorArchitecture = '' + +# Modules that must be imported into the global environment prior to importing this module +# RequiredModules = @() + +# Assemblies that must be loaded prior to importing this module +# RequiredAssemblies = @() + +# Script files (.ps1) that are run in the caller's environment prior to importing this module. +# ScriptsToProcess = @() + +# Type files (.ps1xml) to be loaded when importing this module +# TypesToProcess = @() + +# Format files (.ps1xml) to be loaded when importing this module +# FormatsToProcess = @() + +# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess +NestedModules = @('Get-NetView.psm1') + +# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. +FunctionsToExport = @('Get-NetView') + +# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. +CmdletsToExport = @() + +# Variables to export from this module +VariablesToExport = '' + +# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. +AliasesToExport = @() + +# DSC resources to export from this module +# DscResourcesToExport = @() + +# List of all modules packaged with this module +# ModuleList = @() + +# List of all files packaged with this module +# FileList = @() + +# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. +PrivateData = @{ + + PSData = @{ + + # Tags applied to this module. These help with module discovery in online galleries. + # Tags = @() + + # A URL to the license for this module. + # LicenseUri = '' + + # A URL to the main website for this project. + # ProjectUri = '' + + # A URL to an icon representing this module. + # IconUri = '' + + # ReleaseNotes of this module + # ReleaseNotes = '' + + } # End of PSData hashtable + +} # End of PrivateData hashtable + +# HelpInfo URI of this module +# HelpInfoURI = '' + +# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. +# DefaultCommandPrefix = '' + +} diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventNetworkAdapter.cdxml b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventNetworkAdapter.cdxml new file mode 100644 index 0000000..04d6ad3 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventNetworkAdapter.cdxml @@ -0,0 +1,96 @@ + + + + 1.1 + NetEventNetworkAdapter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventNetworkAdapter.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventNetworkAdapter.format.ps1xml new file mode 100644 index 0000000..b0f64f9 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventNetworkAdapter.format.ps1xml @@ -0,0 +1,71 @@ + + + + + MSFT_NetEventNetworkAdapter_ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventNetworkAdapter + + + + + + + Name + + + InterfaceDescription + + + ProviderName + + + CaptureStatus + + + + + + + + MSFT_NetEventNetworkAdapter_TableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventNetworkAdapter + + + + + 10 + + + 15 + + + 15 + + + 10 + + + + + + + Name + + + InterfaceDescription + + + ProviderName + + + CaptureStatus + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventPacketCaptureProvider.cdxml b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventPacketCaptureProvider.cdxml new file mode 100644 index 0000000..b3bdcdd --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventPacketCaptureProvider.cdxml @@ -0,0 +1,199 @@ + + + + 1.0 + NetEventPacketCaptureProvider + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventPacketCaptureProvider.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventPacketCaptureProvider.format.ps1xml new file mode 100644 index 0000000..4974b5c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventPacketCaptureProvider.format.ps1xml @@ -0,0 +1,152 @@ + + + + + MSFT_NetEventPacketCaptureProvider_ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventPacketCaptureProvider + + + + + + + Name + + + SessionName + + + Level + + + MatchAnyKeyword + + + MatchAllKeyword + + + CaptureType + + + VmCaptureDirection + + + MultiLayer + + + LinkLayerAddress + + + EtherType + + + IpAddresses + + + IpProtocols + + + TruncationLength + + + + + + + + MSFT_NetEventPacketCaptureProvider_TableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventPacketCaptureProvider + + + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + + + + + Name + + + SessionName + + + Level + + + MatchAnyKeyword + + + MatchAllKeyword + + + CaptureType + + + VmCaptureDirection + + + MultiLayer + + + LinkLayerAddress + + + EtherType + + + IpAddresses + + + IpProtocols + + + TruncationLength + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventProvider.cdxml b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventProvider.cdxml new file mode 100644 index 0000000..61f3aba --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventProvider.cdxml @@ -0,0 +1,144 @@ + + + + 1.0 + NetEventProvider + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventProvider.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventProvider.format.ps1xml new file mode 100644 index 0000000..263b32e --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventProvider.format.ps1xml @@ -0,0 +1,80 @@ + + + + + MSFT_NetEventProvider_ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventProvider + + + + + + + Name + + + SessionName + + + Level + + + MatchAnyKeyword + + + MatchAllKeyword + + + + + + + + MSFT_NetEventProvider_TableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventProvider + + + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + + + + + Name + + + SessionName + + + Level + + + MatchAnyKeyword + + + MatchAllKeyword + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventSession.cdxml b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventSession.cdxml new file mode 100644 index 0000000..9de435a --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventSession.cdxml @@ -0,0 +1,163 @@ + + + + 1.0 + NetEventSession + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventSession.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventSession.format.ps1xml new file mode 100644 index 0000000..65342cc --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventSession.format.ps1xml @@ -0,0 +1,98 @@ + + + + + MSFT_NetEventSession_ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventSession + + + + + + + Name + + + CaptureMode + + + LocalFilePath + + + MaxFileSize + + + TraceBufferSize + + + MaxNumberOfBuffers + + + SessionStatus + + + + + + + + MSFT_NetEventSession_TableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventSession + + + + + 10 + + + 15 + + + 15 + + + 17 + + + 14 + + + 8 + + + 10 + + + + + + + Name + + + CaptureMode + + + LocalFilePath + + + MaxFileSize + + + TraceBufferSize + + + MaxNumberOfBuffers + + + SessionStatus + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVFPProvider.cdxml b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVFPProvider.cdxml new file mode 100644 index 0000000..e32b38e --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVFPProvider.cdxml @@ -0,0 +1,294 @@ + + + + 1.0 + NetEventVFPProvider + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVFPProvider.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVFPProvider.format.ps1xml new file mode 100644 index 0000000..7e7ee55 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVFPProvider.format.ps1xml @@ -0,0 +1,194 @@ + + + + + MSFT_NetEventVFPProvider_ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventVFPProvider + + + + + + + SessionName + + + Level + + + MatchAnyKeyword + + + MatchAllKeyword + + + DestinationMACAddresses + + + SourceMACAddresses + + + VLANIds + + + GREKeys + + + TenantIds + + + SourceIPAddresses + + + DestinationIPAddresses + + + IPProtocols + + + TCPPorts + + + UDPPorts + + + VFPFlowDirection + + + SwitchName + + + PortIds + + + + + + + + MSFT_NetEventVFPProvider_TableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventVFPProvider + + + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + + + + + Name + + + SessionName + + + Level + + + MatchAnyKeyword + + + MatchAllKeyword + + + DestinationMACAddresses + + + SourceMACAddresses + + + VLANIds + + + GREKeys + + + TenantIds + + + SourceIPAddresses + + + DestinationIPAddresses + + + IPProtocols + + + TCPPorts + + + UDPPorts + + + VFPFlowDirection + + + SwitchName + + + PortIds + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVmNetworkAdatper.cdxml b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVmNetworkAdatper.cdxml new file mode 100644 index 0000000..d5d5538 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVmNetworkAdatper.cdxml @@ -0,0 +1,85 @@ + + + + 1.0 + NetEventVmNetworkAdapter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVmNetworkAdatper.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVmNetworkAdatper.format.ps1xml new file mode 100644 index 0000000..4979229 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVmNetworkAdatper.format.ps1xml @@ -0,0 +1,98 @@ + + + + + MSFT_NetEventVmNetworkAdapter_ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventVmNetworkAdapter + + + + + + + Name + + + ProviderName + + + MacAddress + + + SwitchName + + + PortName + + + VMName + + + CaptureStatus + + + + + + + + MSFT_NetEventVmNetworkAdapter_TableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventVmNetworkAdapter + + + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + + + + + Name + + + ProviderName + + + MacAddress + + + SwitchName + + + PortName + + + VMName + + + CaptureStatus + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitch.cdxml b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitch.cdxml new file mode 100644 index 0000000..c28520a --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitch.cdxml @@ -0,0 +1,85 @@ + + + + 1.0 + NetEventVmSwitch + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitch.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitch.format.ps1xml new file mode 100644 index 0000000..d58ca7d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitch.format.ps1xml @@ -0,0 +1,62 @@ + + + + + MSFT_NetEventVmSwitch_ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventVmSwitch + + + + + + + Name + + + ProviderName + + + CaptureStatus + + + + + + + + MSFT_NetEventVmSwitch_TableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventVmSwitch + + + + + 10 + + + 15 + + + 10 + + + + + + + Name + + + ProviderName + + + CaptureStatus + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitchProvider.cdxml b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitchProvider.cdxml new file mode 100644 index 0000000..18c4a67 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitchProvider.cdxml @@ -0,0 +1,133 @@ + + + + 1.0 + NetEventVmSwitchProvider + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitchProvider.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitchProvider.format.ps1xml new file mode 100644 index 0000000..7199a29 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventVmSwitchProvider.format.ps1xml @@ -0,0 +1,95 @@ + + + + + MSFT_NetEventVmSwitchProvider_ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventVmSwitchProvider + + + + + + + SessionName + + + Level + + + MatchAnyKeyword + + + MatchAllKeyword + + + SwitchName + + + PortIds + + + + + + + + MSFT_NetEventVmSwitchProvider_TableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventVmSwitchProvider + + + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + + + + + Name + + + SessionName + + + Level + + + MatchAnyKeyword + + + MatchAllKeyword + + + SwitchName + + + PortIds + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventWFPCaptureProvider.cdxml b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventWFPCaptureProvider.cdxml new file mode 100644 index 0000000..862d051 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventWFPCaptureProvider.cdxml @@ -0,0 +1,147 @@ + + + + 1.0 + NetEventWFPCaptureProvider + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventWFPCaptureProvider.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventWFPCaptureProvider.format.ps1xml new file mode 100644 index 0000000..c059bfd --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/MSFT_NetEventWFPCaptureProvider.format.ps1xml @@ -0,0 +1,115 @@ + + + + + MSFT_NetEventWFPCaptureProvider_ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventWFPCaptureProvider + + + + + + + Name + + + SessionName + + + Level + + + MatchAnyKeyword + + + MatchAllKeyword + + + CaptureLayerSet + + + IPAddresses + + + TCPPorts + + + UDPPorts + + + + + + + MSFT_NetEventWFPCaptureProvider_TableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetEventWFPCaptureProvider + + + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + 10 + + + + + + + Name + + + SessionName + + + Level + + + MatchAnyKeyword + + + MatchAllKeyword + + + CaptureLayerSet + + + IPAddresses + + + TCPPorts + + + UDPPorts + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/NetEventPacketCapture.Types.ps1xml b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/NetEventPacketCapture.Types.ps1xml new file mode 100644 index 0000000..b6faac8 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/NetEventPacketCapture.Types.ps1xml @@ -0,0 +1,140 @@ + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetEventSession + + + CaptureMode + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetEventPacketCapture.CaptureModes]($this.PSBase.CimInstanceProperties['CaptureMode'].Value) + + + param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetEventPacketCapture.CaptureModes]$value) + $this.PSBase.CimInstanceProperties['CaptureMode'].Value = [System.Byte]$value + + + + MaxFileSize + + "" + $this.PSBase.CimInstanceProperties['MaxFileSize'].Value + " MB" + + + + TraceBufferSize + + "" + $this.PSBase.CimInstanceProperties['TraceBufferSize'].Value + " KB" + + + + MaxNumberOfBuffers + + $this.PSBase.CimInstanceProperties['MaxNumberOfBuffers'].Value + + + + SessionStatus + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetEventPacketCapture.ESessionStatus]($this.PSBase.CimInstanceProperties['SessionStatus'].Value) + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetEventProvider + + + MatchAnyKeyword + + "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAnyKeyword'].Value + + + + MatchAllKeyword + + "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAllKeyword'].Value + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetEventPacketCaptureProvider + + + MatchAnyKeyword + + "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAnyKeyword'].Value + + + + MatchAllKeyword + + "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAllKeyword'].Value + + + + CaptureType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetEventPacketCapture.CaptureType]($this.PSBase.CimInstanceProperties['CaptureType'].Value) + + + param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetEventPacketCapture.CaptureType]$value) + $this.PSBase.CimInstanceProperties['CaptureType'].Value = [System.Byte]$value + + + + VmCaptureDirection + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetEventPacketCapture.VmCaptureDirection]($this.PSBase.CimInstanceProperties['VmCaptureDirection'].Value) + + + param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetEventPacketCapture.VmCaptureDirection]$value) + $this.PSBase.CimInstanceProperties['VmCaptureDirection'].Value = [System.Byte]$value + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetEventVFPProvider + + + MatchAnyKeyword + + "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAnyKeyword'].Value + + + + MatchAllKeyword + + "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAllKeyword'].Value + + + + VFPFlowDirection + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetEventPacketCapture.VFPFlowDirection]($this.PSBase.CimInstanceProperties['VFPFlowDirection'].Value) + + + param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetEventPacketCapture.VFPFlowDirection]$value) + $this.PSBase.CimInstanceProperties['VFPFlowDirection'].Value = [System.UInt32]$value + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetEventVmSwitchProvider + + + MatchAnyKeyword + + "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAnyKeyword'].Value + + + + MatchAllKeyword + + "0x{0:X0}" -f $this.PSBase.CimInstanceProperties['MatchAllKeyword'].Value + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/NetEventPacketCapture.psd1 b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/NetEventPacketCapture.psd1 new file mode 100644 index 0000000..e417155 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetEventPacketCapture/NetEventPacketCapture.psd1 @@ -0,0 +1,74 @@ +@{ + GUID = "7E984F2F-35DA-48A2-A3C1-40CE59930A7C" + Author = "Microsoft Corporation" + CompanyName = "Microsoft Corporation" + Copyright = "© Microsoft Corporation. All rights reserved." + ModuleVersion = "1.0.0.0" + PowerShellVersion = '5.1' + HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=532774" + + NestedModules = @( + 'MSFT_NetEventSession.cdxml', + 'MSFT_NetEventProvider.cdxml', + 'MSFT_NetEventPacketCaptureProvider.cdxml', + 'MSFT_NetEventNetworkAdapter.cdxml', + 'MSFT_NetEventVmSwitch.cdxml', + 'MSFT_NetEventVmNetworkAdatper.cdxml', + 'MSFT_NetEventWFPCaptureProvider.cdxml', + 'MSFT_NetEventVFPProvider.cdxml', + 'MSFT_NetEventVmSwitchProvider.cdxml') + + FormatsToProcess = @( + 'MSFT_NetEventSession.format.ps1xml', + 'MSFT_NetEventProvider.format.ps1xml', + 'MSFT_NetEventPacketCaptureProvider.format.ps1xml', + 'MSFT_NetEventNetworkAdapter.format.ps1xml', + 'MSFT_NetEventVmSwitch.format.ps1xml', + 'MSFT_NetEventVmNetworkAdatper.format.ps1xml', + 'MSFT_NetEventVFPProvider.format.ps1xml', + 'MSFT_NetEventVmSwitchProvider.format.ps1xml') + + TypesToProcess = @('NetEventPacketCapture.Types.ps1xml') + + FunctionsToExport = @( + 'New-NetEventSession', + 'Remove-NetEventSession', + 'Get-NetEventSession', + 'Set-NetEventSession', + 'Start-NetEventSession', + 'Stop-NetEventSession', + 'Add-NetEventProvider', + 'Remove-NetEventProvider', + 'Get-NetEventProvider', + 'Set-NetEventProvider', + 'Add-NetEventPacketCaptureProvider', + 'Remove-NetEventPacketCaptureProvider', + 'Get-NetEventPacketCaptureProvider', + 'Set-NetEventPacketCaptureProvider', + 'Add-NetEventNetworkAdapter', + 'Remove-NetEventNetworkAdapter', + 'Get-NetEventNetworkAdapter', + 'Add-NetEventVmNetworkAdapter', + 'Remove-NetEventVmNetworkAdapter', + 'Get-NetEventVmNetworkAdapter', + 'Add-NetEventVmSwitch', + 'Remove-NetEventVmSwitch', + 'Get-NetEventVmSwitch', + 'Add-NetEventWFPCaptureProvider', + 'Remove-NetEventWFPCaptureProvider', + 'Get-NetEventWFPCaptureProvider', + 'Set-NetEventWFPCaptureProvider', + 'Add-NetEventVFPProvider', + 'Remove-NetEventVFPProvider', + 'Get-NetEventVFPProvider', + 'Set-NetEventVFPProvider', + 'Add-NetEventVmSwitchProvider', + 'Remove-NetEventVmSwitchProvider', + 'Get-NetEventVmSwitchProvider', + 'Set-NetEventVmSwitchProvider') + + CmdletsToExport = @() + + AliasesToExport = @() + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/NetLbfo/MSFT_NetLbfoTeam.cdxml b/newton-cn/bin/v1.0/Modules/NetLbfo/MSFT_NetLbfoTeam.cdxml new file mode 100644 index 0000000..08588b1 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetLbfo/MSFT_NetLbfoTeam.cdxml @@ -0,0 +1,161 @@ + + + + 1.0 + NetLbfoTeam + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetLbfo/MSFT_NetLbfoTeam.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetLbfo/MSFT_NetLbfoTeam.format.ps1xml new file mode 100644 index 0000000..3079479 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetLbfo/MSFT_NetLbfoTeam.format.ps1xml @@ -0,0 +1,95 @@ + + + + + MSFT_NetLbfoTeam_ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetLbfoTeam + + + + + + + Name + + + Members + + + TeamNics + + + TeamingMode + + + LoadBalancingAlgorithm + + + + ($_.LacpTimer -ne $null) + + LacpTimer + + + Status + + + + + + + + MSFT_NetLbfoTeam_TableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetLbfoTeam + + + + + 10 + + + 15 + + + 15 + + + 17 + + + 14 + + + 8 + + + + + + + Name + + + Members + + + TeamNics + + + TeamingMode + + + LoadBalancingAlgorithm + + + Status + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetLbfo/MSFT_NetLbfoTeamMember.cdxml b/newton-cn/bin/v1.0/Modules/NetLbfo/MSFT_NetLbfoTeamMember.cdxml new file mode 100644 index 0000000..877aaf3 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetLbfo/MSFT_NetLbfoTeamMember.cdxml @@ -0,0 +1,120 @@ + + + + 1.0 + NetLbfoTeamMember + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetLbfo/MSFT_NetLbfoTeamMember.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetLbfo/MSFT_NetLbfoTeamMember.format.ps1xml new file mode 100644 index 0000000..6829773 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetLbfo/MSFT_NetLbfoTeamMember.format.ps1xml @@ -0,0 +1,125 @@ + + + + + MSFT_NetLbfoTeamMember_ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetLbfoTeamMember + + + + + + + Name + + + InterfaceDescription + + + Team + + + AdministrativeMode + + + OperationalStatus + + + + $_.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value -lt 1000000000 + + TransmitLinkSpeed(Mbps) + + + + $_.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value -ge 1000000000 + + TransmitLinkSpeed(Gbps) + + + + $_.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value -lt 1000000000 + + ReceiveLinkSpeed(Mbps) + + + + $_.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value -ge 1000000000 + + ReceiveLinkSpeed(Gbps) + + + FailureReason + + + + + + + + MSFT_NetLbfoTeamMember_TableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetLbfoTeamMember + + + + + 12 + + + 15 + + + 10 + + + 7 + + + 7 + + + 11 + + + 11 + + + 12 + + + + + + + Name + + + InterfaceDescription + + + Team + + + AdministrativeMode + + + OperationalStatus + + + TransmitLinkSpeed + + + ReceiveLinkSpeed + + + FailureReason + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetLbfo/MSFT_NetLbfoTeamNic.cdxml b/newton-cn/bin/v1.0/Modules/NetLbfo/MSFT_NetLbfoTeamNic.cdxml new file mode 100644 index 0000000..2b4c168 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetLbfo/MSFT_NetLbfoTeamNic.cdxml @@ -0,0 +1,101 @@ + + + + 1.0 + NetLbfoTeamNic + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetLbfo/MSFT_NetLbfoTeamNic.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetLbfo/MSFT_NetLbfoTeamNic.format.ps1xml new file mode 100644 index 0000000..9ab962d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetLbfo/MSFT_NetLbfoTeamNic.format.ps1xml @@ -0,0 +1,125 @@ + + + + + MSFT_NetLbfoTeamNic_ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetLbfoTeamNic + + + + + + + Name + + + InterfaceDescription + + + Team + + + VlanID + + + Primary + + + Default + + + + $_.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value -lt 1000000000 + + TransmitLinkSpeed(Mbps) + + + + $_.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value -ge 1000000000 + + TransmitLinkSpeed(Gbps) + + + + $_.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value -lt 1000000000 + + ReceiveLinkSpeed(Mbps) + + + + $_.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value -ge 1000000000 + + ReceiveLinkSpeed(Gbps) + + + + + + + + MSFT_NetLbfoTeamNic_TableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetLbfoTeamNic + + + + + 12 + + + 15 + + + 10 + + + 6 + + + 7 + + + 7 + + + 11 + + + 11 + + + + + + + Name + + + InterfaceDescription + + + Team + + + VlanID + + + Primary + + + Default + + + TransmitLinkSpeed + + + ReceiveLinkSpeed + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetLbfo/NetLbfo.Types.ps1xml b/newton-cn/bin/v1.0/Modules/NetLbfo/NetLbfo.Types.ps1xml new file mode 100644 index 0000000..a000a87 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetLbfo/NetLbfo.Types.ps1xml @@ -0,0 +1,247 @@ + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetLbfoTeam + + + Members + + $members = Get-NetLbfoTeamMember -TeamOfTheMember $this + $mnames= @() + foreach($m in @($members)){$mnames += $m.Name} + $mnames + + + + + TeamNics + + $tnics = Get-NetLbfoTeamNic -TeamOfTheTeamNic $this + $tnames= @() + foreach($t in @($tnics)){$tnames += $t.Name} + $tnames + + + + + TeamingMode + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.TeamingModes]($this.PSBase.CimInstanceProperties['TeamingMode'].Value) + + + param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.TeamingModes]$value) + $this.PSBase.CimInstanceProperties['TeamingMode'].Value = [System.UInt32]$value + + + + + LoadBalancingAlgorithm + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.LBAlgos]($this.PSBase.CimInstanceProperties['LoadBalancingAlgorithm'].Value) + + + param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.LBAlgos]$value) + $this.PSBase.CimInstanceProperties['LoadBalancingAlgorithm'].Value = [System.UInt32]$value + + + + + LacpTimer + + $lacpTimer = $this.PSBase.CimInstanceProperties['LacpTimer'].Value + if($lacpTimer -ne $null) + { + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.LacpTimers]$lacpTimer + } + else + { + $null + } + + + param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.LacpTimers]$value) + $this.PSBase.CimInstanceProperties['LacpTimer'].Value = [System.UInt32]$value + + + + + Status + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.TeamStatus]($this.PSBase.CimInstanceProperties['Status'].Value) + + + + + tm + TeamingMode + + + + lba + LoadBalancingAlgorithm + + + + lt + LacpTimer + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetLbfoTeamMember + + + AdministrativeMode + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.AdminModes]($this.PSBase.CimInstanceProperties['AdministrativeMode'].Value) + + + param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.AdminModes]$value) + $this.PSBase.CimInstanceProperties['AdministrativeMode'].Value = [System.UInt32]$value + + + + + OperationalStatus + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.OperationalModes]($this.PSBase.CimInstanceProperties['OperationalMode'].Value) + + + + + FailureReason + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetLbfo.FailureReasons]($this.PSBase.CimInstanceProperties['FailureReason'].Value) + + + + + TransmitLinkSpeed + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-LinkSpeed $this.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value + + + + + TransmitLinkSpeed(Mbps) + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + $val = $this.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value / 1000000 + Format-LinkSpeed $val 1 $false + + + + + TransmitLinkSpeed(Gbps) + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + $val = $this.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value / 1000000000 + Format-LinkSpeed $val 1 $false + + + + + ReceiveLinkSpeed + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-LinkSpeed $this.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value + + + + + ReceiveLinkSpeed(Mbps) + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + $val = $this.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value / 1000000 + Format-LinkSpeed $val 1 $false + + + + + ReceiveLinkSpeed(Gbps) + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + $val = $this.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value / 1000000000 + Format-LinkSpeed $val 1 $false + + + + + am + AdministrativeMode + + + ifAlias + Name + + + InterfaceAlias + Name + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetLbfoTeamNic + + + TransmitLinkSpeed + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-LinkSpeed $this.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value + + + + TransmitLinkSpeed(Mbps) + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + $val = $this.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value / 1000000 + Format-LinkSpeed $val 1 $false + + + + TransmitLinkSpeed(Gbps) + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + $val = $this.PSBase.CimInstanceProperties['TransmitLinkSpeed'].Value / 1000000000 + Format-LinkSpeed $val 1 $false + + + + ReceiveLinkSpeed + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + Format-LinkSpeed $this.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value + + + + ReceiveLinkSpeed(Mbps) + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + $val = $this.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value / 1000000 + Format-LinkSpeed $val 1 $false + + + + ReceiveLinkSpeed(Gbps) + + Import-Module NetAdapter\NetAdapter.Format.Helper.psm1 + $val = $this.PSBase.CimInstanceProperties['ReceiveLinkSpeed'].Value / 1000000000 + Format-LinkSpeed $val 1 $false + + + + + ifAlias + Name + + + + InterfaceAlias + Name + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetLbfo/NetLbfo.psd1 b/newton-cn/bin/v1.0/Modules/NetLbfo/NetLbfo.psd1 new file mode 100644 index 0000000..239cca8 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetLbfo/NetLbfo.psd1 @@ -0,0 +1,30 @@ +@{ + GUID = "80cf4c6d-30b7-4b0f-a035-dbb23a65ef1d" + Author = "Microsoft Corporation" + CompanyName = "Microsoft Corporation" + Copyright = "© Microsoft Corporation. All rights reserved." + HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=285763" + ModuleVersion = "2.0.0.0" + PowerShellVersion = '5.1' + NestedModules = @('MSFT_NetLbfoTeam.cdxml', 'MSFT_NetLbfoTeamMember.cdxml', 'MSFT_NetLbfoTeamNic.cdxml') + FormatsToProcess = @('MSFT_NetLbfoTeam.format.ps1xml', 'MSFT_NetLbfoTeamMember.format.ps1xml', 'MSFT_NetLbfoTeamNic.format.ps1xml') + TypesToProcess = @('NetLbfo.Types.ps1xml') + FunctionsToExport = @( + 'Add-NetLbfoTeamMember', + 'Add-NetLbfoTeamNic', + 'Get-NetLbfoTeam', + 'Get-NetLbfoTeamMember', + 'Get-NetLbfoTeamNic', + 'New-NetLbfoTeam', + 'Remove-NetLbfoTeam', + 'Remove-NetLbfoTeamMember', + 'Remove-NetLbfoTeamNic', + 'Rename-NetLbfoTeam', + 'Set-NetLbfoTeam', + 'Set-NetLbfoTeamMember', + 'Set-NetLbfoTeamNic' + ) + CmdletsToExport = @() + AliasesToExport = @() + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNat.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNat.Format.ps1xml new file mode 100644 index 0000000..c0d417b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNat.Format.ps1xml @@ -0,0 +1,209 @@ + + + + + + MSFT_NetNat_Listview + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNat + + + + + + + Name + + + ExternalIPInterfaceAddressPrefix + + + InternalIPInterfaceAddressPrefix + + + IcmpQueryTimeout + + + TcpEstablishedConnectionTimeout + + + TcpTransientConnectionTimeout + + + TcpFilteringBehavior + + + UdpFilteringBehavior + + + UdpIdleSessionTimeout + + + UdpInboundRefresh + + + Store + + + Active + + + + + + + + + MSFT_NetNatExternalIPAddress_Listview + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNatExternalAddress + + + + + + + ExternalAddressID + + + NatName + + + IPAddress + + + PortStart + + + PortEnd + + + Active + + + + + + + + + MSFT_NetNatExternalIPAddressMapping_Listview + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNatStaticMapping + + + + + + + StaticMappingID + + + NatName + + + Protocol + + + RemoteExternalIPAddressPrefix + + + ExternalIPAddress + + + ExternalPort + + + InternalIPAddress + + + InternalPort + + + InternalRoutingDomainId + + + Active + + + + + + + + + MSFT_NetNatSession_Listview + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNatSession + + + + + + + NatName + + + InternalRoutingDomainId + + + CreationTime + + + Protocol + + + InternalSourceAddress + + + InternalSourcePort + + + InternalDestinationAddress + + + InternalDestinationPort + + + ExternalSourceAddress + + + ExternalSourcePort + + + ExternalDestinationAddress + + + ExternalDestinationPort + + + + + + + + + MSFT_NetNatGlobal_Listview + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNatGlobal + + + + + + + InterRoutingDomainHairpinningMode + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNat.Types.ps1xml b/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNat.Types.ps1xml new file mode 100644 index 0000000..ec71cd8 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNat.Types.ps1xml @@ -0,0 +1,123 @@ + + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNat + + + Store + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.PolicyStore]($this.PSBase.CimInstanceProperties['Store'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Store'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.PolicyStore]$newValue + + + + TcpFilteringBehavior + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.FilteringBehaviorType]($this.PSBase.CimInstanceProperties['TcpFilteringBehavior'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['TcpFilteringBehavior'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.FilteringBehaviorType]$newValue + + + + UdpFilteringBehavior + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.FilteringBehaviorType]($this.PSBase.CimInstanceProperties['UdpFilteringBehavior'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['UdpFilteringBehavior'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.FilteringBehaviorType]$newValue + + + + UdpInboundRefresh + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.Boolean]($this.PSBase.CimInstanceProperties['UdpInboundRefresh'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['UdpInboundRefresh'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.Boolean]$newValue + + + + Active + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.Boolean]($this.PSBase.CimInstanceProperties['Active'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Active'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.Boolean]$newValue + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNatStaticMapping + + + Protocol + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNatStaticMapping.Protocol]($this.PSBase.CimInstanceProperties['Protocol'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Protocol'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNatStaticMapping.Protocol]$newValue + + + + Active + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.Boolean]($this.PSBase.CimInstanceProperties['Active'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Active'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.Boolean]$newValue + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNatExternalAddress + + + Active + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.Boolean]($this.PSBase.CimInstanceProperties['Active'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Active'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNat.Boolean]$newValue + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNatGlobal + + + InterRoutingDomainHairpinningMode + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNatGlobal.InterRoutingDomainHairpinningMode]($this.PSBase.CimInstanceProperties['InterRoutingDomainHairpinningMode'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['InterRoutingDomainHairpinningMode'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNatGlobal.InterRoutingDomainHairpinningMode]$newValue + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNat.cdxml b/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNat.cdxml new file mode 100644 index 0000000..179442b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNat.cdxml @@ -0,0 +1,131 @@ + + + + 1.0 + NetNat + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNatExternalAddress.cdxml b/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNatExternalAddress.cdxml new file mode 100644 index 0000000..7624655 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNatExternalAddress.cdxml @@ -0,0 +1,77 @@ + + + + 1.0 + NetNatExternalAddress + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNatGlobal.cdxml b/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNatGlobal.cdxml new file mode 100644 index 0000000..27d6a3f --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNatGlobal.cdxml @@ -0,0 +1,34 @@ + + + + 1.0 + NetNatGlobal + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNatSession.cdxml b/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNatSession.cdxml new file mode 100644 index 0000000..e9b8dde --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNatSession.cdxml @@ -0,0 +1,15 @@ + + + + 1.0 + NetNatSession + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNatStaticMapping.cdxml b/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNatStaticMapping.cdxml new file mode 100644 index 0000000..72d50a2 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetNat/MSFT_NetNatStaticMapping.cdxml @@ -0,0 +1,99 @@ + + + + 1.0 + NetNatStaticMapping + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetNat/NetNat.psd1 b/newton-cn/bin/v1.0/Modules/NetNat/NetNat.psd1 new file mode 100644 index 0000000..e568d15 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetNat/NetNat.psd1 @@ -0,0 +1,34 @@ +@{ + GUID = 'E5439F56-42AA-4FDF-8705-50C782A89345' + Author = "Microsoft Corporation" + CompanyName = "Microsoft Corporation" + Copyright = "© Microsoft Corporation. All rights reserved." + ModuleVersion = '1.0.0.0' + PowerShellVersion = '5.1' + NestedModules = @( + 'MSFT_NetNat.cdxml', + 'MSFT_NetNatExternalAddress.cdxml', + 'MSFT_NetNatStaticMapping.cdxml', + 'MSFT_NetNatSession.cdxml' + 'MSFT_NetNatGlobal.cdxml' + ) + FormatsToProcess = @('MSFT_NetNat.Format.ps1xml') + TypesToProcess = @('MSFT_NetNat.Types.ps1xml') + HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=285219" + FunctionsToExport = @( + 'Get-NetNat', + 'Get-NetNatExternalAddress', + 'Get-NetNatStaticMapping', + 'Get-NetNatSession', + 'Get-NetNatGlobal', + 'Set-NetNat', + 'Set-NetNatGlobal', + 'New-NetNat', + 'Add-NetNatExternalAddress', + 'Add-NetNatStaticMapping', + 'Remove-NetNat', + 'Remove-NetNatExternalAddress', + 'Remove-NetNatStaticMapping' + ) + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/NetQos/MSFT_NetQosPolicy.Format.Helper.psm1 b/newton-cn/bin/v1.0/Modules/NetQos/MSFT_NetQosPolicy.Format.Helper.psm1 new file mode 100644 index 0000000..9879fff --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetQos/MSFT_NetQosPolicy.Format.Helper.psm1 @@ -0,0 +1,25 @@ +<# + +Copyright (c) 2011 Microsoft Corporation. All Rights Reserved. + +Module Name: + + MSFT_NetQosPolicy.Format.Helper.psm1 + +Description: + + Provides helper routines for formatting the output of NetQosPolicy cmdlets. + +#> + +function Format-NetQosPolicySpeed( + $Value, $Precision = 0 +) +{ + $Postfixes = @("Bits", "KBits", "MBits", "GBits", "TBits") + for ($i = 0; $Value -ge 1000 -and $i -lt $Postfixes.Length - 1; $i++) { + $Value /= 1000 + } + $Value = [Math]::Round([Decimal]$Value, $Precision) + return "$($Value) $($Postfixes[$i])/sec" +} diff --git a/newton-cn/bin/v1.0/Modules/NetQos/MSFT_NetQosPolicy.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetQos/MSFT_NetQosPolicy.Format.ps1xml new file mode 100644 index 0000000..7bc35af --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetQos/MSFT_NetQosPolicy.Format.ps1xml @@ -0,0 +1,149 @@ + + + + + MSFT_NetQosPolicy ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetQosPolicySettingData + + + + + + + Name + + + Owner + + + NetworkProfile + + + Precedence + + + + $_.UserMatchCondition -ne $null + + User + + + + ($_.AppPathNameMatchCondition -ne $null) -and $_.AppPathNameMatchCondition[0] + + AppPathName + + + + ($_.TemplateMatchCondition -ne $null) -and ($_.TemplateMatchCondition -ne 0) + + Template + + + + ($_.JobObjectMatchCondition -ne $null) -and ($_.JobObjectMatchCondition -ne 0) + + JobObject + + + + ($_.NetDirectPortMatchCondition -ne $null) -and ($_.NetDirectPortMatchCondition -ne 0) + + NetDirectPort + + + + ($_.IPProtocolMatchCondition -ne $null) -and ($_.IPProtocolMatchCondition -ne 0) + + IPProtocol + + + + ($_.IPPortMatchCondition -ne $null) -and ($_.IPPortMatchCondition -ne 0) + + IPPort + + + + ($_.IPSrcPrefixMatchCondition -ne $null) -and $_.IPSrcPrefixMatchCondition[0] + + IPSrcPrefix + + + + ($_.IPSrcPortStartMatchCondition -ne $null) -and ($_.IPSrcPortStartMatchCondition -ne 0) + + IPSrcPortStart + + + + ($_.IPSrcPortStartMatchCondition -ne $null) -and ($_.IPSrcPortStartMatchCondition -ne 0) + + IPSrcPortEnd + + + + ($_.IPDstPrefixMatchCondition -ne $null) -and $_.IPDstPrefixMatchCondition[0] + + IPDstPrefix + + + + ($_.IPDstPortStartMatchCondition -ne $null) -and ($_.IPDstPortStartMatchCondition -ne 0) + + IPDstPortStart + + + + ($_.IPDstPortStartMatchCondition -ne $null) -and ($_.IPDstPortStartMatchCondition -ne 0) + + IPDstPortEnd + + + + $_.URIMatchCondition -ne $null + + URI + + + + $_.URIMatchCondition -ne $null + + URIRecursive + + + + ($_.PriorityValue8021Action -ne $null) -and ($_.PriorityValue8021Action -ne -1) + + PriorityValue + + + + ($_.DSCPAction -ne $null) -and ($_.DSCPAction -ne -1) + + DSCPValue + + + + ($_.MinBandwidthWeightAction -ne $null) -and ($_.MinBandwidthWeightAction -ne 0) + + MinBandwidthWeight + + + + ($_.ThrottleRateAction -ne $null) -and ($_.ThrottleRateAction -ne 0) + + + + Import-Module NetQos\MSFT_NetQosPolicy.Format.Helper.psm1 + Format-NetQosPolicySpeed $_.ThrottleRateAction 3 + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetQos/MSFT_NetQosPolicy.Types.ps1xml b/newton-cn/bin/v1.0/Modules/NetQos/MSFT_NetQosPolicy.Types.ps1xml new file mode 100644 index 0000000..807e0c4 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetQos/MSFT_NetQosPolicy.Types.ps1xml @@ -0,0 +1,290 @@ + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetQosPolicySettingData + + + NetworkProfile + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetQosPolicy.NetworkProfile]($this.PSBase.CimInstanceProperties['NetworkProfile'].Value) + + + param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetQosPolicy.NetworkProfile]$value) + $this.PSBase.CimInstanceProperties['NetworkProfile'].Value = [System.UInt32]$value + + + + TemplateMatchCondition + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetQosPolicy.Template]($this.PSBase.CimInstanceProperties['TemplateMatchCondition'].Value) + + + param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetQosPolicy.Template]$value) + $this.PSBase.CimInstanceProperties['TemplateMatchCondition'].Value = [System.UInt32]$value + + + + UserMatchCondition + + $user = $this.PSBase.CimInstanceProperties['UserMatchCondition'].Value + if ($user -ne $null -and $user[0]) { + [System.Security.Principal.NTAccount]$user + } else { + $null + } + + + param([System.Security.Principal.NTAccount]$value) + $this.PSBase.CimInstanceProperties['UserMatchCondition'].Value = [System.String]$value + + + + AppPathNameMatchCondition + + [System.String]($this.PSBase.CimInstanceProperties['AppPathNameMatchCondition'].Value) + + + param([System.String]$value) + $this.PSBase.CimInstanceProperties['AppPathNameMatchCondition'].Value = $value + + + + JobObjectMatchCondition + + [System.String]($this.PSBase.CimInstanceProperties['JobObjectMatchCondition'].Value) + + + + NetDirectPortMatchCondition + + [System.UInt16]($this.PSBase.CimInstanceProperties['NetDirectPortMatchCondition'].Value) + + + param([System.UInt16]$value) + $this.PSBase.CimInstanceProperties['NetDirectPortMatchCondition'].Value = $value + + + + IPProtocolMatchCondition + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetQosPolicy.Protocol]($this.PSBase.CimInstanceProperties['IPProtocolMatchCondition'].Value) + + + param([Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetQosPolicy.Protocol]$value) + $this.PSBase.CimInstanceProperties['IPProtocolMatchCondition'].Value = [System.UInt32]$value + + + + IPPortMatchCondition + + [System.UInt16]($this.PSBase.CimInstanceProperties['IPPortMatchCondition'].Value) + + + param([System.UInt16]$value) + $this.PSBase.CimInstanceProperties['IPPortMatchCondition'].Value = $value + + + + IPSrcPrefixMatchCondition + + [System.String]($this.PSBase.CimInstanceProperties['IPSrcPrefixMatchCondition'].Value) + + + param([System.String]$value) + $this.PSBase.CimInstanceProperties['IPSrcPrefixMatchCondition'].Value = $value + + + + IPSrcPortStartMatchCondition + + [System.UInt16]($this.PSBase.CimInstanceProperties['IPSrcPortStartMatchCondition'].Value) + + + param([System.UInt16]$value) + $this.PSBase.CimInstanceProperties['IPSrcPortStartMatchCondition'].Value = $value + + + + IPSrcPortEndMatchCondition + + [System.UInt16]($this.PSBase.CimInstanceProperties['IPSrcPortEndMatchCondition'].Value) + + + param([System.UInt16]$value) + $this.PSBase.CimInstanceProperties['IPSrcPortEndMatchCondition'].Value = $value + + + + IPDstPrefixMatchCondition + + [System.String]($this.PSBase.CimInstanceProperties['IPDstPrefixMatchCondition'].Value) + + + param([System.String]$value) + $this.PSBase.CimInstanceProperties['IPDstPrefixMatchCondition'].Value = $value + + + + IPDstPortStartMatchCondition + + [System.UInt16]($this.PSBase.CimInstanceProperties['IPDstPortStartMatchCondition'].Value) + + + param([System.UInt16]$value) + $this.PSBase.CimInstanceProperties['IPDstPortStartMatchCondition'].Value = $value + + + + IPDstPortEndMatchCondition + + [System.UInt16]($this.PSBase.CimInstanceProperties['IPDstPortEndMatchCondition'].Value) + + + param([System.UInt16]$value) + $this.PSBase.CimInstanceProperties['IPDstPortEndMatchCondition'].Value = $value + + + + URIMatchCondition + + $uri = $this.PSBase.CimInstanceProperties['URIMatchCondition'].Value + if ($uri -ne $null -and $uri[0]) { + [System.Uri]$uri + } else { + $null + } + + + param([System.Uri]$value) + $this.PSBase.CimInstanceProperties['URIMatchCondition'].Value = [System.String]$value + + + + URIRecursiveMatchCondition + + [System.Boolean]($this.PSBase.CimInstanceProperties['URIRecursiveMatchCondition'].Value) + + + param([System.Boolean]$value) + $this.PSBase.CimInstanceProperties['URIRecursiveMatchCondition'].Value = $value + + + + PriorityValue8021Action + + [System.SByte]($this.PSBase.CimInstanceProperties['PriorityValue8021Action'].Value) + + + param([System.SByte]$value) + $this.PSBase.CimInstanceProperties['PriorityValue8021Action'].Value = $value + + + + DSCPAction + + [System.SByte]($this.PSBase.CimInstanceProperties['DSCPAction'].Value) + + + param([System.SByte]$value) + $this.PSBase.CimInstanceProperties['DSCPAction'].Value = $value + + + + MinBandwidthWeightAction + + [System.Byte]($this.PSBase.CimInstanceProperties['MinBandwidthWeightAction'].Value) + + + param([System.Byte]$value) + $this.PSBase.CimInstanceProperties['MinBandwidthWeightAction'].Value = $value + + + + ThrottleRateAction + + [System.UInt64]($this.PSBase.CimInstanceProperties['ThrottleRateAction'].Value) + + + param([System.UInt64]$value) + $this.PSBase.CimInstanceProperties['ThrottleRateAction'].Value = $value + + + + User + UserMatchCondition + + + AppPathName + AppPathNameMatchCondition + + + Template + TemplateMatchCondition + + + JobObject + JobObjectMatchCondition + + + NetDirectPort + NetDirectPortMatchCondition + + + IPProtocol + IPProtocolMatchCondition + + + IPPort + IPPortMatchCondition + + + IPSrcPrefix + IPSrcPrefixMatchCondition + + + IPSrcPortStart + IPSrcPortStartMatchCondition + + + IPSrcPortEnd + IPSrcPortEndMatchCondition + + + IPDstPrefix + IPDstPrefixMatchCondition + + + IPDstPortStart + IPDstPortStartMatchCondition + + + IPDstPortEnd + IPDstPortEndMatchCondition + + + URI + URIMatchCondition + + + URIRecursive + URIRecursiveMatchCondition + + + PriorityValue + PriorityValue8021Action + + + DSCPValue + DSCPAction + + + MinBandwidthWeight + MinBandwidthWeightAction + + + ThrottleRate + ThrottleRateAction + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetQos/MSFT_NetQosPolicy.cdxml b/newton-cn/bin/v1.0/Modules/NetQos/MSFT_NetQosPolicy.cdxml new file mode 100644 index 0000000..8df079a --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetQos/MSFT_NetQosPolicy.cdxml @@ -0,0 +1,1181 @@ + + + + 1.0 + NetQosPolicy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetQos/NetQos.psd1 b/newton-cn/bin/v1.0/Modules/NetQos/NetQos.psd1 new file mode 100644 index 0000000..3f435ec --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetQos/NetQos.psd1 @@ -0,0 +1,18 @@ +@{ + GUID = '743692b7-a227-4389-b082-2b47de1d0d2d' + Author = "Microsoft Corporation" + CompanyName = "Microsoft Corporation" + Copyright = "© Microsoft Corporation. All rights reserved." + ModuleVersion = '2.0.0.0' + PowerShellVersion = '5.1' + NestedModules = @('MSFT_NetQosPolicy.cdxml') + FormatsToProcess = @('MSFT_NetQosPolicy.format.ps1xml') + TypesToProcess = @('MSFT_NetQosPolicy.types.ps1xml') + HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=285555" + FunctionsToExport = @( + 'Get-NetQosPolicy', + 'Set-NetQosPolicy', + 'Remove-NetQosPolicy', + 'New-NetQosPolicy') + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/Microsoft.Windows.Firewall.Commands.dll b/newton-cn/bin/v1.0/Modules/NetSecurity/Microsoft.Windows.Firewall.Commands.dll new file mode 100644 index 0000000..9e5ac84 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/NetSecurity/Microsoft.Windows.Firewall.Commands.dll differ diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallAddressFilter.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallAddressFilter.cmdletDefinition.cdxml new file mode 100644 index 0000000..d01a9ac --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallAddressFilter.cmdletDefinition.cdxml @@ -0,0 +1,72 @@ + + + + 1.0.0.0 + NetFirewallAddressFilter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallApplicationFilter.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallApplicationFilter.cmdletDefinition.cdxml new file mode 100644 index 0000000..cd1cbf2 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallApplicationFilter.cmdletDefinition.cdxml @@ -0,0 +1,74 @@ + + + + 1.0.0.0 + NetFirewallApplicationFilter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallDynamicKeywordAddress.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallDynamicKeywordAddress.cmdletDefinition.cdxml new file mode 100644 index 0000000..9e06cdf --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallDynamicKeywordAddress.cmdletDefinition.cdxml @@ -0,0 +1,102 @@ + + + + 1.0.0.0 + NetFirewallDynamicKeywordAddress + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallInterfaceFilter.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallInterfaceFilter.cmdletDefinition.cdxml new file mode 100644 index 0000000..8872632 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallInterfaceFilter.cmdletDefinition.cdxml @@ -0,0 +1,62 @@ + + + + 1.0.0.0 + NetFirewallInterfaceFilter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallInterfaceTypeFilter.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallInterfaceTypeFilter.cmdletDefinition.cdxml new file mode 100644 index 0000000..f0e3996 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallInterfaceTypeFilter.cmdletDefinition.cdxml @@ -0,0 +1,78 @@ + + + + 1.0.0.0 + NetFirewallInterfaceTypeFilter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallPortFilter.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallPortFilter.cmdletDefinition.cdxml new file mode 100644 index 0000000..c0c2e4f --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallPortFilter.cmdletDefinition.cdxml @@ -0,0 +1,102 @@ + + + + 1.0.0.0 + NetFirewallPortFilter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallProfile.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallProfile.cmdletDefinition.cdxml new file mode 100644 index 0000000..443ea4d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallProfile.cmdletDefinition.cdxml @@ -0,0 +1,164 @@ + + + + 1.0.0.0 + NetFirewallProfile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallRule.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallRule.cmdletDefinition.cdxml new file mode 100644 index 0000000..1ce77f6 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallRule.cmdletDefinition.cdxml @@ -0,0 +1,646 @@ + + + + 1.0.0.0 + NetFirewallRule + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallSecurityFilter.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallSecurityFilter.cmdletDefinition.cdxml new file mode 100644 index 0000000..5beb9e0 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallSecurityFilter.cmdletDefinition.cdxml @@ -0,0 +1,126 @@ + + + + 1.0.0.0 + NetFirewallSecurityFilter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallServiceFilter.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallServiceFilter.cmdletDefinition.cdxml new file mode 100644 index 0000000..a556616 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallServiceFilter.cmdletDefinition.cdxml @@ -0,0 +1,64 @@ + + + + 1.0.0.0 + NetFirewallServiceFilter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallSetting.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallSetting.cmdletDefinition.cdxml new file mode 100644 index 0000000..8737882 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetFirewallSetting.cmdletDefinition.cdxml @@ -0,0 +1,141 @@ + + + + 1.0.0.0 + NetFirewallSetting + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetGPO.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetGPO.cmdletDefinition.cdxml new file mode 100644 index 0000000..98bfc5e --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetGPO.cmdletDefinition.cdxml @@ -0,0 +1,51 @@ + + + + 1.0.0.0 + NetGPO + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecDospSetting.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecDospSetting.cmdletDefinition.cdxml new file mode 100644 index 0000000..5d0a930 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecDospSetting.cmdletDefinition.cdxml @@ -0,0 +1,246 @@ + + + + 1.0.0.0 + NetIPsecDospSetting + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecIdentity.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecIdentity.cmdletDefinition.cdxml new file mode 100644 index 0000000..fedcc7f --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecIdentity.cmdletDefinition.cdxml @@ -0,0 +1,31 @@ + + + + 1.0.0.0 + NetIPsecIdentity + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecMainModeCryptoSet.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecMainModeCryptoSet.cmdletDefinition.cdxml new file mode 100644 index 0000000..55ee4db --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecMainModeCryptoSet.cmdletDefinition.cdxml @@ -0,0 +1,295 @@ + + + + 1.0.0.0 + NetIPsecMainModeCryptoSet + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecMainModeRule.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecMainModeRule.cmdletDefinition.cdxml new file mode 100644 index 0000000..1512511 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecMainModeRule.cmdletDefinition.cdxml @@ -0,0 +1,366 @@ + + + + 1.0.0.0 + NetIPsecMainModeRule + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecMainModeSA.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecMainModeSA.cmdletDefinition.cdxml new file mode 100644 index 0000000..65f9ffb --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecMainModeSA.cmdletDefinition.cdxml @@ -0,0 +1,44 @@ + + + + 1.0.0.0 + NetIPsecMainModeSA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecPhase1AuthSet.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecPhase1AuthSet.cmdletDefinition.cdxml new file mode 100644 index 0000000..6c89259 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecPhase1AuthSet.cmdletDefinition.cdxml @@ -0,0 +1,259 @@ + + + + 1.0.0.0 + NetIPsecPhase1AuthSet + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecPhase2AuthSet.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecPhase2AuthSet.cmdletDefinition.cdxml new file mode 100644 index 0000000..4be6d87 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecPhase2AuthSet.cmdletDefinition.cdxml @@ -0,0 +1,253 @@ + + + + 1.0.0.0 + NetIPsecPhase2AuthSet + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecPolicyChange.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecPolicyChange.cmdletDefinition.cdxml new file mode 100644 index 0000000..739aa1f --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecPolicyChange.cmdletDefinition.cdxml @@ -0,0 +1,17 @@ + + + + 1.0.0.0 + NetIPsecPolicyChange + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecQuickModeCryptoSet.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecQuickModeCryptoSet.cmdletDefinition.cdxml new file mode 100644 index 0000000..8514f0b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecQuickModeCryptoSet.cmdletDefinition.cdxml @@ -0,0 +1,267 @@ + + + + 1.0.0.0 + NetIPsecQuickModeCryptoSet + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecQuickModeSA.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecQuickModeSA.cmdletDefinition.cdxml new file mode 100644 index 0000000..475bae3 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecQuickModeSA.cmdletDefinition.cdxml @@ -0,0 +1,76 @@ + + + + 1.0.0.0 + NetIPsecQuickModeSA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecRule.cmdletDefinition.cdxml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecRule.cmdletDefinition.cdxml new file mode 100644 index 0000000..df19f83 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetIPsecRule.cmdletDefinition.cdxml @@ -0,0 +1,825 @@ + + + + 1.0.0.0 + NetIPsecRule + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetSecurity.formats.ps1xml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetSecurity.formats.ps1xml new file mode 100644 index 0000000..f6481a2 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetSecurity.formats.ps1xml @@ -0,0 +1,3316 @@ + + + + + NetFirewallRule_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetFirewallRule + + + + + + + Name + + + DisplayName + + + Description + + + DisplayGroup + + + Group + + + Enabled + + + Profile + + + Platform + + + Direction + + + Action + + + EdgeTraversalPolicy + + + LooseSourceMapping + + + LocalOnlyMapping + + + Owner + + + PrimaryStatus + + + Status + + + EnforcementStatus + + + PolicyStoreSource + + + PolicyStoreSourceType + + + RemoteDynamicKeywordAddresses + + + + + + + + NetFirewallRule_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetFirewallRule + + + + + + + + + + + + + + + 5 + + + + 10 + + + + + + + + + + + + + + + + Name + + + DisplayName + + + DisplayGroup + + + Enabled + + + Profile + + + Direction + + + Action + + + RemoteDynamicKeywordAddresses + + + + + + + + NetIPsecRule_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetConSecRule + + + + + + + IPsecRuleName + + + DisplayName + + + Description + + + DisplayGroup + + + Group + + + Enabled + + + Profile + + + Platform + + + Mode + + + InboundSecurity + + + OutboundSecurity + + + QuickModeCryptoSet + + + Phase1AuthSet + + + Phase2AuthSet + + + KeyModule + + + AllowWatchKey + + + AllowSetKey + + + LocalTunnelEndpoint + + + RemoteTunnelEndpoint + + + RemoteTunnelHostname + + + ForwardPathLifetime + + + EncryptedTunnelBypass + + + RequireAuthorization + + + User + + + Machine + + + PrimaryStatus + + + Status + + + EnforcementStatus + + + PolicyStoreSource + + + PolicyStoreSourceType + + + + + + + + NetIPsecRule_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetConSecRule + + + + + + + + + + + + + + + 5 + + + + 10 + + + + + + + + + + + + + + + + IPsecRuleName + + + DisplayName + + + DisplayGroup + + + Enabled + + + Profile + + + Mode + + + InboundSecurity + + + OutboundSecurity + + + + + + + + NetIPsecMainModeRule_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetMainModeRule + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetMainModeRule + + + + + + + Name + + + DisplayName + + + Description + + + DisplayGroup + + + Group + + + Enabled + + + Profile + + + Platform + + + MainModeCryptoSet + + + Phase1AuthSet + + + PrimaryStatus + + + Status + + + EnforcementStatus + + + PolicyStoreSource + + + PolicyStoreSourceType + + + + + + + + NetIPsecMainModeRule_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetMainModeRule + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetMainModeRule + + + + + + + + + + + + + + + 5 + + + + 10 + + + + + + + Name + + + DisplayName + + + DisplayGroup + + + Enabled + + + Profile + + + + + + + + NetFirewallAddressFilter_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetAddressFilter + + + + + + + LocalAddress + + + RemoteAddress + + + + + + + + NetFirewallAddressFilter_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetAddressFilter + + + + + + + + + + + + + + + LocalAddress + + + RemoteAddress + + + + + + + + + NetFirewallApplicationFilter_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetApplicationFilter + + + + + + + Program + + + Package + + + + + + + + NetFirewallApplicationFilter_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetApplicationFilter + + + + + + + + + + + + + + + Program + + + Package + + + + + + + + + NetFirewallInterfaceFilter_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetInterfaceFilter + + + + + + + InterfaceAlias + + + + + + + + NetFirewallInterfaceFilter_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetInterfaceFilter + + + + + + + + + + + + InterfaceAlias + + + + + + + + + NetFirewallInterfaceTypeFilter_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetInterfaceTypeFilter + + + + + + + InterfaceType + + + + + + + + NetFirewallInterfaceTypeFilter_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetInterfaceTypeFilter + + + + + + + + + + + + InterfaceType + + + + + + + + + NetFirewallSecurityFilter_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetNetworkLayerSecurityFilter + + + + + + + Authentication + + + Encryption + + + OverrideBlockRules + + + LocalUser + + + RemoteUser + + + RemoteMachine + + + + + + + + NetFirewallSecurityFilter_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetNetworkLayerSecurityFilter + + + + + + + + + + + + + + + + + + + + + + + + + + + Authentication + + + Encryption + + + OverrideBlockRules + + + LocalUser + + + RemoteUser + + + RemoteMachine + + + + + + + + + NetFirewallPortFilter_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetProtocolPortFilter + + + + + + + Protocol + + + LocalPort + + + RemotePort + + + IcmpType + + + DynamicTarget + + + + + + + + NetFirewallPortFilter_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetProtocolPortFilter + + + + + + + + + + + + + + + + + + + + + + + + Protocol + + + LocalPort + + + RemotePort + + + IcmpType + + + DynamicTarget + + + + + + + + + NetFirewallServiceFilter_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetServiceFilter + + + + + + + Service + + + + + + + + NetFirewallServiceFilter_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetServiceFilter + + + + + + + + + + + + Service + + + + + + + + + NetIPsecPhase1AuthSet_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEP1AuthSet + + + + + + + Name + + + DisplayName + + + Description + + + DisplayGroup + + + Group + + + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatAuthenticationProposals($_.Proposals) + + + PrimaryStatus + + + Status + + + EnforcementStatus + + + PolicyStoreSource + + + PolicyStoreSourceType + + + + + + + + NetIPsecPhase1AuthSet_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEP1AuthSet + + + + + + + + + + + + + + + + + + + + + Name + + + DisplayName + + + DisplayGroup + + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatAuthenticationSummary($_.Proposals) + + + + + + + + + NetIPsecPhase2AuthSet_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEP2AuthSet + + + + + + + Name + + + DisplayName + + + Description + + + DisplayGroup + + + Group + + + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatAuthenticationProposals($_.Proposals) + + + PrimaryStatus + + + Status + + + EnforcementStatus + + + PolicyStoreSource + + + PolicyStoreSourceType + + + + + + + + NetIPsecPhase2AuthSet_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEP2AuthSet + + + + + + + + + + + + + + + + + + + + + Name + + + DisplayName + + + DisplayGroup + + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatAuthenticationSummary($_.Proposals) + + + + + + + + + NetIPsecAuthProposal_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEBasicAuthProposal + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEBasicAuthProposal + + + + + + + AuthenticationMethod + + + + + + + + NetIPsecAuthProposal_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEBasicAuthProposal + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEBasicAuthProposal + + + + + + + + + + + + AuthenticationMethod + + + + + + + + + NetIPsecKerbAuthProposal_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEKerbAuthProposal + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEKerbAuthProposal + + + + + + + AuthenticationMethod + + + Proxy + + + + + + + + NetIPsecKerbAuthProposal_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEKerbAuthProposal + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEKerbAuthProposal + + + + + + + + + + + + + + + AuthenticationMethod + + + Proxy + + + + + + + + + NetIPsecPskAuthProposal_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEPSKAuthProposal + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEPSKAuthProposal + + + + + + + AuthenticationMethod + + + PreSharedKey + + + + + + + + NetIPsecPskAuthProposal_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEPSKAuthProposal + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEPSKAuthProposal + + + + + + + + + + + + + + + AuthenticationMethod + + + PreSharedKey + + + + + + + + + NetIPsecCertAuthProposal_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKECertAuthProposal + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKECertAuthProposal + + + + + + + AuthenticationMethod + + + Authority + + + AuthorityType + + + ExcludeCAName + + + AccountMapping + + + Signing + + + SubjectName + + + SubjectNameType + + + ExtendedKeyUsage + + + Thumbprint + + + FollowRenewal + + + SelectionCriteria + + + ValidationCriteria + + + + + + + + NetIPsecCertAuthProposal_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKECertAuthProposal + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKECertAuthProposal + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AuthenticationMethod + + + Authority + + + AuthorityType + + + ExcludeCAName + + + AccountMapping + + + Signing + + + SubjectName + + + SubjectNameType + + + ExtendedKeyUsage + + + Thumbprint + + + FollowRenewal + + + SelectionCriteria + + + ValidationCriteria + + + + + + + + + NetIPsecMainModeCryptoSet_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEMMCryptoSet + + + + + + + Name + + + DisplayName + + + Description + + + DisplayGroup + + + Group + + + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatMainModeCryptoProposals($_.Proposals) + + + MaxMinutes + + + MaxSessions + + + ForceDiffieHellman + + + PrimaryStatus + + + Status + + + EnforcementStatus + + + PolicyStoreSource + + + PolicyStoreSourceType + + + + + + + + NetIPsecMainModeCryptoSet_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEMMCryptoSet + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + DisplayName + + + DisplayGroup + + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatMainModeCryptoProposals($_.Proposals) + + + MaxMinutes + + + MaxSessions + + + ForceDiffieHellman + + + + + + + + + NetIPsecQuickModeCryptoSet_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEQMCryptoSet + + + + + + + Name + + + DisplayName + + + Description + + + DisplayGroup + + + Group + + + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatQuickModeCryptoProposals($_.Proposals) + + + PfsGroup + + + PrimaryStatus + + + Status + + + EnforcementStatus + + + PolicyStoreSource + + + PolicyStoreSourceType + + + + + + + + NetIPsecQuickModeCryptoSet_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEQMCryptoSet + + + + + + + + + + + + + + + + + + + + + + + + Name + + + DisplayName + + + DisplayGroup + + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatQuickModeCryptoProposals($_.Proposals) + + + PfsGroup + + + + + + + + + NetIPsecMainModeCryptoProposal_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEMMCryptoProposal + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEMMCryptoProposal + + + + + + + Encryption + + + Hash + + + KeyExchange + + + + + + + + NetIPsecMainModeCryptoProposal_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEMMCryptoProposal + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEMMCryptoProposal + + + + + + + + + + + + + + + + + + Encryption + + + Hash + + + KeyExchange + + + + + + + + + NetIPsecQuickModeCryptoProposal_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEQMCryptoProposal + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEQMCryptoProposal + + + + + + + Encapsulation + + + AhHash + + + EspHash + + + Encryption + + + MaxKilobytes + + + MaxMinutes + + + + + + + + NetIPsecQuickModeCryptoProposal_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIKEQMCryptoProposal + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEQMCryptoProposal + + + + + + + + + + + + + + + + + + + + + + + + + + + Encapsulation + + + AhHash + + + EspHash + + + Encryption + + + MaxKilobytes + + + MaxMinutes + + + + + + + + + NetFirewallProfile_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetFirewallProfile + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetFirewallProfile + + + + + + + Name + + + Enabled + + + DefaultInboundAction + + + DefaultOutboundAction + + + AllowInboundRules + + + AllowLocalFirewallRules + + + AllowLocalIPsecRules + + + AllowUserApps + + + AllowUserPorts + + + AllowUnicastResponseToMulticast + + + NotifyOnListen + + + EnableStealthModeForIPsec + + + LogFileName + + + LogMaxSizeKilobytes + + + LogAllowed + + + LogBlocked + + + LogIgnored + + + DisabledInterfaceAliases + + + + + + + + NetFirewallProfile_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetFirewallProfile + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetFirewallProfile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + Enabled + + + DefaultInboundAction + + + DefaultOutboundAction + + + AllowInboundRules + + + AllowLocalFirewallRules + + + AllowLocalIPsecRules + + + AllowUserApps + + + AllowUserPorts + + + AllowUnicastResponseToMulticast + + + NotifyOnListen + + + EnableStealthModeForIPsec + + + LogFileName + + + LogMaxSizeKilobytes + + + LogAllowed + + + LogBlocked + + + LogIgnored + + + DisabledInterfaceAliases + + + + + + + + + NetIPsecPolicyChange_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetSecDeltaCollection + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSecDeltaCollection + + + + + + + Action + + + EndpointType + + + PolicyStore + + + IPsecRuleDisplayName + + + IPv4Addresses + + + IPv6Addresses + + + NameResolutionFailures + + + + + + + + NetIPsecPolicyChange_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetSecDeltaCollection + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSecDeltaCollection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Action + + + EndpointType + + + PolicyStore + + + IPsecRuleDisplayName + + + IPv4Addresses + + + IPv6Addresses + + + NameResolutionFailures + + + + + + + + + NetIPsecDospSetting_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIPsecDoSPSetting + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPsecDoSPSetting + + + + + + + Name + + + StateIdleTimeoutSeconds + + + PerIPRateLimitQueueIdleTimeoutSeconds + + + IpV6IPsecUnauthDscp + + + IpV6IPsecUnauthRateLimitBytesPerSec + + + IpV6IPsecUnauthPerIPRateLimitBytesPerSec + + + IpV6IPsecAuthDscp + + + IpV6IPsecAuthRateLimitBytesPerSec + + + IcmpV6Dscp + + + IcmpV6RateLimitBytesPerSec + + + IpV6FilterExemptDscp + + + IpV6FilterExemptRateLimitBytesPerSec + + + DefBlockExemptDscp + + + DefBlockExemptRateLimitBytesPerSec + + + MaxStateEntries + + + MaxPerIPRateLimitQueues + + + EnabledKeyingModules + + + FilteringFlags + + + PublicInterfaceAliases + + + PrivateInterfaceAliases + + + PublicV6Address + + + PrivateV6Address + + + EffectiveAddressFamily + + + + + + + + NetIPsecDospSetting_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIPsecDoSPSetting + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPsecDoSPSetting + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + StateIdleTimeoutSeconds + + + PerIPRateLimitQueueIdleTimeoutSeconds + + + IpV6IPsecUnauthDscp + + + IpV6IPsecUnauthRateLimitBytesPerSec + + + IpV6IPsecUnauthPerIPRateLimitBytesPerSec + + + IpV6IPsecAuthDscp + + + IpV6IPsecAuthRateLimitBytesPerSec + + + IcmpV6Dscp + + + IcmpV6RateLimitBytesPerSec + + + IpV6FilterExemptDscp + + + IpV6FilterExemptRateLimitBytesPerSec + + + DefBlockExemptDscp + + + DefBlockExemptRateLimitBytesPerSec + + + MaxStateEntries + + + MaxPerIPRateLimitQueues + + + EnabledKeyingModules + + + FilteringFlags + + + PublicInterfaceAliases + + + PrivateInterfaceAliases + + + PublicV6Address + + + PrivateV6Address + + + EffectiveAddressFamily + + + + + + + + + NetIPsecIdentity_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIPsecIdentity + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPsecIdentity + + + + + + + ImpersonationType + + + AuthenticationMethod + + + Flags + + + + + + + + NetIPsecIdentity_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetIPsecIdentity + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPsecIdentity + + + + + + + + + + + + + + + + + + ImpersonationType + + + AuthenticationMethod + + + Flags + + + + + + + + + NetIPsecMainModeSA_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetMainModeSA + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetMainModeSA + + + + + + + Name + + + LocalEndpoint + + + RemoteEndpoint + + + + $_.LocalFirstId.Identity + + + + $_.LocalFirstId.ImpersonationType + + + + $_.LocalFirstId.AuthenticationMethod + + + + $_.LocalFirstId.Flags + + + + $_.RemoteFirstId.Identity + + + + $_.RemoteFirstId.ImpersonationType + + + + $_.RemoteFirstId.AuthenticationMethod + + + + $_.RemoteFirstId.Flags + + + + $_.LocalSecondId.Identity + + + + $_.LocalSecondId.ImpersonationType + + + + $_.LocalSecondId.AuthenticationMethod + + + + $_.LocalSecondId.Flags + + + + $_.RemoteSecondId.Identity + + + + $_.RemoteSecondId.ImpersonationType + + + + $_.RemoteSecondId.AuthenticationMethod + + + + $_.RemoteSecondId.Flags + + + CipherAlgorithm + + + HashAlgorithm + + + GroupId + + + KeyModule + + + MaxQMSAs + + + LifetimeSeconds + + + LocalUdpEncapsulationPort + + + RemoteUdpEncapsulationPort + + + ExtendedFilterId + + + + + + + + NetIPsecMainModeSA_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetMainModeSA + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetMainModeSA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + LocalEndpoint + + + RemoteEndpoint + + + $_.LocalFirstId.Identity + + + $_.LocalFirstId.ImpersonationType + + + $_.LocalFirstId.AuthenticationMethod + + + $_.LocalFirstId.Flags + + + $_.RemoteFirstId.Identity + + + $_.RemoteFirstId.ImpersonationType + + + $_.RemoteFirstId.AuthenticationMethod + + + $_.RemoteFirstId.Flags + + + $_.LocalSecondId.Identity + + + $_.LocalSecondId.ImpersonationType + + + $_.LocalSecondId.AuthenticationMethod + + + $_.LocalSecondId.Flags + + + $_.RemoteSecondId.Identity + + + $_.RemoteSecondId.ImpersonationType + + + $_.RemoteSecondId.AuthenticationMethod + + + $_.RemoteSecondId.Flags + + + CipherAlgorithm + + + HashAlgorithm + + + GroupId + + + KeyModule + + + MaxQMSAs + + + LifetimeSeconds + + + LocalUdpEncapsulationPort + + + RemoteUdpEncapsulationPort + + + ExtendedFilterId + + + + + + + + + NetIPsecQuickModeSA_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetQuickModeSA + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetQuickModeSA + + + + + + + Name + + + LocalEndpoint + + + RemoteEndpoint + + + TransportLayerFilterName + + + EncapsulationMode + + + Direction + + + LocalPort + + + RemotePort + + + IpProtocol + + + InterfaceAlias + + + RealIfProfileId + + + LocalUdpEncapsulationPort + + + RemoteUdpEncapsulationPort + + + SPI + + + FirstTransformType + + + FirstIntegrityAlgorithm + + + FirstCipherAlgorithm + + + SecondSpi + + + SecondTransformType + + + SecondIntegrityAlgorithm + + + SecondCipherAlgorithm + + + Flags + + + MmSaId + + + PfsGroupId + + + PeerV4PrivateAddress + + + QuickModeFilterid + + + LifetimeSeconds + + + LifetimeKilobytes + + + LifetimePackets + + + IdleDurationSeconds + + + NdAllowClearTimeoutSeconds + + + NapContext + + + QmSaId + + + VirtualIfTunnelId + + + TrafficSelectorId + + + MmTargetName + + + EmTargetName + + + ExplicitCredentials + + + + + + + + NetIPsecQuickModeSA_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetQuickModeSA + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetQuickModeSA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + LocalEndpoint + + + RemoteEndpoint + + + TransportLayerFilterName + + + EncapsulationMode + + + Direction + + + LocalPort + + + RemotePort + + + IpProtocol + + + InterfaceAlias + + + RealIfProfileId + + + LocalUdpEncapsulationPort + + + RemoteUdpEncapsulationPort + + + SPI + + + FirstTransformType + + + FirstIntegrityAlgorithm + + + FirstCipherAlgorithm + + + SecondSpi + + + SecondTransformType + + + SecondIntegrityAlgorithm + + + SecondCipherAlgorithm + + + Flags + + + MmSaId + + + PfsGroupId + + + PeerV4PrivateAddress + + + QuickModeFilterid + + + LifetimeSeconds + + + LifetimeKilobytes + + + LifetimePackets + + + IdleDurationSeconds + + + NdAllowClearTimeoutSeconds + + + NapContext + + + QmSaId + + + VirtualIfTunnelId + + + TrafficSelectorId + + + MmTargetName + + + EmTargetName + + + ExplicitCredentials + + + + + + + + + NetFirewallSetting_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetSecuritySettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSecuritySettingData + + + + + + + Name + + + Exemptions + + + EnableStatefulFtp + + + EnableStatefulPptp + + + ActiveProfile + + + RemoteMachineTransportAuthorizationList + + + RemoteMachineTunnelAuthorizationList + + + RemoteUserTransportAuthorizationList + + + RemoteUserTunnelAuthorizationList + + + RequireFullAuthSupport + + + CertValidationLevel + + + AllowIPsecThroughNAT + + + MaxSAIdleTimeSeconds + + + KeyEncoding + + + EnablePacketQueuing + + + + + + + + NetFirewallSetting_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetSecuritySettingData + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSecuritySettingData + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + Exemptions + + + EnableStatefulFtp + + + EnableStatefulPptp + + + ActiveProfile + + + RemoteMachineTransportAuthorizationList + + + RemoteMachineTunnelAuthorizationList + + + RemoteUserTransportAuthorizationList + + + RemoteUserTunnelAuthorizationList + + + RequireFullAuthSupport + + + CertValidationLevel + + + AllowIPsecThroughNAT + + + MaxSAIdleTimeSeconds + + + KeyEncoding + + + EnablePacketQueuing + + + + + + + + + NetFirewallDynamicKeywordAddress_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetFirewallDynamicKeywordAddress + + + + + + + Id + + + Keyword + + + Addresses + + + AutoResolve + + + PolicyStoreSource + + + PolicyStoreSourceType + + + + + + + + NetFirewallDynamicKeywordAddress_Tableview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/MSFT_NetFirewallDynamicKeywordAddress + + + + + + + + + + + + + + + + + + + + + Id + + + Keyword + + + Addresses + + + AutoResolve + + + + + + + + + MSFT_NetRuleDeep_Listview + + Microsoft.Management.Infrastructure.CimInstance#root/standardcimv2/NetSecurityDeepEnumElement + + + + + + + + + if ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetFirewallRule") +{( + (New-Object -TypeName System.String '-',((Get-Host).ui.rawui.windowsize.width - 1)) + "`r`n" + + "`r`n`r`n`r`n" + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Name, "Name", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayName, "DisplayName", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Description, "Description", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayGroup, "DisplayGroup", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Group, "Group", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Enabled, "Enabled", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Profile, "Profile", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.Platform), "Platform", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Direction, "Direction", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Action, "Action", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.EdgeTraversalPolicy, "EdgeTraversalPolicy", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.LooseSourceMapping, "LooseSourceMapping", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.LocalOnlyMapping, "LocalOnlyMapping", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Owner, "Owner", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PrimaryStatus, "PrimaryStatus", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Status, "Status", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.EnforcementStatus), "EnforcementStatus", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSource, "PolicyStoreSource", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSourceType, "PolicyStoreSourceType", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.RemoteDynamicKeywordAddresses), "RemoteDynamicKeywordAddresses", 29, (Get-Host).ui.rawui.windowsize.width) +).TrimEnd()} +elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAddressFilter") +{( + "`r`n`$_ | Get-NetFirewallAddressFilter`r`n" + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.LocalAddress), " LocalAddress", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.RemoteAddress), " RemoteAddress", 29, (Get-Host).ui.rawui.windowsize.width) +).TrimEnd()} +elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetApplicationFilter") +{( + "`r`n`$_ | Get-NetFirewallApplicationFilter`r`n" + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Program, " Program", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Package, " Package", 29, (Get-Host).ui.rawui.windowsize.width) +).TrimEnd()} +elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetServiceFilter") +{( + "`r`n`$_ | Get-NetFirewallServiceFilter`r`n" + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Service, " Service", 29, (Get-Host).ui.rawui.windowsize.width) +).TrimEnd()} +elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetInterfaceFilter") +{( + "`r`n`$_ | Get-NetFirewallInterfaceFilter`r`n" + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.InterfaceAlias), " InterfaceAlias", 29, (Get-Host).ui.rawui.windowsize.width) +).TrimEnd()} +elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetInterfaceTypeFilter") +{( + "`r`n`$_ | Get-NetFirewallInterfaceTypeFilter`r`n" + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.InterfaceType, " InterfaceType", 29, (Get-Host).ui.rawui.windowsize.width) +).TrimEnd()} +elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetProtocolPortFilter") +{( + "`r`n`$_ | Get-NetFirewallPortFilter`r`n" + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Protocol, " Protocol", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.LocalPort), " LocalPort", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.RemotePort), " RemotePort", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.IcmpType), " IcmpType", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DynamicTarget, " DynamicTarget", 29, (Get-Host).ui.rawui.windowsize.width) +).TrimEnd()} +elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetNetworkLayerSecurityFilter") +{( + "`r`n`$_ | Get-NetFirewallSecurityFilter`r`n" + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Authentication, " Authentication", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Encryption, " Encryption", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.OverrideBlockRules, " OverrideBlockRules", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.LocalUser, " LocalUser", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.RemoteUser, " RemoteUser", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.RemoteMachine, " RemoteMachine", 29, (Get-Host).ui.rawui.windowsize.width) +).TrimEnd()} +elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetConSecRule") +{( + (New-Object -TypeName System.String '-',((Get-Host).ui.rawui.windowsize.width - 1)) + "`r`n" + + "`r`n`r`n`r`n" + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.IPsecRuleName, "IPsecRuleName", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayName, "DisplayName", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Description, "Description", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayGroup, "DisplayGroup", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Group, "Group", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Enabled, "Enabled", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Profile, "Profile", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.Platform), "Platform", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Mode, "Mode", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.InboundSecurity, "InboundSecurity", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.OutboundSecurity, "OutboundSecurity", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.QuickModeCryptoSet, "QuickModeCryptoSet", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Phase1AuthSet, "Phase1AuthSet", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Phase2AuthSet, "Phase2AuthSet", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.KeyModule, "KeyModule", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.AllowWatchKey, "AllowWatchKey", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.AllowSetKey, "AllowSetKey", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.LocalTunnelEndpoint), "LocalTunnelEndpoint", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.RemoteTunnelEndpoint), "RemoteTunnelEndpoint", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.RemoteTunnelHostname, "RemoteTunnelHostname", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.ForwardPathLifetime, "ForwardPathLifetime", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.EncryptedTunnelBypass, "EncryptedTunnelBypass", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.RequireAuthorization, "RequireAuthorization", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.User, "User", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Machine, "Machine", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PrimaryStatus, "PrimaryStatus", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Status, "Status", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.EnforcementStatus), "EnforcementStatus", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSource, "PolicyStoreSource", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSourceType, "PolicyStoreSourceType", 29, (Get-Host).ui.rawui.windowsize.width) +).TrimEnd()} +elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEQMCryptoSet") +{( + "`r`n`$_ | Get-NetQuickModeCryptoSet`r`n" + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Name, " Name", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayName, " DisplayName", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Description, " Description", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayGroup, " DisplayGroup", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Group, " Group", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock([Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatQuickModeCryptoProposals($_.Proposals), " Proposal", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PerfectForwardSecrecyGroup, " PfsGroup", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PrimaryStatus, " PrimaryStatus", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Status, " Status", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.EnforcementStatus), " EnforcementStatus", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSource, " PolicyStoreSource", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSourceType, " PolicyStoreSourceType", 29, (Get-Host).ui.rawui.windowsize.width) +).TrimEnd()} +elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEP1AuthSet") +{( + "`r`n`$_ | Get-NetIPsecPhase1AuthSet`r`n" + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Name, " Name", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayName, " DisplayName", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Description, " Description", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayGroup, " DisplayGroup", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Group, " Group", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock([Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatAuthenticationProposals($_.Proposals), " Proposal", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PrimaryStatus, " PrimaryStatus", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Status, " Status", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.EnforcementStatus), " EnforcementStatus", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSource, " PolicyStoreSource", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSourceType, " PolicyStoreSourceType", 29, (Get-Host).ui.rawui.windowsize.width) +).TrimEnd()} +elseif ($_.PSTypeNames -contains "Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEP2AuthSet") +{( + "`r`n`$_ | Get-NetIPsecPhase2AuthSet`r`n" + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Name, " Name", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayName, " DisplayName", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Description, " Description", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.DisplayGroup, " DisplayGroup", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Group, " Group", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock([Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatAuthenticationProposals($_.Proposals), " Proposal", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PrimaryStatus, " PrimaryStatus", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.Status, " Status", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock(($_.EnforcementStatus), " EnforcementStatus", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSource, " PolicyStoreSource", 29, (Get-Host).ui.rawui.windowsize.width) + + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatTextBlock($_.PolicyStoreSourceType, " PolicyStoreSourceType", 29, (Get-Host).ui.rawui.windowsize.width) +).TrimEnd()} + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetSecurity.psd1 b/newton-cn/bin/v1.0/Modules/NetSecurity/NetSecurity.psd1 new file mode 100644 index 0000000..501ad22 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetSecurity.psd1 @@ -0,0 +1,136 @@ +@{ + ModuleVersion = '2.0.0.0' + FormatsToProcess = 'NetSecurity.formats.ps1xml' + TypesToProcess = 'NetSecurity.types.ps1xml' + NestedModules = @( + "Microsoft.Windows.Firewall.Commands.dll", + "NetFirewallRule.cmdletDefinition.cdxml", + "NetIPsecRule.cmdletDefinition.cdxml", + "NetIPsecMainModeRule.cmdletDefinition.cdxml", + "NetFirewallAddressFilter.cmdletDefinition.cdxml", + "NetFirewallApplicationFilter.cmdletDefinition.cdxml", + "NetFirewallInterfaceFilter.cmdletDefinition.cdxml", + "NetFirewallInterfaceTypeFilter.cmdletDefinition.cdxml", + "NetFirewallSecurityFilter.cmdletDefinition.cdxml", + "NetFirewallPortFilter.cmdletDefinition.cdxml", + "NetFirewallServiceFilter.cmdletDefinition.cdxml", + "NetIPsecPhase1AuthSet.cmdletDefinition.cdxml", + "NetIPsecPhase2AuthSet.cmdletDefinition.cdxml", + "NetIPsecMainModeCryptoSet.cmdletDefinition.cdxml", + "NetIPsecQuickModeCryptoSet.cmdletDefinition.cdxml", + "NetFirewallProfile.cmdletDefinition.cdxml", + "NetIPsecPolicyChange.cmdletDefinition.cdxml", + "NetIPsecDospSetting.cmdletDefinition.cdxml", + "NetIPsecIdentity.cmdletDefinition.cdxml", + "NetIPsecMainModeSA.cmdletDefinition.cdxml", + "NetIPsecQuickModeSA.cmdletDefinition.cdxml", + "NetFirewallSetting.cmdletDefinition.cdxml", + "NetFirewallDynamicKeywordAddress.cmdletDefinition.cdxml", + "NetGPO.cmdletDefinition.cdxml" + ) + GUID = '{4B26FF51-7AEE-4731-9CF7-508B82532CBF}' + Author = 'Microsoft Corporation' + CompanyName = 'Microsoft Corporation' + PowerShellVersion = '3.0' + ClrVersion = '4.0' + Copyright = '(c) Microsoft Corporation. All rights reserved.' + HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=285764" + CompatiblePSEditions = 'Desktop', 'Core' + + FunctionsToExport = @( + "Copy-NetFirewallRule", + "Copy-NetIPsecMainModeCryptoSet", + "Copy-NetIPsecMainModeRule", + "Copy-NetIPsecPhase1AuthSet", + "Copy-NetIPsecPhase2AuthSet", + "Copy-NetIPsecQuickModeCryptoSet", + "Copy-NetIPsecRule", + "Disable-NetFirewallRule", + "Disable-NetIPsecMainModeRule", + "Disable-NetIPsecRule", + "Enable-NetFirewallRule", + "Enable-NetIPsecMainModeRule", + "Enable-NetIPsecRule", + "Get-NetFirewallAddressFilter", + "Get-NetFirewallApplicationFilter", + "Get-NetFirewallDynamicKeywordAddress", + "Get-NetFirewallInterfaceFilter", + "Get-NetFirewallInterfaceTypeFilter", + "Get-NetFirewallPortFilter", + "Get-NetFirewallProfile", + "Get-NetFirewallRule", + "Get-NetFirewallSecurityFilter", + "Get-NetFirewallServiceFilter", + "Get-NetFirewallSetting", + "Get-NetIPsecDospSetting", + "Get-NetIPsecMainModeCryptoSet", + "Get-NetIPsecMainModeRule", + "Get-NetIPsecMainModeSA", + "Get-NetIPsecPhase1AuthSet", + "Get-NetIPsecPhase2AuthSet", + "Get-NetIPsecQuickModeCryptoSet", + "Get-NetIPsecQuickModeSA", + "Get-NetIPsecRule", + "New-NetFirewallRule", + "New-NetFirewallDynamicKeywordAddress", + "New-NetIPsecDospSetting", + "New-NetIPsecMainModeCryptoSet", + "New-NetIPsecMainModeRule", + "New-NetIPsecPhase1AuthSet", + "New-NetIPsecPhase2AuthSet", + "New-NetIPsecQuickModeCryptoSet", + "New-NetIPsecRule", + "Open-NetGPO", + "Remove-NetFirewallRule", + "Remove-NetFirewallDynamicKeywordAddress", + "Remove-NetIPsecDospSetting", + "Remove-NetIPsecMainModeCryptoSet", + "Remove-NetIPsecMainModeRule", + "Remove-NetIPsecMainModeSA", + "Remove-NetIPsecPhase1AuthSet", + "Remove-NetIPsecPhase2AuthSet", + "Remove-NetIPsecQuickModeCryptoSet", + "Remove-NetIPsecQuickModeSA", + "Remove-NetIPsecRule", + "Rename-NetFirewallRule", + "Rename-NetIPsecMainModeCryptoSet", + "Rename-NetIPsecMainModeRule", + "Rename-NetIPsecPhase1AuthSet", + "Rename-NetIPsecPhase2AuthSet", + "Rename-NetIPsecQuickModeCryptoSet", + "Rename-NetIPsecRule", + "Save-NetGPO", + "Find-NetIPsecRule", + "Set-NetFirewallAddressFilter", + "Set-NetFirewallApplicationFilter", + "Set-NetFirewallInterfaceFilter", + "Set-NetFirewallInterfaceTypeFilter", + "Set-NetFirewallPortFilter", + "Set-NetFirewallProfile", + "Set-NetFirewallRule", + "Set-NetFirewallSecurityFilter", + "Set-NetFirewallServiceFilter", + "Set-NetFirewallSetting", + "Set-NetIPsecDospSetting", + "Set-NetIPsecMainModeCryptoSet", + "Set-NetIPsecMainModeRule", + "Set-NetIPsecPhase1AuthSet", + "Set-NetIPsecPhase2AuthSet", + "Set-NetIPsecQuickModeCryptoSet", + "Set-NetIPsecRule", + "Show-NetFirewallRule", + "Show-NetIPsecRule", + "Sync-NetIPsecRule", + "Update-NetIPsecRule", + "Update-NetFirewallDynamicKeywordAddress" + ) + CmdletsToExport = @( + "Get-DAPolicyChange", + "New-NetIPsecAuthProposal", + "New-NetIPsecMainModeCryptoProposal", + "New-NetIPsecQuickModeCryptoProposal" + ) + AliasesToExport = @( + ) +} + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/NetSecurity.types.ps1xml b/newton-cn/bin/v1.0/Modules/NetSecurity/NetSecurity.types.ps1xml new file mode 100644 index 0000000..9edcf8c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSecurity/NetSecurity.types.ps1xml @@ -0,0 +1,1085 @@ + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetFirewallRule + + + Name + InstanceID + + + ID + Name + + + DisplayName + $this.PSBase.CimInstanceProperties["DisplayName"].Value + param($x) ; $this.PSBase.CimInstanceProperties["DisplayName"].Value = $x ; $this.PSBase.CimInstanceProperties["ElementName"].Value = $x + + + Group + RuleGroup + + + Enabled + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Enabled]($this.PSBase.CimInstanceProperties['Enabled'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['Enabled'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Enabled]$x + + + Profile + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Profile]($this.PSBase.CimInstanceProperties['Profiles'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['Profiles'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Profile]$x + + + Platform + Platforms + + + Direction + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Direction]($this.PSBase.CimInstanceProperties['Direction'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['Direction'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Direction]$x + + + Action + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Action]($this.PSBase.CimInstanceProperties['Action'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['Action'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Action]$x + + + EdgeTraversalPolicy + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.EdgeTraversal]($this.PSBase.CimInstanceProperties['EdgeTraversalPolicy'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['EdgeTraversalPolicy'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.EdgeTraversal]$x + + + LSM + LooseSourceMapping + + + PrimaryStatus + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]($this.PSBase.CimInstanceProperties['PrimaryStatus'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['PrimaryStatus'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]$x + + + Status + $this.PSBase.CimInstanceProperties["Status"].Value + " (" + ($this.PSBase.CimInstanceProperties["StatusCode"].Value + 0) + ")" + + + EnforcementStatus + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatEnforcementStatus($this.PSBase.CimInstanceProperties["EnforcementStatus"].Value) + + + PolicyStoreSourceType + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]($this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]$x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetConSecRule + + + IPsecRuleName + InstanceID + + + ID + IPsecRuleName + + + Name + IPsecRuleName + + + DisplayName + $this.PSBase.CimInstanceProperties["DisplayName"].Value + param($x) ; $this.PSBase.CimInstanceProperties["DisplayName"].Value = $x ; $this.PSBase.CimInstanceProperties["ElementName"].Value = $x + + + Group + RuleGroup + + + Enabled + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Enabled]($this.PSBase.CimInstanceProperties['Enabled'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['Enabled'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Enabled]$x + + + Profile + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Profile]($this.PSBase.CimInstanceProperties['Profiles'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['Profiles'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Profile]$x + + + Platform + Platforms + + + Mode + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.IPsecMode]($this.PSBase.CimInstanceProperties['Mode'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['Mode'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.IPsecMode]$x + + + InboundSecurity + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.SecurityPolicy]($this.PSBase.CimInstanceProperties['InboundSecurity'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['InboundSecurity'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.SecurityPolicy]$x + + + SecIn + InboundSecurity + + + OutboundSecurity + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.SecurityPolicy]($this.PSBase.CimInstanceProperties['OutboundSecurity'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['OutboundSecurity'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.SecurityPolicy]$x + + + SecOut + OutboundSecurity + + + QuickModeCryptoSet + $x = $this.PSBase.CimInstanceProperties["QuickModeCryptoSet"].Value; if ($x -ne $null -and $x.ToUpperInvariant().Equals("{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE2}")) { "Default"; } else { $x } + param($x) +if ($x.PSTypeNames.Contains("Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEQMCryptoSet")) { + $this.PSBase.CimInstanceProperties["QuickModeCryptoSet"].Value = $x.ID; +} elseif ($x.ToUpperInvariant().Equals("DEFAULT")) { + $this.PSBase.CimInstanceProperties["QuickModeCryptoSet"].Value = "{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE2}"; +} else { + $this.PSBase.CimInstanceProperties["QuickModeCryptoSet"].Value = $x; +} + + + Phase1AuthSet + $x = $this.PSBase.CimInstanceProperties["Phase1AuthSet"].Value; if ($x -ne $null -and $x.ToUpperInvariant().Equals("{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE3}")) { "Default"; } else { $x } + param($x) +if ($x.PSTypeNames.Contains("Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEMMAuthSet")) { + $this.PSBase.CimInstanceProperties["Phase1AuthSet"].Value = $x.ID; +} elseif ($x.ToUpperInvariant().Equals("DEFAULT")) { + $this.PSBase.CimInstanceProperties["Phase1AuthSet"].Value = "{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE3}"; +} else { + $this.PSBase.CimInstanceProperties["Phase1AuthSet"].Value = $x; +} + + + Phase2AuthSet + $x = $this.PSBase.CimInstanceProperties["Phase2AuthSet"].Value; if ($x -ne $null -and $x.ToUpperInvariant().Equals("{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE4}")) { "Default"; } else { $x } + param($x) +if ($x.PSTypeNames.Contains("Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEEMAuthSet")) { + $this.PSBase.CimInstanceProperties["Phase2AuthSet"].Value = $x.ID; +} elseif ($x.ToUpperInvariant().Equals("DEFAULT")) { + $this.PSBase.CimInstanceProperties["Phase2AuthSet"].Value = "{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE4}"; +} else { + $this.PSBase.CimInstanceProperties["Phase2AuthSet"].Value = $x; +} + + + KeyModule + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.KeyModule]($this.PSBase.CimInstanceProperties['KeyModule'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['KeyModule'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.KeyModule]$x + + + RemoteTunnelHostname + RemoteTunnelEndpointDNSName + + + ForwardPathLifetime + MaxReturnPathLifetimeSeconds + + + EncryptedTunnelBypass + BypassTunnelIfEncrypted + + + User + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableString($this.PSBase.CimInstanceProperties["Users"].Value) + param($x) ; $this.PSBase.CimInstanceProperties["Users"].Value = $x + + + Machine + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableString($this.PSBase.CimInstanceProperties["Machines"].Value) + param($x) ; $this.PSBase.CimInstanceProperties["Machines"].Value = $x + + + PrimaryStatus + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]($this.PSBase.CimInstanceProperties['PrimaryStatus'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['PrimaryStatus'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]$x + + + Status + $this.PSBase.CimInstanceProperties["Status"].Value + " (" + ($this.PSBase.CimInstanceProperties["StatusCode"].Value + 0) + ")" + + + EnforcementStatus + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatEnforcementStatus($this.PSBase.CimInstanceProperties["EnforcementStatus"].Value) + + + PolicyStoreSourceType + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]($this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]$x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetMainModeRule + + + Name + InstanceID + + + ID + Name + + + DisplayName + $this.PSBase.CimInstanceProperties["DisplayName"].Value + param($x) ; $this.PSBase.CimInstanceProperties["DisplayName"].Value = $x ; $this.PSBase.CimInstanceProperties["ElementName"].Value = $x + + + Group + RuleGroup + + + Enabled + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Enabled]($this.PSBase.CimInstanceProperties['Enabled'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['Enabled'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Enabled]$x + + + Profile + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Profile]($this.PSBase.CimInstanceProperties['Profiles'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['Profiles'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Profile]$x + + + Platform + Platforms + + + MainModeCryptoSet + $x = $this.PSBase.CimInstanceProperties["MainModeCryptoSet"].Value; if ($x -ne $null -and $x.ToUpperInvariant().Equals("{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE1}")) { "Default"; } else { $x } + param($x) +if ($x.PSTypeNames.Contains("Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEMMCryptoSet")) { + $this.PSBase.CimInstanceProperties["MainModeCryptoSet"].Value = $x.ID; +} elseif ($x.ToUpperInvariant().Equals("DEFAULT")) { + $this.PSBase.CimInstanceProperties["MainModeCryptoSet"].Value = "{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE1}"; +} else { + $this.PSBase.CimInstanceProperties["MainModeCryptoSet"].Value = $x; +} + + + Phase1AuthSet + $x = $this.PSBase.CimInstanceProperties["Phase1AuthSet"].Value; if ($x -ne $null -and $x.ToUpperInvariant().Equals("{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE3}")) { "Default"; } else { $x } + param($x) +if ($x.PSTypeNames.Contains("Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEMMAuthSet")) { + $this.PSBase.CimInstanceProperties["Phase1AuthSet"].Value = $x.ID; +} elseif ($x.ToUpperInvariant().Equals("DEFAULT")) { + $this.PSBase.CimInstanceProperties["Phase1AuthSet"].Value = "{E5A5D32A-4BCE-4E4D-B07F-4AB1BA7E5FE3}"; +} else { + $this.PSBase.CimInstanceProperties["Phase1AuthSet"].Value = $x; +} + + + PrimaryStatus + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]($this.PSBase.CimInstanceProperties['PrimaryStatus'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['PrimaryStatus'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]$x + + + Status + $this.PSBase.CimInstanceProperties["Status"].Value + " (" + ($this.PSBase.CimInstanceProperties["StatusCode"].Value + 0) + ")" + + + EnforcementStatus + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatEnforcementStatus($this.PSBase.CimInstanceProperties["EnforcementStatus"].Value) + + + PolicyStoreSourceType + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]($this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]$x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetAddressFilter + + + LocalAddress + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableStringArray($this.PSBase.CimInstanceProperties["LocalAddress"].Value) + param($x) ; $this.PSBase.CimInstanceProperties["LocalAddress"].Value = $x + + + LocalIP + LocalAddress + + + RemoteAddress + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableStringArray($this.PSBase.CimInstanceProperties["RemoteAddress"].Value) + param($x) ; $this.PSBase.CimInstanceProperties["RemoteAddress"].Value = $x + + + RemoteIP + RemoteAddress + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetApplicationFilter + + + Program + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableString($this.PSBase.CimInstanceProperties["AppPath"].Value) + param($x) ; $this.PSBase.CimInstanceProperties["AppPath"].Value = $x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetInterfaceFilter + + + InterfaceAlias + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableStringArray($this.PSBase.CimInstanceProperties["InterfaceAlias"].Value) + param($x) ; $this.PSBase.CimInstanceProperties["InterfaceAlias"].Value = $x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetInterfaceTypeFilter + + + InterfaceType + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.InterfaceType]($this.PSBase.CimInstanceProperties['InterfaceType'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['InterfaceType'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.InterfaceType]$x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetNetworkLayerSecurityFilter + + + Authentication + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Authentication]($this.PSBase.CimInstanceProperties['Authentication'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['Authentication'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Authentication]$x + + + Encryption + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Encryption]($this.PSBase.CimInstanceProperties['Encryption'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['Encryption'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Encryption]$x + + + LocalUser + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableString($this.PSBase.CimInstanceProperties["LocalUsers"].Value) + param($x) ; $this.PSBase.CimInstanceProperties["LocalUsers"].Value = $x + + + RemoteUser + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableString($this.PSBase.CimInstanceProperties["RemoteUsers"].Value) + param($x) ; $this.PSBase.CimInstanceProperties["RemoteUsers"].Value = $x + + + RemoteMachine + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableString($this.PSBase.CimInstanceProperties["RemoteMachines"].Value) + param($x) ; $this.PSBase.CimInstanceProperties["RemoteMachines"].Value = $x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetProtocolPortFilter + + + Protocol + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableString($this.PSBase.CimInstanceProperties["Protocol"].Value) + param($x) ; $this.PSBase.CimInstanceProperties["Protocol"].Value = $x + + + LocalPort + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableStringArray($this.PSBase.CimInstanceProperties["LocalPort"].Value) + param($x) ; $this.PSBase.CimInstanceProperties["LocalPort"].Value = $x + + + RemotePort + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableStringArray($this.PSBase.CimInstanceProperties["RemotePort"].Value) + param($x) ; $this.PSBase.CimInstanceProperties["RemotePort"].Value = $x + + + IcmpType + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableStringArray($this.PSBase.CimInstanceProperties["IcmpType"].Value) + param($x) ; $this.PSBase.CimInstanceProperties["IcmpType"].Value = $x + + + DynamicTarget + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.DynamicTransport]($this.PSBase.CimInstanceProperties['DynamicTransport'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['DynamicTransport'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.DynamicTransport]$x + + + DynamicTransport + DynamicTarget + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetServiceFilter + + + Service + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatNullableString($this.PSBase.CimInstanceProperties["ServiceName"].Value) + param($x) ; $this.PSBase.CimInstanceProperties["ServiceName"].Value = $x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEP1AuthSet + + + Name + InstanceID + + + ID + Name + + + DisplayName + $this.PSBase.CimInstanceProperties["DisplayName"].Value + param($x) ; $this.PSBase.CimInstanceProperties["DisplayName"].Value = $x ; $this.PSBase.CimInstanceProperties["ElementName"].Value = $x + + + Group + RuleGroup + + + Proposal + Proposals + + + PrimaryStatus + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]($this.PSBase.CimInstanceProperties['PrimaryStatus'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['PrimaryStatus'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]$x + + + Status + $this.PSBase.CimInstanceProperties["Status"].Value + " (" + ($this.PSBase.CimInstanceProperties["StatusCode"].Value + 0) + ")" + + + EnforcementStatus + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatEnforcementStatus($this.PSBase.CimInstanceProperties["EnforcementStatus"].Value) + + + PolicyStoreSourceType + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]($this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]$x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEP2AuthSet + + + Name + InstanceID + + + ID + Name + + + DisplayName + $this.PSBase.CimInstanceProperties["DisplayName"].Value + param($x) ; $this.PSBase.CimInstanceProperties["DisplayName"].Value = $x ; $this.PSBase.CimInstanceProperties["ElementName"].Value = $x + + + Group + RuleGroup + + + Proposal + Proposals + + + PrimaryStatus + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]($this.PSBase.CimInstanceProperties['PrimaryStatus'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['PrimaryStatus'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]$x + + + Status + $this.PSBase.CimInstanceProperties["Status"].Value + " (" + ($this.PSBase.CimInstanceProperties["StatusCode"].Value + 0) + ")" + + + EnforcementStatus + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatEnforcementStatus($this.PSBase.CimInstanceProperties["EnforcementStatus"].Value) + + + PolicyStoreSourceType + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]($this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]$x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEBasicAuthProposal + + + AuthenticationMethod + [Microsoft.Windows.Firewall.Commands.AuthenticationMethod]($this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.AuthenticationMethod]$x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEKerbAuthProposal + + + AuthenticationMethod + [Microsoft.Windows.Firewall.Commands.AuthenticationMethod]($this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.AuthenticationMethod]$x + + + Proxy + KerbProxy + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEPSKAuthProposal + + + AuthenticationMethod + [Microsoft.Windows.Firewall.Commands.AuthenticationMethod]($this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.AuthenticationMethod]$x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKECertAuthProposal + + + AuthenticationMethod + [Microsoft.Windows.Firewall.Commands.AuthenticationMethod]($this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.AuthenticationMethod]$x + + + Authority + TrustedCA + + + AuthorityType + [Microsoft.Windows.Firewall.Commands.CertificateAuthorityType]($this.PSBase.CimInstanceProperties['TrustedCAType'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['TrustedCAType'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.CertificateAuthorityType]$x + + + AccountMapping + MapToAccount + + + Signing + [Microsoft.Windows.Firewall.Commands.CertificateSigningAlgorithm]($this.PSBase.CimInstanceProperties['SigningAlgorithm'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['SigningAlgorithm'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.CertificateSigningAlgorithm]$x + + + SubjectName + CertName + + + SubjectNameType + [Microsoft.Windows.Firewall.Commands.CertificateSubjectType]($this.PSBase.CimInstanceProperties['CertNameType'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['CertNameType'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.CertificateSubjectType]$x + + + ExtendedKeyUsage + EKUs + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEMMCryptoSet + + + Name + InstanceID + + + ID + Name + + + DisplayName + $this.PSBase.CimInstanceProperties["DisplayName"].Value + param($x) ; $this.PSBase.CimInstanceProperties["DisplayName"].Value = $x ; $this.PSBase.CimInstanceProperties["ElementName"].Value = $x + + + Group + RuleGroup + + + Proposal + Proposals + + + MaxMinutes + MaxLifetimeMinutes + + + MaxSessions + MaxLifetimeSessions + + + PrimaryStatus + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]($this.PSBase.CimInstanceProperties['PrimaryStatus'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['PrimaryStatus'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]$x + + + Status + $this.PSBase.CimInstanceProperties["Status"].Value + " (" + ($this.PSBase.CimInstanceProperties["StatusCode"].Value + 0) + ")" + + + EnforcementStatus + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatEnforcementStatus($this.PSBase.CimInstanceProperties["EnforcementStatus"].Value) + + + PolicyStoreSourceType + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]($this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]$x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEQMCryptoSet + + + Name + InstanceID + + + ID + Name + + + DisplayName + $this.PSBase.CimInstanceProperties["DisplayName"].Value + param($x) ; $this.PSBase.CimInstanceProperties["DisplayName"].Value = $x ; $this.PSBase.CimInstanceProperties["ElementName"].Value = $x + + + Group + RuleGroup + + + Proposal + Proposals + + + PerfectForwardSecrecyGroup + [Microsoft.Windows.Firewall.Commands.DiffieHellmanGroup]($this.PSBase.CimInstanceProperties['PfsGroupID'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['PfsGroupID'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.DiffieHellmanGroup]$x + + + PfsGroup + PerfectForwardSecrecyGroup + + + PrimaryStatus + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]($this.PSBase.CimInstanceProperties['PrimaryStatus'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['PrimaryStatus'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PrimaryStatus]$x + + + Status + $this.PSBase.CimInstanceProperties["Status"].Value + " (" + ($this.PSBase.CimInstanceProperties["StatusCode"].Value + 0) + ")" + + + EnforcementStatus + [Microsoft.Windows.Firewall.Commands.Formatting.Formatter]::FormatEnforcementStatus($this.PSBase.CimInstanceProperties["EnforcementStatus"].Value) + + + PolicyStoreSourceType + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]($this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]$x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEMMCryptoProposal + + + Encryption + [Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]($this.PSBase.CimInstanceProperties['CipherAlgorithm'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['CipherAlgorithm'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]$x + + + Hash + [Microsoft.Windows.Firewall.Commands.HashAlgorithm]($this.PSBase.CimInstanceProperties['HashAlgorithm'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['HashAlgorithm'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.HashAlgorithm]$x + + + KeyExchange + [Microsoft.Windows.Firewall.Commands.DiffieHellmanGroup]($this.PSBase.CimInstanceProperties['GroupID'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['GroupID'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.DiffieHellmanGroup]$x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIKEQMCryptoProposal + + + Encapsulation + [Microsoft.Windows.Firewall.Commands.IPsecEncapsulation]($this.PSBase.CimInstanceProperties['Encapsulation'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['Encapsulation'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.IPsecEncapsulation]$x + + + AhHash + [Microsoft.Windows.Firewall.Commands.HashAlgorithm]($this.PSBase.CimInstanceProperties['HashAlgorithmAH'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['HashAlgorithmAH'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.HashAlgorithm]$x + + + EspHash + [Microsoft.Windows.Firewall.Commands.HashAlgorithm]($this.PSBase.CimInstanceProperties['HashAlgorithmESP'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['HashAlgorithmESP'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.HashAlgorithm]$x + + + Encryption + [Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]($this.PSBase.CimInstanceProperties['CipherAlgorithm'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['CipherAlgorithm'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]$x + + + MaxKilobytes + MaxLifetimeKilobytes + + + MaxMinutes + MaxLifetimeMinutes + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetFirewallProfile + + + Profile + Name + + + Enabled + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['Enabled'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['Enabled'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x + + + DefaultInboundAction + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Action]($this.PSBase.CimInstanceProperties['DefaultInboundAction'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['DefaultInboundAction'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Action]$x + + + DefaultOutboundAction + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Action]($this.PSBase.CimInstanceProperties['DefaultOutboundAction'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['DefaultOutboundAction'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Action]$x + + + AllowInboundRules + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['AllowInboundRules'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['AllowInboundRules'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x + + + AllowLocalFirewallRules + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['AllowLocalFirewallRules'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['AllowLocalFirewallRules'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x + + + AllowLocalIPsecRules + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['AllowLocalIPsecRules'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['AllowLocalIPsecRules'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x + + + AllowUserApps + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['AllowUserApps'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['AllowUserApps'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x + + + AllowUserPorts + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['AllowUserPorts'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['AllowUserPorts'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x + + + AllowUnicastResponseToMulticast + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['AllowUnicastResponseToMulticast'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['AllowUnicastResponseToMulticast'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x + + + NotifyOnListen + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['NotifyOnListen'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['NotifyOnListen'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x + + + EnableStealthModeForIPsec + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['EnableStealthModeForIPsec'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['EnableStealthModeForIPsec'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x + + + LogMaxSizeKilobytes + $x = $this.PSBase.CimInstanceProperties["LogMaxSizeKilobytes"]; if ($x -ne $null -and $x.Value -ne $null -and $x.Value.ToString().ToUpperInvariant().Equals("4294967296")) { "NotConfigured"; } else { $x.Value } + param($x) + if ($x.ToUpperInvariant().Equals("NOTCONFIGURED")) { $this.PSBase.CimInstanceProperties["LogMaxSizeKilobytes"].Value = 4294967296; } else { $this.PSBase.CimInstanceProperties["LogMaxSizeKilobytes"].Value = [uint32]$x; } + + + LogAllowed + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['LogAllowed'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['LogAllowed'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x + + + LogBlocked + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['LogBlocked'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['LogBlocked'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x + + + LogIgnored + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['LogIgnored'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['LogIgnored'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSecDeltaCollection + + + Action + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.ChangeAction]($this.PSBase.CimInstanceProperties['Action'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['Action'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.ChangeAction]$x + + + EndpointType + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.EndpointType]($this.PSBase.CimInstanceProperties['EndpointType'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['EndpointType'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.EndpointType]$x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPsecDoSPSetting + + + Name + ElementName + + + IpV6IPsecUnauthDscp + $x = $this.PSBase.CimInstanceProperties["IpV6IPsecUnauthDscp"]; if ($x -ne $null -and $x.Value -ne $null -and $x.Value.ToString().ToUpperInvariant().Equals("255")) { "Disabled"; } else { $x.Value } + param($x) + if ($x.ToUpperInvariant().Equals("DISABLED")) { $this.PSBase.CimInstanceProperties["IpV6IPsecUnauthDscp"].Value = 255; } else { $this.PSBase.CimInstanceProperties["IpV6IPsecUnauthDscp"].Value = [uint32]$x; } + + + IpV6IPsecAuthDscp + $x = $this.PSBase.CimInstanceProperties["IpV6IPsecAuthDscp"]; if ($x -ne $null -and $x.Value -ne $null -and $x.Value.ToString().ToUpperInvariant().Equals("255")) { "Disabled"; } else { $x.Value } + param($x) + if ($x.ToUpperInvariant().Equals("DISABLED")) { $this.PSBase.CimInstanceProperties["IpV6IPsecAuthDscp"].Value = 255; } else { $this.PSBase.CimInstanceProperties["IpV6IPsecAuthDscp"].Value = [uint32]$x; } + + + IcmpV6Dscp + $x = $this.PSBase.CimInstanceProperties["IcmpV6Dscp"]; if ($x -ne $null -and $x.Value -ne $null -and $x.Value.ToString().ToUpperInvariant().Equals("255")) { "Disabled"; } else { $x.Value } + param($x) + if ($x.ToUpperInvariant().Equals("DISABLED")) { $this.PSBase.CimInstanceProperties["IcmpV6Dscp"].Value = 255; } else { $this.PSBase.CimInstanceProperties["IcmpV6Dscp"].Value = [uint32]$x; } + + + IpV6FilterExemptDscp + $x = $this.PSBase.CimInstanceProperties["IpV6FilterExemptDscp"]; if ($x -ne $null -and $x.Value -ne $null -and $x.Value.ToString().ToUpperInvariant().Equals("255")) { "Disabled"; } else { $x.Value } + param($x) + if ($x.ToUpperInvariant().Equals("DISABLED")) { $this.PSBase.CimInstanceProperties["IpV6FilterExemptDscp"].Value = 255; } else { $this.PSBase.CimInstanceProperties["IpV6FilterExemptDscp"].Value = [uint32]$x; } + + + DefBlockExemptDscp + $x = $this.PSBase.CimInstanceProperties["DefBlockExemptDscp"]; if ($x -ne $null -and $x.Value -ne $null -and $x.Value.ToString().ToUpperInvariant().Equals("255")) { "Disabled"; } else { $x.Value } + param($x) + if ($x.ToUpperInvariant().Equals("DISABLED")) { $this.PSBase.CimInstanceProperties["DefBlockExemptDscp"].Value = 255; } else { $this.PSBase.CimInstanceProperties["DefBlockExemptDscp"].Value = [uint32]$x; } + + + EnabledKeyingModules + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.DospKeyModules]($this.PSBase.CimInstanceProperties['EnabledKeyingModules'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['EnabledKeyingModules'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.DospKeyModules]$x + + + FilteringFlags + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.DospFlags]($this.PSBase.CimInstanceProperties['FilteringFlags'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['FilteringFlags'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.DospFlags]$x + + + EffectiveAddressFamily + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.AddressVersion]($this.PSBase.CimInstanceProperties['EffectiveAddressFamily'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['EffectiveAddressFamily'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.AddressVersion]$x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPsecIdentity + + + ImpersonationType + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.ImpersonationType]($this.PSBase.CimInstanceProperties['ImpersonationType'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['ImpersonationType'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.ImpersonationType]$x + + + AuthenticationMethod + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.EffectiveAuthenticationMethod]($this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['AuthenticationMethod'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.EffectiveAuthenticationMethod]$x + + + Flags + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.IdFlags]($this.PSBase.CimInstanceProperties['Flags'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['Flags'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.IdFlags]$x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetMainModeSA + + + ID + Name + + + CipherAlgorithm + [Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]($this.PSBase.CimInstanceProperties['CipherAlgorithm'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['CipherAlgorithm'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]$x + + + HashAlgorithm + [Microsoft.Windows.Firewall.Commands.HashAlgorithm]($this.PSBase.CimInstanceProperties['HashAlgorithm'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['HashAlgorithm'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.HashAlgorithm]$x + + + GroupId + [Microsoft.Windows.Firewall.Commands.DiffieHellmanGroup]($this.PSBase.CimInstanceProperties['GroupId'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['GroupId'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.DiffieHellmanGroup]$x + + + KeyModule + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.EffectiveKeyModule]($this.PSBase.CimInstanceProperties['KeyModule'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['KeyModule'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.EffectiveKeyModule]$x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetQuickModeSA + + + Name + InstanceID + + + ID + Name + + + EncapsulationMode + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.IPsecMode]($this.PSBase.CimInstanceProperties['EncapsulationMode'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['EncapsulationMode'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.IPsecMode]$x + + + Direction + $dir = $this.PSBase.CimInstanceProperties["InboundDirection"]; if ($dir -ne $null -and $dir.Value -ne $null -and $dir.Value.Equals($true)) { [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Direction]::Inbound } else { [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Direction]::Outbound } + + + FirstTransformType + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.QmSATransformType]($this.PSBase.CimInstanceProperties['FirstTransformType'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['FirstTransformType'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.QmSATransformType]$x + + + FirstIntegrityAlgorithm + [Microsoft.Windows.Firewall.Commands.HashAlgorithm]($this.PSBase.CimInstanceProperties['FirstIntegrityAlgorithm'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['FirstIntegrityAlgorithm'].Value = [System.Uint32][Microsoft.Windows.Firewall.Commands.HashAlgorithm]$x + + + FirstCipherAlgorithm + [Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]($this.PSBase.CimInstanceProperties['FirstCipherAlgorithm'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['FirstCipherAlgorithm'].Value = [System.Uint32][Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]$x + + + SecondTransformType + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.QmSATransformType]($this.PSBase.CimInstanceProperties['SecondTransformType'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['SecondTransformType'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.QmSATransformType]$x + + + SecondIntegrityAlgorithm + [Microsoft.Windows.Firewall.Commands.HashAlgorithm]($this.PSBase.CimInstanceProperties['SecondIntegrityAlgorithm'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['SecondIntegrityAlgorithm'].Value = [System.Uint32][Microsoft.Windows.Firewall.Commands.HashAlgorithm]$x + + + SecondCipherAlgorithm + [Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]($this.PSBase.CimInstanceProperties['SecondCipherAlgorithm'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['SecondCipherAlgorithm'].Value = [System.Uint32][Microsoft.Windows.Firewall.Commands.EncryptionAlgorithm]$x + + + Flags + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.QmBundleFlags]($this.PSBase.CimInstanceProperties['Flags'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['Flags'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.QmBundleFlags]$x + + + PfsGroupId + [Microsoft.Windows.Firewall.Commands.DiffieHellmanGroup]($this.PSBase.CimInstanceProperties['PfsGroupId'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['PfsGroupId'].Value = [System.Uint16][Microsoft.Windows.Firewall.Commands.DiffieHellmanGroup]$x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSecuritySettingData + + + Name + ElementName + + + Exemptions + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.TrafficExemption]($this.PSBase.CimInstanceProperties['Exemptions'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['Exemptions'].Value = [System.Uint32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.TrafficExemption]$x + + + EnableStatefulFtp + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['EnableStatefulFtp'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['EnableStatefulFtp'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x + + + EnableStatefulPptp + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['EnableStatefulPptp'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['EnableStatefulPptp'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x + + + ActiveProfile + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Profile]($this.PSBase.CimInstanceProperties['Profile'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['Profile'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.Profile]$x + + + RequireFullAuthSupport + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]($this.PSBase.CimInstanceProperties['RequireFullAuthSupport'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['RequireFullAuthSupport'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.GpoBoolean]$x + + + CertValidationLevel + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.CRLCheck]($this.PSBase.CimInstanceProperties['CertValidationLevel'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['CertValidationLevel'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.CRLCheck]$x + + + AllowIPsecThroughNAT + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.IPsecThroughNAT]($this.PSBase.CimInstanceProperties['AllowIPsecThroughNAT'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['AllowIPsecThroughNAT'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.IPsecThroughNAT]$x + + + MaxSAIdleTimeSeconds + $x = $this.PSBase.CimInstanceProperties["MaxSAIdleTimeSeconds"]; if ($x -ne $null -and $x.Value -ne $null -and $x.Value.ToString().Equals("0")) { "NotConfigured"; } else { $x.Value } + param($x) + if ($x.ToUpperInvariant().Equals("NOTCONFIGURED")) { $this.PSBase.CimInstanceProperties["MaxSAIdleTimeSeconds"].Value = 0; } else { $this.PSBase.CimInstanceProperties["MaxSAIdleTimeSeconds"].Value = [uint32]$x; } + + + KeyEncoding + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.KeyEncoding]($this.PSBase.CimInstanceProperties['KeyEncoding'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['KeyEncoding'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.KeyEncoding]$x + + + EnablePacketQueuing + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PacketQueuing]($this.PSBase.CimInstanceProperties['EnablePacketQueuing'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['EnablePacketQueuing'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PacketQueuing]$x + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetGPO + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetFirewallDynamicKeywordAddress + + + PolicyStoreSourceType + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]($this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value + 0) + param($x); $this.PSBase.CimInstanceProperties['PolicyStoreSourceType'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetSecurity.PolicyStoreType]$x + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSecurity/ko/Microsoft.Windows.Firewall.Commands.Resources.dll b/newton-cn/bin/v1.0/Modules/NetSecurity/ko/Microsoft.Windows.Firewall.Commands.Resources.dll new file mode 100644 index 0000000..bab060c Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/NetSecurity/ko/Microsoft.Windows.Firewall.Commands.Resources.dll differ diff --git a/newton-cn/bin/v1.0/Modules/NetSwitchTeam/MSFT_NetSwitchTeam.cdxml b/newton-cn/bin/v1.0/Modules/NetSwitchTeam/MSFT_NetSwitchTeam.cdxml new file mode 100644 index 0000000..fe18d98 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSwitchTeam/MSFT_NetSwitchTeam.cdxml @@ -0,0 +1,146 @@ + + + + 1.0 + NetSwitchTeam + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSwitchTeam/MSFT_NetSwitchTeam.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetSwitchTeam/MSFT_NetSwitchTeam.format.ps1xml new file mode 100644 index 0000000..aa64e0b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSwitchTeam/MSFT_NetSwitchTeam.format.ps1xml @@ -0,0 +1,69 @@ + + + + + MSFT_NetSwitchTeam_ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT\StandardCimV2\MSFT_NetSwitchTeam + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSwitchTeam + + + + + + + + Name + + + + $members = Get-NetSwitchTeamMember * $_.Name + $mnames= @() + foreach($m in @($members)){$mnames += $m.Name} + $mnames + + + + + + + + + + MSFT_NetSwitchTeam_TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT\StandardCimV2\MSFT_NetSwitchTeam + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSwitchTeam + + + + + + 10 + + + + 15 + + + + + + + Name + + + + $members = $_ | Get-NetSwitchTeamMember + $mnames = @() + foreach($m in @($members)){$mnames += $m.Name} + $mnames + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSwitchTeam/MSFT_NetSwitchTeamMember.cdxml b/newton-cn/bin/v1.0/Modules/NetSwitchTeam/MSFT_NetSwitchTeamMember.cdxml new file mode 100644 index 0000000..6e87fa3 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSwitchTeam/MSFT_NetSwitchTeamMember.cdxml @@ -0,0 +1,25 @@ + + + + 1.0 + NetSwitchTeamMember + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSwitchTeam/MSFT_NetSwitchTeamMember.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetSwitchTeam/MSFT_NetSwitchTeamMember.format.ps1xml new file mode 100644 index 0000000..725009c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSwitchTeam/MSFT_NetSwitchTeamMember.format.ps1xml @@ -0,0 +1,92 @@ + + + + + MSFT_NetSwitchTeamMember_ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT\StandardCimV2\MSFT_NetSwitchTeamMember + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSwitchTeamMember + + + + + + + + Name + + + + InterfaceDescription + + + + Team + + + + TransmitLinkSpeed + + + + ReceiveLinkSpeed + + + + + + + + MSFT_NetSwitchTeamMember_TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT\StandardCimV2\MSFT_NetSwitchTeamMember + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetSwitchTeamMember + + + + + + 12 + + + + 15 + + + + 10 + + + + 10 + + + + 10 + + + + + + + Name + + + InterfaceDescription + + + Team + + + TransmitLinkSpeed + + + ReceiveLinkSpeed + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetSwitchTeam/NetSwitchTeam.psd1 b/newton-cn/bin/v1.0/Modules/NetSwitchTeam/NetSwitchTeam.psd1 new file mode 100644 index 0000000..b8930a7 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetSwitchTeam/NetSwitchTeam.psd1 @@ -0,0 +1,44 @@ +<#++ + +Copyright (c) Microsoft Corporation + +Module Name: + + NetSwitchTeam.psd1 + +Abstract: + + This module is the container schema for the NetSwitchTeam* CIM object + CmdLets. + +--#> + +@{ + GUID = 'E83097B1-4470-4F37-8CE3-A6B0AC5ED8F5' + Author = "Microsoft Corporation" + CompanyName = "Microsoft Corporation" + Copyright = "� Microsoft Corporation. All rights reserved." + HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=285556" + ModuleVersion = '1.0.0.0' + PowerShellVersion = '5.1' + NestedModules = @( + 'MSFT_NetSwitchTeam.cdxml', + 'MSFT_NetSwitchTeamMember.cdxml' + ) + FormatsToProcess = @( + 'MSFT_NetSwitchTeam.format.ps1xml', + 'MSFT_NetSwitchTeamMember.format.ps1xml' + ) + FunctionsToExport = @( + 'New-NetSwitchTeam', + 'Remove-NetSwitchTeam', + 'Get-NetSwitchTeam', + 'Rename-NetSwitchTeam', + 'Add-NetSwitchTeamMember', + 'Remove-NetSwitchTeamMember', + 'Get-NetSwitchTeamMember' + ) + CmdletsToExport = @() + AliasesToExport = @() + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetCompartment.cdxml b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetCompartment.cdxml new file mode 100644 index 0000000..9300a8e --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetCompartment.cdxml @@ -0,0 +1,29 @@ + + + + 1.0 + NetCompartment + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetIPAddress.cdxml b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetIPAddress.cdxml new file mode 100644 index 0000000..22303eb --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetIPAddress.cdxml @@ -0,0 +1,436 @@ + + + + 1.0.0 + NetIPAddress + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetIPInterface.cdxml b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetIPInterface.cdxml new file mode 100644 index 0000000..eb03145 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetIPInterface.cdxml @@ -0,0 +1,479 @@ + + + + 1.0.0 + + NetIPInterface + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetIPv4Protocol.cdxml b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetIPv4Protocol.cdxml new file mode 100644 index 0000000..2fed106 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetIPv4Protocol.cdxml @@ -0,0 +1,239 @@ + + + + 1.0.0 + NetIPv4Protocol + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetIPv6Protocol.cdxml b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetIPv6Protocol.cdxml new file mode 100644 index 0000000..23f8d78 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetIPv6Protocol.cdxml @@ -0,0 +1,292 @@ + + + + 1.0.0 + NetIPv6Protocol + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetNeighbor.cdxml b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetNeighbor.cdxml new file mode 100644 index 0000000..d867b42 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetNeighbor.cdxml @@ -0,0 +1,234 @@ + + + + 1.0.0 + NetNeighbor + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetOffloadGlobalSetting.cdxml b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetOffloadGlobalSetting.cdxml new file mode 100644 index 0000000..1eca6cc --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetOffloadGlobalSetting.cdxml @@ -0,0 +1,109 @@ + + + + 1.0.0 + NetOffloadGlobalSetting + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetPrefixPolicy.cdxml b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetPrefixPolicy.cdxml new file mode 100644 index 0000000..184fbeb --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetPrefixPolicy.cdxml @@ -0,0 +1,33 @@ + + + + 1.0.0 + NetPrefixPolicy + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetRoute.cdxml b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetRoute.cdxml new file mode 100644 index 0000000..fe8ffe5 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetRoute.cdxml @@ -0,0 +1,376 @@ + + + + 1.0.0 + NetRoute + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetTCPConnection.cdxml b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetTCPConnection.cdxml new file mode 100644 index 0000000..2af7fcc --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetTCPConnection.cdxml @@ -0,0 +1,100 @@ + + + + 1.0.0 + NetTCPConnection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetTCPSetting.cdxml b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetTCPSetting.cdxml new file mode 100644 index 0000000..233829d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetTCPSetting.cdxml @@ -0,0 +1,324 @@ + + + + 1.0.0 + NetTCPSetting + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetTransportFilter.cdxml b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetTransportFilter.cdxml new file mode 100644 index 0000000..88369a7 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetTransportFilter.cdxml @@ -0,0 +1,126 @@ + + + + 1.0.0 + NetTransportFilter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetUDPEndpoint.cdxml b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetUDPEndpoint.cdxml new file mode 100644 index 0000000..245b8a0 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetUDPEndpoint.cdxml @@ -0,0 +1,39 @@ + + + + 1.0.0 + NetUDPEndpoint + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetUDPSetting.cdxml b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetUDPSetting.cdxml new file mode 100644 index 0000000..279ceb5 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetTCPIP/MSFT_NetUDPSetting.cdxml @@ -0,0 +1,46 @@ + + + + 1.0.0 + NetUDPSetting + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/NetTCPIP/NetIPConfiguration.psm1 b/newton-cn/bin/v1.0/Modules/NetTCPIP/NetIPConfiguration.psm1 new file mode 100644 index 0000000..289a33b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetTCPIP/NetIPConfiguration.psm1 @@ -0,0 +1,300 @@ +class NetIPConfiguration +{ + [string] $ComputerName + [string] $InterfaceAlias + [int] $InterfaceIndex + [string] $InterfaceDescription + [int] $CompartmentId + [Microsoft.Management.Infrastructure.CimInstance] $NetAdapter + [Microsoft.Management.Infrastructure.CimInstance] $NetCompartment + [Microsoft.Management.Infrastructure.CimInstance] $NetIPv6Interface + [Microsoft.Management.Infrastructure.CimInstance] $NetIPv4Interface + [Microsoft.Management.Infrastructure.CimInstance] $NetProfile + [Microsoft.Management.Infrastructure.CimInstance[]] $AllIPAddresses + [Microsoft.Management.Infrastructure.CimInstance[]] $IPv6Address + [Microsoft.Management.Infrastructure.CimInstance[]] $IPv6TemporaryAddress + [Microsoft.Management.Infrastructure.CimInstance[]] $IPv6LinkLocalAddress + [Microsoft.Management.Infrastructure.CimInstance[]] $IPv4Address + [Microsoft.Management.Infrastructure.CimInstance[]] $IPv6DefaultGateway + [Microsoft.Management.Infrastructure.CimInstance[]] $IPv4DefaultGateway + [Microsoft.Management.Infrastructure.CimInstance[]] $DNSServer + [bool] $Detailed = $false +} + +# .Link +# http://go.microsoft.com/fwlink/?LinkId=253567 +# .ExternalHelp NetIPConfiguration.psm1-help.xml +function Get-NetIPConfiguration +{ + [CmdletBinding(DefaultParametersetName="Alias" )] + Param( + [Parameter(ParameterSetName = "Alias", Mandatory = $false, ValueFromPipelineByPropertyName = $true, Position = 0)] [Alias('ifAlias')] [string]$InterfaceAlias = "*", + [Parameter(ParameterSetName = "Index", Mandatory = $true, ValueFromPipelineByPropertyName = $true)] [Alias('ifIndex')] [int]$InterfaceIndex = -1, + [Parameter(ParameterSetName = "All", Mandatory = $true)] [Alias('IncludeAllInterfaces')] [switch]$All = $false, + [Parameter(Mandatory = $false)] [Alias('IncludeAllCompartments')] [switch]$AllCompartments = $false, + [Parameter(Mandatory = $false, ValueFromPipelineByPropertyName = $true)] [int]$CompartmentId = -1, + [Parameter(Mandatory = $false)] [switch]$Detailed = $false, + [Parameter(Mandatory = $false, ValueFromPipelineByPropertyName = $true)] [Alias('PSComputerName','ComputerName')] [Microsoft.Management.Infrastructure.CimSession]$CimSession = $null + ) + Process + { + # + # Session defaults to localhost. + # + if ($CimSession -eq $null) + { + $CimSession = New-CimSession + $ComputerName = (Get-CimInstance win32_ComputerSystem).name + } + else + { + $ComputerName = $CimSession.ComputerName + } + + # + # Return hidden interfaces if the user query is for a specific interface. + # + if (($InterfaceAlias -ne "*") -or ($InterfaceIndex -ne -1)) + { + $All = $true + } + + # + # CompartmentId requires the AllCompartments switch. + # + if ($CompartmentId -ne -1) + { + $AllCompartments = $true; + $Compartments = Get-NetCompartment -CompartmentId $CompartmentId -CimSession $CimSession + } + else + { + $Compartments = Get-NetCompartment -CimSession $CimSession + } + + # + # Retrieve NetAdapters and NetIPInterfaces matching the user query. + # + if ($InterfaceIndex -ne -1) + { + $Adapters = Get-NetAdapter -InterfaceIndex $InterfaceIndex -IncludeHidden -CimSession $CimSession -ErrorAction SilentlyContinue + $IPInterfaces = Get-NetIPInterface -InterfaceIndex $InterfaceIndex -IncludeAllCompartments:$AllCompartments -PolicyStore ActiveStore -CimSession $CimSession + } + elseif ($InterfaceAlias -ne "*") + { + $Adapters = Get-NetAdapter -Name $InterfaceAlias -IncludeHidden -CimSession $CimSession -ErrorAction SilentlyContinue + $IPInterfaces = Get-NetIPInterface -InterfaceAlias $InterfaceAlias -IncludeAllCompartments:$AllCompartments -PolicyStore ActiveStore -CimSession $CimSession + } + else + { + $Adapters = Get-NetAdapter -IncludeHidden -CimSession $CimSession + $IPInterfaces = Get-NetIPInterface -IncludeAllCompartments:$AllCompartments -PolicyStore ActiveStore -CimSession $CimSession + } + + # + # Filter out other compartments if the user query is for a specific compartment. + # + if ($CompartmentId -ne -1) + { + $IPInterfaces = $IPInterfaces | where CompartmentId -eq $CompartmentId; + } + + # + # Get the indices of all interfaces that are bound to IP. + # + $IfIndices = $IPInterfaces | select -ExpandProperty ifIndex -Unique + + # + # Create a NetIPConfiguration for each interface index. + # + $IPConfigs = @() + + # + # Check if the Get-NetConnectionProfile cmdlet is available. + # + $NetConnectionCmdletExists = Get-Command Get-NetConnectionProfile -ErrorAction SilentlyContinue + + # + # Check if the Get-DnsClientServerAddress cmdlet is available. + # + $DNSClientCmdletExists = Get-Command Get-DnsClientServerAddress -ErrorAction SilentlyContinue + + foreach ($IfIndex in $IfIndices) + { + $IPConfig = [NetIPConfiguration]::New() + $IPConfig.ComputerName = $ComputerName + $IPConfig.InterfaceIndex = $IfIndex + $IPConfig.Detailed = $Detailed + + # + # Link up the NetAdapter and NetIPInterface objects. + # + $IPConfig.NetAdapter = $Adapters | where InterfaceIndex -eq $IfIndex + $IPConfig.NetIPv4Interface = $IPInterfaces | where {($_.InterfaceIndex -eq $IfIndex ) -and ($_.AddressFamily -eq "IPv4")} + $IPConfig.NetIPv6Interface = $IPInterfaces | where {($_.InterfaceIndex -eq $IfIndex ) -and ($_.AddressFamily -eq "IPv6")} + + # + # Filter out hidden objects if necessary. + # + if ((-not $All) -and ($IPConfig.NetAdapter.Hidden)) + { + continue + } + + # + # Filter out objects with no underlying NetAdapter, with two exceptions: + # - VPN interfaces have a LowestIfNetLuid, but should not be linked to a NetAdapter. + # - Isolation interfaces also have an IsolationId and should be linked to a NetAdapter. + # + if ($IPConfig.NetAdapter -eq $null) + { + if ($IPConfig.NetIPv6Interface.LowestIfNetLuid -ne 0) + { + if ($IPConfig.NetIPv6Interface.IsolationId -ne 0) + { + $IPConfig.NetAdapter = $Adapters | where NetLuid -eq $IPConfig.NetIPv6Interface.LowestIfNetLuid + } + } + elseif ($IPConfig.NetIPv4Interface.LowestIfNetLuid -ne 0) + { + if ($IPConfig.NetIPv4Interface.IsolationId -ne 0) + { + $IPConfig.NetAdapter = $Adapters | where NetLuid -eq $IPConfig.NetIPv4Interface.LowestIfNetLuid + } + } + else + { + continue + } + } + + # + # Find the best object to source the interface alias and compartment ID. + # + if ($IPConfig.NetIPv6Interface -ne $null) + { + $IPConfig.InterfaceAlias = $IPConfig.NetIPv6Interface.InterfaceAlias + $IPConfig.CompartmentId = $IPConfig.NetIPv6Interface.CompartmentId + } + elseif ($IPConfig.NetIPv4Interface -ne $null) + { + $IPConfig.InterfaceAlias = $IPConfig.NetIPv4Interface.InterfaceAlias + $IPConfig.CompartmentId = $IPConfig.NetIPv4Interface.CompartmentId + } + + # + # Escape wilcard characters in interface alias. + # + $IfAlias = [System.Management.Automation.WildcardPattern]::Escape($IPConfig.InterfaceAlias) + + # + # Get NetAdapter properties. + # + if ($IPConfig.NetAdapter -ne $null) + { + $IPConfig.InterfaceDescription = $IPConfig.NetAdapter.InterfaceDescription + } + + $IPConfig.NetCompartment = $Compartments | where CompartmentId -eq $IPConfig.CompartmentId + if ($NetConnectionCmdletExists) + { + $IPConfig.NetProfile = Get-NetConnectionProfile -InterfaceAlias $IfAlias -CimSession $CimSession -ErrorAction SilentlyContinue + } + + # Begin Verbose Section + write-verbose "----------------------------------------" + write-verbose "Interface $IfAlias" + write-verbose "----------------------------------------" + write-verbose "InterfaceAlias: Get-NetAdapter -Name '$IfAlias' -CimSession $ComputerName | select InterfaceAlias" + write-verbose "InterfaceIndex: Get-NetAdapter -Name '$IfAlias' -CimSession $ComputerName | select InterfaceIndex" + write-verbose "InterfaceDescription: Get-NetAdapter -Name '$IfAlias' -CimSession $ComputerName | select InterfaceDescription" + write-verbose "NetCompartment: Get-NetCompartment -CompartmentId '$CompartmentId' -CimSession $ComputerName" + if ($NetConnectionCmdletExists) + { + write-verbose "NetProfile: Get-NetConnectionProfile -InterfaceAlias '$IfAlias' -CimSession $ComputerName" + } + write-verbose "NetIPv6Interface: Get-NetIPInterface -InterfaceAlias '$IfAlias' -AddressFamily IPv6 -PolicyStore ActiveStore -CimSession $ComputerName" + write-verbose "NetIPv4Interface: Get-NetIPInterface -InterfaceAlias '$IfAlias' -AddressFamily IPv4 -PolicyStore ActiveStore -CimSession $ComputerName" + # End Verbose Section + + # + # Get IPv6 addresses. + # + $Addresses = Get-NetIPAddress -InterfaceAlias $IfAlias -AddressFamily IPv6 -IncludeAllCompartments:$AllCompartments -PolicyStore ActiveStore -CimSession $CimSession -ErrorAction SilentlyContinue + write-verbose "IPv6Address: Get-NetIPAddress -InterfaceAlias '$IfAlias' -AddressFamily IPv6 -PolicyStore ActiveStore -CimSession $ComputerName" + + $IPv6Addresses = @() + $IPv6LinkLocalAddresses = @() + $IPv6TemporaryAddresses = @() + + foreach ($Address in $Addresses) + { + if (($Address.PrefixOrigin -eq "RouterAdvertisement") -and ($Address.SuffixOrigin -eq "Random")) + { + $IPv6TemporaryAddresses += $Address + } + elseif (($Address.PrefixOrigin -eq "WellKnown") -and ($Address.SuffixOrigin -eq "Link")) + { + $IPv6LinkLocalAddresses += $Address + } + else + { + $IPv6Addresses += $Address + } + } + + $IPConfig.IPv6Address = $IPv6Addresses + $IPConfig.IPv6TemporaryAddress = $IPv6TemporaryAddresses + $IPConfig.IPv6LinkLocalAddress = $IPv6LinkLocalAddresses + + # + # Get IPv4 addresses. + # + $IPConfig.IPv4Address = Get-NetIPAddress -InterfaceAlias $IfAlias -AddressFamily IPv4 -IncludeAllCompartments:$AllCompartments -PolicyStore ActiveStore -CimSession $CimSession -ErrorAction SilentlyContinue + write-verbose "IPv4Address: Get-NetIPAddress -InterfaceAlias '$IfAlias' -AddressFamily IPv4 -PolicyStore ActiveStore -CimSession $ComputerName" + + $IPConfig.AllIPAddresses = $IPConfig.IPv4Address + $IPv6Addresses + $IPv6TemporaryAddresses + $IPv6LinkLocalAddresses + + # + # Get default gateway. + # + $IPConfig.IPv6DefaultGateway = Get-NetRoute -DestinationPrefix "::/0" -InterfaceAlias $IfAlias -IncludeAllCompartments:$AllCompartments -PolicyStore ActiveStore -CimSession $CimSession -ErrorAction SilentlyContinue + $IPConfig.IPv4DefaultGateway = Get-NetRoute -DestinationPrefix "0.0.0.0/0" -InterfaceAlias $IfAlias -IncludeAllCompartments:$AllCompartments -PolicyStore ActiveStore -CimSession $CimSession -ErrorAction SilentlyContinue + write-verbose "IPv6DefaultGateway: Get-NetRoute -DestinationPrefix '::/0' -InterfaceAlias '$IfAlias' -PolicyStore ActiveStore -CimSession $ComputerName | select NextHop" + write-verbose "IPv4DefaultGateway: Get-NetRoute -DestinationPrefix '0.0.0.0/0' -InterfaceAlias '$IfAlias' -PolicyStore ActiveStore -CimSession $ComputerName | select NextHop" + + # + # Get DNS servers. + # + if ($DNSClientCmdletExists) + { + $IPConfig.DNSServer = Get-DnsClientServerAddress -InterfaceAlias $IfAlias -CimSession $CimSession -ErrorAction SilentlyContinue | Sort AddressFamily -Descending + write-verbose "DNSServer: Get-DnsClientServerAddress -InterfaceAlias '$IfAlias' -CimSession $ComputerName | select ServerAddresses" + } + + $IPConfigs += $IPConfig + } + + # + # Group the results by compartment, where each group is sorted as: + # - first the interfaces with connected NetAdapters sorted by media type, + # - then the interfaces without a NetAdapter, + # - then the interfaces with disconnected NetAdapters sorted by media type. + # + $Return = @() + $CompartmentIds = $IPInterfaces | select -ExpandProperty CompartmentId -Unique | sort {$_.CompartmentId} + + foreach ($CompartmentId in $CompartmentIds) + { + $IPConfigsInCompartment = $IPConfigs | where {$_.CompartmentId -eq $CompartmentId} + $Return += $IPConfigsInCompartment | where {$_.NetAdapter.Status -eq "Up" } | sort {$_.NetAdapter.MediaType, $_.InterfaceIndex} + $Return += $IPConfigsInCompartment | where {$_.NetAdapter -eq $null} | sort {$_.InterfaceIndex} + $Return += $IPConfigsInCompartment | where {($_.NetAdapter -ne $null) -and ($_.NetAdapter.Status -ne "Up")} | sort {$_.NetAdapter.MediaType} | sort {$_.NetAdapter.Status} -Descending + } + + return $Return + } +} + +New-Alias gip Get-NetIPConfiguration +Export-ModuleMember -Alias gip -Function Get-NetIPConfiguration diff --git a/newton-cn/bin/v1.0/Modules/NetTCPIP/NetTCPIP.psd1 b/newton-cn/bin/v1.0/Modules/NetTCPIP/NetTCPIP.psd1 new file mode 100644 index 0000000..5950847 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetTCPIP/NetTCPIP.psd1 @@ -0,0 +1,78 @@ +@{ + GUID = "{2d0b6c7f-16a0-4185-843f-ae47b6db4551}" + Author = "Microsoft Corporation" + CompanyName = "Microsoft Corporation" + Copyright = "© Microsoft Corporation. All rights reserved." + HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=390802" + ModuleVersion = "1.0.0.0" + + PowerShellVersion = "5.1" + # Supported PSEditions + CompatiblePSEditions = @('Desktop', 'Core') + + NestedModules = @( + "MSFT_NetCompartment", + "MSFT_NetIPAddress", + "MSFT_NetIPInterface", + "MSFT_NetIPv4Protocol", + "MSFT_NetIPv6Protocol", + "MSFT_NetNeighbor", + "MSFT_NetOffloadGlobalSetting", + "MSFT_NetPrefixPolicy", + "MSFT_NetRoute", + "MSFT_NetTCPConnection", + "MSFT_NetTCPSetting", + "MSFT_NetTransportFilter", + "MSFT_NetUDPEndpoint", + "MSFT_NetUDPSetting", + "NetIPConfiguration", + "Test-NetConnection" + ) + + FormatsToProcess = @('Tcpip.Format.ps1xml') + TypesToProcess = @('Tcpip.Types.ps1xml') + + FunctionsToExport = @( + "Get-NetIPAddress", + "Get-NetIPInterface", + "Get-NetIPv4Protocol", + "Get-NetIPv6Protocol", + "Get-NetNeighbor", + "Get-NetOffloadGlobalSetting", + "Get-NetPrefixPolicy", + "Get-NetRoute", + "Get-NetTCPConnection", + "Get-NetTCPSetting", + "Get-NetTransportFilter", + "Get-NetUDPEndpoint", + "Get-NetUDPSetting", + "Get-NetCompartment", + "Get-NetIPConfiguration" + "New-NetIPAddress", + "New-NetNeighbor", + "New-NetRoute", + "New-NetTransportFilter", + "Remove-NetIPAddress", + "Remove-NetNeighbor", + "Remove-NetRoute", + "Remove-NetTransportFilter", + "Find-NetRoute", + "Set-NetIPAddress", + "Set-NetIPInterface", + "Set-NetIPv4Protocol", + "Set-NetIPv6Protocol", + "Set-NetNeighbor", + "Set-NetOffloadGlobalSetting", + "Set-NetRoute", + "Set-NetTCPSetting", + "Set-NetUDPSetting", + "Test-NetConnection" + ) + + AliasesToExport = @( + "gip", + "TNC" + ) + + CmdletsToExport = @() +} diff --git a/newton-cn/bin/v1.0/Modules/NetTCPIP/Tcpip.Format.ps1xml b/newton-cn/bin/v1.0/Modules/NetTCPIP/Tcpip.Format.ps1xml new file mode 100644 index 0000000..6fab2b6 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetTCPIP/Tcpip.Format.ps1xml @@ -0,0 +1,2043 @@ + + + + + + + DefaultView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetRoute + + + + + + 7 + + + 46 + + + 40 + + + 11 + + + + 8 + + + + 11 + + + + + + + InterfaceIndex + + + DestinationPrefix + + + NextHop + + + RouteMetric + Right + + + InterfaceMetric + + + Store + + + + + + + + + ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetRoute + + + + + + + DestinationPrefix + + + InterfaceIndex + + + InterfaceAlias + + + CompartmentId + + + AddressFamily + + + NextHop + + + Publish + + + State + + + RouteMetric + + + InterfaceMetric + + + Protocol + + + + + if ($_.ValidLifetime.Days -eq 10675199 -and + $_.ValidLifetime.Hours -eq 2 -and + $_.ValidLifetime.Minutes -eq 48 -and + $_.ValidLifetime.Seconds -eq 5 -and + $_.ValidLifetime.Milliseconds -eq 477) { + “Infinite ([TimeSpan]::MaxValue)” + } else { + $_.ValidLifetime.ToString() + } + + + + + + + if ($_.PreferredLifetime.Days -eq 10675199 -and + $_.PreferredLifetime.Hours -eq 2 -and + $_.PreferredLifetime.Minutes -eq 48 -and + $_.PreferredLifetime.Seconds -eq 5 -and + $_.PreferredLifetime.Milliseconds -eq 477) { + “Infinite ([TimeSpan]::MaxValue)” + } else { + $_.PreferredLifetime.ToString() + } + + + + + + Store + + + + + + + + + DefaultView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPAddress + + + + + + + IPAddress + + + InterfaceIndex + + + InterfaceAlias + + + AddressFamily + + + Type + + + PrefixLength + + + PrefixOrigin + + + SuffixOrigin + + + AddressState + + + + + if ($_.ValidLifetime.Days -eq 10675199 -and + $_.ValidLifetime.Hours -eq 2 -and + $_.ValidLifetime.Minutes -eq 48 -and + $_.ValidLifetime.Seconds -eq 5 -and + $_.ValidLifetime.Milliseconds -eq 477) { + “Infinite ([TimeSpan]::MaxValue)” + } else { + $_.ValidLifetime.ToString() + } + + + + + + + if ($_.PreferredLifetime.Days -eq 10675199 -and + $_.PreferredLifetime.Hours -eq 2 -and + $_.PreferredLifetime.Minutes -eq 48 -and + $_.PreferredLifetime.Seconds -eq 5 -and + $_.PreferredLifetime.Milliseconds -eq 477) { + “Infinite ([TimeSpan]::MaxValue)” + } else { + $_.PreferredLifetime.ToString() + } + + + + + SkipAsSource + + + + Store + + + + + + + + + TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPAddress + + + + + + 7 + + + 47 + + + 12 + + + 12 + + + 12 + + + 12 + + + + 11 + + + + + + + InterfaceIndex + + + IPAddress + + + PrefixLength + Right + + + PrefixOrigin + + + SuffixOrigin + + + AddressState + + + Store + + + + + + + + + DefaultView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNeighbor + + + + + + 7 + + + 50 + + + 21 + + + 11 + + + + 15 + + + + + + + InterfaceIndex + + + IPAddress + + + LinkLayerAddress + + + State + + + Store + + + + + + + + + ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNeighbor + + + + + + + IPAddress + + + InterfaceIndex + + + InterfaceAlias + + + AddressFamily + + + LinkLayerAddress + + + State + + + + Store + + + + + + + + + DefaultView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPInterface + + + + + + 7 + + + 31 + + + 13 + + + + 12 + + + 15 + + + 8 + + + 15 + + + + 11 + + + + + + + InterfaceIndex + + + InterfaceAlias + + + AddressFamily + + + NlMtu + Right + + + InterfaceMetric + Right + + + Dhcp + + + ConnectionState + + + Store + + + + + + + + + ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPInterface + + + + + + + InterfaceIndex + + + InterfaceAlias + + + CompartmentId + + + AddressFamily + + + Forwarding + + + ClampMss + + + Advertising + + + NlMtu + + + + AutomaticMetric + + + InterfaceMetric + + + NeighborDiscoverySupported + + + NeighborUnreachabilityDetection + + + BaseReachableTime + + + + ReachableTime + + + + RetransmitTime + + + + DadTransmits + + + DadRetransmitTime + + + + RouterDiscovery + + + ManagedAddressConfiguration + + + OtherStatefulConfiguration + + + WeakHostSend + + + WeakHostReceive + + + IgnoreDefaultRoutes + + + + + if ($_.AdvertisedRouterLifetime.Days -eq 10675199 -and + $_.AdvertisedRouterLifetime.Hours -eq 2 -and + $_.AdvertisedRouterLifetime.Minutes -eq 48 -and + $_.AdvertisedRouterLifetime.Seconds -eq 5 -and + $_.AdvertisedRouterLifetime.Milliseconds -eq 477) { + "Infinite ([TimeSpan]::MaxValue)" + } else { + $_.AdvertisedRouterLifetime.ToString() + } + + + + + AdvertiseDefaultRoute + + + CurrentHopLimit + + + ForceArpNdWolPattern + + + DirectedMacWolPattern + + + EcnMarking + + + Dhcp + + + ConnectionState + + + + Store + + + + + + + + + DefaultView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetPrefixPolicy + + + + + 60 + + + 10 + + + 10 + + + + + + + Prefix + + + Precedence + Right + + + Label + Right + + + + + + + + + ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetPrefixPolicy + + + + + + + Prefix + + + Precedence + + + Label + + + + + + + + + DefaultView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPv6Protocol + + + + + + + DefaultHopLimit + + + NeighborCacheLimit + + + + RouteCacheLimit + + + + ReassemblyLimit + + + + IcmpRedirects + + + SourceRoutingBehavior + + + DhcpMediaSense + + + MediaSenseEventLog + + + MldLevel + + + MldVersion + + + MulticastForwarding + + + GroupForwardedFragments + + + RandomizeIdentifiers + + + AddressMaskReply + + + UseTemporaryAddresses + + + MaxDadAttempts + + + + + + if ($_.MaxValidLifetime.Days -eq 10675199 -and + $_.MaxValidLifetime.Hours -eq 2 -and + $_.MaxValidLifetime.Minutes -eq 48 -and + $_.MaxValidLifetime.Seconds -eq 5 -and + $_.MaxValidLifetime.Milliseconds -eq 477) { + “Infinite ([TimeSpan]::MaxValue)” + } else { + $_.MaxValidLifetime.ToString() + } + + + + + + + if ($_.MaxPreferredLifetime.Days -eq 10675199 -and + $_.MaxPreferredLifetime.Hours -eq 2 -and + $_.MaxPreferredLifetime.Minutes -eq 48 -and + $_.MaxPreferredLifetime.Seconds -eq 5 -and + $_.MaxPreferredLifetime.Milliseconds -eq 477) { + “Infinite ([TimeSpan]::MaxValue)” + } else { + $_.MaxPreferredLifetime.ToString() + } + + + + + + + if ($_.RegenerateTime.Days -eq 10675199 -and + $_.RegenerateTime.Hours -eq 2 -and + $_.RegenerateTime.Minutes -eq 48 -and + $_.RegenerateTime.Seconds -eq 5 -and + $_.RegenerateTime.Milliseconds -eq 477) { + “Infinite ([TimeSpan]::MaxValue)” + } else { + $_.RegenerateTime.ToString() + } + + + + + + + if ($_.MaxRandomTime.Days -eq 10675199 -and + $_.MaxRandomTime.Hours -eq 2 -and + $_.MaxRandomTime.Minutes -eq 48 -and + $_.MaxRandomTime.Seconds -eq 5 -and + $_.MaxRandomTime.Milliseconds -eq 477) { + “Infinite ([TimeSpan]::MaxValue)” + } else { + $_.MaxRandomTime.ToString() + } + + + + + DeadGatewayDetection + + + + + + + + + TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPv6Protocol + + + + + 15 + + + 13 + + + 14 + + + 11 + + + 20 + + + 21 + + + 14 + + + + + + + DefaultHopLimit + + + IcmpRedirects + + + DhcpMediaSense + + + MldVersion + + + RandomizeIdentifiers + + + UseTemporaryAddresses + + + MaxDadAttempts + + + + + + + + + DefaultView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPv4Protocol + + + + + + + DefaultHopLimit + + + NeighborCacheLimit + + + + RouteCacheLimit + + + + ReassemblyLimit + + + + IcmpRedirects + + + SourceRoutingBehavior + + + DhcpMediaSense + + + MediaSenseEventLog + + + IGMPLevel + + + IGMPVersion + + + MulticastForwarding + + + GroupForwardedFragments + + + RandomizeIdentifiers + + + AddressMaskReply + + + MinimumMtu + + + + DeadGatewayDetection + + + + + + + + + TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPv4Protocol + + + + + 15 + + + 13 + + + 14 + + + 11 + + + 20 + + + + + + + DefaultHopLimit + + + IcmpRedirects + + + DhcpMediaSense + + + IGMPVersion + + + RandomizeIdentifiers + + + + + + + + + + DefaultView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTCPSetting + + + + + + + SettingName + + + MinRto + + + + InitialCongestionWindow + + + + CongestionProvider + + + CwndRestart + + + DelayedAckTimeout + + + + DelayedAckFrequency + + + MemoryPressureProtection + + + AutoTuningLevelLocal + + + AutoTuningLevelGroupPolicy + + + AutoTuningLevelEffective + + + EcnCapability + + + Timestamps + + + InitialRto + + + + ScalingHeuristics + + + DynamicPortRangeStartPort + + + DynamicPortRangeNumberOfPorts + + + AutomaticUseCustom + + + NonSackRttResiliency + + + ForceWS + + + MaxSynRetransmissions + + + AutoReusePortRangeStartPort + + + AutoReusePortRangeNumberOfPorts + + + + + + + + + TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTCPSetting + + + + + 11 + + + 18 + + + + 10 + + + + 14 + + + 11 + + + 17 + + + 17 + + + 24 + + + + + + + SettingName + + + CongestionProvider + + + MinRto + Right + + + InitialRto + Right + + + CwndRestart + + + DelayedAckTimeout + Right + + + DelayedAckFrequency + Right + + + AutoTuningLevelEffective + + + + + + + + + DefaultView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetUDPSetting + + + + + + + DynamicPortRangeStartPort + + + DynamicPortRangeNumberOfPorts + + + + + + + + + TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetUDPSetting + + + + + 25 + + + 30 + + + + + + + DynamicPortRangeStartPort + + + DynamicPortRangeNumberOfPorts + + + + + + + + + + DefaultView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTransportFilter + + + + + + + SettingName + + + Protocol + + + LocalPortStart + + + LocalPortEnd + + + RemotePortStart + + + RemotePortEnd + + + DestinationPrefix + + + + + + + + + TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTransportFilter + + + + + 12 + + + 8 + + + 14 + + + 12 + + + 15 + + + 13 + + + 39 + + + + + + + SettingName + + + Protocol + + + LocalPortStart + + + LocalPortEnd + + + RemotePortStart + + + RemotePortEnd + + + DestinationPrefix + + + + + + + + + DefaultView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTCPConnection + + + + + 35 + + + 9 + + + 35 + + + 10 + + + 11 + + + 14 + + + 14 + + + + + + + LocalAddress + + + LocalPort + + + RemoteAddress + + + RemotePort + + + State + + + AppliedSetting + + + OwningProcess + + + + + + + + + ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTCPConnection + + + + + + + LocalAddress + + + LocalPort + + + RemoteAddress + + + RemotePort + + + State + + + AppliedSetting + + + OwningProcess + + + + + if ($_.CreationTime.Year -eq 1600) { + "N/A" + } else { + $_.CreationTime.ToString() + } + + + + + OffloadState + + + + + + + + + DefaultView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetUDPEndpoint + + + + + 40 + + + 15 + + + + + + + LocalAddress + + + LocalPort + + + + + + + + + ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetUDPEndpoint + + + + + + + LocalAddress + + + LocalPort + + + OwningProcess + + + + + if ($_.CreationTime.Year -eq 1600) { + "N/A" + } else { + $_.CreationTime.ToString() + } + + + + + + + + + + + ListView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetCompartment + + + + + + + CompartmentId + + + CompartmentDescription + + + CompartmentGuid + + + + + + + + DefaultView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetOffloadGlobalSetting + + + + + + + ReceiveSideScaling + + + ReceiveSegmentCoalescing + + + Chimney + + + TaskOffload + + + NetworkDirect + + + NetworkDirectAcrossIPSubnets + + + PacketCoalescingFilter + + + + + + + + + NetIPConfiguration + + NetIPConfiguration + + + + + + + + + + Detailed + + ComputerName + + + + InterfaceAlias + + + + InterfaceIndex + + + + InterfaceDescription + + + + + + Detailed + + $_.NetCompartment.CompartmentId + + + + + + Detailed + + $_.NetCompartment.CompartmentDescription + + + + + + ($_.NetAdapter -ne $null) -and ($_.Detailed) + + $_.NetAdapter.LinkLayerAddress + + + + + + ($_.NetAdapter -ne $null) -and (($_.NetAdapter.Status -ne "Up") -or ($_.Detailed)) + + $_.NetAdapter.Status + + + + + + $_.NetProfile + + $_.NetProfile.Name + + + + + + ($_.NetProfile) -and ($_.Detailed) + + $_.NetProfile.NetworkCategory + + + + + + ($_.NetProfile) -and ($_.Detailed) + + $_.NetProfile.IPv6Connectivity + + + + + + ($_.NetProfile) -and ($_.Detailed) + + $_.NetProfile.IPv4Connectivity + + + + + + + ($_.NetIPv6Interface.ConnectionState -eq "Connected") -and + ($_.IPv6Address.Count -ne 0) + + + + $output = ""; + foreach($Address in $_.IPv6Address) { + $output += $Address.IPv6Address + "`n"; + } + $output.Trim("`n"); + + + + + + + + ($_.NetIPv6Interface.ConnectionState -eq "Connected") -and + ($_.IPv6TemporaryAddress.Count -ne 0) -and + ($_.Detailed) + + + + $output = ""; + foreach($Address in $_.IPv6TemporaryAddress) { + $output += $Address.IPv6Address + "`n"; + } + $output.Trim("`n"); + + + + + + + + ($_.NetIPv6Interface.ConnectionState -eq "Connected") -and + ($_.IPv6LinkLocalAddress.Count -ne 0) -and + ($_.Detailed) + + + + $output = ""; + foreach($Address in $_.IPv6LinkLocalAddress) { + $output += $Address.IPv6Address + "`n"; + } + $output.Trim("`n"); + + + + + + + + ($_.NetIPv4Interface.ConnectionState -eq "Connected") -and + ($_.IPv4Address.Count -ne 0) + + + + $output = ""; + foreach($Address in $_.IPv4Address) { + $output += $Address.IPv4Address + "`n"; + } + $output.Trim("`n"); + + + + + + + ($_.NetIPv6Interface.ConnectionState -eq "Connected") + + + $output = @(); + foreach($Route in $_.IPv6DefaultGateway) { + $output += $Route.NextHop; + } + $output; + + + + + + + ($_.NetIPv4Interface.ConnectionState -eq "Connected") + + + $output = @(); + foreach($Route in $_.IPv4DefaultGateway) { + $output += $Route.NextHop; + } + $output; + + + + + + + ($_.NetIPv6Interface.ConnectionState -eq "Connected") -and ($_.Detailed) -and ($_.NetIPv6Interface.IsolationId -ne 0) + + $_.NetIPv6Interface.IsolationId + + + + + + ($_.NetIPv4Interface.ConnectionState -eq "Connected") -and ($_.Detailed) -and ($_.NetIPv4Interface.IsolationId -ne 0) + + $_.NetIPv4Interface.IsolationId + + + + + + ($_.NetIPv6Interface.ConnectionState -eq "Connected") -and ($_.Detailed) + + $_.NetIPv6Interface.NlMTU + + + + + + ($_.NetIPv4Interface.ConnectionState -eq "Connected") -and ($_.Detailed) + + $_.NetIPv4Interface.NlMTU + + + + + + ($_.NetIPv6Interface.ConnectionState -eq "Connected") -and ($_.Detailed) + + $_.NetIPv6Interface.DHCP + + + + + + ($_.NetIPv4Interface.ConnectionState -eq "Connected") -and ($_.Detailed) + + $_.NetIPv4Interface.DHCP + + + + + + + ($_.DNSServer.Count -ne 0) -and + (($_.NetIPv4Interface.ConnectionState -eq "Connected") -or + ($_.NetIPv6Interface.ConnectionState -eq "Connected")) + + + + $output = ""; + foreach($Server in $_.DNSServer) { + foreach($Address in $Server.ServerAddresses) { + $output += $Address + "`n"; + } + }; + $output.Trim("`n"); + + + + + + + + + + + DefaultView + + TestNetConnectionResult + + + + + + + ComputerName + + + RemoteAddress + + + + + + ($_.RemotePort) -ne 0 + + + RemotePort + + + + + + ($_.Detailed) + + + + $output = ""; + foreach($Address in $_.ResolvedAddresses) { + $output += $Address.IPAddressToString + "`n"; + }; + foreach($PTRRecord in $($_.BasicNameResolution | where-object {$_.QueryType -eq "PTR"})) { + $output += $PTRRecord.NameHost + "`n"; + }; + $output.Trim("`n"); + + + + + + + (($_.RemotePort -ne 0) -and ($_.Detailed)) + + + + $output = ""; + foreach($Result in $_.MatchingIPsecRules) { + $output += $Result.DisplayName + "`n"; + }; + $output.Trim("`n"); + + + + + + (($_.RemotePort -ne 0) -and ($_.Detailed)) + + + NetworkIsolationContext + + + + + ((($_.RemotePort -ne 0) -and ($_.Detailed)) -and (!$_.IsAdmin)) + + + IsAdmin + + + InterfaceAlias + + + SourceAddress + + + + + + $_.Detailed + + + + $_.NetRoute.NextHop + + + + + + (($_.RemotePort -eq 0) -or (!$_.TcpTestSucceeded)) + + + PingSucceeded + + + + + + ($_.PingReplyDetails -ne $null) + + + + $_.PingReplyDetails.RoundTripTime.ToString() + " ms"; + + + + + + + ($_.RemotePort) -ne 0 + + + TcpTestSucceeded + + + + + + ($_.TraceRoute -ne $null) + + + + $output = ""; + foreach($Result in $_.TraceRoute) { + $output += $Result + "`n"; + }; + $output.Trim("`n"); + + + + + + + + + TableView + + TestNetConnectionResult + + + + + 15 + + + 10 + + + 30 + + + 20 + + + + 25 + + + 35 + + + + + + + ComputerName + + + RemotePort + + + RemoteAddress + + + PingSucceeded + + + + $_.PingReplyDetails.RoundTripTime.ToString() + " ms"; + + + + TcpTestSucceeded + + + + + + + + DefaultView + + NetRouteDiagnostics + + + + + + + ComputerName + + + RemoteAddress + + + + + + (($_.ConstrainSourceAddress -ne [System.Net.IPAddress]::IPv6Any) -and + ($_.ConstrainSourceAddress -ne [System.Net.IPAddress]::Any)) + + + ConstrainSourceAddress + + + + + + ($_.ConstrainInterfaceIndex -ne 0) + + + ConstrainInterfaceIndex + + + SelectedSourceAddress + + + OutgoingInterfaceIndex + + + + + $output = "DestinationPrefix: "; + $output += $_.SelectedNetRoute.DestinationPrefix + "`n"; + $output += "NextHop: "; + $output += $_.SelectedNetRoute.NextHop; + $output; + + + + + + + ($_.Detailed) + + + + $output = ""; + foreach($Event in $_.DestinationAddressSelectionEvents) { + $output += $Event + "`n`n"; + }; + $output.Trim("`n`n"); + + + + + + + ($_.Detailed) + + + + $output = ""; + foreach($Event in $_.RouteSelectionEvents) { + $output += $Event + "`n`n"; + }; + $output.Trim("`n`n"); + + + + + + + ($_.Detailed) + + + + $output = ""; + foreach($Event in $_.SourceAddressSelectionEvents) { + $output += $Event + "`n`n"; + }; + $output.Trim("`n`n"); + + + + RouteDiagnosticsSucceeded + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetTCPIP/Tcpip.Types.ps1xml b/newton-cn/bin/v1.0/Modules/NetTCPIP/Tcpip.Types.ps1xml new file mode 100644 index 0000000..b0700fb --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetTCPIP/Tcpip.Types.ps1xml @@ -0,0 +1,925 @@ + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetRoute + + + Publish + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Publish]($this.PSBase.CimInstanceProperties['Publish'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Publish'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Publish]$newValue + + + + Protocol + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Protocol]($this.PSBase.CimInstanceProperties['Protocol'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Protocol'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Protocol]$newValue + + + + Store + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Store]($this.PSBase.CimInstanceProperties['Store'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Store'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.Store]$newValue + + + + AddressFamily + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.AddressFamily]($this.PSBase.CimInstanceProperties['AddressFamily'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['AddressFamily'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.AddressFamily]$newValue + + + + State + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.State]($this.PSBase.CimInstanceProperties['State'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['State'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.State]$newValue + + + + ifIndex + InterfaceIndex + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPAddress + + + PrefixOrigin + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.PrefixOrigin]($this.PSBase.CimInstanceProperties['PrefixOrigin'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['PrefixOrigin'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.PrefixOrigin]$newValue + + + + SuffixOrigin + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.SuffixOrigin]($this.PSBase.CimInstanceProperties['SuffixOrigin'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['SuffixOrigin'].Value = [System.Uint16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.SuffixOrigin]$newValue + + + + Type + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.Type]($this.PSBase.CimInstanceProperties['Type'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Type'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.Type]$newValue + + + + Store + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.Store]($this.PSBase.CimInstanceProperties['Store'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Store'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.Store]$newValue + + + + AddressFamily + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.AddressFamily]($this.PSBase.CimInstanceProperties['AddressFamily'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['AddressFamily'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.AddressFamily]$newValue + + + + AddressState + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.AddressState]($this.PSBase.CimInstanceProperties['AddressState'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['AddressState'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPAddress.AddressState]$newValue + + + + ToString + + + + ifIndex + InterfaceIndex + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetNeighbor + + + State + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.State]($this.PSBase.CimInstanceProperties['State'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['State'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.State]$newValue + + + + Store + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.Store]($this.PSBase.CimInstanceProperties['Store'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Store'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.Store]$newValue + + + + AddressFamily + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.AddressFamily]($this.PSBase.CimInstanceProperties['AddressFamily'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['AddressFamily'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNeighbor.AddressFamily]$newValue + + + + ifIndex + InterfaceIndex + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetCompartment + + + CompartmentType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetCompartment.CompartmentType]($this.PSBase.CimInstanceProperties['CompartmentType'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['CompartmentType'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetCompartment.CompartmentType]$newValue + + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPInterface + + + Store + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Store]($this.PSBase.CimInstanceProperties['Store'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Store'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Store]$newValue + + + + AddressFamily + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AddressFamily]($this.PSBase.CimInstanceProperties['AddressFamily'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['AddressFamily'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AddressFamily]$newValue + + + + Forwarding + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Forwarding]($this.PSBase.CimInstanceProperties['Forwarding'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Forwarding'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Forwarding]$newValue + + + + ClampMss + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ClampMss]($this.PSBase.CimInstanceProperties['ClampMss'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['ClampMss'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ClampMss]$newValue + + + + Advertising + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Advertising]($this.PSBase.CimInstanceProperties['Advertising'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Advertising'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Advertising]$newValue + + + + NeighborUnreachabilityDetection + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.NeighborUnreachabilityDetection]($this.PSBase.CimInstanceProperties['NeighborUnreachabilityDetection'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['NeighborUnreachabilityDetection'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.NeighborUnreachabilityDetection]$newValue + + + + RouterDiscovery + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.RouterDiscovery]($this.PSBase.CimInstanceProperties['RouterDiscovery'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['RouterDiscovery'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.RouterDiscovery]$newValue + + + + NeighborDiscoverySupported + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.NeighborDiscoverySupported]($this.PSBase.CimInstanceProperties['NeighborDiscoverySupported'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['NeighborDiscoverySupported'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.NeighborDiscoverySupported]$newValue + + + + ManagedAddressConfiguration + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ManagedAddressConfiguration]($this.PSBase.CimInstanceProperties['ManagedAddressConfiguration'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['ManagedAddressConfiguration'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ManagedAddressConfiguration]$newValue + + + + OtherStatefulConfiguration + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.OtherStatefulConfiguration]($this.PSBase.CimInstanceProperties['OtherStatefulConfiguration'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['OtherStatefulConfiguration'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.OtherStatefulConfiguration]$newValue + + + + WeakHostSend + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.WeakHostSend]($this.PSBase.CimInstanceProperties['WeakHostSend'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['WeakHostSend'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.WeakHostSend]$newValue + + + + WeakHostReceive + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.WeakHostReceive]($this.PSBase.CimInstanceProperties['WeakHostReceive'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['WeakHostReceive'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.WeakHostReceive]$newValue + + + + IgnoreDefaultRoutes + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.IgnoreDefaultRoutes]($this.PSBase.CimInstanceProperties['IgnoreDefaultRoutes'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['IgnoreDefaultRoutes'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.IgnoreDefaultRoutes]$newValue + + + + AdvertiseDefaultRoute + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AdvertiseDefaultRoute]($this.PSBase.CimInstanceProperties['AdvertiseDefaultRoute'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['AdvertiseDefaultRoute'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AdvertiseDefaultRoute]$newValue + + + + ForceArpNdWolPattern + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ForceArpNdWolPattern]($this.PSBase.CimInstanceProperties['ForceArpNdWolPattern'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['ForceArpNdWolPattern'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ForceArpNdWolPattern]$newValue + + + + DirectedMacWolPattern + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.DirectedMacWolPattern]($this.PSBase.CimInstanceProperties['DirectedMacWolPattern'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['DirectedMacWolPattern'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.DirectedMacWolPattern]$newValue + + + + EcnMarking + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.EcnMarking]($this.PSBase.CimInstanceProperties['EcnMarking'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['EcnMarking'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.EcnMarking]$newValue + + + + Dhcp + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Dhcp]($this.PSBase.CimInstanceProperties['Dhcp'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Dhcp'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.Dhcp]$newValue + + + + ConnectionState + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ConnectionState]($this.PSBase.CimInstanceProperties['ConnectionState'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['ConnectionState'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.ConnectionState]$newValue + + + + AutomaticMetric + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AutomaticMetric]($this.PSBase.CimInstanceProperties['AutomaticMetric'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['AutomaticMetric'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPInterface.AutomaticMetric]$newValue + + + + ifIndex + InterfaceIndex + + + ifAlias + InterfaceAlias + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPv4Protocol + + + IcmpRedirects + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.IcmpRedirects]($this.PSBase.CimInstanceProperties['IcmpRedirects'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['IcmpRedirects'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.IcmpRedirects]$newValue + + + + SourceRoutingBehavior + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.SourceRoutingBehavior]($this.PSBase.CimInstanceProperties['SourceRoutingBehavior'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['SourceRoutingBehavior'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.SourceRoutingBehavior]$newValue + + + + DhcpMediaSense + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.DhcpMediaSense]($this.PSBase.CimInstanceProperties['DhcpMediaSense'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['DhcpMediaSense'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.DhcpMediaSense]$newValue + + + + MediaSenseEventLog + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MediaSenseEventLog]($this.PSBase.CimInstanceProperties['MediaSenseEventLog'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['MediaSenseEventLog'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MediaSenseEventLog]$newValue + + + + MldLevel + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MldLevel]($this.PSBase.CimInstanceProperties['MldLevel'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['MldLevel'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MldLevel]$newValue + + + + MldVersion + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MldVersion]($this.PSBase.CimInstanceProperties['MldVersion'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['MldVersion'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MldVersion]$newValue + + + + MulticastForwarding + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MulticastForwarding]($this.PSBase.CimInstanceProperties['MulticastForwarding'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['MulticastForwarding'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.MulticastForwarding]$newValue + + + + GroupForwardedFragments + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.GroupForwardedFragments]($this.PSBase.CimInstanceProperties['GroupForwardedFragments'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['GroupForwardedFragments'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.GroupForwardedFragments]$newValue + + + + RandomizeIdentifiers + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.RandomizeIdentifiers]($this.PSBase.CimInstanceProperties['RandomizeIdentifiers'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['RandomizeIdentifiers'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.RandomizeIdentifiers]$newValue + + + + AddressMaskReply + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.AddressMaskReply]($this.PSBase.CimInstanceProperties['AddressMaskReply'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['AddressMaskReply'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.AddressMaskReply]$newValue + + + + DeadGatewayDetection + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.DeadGatewayDetection]($this.PSBase.CimInstanceProperties['DeadGatewayDetection'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['DeadGatewayDetection'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv4Protocol.DeadGatewayDetection]$newValue + + + + IGMPLevel + MldLevel + + + IGMPVersion + MldVersion + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetIPv6Protocol + + + IcmpRedirects + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.IcmpRedirects]($this.PSBase.CimInstanceProperties['IcmpRedirects'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['IcmpRedirects'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.IcmpRedirects]$newValue + + + + SourceRoutingBehavior + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.SourceRoutingBehavior]($this.PSBase.CimInstanceProperties['SourceRoutingBehavior'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['SourceRoutingBehavior'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.SourceRoutingBehavior]$newValue + + + + DhcpMediaSense + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.DhcpMediaSense]($this.PSBase.CimInstanceProperties['DhcpMediaSense'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['DhcpMediaSense'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.DhcpMediaSense]$newValue + + + + MediaSenseEventLog + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MediaSenseEventLog]($this.PSBase.CimInstanceProperties['MediaSenseEventLog'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['MediaSenseEventLog'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MediaSenseEventLog]$newValue + + + + MldLevel + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MldLevel]($this.PSBase.CimInstanceProperties['MldLevel'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['MldLevel'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MldLevel]$newValue + + + + MldVersion + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MldVersion]($this.PSBase.CimInstanceProperties['MldVersion'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['MldVersion'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MldVersion]$newValue + + + + MulticastForwarding + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MulticastForwarding]($this.PSBase.CimInstanceProperties['MulticastForwarding'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['MulticastForwarding'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.MulticastForwarding]$newValue + + + + GroupForwardedFragments + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.GroupForwardedFragments]($this.PSBase.CimInstanceProperties['GroupForwardedFragments'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['GroupForwardedFragments'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.GroupForwardedFragments]$newValue + + + + RandomizeIdentifiers + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.RandomizeIdentifiers]($this.PSBase.CimInstanceProperties['RandomizeIdentifiers'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['RandomizeIdentifiers'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.RandomizeIdentifiers]$newValue + + + + AddressMaskReply + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.AddressMaskReply]($this.PSBase.CimInstanceProperties['AddressMaskReply'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['AddressMaskReply'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.AddressMaskReply]$newValue + + + + UseTemporaryAddresses + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.UseTemporaryAddresses]($this.PSBase.CimInstanceProperties['UseTemporaryAddresses'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['UseTemporaryAddresses'].Value = [System.UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.UseTemporaryAddresses]$newValue + + + + DeadGatewayDetection + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.DeadGatewayDetection]($this.PSBase.CimInstanceProperties['DeadGatewayDetection'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['DeadGatewayDetection'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPv6Protocol.DeadGatewayDetection]$newValue + + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTCPConnection + + + State + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPConnection.State]($this.PSBase.CimInstanceProperties['State'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['State'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPConnection.State]$newValue + + + + AppliedSetting + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPConnection.AppliedSetting]($this.PSBase.CimInstanceProperties['AppliedSetting'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['AppliedSetting'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPConnection.AppliedSetting]$newValue + + + + OffloadState + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPConnection.OffloadState]($this.PSBase.CimInstanceProperties['OffloadState'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['OffloadState'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPConnection.OffloadState]$newValue + + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTransportFilter + + + Protocol + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTransportFilter.Protocol]($this.PSBase.CimInstanceProperties['Protocol'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Protocol'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTransportFilter.Protocol]$newValue + + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetTCPSetting + + + CwndRestart + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.CwndRestart]($this.PSBase.CimInstanceProperties['CwndRestart'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['CwndRestart'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.CwndRestart]$newValue + + + + MemoryPressureProtection + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.MemoryPressureProtection]($this.PSBase.CimInstanceProperties['MemoryPressureProtection'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['MemoryPressureProtection'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.MemoryPressureProtection]$newValue + + + + CongestionProvider + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.CongestionProvider]($this.PSBase.CimInstanceProperties['CongestionProvider'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['CongestionProvider'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.CongestionProvider]$newValue + + + + AutoTuningLevelLocal + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutoTuningLevelLocal]($this.PSBase.CimInstanceProperties['AutoTuningLevelLocal'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['AutoTuningLevelLocal'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutoTuningLevelLocal]$newValue + + + + EcnCapability + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.EcnCapability]($this.PSBase.CimInstanceProperties['EcnCapability'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['EcnCapability'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.EcnCapability]$newValue + + + + Timestamps + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.Timestamps]($this.PSBase.CimInstanceProperties['Timestamps'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Timestamps'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.Timestamps]$newValue + + + + ScalingHeuristics + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.ScalingHeuristics]($this.PSBase.CimInstanceProperties['ScalingHeuristics'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['ScalingHeuristics'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.ScalingHeuristics]$newValue + + + + AutoTuningLevelGroupPolicy + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutoTuningLevelGroupPolicy]($this.PSBase.CimInstanceProperties['AutoTuningLevelGroupPolicy'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['AutoTuningLevelGroupPolicy'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutoTuningLevelGroupPolicy]$newValue + + + + AutoTuningLevelEffective + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutoTuningLevelEffective]($this.PSBase.CimInstanceProperties['AutoTuningLevelEffective'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['AutoTuningLevelEffective'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutoTuningLevelEffective]$newValue + + + + AutomaticUseCustom + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutomaticUseCustom]($this.PSBase.CimInstanceProperties['AutomaticUseCustom'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['AutomaticUseCustom'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.AutomaticUseCustom]$newValue + + + + NonSackRttResiliency + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.NonSackRttResiliency]($this.PSBase.CimInstanceProperties['NonSackRttResiliency'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['NonSackRttResiliency'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.NonSackRttResiliency]$newValue + + + + ForceWS + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.ForceWS]($this.PSBase.CimInstanceProperties['ForceWS'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['ForceWS'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTCPSetting.ForceWS]$newValue + + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_NetOffloadGlobalSetting + + + ReceiveSideScaling + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]($this.PSBase.CimInstanceProperties['ReceiveSideScaling'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['ReceiveSideScaling'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]$newValue + + + + ReceiveSegmentCoalescing + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]($this.PSBase.CimInstanceProperties['ReceiveSegmentCoalescing'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['ReceiveSegmentCoalescing'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]$newValue + + + + Chimney + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.ChimneyEnum]($this.PSBase.CimInstanceProperties['Chimney'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Chimney'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.ChimneyEnum]$newValue + + + + TaskOffload + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]($this.PSBase.CimInstanceProperties['TaskOffload'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['TaskOffload'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]$newValue + + + + NetworkDirect + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]($this.PSBase.CimInstanceProperties['NetworkDirect'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['NetworkDirect'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]$newValue + + + + NetworkDirectAcrossIPSubnets + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.AllowedBlockedEnum]($this.PSBase.CimInstanceProperties['NetworkDirectAcrossIPSubnets'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['NetworkDirectAcrossIPSubnets'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.AllowedBlockedEnum]$newValue + + + + PacketCoalescingFilter + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]($this.PSBase.CimInstanceProperties['PacketCoalescingFilter'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['PacketCoalescingFilter'].Value = [System.Byte][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetOffloadGlobalSetting.EnabledDisabledEnum]$newValue + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetTCPIP/Test-NetConnection.psm1 b/newton-cn/bin/v1.0/Modules/NetTCPIP/Test-NetConnection.psm1 new file mode 100644 index 0000000..bf2e522 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetTCPIP/Test-NetConnection.psm1 @@ -0,0 +1,643 @@ +class NetRouteDiagnostics +{ + #Remote hostname used for routing + [String] $ComputerName + + #Remote IP address used for routing + [System.Net.IPAddress] $RemoteAddress + + #Resolved IP addresses for ComputerName + [System.Net.IPAddress[]] $ResolvedAddresses + + #SourceAddress constraint used for routing + [System.Net.IPAddress] $ConstrainSourceAddress + + #Interface constraint used for routing + [UInt32] $ConstrainInterfaceIndex + + #SourceAddress selected for routing + [Microsoft.Management.Infrastructure.CimInstance] $SelectedSourceAddress + + #Outgoing interface information selected for routing + [String] $OutgoingInterfaceAlias + [UInt32] $OutgoingInterfaceIndex + [String] $OutgoingInterfaceDescription + [Microsoft.Management.Infrastructure.CimInstance] $OutgoingNetAdapter + + #NetRoute selected for routing + [Microsoft.Management.Infrastructure.CimInstance] $SelectedNetRoute + + #Log file used for logging route events + [String] $LogFile + + #Events logged during routing + [String[]] $RouteSelectionEvents + [String[]] $SourceAddressSelectionEvents + [String[]] $DestinationAddressSelectionEvents + + #An indicator to the formatter that details should be shown + [Bool] $Detailed + + #If diagnostics succeeded + [Bool] $RouteDiagnosticsSucceeded +} + +class TestNetConnectionResult +{ + [String] $ComputerName + + #The Remote IP address used for connectivity + [System.Net.IPAddress] $RemoteAddress + + #Resolved IP addresses for ComputerName + [System.Net.IPAddress[]] $ResolvedAddresses + + #Indicates if the Ping was successful + [Bool] $PingSucceeded + + #Details of the ping + [System.Net.NetworkInformation.PingReply] $PingReplyDetails + + #The TCP socket + [System.Net.Sockets.Socket] $TcpClientSocket + + #If the test succeeded + [Bool] $TcpTestSucceeded + + #Remote port used + [UInt32] $RemotePort + + #The results of the traceroute + [String[]] $TraceRoute + + #An indicator to the formatter that details should be shown + [Bool] $Detailed + + #Information on the interface used for connectivity + [String] $InterfaceAlias + [UInt32] $InterfaceIndex + [String] $InterfaceDescription + [Microsoft.Management.Infrastructure.CimInstance] $NetAdapter + [Microsoft.Management.Infrastructure.CimInstance] $NetRoute + + #Source IP address + [Microsoft.Management.Infrastructure.CimInstance] $SourceAddress + + #DNS information + [Bool] $NameResolutionSucceeded + [Object] $BasicNameResolution + [Object] $LLMNRNetbiosRecords + [Object] $DNSOnlyRecords + [Object] $AllNameResolutionResults + + #NetSec Info + [Bool] $IsAdmin #If the test succeeded + [String] $NetworkIsolationContext + [Microsoft.Management.Infrastructure.CimInstance[]] $MatchingIPsecRules +} + +function Test-NetConnection +{ + [CmdletBinding( )] + Param( + [Parameter(Mandatory = $false, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, Position = 0)] + [Alias('RemoteAddress','cn')] + [String] $ComputerName = "internetbeacon.msedge.net", + + [Parameter(ParameterSetName = "ICMP", Mandatory = $False)] + [Switch] $TraceRoute, + + [Parameter(ParameterSetName = "ICMP", Mandatory = $False)] + [ValidateRange(1,120)] + [Int] $Hops = 30, + + [Parameter(ParameterSetName = "CommonTCPPort", Mandatory = $True, Position = 1)] + [ValidateSet("HTTP", "RDP", "SMB", "WINRM")] + [String] $CommonTCPPort = "", + + [Parameter(ParameterSetName = "RemotePort", Mandatory = $True, ValueFromPipelineByPropertyName = $true)] + [Alias('RemotePort')] [ValidateRange(1,65535)] + [Int] $Port = 0, + + [Parameter(ParameterSetName = "NetRouteDiagnostics", Mandatory = $True)] + [Switch] $DiagnoseRouting, + + [Parameter(ParameterSetName = "NetRouteDiagnostics", Mandatory = $False)] + [String] $ConstrainSourceAddress = "", + + [Parameter(ParameterSetName = "NetRouteDiagnostics", Mandatory = $False)] + [UInt32] $ConstrainInterface = 0, + + [ValidateSet("Quiet", "Detailed")] + [String] $InformationLevel = "Standard" + ) + + Begin + { + + ##Description: Checks if the local execution context is elevated + ##Input: None + ##Output: Boolean. True if the local execution context is elevated. + function CheckIfAdmin + { + $CurrentIdentity = [System.Security.Principal.WindowsIdentity]::GetCurrent() + $CurrentSecurityPrincipal = [System.Security.Principal.WindowsPrincipal]::new($CurrentIdentity) + $AdminPrincipal = [System.Security.Principal.WindowsBuiltInRole]::Administrator + return $CurrentSecurityPrincipal.IsInRole($AdminPrincipal) + } + + ##Description: Resolves a hostname. + ##Input: The user-provided computername that will be pinged/tested + ##Output: The resolved IP addresses for computername + function ResolveTargetName + { + param ($TargetName) + + $Addresses = $null + try + { + $Addresses = [System.Net.Dns]::GetHostAddressesAsync($TargetName).GetAwaiter().GetResult() + } + catch + { + Write-Debug "Name resolution of $TargetName threw exception: $($_.Exception.Message)" + } + + if ($Addresses -eq $null) + { + Write-Warning "Name resolution of $TargetName failed" + } + + return $Addresses + } + + ##Description: Pings a specified host + ##Input: IP address to ping + ##Output: PingReplyDetails for the ping attempt to host + function PingTest + { + param ($TargetIPAddress) + + $Ping = [System.Net.NetworkInformation.Ping]::new() + $PingReplyDetails = $null + + ##Indeterminate progress indication + Write-Progress -Activity "Test-NetConnection :: $TargetIPAddress" -Status "Ping/ICMP Test" -CurrentOperation "Waiting for echo reply" -SecondsRemaining -1 -PercentComplete -1 + + try + { + $PingReplyDetails = $Ping.SendPingAsync($TargetIPAddress).GetAwaiter().Getresult() + } + catch + { + Write-Debug "Ping to $TargetIPAddress threw exception: $($_.Exception.Message)" + } + finally + { + $Ping.Dispose() + } + + return $PingReplyDetails + } + + ##Description: Traces a route to a specified IP address using repetitive echo requests + ##Input: IP address to trace against + ##Output: Array of IP addresses representing the traced route. The message from the ping reply status is emmited, if there is no response. + function TraceRoute + { + param ($TargetIPAddress,$Hops) + + $Ping = [System.Net.NetworkInformation.Ping]::new() + $PingOptions = [System.Net.NetworkInformation.PingOptions]::new() + $PingOptions.Ttl = 1 + [Byte[]]$DataBuffer = @() + 1..10 | foreach {$DataBuffer += [Byte]0} + $ReturnTrace = @() + + do + { + try + { + $CurrentHop = [int] $PingOptions.Ttl + write-progress -CurrentOperation "TTL = $CurrentHop" -Status "ICMP Echo Request (Max TTL = $Hops)" -Activity "TraceRoute" -PercentComplete -1 -SecondsRemaining -1 + $PingReplyDetails = $Ping.SendPingAsync($TargetIPAddress, 4000, $DataBuffer, $PingOptions).GetAwaiter().Getresult() + + if ($PingReplyDetails.Address -eq $null) + { + $ReturnTrace += $PingReplyDetails.Status.ToString() + } + else + { + $ReturnTrace += $PingReplyDetails.Address.IPAddressToString + } + } + catch + { + Write-Debug "Ping to $TargetIPAddress threw exception: $($_.Exception.Message)" + $ReturnTrace += "..." + } + $PingOptions.Ttl++ + } + while (($PingReplyDetails.Status -ne 'Success') -and ($PingOptions.Ttl -le $Hops)) + + ##If the last entry in the trace does not equal the target, then the trace did not successfully complete + if ($ReturnTrace[-1] -ne $TargetIPAddress) + { + $OutputString = "Trace route to destination " + $TargetIPAddress + " did not complete. Trace terminated :: " + $ReturnTrace[-1] + Write-Warning $OutputString + } + + $Ping.Dispose() + return $ReturnTrace + } + + ##Description: Attempts a TCP connection against a specified IP address + ##Input: IP address and port to connect to + ##Output: If the connection succeeded (as a boolean) + function TestTCP + { + param ($TargetIPAddress,$TargetPort) + + $ProgressString = "Test-NetConnection - " + $TargetIPAddress + ":" + $TargetPort + Write-Progress -Activity $ProgressString -Status "Attempting TCP connect" -CurrentOperation "Waiting for response" -SecondsRemaining -1 -PercentComplete -1 + + $Success = $False + $TCPClient = [System.Net.Sockets.TcpClient]::new($TargetIPAddress.AddressFamily) + try + { + $null = $TCPClient.ConnectAsync($TargetIPAddress, $TargetPort).GetAwaiter().Getresult() + $Success = $TCPClient.Connected; + } + catch + { + Write-Debug "TCP connect to ($TargetIPAddress : $TargetPort) threw exception: $($_.Exception.Message)" + } + finally + { + $TCPClient.Dispose() + } + + return $Success + } + + ##Description: Modifies the provided object with the correct local connectivty information + ##Input: TestNetConnectionResults object that will be modified + ##Output: Modified TestNetConnectionResult object + function ResolveRoutingandAdapterWMIObjects + { + param ($TestNetConnectionResult) + + try + { + $TestNetConnectionResult.SourceAddress, $TestNetConnectionResult.NetRoute = Find-NetRoute -RemoteIPAddress $TestNetConnectionResult.RemoteAddress -ErrorAction SilentlyContinue + $TestNetConnectionResult.NetAdapter = $TestNetConnectionResult.NetRoute | Get-NetAdapter -IncludeHidden -ErrorAction SilentlyContinue + + $TestNetConnectionResult.InterfaceAlias = $TestNetConnectionResult.NetRoute.InterfaceAlias + $TestNetConnectionResult.InterfaceIndex = $TestNetConnectionResult.NetRoute.InterfaceIndex + $TestNetConnectionResult.InterfaceDescription = $TestNetConnectionResult.NetAdapter.InterfaceDescription + } + catch + { + Write-Debug "ResolveRoutingandAdapterWMIObjects threw exception: $($_.Exception.Message)" + } + return $TestNetConnectionResult + } + + ##Description: Resolves the DNS details for the computername + ##Input: The TestNetConnectionResults object that will be "filled in" with DNS information + ##Output: The modified TestNetConnectionResults object + function ResolveDNSDetails + { + param ($TestNetConnectionResult) + + $TestNetConnectionResult.DNSOnlyRecords = @( Resolve-DnsName $ComputerName -DnsOnly -NoHostsFile -Type A_AAAA -ErrorAction SilentlyContinue | where-object {($_.QueryType -eq "A") -or ($_.QueryType -eq "AAAA") -or ($_.QueryType -eq "PTR")} ) + $TestNetConnectionResult.LLMNRNetbiosRecords = @( Resolve-DnsName $ComputerName -LlmnrNetbiosOnly -NoHostsFile -ErrorAction SilentlyContinue | where-object {($_.QueryType -eq "A") -or ($_.QueryType -eq "AAAA") } ) + $TestNetConnectionResult.BasicNameResolution = @(Resolve-DnsName $ComputerName -ErrorAction SilentlyContinue | where-object {($_.QueryType -eq "A") -or ($_.QueryType -eq "AAAA") -or ($_.QueryType -eq "PTR")} ) + + $TestNetConnectionResult.AllNameResolutionResults = $Return.BasicNameResolution + $Return.DNSOnlyRecords + $Return.LLMNRNetbiosRecords | Sort-Object -Unique -Property Address + return $TestNetConnectionResult + } + + ##Description: Resolves the network security details for the computername + ##Input: The TestNetConnectionResults object that will be "filled in" with network security information + ##Output: Teh modified TestNetConnectionResults object + function ResolveNetworkSecurityDetails + { + param ($TestNetConnectionResult) + + $TestNetConnectionResult.IsAdmin = CheckIfAdmin + $NetworkIsolationInfo = Invoke-CimMethod -Namespace root\standardcimv2 -ClassName MSFT_NetAddressFilter -MethodName QueryIsolationType -Arguments @{InterfaceIndex = [uint32]$TestNetConnectionResult.InterfaceIndex; RemoteAddress = [string]$TestNetConnectionResult.RemoteAddress} -ErrorAction SilentlyContinue + + switch ($NetworkIsolationInfo.IsolationType) + { + 1 {$TestNetConnectionResult.NetworkIsolationContext = "Private Network";} + 0 {$TestNetConnectionResult.NetworkIsolationContext = "Loopback";} + 2 {$TestNetConnectionResult.NetworkIsolationContext = "Internet";} + } + + ##Elevation is required to read IPsec information for the connection. + if ($TestNetConnectionResult.IsAdmin) + { + $TestNetConnectionResult.MatchingIPsecRules = Find-NetIPsecRule -RemoteAddress $TestNetConnectionResult.RemoteAddress -RemotePort $TestNetConnectionResult.RemotePort -Protocol TCP -ErrorAction SilentlyContinue + } + + return $TestNetConnectionResult + } + + ##Description: Diagnose route selection for a destination + ##Input: RouteDiagnosticsResults object that will be filled on with route diagnostics information. + ##Output: None + function DiagnoseRouteSelection + { + param ([NetRouteDiagnostics] $RouteDiagnostics) + + $RouteDiagnostics.RouteDiagnosticsSucceeded = $False + + if ($RouteDiagnostics.Detailed) + { + Write-Progress -Activity "Test-NetConnection :: $($RouteDiagnostics.RemoteAddress)" -Status "RouteDiagnostics" -CurrentOperation "Starting Route Event Tracing" -SecondsRemaining -1 -PercentComplete -1 + + $LogFile = "" + do + { + $LogFile = [System.IO.Path]::GetTempFileName().split(".")[0] + "Test-NetConnection.etl" + } + while (Test-Path -Path $LogFile -ErrorAction SilentlyContinue) + + $TraceResults = netsh trace start tracefile=$LogFile provider=Microsoft-Windows-TCPIP keywords=ut:TcpipRoute report=di perfmerge=no correlation=di + } + + Write-Progress -Activity "Test-NetConnection :: $($RouteDiagnostics.ComputerName)" -Status "RouteDiagnostics" -CurrentOperation "Resolving name" -SecondsRemaining -1 -PercentComplete -1 + + $RouteDiagnostics.ResolvedAddresses = ResolveTargetName -TargetName $RouteDiagnostics.ComputerName + if ($RouteDiagnostics.ResolvedAddresses -eq $null) + { + netsh trace stop | out-null + return + } + + $RouteDiagnostics.RemoteAddress = $RouteDiagnostics.ResolvedAddresses[0] + + if ($RouteDiagnostics.ConstrainSourceAddress -eq $null) + { + if ($RouteDiagnostics.RemoteAddress.AddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetwork) + { + $RouteDiagnostics.ConstrainSourceAddress = [System.Net.IPAddress]::Any + } + else + { + $RouteDiagnostics.ConstrainSourceAddress = [System.Net.IPAddress]::IPv6Any + } + } + + if ($RouteDiagnostics.Detailed -and (Test-Path -Path $LogFile)) + { + ##Flush the destination cache to trigger a new route route lookup + if ($RouteDiagnostics.RemoteAddress.AddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetwork) + { + netsh int ipv4 delete destinationcache | out-null + } + else + { + netsh int ipv6 delete destinationcache | out-null + } + } + + Write-Progress -Activity "Test-NetConnection :: $($RouteDiagnostics.RemoteAddress)" -Status "RouteDiagnostics" -CurrentOperation "Finding route" -SecondsRemaining -1 -PercentComplete -1 + + try + { + $RouteDiagnostics.SelectedSourceAddress, $RouteDiagnostics.SelectedNetRoute = ` + Find-NetRoute -RemoteIPAddress $RouteDiagnostics.RemoteAddress -LocalIPAddress $RouteDiagnostics.ConstrainSourceAddress -InterfaceIndex $RouteDiagnostics.ConstrainInterfaceIndex -ErrorAction SilentlyContinue + + $RouteDiagnostics.OutgoingNetAdapter = $RouteDiagnostics.SelectedNetRoute | Get-NetAdapter -IncludeHidden -ErrorAction SilentlyContinue + + $RouteDiagnostics.OutgoingInterfaceAlias = $RouteDiagnostics.SelectedNetRoute.InterfaceAlias + $RouteDiagnostics.OutgoingInterfaceIndex = $RouteDiagnostics.SelectedNetRoute.InterfaceIndex + $RouteDiagnostics.OutgoingInterfaceDescription = $RouteDiagnostics.OutgoingNetAdapter.InterfaceDescription + } + catch + { + Write-Debug "Error occured while finding route information. Exception: $($_.Exception.Message)" + netsh trace stop | out-null + return + } + + if ($RouteDiagnostics.Detailed) + { + Write-Progress -Activity "Test-NetConnection :: $($RouteDiagnostics.RemoteAddress)" -Status "RouteDiagnostics" -CurrentOperation "Parsing Route Events" -SecondsRemaining -1 -PercentComplete -1 + + $TraceResults += netsh trace stop + + if (-not (Test-Path -Path $LogFile)) + { + $Message = "Error occured while collection routing events. Error: " + $TraceResults + Write-Warning $Message + return + } + + ##Get route selection events: [IpRouteSelection (task:1378) and IpRouteBlocked (task:1379)] containing the remote IP + $RouteEvents = Get-WinEvent -Path $LogFile -Oldest | Where-Object {(($_.task -eq "1379") -or ($_.task -eq "1378")) -and (($_.Message -ne $null) -and $_.Message.Contains("$($RouteDiagnostics.RemoteAddress) "))} + foreach ($event in $RouteEvents) + { + if ($RouteDiagnostics.RouteSelectionEvents -notcontains $($event.Message)) + { + $RouteDiagnostics.RouteSelectionEvents += "$($event.Message)" + } + } + + ##Get source address selection events: [IpSourceAddressSelection (task:1326)] containing the remote IP + $SrcAddrEvents = Get-WinEvent -Path $LogFile -Oldest | Where-Object {($_.task -eq "1326") -and (($_.Message -ne $null) -and $_.Message.Contains("$($RouteDiagnostics.RemoteAddress) "))} + foreach ($event in $SrcAddrEvents) + { + if ($RouteDiagnostics.SourceAddressSelectionEvents -notcontains $($event.Message)) + { + $RouteDiagnostics.SourceAddressSelectionEvents += "$($event.Message)" + } + } + + ##Get destination address selection events: [IpSortedAddressPairs (task:1327)] containing the resolved IPs + $DstAddrEvents = Get-WinEvent -Path $LogFile -Oldest | Where-Object {($_.task -eq "1327") -and ((($Message = $_.Message) -ne $null) -and (@(($RouteDiagnostics.ResolvedAddresses | ForEach-Object {$_.IPAddressToString}) | where {$Message.Contains("$_)")}) -ne $null))} + foreach ($event in $DstAddrEvents) + { + if ($RouteDiagnostics.DestinationAddressSelectionEvents -notcontains $($event.Message)) + { + $RouteDiagnostics.DestinationAddressSelectionEvents += "$($event.Message)" + } + } + + $RouteDiagnostics.LogFile = $LogFile + } + + $RouteDiagnostics.RouteDiagnosticsSucceeded = $True + + return + } + } + + Process + { + switch ($PSCmdlet.ParameterSetName) + { + + ##Route diagnostics parameterset + "NetRouteDiagnostics" + { + $Return = [NetRouteDiagnostics]::new() + $Return.ComputerName = $ComputerName + + if ($ConstrainSourceAddress -ne "") + { + $Return.ConstrainSourceAddress = $ConstrainSourceAddress + } + + $Return.ConstrainInterfaceIndex = $ConstrainInterface + + $Return.Detailed = ($InformationLevel -eq "Detailed") + if ($Return.Detailed -and (-not (CheckIfAdmin))) { + Write-Warning "'-InformationLevel Detailed' requires elevation (Run as administrator)." + $Return.Detailed = $False + } + + DiagnoseRouteSelection -RouteDiagnostics $Return + + return $Return + } + + ##Test connection parametersets + default + { + ##Construct the return object and fill basic details + $Return = [TestNetConnectionResult]::new() + $Return.ComputerName = $ComputerName + $Return.Detailed = ($InformationLevel -eq "Detailed") + + #### Begin Name Resolution #### + + $Return.ResolvedAddresses = ResolveTargetName -TargetName $ComputerName + if ($Return.ResolvedAddresses -eq $null) + { + if ($InformationLevel -eq "Quiet") + { + return $False + } + + $Return.NameResolutionSucceeded = $False + return $Return + } + + $Return.RemoteAddress = $Return.ResolvedAddresses[0] + $Return.NameResolutionSucceeded = $True + #### End of Name Resolution #### + + #### Begin TCP test #### + + ##Attempt TCP test only if Port or CommonTCPPort is specified + $AttemptTcpTest = ($PSCmdlet.ParameterSetName -eq "CommonTCPPort") -or ($PSCmdlet.ParameterSetName -eq "RemotePort") + if ($AttemptTcpTest) + { + $Return.TcpTestSucceeded = $False + + switch ($CommonTCPPort) + { + "" {$Return.RemotePort = $Port} + "HTTP" {$Return.RemotePort = 80} + "RDP" {$Return.RemotePort = 3389} + "SMB" {$Return.RemotePort = 445} + "WINRM" {$Return.RemotePort = 5985} + } + + ##Try TCP connect using all resolved addresses until it succeeds + $Iter = 0 + while (($Iter -lt $Return.ResolvedAddresses.Count) -and (-not $Return.TcpTestSucceeded)) + { + $Return.TcpTestSucceeded = TestTCP -TargetIPAddress $Return.ResolvedAddresses[$Iter] -TargetPort $Return.RemotePort + ##Output a warning message if the TCP test didn't succeed + if (-not $Return.TcpTestSucceeded) + { + Write-Warning "TCP connect to ($($Return.ResolvedAddresses[$Iter]) : $($Return.RemotePort)) failed" + } + $Iter++ + } + + if ($Return.TcpTestSucceeded) + { + ##Get the remote address that was actually used for connection + $Return.RemoteAddress = $Return.ResolvedAddresses[$Iter - 1] + } + + ##If the user specified "quiet" then we should only return a boolean + if ($InformationLevel -eq "Quiet") + { + return $Return.TcpTestSucceeded + } + } + #### End of TCP test #### + + #### Begin Ping test #### + + ##Attempt Ping test only if TCP test is not attempted or TCP test failed + $AttemptPingTest = (-not $AttemptTcpTest) -or (-not $Return.TcpTestSucceeded) + if ($AttemptPingTest) + { + $Return.PingSucceeded = $False + + ##Try Ping using all resolved addresses until it succeeds + $Iter = 0 + while (($Iter -lt $Return.ResolvedAddresses.Count) -and (-not $Return.PingSucceeded)) + { + $Return.PingReplyDetails = PingTest -TargetIPAddress $Return.ResolvedAddresses[$Iter] + if ($Return.PingReplyDetails -ne $null) + { + $Return.PingSucceeded = ($Return.PingReplyDetails.Status -eq [System.Net.NetworkInformation.IPStatus]::Success) + } + + ##Output a warning message if Ping didn't succeed + if (-not $Return.PingSucceeded) + { + $WarningString = "Ping to $($Return.ResolvedAddresses[$Iter]) failed" + if ($Return.PingReplyDetails -ne $null) + { + $WarningString += " with status: $($Return.PingReplyDetails.Status)" + } + Write-Warning $WarningString + } + $Iter++ + } + + if ($Return.PingSucceeded) + { + ##Get the remote address that was actually used for Ping + $Return.RemoteAddress = $Return.ResolvedAddresses[$Iter - 1] + } + + ##If the user specified "quiet" then we should only return a boolean + if ($InformationLevel -eq "Quiet") + { + return $Return.PingSucceeded + } + } + #### End of Ping test #### + + #### Begin TraceRoute #### + + ##TraceRoute, only occurs if switched by the user + if ($TraceRoute -eq $True) + { + $Return.TraceRoute = TraceRoute -TargetIPAddress $Return.RemoteAddress -Hops $Hops + } + #### End of TraceRoute #### + + $Return = ResolveDNSDetails -TestNetConnectionResult $Return + $Return = ResolveNetworkSecurityDetails -TestNetConnectionResult $Return + $Return = ResolveRoutingandAdapterWMIObjects -TestNetConnectionResult $Return + + return $Return + } + } + } +} + +##Export cmdlet and alias to module +New-Alias TNC Test-NetConnection +Export-ModuleMember -Alias TNC -Function Test-NetConnection diff --git a/newton-cn/bin/v1.0/Modules/NetworkConnectivityStatus/MSFT_DAConnectionStatus.cdxml b/newton-cn/bin/v1.0/Modules/NetworkConnectivityStatus/MSFT_DAConnectionStatus.cdxml new file mode 100644 index 0000000..f829844 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkConnectivityStatus/MSFT_DAConnectionStatus.cdxml @@ -0,0 +1,49 @@ + + + + + 1.0 + DAConnectionStatus + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkConnectivityStatus/MSFT_DAConnectionStatus.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkConnectivityStatus/MSFT_DAConnectionStatus.format.ps1xml new file mode 100644 index 0000000..0e43865 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkConnectivityStatus/MSFT_DAConnectionStatus.format.ps1xml @@ -0,0 +1,27 @@ + + + + + MSFT_DAConnectionStatus + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_DAConnectionStatus + Microsoft.Management.Infrastructure.CimInstance#MSFT_DAConnectionStatus + + + + + + + Status + + + SubStatus + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkConnectivityStatus/MSFT_DAConnectionStatus.types.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkConnectivityStatus/MSFT_DAConnectionStatus.types.ps1xml new file mode 100644 index 0000000..2e20806 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkConnectivityStatus/MSFT_DAConnectionStatus.types.ps1xml @@ -0,0 +1,27 @@ + + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_DAConnectionStatus + + + Status + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.DAConnectionStatus.Status]($this.PSBase.CimInstanceProperties['Status'].Value) + + + $this.PSBase.CimInstanceProperties['Status'].Value = [System.UInt32]$_ + + + + Substatus + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.DAConnectionStatus.Substatus]($this.PSBase.CimInstanceProperties['Substatus'].Value) + + + $this.PSBase.CimInstanceProperties['Substatus'].Value = [System.UInt32]$_ + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkConnectivityStatus/MSFT_NCSIPolicyConfiguration.cdxml b/newton-cn/bin/v1.0/Modules/NetworkConnectivityStatus/MSFT_NCSIPolicyConfiguration.cdxml new file mode 100644 index 0000000..520379c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkConnectivityStatus/MSFT_NCSIPolicyConfiguration.cdxml @@ -0,0 +1,117 @@ + + + + + 1.0 + NCSIPolicyConfiguration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkConnectivityStatus/MSFT_NCSIPolicyConfiguration.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkConnectivityStatus/MSFT_NCSIPolicyConfiguration.format.ps1xml new file mode 100644 index 0000000..13867d6 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkConnectivityStatus/MSFT_NCSIPolicyConfiguration.format.ps1xml @@ -0,0 +1,39 @@ + + + + + MSFT_NCSIPolicyConfiguration + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NCSIPolicyConfiguration + Microsoft.Management.Infrastructure.CimInstance#MSFT_NCSIPolicyConfiguration + + + + + + + Description + + + CorporateDNSProbeHostAddress + + + CorporateDNSProbeHostName + + + CorporateSitePrefixList + + + CorporateWebsiteProbeURL + + + DomainLocationDeterminationURL + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkConnectivityStatus/NetworkConnectivityStatus.psd1 b/newton-cn/bin/v1.0/Modules/NetworkConnectivityStatus/NetworkConnectivityStatus.psd1 new file mode 100644 index 0000000..986ebb5 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkConnectivityStatus/NetworkConnectivityStatus.psd1 @@ -0,0 +1,17 @@ + +@{ + ModuleVersion = '1.0.0.0' + NestedModules = @("MSFT_DAConnectionStatus.cdxml", "MSFT_NCSIPolicyConfiguration.cdxml") + FormatsToProcess = @("MSFT_DAConnectionStatus.format.ps1xml", "MSFT_NCSIPolicyConfiguration.format.ps1xml") + TypesToProcess = @("MSFT_DAConnectionStatus.types.ps1xml") + HelpInfoUri = "http://go.microsoft.com/fwlink/?LinkId=285557" + GUID = '{6C9A449B-B0C6-4386-B139-EE0A55638803}' + Author = 'Microsoft Corporation' + CompanyName = 'Microsoft Corporation' + PowerShellVersion = '5.1' + Copyright = '© Microsoft Corporation. All rights reserved.' + FunctionsToExport = @("Get-DAConnectionStatus", "Get-NCSIPolicyConfiguration", "Reset-NCSIPolicyConfiguration", "Set-NCSIPolicyConfiguration") + CmdletsToExport = @() + AliasesToExport = @() + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/CmdletHelpers.psm1 b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/CmdletHelpers.psm1 new file mode 100644 index 0000000..4696e57 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/CmdletHelpers.psm1 @@ -0,0 +1,379 @@ +########################################################################### +# # +# Module Name: CmdletHelpers.psm1 # +# # +# Description: Wrappers for common functions used by all cmdlets. # +# # +# Copyright (c) Microsoft Corporation. All rights reserved. # +# # +########################################################################### + +function CmdletShouldProcess() { +param( + [Parameter(Mandatory=$true, Position=0)] + [System.Management.Automation.PSCmdlet] $PSCmdlet, + + [Parameter(Mandatory=$true, Position=1)] + [object] $Object + ) + + $PSCmdlet.ShouldProcess($Object) +} + +function Get-NetworkSwitchRegisteredProfileFromNamespace() { +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession]$cimSession, + + [Parameter(Mandatory=$true)] + [string] $Namespace + ) + + Get-CimInstance -classname CIM_RegisteredProfile -Namespace $Namespace -CimSession $cimSession -ErrorAction Ignore | ? {$_.RegisteredName -ieq 'Ethernet Switch Profile' -and $_.RegisteredOrganization -ieq '1' -and ($_.RegisteredVersion).StartsWith("1.")} +} + +# cmdlets should use this, since it will be mocked in unit tests +function Get-NetworkSwitchImplementationNamespace() { +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession + ) + + Get-NetworkSwitchImplementationNamespace_Internal -CimSession $CimSession +} + +function New-LocalCimInstance() { +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimClass] $CimClass, + + [Parameter(Mandatory=$true)] + [HashTable] $Property + ) + + New-CimInstance -ClientOnly -CimClass $CimClass -Property $Property +} + + +# fallback localization data in case it fails to load properly +data networkSwitchLocalizedData +{ + # culture="en-US" + ConvertFrom-StringData @' + ErrorMessageNoTarget={0} encountered an error. Ensure that you are using a valid CIM session and that the Ethernet Switch Profile is correctly registered. If you are passing input objects, ensure these are valid instances of the appropriate type. See the Exception member of this error record for more details on the underlying issue. + ErrorMessageTarget={0} encountered an error while processing {1}. Ensure that you are using a valid CIM session and that the Ethernet Switch Profile is correctly registered. If you are passing input objects, ensure these are valid instances of the appropriate type. See the Exception member of this error record for more details on the underlying issue. + WarningMessageNoTarget={0} encountered a warning: {1}. + WarningMessageTarget={0} encountered a warning while processing {1}: {2}. + UnknownError=An unknown error has occured - error code {0}. + NoValidAssociatedSwitch=The registered Ethernet Switch Profile is not associated with a conforming switch. Please register your switch as conforming to the Ethernet Switch Profile. + NoValidAssociatedNamespace=The switch registered as conforming to the Ethernet Switch Profile is not associated with a valid namespace. Please verify your switch implementation and registration. + NoValidRegisteredProfile=The Ethernet Switch Profile was not registered in root/interop, interop, /root/interop or /interop. Please register the Ethernet Switch Profile in one of these namespaces. + NoMatchingInstance=Did not find any instances matching search criteria: {0} = {1}. +'@ +} + +# load localized strings for the locale +Import-LocalizedData networkSwitchLocalizedData -filename NetworkSwitchManager.Resource.psd1 + +$script:nsLocalizedData = $networkSwitchLocalizedData + +function NetworkSwitchExceptionHandler( + [System.Collections.ArrayList] $ErrorObjects, + [System.Collections.ArrayList] $WarningObjects, + [string] $CmdletName, + [object] $TargetObject) { + + foreach ($ErrorObject in $ErrorObjects) { + + if ($TargetObject) { + $torExceptionMessage = $script:nsLocalizedData.ErrorMessageTarget -f $CmdletName, $TargetObject + } + else { + $torExceptionMessage = $script:nsLocalizedData.ErrorMessageNoTarget -f $CmdletName + } + + $baseErrorId = $ErrorObject.FullyQualifiedErrorId + $errorId = "NetworkSwitchManager : $CmdletName : $baseErrorId" + + $torException = New-Object -TypeName System.Exception -ArgumentList @($torExceptionMessage, $ErrorObject.Exception) + + $torErrorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` + -ArgumentList @($TorException, ` + $errorId, ` + [System.Management.Automation.ErrorCategory] "NotSpecified", ` + $TargetObject) + + Write-Error -ErrorRecord $torErrorRecord + } + + foreach ($WarningObject in $WarningObjects) { + + if ($TargetObject) { + $warningMessage = $script:nsLocalizedData.WarningMessageTarget -f $CmdletName, $TargetObject, $WarningObject.Message + } + else { + $warningMessage = $script:nsLocalizedData.WarningMessageNoTarget -f $CmdletName, $WarningObject.Message + } + + Write-Warning $warningMessage + + } +} + +$global:NETWORK_SWITCH_UNKNOWN_ERROR = 0 +$global:NETWORK_SWITCH_NO_VALID_ASSOCIATED_SWITCH = 1 +$global:NETWORK_SWITCH_NO_VALID_ASSOCIATED_NAMESPACE = 2 +$global:NETWORK_SWITCH_NO_VALID_REGISTERED_PROFILE = 3 +$global:NETWORK_SWITCH_NO_MATCHING_INSTANCE = 4 + +$script:nsCustomErrorMessages = @( + $script:nsLocalizedData.UnknownError, + $script:nsLocalizedData.NoValidAssociatedSwitch, + $script:nsLocalizedData.NoValidAssociatedNamespace, + $script:nsLocalizedData.NoValidRegisteredProfile, + $script:nsLocalizedData.NoMatchingInstance + ) + +function NetworkSwitchErrorHandler( + [int] $ErrorCode, + [string] $CmdletName, + [object] $TargetObject, + [object] $ExtraData1, + [object] $ExtraData2) { + + $baseMessage = $script:nsCustomErrorMessages[$ErrorCode] + + if (($ErrorCode -ne 0) -and $baseMessage) { + $message = $baseMessage -f $ExtraData1, $ExtraData2 + } + else { + $message = $script:nsCustomErrorMessages[$global:NETWORK_SWITCH_UNKNOWN_ERROR] -f $ErrorCode + } + + $nsErrorId = "Error_$ErrorCode" + $nsException = New-Object -TypeName System.Exception -ArgumentList @($message) + $nsErrorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` + -ArgumentList @($nsException, ` + $nsErrorId, ` + [System.Management.Automation.ErrorCategory] "NotSpecified", ` + $TargetObject) + + NetworkSwitchExceptionHandler -ErrorObjects @($nsErrorRecord) ` + -CmdletName $CmdletName ` + -TargetObject $TargetObject +} + + + +function Get-NetworkSwitchService( + [string] $Namespace, + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + [string] $CmdletName) { + + $switchService = Get-CimInstance -ClassName MSFT_SwitchService ` + -Namespace $Namespace ` + -CimSession $CimSession ` + -ErrorVariable cimError ` + -WarningVariable cimWarning ` + -ErrorAction SilentlyContinue ` + -WarningAction SilentlyContinue ` + + NetworkSwitchExceptionHandler -ErrorObject $cimError ` + -WarningObject $cimWarning ` + -CmdletName $cmdletName ` + -TargetObject $port + + $switchService +} + + +function Get-NetworkSwitchAssociatedInstance( + [Microsoft.Management.Infrastructure.CimInstance] $InputObject, + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + [string] $CmdletName, + [string] $ResultClassName + ) { + + $instances = Get-CimAssociatedInstance -InputObject $InputObject ` + -ResultClassName $ResultClassName ` + -CimSession $CimSession ` + -ErrorVariable cimError ` + -WarningVariable cimWarning ` + -ErrorAction SilentlyContinue ` + -WarningAction SilentlyContinue + + NetworkSwitchExceptionHandler -ErrorObject $cimError ` + -WarningObject $cimWarning ` + -CmdletName $cmdletName ` + -TargetObject $InputObject + $instances +} + +function Get-NetworkSwitchClass( + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + [string] $ClassName, + [string] $Namespace, + [string] $CmdletName) { + + $classDef = Get-CimClass -Namespace $Namespace ` + -ClassName $ClassName ` + -CimSession $CimSession ` + -ErrorVariable cimError ` + -WarningVariable cimWarning ` + -ErrorAction SilentlyContinue ` + -WarningAction SilentlyContinue + + NetworkSwitchExceptionHandler -ErrorObject $cimError ` + -WarningObject $cimWarning ` + -CmdletName $cmdletName ` + -TargetObject $InputObject + + $classDef +} + +function Set-NetworkSwitchInstance( + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + [Microsoft.Management.Infrastructure.CimInstance] $InputObject, + [HashTable] $Property, + [string] $CmdletName) { + + Set-CimInstance -InputObject $InputObject ` + -Property $Property ` + -CimSession $CimSession ` + -Confirm:$false ` + -ErrorVariable cimError ` + -WarningVariable cimWarning ` + -ErrorAction SilentlyContinue ` + -WarningAction SilentlyContinue ` + 1>$null + + NetworkSwitchExceptionHandler -ErrorObject $cimError ` + -WarningObject $cimWarning ` + -CmdletName $cmdletName ` + -TargetObject $InputObject +} + +function Get-NetworkSwitchInstanceNoFilter( + [string] $Namespace, + [string] $ClassName, + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + [string] $CmdletName) { + + $insts = Get-CimInstance -NameSpace $Namespace ` + -ClassName $ClassName ` + -CimSession $CimSession ` + -ErrorVariable cimError ` + -WarningVariable cimWarning ` + -ErrorAction SilentlyContinue ` + -WarningAction SilentlyContinue + + NetworkSwitchExceptionHandler -ErrorObject $cimError ` + -WarningObject $cimWarning ` + -CmdletName $CmdletName + $insts +} + +function Filter-NetworkSwitchInstance( + [Microsoft.Management.Infrastructure.CimInstance[]] $Instances, + [string] $Property, + [object] $Value, + [switch] $UseLike, + [switch] $UseContains, + [switch] $AssertNonEmpty, + [string] $CmdletName) { + + $insts = $null + if ($Instances) { + if ($UseLike) { + $insts = $Instances | where {$_.CimInstanceProperties[$Property].Value -like $Value} + } + elseif ($UseContains) { + $insts = $Instances | where {$Value -contains $_.CimInstanceProperties[$Property].Value} + } + else { + $insts = $Instances | where {$_.CimInstanceProperties[$Property].Value -eq $Value} + } + } + + if ($AssertNonEmpty -and (-not $insts)) { + NetworkSwitchErrorHandler -ErrorCode $global:NETWORK_SWITCH_NO_MATCHING_INSTANCE ` + -CmdletName $CmdletName ` + -ExtraData1 $Property ` + -ExtraData2 $Value + } + + $insts +} + +function Invoke-NetworkSwitchMethod( + [Microsoft.Management.Infrastructure.CimInstance] $Instance, + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + [string] $MethodName, + [HashTable] $Arguments, + [string] $CmdletName) { + + Invoke-CimMethod -InputObject $Instance ` + -MethodName $MethodName ` + -Arguments $Arguments ` + -CimSession $CimSession ` + -Confirm:$false ` + -ErrorVariable cimError ` + -WarningVariable cimWarning ` + -ErrorAction SilentlyContinue ` + -WarningAction SilentlyContinue ` + 1>$null + + NetworkSwitchExceptionHandler -ErrorObject $cimError ` + -WarningObject $cimWarning ` + -CmdletName $cmdletName ` + -TargetObject $Instance +} + +#cmdlets should never use this; it will be unit-tested. +function Get-NetworkSwitchImplementationNamespace_Internal() { +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession]$cimSession + ) + + $cmdletName = "Get-NetworkSwitchImplementationNamespace" + $ethernetSwitchProfile = Get-NetworkSwitchRegisteredProfileFromNamespace -CimSession $CimSession -Namespace root/interop + + if (-not $ethernetSwitchProfile) { + $ethernetSwitchProfile = Get-NetworkSwitchRegisteredProfileFromNamespace -CimSession $CimSession -Namespace interop + } + + if (-not $ethernetSwitchProfile) { + $ethernetSwitchProfile = Get-NetworkSwitchRegisteredProfileFromNamespace -CimSession $CimSession -Namespace /root/interop + } + + if (-not $ethernetSwitchProfile) { + $ethernetSwitchProfile = Get-NetworkSwitchRegisteredProfileFromNamespace -CimSession $CimSession -Namespace /interop + } + + if (-not $ethernetSwitchProfile) { + NetworkSwitchErrorHandler -ErrorCode $global:NETWORK_SWITCH_NO_VALID_REGISTERED_PROFILE ` + -CmdletName $cmdletName + return + } + + $computerSystem = Get-CimAssociatedInstance -InputObject $ethernetSwitchProfile -ResultClassName CIM_ComputerSystem -CimSession $CimSession + + if(-not $computerSystem) { + NetworkSwitchErrorHandler -ErrorCode $global:NETWORK_SWITCH_NO_VALID_ASSOCIATED_SWITCH ` + -CmdletName $cmdletName + return + } + + $namespace = $computerSystem.CimSystemProperties.Namespace + + if(-not $namespace) { + NetworkSwitchErrorHandler -ErrorCode $global:NETWORK_SWITCH_NO_VALID_ASSOCIATED_NAMESPACE ` + -CmdletName $cmdletName + return + } + + $namespace +} + +Export-ModuleMember -Function * \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchConfiguration.psm1 b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchConfiguration.psm1 new file mode 100644 index 0000000..defbe0d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchConfiguration.psm1 @@ -0,0 +1,71 @@ +########################################################################### +# # +# Module Name: NetworkSwitchConfiguration.psm1 # +# # +# Description: Cmdlets for saving and restoring the switch state # +# # +# Copyright (c) Microsoft Corporation. All rights reserved. # +# # +########################################################################### + +import-module "$PSScriptRoot\CmdletHelpers.psm1" -Force -DisableNameChecking + +function Restore-NetworkSwitchConfiguration() { +[CmdletBinding(SupportsShouldProcess=$true)] +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession + ) + + Begin { + $cmdletName = "Restore-NetworkSwitchConfiguration" + $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession + } + + Process { + if (-not $nsNamespace) { return } + + $ss = Get-NetworkSwitchService -Namespace $nsNamespace ` + -CimSession $cimSession ` + -CmdletName $cmdletName + + if ($(CmdletShouldProcess $PSCmdlet $ss)) { + Invoke-NetworkSwitchMethod -Instance $ss[0] ` + -CimSession $CimSession ` + -MethodName "CopyStartupToCurrent" ` + -CmdletName $cmdletName + } + } + + End {} +} + +function Save-NetworkSwitchConfiguration() { +[CmdletBinding(SupportsShouldProcess=$true)] +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession + ) + + Begin { + $cmdletName = "Save-NetworkSwitchConfiguration" + $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession + } + + Process { + if (-not $nsNamespace) { return } + + $ss = Get-NetworkSwitchService -Namespace $nsNamespace ` + -CimSession $cimSession ` + -CmdletName $cmdletName + + if ($(CmdletShouldProcess $PSCmdlet $ss)) { + Invoke-NetworkSwitchMethod -Instance $ss[0] ` + -CimSession $CimSession ` + -MethodName "CopyCurrentToStartup" ` + -CmdletName $cmdletName + } + } + + End {} +} diff --git a/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchEthernetPort.psm1 b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchEthernetPort.psm1 new file mode 100644 index 0000000..abdc6a8 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchEthernetPort.psm1 @@ -0,0 +1,573 @@ +########################################################################### +# # +# Module Name: NetworkSwitchEthernetPort.psm1 # +# # +# Description: Cmdlets to manage Ethernet ports # +# # +# Copyright (c) Microsoft Corporation. All rights reserved. # +# # +########################################################################### + +import-module "$PSScriptRoot\CmdletHelpers.psm1" -Force -DisableNameChecking + +function Disable-NetworkSwitchEthernetPort() { +[CmdletBinding(SupportsShouldProcess=$true)] +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + + [Parameter(Mandatory=$true, ParameterSetName="DeviceIdSet")] + [string] $DeviceID, + + [Parameter(Mandatory=$true, ParameterSetName="PortNumberSet")] + [int] $PortNumber, + + [Parameter(Mandatory=$true, + ParameterSetName="InputObjectSet", + ValueFromPipeline=$true)] + [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject + ) + + Begin { + $cmdletName = "Disable-NetworkSwitchEthernetPort" + $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession + } + + Process { + if (-not $nsNamespace) { return } + + if ($InputObject) { + if ($input) { + $ports = $input[0] + } + else { + $ports = $InputObject + } + } + else { + + $ports = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` + -ClassName CIM_EthernetPort ` + -CimSession $CimSession ` + -CmdletName $cmdletName + if ($DeviceID) { + $ports = Filter-NetworkSwitchInstance -Instances $ports ` + -Property DeviceId ` + -Value $DeviceId ` + -CmdletName $cmdletName ` + -AssertNonEmpty + } + elseif ($PortNumber) { + $ports = Filter-NetworkSwitchInstance -Instances $ports ` + -Property PortNumber ` + -Value $PortNumber ` + -CmdletName $cmdletName ` + -AssertNonEmpty + } + } + + foreach ($port in $ports) { + if ($(CmdletShouldProcess $PSCmdlet $port)) { + Invoke-NetworkSwitchMethod -Instance $port ` + -CimSession $CimSession ` + -MethodName "RequestStateChange" ` + -Arguments @{RequestedState = 3} ` + -CmdletName $cmdletName + } + } + } + + End {} +} + +function Enable-NetworkSwitchEthernetPort() { +[CmdletBinding(SupportsShouldProcess=$true)] +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + + [Parameter(Mandatory=$true, ParameterSetName="DeviceIdSet")] + [string] $DeviceID, + + [Parameter(Mandatory=$true, ParameterSetName="PortNumberSet")] + [int] $PortNumber, + + [Parameter(Mandatory=$true, + ParameterSetName="InputObjectSet", + ValueFromPipeline=$true)] + [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject + ) + + Begin { + $cmdletName = "Enable-NetworkSwitchEthernetPort" + $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession + } + + Process { + if (-not $nsNamespace) { return } + + if ($InputObject) { + if ($input) { + $ports = $input[0] + } + else { + $ports = $InputObject + } + } + else { + $ports = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` + -ClassName CIM_EthernetPort ` + -CimSession $CimSession ` + -CmdletName $cmdletName + if ($DeviceID) { + $ports = Filter-NetworkSwitchInstance -Instances $ports ` + -Property DeviceId ` + -Value $DeviceId ` + -CmdletName $cmdletName ` + -AssertNonEmpty + } + elseif ($PortNumber) { + $ports = Filter-NetworkSwitchInstance -Instances $ports ` + -Property PortNumber ` + -Value $PortNumber ` + -CmdletName $cmdletName ` + -AssertNonEmpty + } + } + + foreach ($port in $ports) { + if ($(CmdletShouldProcess $PSCmdlet $port)) { + Invoke-NetworkSwitchMethod -Instance $port ` + -CimSession $CimSession ` + -MethodName "RequestStateChange" ` + -Arguments @{RequestedState = 2} ` + -CmdletName $cmdletName + } + } + } + + End {} +} + +function Get-NetworkSwitchEthernetPort() { +[CmdletBinding(DefaultParameterSetName="DeviceIDSet")] +[OutputType([Microsoft.Management.Infrastructure.CimInstance])] +[OutputType('Microsoft.Management.Infrastructure.CimInstance#CIM_EthernetPort')] +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + + [Parameter(Mandatory=$false, ParameterSetName="DeviceIDSet")] + [string] $DeviceId, + + [Parameter(Mandatory=$true, ParameterSetName="FullDuplexEnabledSet")] + [switch] $FullDuplexEnabled, + + [Parameter(Mandatory=$true, ParameterSetName="FullDuplexDisabledSet")] + [switch] $FullDuplexDisabled, + + [Parameter(Mandatory=$true, ParameterSetName="PortNumberSet")] + [int] $PortNumber + ) + + Begin { + $cmdletName = "Get-NetworkSwitchEthernetPort" + $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession + } + + Process { + if (-not $nsNamespace) { return } + + $ports = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` + -ClassName CIM_EthernetPort ` + -CimSession $CimSession ` + -CmdletName $cmdletName + if ($DeviceId) { + $ports = Filter-NetworkSwitchInstance -Instances $ports ` + -Property DeviceId ` + -Value $DeviceId ` + -CmdletName $cmdletName ` + -AssertNonEmpty + } + elseif ($FullDuplexEnabled) { + $ports = Filter-NetworkSwitchInstance -Instances $ports ` + -Property FullDuplex ` + -Value $true ` + -CmdletName $cmdletName ` + } + elseif ($FullDuplexDisabled) { + $ports = Filter-NetworkSwitchInstance -Instances $ports ` + -Property FullDuplex ` + -Value $false ` + -CmdletName $cmdletName ` + } + elseif ($PortNumber) { + $ports = Filter-NetworkSwitchInstance -Instances $ports ` + -Property PortNumber ` + -Value $PortNumber ` + -CmdletName $cmdletName ` + -AssertNonEmpty + } + + foreach ($port in $ports) { + $lanep = Get-NetworkSwitchAssociatedInstance -InputObject $port ` + -ResultClassName Cim_LanEndpoint ` + -CimSession $CimSession ` + -CmdletName $cmdletName + if ($lanep) { + $ippe = @(Get-NetworkSwitchAssociatedInstance -InputObject $lanep ` + -ResultClassName CIM_IPProtocolEndpoint ` + -CimSession $CimSession ` + -CmdletName $cmdletName) + } + + if ($lanep) { + $vlanep = Get-NetworkSwitchAssociatedInstance -InputObject $lanep ` + -ResultClassName Cim_VLanEndpoint ` + -CimSession $CimSession ` + -CmdletName $cmdletName + } + + if ($vlanep) { + $vlanepsd = Get-NetworkSwitchAssociatedInstance -InputObject $vlanep ` + -ResultClassName Cim_VLanEndpointSettingData ` + -CimSession $CimSession ` + -CmdletName $cmdletName + } + + $port.PSObject.Members.Remove("IPAddress") + Add-Member -InputObject $port ` + -MemberType NoteProperty ` + -Name IPAddress ` + -Value $ippe + + $port.PSObject.Members.Remove("PortMode") + Add-Member -InputObject $port ` + -MemberType NoteProperty ` + -Name PortMode ` + -Value $vlanep.DesiredEndpointMode + + $port.PSObject.Members.Remove("AccessVLAN") + Add-Member -InputObject $port ` + -MemberType NoteProperty ` + -Name AccessVLAN ` + -Value $vlanepsd.AccessVLAN + + $port.PSObject.Members.Remove("TrunkedVLANList") + Add-Member -InputObject $port ` + -MemberType NoteProperty ` + -Name TrunkedVLANList ` + -Value $vlanepsd.TrunkedVLANList + + $port + } + } + + End {} +} + +function Remove-NetworkSwitchEthernetPortIPAddress() { +[CmdletBinding(SupportsShouldProcess=$true)] +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + + [Parameter(Mandatory=$true, ParameterSetName="PortNumberSet")] + [int] $PortNumber, + + [Parameter(Mandatory=$true, + ParameterSetName="InputObjectSet", + ValueFromPipeline=$true)] + [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject + ) + + Begin { + $cmdletName = "Remove-NetworkSwitchEthernetPortIPAddress" + $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession + } + + Process { + if (-not $nsNamespace) { return } + + if ($InputObject) { + if ($input) { + $ports = $input[0] + } + else { + $ports = $InputObject + } + } + else { + $ports = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` + -ClassName CIM_EthernetPort ` + -CimSession $CimSession ` + -CmdletName $cmdletName + if ($PortNumber) { + $ports = Filter-NetworkSwitchInstance -Instances $ports ` + -Property PortNumber ` + -Value $PortNumber ` + -CmdletName $cmdletName ` + -AssertNonEmpty + } + } + + $switchService = Get-NetworkSwitchService -Namespace $nsNamespace ` + -CimSession $cimSession ` + -CmdletName $cmdletName + foreach ($port in $ports) { + if ($(CmdletShouldProcess $PSCmdlet $port)) { + $lanEndpoints = Get-NetworkSwitchAssociatedInstance -InputObject $port ` + -CimSession $CimSession ` + -ResultClassName CIM_LANEndpoint ` + -CmdletName $cmdletName + foreach ($lep in $lanEndpoints) { + $protocolEndpoints = Get-NetworkSwitchAssociatedInstance -InputObject $lep ` + -CimSession $CimSession ` + -ResultClassName CIM_IPProtocolEndpoint ` + -CmdletName $cmdletName + foreach($pep in $protocolEndpoints) { + + Invoke-NetworkSwitchMethod -Instance $switchService[0] ` + -CimSession $CimSession ` + -MethodName "RemoveProtocolEndpoint" ` + -Arguments @{Endpoint = $pep} ` + -CmdletName $cmdletName + } + } + } + } + } + + End {} +} + +function Set-NetworkSwitchEthernetPortIPAddress() { +[CmdletBinding(SupportsShouldProcess=$true)] +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + + [Parameter(Mandatory=$true)] + [string] $IpAddress, + + [Parameter(Mandatory=$true)] + [string] $SubnetAddress, + + [Parameter(Mandatory=$true, ParameterSetName="PortNumberSet")] + [int] $PortNumber, + + [Parameter(Mandatory=$true, + ParameterSetName="InputObjectSet", + ValueFromPipeline=$true)] + [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject + ) + + Begin { + $cmdletName = "Set-NetworkSwitchEthernetPortIPAddress" + $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession + } + + Process { + if (-not $nsNamespace) { return } + + if ($InputObject) { + if ($input) { + $ports = $input[0] + } + else { + $ports = $InputObject + } + } + else { + $ports = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` + -ClassName CIM_EthernetPort ` + -CimSession $CimSession ` + -CmdletName $cmdletName + if ($PortNumber) { + $ports = Filter-NetworkSwitchInstance -Instances $ports ` + -Property PortNumber ` + -Value $PortNumber ` + -CmdletName $cmdletName ` + -AssertNonEmpty + } + } + + $switchService = Get-NetworkSwitchService -Namespace $nsNamespace ` + -CimSession $cimSession ` + -CmdletName $cmdletName + + $ippeCls = Get-NetworkSwitchClass -Namespace $nsNamespace ` + -ClassName CIM_IPProtocolEndpoint ` + -CimSession $CimSession ` + -CmdletName $cmdletName + + $protocolEndpoint = New-LocalCimInstance -CimClass $ippeCls ` + -Property @{IPV4Address = $ipAddress; ` + SubnetMask = $SubnetAddress} + foreach ($port in $ports) { + if ($(CmdletShouldProcess $PSCmdlet $port)) { + Invoke-NetworkSwitchMethod -Instance $switchService[0] ` + -CimSession $CimSession ` + -MethodName "AddProtocolEndpoint" ` + -Arguments @{TargetInterface = $port; ` + ProtocolEndpoint = [ciminstance[]]@($protocolEndpoint)} ` + -CmdletName $cmdletName + } + } + } + + End {} +} + +function Set-NetworkSwitchPortMode() { +[CmdletBinding(SupportsShouldProcess=$true)] +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + + [Parameter(Mandatory=$true, ParameterSetName="AccessSet")] + [switch] $AccessMode, + + [Parameter(Mandatory=$true, ParameterSetName="AccessSet")] + [int] $VlanID, + + [Parameter(Mandatory=$true, ParameterSetName="RouteSet")] + [switch] $RouteMode, + + [Parameter(Mandatory=$true, ParameterSetName="RouteSet")] + [string] $IpAddress, + + [Parameter(Mandatory=$true, ParameterSetName="RouteSet")] + [string] $SubnetAddress, + + [Parameter(Mandatory=$true, ParameterSetName="TrunkSet")] + [switch] $TrunkMode, + + [Parameter(Mandatory=$true, ParameterSetName="TrunkSet")] + [uint16[]] $VlanIDs, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject + ) + + Begin { + $cmdletName = "Set-NetworkSwitchPortMode" + $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession + } + + Process { + if (-not $nsNamespace) { return } + + if ($input) { + $ports = $input[0] + } + else { + $ports = $InputObject + } + + if ($RouteMode) { + $switchService = Get-NetworkSwitchService -Namespace $nsNamespace ` + -CimSession $cimSession ` + -CmdletName $cmdletName + + $ippeCls = Get-NetworkSwitchClass -Namespace $nsNamespace ` + -ClassName CIM_IPProtocolEndpoint ` + -CimSession $CimSession ` + -CmdletName $cmdletName + + $protocolEndpoint = New-LocalCimInstance -CimClass $ippeCls ` + -Property @{IPV4Address = $ipAddress; ` + SubnetMask = $SubnetAddress} + } + + foreach ($port in $ports) { + if ($(CmdletShouldProcess $PSCmdlet $port)) { + if ($RouteMode) { + Invoke-NetworkSwitchMethod -Instance $switchService[0] ` + -CimSession $CimSession ` + -MethodName "AddProtocolEndpoint" ` + -Arguments @{TargetInterface = $port; ` + ProtocolEndpoint = [ciminstance[]]@($protocolEndpoint)} ` + -CmdletName $cmdletName + } + else { + $lanep = Get-NetworkSwitchAssociatedInstance -InputObject $port ` + -ResultClassName Cim_LanEndpoint ` + -CimSession $CimSession ` + -CmdletName $cmdletName + + $vlanep = Get-NetworkSwitchAssociatedInstance -InputObject $lanep ` + -ResultClassName Cim_VLanEndpoint ` + -CimSession $CimSession ` + -CmdletName $cmdletName + + $vlanepsd = Get-NetworkSwitchAssociatedInstance -InputObject $vlanep ` + -ResultClassName Cim_VLanEndpointSettingData ` + -CimSession $CimSession ` + -CmdletName $cmdletName + if ($AccessMode) { + $vlanepProp = @{DesiredEndpointMode = 2} + $vlanepsdProp = @{AccessVlan = $VlanID} + } + elseif ($TrunkMode) { + $vlanepProp = @{DesiredEndpointMode = 5} + $vlanepsdProp = @{TrunkedVlanList = $VlanIDs} + } + + Set-NetworkSwitchInstance -InputObject $vlanep ` + -Property $vlanepProp ` + -CimSession $CimSession ` + -CmdletName $cmdletName + + Set-NetworkSwitchInstance -InputObject $vlanepsd ` + -Property $vlanepsdProp ` + -CimSession $CimSession ` + -CmdletName $cmdletName + } + } + } + } + + End {} +} + +function Set-NetworkSwitchPortProperty() { +[CmdletBinding(SupportsShouldProcess=$true)] +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + + [Parameter(Mandatory=$false)] + [System.Collections.HashTable] $Property, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject + ) + + Begin { + $cmdletName = "Set-NetworkSwitchPortProperty" + $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession + } + + Process { + if (-not $nsNamespace) { return } + + if ($input) { + $ports = $input[0] + } + else { + $ports = $InputObject + } + + foreach ($port in $ports) { + if ($(CmdletShouldProcess $PSCmdlet $port)) { + Set-NetworkSwitchInstance -InputObject $port ` + -CimSession $CimSession ` + -Property $Property ` + -CmdletName $cmdletName + } + } + } + + End {} +} diff --git a/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchFeature.psm1 b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchFeature.psm1 new file mode 100644 index 0000000..3e8bb14 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchFeature.psm1 @@ -0,0 +1,221 @@ +########################################################################### +# # +# Module Name: NetworkSwitchFeature.psm1 # +# # +# Description: Cmdlets to manage features # +# # +# Copyright (c) Microsoft Corporation. All rights reserved. # +# # +########################################################################### + +import-module "$PSScriptRoot\CmdletHelpers.psm1" -Force -DisableNameChecking + +function Disable-NetworkSwitchFeature() { +[CmdletBinding(SupportsShouldProcess=$true)] +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + + [Parameter(Mandatory=$true, ParameterSetName="FeatureNameSet")] + [int] $FeatureName, + + [Parameter(Mandatory=$true, ParameterSetName="NameSet")] + [string] $Name, + + [Parameter(Mandatory=$true,ParameterSetName="InstanceIdSet")] + [string] $InstanceId, + + [Parameter(Mandatory=$true, + ParameterSetName="InputObjectSet", + ValueFromPipeline=$true)] + [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject + ) + + Begin { + $cmdletName = "Disable-NetworkSwitchFeature" + $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession + } + + Process { + if (-not $nsNamespace) { return } + + if ($InputObject) { + if ($input) { + $features = $input[0] + } + else { + $features = $InputObject + } + } + else { + $features = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` + -ClassName MSFT_Feature ` + -CimSession $CimSession ` + -CmdletName $cmdletName + if ($FeatureName) { + $features = Filter-NetworkSwitchInstance -Instances $features ` + -Property FeatureName ` + -Value $FeatureName ` + -CmdletName $cmdletName + } + elseif ($Name) { + $features = Filter-NetworkSwitchInstance -Instances $features ` + -Property Name ` + -Value $Name ` + -CmdletName $cmdletName ` + -UseLike + } + elseif ($InstanceId) { + $features = Filter-NetworkSwitchInstance -Instances $features ` + -Property InstanceId ` + -Value $InstanceId ` + -CmdletName $cmdletName ` + -AssertNonEmpty + } + } + + foreach ($feature in $features) { + if ($(CmdletShouldProcess $PSCmdlet $feature)) { + Set-NetworkSwitchInstance -InputObject $feature ` + -Property @{IsEnabled = $false} ` + -CimSession $CimSession ` + -CmdletName $cmdletName + } + } + } + + End {} +} + +function Enable-NetworkSwitchFeature() { +[CmdletBinding(SupportsShouldProcess=$true)] +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + + [Parameter(Mandatory=$true,ParameterSetName="FeatureNameSet")] + [int] $FeatureName, + + [Parameter(Mandatory=$true,ParameterSetName="NameSet")] + [string] $Name, + + [Parameter(Mandatory=$true,ParameterSetName="InstanceIdSet")] + [string] $InstanceId, + + [Parameter(Mandatory=$true, + ParameterSetName="InputObjectSet", + ValueFromPipeline=$true)] + [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject + ) + + Begin { + $cmdletName = "Enable-NetworkSwitchFeature" + $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession + } + + Process { + if (-not $nsNamespace) { return } + + if ($InputObject) { + if ($input) { + $features = $input[0] + } + else { + $features = $InputObject + } + } + else { + $features = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` + -ClassName MSFT_Feature ` + -CimSession $CimSession ` + -CmdletName $cmdletName + if ($FeatureName) { + $features = Filter-NetworkSwitchInstance -Instances $features ` + -Property FeatureName ` + -Value $FeatureName ` + -CmdletName $cmdletName + } + elseif ($Name) { + $features = Filter-NetworkSwitchInstance -Instances $features ` + -Property Name ` + -Value $Name ` + -CmdletName $cmdletName ` + -UseLike + } + elseif ($InstanceId) { + $features = Filter-NetworkSwitchInstance -Instances $features ` + -Property InstanceId ` + -Value $InstanceId ` + -CmdletName $cmdletName ` + -AssertNonEmpty + } + } + + foreach ($feature in $features) { + if ($(CmdletShouldProcess $PSCmdlet $feature)) { + Set-NetworkSwitchInstance -InputObject $feature ` + -Property @{IsEnabled = $true} ` + -CimSession $CimSession ` + -CmdletName $cmdletName + } + } + } + + End {} +} + +function Get-NetworkSwitchFeature() { +[CmdletBinding(DefaultParameterSetName="NameSet")] +[OutputType([Microsoft.Management.Infrastructure.CimInstance])] +[OutputType('Microsoft.Management.Infrastructure.CimInstance#MSFT_Feature')] +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + + [Parameter(Mandatory=$false, ParameterSetName="NameSet")] + [string] $Name, + + [Parameter(Mandatory=$true, ParameterSetName="EnabledSet")] + [switch] $Enabled, + + [Parameter(Mandatory=$true, ParameterSetName="DisabledSet")] + [switch] $Disabled + ) + + Begin { + $cmdletName = "Get-NetworkSwitchFeature" + $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession + } + + Process { + if (-not $nsNamespace) { return } + + $featureList = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` + -ClassName MSFT_Feature ` + -CimSession $CimSession ` + -CmdletName $cmdletName + if ($Name) { + $featureList = Filter-NetworkSwitchInstance -Instances $featureList ` + -Property Name ` + -Value $Name ` + -CmdletName $cmdletName ` + -UseLike + } + elseif ($Enabled) { + $featureList = Filter-NetworkSwitchInstance -Instances $featureList ` + -Property IsEnabled ` + -Value $true ` + -CmdletName $cmdletName + } + elseif ($Disabled) { + $featureList = Filter-NetworkSwitchInstance -Instances $featureList ` + -Property IsEnabled ` + -Value $false ` + -CmdletName $cmdletName + } + + $featureList + } + + End {} +} diff --git a/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchGlobalSettingData.psm1 b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchGlobalSettingData.psm1 new file mode 100644 index 0000000..06247df --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchGlobalSettingData.psm1 @@ -0,0 +1,37 @@ +########################################################################### +# # +# Module Name: NetworkSwitchGlobalSettingData.psm1 # +# # +# Description: Cmdlet to access the switch global settings data # +# # +# Copyright (c) Microsoft Corporation. All rights reserved. # +# # +########################################################################### + +import-module "$PSScriptRoot\CmdletHelpers.psm1" -Force -DisableNameChecking + +function Get-NetworkSwitchGlobalData() { +[CmdletBinding()] +[OutputType([Microsoft.Management.Infrastructure.CimInstance])] +[OutputType('Microsoft.Management.Infrastructure.CimInstance#MSFT_GlobalEthernetSwitchSettingData')] +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession + ) + + Begin { + $cmdletName = "Get-NetworkSwitchGlobalData" + $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession + } + + Process { + if (-not $nsNamespace) { return } + + Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` + -ClassName MSFT_GlobalEthernetSwitchSettingData ` + -CimSession $CimSession ` + -CmdletName $cmdletName + } + + End {} +} diff --git a/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchManager.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchManager.format.ps1xml new file mode 100644 index 0000000..62e915c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchManager.format.ps1xml @@ -0,0 +1,391 @@ + + + + + GlobalSwitchSettingData_TableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_GlobalEthernetSwitchSettingData + + + + + + 20 + + + + 20 + + + + 20 + + + + 20 + + + + 15 + + + + 20 + + + + + + + Caption + + + Description + + + Name + + + Banner + + + BannerIsEnabled + + + InstanceID + + + + + + + + Feature_TableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_Feature + + + + + + 20 + + + + 20 + + + + 20 + + + + + + + Name + + + IsEnabled + + + InstanceID + + + + + + + + NetworkVLAN_TableView + + Microsoft.Management.Infrastructure.CimInstance#CIM_NetworkVLAN + + + + + + 20 + + + + 20 + + + + 20 + + + + 20 + + + + 10 + + + + + + + Caption + + + Description + + + Name + + + InstanceID + + + VlanID + + + + + + + + EthernetPort_TableView + + Microsoft.Management.Infrastructure.CimInstance#CIM_EthernetPort + + + + + + 20 + + + + 10 + + + + 20 + + + + 10 + + + + 10 + + + + 10 + + + + 15 + + + + + + + Name + + + PortNumber + + + DeviceID + + + FullDuplex + + + AutoSense + + + PortType + + + MaxDataSize + + + + + + + + IPProtocolEndpoint_TableView + + Microsoft.Management.Infrastructure.CimInstance#CIM_IPProtocolEndpoint + + + + + + 20 + + + + 20 + + + + + + + SubnetAddress + + + IPAddress + + + + + + + + GlobalSwitchSettingData_ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_GlobalEthernetSwitchSettingData + + + + + + + Caption + + + Description + + + Name + + + Banner + + + BannerIsEnabled + + + InstanceID + + + + + + + + Feature_ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_Feature + + + + + + + Name + + + IsEnabled + + + InstanceID + + + + + + + + NetworkVLAN_ListView + + Microsoft.Management.Infrastructure.CimInstance#CIM_NetworkVLAN + + + + + + + Caption + + + Description + + + Name + + + InstanceID + + + VlanID + + + + + + + + EthernetPort_ListView + + Microsoft.Management.Infrastructure.CimInstance#CIM_EthernetPort + + + + + + + Name + + + PortNumber + + + DeviceID + + + FullDuplex + + + AutoSense + + + PortType + + + MaxDataSize + + + + + + + + IPProtocolEndpoint_ListView + + Microsoft.Management.Infrastructure.CimInstance#CIM_IPProtocolEndpoint + + + + + + + SubnetAddress + + + IPAddress + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchManager.psd1 b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchManager.psd1 new file mode 100644 index 0000000..9d1b649 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchManager.psd1 @@ -0,0 +1,50 @@ +########################################################################### +# # +# Module Name: NetworkSwitchManager.psd1 # +# # +# Description: Network switch manager module manifest file # +# # +# Copyright (c) Microsoft Corporation. All rights reserved. # +# # +########################################################################### +@{ + GUID = '53B60D16-69AD-4453-BF41-83EFA5AC35B8' + Author = "Microsoft Corporation" + CompanyName = "Microsoft" + Copyright = "© Microsoft. All rights reserved." + HelpInfoUri = "http://go.microsoft.com/fwlink/?linkid=216365" + ModuleVersion = '1.0.0.0' + NestedModules=@("NetworkSwitchConfiguration.psm1", "NetworkSwitchEthernetPort.psm1", "NetworkSwitchFeature.psm1", "NetworkSwitchGlobalSettingData.psm1", "NetworkSwitchVlan.psm1") + AliasesToExport = @() + + FunctionsToExport = @( + 'Disable-NetworkSwitchEthernetPort', + 'Enable-NetworkSwitchEthernetPort', + 'Get-NetworkSwitchEthernetPort', + 'Remove-NetworkSwitchEthernetPortIPAddress', + 'Set-NetworkSwitchEthernetPortIPAddress', + 'Set-NetworkSwitchPortMode', + 'Set-NetworkSwitchPortProperty', + + 'Disable-NetworkSwitchFeature', + 'Enable-NetworkSwitchFeature', + 'Get-NetworkSwitchFeature', + + 'Disable-NetworkSwitchVlan', + 'Enable-NetworkSwitchVlan', + 'Get-NetworkSwitchVlan', + 'New-NetworkSwitchVlan', + 'Remove-NetworkSwitchVlan', + 'Set-NetworkSwitchVlanProperty', + + 'Get-NetworkSwitchGlobalData', + + 'Save-NetworkSwitchConfiguration', + 'Restore-NetworkSwitchConfiguration' + ) + + PowerShellVersion = '5.1' + TypesToProcess = @('NetworkSwitchManager.types.ps1xml') + FormatsToProcess = @('NetworkSwitchManager.format.ps1xml') + CompatiblePSEditions = @('Desktop','Core') +} diff --git a/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchManager.types.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchManager.types.ps1xml new file mode 100644 index 0000000..da2686c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchManager.types.ps1xml @@ -0,0 +1,40 @@ + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_GlobalEthernetSwitchSettingData + + + Name + ElementName + + + + + Microsoft.Management.Infrastructure.CimInstance#CIM_NetworkVLAN + + + Name + ElementName + + + + + Microsoft.Management.Infrastructure.CimInstance#CIM_IPProtocolEndpoint + + + IPAddress + IPv4Address + + + SubnetAddress + SubnetMask + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchVlan.psm1 b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchVlan.psm1 new file mode 100644 index 0000000..fd67c04 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/NetworkSwitchVlan.psm1 @@ -0,0 +1,430 @@ +########################################################################### +# # +# Module Name: NetworkSwitchVlan.psm1 # +# # +# Description: Cmdlets for managing VLANs # +# # +# Copyright (c) Microsoft Corporation. All rights reserved. # +# # +########################################################################### + +import-module "$PSScriptRoot\CmdletHelpers.psm1" -Force -DisableNameChecking + +function Disable-NetworkSwitchVlan() { +[CmdletBinding(SupportsShouldProcess=$true)] +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + + [Parameter(Mandatory=$true, ParameterSetName="InstanceIdSet")] + [string] $InstanceId, + + [Parameter(Mandatory=$true, ParameterSetName="NameSet")] + [string] $Name, + + [Parameter(Mandatory=$true, ParameterSetName="VlanIdSet")] + [int] $VlanID + ) + + Begin { + $cmdletName = "Disable-NetworkSwitchVlan" + $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession + } + + Process { + if (-not $nsNamespace) { return } + + $vlans = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` + -ClassName CIM_NetworkVLAN ` + -CimSession $CimSession ` + -CmdletName $cmdletName + + if ($InstanceId) { + $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` + -Property InstanceId ` + -Value $InstanceId ` + -AssertNonEmpty ` + -CmdletName $cmdletName + } + elseif ($VlanID) { + $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` + -Property VlanId ` + -Value $VlanId ` + -AssertNonEmpty ` + -CmdletName $cmdletName + } + elseif ($Name) { + $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` + -Property ElementName ` + -Value $Name ` + -UseLike ` + -CmdletName $cmdletName + } + + $switchService = Get-NetworkSwitchService -Namespace $nsNamespace ` + -CimSession $CimSession ` + -CmdletName $cmdletName + foreach ($vlan in $vlans) { + if ($(CmdletShouldProcess $PSCmdlet $vlan)) { + Invoke-NetworkSwitchMethod -Instance $switchService[0] ` + -CimSession $CimSession ` + -MethodName "DisableVLAN" ` + -Arguments @{VLAN = [ciminstance[]]@($vlan)} ` + -CmdletName $cmdletName + } + } + } + + End {} +} + +function Enable-NetworkSwitchVlan() { +[CmdletBinding(SupportsShouldProcess=$true)] +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + + [Parameter(Mandatory=$true, ParameterSetName="InstanceIdSet")] + [string] $InstanceId, + + [Parameter(Mandatory=$true, ParameterSetName="NameSet")] + [string] $Name, + + [Parameter(Mandatory=$true, ParameterSetName="VlanIdSet")] + [int] $VlanID + ) + + Begin { + $cmdletName = "Enable-NetworkSwitchVlan" + $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession + } + + Process { + if (-not $nsNamespace) { return } + + $vlans = Get-NetworkSwitchInstanceNoFilter -Namespace $nsNamespace ` + -ClassName CIM_NetworkVLAN ` + -CimSession $CimSession ` + -CmdletName $cmdletName + + if ($InstanceId) { + $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` + -Property InstanceId ` + -Value $InstanceId ` + -AssertNonEmpty ` + -CmdletName $cmdletName + } + elseif ($VlanID) { + $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` + -Property VlanId ` + -Value $VlanId ` + -AssertNonEmpty ` + -CmdletName $cmdletName + } + elseif ($Name) { + $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` + -Property ElementName ` + -Value $Name ` + -UseLike ` + -CmdletName $cmdletName + } + + $switchService = Get-NetworkSwitchService -Namespace $nsNamespace ` + -CimSession $CimSession ` + -CmdletName $cmdletName + foreach ($vlan in $vlans) { + if ($(CmdletShouldProcess $PSCmdlet $vlan)) { + Invoke-NetworkSwitchMethod -Instance $switchService[0] ` + -CimSession $CimSession ` + -MethodName "EnableVLAN" ` + -Arguments @{VLAN = [ciminstance[]]@($vlan)} ` + -CmdletName $cmdletName + } + } + } + + End {} +} + +function Get-NetworkSwitchVlan() { +[CmdletBinding(DefaultParameterSetName="NameSet")] +[OutputType([Microsoft.Management.Infrastructure.CimInstance])] +[OutputType("Microsoft.Management.Infrastructure.CimInstance#CIM_NetworkVLAN")] +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + + [Parameter(Mandatory=$false, ParameterSetName="NameSet")] + [string] $Name, + + [Parameter(Mandatory=$true, ParameterSetName="VlanIdSet")] + [int] $VlanId, + + [Parameter(Mandatory=$true, ParameterSetName="InstanceIdSet")] + [string] $InstanceId, + + [Parameter(Mandatory=$true, ParameterSetName="CaptionSet")] + [string] $Caption, + + [Parameter(Mandatory=$true, ParameterSetName="DescriptionSet")] + [string] $Description + ) + + Begin { + $cmdletName = "Get-NetworkSwitchVlan" + $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession + } + + Process { + if (-not $nsNamespace) { return } + + $vlanList = Get-NetworkSwitchInstanceNoFilter -ClassName CIM_NetworkVlan ` + -Namespace $nsNamespace ` + -CimSession $CimSession ` + -CmdletName $cmdletName + + if ($Name) { + $vlanList = Filter-NetworkSwitchInstance -Instances $vlanList ` + -Property ElementName ` + -Value $Name ` + -UseLike ` + -CmdletName $cmdletName + } + elseif ($Caption) { + $vlanList = Filter-NetworkSwitchInstance -Instances $vlanList ` + -Property Caption ` + -Value $Caption ` + -UseLike ` + -CmdletName $cmdletName + } + elseif ($Description) { + $vlanList = Filter-NetworkSwitchInstance -Instances $vlanList ` + -Property Description ` + -Value $Description ` + -UseLike ` + -CmdletName $cmdletName + } + elseif ($VlanId) { + $vlanList = Filter-NetworkSwitchInstance -Instances $vlanList ` + -Property VlanId ` + -Value $VlanId ` + -AssertNonEmpty ` + -CmdletName $cmdletName + } + elseif ($InstanceId) { + $vlanList = Filter-NetworkSwitchInstance -Instances $vlanList ` + -Property InstanceId ` + -Value $InstanceId ` + -AssertNonEmpty ` + -CmdletName $cmdletName + } + + $vlanList + } + + End {} +} + +function New-NetworkSwitchVlan() { +[CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + + [Parameter(Mandatory=$false)] + [string] $Caption, + + [Parameter(Mandatory=$false)] + [string] $Description, + + [Parameter(Mandatory=$true)] + [int] $VlanID, + + [Parameter(Mandatory=$true)] + [string] $Name + ) + + Begin { + $cmdletName = "New-NetworkSwitchVlan" + $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession + } + + Process { + if (-not $nsNamespace) { return } + + $cs = Get-NetworkSwitchInstanceNoFilter -CimSession $CimSession ` + -ClassName CIM_ComputerSystem ` + -Namespace $nsNamespace ` + -CmdletName $cmdletName + + $switchService = Get-NetworkSwitchService -Namespace $nsNamespace ` + -ClassName MSFT_SwitchService ` + -CimSession $CimSession ` + -CmdletName $cmdletName + + $vlanCls = Get-NetworkSwitchClass -Namespace $nsNamespace ` + -ClassName CIM_NetworkVLAN ` + -CimSession $CimSession ` + -CmdletName $cmdletName + + $vlan = New-LocalCimInstance -CimClass $vlanCls ` + -Property @{VLANId = $VlanID; ` + ElementName = $Name; ` + Caption = [string]$Caption; ` + Description = [string]$Description} + + Invoke-NetworkSwitchMethod -Instance $switchService[0] ` + -CimSession $CimSession ` + -MethodName "AddVLAN" ` + -Arguments @{ TargetedSwitch = $cs[0]; ` + NetworkVLAN = [ciminstance[]]@($vlan) } ` + -CmdletName $cmdletName + } + + End {} +} + +function Remove-NetworkSwitchVlan() { +[CmdletBinding(SupportsShouldProcess=$true)] +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + + [Parameter(Mandatory=$false, ParameterSetName="InstanceIdSet")] + [string] $InstanceId, + + [Parameter(Mandatory=$false, ParameterSetName="NameSet")] + [string] $Name, + + [Parameter(Mandatory=$false, ParameterSetName="VlanIdSet")] + [int] $VlanId, + + [Parameter(Mandatory=$true, + ParameterSetName="InputObjectSet", + ValueFromPipeline=$true)] + [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject + ) + + Begin { + $cmdletName = "Remove-NetworkSwitchVlan" + $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession + } + + Process { + if (-not $nsNamespace) { return } + + if ($InputObject) { + if ($input) { + $vlans = $input[0] + } + else { + $vlans = $InputObject + } + } + else { + $vlans = Get-NetworkSwitchInstanceNoFilter -NameSpace $nsNamespace ` + -ClassName CIM_NetworkVlan ` + -CimSession $CimSession ` + -CmdletName $cmdletName + if ($Name) { + $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` + -Property ElementName ` + -Value $Name ` + -UseLike ` + -CmdletName $cmdletName + } + elseif ($VlanId) { + $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` + -Property VlanId ` + -Value $VlanId ` + -AssertNonEmpty ` + -CmdletName $cmdletName + } + elseif ($InstanceId) { + $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` + -Property InstanceId ` + -Value $InstanceId ` + -AssertNonEmpty ` + -CmdletName $cmdletName + } + } + + $switchService = Get-NetworkSwitchService -Namespace $nsNamespace ` + -ClassName MSFT_SwitchService ` + -CimSession $CimSession ` + -CmdletName $cmdletName + foreach ($vlan in $vlans) { + if ($(CmdletShouldProcess $PSCmdlet $vlan)) { + Invoke-NetworkSwitchMethod -Instance $switchService[0] ` + -CimSession $CimSession ` + -MethodName "RemoveVLAN" ` + -Arguments @{VLAN = [ciminstance[]]@($vlan)} ` + -CmdletName $cmdletName + } + } + } + + End {} +} + +function Set-NetworkSwitchVlanProperty() { +[CmdletBinding(SupportsShouldProcess=$true)] +param( + [Parameter(Mandatory=$true)] + [Microsoft.Management.Infrastructure.CimSession] $CimSession, + + [Parameter(Mandatory=$false)] + [System.Collections.HashTable] $Property, + + [Parameter(Mandatory=$true, ParameterSetName="VlanIdSet")] + [int[]] $VlanId, + + [Parameter(Mandatory=$true, + ParameterSetName="InputObjectSet", + ValueFromPipeline=$true)] + [Microsoft.Management.Infrastructure.CimInstance[]] $InputObject + ) + + Begin { + $cmdletName = "Set-NetworkSwitchVlanProperty" + $nsNamespace = Get-NetworkSwitchImplementationNamespace -CimSession $CimSession + } + + Process { + if (-not $nsNamespace) { return } + + if ($InputObject) { + if ($input) { + $vlans = $input[0] + } + else { + $vlans = $InputObject + } + } + else { + $vlans = Get-NetworkSwitchInstanceNoFilter -NameSpace $nsNamespace ` + -ClassName CIM_NetworkVlan ` + -CimSession $CimSession ` + -CmdletName $cmdletName + if ($VlanId) { + $vlans = Filter-NetworkSwitchInstance -Instances $vlans ` + -Property VlanId ` + -Value $VlanId ` + -UseContains ` + -AssertNonEmpty ` + -CmdletName $cmdletName + } + } + + foreach ($vlan in $vlans) { + if ($(CmdletShouldProcess $PSCmdlet $vlan)) { + Set-NetworkSwitchInstance -InputObject $vlan ` + -Property $Property ` + -CimSession $CimSession ` + -CmdletName $cmdletName + } + } + } + + End {} +} diff --git a/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/ko-KR/NetworkSwitchManager.Resource.psd1 b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/ko-KR/NetworkSwitchManager.Resource.psd1 new file mode 100644 index 0000000..8d02f46 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/NetworkSwitchManager/ko-KR/NetworkSwitchManager.Resource.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_Net6to4Configuration.cdxml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_Net6to4Configuration.cdxml new file mode 100644 index 0000000..13bfec9 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_Net6to4Configuration.cdxml @@ -0,0 +1,137 @@ + + + + + 1.0 + Net6to4Configuration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_Net6to4Configuration.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_Net6to4Configuration.format.ps1xml new file mode 100644 index 0000000..27443ab --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_Net6to4Configuration.format.ps1xml @@ -0,0 +1,40 @@ + + + + + MSFT_Net6to4Configuration + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_Net6to4Configuration + Microsoft.Management.Infrastructure.CimInstance#MSFT_Net6to4Configuration + + + + + + + Description + + + State + + + AutoSharing + + + RelayName + + + RelayState + + + ResolutionInterval + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_Net6to4Configuration.types.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_Net6to4Configuration.types.ps1xml new file mode 100644 index 0000000..26d7736 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_Net6to4Configuration.types.ps1xml @@ -0,0 +1,69 @@ + + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_Net6to4Configuration + + + State + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Net6to4Configuration.State]($this.PSBase.CimInstanceProperties['State'].Value) + + + $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ + + + + AutoSharing + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Net6to4Configuration.State]($this.PSBase.CimInstanceProperties['AutoSharing'].Value) + + + $this.PSBase.CimInstanceProperties['AutoSharing'].Value = [System.UInt32]$_ + + + + RelayState + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Net6to4Configuration.State]($this.PSBase.CimInstanceProperties['RelayState'].Value) + + + $this.PSBase.CimInstanceProperties['RelayState'].Value = [System.UInt32]$_ + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_Net6to4Configuration + + + State + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Net6to4Configuration.State]($this.PSBase.CimInstanceProperties['State'].Value) + + + $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ + + + + AutoSharing + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Net6to4Configuration.State]($this.PSBase.CimInstanceProperties['AutoSharing'].Value) + + + $this.PSBase.CimInstanceProperties['AutoSharing'].Value = [System.UInt32]$_ + + + + RelayState + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Net6to4Configuration.State]($this.PSBase.CimInstanceProperties['RelayState'].Value) + + + $this.PSBase.CimInstanceProperties['RelayState'].Value = [System.UInt32]$_ + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetDnsTransitionConfiguration.cdxml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetDnsTransitionConfiguration.cdxml new file mode 100644 index 0000000..0b25047 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetDnsTransitionConfiguration.cdxml @@ -0,0 +1,145 @@ + + + + 1.0 + NetDnsTransitionConfiguration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetDnsTransitionConfiguration.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetDnsTransitionConfiguration.format.ps1xml new file mode 100644 index 0000000..3acfe7b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetDnsTransitionConfiguration.format.ps1xml @@ -0,0 +1,47 @@ + + + + + MSFT_NetDnsTransitionConfiguration + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetDnsTransitionConfiguration + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetDnsTransitionConfiguration + + + + + + + State + + + AcceptInterface + + + SendInterface + + + OnlySendAQuery + + + Latency + + + + AlwaysSynthesize + + + ExclusionList + + + PrefixMapping + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetDnsTransitionConfiguration.types.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetDnsTransitionConfiguration.types.ps1xml new file mode 100644 index 0000000..3bb4707 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetDnsTransitionConfiguration.types.ps1xml @@ -0,0 +1,32 @@ + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetDnsTransitionConfiguration + + + State + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetDnsTransitionConfiguration.State]($this.PSBase.CimInstanceProperties['State'].Value) + + + $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetDnsTransitionConfiguration + + + State + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetDnsTransitionConfiguration.State]($this.PSBase.CimInstanceProperties['State'].Value) + + + $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetDnsTransitionMonitoring.cdxml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetDnsTransitionMonitoring.cdxml new file mode 100644 index 0000000..3ccd6fd --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetDnsTransitionMonitoring.cdxml @@ -0,0 +1,13 @@ + + + + 1.0 + NetDnsTransitionMonitoring + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetDnsTransitionMonitoring.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetDnsTransitionMonitoring.format.ps1xml new file mode 100644 index 0000000..9da684e --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetDnsTransitionMonitoring.format.ps1xml @@ -0,0 +1,40 @@ + + + + + MSFT_NetDnsTransitionMonitoring + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetDnsTransitionMonitoring + + + + + + + NumAAAAQueriesSucceeded + + + NumAAAAQueriesFailed + + + NumAAAAQueriesSynthesized + + + NumAAAAQueriesIn6ArpaPtr + + + NumOtherQueriesSucceeded + + + NumOtherQueriesFailed + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetISATAPConfiguration.cdxml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetISATAPConfiguration.cdxml new file mode 100644 index 0000000..1980c83 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetISATAPConfiguration.cdxml @@ -0,0 +1,126 @@ + + + + + 1.0 + NetIsatapConfiguration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetISATAPConfiguration.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetISATAPConfiguration.format.ps1xml new file mode 100644 index 0000000..0c0262d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetISATAPConfiguration.format.ps1xml @@ -0,0 +1,37 @@ + + + + + MSFT_NetISATAPConfiguration + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetISATAPConfiguration + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetISATAPConfiguration + + + + + + + Description + + + State + + + Router + + + ResolutionState + + + ResolutionInterval + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetISATAPConfiguration.types.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetISATAPConfiguration.types.ps1xml new file mode 100644 index 0000000..e9e6f72 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetISATAPConfiguration.types.ps1xml @@ -0,0 +1,51 @@ + + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetISATAPConfiguration + + + State + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetISATAPConfiguration.State]($this.PSBase.CimInstanceProperties['State'].Value) + + + $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ + + + + ResolutionState + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetISATAPConfiguration.State]($this.PSBase.CimInstanceProperties['ResolutionState'].Value) + + + $this.PSBase.CimInstanceProperties['ResolutionState'].Value = [System.UInt32]$_ + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetISATAPConfiguration + + + State + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetISATAPConfiguration.State]($this.PSBase.CimInstanceProperties['State'].Value) + + + $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ + + + + ResolutionState + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetISATAPConfiguration.State]($this.PSBase.CimInstanceProperties['ResolutionState'].Value) + + + $this.PSBase.CimInstanceProperties['ResolutionState'].Value = [System.UInt32]$_ + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetIpHTTPsConfiguration.cdxml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetIpHTTPsConfiguration.cdxml new file mode 100644 index 0000000..a77d2c2 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetIpHTTPsConfiguration.cdxml @@ -0,0 +1,321 @@ + + + + 1.0 + NetIPHttpsConfiguration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetIpHTTPsConfiguration.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetIpHTTPsConfiguration.format.ps1xml new file mode 100644 index 0000000..df19335 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetIpHTTPsConfiguration.format.ps1xml @@ -0,0 +1,50 @@ + + + + + MSFT_NetIPHttpsConfiguration + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetIPHttpsConfiguration + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPHttpsConfiguration + + + + + + + PolicyStore + + + ConfigurationType + + + Profile + + + ProfileActivated + + + State + + + ServerURL + + + Type + + + AuthMode + + + StrongCRLRequired + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetIpHTTPsConfiguration.types.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetIpHTTPsConfiguration.types.ps1xml new file mode 100644 index 0000000..3fdecb1 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetIpHTTPsConfiguration.types.ps1xml @@ -0,0 +1,86 @@ + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetIPHttpsConfiguration + + + Type + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPHttpsConfiguration.Type]($this.PSBase.CimInstanceProperties['Type'].Value) + + + $this.PSBase.CimInstanceProperties['Type'].Value = [System.UInt32]$_ + + + + State + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPHttpsConfiguration.State]($this.PSBase.CimInstanceProperties['State'].Value) + + + $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ + + + + AuthMode + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPHttpsConfiguration.AuthMode]($this.PSBase.CimInstanceProperties['AuthMode'].Value) + + + $this.PSBase.CimInstanceProperties['AuthMode'].Value = [System.UInt32]$_ + + + + ConfigurationType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPHttpsConfiguration.ConfigurationType]($this.PSBase.CimInstanceProperties['ConfigurationType'].Value) + + + $this.PSBase.CimInstanceProperties['ConfigurationType'].Value = [System.UInt32]$_ + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetIPHttpsConfiguration + + + Type + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPHttpsConfiguration.Type]($this.PSBase.CimInstanceProperties['Type'].Value) + + + $this.PSBase.CimInstanceProperties['Type'].Value = [System.UInt32]$_ + + + + State + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPHttpsConfiguration.State]($this.PSBase.CimInstanceProperties['State'].Value) + + + $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ + + + + AuthMode + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPHttpsConfiguration.AuthMode]($this.PSBase.CimInstanceProperties['AuthMode'].Value) + + + $this.PSBase.CimInstanceProperties['AuthMode'].Value = [System.UInt32]$_ + + + + ConfigurationType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetIPHttpsConfiguration.ConfigurationType]($this.PSBase.CimInstanceProperties['ConfigurationType'].Value) + + + $this.PSBase.CimInstanceProperties['ConfigurationType'].Value = [System.UInt32]$_ + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetIpHTTPsState.cdxml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetIpHTTPsState.cdxml new file mode 100644 index 0000000..9c469ef --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetIpHTTPsState.cdxml @@ -0,0 +1,10 @@ + + + + 1.0 + NetIPHttpsState + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetIpHTTPsState.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetIpHTTPsState.format.ps1xml new file mode 100644 index 0000000..02d64ff --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetIpHTTPsState.format.ps1xml @@ -0,0 +1,28 @@ + + + + + MSFT_NetIPHttpsState + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetIPHttpsState + + + + + + + LastErrorCode + 0x{0:x} + + + InterfaceStatus + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetNatTransitionConfiguration.cdxml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetNatTransitionConfiguration.cdxml new file mode 100644 index 0000000..e64f942 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetNatTransitionConfiguration.cdxml @@ -0,0 +1,165 @@ + + + + 1.0 + NetNatTransitionConfiguration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetNatTransitionConfiguration.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetNatTransitionConfiguration.format.ps1xml new file mode 100644 index 0000000..b4ba685 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetNatTransitionConfiguration.format.ps1xml @@ -0,0 +1,45 @@ + + + + + MSFT_NetNatTransitionConfiguration + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetNatTransitionConfiguration + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetNatTransitionConfiguration + + + + + + + InstanceName + + + PolicyStore + + + State + + + TcpMappingTimeout + + + InboundInterface + + + OutboundInterface + + + PrefixMapping + + + IPv4AddressPortPool + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetNatTransitionConfiguration.types.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetNatTransitionConfiguration.types.ps1xml new file mode 100644 index 0000000..5166a4f --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetNatTransitionConfiguration.types.ps1xml @@ -0,0 +1,50 @@ + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetNatTransitionConfiguration + + + State + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNatTransitionConfiguration.State]($this.PSBase.CimInstanceProperties['State'].Value) + + + $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ + + + + PolicyStore + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNatTransitionConfiguration.PolicyStore]($this.PSBase.CimInstanceProperties['PolicyStore'].Value) + + + $this.PSBase.CimInstanceProperties['PolicyStore'].Value = [System.UInt32]$_ + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetNatTransitionConfiguration + + + State + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNatTransitionConfiguration.State]($this.PSBase.CimInstanceProperties['State'].Value) + + + $this.PSBase.CimInstanceProperties['State'].Value = [System.UInt32]$_ + + + + PolicyStore + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetNatTransitionConfiguration.PolicyStore]($this.PSBase.CimInstanceProperties['PolicyStore'].Value) + + + $this.PSBase.CimInstanceProperties['PolicyStore'].Value = [System.UInt32]$_ + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetNatTransitionMonitoring.cdxml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetNatTransitionMonitoring.cdxml new file mode 100644 index 0000000..5f916f5 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetNatTransitionMonitoring.cdxml @@ -0,0 +1,23 @@ + + + + 1.0 + NetNatTransitionMonitoring + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetNatTransitionMonitoring.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetNatTransitionMonitoring.format.ps1xml new file mode 100644 index 0000000..45ac971 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetNatTransitionMonitoring.format.ps1xml @@ -0,0 +1,50 @@ + + + + + MSFT_NetNatTransitionMonitoring + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetNatTransitionMonitoring + + + + + + 8 + + + + 25 + + + + 25 + + + + + + + + + + TransportProtocol + + + InboundAddress + + + OutboundAddress + + + NatOutboundAddress + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetTeredoConfiguration.cdxml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetTeredoConfiguration.cdxml new file mode 100644 index 0000000..be6e084 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetTeredoConfiguration.cdxml @@ -0,0 +1,166 @@ + + + + + 1.0 + NetTeredoConfiguration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetTeredoConfiguration.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetTeredoConfiguration.format.ps1xml new file mode 100644 index 0000000..83d6cb7 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetTeredoConfiguration.format.ps1xml @@ -0,0 +1,46 @@ + + + + + MSFT_NetTeredoConfiguration + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetTeredoConfiguration + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetTeredoConfiguration + + + + + + + Description + + + Type + + + ServerName + + + RefreshInterval + + + + ClientPort + + + ServerVirtualIP + + + DefaultQualified + + + ServerShunt + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetTeredoConfiguration.types.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetTeredoConfiguration.types.ps1xml new file mode 100644 index 0000000..89d5bc3 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetTeredoConfiguration.types.ps1xml @@ -0,0 +1,32 @@ + + + + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetTeredoConfiguration + + + Type + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTeredoConfiguration.Type]($this.PSBase.CimInstanceProperties['Type'].Value) + + + $this.PSBase.CimInstanceProperties['Type'].Value = [System.UInt32]$_ + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetTeredoConfiguration + + + Type + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetTeredoConfiguration.Type]($this.PSBase.CimInstanceProperties['Type'].Value) + + + $this.PSBase.CimInstanceProperties['Type'].Value = [System.UInt32]$_ + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetTeredoState.cdxml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetTeredoState.cdxml new file mode 100644 index 0000000..bf9550b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetTeredoState.cdxml @@ -0,0 +1,19 @@ + + + + + 1.0 + NetTeredoState + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetTeredoState.format.ps1xml b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetTeredoState.format.ps1xml new file mode 100644 index 0000000..03a7da9 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/MSFT_NetTeredoState.format.ps1xml @@ -0,0 +1,26 @@ + + + + + MSFT_NetTeredoState + + Microsoft.Management.Infrastructure.CimInstance#root/StandardCimv2/MSFT_NetTeredoState + + + + + + + Error + + + State + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/NetworkTransition/NetworkTransition.psd1 b/newton-cn/bin/v1.0/Modules/NetworkTransition/NetworkTransition.psd1 new file mode 100644 index 0000000..8fb8477 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/NetworkTransition/NetworkTransition.psd1 @@ -0,0 +1,17 @@ + +@{ + ModuleVersion = '1.0.0.0' + NestedModules = @("MSFT_Net6to4Configuration.cdxml", "MSFT_NetDnsTransitionConfiguration.cdxml", "MSFT_NetDnsTransitionMonitoring.cdxml", "MSFT_NetIpHTTPsConfiguration.cdxml", "MSFT_NetIpHTTPsState.cdxml", "MSFT_NetISATAPConfiguration.cdxml", "MSFT_NetNatTransitionConfiguration.cdxml", "MSFT_NetNatTransitionMonitoring.cdxml", "MSFT_NetTeredoConfiguration.cdxml", "MSFT_NetTeredoState.cdxml") + FormatsToProcess = @("MSFT_Net6to4Configuration.format.ps1xml", "MSFT_NetDnsTransitionConfiguration.format.ps1xml", "MSFT_NetDnsTransitionMonitoring.format.ps1xml", "MSFT_NetIpHTTPsConfiguration.format.ps1xml", "MSFT_NetIpHTTPsState.format.ps1xml", "MSFT_NetISATAPConfiguration.format.ps1xml", "MSFT_NetNatTransitionConfiguration.format.ps1xml", "MSFT_NetNatTransitionMonitoring.format.ps1xml", "MSFT_NetTeredoConfiguration.format.ps1xml", "MSFT_NetTeredoState.format.ps1xml") + TypesToProcess = @("MSFT_Net6to4Configuration.types.ps1xml", "MSFT_NetDnsTransitionConfiguration.types.ps1xml", "MSFT_NetIpHTTPsConfiguration.types.ps1xml", "MSFT_NetISATAPConfiguration.types.ps1xml", "MSFT_NetNatTransitionConfiguration.types.ps1xml", "MSFT_NetTeredoConfiguration.types.ps1xml") + HelpInfoUri = "http://go.microsoft.com/fwlink/?LinkId=285559" + GUID = '{EFF9CCF9-53ED-423d-B0DA-23E6772AACAA}' + Author = 'Microsoft Corporation' + CompanyName = 'Microsoft Corporation' + PowerShellVersion = '5.1' + Copyright = '© Microsoft Corporation. All rights reserved.' + FunctionsToExport = @("Add-NetIPHttpsCertBinding", "Disable-NetDnsTransitionConfiguration", "Disable-NetIPHttpsProfile", "Disable-NetNatTransitionConfiguration", "Enable-NetDnsTransitionConfiguration", "Enable-NetIPHttpsProfile", "Enable-NetNatTransitionConfiguration", "Get-Net6to4Configuration", "Get-NetDnsTransitionConfiguration", "Get-NetDnsTransitionMonitoring", "Get-NetIPHttpsConfiguration", "Get-NetIPHttpsState", "Get-NetIsatapConfiguration", "Get-NetNatTransitionConfiguration", "Get-NetNatTransitionMonitoring", "Get-NetTeredoConfiguration", "Get-NetTeredoState", "New-NetIPHttpsConfiguration", "New-NetNatTransitionConfiguration", "Remove-NetIPHttpsCertBinding", "Remove-NetIPHttpsConfiguration", "Remove-NetNatTransitionConfiguration", "Rename-NetIPHttpsConfiguration", "Reset-Net6to4Configuration", "Reset-NetDnsTransitionConfiguration", "Reset-NetIPHttpsConfiguration", "Reset-NetIsatapConfiguration", "Reset-NetTeredoConfiguration", "Set-Net6to4Configuration", "Set-NetDnsTransitionConfiguration", "Set-NetIPHttpsConfiguration", "Set-NetIsatapConfiguration", "Set-NetNatTransitionConfiguration", "Set-NetTeredoConfiguration") + CmdletsToExport = @() + AliasesToExport = @() + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/PKI/pki.psd1 b/newton-cn/bin/v1.0/Modules/PKI/pki.psd1 new file mode 100644 index 0000000..6b2d4a2 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PKI/pki.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PKI/pki.types.ps1xml b/newton-cn/bin/v1.0/Modules/PKI/pki.types.ps1xml new file mode 100644 index 0000000..bf543e8 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PKI/pki.types.ps1xml @@ -0,0 +1,186 @@ + + + System.Security.Cryptography.X509Certificates.X509Certificate2 + + + + EnrollmentPolicyEndPoint + + new-object Microsoft.CertificateServices.Commands.EnrollmentEndPointProperty -argumentlist $this,$true + + + $e = $this.EnrollmentPolicyEndPoint + $e.CopyUrlAndAuthType($args[0]) + + + + EnrollmentServerEndPoint + + new-object Microsoft.CertificateServices.Commands.EnrollmentEndPointProperty -argumentlist $this,$false + + + $e = $this.EnrollmentServerEndPoint + $e.CopyUrlAndAuthType($args[0]) + + + + PolicyId + + [Microsoft.CertificateServices.Commands.PolicyIdProperty]::ReadPolicyId($this) + + + $policyId = $args[0] + [Microsoft.CertificateServices.Commands.PolicyIdProperty]::WritePolicyId($this,$policyId) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCClassResources/WindowsPackageCab/WindowsPackageCab.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCClassResources/WindowsPackageCab/WindowsPackageCab.psd1 new file mode 100644 index 0000000..05c8a5c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCClassResources/WindowsPackageCab/WindowsPackageCab.psd1 @@ -0,0 +1,33 @@ +@{ + +# Script module or binary module file associated with this manifest. +RootModule = 'WindowsPackageCab.psm1' + +DscResourcesToExport = 'WindowsPackageCab' + +# Version number of this module. +ModuleVersion = '1.0' + +# ID used to uniquely identify this module +GUID = 'fe7be92e-9fad-47f7-84f7-aa6093bf4c0e' + +# Author of this module +Author = 'Microsoft Corporation' + +# Company or vendor of this module +CompanyName = 'Microsoft Corporation' + +# Copyright statement for this module +Copyright = '(c) 2016 Microsoft. All rights reserved.' + +# Description of the functionality provided by this module +# Description = '' + +# Minimum version of the Windows PowerShell engine required by this module +PowerShellVersion = '5.0' + +# Name of the Windows PowerShell host required by this module +# PowerShellHostName = '' + +# FunctionsToExport = '*' +} \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCClassResources/WindowsPackageCab/WindowsPackageCab.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCClassResources/WindowsPackageCab/WindowsPackageCab.psm1 new file mode 100644 index 0000000..18d8d17 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCClassResources/WindowsPackageCab/WindowsPackageCab.psm1 @@ -0,0 +1,1109 @@ +# +# Windows Cab Package Provider - Microsoft 2016 +# This resource manages the packages for a live image. +# + +data LocalizedData +{ + # culture="en-US" + ConvertFrom-StringData @' +SourcePathDoesNotExist=Source does not exist: {0} +ConfigurationStarted=The configuration of WindowsPackageCab resource is starting +ConfigurationFinished=The configuration of WindowsPackageCab resource has completed +FailedToAddPackage=Failed to add package from {0} +FailedToRemovePackage=Failed to remove package {0} +SourcePathInvalid=Source path is null or empty +'@ +} + +Import-LocalizedData LocalizedData -FileName WindowsPackageCab.Strings.psd1 + +[DscResource()] +class WindowsPackageCab { + + # Property: Holds the product name of the package. + [DscProperty(Key)] + [String] $Name; + + # Property: Makes sure a package is installed/not installed on the image. + [DscProperty(Mandatory)] + [ValidateSet("Absent","Present")] + [String] $Ensure; + + # Property: Points to the location of a .cab file. + [DscProperty(Mandatory)] + [String] $SourcePath; + + # Property: Points the desired location for a log file + [DscProperty()] + [String] $LogPath; + + WindowsPackageCab() + { + Import-DscNativeDISMMethods + } + + [void] Set() + { + Write-Verbose $script:LocalizedData.ConfigurationStarted + + if ([string]::IsNullOrEmpty($this.SourcePath)) + { + Throw-TerminatingError ($script:LocalizedData.SourcePathInvalid) + } + + $SourcePathExists = Test-Path -Path $this.SourcePath + if (-not $SourcePathExists) + { + Throw-TerminatingError ($script:LocalizedData.SourcePathDoesNotExist -f $this.SourcePath) + } + + if ($this.Ensure -match 'Present') + { + Add-CabPackage -PackagePath $this.SourcePath + } + else + { + Remove-CabPackage -PackagePath $this.SourcePath + } + + Write-Verbose $script:LocalizedData.ConfigurationFinished + } + + [bool] Test() + { + $details = Get-DISMDetailedInstalledPackageInfo -PackageName $this.Name + + $isPackagePresent = Test-PackagePresence -packageInfoDetails $details + + if ($this.Ensure -match 'Present') + { + return $isPackagePresent + } + else + { + return -not $isPackagePresent + } + } + + [WindowsPackageCab] Get() + { + $details = Get-DISMDetailedInstalledPackageInfo -PackageName $this.Name + + if ($details -eq $null) + { + $this.Ensure = 'Absent' + } + else + { + $this.Ensure = 'Present' + } + + $this.SourcePath = $null + $this.LogPath = $null + + return $this + } +} + +Function Trace-Message +{ + param + ( + [string] $Message + ) + + Write-Verbose $Message + + if ($this.LogPath) + { + New-Item -Path $this.LogPath -ErrorAction SilentlyContinue + Add-Content -Path $this.LogPath -Value $message + } +} + +Function Throw-TerminatingError +{ + param + ( + [string] $Message, + [System.Management.Automation.ErrorRecord] $ErrorRecord, + [string] $ExceptionType + ) + + $exception = new-object "System.InvalidOperationException" $Message,$ErrorRecord.Exception + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception,"MachineStateIncorrect","InvalidOperation",$null + throw $errorRecord +} + +Function Test-PackagePresence +{ + Param + ( + [Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.DismDetailedPackageInfo] $packageInfoDetails + ) + + if (-not $packageInfoDetails) + { + return $false; + } + + if ($packageInfoDetails.PackageState -eq [Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.DismPackageFeatureState]::DismStateInstalled -or + $packageInfoDetails.PackageState -eq [Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.DismPackageFeatureState]::DismStateInstallPending) + { + return $true; + } + + return $false; +} + +Function Get-DISMDetailedInstalledPackageInfo +{ + Param + ( + [string] $PackageName + ) + + try + { + $detailedPacketInfo = [Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.Dism]::new().GetDetailedPackageInfo($PackageName, $this.LogPath) + } + catch + { + $detailedPacketInfo = $null + } + + return $detailedPacketInfo +} + +Function Get-DISMDetailedCabFileInfo +{ + Param + ( + [string] $PackagePath + ) + + return [Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.Dism]::new().GetDetailedCabFileInfo($PackagePath, $this.LogPath) +} + +Function Add-CabPackage +{ + Param + ( + [string] $PackagePath + ) + + try + { + $dismStatus = [Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.Dism]::new().AddPackage($PackagePath, $this.LogPath) + if ($dismStatus -eq [Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.DismStatus]::DismStatusRebootRequired) + { + $global:DSCMachineStatus = 1; + } + Trace-Message ("-CabPackage successful. PackagePath = $PackagePath") + } + catch [System.Exception] + { + Throw-TerminatingError ($script:LocalizedData.FailedToAddPackage -f $this.SourcePath) + } + +} + +Function Remove-CabPackage +{ + Param + ( + [string] $PackagePath + ) + + try + { + $dismStatus = [Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.Dism]::new().RemovePackage($PackagePath, $this.LogPath) + if ($dismStatus -eq [Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.DismStatus]::DismStatusRebootRequired) + { + $global:DSCMachineStatus = 1; + } + Trace-Message ("Remove-CabPackage successful. PackagePath = $PackagePath") + } + catch [System.Exception] + { + Throw-TerminatingError ($script:LocalizedData.FailedToRemovePackage -f $this.SourcePath) + } +} + +Function Import-DscNativeDISMMethods +{ + if (-not ([System.Management.Automation.PSTypeName]'Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab.Dism').Type) + { + $source = @" +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; + +#if CORECLR + using Environment = System.Management.Automation.Environment; +#else +using Environment = System.Environment; +#endif + +namespace Microsoft.PowerShell.DesiredStateConfiguration.WindowsPackageCab +{ + #region Native Handlers + + internal enum DismPackageIdentifier + { + DismPackageNone = 0, + DismPackageName = 1, + DismPackagePath = 2 + }; + + internal enum DismLogLevel + { + DismLogErrors = 0, + DismLogErrorsWarnings, + DismLogErrorsWarningsInfo + }; + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + internal class SystemTime + { + [MarshalAs(UnmanagedType.U2)] + public UInt16 wYear; + [MarshalAs(UnmanagedType.U2)] + public UInt16 wMonth; + [MarshalAs(UnmanagedType.U2)] + public UInt16 wDayOfWeek; + [MarshalAs(UnmanagedType.U2)] + public UInt16 wDay; + [MarshalAs(UnmanagedType.U2)] + public UInt16 wHour; + [MarshalAs(UnmanagedType.U2)] + public UInt16 wMinute; + [MarshalAs(UnmanagedType.U2)] + public UInt16 wSecond; + [MarshalAs(UnmanagedType.U2)] + public UInt16 wMillisecond; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + internal class DismPackage + { + [MarshalAs(UnmanagedType.LPWStr)] + internal string PackageName; + internal DismPackageFeatureState PackageState; + internal DismReleaseType ReleaseType; + internal SystemTime InstalledOn; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + internal class DismPackageDetails + { + [MarshalAs(UnmanagedType.LPWStr)] + public string PackageName; + public DismPackageFeatureState PackageState; + public DismReleaseType ReleaseType; + public SystemTime InstalledOn; + public bool Applicable; + [MarshalAs(UnmanagedType.LPWStr)] + public string Copyright; + [MarshalAs(UnmanagedType.LPWStr)] + public string Company; + public SystemTime CreationTime; + [MarshalAs(UnmanagedType.LPWStr)] + public string DisplayName; + [MarshalAs(UnmanagedType.LPWStr)] + public string Description; + [MarshalAs(UnmanagedType.LPWStr)] + public string InstallClient; + [MarshalAs(UnmanagedType.LPWStr)] + public string InstallPackageName; + public SystemTime LastUpdateTime; + [MarshalAs(UnmanagedType.LPWStr)] + public string ProductName; + [MarshalAs(UnmanagedType.LPWStr)] + public string ProductVersion; + public DismRestartType RestartRequired; + public DismFullyOfflineInstallable FullyOffline; + [MarshalAs(UnmanagedType.LPWStr)] + public string SupportInformation; + public IntPtr CustomPropertyBuffer; + [MarshalAs(UnmanagedType.U4)] + public UInt32 CustomPropertyCount; + public IntPtr FeatureBuffer; + [MarshalAs(UnmanagedType.U4)] + public UInt32 FeatureCount; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + internal class DismPackageCustomProperty + { + [MarshalAs(UnmanagedType.LPWStr)] + public string Name; + [MarshalAs(UnmanagedType.LPWStr)] + public string Value; + [MarshalAs(UnmanagedType.LPWStr)] + public string Path; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public class DismPackageFeature + { + [MarshalAs(UnmanagedType.LPWStr)] + public string FeatureName; + public DismPackageFeatureState State; + } + + internal class DismNativeMethods + { + internal static string DismOnlineImage = "DISM_{53BFAE52-B167-4E2F-A258-0A37B57FF845}"; + + [DllImport("DismApi.dll")] + public static extern int DismCloseSession(uint session); + + [DllImport("DismApi.dll")] + public static extern int DismOpenSession( + [MarshalAs(UnmanagedType.LPWStr)] string imagePath, + [MarshalAs(UnmanagedType.LPWStr)] string windowsDirectory, + [MarshalAs(UnmanagedType.LPWStr)] string systemDrive, + out uint session + ); + + [DllImport("DismApi.dll")] + public static extern int DismInitialize( + DismLogLevel logLevel, + [MarshalAs(UnmanagedType.LPWStr)] string logFilePath, + [MarshalAs(UnmanagedType.LPWStr)] string scratchDirectory + ); + + [DllImport("DismApi.dll")] + public static extern int DismShutdown(); + + [DllImport("DismApi.dll")] + public static extern int DismDelete(IntPtr dismStructure); + + [DllImport("DismApi.dll")] + public static extern int DismGetPackages( + uint session, + out IntPtr packageBufPtr, + out uint packageCount + ); + + [DllImport("DismApi.dll")] + public static extern int DismGetPackageInfo( + uint session, + [MarshalAs(UnmanagedType.LPWStr)] string identifier, + DismPackageIdentifier packageIdentifier, + out IntPtr packageInfo + ); + + [DllImport("DismApi.dll")] + public static extern int DismAddPackage( + uint session, + [MarshalAs(UnmanagedType.LPWStr)] string packagePath, + [MarshalAs(UnmanagedType.Bool)] bool ignoreCheck, + [MarshalAs(UnmanagedType.Bool)] bool preventPending, + IntPtr cancelEvent, + DismProgressCallback progress, + IntPtr userData + ); + + [DllImport("DismApi.dll")] + public static extern int DismRemovePackage( + uint session, + [MarshalAs(UnmanagedType.LPWStr)] string identifier, + DismPackageIdentifier packageIdentifier, + IntPtr cancelEvent, + DismProgressCallback progress, + IntPtr userData + ); + + public delegate void DismProgressCallback( + uint current, + uint total, + IntPtr userData + ); + + internal static DateTime GetDateTimeFromSystemTime(SystemTime time) + { + try + { + return new DateTime(time.wYear, time.wMonth, time.wDay, + time.wHour, time.wMinute, time.wSecond, DateTimeKind.Local); + } + catch (ArgumentOutOfRangeException) + { + return new DateTime(0, DateTimeKind.Local); + } + } + } + + #endregion Native Handlers + + #region Helper Classes + + internal class DismHandler : IDisposable + { + #region Private Members + + private readonly string _logPath; + private uint _sessionToken; + private readonly DismLogLevel _logLevel; + private bool _sessionOpened; + + #endregion Private Members + + #region Constructors + internal DismHandler(string logPath, DismLogLevel logLevel) + { + _logPath = logPath; + _logLevel = logLevel; + } + + internal DismHandler() : this(string.Format("{0}\\dism.log", Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System))), DismLogLevel.DismLogErrorsWarnings) { } + + internal DismHandler(string logPath) + { + if (!String.IsNullOrEmpty(logPath)) + _logPath = logPath; + else + _logPath = string.Format("{0}\\dism.log", Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System))); + + _logLevel = DismLogLevel.DismLogErrorsWarnings; + } + #endregion Constructors + + #region Private Methods + private const int CbsInvalidPackage = unchecked((int)0x800f0805); + private const int FileNotFound = unchecked((int)0x80070002); + private const int CorruptedFile = unchecked((int)0x80070570); + private const int InvalidArgument = unchecked((int)0x80070057); + private const int SessionReloadRequired = 0x1; + private const int MachineRebootRequired = 0xbc2; + + private static void ValidateResult(int hr) + { + if (hr == 0) return; + if (IsSpecialErrorCode(hr)) return; + + switch (hr) + { + case CbsInvalidPackage: // 0x800f0805 + { + // 0x800f0805 -2146498555 : CBS_E_INVALID_PACKAGE the update package was not a valid CSI update + // when package is queried by name and is not installed + throw new DismInvalidPackageException(string.Format("Dism error code = {0}", hr)); + } + case FileNotFound: // 0x80070002 + { + // 0x80070002 : -2147024894 E_FILE_NOT_FOUND The system cannot find the file specified. + // when package is queried by path and the file does not exist + throw new FileNotFoundException(); + } + case CorruptedFile: // 0x80070570 + { + // 0x80070570 : 1392 ERROR_FILE_CORRUPT The file or directory is corrupted and unreadable + // when package file iscorrupted and unreadable + throw new DismInvalidPackageException(string.Format("Dism error code = {0}", hr)); + } + case InvalidArgument: // 0x80070057 + { + // 0x80070057 -2147024809 : E_INVALIDARG One or more arguments are invalid + // when package is queried by name and is not installed + throw new DismInvalidPackageException(string.Format("Dism error code = {0}", hr)); + } + default: + { + throw new DismException(string.Format("Dism error code = {0}", hr)); + } + } + } + + /// + /// Special Error codes are not failures. They are positive values and often indicate an expected followup operation. + /// + /// + /// + private static bool IsSpecialErrorCode(int errorCode) + { + switch (errorCode) + { + case SessionReloadRequired: + { + return true; + } + case MachineRebootRequired: + { + return true; + } + } + + return false; + } + + private static DismStatus GetStatusFromErrorCode(int errorCode) + { + switch (errorCode) + { + case SessionReloadRequired: + { + return DismStatus.DismStatusSuccess; + } + case MachineRebootRequired: + { + return DismStatus.DismStatusRebootRequired; + } + } + + return DismStatus.DismStatusSuccess; + } + + private void OpenSession() + { + if (_sessionOpened) return; + + var hr = DismNativeMethods.DismInitialize(_logLevel, _logPath, null); + ValidateResult(hr); + + hr = DismNativeMethods.DismOpenSession(DismNativeMethods.DismOnlineImage, null, null, out _sessionToken); + ValidateResult(hr); + + _sessionOpened = true; + } + + private void CloseSession() + { + if (!_sessionOpened) return; + + var hr = DismNativeMethods.DismCloseSession(_sessionToken); + ValidateResult(hr); + + DismNativeMethods.DismShutdown(); + + _sessionOpened = false; + } + + private void DeleteDismBuffer(IntPtr buffer) + { + if (buffer != IntPtr.Zero) DismNativeMethods.DismDelete(buffer); + buffer = IntPtr.Zero; + } + + #endregion Private Methods + + #region Dispose + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected void Dispose(bool isDisposing) + { + CloseSession(); + } + + #endregion Dispose + + #region Core Logic + + internal List GetInstalledPackages() + { + OpenSession(); + + List packages = new List(); + + IntPtr pPackagesBuffer; + uint numOfPackages = 0; + + var hr = DismNativeMethods.DismGetPackages(_sessionToken, out pPackagesBuffer, out numOfPackages); + ValidateResult(hr); + + try + { + var pBuffer = pPackagesBuffer; + var originalPackageSize = Marshal.SizeOf(typeof(DismPackage)); + for (uint i = 0; i < numOfPackages; i++) + { + try + { + var dismPackage = (DismPackage)Marshal.PtrToStructure(pBuffer, typeof(DismPackage)); + if (dismPackage != null) + { + packages.Add(new DismPackageInfo(dismPackage)); + } + } + finally + { + pBuffer = new IntPtr(pBuffer.ToInt64() + originalPackageSize); + } + } + } + finally + { + if (pPackagesBuffer != IntPtr.Zero) + { + DismNativeMethods.DismDelete(pPackagesBuffer); + } + } + return packages; + } + + internal DismDetailedPackageInfo GetPackageInfo(string identifier, DismPackageIdentifier packageIdentifier) + { + OpenSession(); + + IntPtr packageInfo; + + var hr = 0; + + hr = DismNativeMethods.DismGetPackageInfo(_sessionToken, identifier, packageIdentifier, out packageInfo); + ValidateResult(hr); + + try + { + var details = (DismPackageDetails)Marshal.PtrToStructure(packageInfo, typeof(DismPackageDetails)); + return extractDismDetailedPackageInfo(details); + } + finally + { + DeleteDismBuffer(packageInfo); + } + } + + internal DismDetailedPackageInfo extractDismDetailedPackageInfo(DismPackageDetails details) + { + string PackageName = details.PackageName; + DismPackageFeatureState PackageState = details.PackageState; + DismReleaseType ReleaseType = details.ReleaseType; + DateTime InstalledOn = DismNativeMethods.GetDateTimeFromSystemTime(details.InstalledOn); + bool Applicable = details.Applicable; + string Copyright = details.Copyright; + string Company = details.Company; + DateTime CreationTime = DismNativeMethods.GetDateTimeFromSystemTime(details.CreationTime); + string DisplayName = details.DisplayName; + string Description = details.Description; + string InstallClient = details.InstallClient; + string InstallPackageName = details.InstallPackageName; + DateTime LastUpdateTime = DismNativeMethods.GetDateTimeFromSystemTime(details.LastUpdateTime); + string ProductName = details.ProductName; + string ProductVersion = details.ProductVersion; + DismRestartType RestartRequired = details.RestartRequired; + DismFullyOfflineInstallable FullyOffline = details.FullyOffline; + string SupportInformation = details.SupportInformation; + + List CustomProperty = new List(); + + IntPtr currentCustomPropertyPtr = details.CustomPropertyBuffer; + for (int i = 0; i < details.CustomPropertyCount; ++i) + { + DismCustomProperty customPropertyInstance = new DismCustomProperty(currentCustomPropertyPtr); + CustomProperty.Add(customPropertyInstance); + currentCustomPropertyPtr = new IntPtr(currentCustomPropertyPtr.ToInt64() + Marshal.SizeOf(typeof(DismCustomProperty))); + } + + List Feature = new List(); + IntPtr currentFeaturePtr = details.FeatureBuffer; + for (int i = 0; i < details.FeatureCount; ++i) + { + DismFeature basicFeature = new DismFeature(currentFeaturePtr); + Feature.Add(basicFeature); + currentFeaturePtr = new IntPtr(currentFeaturePtr.ToInt64() + Marshal.SizeOf(typeof(DismPackageFeature))); + } + + return new DismDetailedPackageInfo( + PackageName, + PackageState, + ReleaseType, + InstalledOn, + Applicable, + Copyright, + Company, + CreationTime, + DisplayName, + Description, + InstallClient, + InstallPackageName, + LastUpdateTime, + ProductName, + ProductVersion, + RestartRequired, + FullyOffline, + SupportInformation, + CustomProperty, + Feature + ); + } + + internal DismStatus AddPackage(string packagePath) + { + OpenSession(); + + // Add the package + var hr = DismNativeMethods.DismAddPackage(_sessionToken, packagePath, false, false, IntPtr.Zero, null, IntPtr.Zero); + ValidateResult(hr); + return GetStatusFromErrorCode(hr); + } + + internal DismStatus RemoveInstalledPackage(string packagePath) + { + OpenSession(); + + // Remove the package + var hr = DismNativeMethods.DismRemovePackage(_sessionToken, packagePath, DismPackageIdentifier.DismPackagePath, IntPtr.Zero, null, IntPtr.Zero); + ValidateResult(hr); + return GetStatusFromErrorCode(hr); + } + + #endregion Core Logic + } + + #endregion Helper Classes + + #region Core Logic + + public class DismException : Exception + { + public DismException(string message) : base(message) + { + } + } + + public class DismInvalidPackageException : Exception + { + public DismInvalidPackageException(string message) + { + } + } + + public class DismSessionException : Exception + { + public DismSessionException(string message) + { + } + } + + /// + /// Core Dism class is used directly by the resource and provides a managed interface + /// + public class Dism + { + /// + /// Get a list of installed packages + /// + /// list containining installed packages + public List GetInstalledPackages(string logPath = null) + { + using (var dismHandler = new DismHandler(logPath)) + { + return dismHandler.GetInstalledPackages(); + } + } + + /// + /// Get detailed package info based on unique package name + /// + /// + /// + public DismDetailedPackageInfo GetDetailedPackageInfo(string packageName, string logPath = null) + { + using (var dismHandler = new DismHandler(logPath)) + { + return dismHandler.GetPackageInfo(packageName, DismPackageIdentifier.DismPackageName); + } + } + + /// + /// Get detailed package info based on path to a .cab file + /// + public DismDetailedPackageInfo GetDetailedCabFileInfo(string packagePath, string logPath = null) + { + using (var dismHandler = new DismHandler(logPath)) + { + return dismHandler.GetPackageInfo(packagePath, DismPackageIdentifier.DismPackagePath); + } + } + + /// + /// Install windows package from .cab file + /// + /// + /// + public DismStatus AddPackage(string packagePath, string logPath = null) + { + using (var dismHandler = new DismHandler(logPath)) + { + return dismHandler.AddPackage(packagePath); + } + } + + /// + /// Remove the installed windows package pointed to by the .cab file + /// + /// + /// + public DismStatus RemovePackage(string packagePath, string logPath = null) + { + using (var dismHandler = new DismHandler(logPath)) + { + return dismHandler.RemoveInstalledPackage(packagePath); + } + } + + private static readonly object SyncObject = new object(); + private static Dism _instance; + public static Dism Instance + { + get + { + if (_instance == null) + { + lock (SyncObject) + { + if (_instance == null) + { + _instance = new Dism(); + } + } + } + + return _instance; + } + } + } + + public class DismDetailedPackageInfo + { + public string PackageName; + public DismPackageFeatureState PackageState; + public DismReleaseType ReleaseType; + public DateTime InstalledOn; + public bool Applicable; + public string Copyright; + public string Company; + public DateTime CreationTime; + public string DisplayName; + public string Description; + public string InstallClient; + public string InstallPackageName; + public DateTime LastUpdateTime; + public string ProductName; + public string ProductVersion; + public DismRestartType RestartRequired; + public DismFullyOfflineInstallable FullyOffline; + public string SupportInformation; + public List CustomProperty; + public List Feature; + + internal DismDetailedPackageInfo( + string aPackageName, + DismPackageFeatureState aPackageState, + DismReleaseType aReleaseType, + DateTime aInstalledOn, + bool aApplicable, + string aCopyright, + string aCompany, + DateTime aCreationTime, + string aDisplayName, + string aDescription, + string aInstallClient, + string aInstallPackageName, + DateTime aLastUpdateTime, + string aProductName, + string aProductVersion, + DismRestartType aRestartRequired, + DismFullyOfflineInstallable aFullyOffline, + string aSupportInformation, + List aCustomProperty, + List aFeature + ) + { + PackageName = aPackageName; + PackageState = aPackageState; + ReleaseType = aReleaseType; + InstalledOn = aInstalledOn; + Applicable = aApplicable; + Copyright = aCopyright; + Company = aCompany; + CreationTime = aCreationTime; + DisplayName = aDisplayName; + Description = aDescription; + InstallClient = aInstallClient; + InstallPackageName = aInstallPackageName; + LastUpdateTime = aLastUpdateTime; + ProductName = aProductName; + ProductVersion = aProductVersion; + RestartRequired = aRestartRequired; + FullyOffline = aFullyOffline; + SupportInformation = aSupportInformation; + CustomProperty = aCustomProperty; + Feature = aFeature; + } + } + + public class DismCustomProperty + { + public string Name; + public string Value; + public string Path; + + public DismCustomProperty( + string Name, + string Value, + string Path + ) + { + this.Name = Name; + this.Value = Value; + this.Path = Path; + } + + public DismCustomProperty(IntPtr DismPackageCustomPropertyPtr) + { + DismPackageCustomProperty customProperty = (DismPackageCustomProperty)Marshal.PtrToStructure(DismPackageCustomPropertyPtr, typeof(DismPackageCustomProperty)); + + Name = customProperty.Name; + Value = customProperty.Value; + Path = customProperty.Path; + } + } + + public class DismFeature + { + public string FeatureName; + public DismFeatureState FeatureState; + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + public DismFeature(IntPtr FeatureBuf) + { + DismPackageFeature Feature = (DismPackageFeature)Marshal.PtrToStructure(FeatureBuf, typeof(DismPackageFeature)); + + SetFeatureState(Feature.State); + FeatureName = Feature.FeatureName; + } + + public void SetFeatureState(DismPackageFeatureState state) + { + switch (state) + { + case DismPackageFeatureState.DismStateNotPresent: + case DismPackageFeatureState.DismStateStaged: + FeatureState = DismFeatureState.Disabled; + break; + case DismPackageFeatureState.DismStateUninstallPending: + FeatureState = DismFeatureState.DisablePending; + break; + case DismPackageFeatureState.DismStateResolved: + FeatureState = DismFeatureState.DisabledWithPayloadRemoved; + break; + case DismPackageFeatureState.DismStateInstalled: + FeatureState = DismFeatureState.Enabled; + break; + case DismPackageFeatureState.DismStateInstallPending: + FeatureState = DismFeatureState.EnablePending; + break; + case DismPackageFeatureState.DismStateSuperseded: + FeatureState = DismFeatureState.Superseded; + break; + case DismPackageFeatureState.DismStatePartiallyInstalled: + FeatureState = DismFeatureState.PartiallyInstalled; + break; + default: + FeatureState = DismFeatureState.Disabled; + break; + } + } + } + + public enum DismPackageFeatureState + { + DismStateNotPresent = 0, + DismStateUninstallPending, + DismStateStaged, + DismStateResolved, + DismStateRemoved = DismStateResolved, + DismStateInstalled, + DismStateInstallPending, + DismStateSuperseded, + DismStatePartiallyInstalled + }; + + public enum DismFeatureState + { + Disabled = 0, + DisablePending, + Enabled, + EnablePending, + Superseded, + PartiallyInstalled, + DisabledWithPayloadRemoved + } + + public enum DismReleaseType + { + DismReleaseTypeCriticalUpdate = 0, + DismReleaseTypeDriver, + DismReleaseTypeFeaturePack, + DismReleaseTypeHotfix, + DismReleaseTypeSecurityUpdate, + DismReleaseTypeSoftwareUpdate, + DismReleaseTypeUpdate, + DismReleaseTypeUpdateRollup, + DismReleaseTypeLanguagePack, + DismReleaseTypeFoundation, + DismReleaseTypeServicePack, + DismReleaseTypeProduct, + DismReleaseTypeLocalPack, + DismReleaseTypeOther + }; + + public class DismPackageInfo + { + public string Name; + public DismPackageFeatureState PackageState; + public DismReleaseType ReleaseType; + public DateTime InstalledOn; + + internal DismPackageInfo(DismPackage package) + { + Name = package.PackageName; + PackageState = package.PackageState; + ReleaseType = package.ReleaseType; + InstalledOn = DismNativeMethods.GetDateTimeFromSystemTime(package.InstalledOn); + } + } + + public enum DismRestartType + { + DismRestartNo = 0, + DismRestartPossible = 1, + DismRestartRequired = 2 + } + + public enum DismFullyOfflineInstallable + { + DismFullyOfflineInstallable = 0, + DismFullyOfflineNotInstallable = 1, + DismFullyOfflineInstallableUndetermined = 2 + } + + public enum DismStatus + { + DismStatusSuccess = 0, + DismStatusRebootRequired = 1, + DismStatusFailed = 2 + }; + + #endregion Core logic + +} + + +"@ + + Add-Type -TypeDefinition $source + } +} + +Export-ModuleMember -Function '' \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCClassResources/WindowsPackageCab/ko-KR/WindowsPackageCab.Strings.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCClassResources/WindowsPackageCab/ko-KR/WindowsPackageCab.Strings.psd1 new file mode 100644 index 0000000..79e605b Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCClassResources/WindowsPackageCab/ko-KR/WindowsPackageCab.Strings.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/CompositeResourceHelper.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/CompositeResourceHelper.psm1 new file mode 100644 index 0000000..3cb4906 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/CompositeResourceHelper.psm1 @@ -0,0 +1,147 @@ +########################################################################### +# Common code for built-in Composite Resources +########################################################################### + +Set-StrictMode -version Latest + +# +# Builds a string with all common parameters shared across all +# resource nodes. +# +function BuildResourceCommonParameters +{ + [CmdletBinding()] + param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + $KeyParamName, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [System.Array] + $OptionalParams, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [System.Collections.Hashtable] + $PSBoundParams) + + [System.Text.StringBuilder] $pb = new-object System.Text.StringBuilder + + #build optional parameters for invoking the inbuilt resource + foreach($paramName in $($PSBoundParams.keys)) + { + #If the param name is the 'Key' then continue + if ($paramName -eq $KeyParamName) + { + continue + } + if ($paramName -in $OptionalParams) + { + $value = $PSBoundParams[$paramName] + if ($value -eq $null) + { + continue + } + + if ($value -is [System.String]) + { + $pb.AppendFormat('{0} = "{1}"', $paramName, $value) | Out-Null + $pb.AppendLine() | Out-Null + } + else + { + $pb.Append($paramName + ' = $' + $paramName) | Out-Null + $pb.AppendLine() | Out-Null + } + } + } + + return $pb.ToString() +} + +# +# Builds a string with all resource nodes based on the key parameter along with +# the other optional parameters provided in the composite configuration. +# For e.g. While installing multiple features using WindowsFeature resource, +# output of this method would be: +# +# $KeyParam = @("Telnet-client","web-server") +# WindowsFeature Resource0 +# { +# Name = "Telnet-client" #Name provided in the composite configuration +# Ensure = "Present" +# IncludeAllSubFeature = True +# } +# +# WindowsFeature Resource1 +# { +# Name = "Web-Server" #Name provided in the composite configuration +# Ensure = "Present" +# IncludeAllSubFeature = True +# } +# +# +function BuildResourceString +{ + [CmdletBinding()] + param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string[]] + $KeyParam, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + $KeyParamName, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + $CommonParams, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + $ResourceName, + + [ValidateNotNullOrEmpty()] + [string] + $ModuleName="PSDesiredStateConfiguration", + + [ValidateNotNullOrEmpty()] + [string] + $DefaultParams + ) + + [System.Text.StringBuilder] $sb = new-object System.Text.StringBuilder + + $sb.AppendFormat('Import-DscResource -Name {0} -ModuleName {1}', $ResourceName, $ModuleName) | Out-Null + $sb.AppendLine() | Out-Null + + # add the resource nodes and their common parameters + [int] $count = 0 + foreach ($key in $KeyParam) + { + $sb.AppendFormat('{0} Resource{1}', $ResourceName, $count) | Out-Null + $sb.AppendLine() | Out-Null + $sb.AppendLine('{') | Out-Null + $sb.AppendFormat($KeyParamName + ' = "{0}"', $key) | Out-Null + $sb.AppendLine() | Out-Null + $sb.AppendLine($CommonParams) | Out-Null + + if($DefaultParams) + { + $sb.AppendLine($DefaultParams) | Out-Null + } + + $sb.AppendLine('}') | Out-Null + $count++ + } + + return $sb.ToString() +} + +Export-ModuleMember -Function BuildResourceCommonParameters, BuildResourceString diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/DSCResourceHelper.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/DSCResourceHelper.psm1 new file mode 100644 index 0000000..04b5f01 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/DSCResourceHelper.psm1 @@ -0,0 +1,14 @@ +########################################################################### +# Common code for built-in DSC Resources +########################################################################### + +function IsNanoServer +{ + if($PSVersionTable.PSEdition -ieq 'Core') + { + return $true + } + return $false +} + +Export-ModuleMember -Function IsNanoServer diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/GroupSet/GroupSet.Schema.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/GroupSet/GroupSet.Schema.psm1 new file mode 100644 index 0000000..f716431 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/GroupSet/GroupSet.Schema.psm1 @@ -0,0 +1,40 @@ +Import-Module "$PSScriptRoot\..\CompositeResourceHelper.psm1" + +Configuration GroupSet +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [System.String[]] + $GroupName, + + [ValidateSet('Present','Absent')] + [System.String] + $Ensure, + + [System.String[]] + $MembersToInclude, + + [System.String[]] + $MembersToExclude, + + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $Credential + ) + + $psboundParams = $PSBoundParameters + $optionalParameters = @("Ensure","MembersToInclude","MembersToExclude","Credential") + $keyParamName = "GroupName" + $resourceName = "Group" + + #build common parameters for all Group resource nodes + [string] $commonParameters = BuildResourceCommonParameters -KeyParamName $keyParamName -OptionalParams $optionalParameters -PSBoundParams $psboundParams + + #build Group resource string + [string] $resourceString = BuildResourceString -KeyParam $GroupName -KeyParamName $keyParamName -CommonParams $commonParameters -ResourceName $resourceName + + $configScript = [scriptblock]::Create($resourceString) + . $configScript +} \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/GroupSet/GroupSet.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/GroupSet/GroupSet.psd1 new file mode 100644 index 0000000..768299e Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/GroupSet/GroupSet.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/MSFT_ArchiveResource.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/MSFT_ArchiveResource.psm1 new file mode 100644 index 0000000..91bb46c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/MSFT_ArchiveResource.psm1 @@ -0,0 +1,983 @@ +data LocalizedData +{ + # culture="en-US" + # TODO: Support WhatIf + ConvertFrom-StringData @' +InvalidChecksumArgsMessage=Specifying a Checksum without requesting content validation (the Validate parameter) is not meaningful +InvalidDestinationDirectory=The specified destination directory {0} does not exist or is not a directory +InvalidSourcePath=The specified source file {0} does not exist or is not a file +InvalidNetSourcePath=The specified source file {0} is not a valid net source path +ErrorOpeningExistingFile=An error occurred while opening the file {0} on disk. Please examine the inner exception for details +ErrorOpeningArchiveFile=An error occurred while opening the archive file {0}. Please examine the inner exception for details +ItemExistsButIsWrongType=The named item ({0}) exists but is not the expected type, and Force was not specified +ItemExistsButIsIncorrect=The destination file {0} has been determined not to match the source, but Force has not been specified. Cannot continue +ErrorCopyingToOutstream=An error was encountered while copying the archived file to {0} +PackageUninstalled=The archive at {0} was removed from destination {1} +PackageInstalled=The archive at {0} was unpacked to destination {1} +ConfigurationStarted=The configuration of MSFT_ArchiveResource is starting +ConfigurationFinished=The configuration of MSFT_ArchiveResource has completed +MakeDirectory=Make directory {0} +RemoveFileAndRecreateAsDirectory=Remove existing file {0} and replace it with a directory of the same name +RemoveFile=Remove file {0} +RemoveDirectory=Remove directory {0} +UnzipFile=Unzip archived file to {0} +DestMissingOrIncorrectTypeReason=The destination file {0} was missing or was not a file +DestHasIncorrectHashvalue=The destination file {0} exists but its checksum did not match the origin file +DestShouldNotBeThereReason=The destination file {0} exists but should not +UsingKeyToRetrieveHashValue = Using {0} to retrieve hash value +Nocachevaluefound = No cache value found +Cachevaluefoundreturning = Cache value found, returning {0} +CacheCorrupt = Cache found, but failed to loaded. Ignoring Cache. +Usingtmpkeytosavehashvalue = Using {0} {1} to save hash value +AbouttocachevalueInputObject = About to cache value {0} +InUpdateCache = In Update-Cache +AddingentryFullNameasacacheentry = Adding {0} as a cache entry +UpdatingCacheObject = Updating CacheObject +Placednewcacheentry = Placed new cache entry +NormalizeChecksumreturningChecksum = Normalize-Checksum returning {0} +PathPathisalreadyaccessiableNomountneeded. = Path {0} is already accessible. No mount needed. +Pathpathisnotavalidatenetpath = Path {0} is not a validate net path. +createpsdrivewithPathpath = create psdrive with Path {0}... +CannotaccessPathPathwithgivenCredential = Cannot access Path {0} with given Credential +Abouttovalidatestandardarguments = About to validate standard arguments +Goingforcacheentries = Going for cache entries +Thecachewasuptodateusingcachetosatisfyrequests = The cache was up to date, using cache to satisfy requests +Abouttoopenthezipfile = About to open the zip file +Cacheupdatedwithentries = Cache updated with {0} entries +Processing = Processing {0} +InTestTargetResourcedestexistsnotusingchecksumscontinuing = In Test-TargetResource: {0} exists, not using checksums, continuing +Notperformingchecksumthefileondiskhasthesamewritetimeasthelasttimeweverifieditscontents = Not performing checksum, the file on disk has the same write time as the last time we verified its contents +destexistsandthehashmatcheseven = {0} exists and the hash matches even though the LastModifiedTime did not. Updating cache +InTestTargetResourcedestexistsandtheselectedtimestampChecksummatched = In Test-TargetResource: {0} exists and the selected timestamp {1} matched +RemovePSDriveonRootpsdriveRoot = Remove PSDrive on Root {0} +RemovingDir = Removing {0} +Hashesofexistingandzipfilesmatchremoving = Hashes of existing and zip files match, removing +HashdidnotmatchfilehasbeenmodifiedsinceitwasextractedLeaving = Hash did not match, file has been modified since it was extracted. Leaving +InSetTargetResourceexistsselectedtimestampmatched = In Set-TargetResource: {0} exists and the selected timestamp {1} matched, removing +InSetTargetResourceexistsdtheselectedtimestampnotmatchg = In Set-TargetResource: {0} exists and the selected timestamp {1} did not match, leaving +existingappearstobeanemptydirectoryRemovingit = {0} appears to be an empty directory. Removing it +LastWriteTimemtcheswhatwehaverecordnotreexaminingchecksum = LastWriteTime of {0} matches what we have on record, not re-examining {1} +FoundfatdestwheregoingtoplaceoneandhashmatchedContinuing = Found a file at {0} where we were going to place one and hash matched. Continuing +FoundfileatdestwhereweweregoingtoplaceoneandhashdidntmatchItwillbeoverwritten = Found a file at $dest where we were going to place one and hash did not match. It will be overwritten +FoundfileatdestwhereweweregoingtoplaceoneanddoesnotmatchthesourcebutForcewasnotspecifiedErroring = Found a file at {0} where we were going to place one and does not match the source, but Force was not specified. Erroring +InSetTargetResourcedestexistsandtheselectedtimestamp$ChecksumdidnotmatchForcewasspecifiedwewilloverwrite = "In Set-TargetResource: {0} exists and the selected timestamp {1} did not match. Force was specified, we will overwrite +FoundafileatdestandtimestampChecksumdoesnotmatchthesourcebutForcewasnotspecifiedErroring = Found a file at {0} and timestamp {1} does not match the source, but Force was not specified. Erroring +FoundadirectoryatdestwhereafileshouldbeRemoving = Found a directory at {0} where a file should be. Removing +FounddirectoryatdestwhereafileshouldbeandForcewasnotspecifiedErroring = Found a directory at {0} where a file should be and Force was not specified. Erroring. +Writingtofiledest = Writing to file {0} +RemovePSDriveonRootdriveRoot = Remove PSDrive on Root {0} +Updatingcache = Updating cache +FolderDirdoesnotexist = Folder {0} does not exist +Examiningdirectorytoseeifitshouldberemoved = Examining {0} to see if it should be removed +InSetTargetResourcedestexistsandtheselectedtimestampChecksummatchedwillleaveit = In Set-TargetResource: {0} exists and the selected timestamp {1} matched, will leave it +'@ +} + +Import-LocalizedData LocalizedData -filename ArchiveProvider.psd1 + +Import-Module "$PSScriptRoot\..\RunAsHelper.psm1" + +$Debug = $false +Function Trace-Message +{ + param([string] $Message) + + if($Debug) + { + Write-Verbose $Message + } +} + +$CacheLocation = "$env:systemroot\system32\Configuration\BuiltinProvCache\MSFT_ArchiveResource" + +Function DSCHashNameToPSHashName +{ + param( + [string] $Algorithm + ) + + $dscToPsName= @{ + # Since in-box powershell Get-FileHash cmdlet takes algorithm without hypen, we silently change the names + "sha-1" = "SHA1" + "sha-256" = "SHA256" + "sha-512" = "SHA512" + } + + $psName = $dscToPsName[$Algorithm] + + $psName +} + + +Function Get-CacheEntry +{ + param( + [string]$path, + [string]$destination + ) + + $key = ($path + $destination).GetHashCode() + Trace-Message ($LocalizedData.UsingKeyToRetrieveHashValue -f $Key) + $path = Join-Path $CacheLocation $key + if(-not (Test-Path $path)) + { + Trace-Message ($LocalizedData.Nocachevaluefound) + return @{} + } + else + { + # ErroAction seems to have no affect on this condition, (see: https://microsoft.visualstudio.com/web/wi.aspx?pcguid=cb55739e-4afe-46a3-970f-1b49d8ee7564&id=1185735) + # using a try/catch to work around the issue. + try + { + $tmp = Import-CliXml $path + Trace-Message ($LocalizedData.Cachevaluefoundreturning -f $tmp) + return $tmp + } + catch [System.Xml.XmlException] + { + Trace-Message ($LocalizedData.CacheCorrupt) + return @{} + } + } +} + +Function Set-CacheEntry +{ + param( + [object] $InputObject, + [string] $path, + [string] $destination + ) + $key = ($path + $destination).GetHashCode() + Trace-Message ($LocalizedData.Usingtmpkeytosavehashvalue -f $tmp, $key) + $path = Join-Path $CacheLocation $key + Trace-Message ($LocalizedData.AbouttocachevalueInputObject -f $InputObject) + if(-not (Test-Path $CacheLocation)) + { + mkdir $CacheLocation | Out-Null + } + + Export-CliXml -Path $path -InputObject $InputObject +} + +Function Throw-InvalidArgumentException +{ + param( + [string] $Message, + [string] $ParamName + ) + + $exception = new-object System.ArgumentException $Message,$ParamName + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception,$ParamName,"InvalidArgument",$null + throw $errorRecord +} + +Function Throw-TerminatingError +{ + param( + [string] $Message, + [System.Management.Automation.ErrorRecord] $ErrorRecord, + [string] $ExceptionType + ) + + $exception = new-object "System.InvalidOperationException" $Message,$ErrorRecord.Exception + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception,"MachineStateIncorrect","InvalidOperation",$null + throw $errorRecord +} + +Function Assert-ValidStandardArgs +{ + param( + [string] $Path, + [string] $Destination, + [boolean] $Validate, + [string] $Checksum + ) + + #mkdir and Test-Path can each fail with a useful error message + #We want to stop our execution if that happens + $ErrorActionPreference = "Stop" + + if(-not (Test-Path -PathType Leaf $Path)) + { + Throw-InvalidArgumentException ($LocalizedData.InvalidSourcePath -f $Path) "Path" + } + + $item = Get-Item -EA Ignore $Destination + if($item -and $item.GetType() -eq [System.IO.FileInfo]) + { + Throw-InvalidArgumentException ($LocalizedData.InvalidDestinationDirectory -f $Destination) "Destination" + } + + if($Checksum -and -not $Validate) + { + Throw-InvalidArgumentException ($LocalizedData.InvalidChecksumArgsMessage -f $Checksum) "Checksum" + } +} + +Function Compare-FileToEntry +{ + param( + [string] $FileName, + [object] $Entry, + [string] $Algorithm + ) + + $existingStream = $null + $hash1 = $null + try + { + $existingStream = New-Object System.IO.FileStream $FileName, "Open" + $psAlgorithm = DSCHashNameToPSHashName -Algorithm $Algorithm + $hash1 = Get-FileHash -InputStream $existingStream -Algorithm $psAlgorithm + } + catch + { + Throw-TerminatingError ($LocalizedData.ErrorOpeningExistingFile -f $FileName) $_ + } + finally + { + if($existingStream -ne $null) + { + $existingStream.Dispose() + } + } + + $hash2 = $Entry.Checksum + return ($hash1.Algorithm -eq $hash2.Algorithm) -and ($hash1.Hash -eq $hash2.Hash) +} + +Function Get-RelevantChecksumTimestamp +{ + param( + [System.IO.FileSystemInfo] $FileSystemObject, + [String] $Checksum + ) + + if($Checksum.Equals("createddate")) + { + return $FileSystemObject.CreationTime + } + else #$Checksum.Equals("modifieddate") + { + return $FileSystemObject.LastWriteTime + } +} + +Function Update-Cache +{ + param( + [Hashtable] $CacheObject, + [System.IO.Compression.ZipArchiveEntry[]] $Entries, + [string] $Checksum, + [string] $SourceLastWriteTime + ) + + Trace-Message ($LocalizedData.InUpdateCache) + $cacheEntries = new-object System.Collections.ArrayList + foreach($entry in $Entries) + { + $hash = $null + if($Checksum.StartsWith("sha")) + { + $stream = $null + try + { + $stream = $entry.Open() + $psAlgorithm = DSCHashNameToPSHashName -Algorithm $Checksum + $hash = Get-FileHash -InputStream $stream -Algorithm $psAlgorithm + } + finally + { + if($stream) + { + $stream.Dispose() + } + } + } + + Trace-Message ($LoalizedData.AddingentryFullNameasacacheentry -f $entry.FullName) + $cacheEntries.Add(@{ + FullName = $entry.FullName + LastWriteTime = $entry.LastWriteTime + Checksum = $hash + }) | Out-Null + } + + Trace-Message ($LocalizedData.UpdatingCacheObject) + $CacheObject["SourceLastWriteTime"] = $SourceLastWriteTime + $CacheObject["Entries"] = (@() + $cacheEntries) + Set-CacheEntry -InputObject $CacheObject -path $Path -destination $Destination + Trace-Message ($LocalizedData.Placednewcacheentry) +} + +Function Normalize-Checksum +{ + param( + [boolean] $Validate, + [string] $Checksum + ) + + if($Validate) + { + if(-not $Checksum) + { + $Checksum = "SHA-256" + } + + $Checksum = $Checksum.ToLower() + } + + Trace-Message ($LocalizedData.NormalizeChecksumreturningChecksum -f $Checksum) + return $Checksum +} + +# create a psdrive to a net share with a given credential. +function Mount-NetworkPath +{ + param ( [string] $path, [pscredential] $Credential) + + # mount the drive only if not accessible + if (Test-Path $path -ErrorAction Ignore) + { + Trace-Message ($LocalizedData.PathPathisalreadyaccessiableNomountneeded -f $Path) + $psdrive = $null + } + else + { + if (-not $path.EndsWith("\")) + { + $index = $Path.LastIndexOf("\"); + if (-1 -eq $index) + { + Trace-Message ($LocalizedData.Pathpathisnotavalidatenetpath -f $path) + Throw-TerminatingError ($LocalizedData.InvalidNetSourcePath -f $Path) + } + else + { + $path = $path.Substring(0, $index) + } + } + + $psdriveArgs = @{ Name=([guid]::NewGuid()); PSProvider="FileSystem"; Root=$Path; Scope="Script"; Credential=$Credential } + try + { + Trace-Message ($LocalizedData.createpsdrivewithPathpath -f $path) + $psdrive = New-PSDrive @psdriveArgs + } + catch + { + Trace-Message ($LocalizedData.CannotaccessPathPathwithgivenCredential -f $Path) + Throw-TerminatingError ($LocalizedData.ErrorOpeningArchiveFile -f $Path) $_ + } + } + + return $psdrive +} + +# The Test-TargetResource cmdlet is used to test the status of item on the destination +function Test-TargetResource +{ + param + ( + [ValidateSet("Present", "Absent")] + [string] $Ensure = "Present", + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] $Path, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] $Destination, + + [boolean] $Validate = $false, + + [ValidateSet("", "SHA-1", "SHA-256", "SHA-512", "CreatedDate", "ModifiedDate")] + [string] $Checksum, + + [boolean] $Force = $false, + + [pscredential] $Credential + ) + + if ($Credential) + { + $psdrive = Mount-NetworkPath -path $Path -Credential $Credential + } + + try + { + $ErrorActionPreference = "Stop" + + Trace-Message ($LocalizedData.Abouttovalidatestandardarguments) + Assert-ValidStandardArgs $Path $Destination $Validate $Checksum + $Checksum = Normalize-Checksum $Validate $Checksum + Trace-Message ($LocalizedData.Goingforcacheentries) + $result = $true + $cacheObj = Get-CacheEntry -path $Path -destination $Destination + $sourceLastWriteTime = (Get-Item $Path).LastWriteTime + $cacheUpToDate = $cacheObj -and $cacheObj.SourceLastWriteTime -and $cacheObj.SourceLastWriteTime -eq $sourceLastWriteTime + $file = $null + try + { + $entries = $null + if($cacheUpToDate) + { + Trace-Message ($LocalizedData.Thecachewasuptodateusingcachetosatisfyrequests) + $entries = $cacheObj.Entries + } + else + { + Trace-Message ($LocalizedData.Abouttoopenthezipfile) + $entries, $null, $file = Open-ZipFile $Path + + Trace-Message ($LocalizedData.Updatingcache) + Update-Cache $cacheObj $entries $Checksum $sourceLastWriteTime + $entries = $cacheObj.Entries + Trace-Message ($LocalizedData.Cacheupdatedwithentries -f $cacheObj.Entries.Length) + } + + foreach($entry in $entries) + { + $individualResult = $true + Trace-Message ($LocalizedData.Processing -f $entry.FullName) + $dest = join-path $Destination $entry.FullName + if($dest.EndsWith('\')) #Directory + { + $dest = $dest.TrimEnd('\') + if(-not (Test-Path -PathType Container $dest)) + { + Write-Verbose ($LocalizedData.DestMissingOrIncorrectTypeReason -f $dest) + $individualResult = $result = $false + } + } + else + { + $item = Get-Item $dest -EA Ignore + if(-not $item) + { + $individualResult = $result = $false + } + elseif($item.GetType() -ne [System.IO.FileInfo]) + { + $individualResult = $result = $false + } + + if(-not $Checksum) + { + Trace-Message ($LocalizedData.InTestTargetResourcedestexistsnotusingchecksumscontinuing -f $dest) + if(-not $individualResult -and $Ensure -eq "Present") + { + Write-Verbose ($LocalizedData.DestMissingOrIncorrectTypeReason -f $dest) + } + elseif($individualResult -and $Ensure -eq "Absent") + { + Write-Verbose ($LocalizedData.DestShouldNotBeThereReason -f $dest) + } + } + else + { + #If the file is there we need to check if it could possibly fail in a different way + #Otherwise we skip all these checks - there's nothing to work with + if($individualResult) + { + $Checksum = $Checksum.ToLower() + if($Checksum.StartsWith("sha")) + { + if($item.LastWriteTime.Equals($entry.ExistingItemTimestamp)) + { + Trace-Message ($LocalizedData.Notperformingchecksumthefileondiskhasthesamewritetimeasthelasttimeweverifieditscontents) + } + else + { + if(-not (Compare-FileToEntry $dest $entry $Checksum)) + { + $individualResult = $result = $false + } + else + { + $entry.ExistingItemTimestamp = $item.LastWriteTime + Trace-Message ($LocalizedData.destexistsandthehashmatcheseven -f $dest) + } + } + } + else + { + $date = Get-RelevantChecksumTimestamp $item $Checksum + if(-not $date.Equals($entry.LastWriteTime.DateTime)) + { + $individualResult = $result = $false + } + else + { + Trace-Message ($LocalizedData.InTestTargetResourcedestexistsandtheselectedtimestampChecksummatched -f $dest, $Checksum) + } + } + } + + if(-not $individualResult -and $Ensure -eq "Present") + { + Write-Verbose ($LocalizedData.DestHasIncorrectHashvalue -f $dest) + } + elseif($individualResult -and $Ensure -eq "Absent") + { + Write-Verbose ($LocalizedData.DestShouldNotBeThereReason -f $dest) + } + } + } + } + } + finally + { + if($file) + { + $file.Dispose() + } + } + + Set-CacheEntry -InputObject $cacheObj -path $Path -destination $Destination + $result = $result -eq ("Present" -eq $Ensure) + } + finally + { + if($psdrive) + { + $ErrorActionPreference = "SilentlyContinue" + Trace-Message ($LoalizedData.RemovePSDriveonRootpsdrive -f $($psdrive.Root)) + Remove-PSDrive $psdrive -Force -ErrorAction SilentlyContinue + } + } + + return $result +} + +Function Ensure-Directory +{ + param([string] $Dir) + $item = get-item $Dir -EA SilentlyContinue + if(-not $item) + { + Trace-Message ($LocalizedData.FolderDirdoesnotexist -f $Dir) + if($PSCmdlet.ShouldProcess(($LocalizedData.MakeDirectory -f $Dir), $null, $null)) + { + mkdir $Dir | Out-Null + } + } + else + { + if($item.GetType() -ne [System.IO.DirectoryInfo]) + { + if($Force -and $PSCmdlet.ShouldProcess(($LocalizedData.RemoveFileAndRecreateAsDirectory -f $Dir), $null, $null)) + { + Trace-Message ($LocalizedData.RemovingDir -f $Dir) + rm $Dir | Out-Null + mkdir $Dir | Out-Null #Note that we don't do access time translations onto directories since we are emulating the shell's behavior + } + else + { + Throw-TerminatingError ($LocalizedData.ItemExistsButIsWrongType -f $Path) + } + } + } +} + +Function Open-ZipFile +{ + param($Path) + if (IsNanoServer) + { + add-type -assemblyname System.IO.Compression + } + else + { + add-type -assemblyname System.IO.Compression.FileSystem + } + $nameHash = @{} + try + { + $fileHandle = ([System.IO.Compression.ZipFile]::OpenRead($Path)) + $entries = $fileHandle.Entries + } + catch + { + Throw-TerminatingError ($LocalizedData.ErrorOpeningArchiveFile -f $Path) $_ + } + + $entries | %{$nameHash[$_.FullName] = $_} + return $entries, $nameHash, $fileHandle +} + +# The Set-TargetResource cmdlet is used to unpack or remove a zip file to a particular directory +function Set-TargetResource +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] $Path, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] $Destination, + + [ValidateSet("Present", "Absent")] + [string] $Ensure = "Present", + + [boolean] $Validate = $false, + + [ValidateSet("", "SHA-1", "SHA-256", "SHA-512", "CreatedDate", "ModifiedDate")] + [string] $Checksum, + + [boolean] $Force = $false, + + [pscredential] $Credential + ) + + if ($Credential) + { + $psdrive = Mount-NetworkPath -path $Path -Credential $Credential + } + + try + { + $ErrorActionPreference = "Stop" + Assert-ValidStandardArgs $Path $Destination $Validate $Checksum + $Checksum = Normalize-Checksum $Validate $Checksum + Write-Verbose $LocalizedData.ConfigurationStarted + + if(-not (Test-Path $Destination)) + { + mkdir $Destination | Out-Null + } + + $cacheObj = Get-CacheEntry -path $Path -destination $Destination + $sourceLastWriteTime = (Get-Item $Path).LastWriteTime + $cacheUpToDate = $cacheObj -and $cacheObj.SourceLastWriteTime -and $cacheObj.SourceLastWriteTime -eq $sourceLastWriteTime + $file = $null + $nameToEntry = @{} + + try + { + # once cache is updated we need to dispose the handle + # if not, when the second time $file is updated with a + # new handle, the old one not being disposed will lead + # to archive resource having a lock on the file + if(-not $cacheUpToDate) + { + $entries, $nameToEntry, $file = Open-ZipFile $Path + Update-Cache $cacheObj $entries $Checksum $sourceLastWriteTime + } + } + finally + { + if($file) + { + $file.Dispose() + $file = $null + } + + } + + try + { + + $entries = $cacheObj.Entries + if($Ensure -eq "Absent") + { + $directories = new-object system.collections.generic.hashset[string] + foreach($entry in $entries) + { + $isDir = $false + if($entry.FullName.EndsWith("\")) + { + $isDir = $true + $directories.Add((Split-Path -Leaf $entry)) | Out-Null + } + + $parent = $entry.FullName + while(($parent = (Split-Path $parent))) { $directories.Add($parent) | Out-Null } + + if($isDir) + { + #Directory removal is handled as its own pass, see note and code after this loop + continue + } + + $existing = Join-Path $Destination $entry.FullName + $item = Get-Item $existing -EA SilentlyContinue + if(-not $item) + { + continue + } + + #Possible for a folder to have been replaced by a directory of the same name, in which case we must leave it alone + $type = $item.GetType() + if($type -ne [System.IO.FileInfo]) + { + continue + } + + if(-not $Checksum -and $PSCmdlet.ShouldProcess(($LocalizedData.RemoveFile -f $existing), $null, $null)) + { + Trace-Message ($LocalizedData.RemovingDir -f $existing) + rm $existing + continue + } + + $Checksum = $Checksum.ToLower() + if($Checksum.StartsWith("sha")) + { + if((Compare-FileToEntry $existing $entry $Checksum) -and $PSCmdlet.ShouldProcess(($LocalizedData.RemoveFile -f $existing), $null, $null)) + { + Trace-Message ($LocalizedData.Hashesofexistingandzipfilesmatchremoving) + rm $existing + } + else + { + Trace-Message ($LocalizedData.HashdidnotmatchfilehasbeenmodifiedsinceitwasextractedLeaving) + } + } + else + { + $date = Get-RelevantChecksumTimestamp $item $Checksum + if($date.Equals($entry.LastWriteTime.DateTime) -and $PSCmdlet.ShouldProcess(($LocalizedData.RemoveFile -f $existing), $null, $null)) + { + Trace-Message ($LocalizedData.InSetTargetResourceexistsselectedtimestampmatched -f $existing, $Checksum) + rm $existing + } + else + { + Trace-Message ($LocalizedData.InSetTargetResourceexistsdtheselectedtimestampnotmatchg -f $existing, $Checksum) + } + } + } + + #Hashset was useful for dropping dupes in an efficient manner, but it can mess with ordering + #Sort according to current culture (directory names can be localized, obviously) + #Reverse so we hit children before parents + $directories = [system.linq.enumerable]::ToList($directories) + $directories.Sort([System.StringComparer]::InvariantCultureIgnoreCase) + $directories.Reverse() + foreach($directory in $directories) + { + Trace-Message ($LocalizedData.Examiningdirectorytoseeifitshouldberemoved -f $directory) + $existing = Join-Path $Destination $directory + $item = Get-Item $existing -EA SilentlyContinue + if($item -and $item.GetType() -eq [System.IO.DirectoryInfo] -and $item.GetFiles().Count -eq 0 -and $item.GetDirectories().Count -eq 0 ` + -and $PSCmdlet.ShouldProcess(($LocalizedData.RemoveDirectory -f $existing), $null, $null)) + { + Trace-Message ($LocalizedData.existingappearstobeanemptydirectoryRemovingit -f $existing) + rmdir $existing + } + } + + Write-Verbose ($LocalizedData.PackageUninstalled -f $Path,$Destination) + Write-Verbose $LocalizedData.ConfigurationFinished + return + } + + Ensure-Directory $Destination + foreach($entry in $entries) + { + $dest = join-path $Destination $entry.FullName + if($dest.EndsWith('\')) #Directory + { + Ensure-Directory $dest.TrimEnd("\") #Some cmdlets have problems with trailing char + continue + } + + $item = Get-Item $dest -EA SilentlyContinue + if($item) + { + if($item.GetType() -eq [System.IO.FileInfo]) + { + if(-not $Checksum) + { + #It exists. The user didn't specify -Validate, so that's good enough for us + continue + } + + if($Checksum.StartsWith("sha")) + { + if($item.LastWriteTime.Equals($entry.ExistingTimestamp)) + { + Trace-Message ($LocalizedData.LastWriteTimemtcheswhatwehaverecordnotreexaminingchecksum -f $dest, $checksum) + } + else + { + $identical = Compare-FileToEntry $dest $entry $Checksum + + if($identical) + { + Trace-Message ($LocalizedData.FoundfatdestwheregoingtoplaceoneandhashmatchedContinuing -f $dest) + $entry.ExistingItemTimestamp = $item.LastWriteTime + continue + } + else + { + if($Force) + { + Trace-Message ($LocalizedData.FoundfileatdestwhereweweregoingtoplaceoneandhashdidntmatchItwillbeoverwritten -f $dest) + } + else + { + Trace-Message ($LocalizedData.FoundfileatdestwhereweweregoingtoplaceoneanddoesnotmatchthesourcebutForcewasnotspecifiedErroring -f $dest) + Throw-TerminatingError ($LocalizedData.ItemExistsButIsIncorrect -f $dest) + } + } + } + } + else + { + $date = Get-RelevantChecksumTimestamp $item $Checksum + if($date.Equals($entry.LastWriteTime.DateTime)) + { + Trace-Message ($LocalizedData.InSetTargetResourcedestexistsandtheselectedtimestampChecksummatchedwillleaveit -f $dest, $Checksum) + continue + } + else + { + if($Force) + { + Trace-Message ($LocalizedData.InSetTargetResourcedestexistsandtheselectedtimestamp -f $dest, $Checksum) + } + else + { + Trace-Message ($LocalizedData.FoundafileatdestandtimestampChecksumdoesnotmatchthesourcebutForcewasnotspecifiedErroring -f $dest, $Checksum) + Throw-TerminatingError ($LocalizedData.ItemExistsButIsIncorrect -f $dest) + } + } + } + } + else + { + if($Force) + { + Trace-Message ($LocalizedData.FoundadirectoryatdestwhereafileshouldbeRemoving -f $dest) + if($PSCmdlet.ShouldProcess(($LocalizedData.RemoveDirectory -f $dest), $null, $null)) + { + rmdir -Recurse -Force $dest + } + } + else + { + Trace-Message ($LocalizedData.FounddirectoryatdestwhereafileshouldbeandForcewasnotspecifiedErroring -f $dest) + Throw-TerminatingError ($LocalizedData.ItemExistsButIsWrongType -f $dest) + } + } + } + + $parent = Split-Path $dest + if(-not (Test-Path $parent) -and $PSCmdlet.ShouldProcess(($LocalizedData.MakeDirectory -f $parent), $null, $null)) + { + #TODO: This is an edge case we need to revisit. We should be correctly handling wrong file types along + #the directory path if they occur within the archive, but they don't have to. Simple tests demonstrate that + #the Zip format allows you to have the file within a folder without explicitly having an entry for the folder + #This solution will fail in such a case IF anything along the path is of the wrong type (e.g. file in a place + #we expect a directory to be) + mkdir $parent | Out-Null + } + + if($PSCmdlet.ShouldProcess(($LocalizedData.UnzipFile -f $dest), $null, $null)) + { + #If we get here we can safely blow away anything we find. + $null, $nameToEntry, $file = Open-ZipFile $Path + $stream = $null + $outStream = $null + try + { + Trace-Message ($LocalizedData.Writingtofiledest -f $dest) + $stream = $nameToEntry[$entry.FullName].Open() + $outStream = New-Object System.IO.FileStream $dest, "Create" + $stream.CopyTo($outStream) + } + catch + { + Throw-TerminatingError ($LocalizedData.ErrorCopyingToOutstream -f $dest) $_ + } + finally + { + if($stream -ne $null) + { + $stream.Dispose() + } + + if($outStream -ne $null) + { + $outStream.Dispose() + } + } + + $fileInfo = New-Object System.IO.FileInfo $dest + $entry.ExistingItemTimestamp = $fileInfo.LastWriteTime = $fileInfo.LastAccessTime = $fileInfo.CreationTime = $entry.LastWriteTime.DateTime + } + } + } + finally + { + if($file) + { + $file.Dispose() + } + } + + Set-CacheEntry -InputObject $cacheObj -path $Path -destination $Destination + Write-Verbose ($LocalizedData.PackageInstalled -f $Path,$Destination) + Write-Verbose $LocalizedData.ConfigurationFinished + } + finally + { + if($psdrive) + { + $ErrorActionPreference = "SilentlyContinue" + Trace-Message ($LocalizedData.RemovePSDriveonRootdriveRoot -f ($($psdrive.Root))) + Remove-PSDrive $psdrive -Force -ErrorAction SilentlyContinue + } + } +} + +# The Get-TargetResource cmdlet is used to fetch the object +function Get-TargetResource +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] $Path, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] $Destination, + + [boolean] $Validate = $false, + + [ValidateSet("", "SHA-1", "SHA-256", "SHA-512", "CreatedDate", "ModifiedDate")] + [string] $Checksum, + + [pscredential] $Credential + ) + + if ($null -eq $Credential) + { + $PSBoundParameters.Remove("Credential") + } + + $exists = Test-TargetResource @PSBoundParameters + + $stringResult = "Absent" + if($exists) + { + $stringResult = "Present" + } + + @{ + Ensure = $stringResult; + Path = $Path; + Destination = $Destination; + } +} + +Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/MSFT_ArchiveResource.schema.mof b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/MSFT_ArchiveResource.schema.mof new file mode 100644 index 0000000..17fb131 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/MSFT_ArchiveResource.schema.mof differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/ko-KR/ArchiveProvider.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/ko-KR/ArchiveProvider.psd1 new file mode 100644 index 0000000..780e23d Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/ko-KR/ArchiveProvider.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/ko-KR/MSFT_ArchiveResource.schema.mfl b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/ko-KR/MSFT_ArchiveResource.schema.mfl new file mode 100644 index 0000000..ee9ae75 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ArchiveResource/ko-KR/MSFT_ArchiveResource.schema.mfl differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/MSFT_EnvironmentResource.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/MSFT_EnvironmentResource.psm1 new file mode 100644 index 0000000..b0553b1 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/MSFT_EnvironmentResource.psm1 @@ -0,0 +1,798 @@ +# This PS module contains functions for Desired State Configuration (DSC) "Environment" provider + +# Fallback message strings in en-US +DATA localizedData +{ + # culture = "en-US" + ConvertFrom-StringData @' + EnvVarCreated = (CREATE) Environment variable '{0}' with value '{1}' + EnvVarSetError = (ERROR) Failed to set environment variable '{0}' to value '{1}' + EnvVarPathSetError = (ERROR) Failed to add path '{0}' to environment variable '{1}' holding value '{2}' + EnvVarRemoveError = (ERROR) Failed to remove environment variable '{0}' holding value '{1}' + EnvVarPathRemoveError = (ERROR) Failed to remove path '{0}' from variable '{1}' holding value '{2}' + EnvVarUnchanged = (UNCHANGED) Environment variable '{0}' with value '{1}' + EnvVarUpdated = (UPDATE) Environment variable '{0}' from value '{1}' to value '{2}' + EnvVarPathUnchanged = (UNCHANGED) Path environment variable '{0}' with value '{1}' + EnvVarPathUpdated = (UPDATE) Environment variable '{0}' from value '{1}' to value '{2}' + EnvVarNotFound = (NOT FOUND) Environment variable '{0}' + EnvVarFound = (FOUND) Environment variable '{0}' with value '{1}' + EnvVarFoundWithMisMatchingValue = (FOUND MISMATCH) Environment variable '{0}' with value '{1}' mismatched the specified value '{2}' + EnvVarRemoved = (REMOVE) Environment variable '{0}' +'@ +} +Import-LocalizedData LocalizedData -filename MSFT_EnvironmentResource.strings.psd1 + + +#------------------------------------- +# Script-level Constants and Variables +#------------------------------------- +$EnvVarRegPathMachine = "HKLM:\\System\\CurrentControlSet\\Control\\Session Manager\\Environment" +$EnvVarRegPathUser = "HKCU:\\Environment" + +$EnvironmentVariableTarget = @{ Process = 0; User = 1; Machine = 2 } +$MaxSystemEnvVariableLength = 1024 +$MaxUserEnvVariableLength = 255 + +Function Throw-InvalidArgumentException +{ + param( + [string] $Message, + [string] $ParamName + ) + + $exception = new-object System.ArgumentException $Message,$ParamName + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception,$ParamName,"InvalidArgument",$null + throw $errorRecord +} + +function GetEnvironmentVariable +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] $Name, + + [parameter(Mandatory = $true)] + [int] $Target + ) + + if ($Target -eq $EnvironmentVariableTarget.Process) + { + return [System.Environment]::GetEnvironmentVariable($Name); + } + + if ($Target -eq $EnvironmentVariableTarget.Machine) + { + $retVal = Get-ItemProperty $EnvVarRegPathMachine -Name $Name -ErrorAction SilentlyContinue + return $retVal.$Name + } + + if ($Target -eq $EnvironmentVariableTarget.User) + { + $retVal = Get-ItemProperty $EnvVarRegPathUser -Name $Name -ErrorAction SilentlyContinue + return $retVal.$Name + } +} + +function SetEnvironmentVariable +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [String] $Name, + + [String] $Value, + + [parameter(Mandatory = $true)] + [int] $Target + ) + + if ($Target -eq $EnvironmentVariableTarget.Process) + { + [System.Environment]::SetEnvironmentVariable($Name, $Value); + } + + if ($Target -eq $EnvironmentVariableTarget.Machine) + { + if ($Name.Length -ge $MaxSystemEnvVariableLength) { + Throw-InvalidArgumentException -Message "Argument is too long." -ParamName $Name + } + $Path = $EnvVarRegPathMachine + } + elseif ($Target -eq $EnvironmentVariableTarget.User) + { + if ($Name.Length -ge $MaxUserEnvVariableLength) { + Throw-InvalidArgumentException -Message "Argument is too long." -ParamName $Name + } + $Path = $EnvVarRegPathUser + } + + $environmentKey = Get-ItemProperty $Path -Name $Name -ErrorAction SilentlyContinue + if ($environmentKey) + { + if (!$Value) + { + Remove-ItemProperty $Path -Name $Name -ErrorAction SilentlyContinue + } + else + { + Set-ItemProperty $Path -Name $Name -Value $Value -ErrorAction SilentlyContinue + } + } +} + + +#------------------------------ +# The Get-TargetResource cmdlet +#------------------------------ +FUNCTION Get-TargetResource +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Name + ) + + $retVal = GetItemProperty $EnvVarRegPathMachine -Name $Name -Expand:$false -ErrorAction SilentlyContinue + + if($retVal -eq $null) + { + Write-Verbose ($localizedData.EnvVarNotFound -f $Name) + + return @{Ensure='Absent'; Name=$Name} + } + + Write-Verbose ($localizedData.EnvVarFound -f $Name, $retVal.$Name) + + return @{Ensure='Present'; Name=$Name; Value=$retVal.$Name} +} + +function Set-EnvVar +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Name, + + [ValidateNotNull()] + [System.String] + $Value = [String]::Empty + ) + + $err = Set-ItemProperty $EnvVarRegPathMachine -Name $Name -Value $Value 2>&1 + + if($err) + { + Write-Verbose ($localizedData.EnvVarSetError -f $Name, $Value) + + throw $err + } + + try + { + if($value) + { + SetEnvironmentVariable -Name $Name -Value $Value -Target $EnvironmentVariableTarget.Machine + SetEnvironmentVariable -Name $Name -Value $Value -Target $EnvironmentVariableTarget.Process + } + } + catch + { + Write-Verbose ($localizedData.EnvVarSetError -f $Name, $Value) + + throw $_ + } + +} +function Remove-EnvVar +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Name + ) + + $curVarProperties = Get-ItemProperty $EnvVarRegPathMachine -Name $Name -ErrorAction SilentlyContinue + $currentValueFromEnv = GetEnvironmentVariable -Name $name -Target $EnvironmentVariableTarget.Process + + if($curVarProperties -ne $null) + { + $err = Remove-ItemProperty $EnvVarRegPathMachine -Name $Name 2>&1 + + if($err) + { + Write-Log -Message ($localizedData.EnvVarRemoveError -f $Name, $Value) + + throw $err + } + } + + if($currentValueFromEnv -ne $null) + { + try + { + SetEnvironmentVariable -Name $Name -Value $null -Target $EnvironmentVariableTarget.Machine + SetEnvironmentVariable -Name $Name -Value $null -Target $EnvironmentVariableTarget.Process + } + catch + { + Write-Verbose ($localizedData.EnvVarRemoveError -f $Name, $Value) + + throw $_ + } + } +} + + +#------------------------------ +# The Set-TargetResource cmdlet +#------------------------------ +FUNCTION Set-TargetResource +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Name, + + [ValidateNotNull()] + [System.String] + $Value = [String]::Empty, + + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present", + + [System.Boolean] + $Path = $false + ) + + $ValueSpecified = $PSBoundParameters.ContainsKey("Value") + + $curVarProperties = GetItemProperty $EnvVarRegPathMachine -Name $Name -Expand:(-not $Path) -ErrorAction SilentlyContinue + $currentValueFromEnv = GetEnvironmentVariable -Name $name -Target $EnvironmentVariableTarget.Process + + # ---------------- + # ENSURE = PRESENT + if ($Ensure -ieq "Present") + { + if (($curVarProperties -eq $null) -or (($currentValueFromEnv -eq $null) -and ($curVarProperties.$Name -ne [string]::Empty))) # The specified variable doesn't exist already + { + # Given the specified $Name environment variable doesn't exist already, + # simply create one with the specified value and return. If no $Value is + # specified, the default value is set to empty string "" (per spec). + # Both path and non-path cases are covered by this. + + $successMessage = $localizedData.EnvVarCreated -f $Name, $Value + + if ($PSCmdlet.ShouldProcess($successMessage, $null, $null)) + { + Set-EnvVar -Name $Name -Value $Value + } + + return + } + + # If the control reaches here, the specified variable exists already + + if (!$ValueSpecified) + { + # Given no $Value was specified to be set and the variable exists, + # we'll leave the existing variable as is. + # This covers both path and non-path variables. + + Write-Log -Message ($localizedData.EnvVarUnchanged -f $Name, $curVarProperties.$Name) + + return + } + + # If the control reaches here: the specified variable exists already and a $Value has been specified to be set. + + if (!$Path) + { + # For non-path variables, simply set the specified $Value as the new value of the specified + # variable $Name, then return. + + $successMessage = $localizedData.EnvVarUpdated -f $Name, $curVarProperties.$Name, $Value + if ($Value -ceq $curVarProperties.$Name) + { + $successMessage = $localizedData.EnvVarUnchanged -f $Name, $curVarProperties.$Name + } + + if ($PSCmdlet.ShouldProcess($successMessage, $null, $null) -and ($Value -cne $curVarProperties.$Name)) + { + Set-EnvVar -Name $Name -Value $Value + } + + return + } + + # If the control reaches here: the specified variable exists already, it is a path variable and a $Value has been specified to be set. + + # Check if an empty, whitespace or semi-colon only string has been specified. If yes, return unchanged. + $trimmedValue = $Value.Trim(";"," ") + if ([String]::IsNullOrEmpty($trimmedValue)) + { + Write-Log -Message ($localizedData.EnvVarPathUnchanged -f $Name, $curVarProperties.$Name) + + return + } + + + $setValue = $curVarProperties.$Name + ";" + $specifiedPaths = $trimmedValue -split ";" + $currentPaths = $curVarProperties.$Name -split ";" + $varUpdated = $false + + foreach ($specifiedPath in $specifiedPaths) + { + if (FindSubPath -QueryPath $specifiedPath -PathList $currentPaths) + { + # Found this $specifiedPath as one of the $currentPaths, no need to add this again, skip/continue to the next $specifiedPath + + continue + } + + # If the control reached here, we didn't find this $specifiedPath in the $currentPaths, add it + # and mark the environment variable as updated. + + $varUpdated = $true + $setValue += $specifiedPath + ";" + } + + # Remove any extraneous ";" at the end (and potentially start - as a side-effect) of the value to be set + $setValue = $setValue.Trim(";") + + # Set the expected success message + $successMessage = $localizedData.EnvVarPathUnchanged -f $Name, $curVarProperties.$Name + if ($varUpdated) + { + $successMessage = $localizedData.EnvVarPathUpdated -f $Name, $curVarProperties.$Name, $setValue + } + + if ($PSCmdlet.ShouldProcess($successMessage, $null, $null)) + { + # Finally update the existing environment path variable + + Set-EnvVar -Name $Name -Value $setValue + } + } + + # --------------- + # ENSURE = ABSENT + elseif ($Ensure -ieq "Absent") + { + if(($curVarProperties -eq $null) -and ($currentValueFromEnv -eq $null)) + { + # Variable not found, condition is satisfied and there is nothing to set/remove, return + + Write-Log -Message ($localizedData.EnvVarNotFound -f $Name) + + return + } + + if(!$ValueSpecified -or !$Path) + { + # If no $Value specified to be removed, simply remove the environment variable (holds true for both path and non-path variables + # OR + # Regardless of $Value, if the target variable is a non-path variable, simply remove it to meet the absent condition + + $successMessage = $localizedData.EnvVarRemoved -f $Name + + if ($PSCmdlet.ShouldProcess($successMessage, $null, $null)) + { + Remove-EnvVar -Name $Name + } + + return + } + + # If the control reaches here: target variable is an existing environment path-variable and a specified $Value needs be removed from it + + # Check if an empty string or semi-colon only string has been specified as $Value. If yes, return unchanged as we don't need to remove anything. + $trimmedValue = $Value.Trim(";") + if ([String]::IsNullOrEmpty($trimmedValue)) + { + Write-Log -Message ($localizedData.EnvVarPathUnchanged -f $Name, $curVarProperties.$Name) + + return + } + + $finalPath = "" + $specifiedPaths = $trimmedValue -split ";" + $currentPaths = $curVarProperties.$Name -split ";" + $varAltered = $false + + foreach ($subpath in $currentPaths) + { + if (FindSubPath -QueryPath $subpath -PathList $specifiedPaths) + { + # Found this $subpath as one of the $specifiedPaths, skip adding this to the final value/path of this variable + # and mark the variable as altered. + + $varAltered = $true + continue + } + + # If the control reaches here, the current $subpath was not part of the $specifiedPaths (to be removed), + # so keep this $subpath in the finalPath + + $finalPath += $subpath + ";" + } + + # Remove any extraneous ";" at the end (and potentially start - as a side-effect) of the $finalPath + $finalPath = $finalPath.Trim(";") + + + # Set the expected success message + $successMessage = $localizedData.EnvVarPathUnchanged -f $Name, $curVarProperties.$Name + if ($varAltered) + { + $successMessage = $localizedData.EnvVarPathUpdated -f $Name, $curVarProperties.$Name, $finalPath + + if ([String]::IsNullOrEmpty($finalPath)) + { + $successMessage = $localizedData.EnvVarRemoved -f $Name + } + } + + # Handle WhatIf case and update resource as appropriate + if ($PSCmdlet.ShouldProcess($successMessage, $null, $null)) + { + # Finally, update the environment path-variable + + if ([String]::IsNullOrEmpty($finalPath)) + { + Remove-EnvVar -Name $Name + } + else + { + Set-EnvVar -Name $Name -Value $finalPath + } + + if($err) + { + Write-Log -Message ($localizedData.EnvVarPathRemoveError -f $Value, $Name, $curVarProperties.$Name) + + throw $err + } + } + } +} + + +#------------------------------- +# The Test-TargetResource cmdlet +#------------------------------- +FUNCTION Test-TargetResource +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Name, + + [ValidateNotNull()] + [System.String] + $Value, + + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present", + + [System.Boolean] + $Path = $false + ) + + $ValueSpecified = $PSBoundParameters.ContainsKey("Value") + $curVarProperties = GetItemProperty $EnvVarRegPathMachine -Name $Name -Expand:(-not $Path) -ErrorAction SilentlyContinue + $currentValueFromEnv = GetEnvironmentVariable -Name $name -Target $EnvironmentVariableTarget.Process + + # ---------------- + # ENSURE = PRESENT + if ($Ensure -ieq "Present") + { + if (($curVarProperties -eq $null) -or (($currentValueFromEnv -eq $null) -and ($curVarProperties.$Name -ne [string]::Empty)) ) + { + # Variable not found, return failure + + Write-Verbose ($localizedData.EnvVarNotFound -f $Name) + + return $false + } + + if (!$ValueSpecified) + { + # No value has been specified for test, so the existence of the variable means success + + Write-Verbose ($localizedData.EnvVarFound -f $Name, $curVarProperties.$Name) + + return $true + } + + if (!$Path) + { + # For this non-path variable, make sure that the specified $Value matches the current value. + # Success if it matches, failure otherwise + + if ($Value -ceq $curVarProperties.$Name) + { + Write-Verbose ($localizedData.EnvVarFound -f $Name, $curVarProperties.$Name) + + return $true + } + else + { + Write-Verbose ($localizedData.EnvVarFoundWithMisMatchingValue -f $Name, $curVarProperties.$Name, $Value) + + return $false + } + } + + # If the control reaches here, the expected environment variable exists, it is a path variable and a $Value is specified to test against + + if (FindPath -ExistingPaths $curVarProperties.$Name -QueryPaths $Value -FindCriteria All) + { + # The specified path was completely present in the existing environment variable, return success + + Write-Verbose ($localizedData.EnvVarFound -f $Name, $curVarProperties.$Name) + + return $true + } + + # If the control reached here some part of the specified path ($Value) was not found in the existing variable, return failure + + Write-Verbose ($localizedData.EnvVarFoundWithMisMatchingValue -f $Name, $curVarProperties.$Name, $Value) + + return $false + } + + # --------------- + # ENSURE = ABSENT + elseif ($Ensure -eq "Absent") + { + if(($curVarProperties -eq $null) -and ($currentValueFromEnv -eq $null)) + { + # Variable not found (path/non-path and $Value both do not matter then), return success + + Write-Verbose ($localizedData.EnvVarNotFound -f $Name) + + return $true + } + + if (!$ValueSpecified) + { + # Given no value has been specified for test, the mere existence of the variable fails the test + + Write-Verbose ($localizedData.EnvVarFound -f $Name, $curVarProperties.$Name) + + return $false + } + + # If the control reaches here: the variable exists and a value has been specified to test against it + + if (!$Path) + { + # For this non-path variable, make sure that the specified value doesn't match the current value + # Success if it doesn't match, failure otherwise + + if ($Value -cne $curVarProperties.$Name) + { + Write-Verbose ($localizedData.EnvVarFoundWithMisMatchingValue -f $Name, $curVarProperties.$Name, $Value) + + return $true + } + else + { + Write-Verbose ($localizedData.EnvVarFound -f $Name, $curVarProperties.$Name) + + return $false + } + } + + # If the control reaches here: the variable exists, it is a path variable, and a value has been specified to test against it + + if (FindPath -ExistingPaths $curVarProperties.$Name -QueryPaths $Value -FindCriteria Any) + { + # One of the specified paths in $Value exists in the environment variable path, thus the test fails + + Write-Verbose ($localizedData.EnvVarFound -f $Name, $curVarProperties.$Name) + + return $false + } + + # If the control reached here, none of the specified paths were found in the existing path-variable, return success + + Write-Verbose ($localizedData.EnvVarFoundWithMisMatchingValue -f $Name, $curVarProperties.$Name, $Value) + + return $true + } +} + + +#---------------------------------------- +# Utility to write WhatIf or Verbose logs +#---------------------------------------- +FUNCTION Write-Log +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Message + ) + + if ($PSCmdlet.ShouldProcess($Message, $null, $null)) + { + Write-Verbose $Message + } +} + + +#----------------------------------- +# Utility to match environment paths +#----------------------------------- +FUNCTION FindPath +{ + param + ( + [System.String] + $ExistingPaths, + + [System.String] + $QueryPaths, + + [parameter(Mandatory = $true)] + [ValidateSet("Any", "All")] + [System.String] + $FindCriteria + ) + + $existingPathList = $ExistingPaths -split ";" + $queryPathList = $QueryPaths -split ";" + + switch ($FindCriteria) + { + "Any" + { + foreach ($queryPath in $queryPathList) + { + if (FindSubPath -QueryPath $queryPath -PathList $existingPathList) + { + # Found this $queryPath in the existing paths, return $true + return $true + } + } + + # If the control reached here, none of the $QueryPaths were found as part of the $ExistingPaths, return $false + return $false + } + + "All" + { + foreach ($queryPath in $queryPathList) + { + $found = $false + if($queryPath) + { + if (!(FindSubPath -QueryPath $queryPath -PathList $existingPathList)) + { + # The current $queryPath wasn't found in any of the $existingPathList, return failure + return $false + } + } + } + + # If the control reached here, all of the $QueryPaths were found as part of the $ExistingPaths, return $true + return $true + } + } +} + + +#--------------------------------------- +# Utility to search a path in a pathlist +#--------------------------------------- +FUNCTION FindSubPath +{ + param + ( + [System.String] + $QueryPath, + + [String[]] + $PathList + ) + + foreach ($path in $PathList) + { + if($QueryPath -ieq $path) + { + # If the query path matches any of the paths in $PathList, return $true + return $true + } + } + + return $false +} + +#--------------------------------------------------------------- +# Utility to get item property without expanding it if necessary +#--------------------------------------------------------------- +FUNCTION GetItemProperty +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Path, + + [ValidateNotNull()] + [System.String] + $Name, + + [switch] + $Expand = $false + ) + + if ($Expand) + { + return (Get-ItemProperty $EnvVarRegPathMachine -Name $Name -ErrorAction SilentlyContinue) + } + else + { + if (!(Test-Path -Path $Path)) + { + return $null; + } + + $PathTokens = $Path.Split('\',[System.StringSplitOptions]::RemoveEmptyEntries) + $Division = $PathTokens[0].Replace(':', '') + $Entry = $PathTokens[1..($PathTokens.Count-1)] -join '\' + + # Since the target registry path coming to this function is hardcoded for local machine + $Hive = [Microsoft.Win32.Registry]::LocalMachine + + $NoteProperties = @{} + try + { + $Key = $Hive.OpenSubKey($Entry) + + $ValueNames = $Key.GetValueNames() + if ($ValueNames -inotcontains $Name) + { + return $null + } + + [string] $Value = $Key.GetValue($Name, $null, [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames) + $NoteProperties.Add($Name, $Value) + } + finally + { + if ($key) + { + $key.Close() + } + } + + [System.Management.Automation.PSObject] $PropertyResults = New-Object -TypeName System.Management.Automation.PSObject -Property $NoteProperties + + return $PropertyResults + } +} + +Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/MSFT_EnvironmentResource.schema.mof b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/MSFT_EnvironmentResource.schema.mof new file mode 100644 index 0000000..f83f0f2 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/MSFT_EnvironmentResource.schema.mof differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/ko-KR/MSFT_EnvironmentResource.schema.mfl b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/ko-KR/MSFT_EnvironmentResource.schema.mfl new file mode 100644 index 0000000..f54b711 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/ko-KR/MSFT_EnvironmentResource.schema.mfl differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/ko-KR/MSFT_EnvironmentResource.strings.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/ko-KR/MSFT_EnvironmentResource.strings.psd1 new file mode 100644 index 0000000..4946bb2 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_EnvironmentResource/ko-KR/MSFT_EnvironmentResource.strings.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/MSFT_GroupResource.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/MSFT_GroupResource.psm1 new file mode 100644 index 0000000..71686db --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/MSFT_GroupResource.psm1 @@ -0,0 +1,2184 @@ +<# +Implementatation notes + +Managing Disposable objects + The types PrincipalContext, Principal, and DirectoryEntry are used througout the code + and all are disposable. However, in many cases, disposing the object immediately + causes subsequent operations to fail or duplicate dispose calls to occur. + To simplify management of these disposables, each public entry point defines a + $disposables ArrayList variable and passes it to secondary functions that may + need to create disposable objects. The public entry point is then required + to dispose the contents of the list in a finally block. + +Managing PrincipalContext instances. + To use the AccountManagement APIs to connect to the local machine or a domain, + a PrincipalContext is needed. + + For the local groups and users, a PrincipalContext reflecting the current user + can be created. + + For the default domain; the domain where the machine is joined, explicit credentials + are needed since the default user context is SYSTEM which has no rights to the + domain. + + Additional PrincipalContext intsances may be needed when the machine is in a domain that is + part of a multi-domain forest. For example, Microsoft uses a multi-domain forest that + includes domains such as ntdev, redmond, wingroup and a group may have members that + span multiple domains. Unless the enterprise implements the Global Catalog; + something that Microsoft does not do; a unique PrincipalContext is needed to resolve + accounts in each of the domains. + + To manage the use of PrincipalContext across domains, public entry points define + a $principalContexts hashtable and pass it to support functions that need to + resolve a group or group member. Consumers of a PrincipalContext call + GetPrincipalContext with a scope (domain name or machine name). GetPrincipalContext + returns an existing hashtable entry or creates a new entry. Note that a PrincipalContext + to a target domain requires connecting to the domain, the hash table avoids subsequent + connection calls. Also note that GetPrincipalContext takes a Credential parameter for the + case where a new PrincipalContext is needed. The implicit assumption is the credentials + provided for the primary domain also has rights to resolve accounts in any of the other domains. + +Resolving Group Members + The original implementation assumed that group members could be resolved using the machine + PrincipalContext or the logged on user. In practice this is not reliable since + the resource is typically run under the system account and this account is not guaranteed + to have rights to resolve domain accounts. Additionally, the API's for enumerating group members + does not provide a facility for passing additional credentials resulting in domain members failing + to resolve. + To address this, group members are enumerated by first converting the GroupPrincipal to a + DirectoryEntry and enumerating its child members. The returned DirectoryEntry instances + are then resolved to Principal objects using a PrincipalContext appropriate for the + target domain. See ResolveGroupMembersToPrincipals for details. + +Handling Stale Group members + A group may have stale members if the machine was moved from one domain to a another, + foreign domain or when accounts are deleted (domain or local). + At this point, members that were defined in the original domain or were deleted are + now stale and cannot be resolved using Principal::FindByIdentity. The original + implementation failed at this point preventing any operations against the group. The + current implementation calls Write-Warning with the associated SID of the member that cannot + be resolved then continues the operation. + +#> + +# A global variable that contains localized messages. +data LocalizedData +{ +# culture="en-US" +ConvertFrom-StringData @' +GroupWithName=Group: {0} +RemoveOperation=Remove +AddOperation=Add +SetOperation=Set +GroupCreated=Group {0} created successfully. +GroupUpdated=Group {0} properties updated successfully. +GroupRemoved=Group {0} removed successfully. +NoConfigurationRequired=Group {0} exists on this node with the desired properties. No action required. +NoConfigurationRequiredGroupDoesNotExist=Group {0} does not exist on this node. No action required. +CouldNotFindPrincipal=Could not find a principal with the provided name [{0}] +MembersAndIncludeExcludeConflict=The {0} and {1} and/or {2} parameters conflict. The {0} parameter should not be used in any combination with the {1} and {2} parameters. +MembersIsNull=The Members parameter value is null. The {0} parameter must be provided if neither {1} nor {2} is provided. +MembersIsEmpty=The Members parameter is empty. At least one group member must be provided. +MemberNotValid=The group member does not exist or cannot be resolved: {0}. +IncludeAndExcludeConflict=The principal {0} is included in both {1} and {2} parameter values. The same principal must not be included in both {1} and {2} parameter values. +IncludeAndExcludeAreEmpty=The MembersToInclude and MembersToExclude are either both null or empty. At least one member must be specified in one of these parameters" +InvalidGroupName=The name {0} cannot be used. Names may not consist entirely of periods and/or spaces, or contain these characters: {1} +GroupExists=A group with the name {0} exists. +GroupDoesNotExist=A group with the name {0} does not exist. +PropertyMismatch=The value of the {0} property is expected to be {1} but it is {2}. +MembersNumberMismatch=Property {0}. The number of provided unique group members {1} is different from the number of actual group members {2}. +MembersMemberMismatch=At least one member {0} of the provided {1} parameter does not have a match in the existing group {2}. +MemberToExcludeMatch=At least one member {0} of the provided {1} parameter has a match in the existing group {2}. +ResolvingLocalAccount=Resolving {0} as a local account. +ResolvingDomainAccount=Resolving {0} in the {1} domain. +ResolvingDomainAccountWithTrust=Resolving {0} with domain trust. +DomainCredentialsRequired=Credentials are required to resolve the domain account {0}. +UnableToResolveAccount=Unable to resolve account '{0}'. Failed with message: {1} (error code={2}) +'@ +} + +Import-Module "$PSScriptRoot\..\RunAsHelper.psm1" + +Import-LocalizedData LocalizedData -FileName MSFT_GroupResource.strings.psd1 + +if (-not (IsNanoServer)) +{ + Add-Type -AssemblyName 'System.DirectoryServices.AccountManagement' +} + +<# +.Synopsis +The Get-TargetResource cmdlet. +#> +function Get-TargetResource +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $GroupName, + + [System.Management.Automation.PSCredential] + $Credential = $null + ) + + if (IsNanoServer) + { + return Get-TargetResourceOnNanoServer @PSBoundParameters + } + else + { + return Get-TargetResourceOnFullSKU @PSBoundParameters + } + +} + +<# +.Synopsis +The Set-TargetResource cmdlet. +#> +function Set-TargetResource +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $GroupName, + + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present", + + [System.String] + $Description, + + [System.String[]] + $Members, + + [System.String[]] + $MembersToInclude, + + [System.String[]] + $MembersToExclude, + + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $Credential + ) + + if (IsNanoServer) + { + Set-TargetResourceOnNanoServer @PSBoundParameters + } + else + { + Set-TargetResourceOnFullSKU @PSBoundParameters + } +} + +<# +.Synopsis +The Test-TargetResource cmdlet is used to validate if the resource is in a state as expected in the instance document. +#> +function Test-TargetResource +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $GroupName, + + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present", + + [System.String] + $Description, + + [System.String[]] + $Members, + + [System.String[]] + $MembersToInclude, + + [System.String[]] + $MembersToExclude, + + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $Credential + ) + + if (IsNanoServer) + { + return Test-TargetResourceOnNanoServer @PSBoundParameters + } + else + { + return Test-TargetResourceOnFullSKU @PSBoundParameters + } +} + +<# +.Synopsis +The Get-TargetResource cmdlet for Full SKU images. +#> +function Get-TargetResourceOnFullSKU +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $GroupName, + + [System.Management.Automation.PSCredential] + $Credential = $null + ) + + Set-StrictMode -Version Latest + + ValidateGroupName -GroupName $GroupName + + # store disposable objects in a list for cleanup later. + # This is needed for the case where utility functions need to create + # disposable objects (Principal and PrincipalContext) and the + # object's life time is longer than the function. The $disposables + # collection is passed to these functions for storing the disposable objects + # and this function disposes the contents prior to returning. + # See references to DisposeAll for details. + $disposables = New-Object System.Collections.ArrayList + + # hash table of scope to PrincipalContext. This is used for + # cases where the group membership contains entries that span the machine + # and one or more domains. The hashtable's key is the machine or domain + # name (scope) while the value is the PrincipalContext to use to resolve accounts + # within the named scope. + $principalContexts = @{} + + try + { + [System.DirectoryServices.AccountManagement.GroupPrincipal] $group = GetGroup -groupName $GroupName -principalContexts $principalContexts -disposables $disposables + if($group -ne $null) + { + $null = $disposables.Add($group) + + # The group is found. Enumerate all group members. + $members = [String[]]@(EnumerateMembersOnFullSKU -Group $group -principalContexts $principalContexts -disposables $disposables -credential $Credential) + + # Return all group properties and Ensure="Present". + $returnValue = @{ + GroupName = $group.Name; + Ensure = "Present"; + Description = $group.Description; + Members = [System.String[]] $members; + } + + return $returnValue + } + + # The group is not found. Return Ensure=Absent. + return @{ + GroupName = $GroupName; + Ensure = "Absent"; + } + } + finally + { + DisposeAll $disposables + } +} + +<# +.Synopsis +The Set-TargetResource cmdlet for Full SKU images. +#> +function Set-TargetResourceOnFullSKU +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $GroupName, + + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present", + + [System.String] + $Description, + + [System.String[]] + $Members, + + [System.String[]] + $MembersToInclude, + + [System.String[]] + $MembersToExclude, + + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $Credential + ) + + Set-StrictMode -Version Latest + + ValidateGroupName -GroupName $GroupName + + # store disposable objects in a list for cleanup later. + # This is needed for the case where utility functions need to create + # disposable objects (Principal and PrincipalContext) and the + # object's life time is longer than the function. The $disposables + # collection is passed to these functions for storing the disposable objects + # and this function disposes the contents prior to returning. + # See references to DisposeAll for details. + $disposables = New-Object System.Collections.ArrayList + + # hash table of scope to PrincipalContext. This is used for + # cases where the group membership contains entries that span the machine + # and one or more domains. The hashtable's key is the machine or domain + # name (scope) while the value is the PrincipalContext to use to resolve accounts + # within the named scope. + $principalContexts = @{} + + try + { + # Try to find a group by its name. + [System.DirectoryServices.AccountManagement.GroupPrincipal] $group = GetGroup -groupName $GroupName -principalContexts $principalContexts -disposables $disposables + [bool] $groupExists = $false + + if ($group -ne $null) + { + $groupExists = $true + } + + if($Ensure -eq "Present") + { + [System.DirectoryServices.AccountManagement.Principal[]] $membersToIncludePrincipals = $null + [System.DirectoryServices.AccountManagement.Principal[]] $membersToExcludePrincipals = $null + + if ($group -ne $null) + { + $null = $disposables.Add($group) + } + + # Ensure is set to "Present". + + [bool] $whatIfShouldProcess = $true + [bool] $saveChanges = $false + + if(-not $groupExists) + { + # A group does not exist. Check WhatIf for adding a group. + $whatIfShouldProcess = $pscmdlet.ShouldProcess(($LocalizedData.GroupWithName -f $GroupName), $LocalizedData.AddOperation) + } + else + { + # Check WhatIf for setting a group. + $whatIfShouldProcess = $pscmdlet.ShouldProcess(($LocalizedData.GroupWithName -f $GroupName), $LocalizedData.SetOperation) + } + + if($whatIfShouldProcess) + { + if(-not $groupExists) + { + # NOTE: The PrincipalContext for the local machine is populated above in the call to GetGroup + $localPrincipalContext = $principalContexts[$env:COMPUTERNAME] + + # The group with the provided name does not exist. Add a new group. + $group = New-Object System.DirectoryServices.AccountManagement.GroupPrincipal($localPrincipalContext) + $null = $disposables.Add($group) + + $group.Name = $GroupName + $saveChanges = $true + } + + # Set group properties. + + if($PSBoundParameters.ContainsKey('Description') -and ((-not $groupExists) -or ($Description -ne $group.Description))) + { + $group.Description = $Description + $saveChanges = $true + } + + # NOTE: Group members can be updated in two ways.. + # 1: Supplying the Members parameter - this causes the membership to be replaced with the members defined in Members. + # NOTE: If Members is empty, the group membership is cleared. + # 2: Providing MembersToInclude and/or MembersToExclude - this adds/removes members from the list. + # If Members is mutually exclusive with MembersToInclude and MembersToExclude + # If Members is not defined then MembersToInclude or MembersToExclude must contain at least one entry. + + if($PSBoundParameters.ContainsKey('Members')) + { + if($PSBoundParameters.ContainsKey('MembersToInclude') -or $PSBoundParameters.ContainsKey('MembersToExclude')) + { + # If Members are provided, Include and Exclude are not allowed. + ThrowInvalidArgumentError -ErrorId "GroupTestCmdlet_MembersPlusIncludeOrExcludeConflict" -ErrorMessage ($LocalizedData.MembersAndIncludeExcludeConflict -f "Members","MembersToInclude","MembersToExclude") + } + + if($Members -eq $null) + { + ThrowInvalidArgumentError -ErrorId "GroupTestCmdlet_MembersIsNull" -ErrorMessage ($LocalizedData.MembersIsNull -f "Members","MembersToInclude","MembersToExclude") + } + + if ($Members.Count -eq 0) + { + $group.Members.Clear() + $saveChanges = $true + } + else + { + # Remove duplicate names as strings. + $Members = [String[]]@(RemoveDuplicates -Members $Members) + + # Resolve the names to actual principal objects. + [System.DirectoryServices.AccountManagement.Principal[]]$expectedPrincipals = ResolveNamesToPrincipals -principalContexts $principalContexts -Disposables $disposables -credential $Credential -ObjectNames $Members + + if ($expectedPrincipals.Length -gt 0) + { + $group.Members.Clear() + # Set the contents of the group + if ((AddGroupMembers -Group $group -Principals $expectedPrincipals) -eq $true) + { + $saveChanges = $true + } + } + else + { + #ISSUE: Is an empty $Members parameter valid? + ThrowInvalidArgumentError -ErrorId "GroupSetCmdlet_MembersEmpty" -ErrorMessage ($LocalizedData.MembersIsEmpty) + } + } + } + else + { + [System.DirectoryServices.AccountManagement.Principal[]] $membersToIncludePrincipals = $null + [System.DirectoryServices.AccountManagement.Principal[]] $membersToExcludePrincipals = $null + + if($PSBoundParameters.ContainsKey('MembersToInclude')) + { + $MembersToInclude = [String[]]@(RemoveDuplicates -Members $MembersToInclude) + + # Resolve the names to actual principal objects. + $membersToIncludePrincipals = ResolveNamesToPrincipals -principalContexts $principalContexts -Disposables $disposables -credential $Credential -ObjectNames $MembersToInclude + } + + if($PSBoundParameters.ContainsKey('MembersToExclude')) + { + $MembersToExclude = [String[]]@(RemoveDuplicates -Members $MembersToExclude) + + # Resolve the names to actual principal objects. + $membersToExcludePrincipals = ResolveNamesToPrincipals -principalContexts $principalContexts -Disposables $disposables -credential $Credential -ObjectNames $MembersToExclude + } + + if($membersToIncludePrincipals -ne $null -and $membersToExcludePrincipals -ne $null) + { + # Both MembersToInclude and MembersToExlude were provided. Check if they have common principals. + foreach($includePrincipal in $membersToIncludePrincipals) + { + foreach($excludePrincipal in $membersToExcludePrincipals) + { + if($includePrincipal -eq $excludePrincipal) + { + ThrowInvalidArgumentError -ErrorId "GroupSetCmdlet_IncludeAndExcludeConflict" -ErrorMessage ($LocalizedData.IncludeAndExcludeConflict -f $includePrincipal.SamAccountName,"MembersToInclude", "MembersToExclude") + } + } + } + if ($membersToIncludePrincipals.Length -eq 0 -and $membersToExcludePrincipals.Length -eq 0) + { + ThrowInvalidArgumentError -ErrorId "GroupSetCmdlet_EmptyIncludeAndExclude" -ErrorMessage ($LocalizedData.IncludeAndExcludeAreEmpty) + } + } + + + if ((RemoveGroupMembers -Group $group -Principals $membersToExcludePrincipals) -eq $true) + { + $saveChanges = $true + } + + if ((AddGroupMembers -Group $group -Principals $membersToIncludePrincipals) -eq $true) + { + $saveChanges = $true + } + } + + if($saveChanges) + { + $group.Save() + + # Send an operation success verbose message. + if($groupExists) + { + Write-Verbose -Message ($LocalizedData.GroupUpdated -f $GroupName) + } + else + { + Write-Verbose -Message ($LocalizedData.GroupCreated -f $GroupName) + } + } + else + { + Write-Verbose -Message ($LocalizedData.NoConfigurationRequired -f $GroupName) + } + } + } + else + { + # Ensure is set to "Absent". + if($groupExists -eq $true) + { + # The group exists. + if($pscmdlet.ShouldProcess(($LocalizedData.GroupWithName -f $GroupName), $LocalizedData.RemoveOperation)) + { + # Remove the group by the provided name. + # NOTE: Don't add to $disposables since Delete also disposes. + $group.Delete() + Write-Verbose -Message ($LocalizedData.GroupRemoved -f $GroupName) + } + else + { + $null = $disposables.Add($group) + } + } + else + { + Write-Verbose -Message ($LocalizedData.NoConfigurationRequiredGroupDoesNotExist -f $GroupName) + } + } + } + finally + { + DisposeAll $disposables + } +} + +<# +.Synopsis +The Test-TargetResource cmdlet for Full SKU images is used to validate if the resource is in a state as expected in the instance document. +#> +function Test-TargetResourceOnFullSKU +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $GroupName, + + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present", + + [System.String] + $Description, + + [System.String[]] + $Members, + + [System.String[]] + $MembersToInclude, + + [System.String[]] + $MembersToExclude, + + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $Credential + ) + + Set-StrictMode -Version Latest + + ValidateGroupName -GroupName $GroupName + + # store disposable objects in a list for cleanup later. + # This is needed for the case where utility functions need to create + # disposable objects (Principal and PrincipalContext) and the + # object's life time is longer than the function. The $disposables + # collection is passed to these functions for storing the disposable objects + # and this function disposes the contents prior to returning. + # See references to DisposeAll for details. + $disposables = New-Object System.Collections.ArrayList + + # hash table of scope to PrincipalContext. This is used for + # cases where the group membership contains entries that span the machine + # and one or more domains. The hashtable's key is the machine or domain + # name (scope) while the value is the PrincipalContext to use to resolve accounts + # within the named scope. + $principalContexts = @{} + + try + { + [System.DirectoryServices.AccountManagement.GroupPrincipal] $group = GetGroup -groupName $GroupName -principalContexts $principalContexts -disposables $disposables + if($group -eq $null) + { + # A group with the provided name does not exist. + Write-Log -Message ($LocalizedData.GroupDoesNotExist -f $GroupName) + + if($Ensure -eq "Absent") + { + return $true + } + else + { + return $false + } + } + $null = $disposables.Add($group) + + # A group with the provided name exists. + Write-Log -Message ($LocalizedData.GroupExists -f $GroupName) + + # Validate separate properties. + if($Ensure -eq "Absent") + { + Write-Log -Message ($LocalizedData.PropertyMismatch -f "Ensure", "Absent", "Present") + return $false # The Ensure property does not match. Return $false + } + + if($PSBoundParameters.ContainsKey('GroupName') -and $GroupName -ne $group.SamAccountName -and $GroupName -ne $group.Sid.Value) + { + return $false # The Name property does not match. Return $false + } + + if($PSBoundParameters.ContainsKey('Description') -and $Description -ne $group.Description) + { + Write-Log -Message ($LocalizedData.PropertyMismatch -f "Description", $Description, $group.Description) + return $false # The Description property does not match. Return $false + } + + if($PSBoundParameters.ContainsKey('Members')) + { + if($PSBoundParameters.ContainsKey('MembersToInclude') -or $PSBoundParameters.ContainsKey('MembersToExclude')) + { + # If Members are provided, Include and Exclude are not allowed. + ThrowInvalidArgumentError -ErrorId "GroupTestCmdlet_MembersPlusIncludeOrExcludeConflict" -ErrorMessage ($LocalizedData.MembersAndIncludeExcludeConflict -f "Members","MembersToInclude","MembersToExclude") + } + + if($Members -eq $null) + { + ThrowInvalidArgumentError -ErrorId "GroupTestCmdlet_MembersIsNull" -ErrorMessage ($LocalizedData.MembersIsNull -f "Members","MembersToInclude","MembersToExclude") + } + + if ($Members.Count -eq 0) + { + if ($group.Members.Count -eq 0) + { + return $true + } + else + { + return $false + } + } + else + { + # Remove duplicate names as strings. + $Members = [String[]]@(RemoveDuplicates -Members $Members) + + # Resolve the names to actual principal objects. + [System.DirectoryServices.AccountManagement.Principal[]] $expectedMembers = ResolveNamesToPrincipals -principalContexts $principalContexts -Disposables $disposables -credential $Credential -ObjectNames $Members + + if($expectedMembers.Length -ne $group.Members.Count) + { + Write-Log -Message ($LocalizedData.MembersNumberMismatch -f "Members", $expectedMembers.Length, $group.Members.Count) + return $false; # The number of provided unique group members is different from the number of actual group members. Return $false. + } + + [System.DirectoryServices.AccountManagement.Principal[]] $actualMembers = ResolveGroupMembersToPrincipals -group $group -principalContexts $principalContexts -disposables $disposables -credential $Credential + + # Compare two members lists. + foreach ($expectedMember in $expectedMembers) + { + $matchFound = $false + + foreach($groupMember in $actualMembers) + { + if($expectedMember -eq $groupMember) + { + $matchFound = $true + break; + } + } + + if(!$matchFound) + { + Write-Log -Message ($LocalizedData.MembersMemberMismatch -f $expectedMember.SamAccountName, "Members", $group.SamAccountName) + return $false # At least one element does not have a match. Return $false + } + } + } + } + else + { + [System.DirectoryServices.AccountManagement.Principal[]] $actualMembers = ResolveGroupMembersToPrincipals -group $group -principalContexts $principalContexts -disposables $disposables -credential $Credential + + if($PSBoundParameters.ContainsKey('MembersToInclude')) + { + $MembersToInclude = [String[]]@(RemoveDuplicates -Members $MembersToInclude) + + # Resolve the names to actual principal objects. + [System.DirectoryServices.AccountManagement.Principal[]] $membersToIncludePrincipals = ResolveNamesToPrincipals -principalContexts $principalContexts -Disposables $disposables -credential $Credential -ObjectNames $MembersToInclude + + # Check if every element in $membersToIncludePrincipals has a match in $group.Members. + # Compare two members lists. + foreach($expectedMember in $membersToIncludePrincipals) + { + $matchFound = $false + + foreach($groupMember in $actualMembers) + { + if($expectedMember -eq $groupMember) + { + $matchFound = $true + break + } + } + + if(!$matchFound) + { + Write-Log -Message ($LocalizedData.MembersMemberMismatch -f $expectedMember.SamAccountName, "MembersToInclude", $group.SamAccountName) + return $false # At least one element from $MembersToInclude does not have a match. Return $false + } + } + } + + if($PSBoundParameters.ContainsKey('MembersToExclude')) + { + $MembersToExclude = [String[]]@(RemoveDuplicates -Members $MembersToExclude); + + # Resolve the names to actual principal objects. + [System.DirectoryServices.AccountManagement.Principal[]] $membersToExcludePrincipals = ResolveNamesToPrincipals -principalContexts $principalContexts -Disposables $disposables -credential $Credential -ObjectNames $MembersToExclude + + foreach($expectedMember in $membersToExcludePrincipals) + { + foreach($groupMember in $actualMembers) + { + if($expectedMember -eq $groupMember) + { + Write-Log -Message ($LocalizedData.MemberToExcludeMatch -f $expectedMember.SamAccountName, "MembersToExclude", $group.SamAccountName) + return $false # At least one element from $MembersToExclude has a match. Return $false + } + } + } + } + } + } + finally + { + DisposeAll $disposables + } + + # All properties match. Return $true. + return $true; +} + +<# +.Synopsis +The Get-TargetResource cmdlet for Nano Server images. +#> +function Get-TargetResourceOnNanoServer +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $GroupName, + + [System.Management.Automation.PSCredential] + $Credential = $null + ) + + Set-StrictMode -Version Latest + + ValidateGroupName -GroupName $GroupName + + try + { + [Microsoft.PowerShell.Commands.LocalGroup] $group = Get-LocalGroup -Name $GroupName -ErrorAction Stop + } + catch [System.Exception] + { + if ($_.CategoryInfo.Reason -eq 'GroupNotFoundException') + { + # The group is not found. Return Ensure=Absent. + return @{ + GroupName = $GroupName; + Ensure = "Absent"; + } + } + Throw-TerminatingError -ErrorRecord $_ + } + + # The group is found. Enumerate all group members. + $members = [String[]](EnumerateMembersOnNanoServer -Group $group) + + # Return all group properties and Ensure="Present". + $returnValue = @{ + GroupName = $group.Name; + Ensure = "Present"; + Description = $group.Description; + Members = [System.String[]] $members; + } + + return $returnValue +} + +<# +.Synopsis +The Set-TargetResource cmdlet for Nano Server images. +#> +function Set-TargetResourceOnNanoServer +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $GroupName, + + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present", + + [System.String] + $Description, + + [System.String[]] + $Members, + + [System.String[]] + $MembersToInclude, + + [System.String[]] + $MembersToExclude, + + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $Credential + ) + + Set-StrictMode -Version Latest + + ValidateGroupName -GroupName $GroupName + + # Try to find a group by its name. + [bool] $groupExists = $false + try + { + [Microsoft.PowerShell.Commands.LocalGroup] $group = Get-LocalGroup -Name $GroupName -ErrorAction Stop + $groupExists = $true + } + catch [System.Exception] + { + if ($_.CategoryInfo.Reason -eq 'GroupNotFoundException') + { + # A group with the provided name does not exist. + Write-Log -Message ($LocalizedData.GroupDoesNotExist -f $GroupName) + } + else + { + Throw-TerminatingError -ErrorRecord $_ + } + } + + if($Ensure -eq "Present") + { + # Ensure is set to "Present". + if(-not $groupExists) + { + # The group with the provided name does not exist. Add a new group. + New-LocalGroup -Name $GroupName + Write-Verbose -Message ($LocalizedData.GroupCreated -f $GroupName) + } + + # Set group properties. + + if($PSBoundParameters.ContainsKey('Description') -and ((-not $groupExists) -or ($Description -ne $group.Description))) + { + Set-LocalGroup -Name $GroupName -Description $Description + } + + # NOTE: Group members can be updated in two ways.. + # 1: Supplying the Members parameter - this causes the membership to be replaced with the members defined in Members. + # NOTE: If Members is empty, the group membership is cleared. + # 2: Providing MembersToInclude and/or MembersToExclude - this adds/removes members from the list. + # If Members is mutually exclusive with MembersToInclude and MembersToExclude + # If Members is not defined then MembersToInclude or MembersToExclude must contain at least one entry. + + if($PSBoundParameters.ContainsKey('Members')) + { + if($PSBoundParameters.ContainsKey('MembersToInclude') -or $PSBoundParameters.ContainsKey('MembersToExclude')) + { + # If Members are provided, Include and Exclude are not allowed. + ThrowInvalidArgumentError -ErrorId "GroupTestCmdlet_MembersPlusIncludeOrExcludeConflict" -ErrorMessage ($LocalizedData.MembersAndIncludeExcludeConflict -f "Members","MembersToInclude","MembersToExclude") + } + + if($Members -eq $null) + { + ThrowInvalidArgumentError -ErrorId "GroupTestCmdlet_MembersIsNull" -ErrorMessage ($LocalizedData.MembersIsNull -f "Members","MembersToInclude","MembersToExclude") + } + + # Remove duplicate names as strings. + $ExpectedMembers = [String[]]@(RemoveDuplicates -Members $Members) + + if ($ExpectedMembers.Length -gt 0) + { + # Get current members + $CurrentMembers = EnumerateMembersOnNanoServer -Group $group + + # Remove the current members of the group + Remove-LocalGroupMember -Group $GroupName -Member $CurrentMembers + + # Add the list of expected members to the group + Add-LocalGroupMember -Group $GroupName -Member $ExpectedMembers + } + else + { + ThrowInvalidArgumentError -ErrorId "GroupSetCmdlet_MembersEmpty" -ErrorMessage ($LocalizedData.MembersIsEmpty) + } + } + else + { + if($PSBoundParameters.ContainsKey('MembersToInclude')) + { + $MembersToInclude = [String[]]@(RemoveDuplicates -Members $MembersToInclude) + } + + if($PSBoundParameters.ContainsKey('MembersToExclude')) + { + $MembersToExclude = [String[]]@(RemoveDuplicates -Members $MembersToExclude) + } + + if($PSBoundParameters.ContainsKey('MembersToInclude') -and $PSBoundParameters.ContainsKey('MembersToExclude')) + { + # Both MembersToInclude and MembersToExlude were provided. Check if they have common principals. + foreach($includeMember in $MembersToInclude) + { + foreach($excludeMember in $MembersToExclude) + { + if($includeMember -eq $excludeMember) + { + ThrowInvalidArgumentError -ErrorId "GroupSetCmdlet_IncludeAndExcludeConflict" -ErrorMessage ($LocalizedData.IncludeAndExcludeConflict -f $includeMember ,"MembersToInclude", "MembersToExclude") + } + } + } + if ($MembersToInclude.Length -eq 0 -and $MembersToExclude.Length -eq 0) + { + ThrowInvalidArgumentError -ErrorId "GroupSetCmdlet_EmptyIncludeAndExclude" -ErrorMessage ($LocalizedData.IncludeAndExcludeAreEmpty) + } + } + + if($PSBoundParameters.ContainsKey('MembersToInclude')) + { + foreach($includeMember in $MembersToInclude) + { + try + { + Add-LocalGroupMember -Group $GroupName -Member $includeMember -ErrorAction Stop + } + catch [System.Exception] + { + if ($_.CategoryInfo.Reason -ne 'MemberExistsException') + { + throw $_.Exception + } + } + } + } + + if($PSBoundParameters.ContainsKey('MembersToExclude')) + { + foreach($excludeMember in $MembersToExclude) + { + try + { + Remove-LocalGroupMember -Group $GroupName -Member $excludeMember -ErrorAction Stop + } + catch [System.Exception] + { + if ($_.CategoryInfo.Reason -ne 'MemberNotFoundException') + { + Throw-TerminatingError -ErrorRecord $_ + } + } + } + } + } + } + else + { + # Ensure is set to "Absent". + if($groupExists -eq $true) + { + # The group exists. Remove the group by the provided name. + Remove-LocalGroup -Name $GroupName + Write-Verbose -Message ($LocalizedData.GroupRemoved -f $GroupName) + } + else + { + Write-Verbose -Message ($LocalizedData.NoConfigurationRequiredGroupDoesNotExist -f $GroupName) + } + } +} + +<# +.Synopsis +The Test-TargetResource cmdlet for Nano Server images is used to validate if the resource is in a state as expected in the instance document. +#> +function Test-TargetResourceOnNanoServer +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $GroupName, + + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present", + + [System.String] + $Description, + + [System.String[]] + $Members, + + [System.String[]] + $MembersToInclude, + + [System.String[]] + $MembersToExclude, + + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $Credential + ) + + Set-StrictMode -Version Latest + + ValidateGroupName -GroupName $GroupName + + try + { + [Microsoft.PowerShell.Commands.LocalGroup] $group = Get-LocalGroup -Name $GroupName -ErrorAction Stop + } + catch [System.Exception] + { + if ($_.CategoryInfo.Reason -eq 'GroupNotFoundException') + { + # A group with the provided name does not exist. + Write-Log -Message ($LocalizedData.GroupDoesNotExist -f $GroupName) + + if($Ensure -eq "Absent") + { + return $true + } + else + { + return $false + } + } + Throw-TerminatingError -ErrorRecord $_ + } + + # A group with the provided name exists. + Write-Log -Message ($LocalizedData.GroupExists -f $GroupName) + + # Validate separate properties. + if($Ensure -eq "Absent") + { + Write-Log -Message ($LocalizedData.PropertyMismatch -f "Ensure", "Absent", "Present") + return $false # The Ensure property does not match. Return $false + } + + if($PSBoundParameters.ContainsKey('Description') -and $Description -ne $group.Description) + { + Write-Log -Message ($LocalizedData.PropertyMismatch -f "Description", $Description, $group.Description) + return $false # The Description property does not match. Return $false + } + + if($PSBoundParameters.ContainsKey('Members')) + { + Write-Verbose "Testing members..." + if($PSBoundParameters.ContainsKey('MembersToInclude') -or $PSBoundParameters.ContainsKey('MembersToExclude')) + { + # If Members are provided, Include and Exclude are not allowed. + ThrowInvalidArgumentError -ErrorId "GroupTestCmdlet_MembersPlusIncludeOrExcludeConflict" -ErrorMessage ($LocalizedData.MembersAndIncludeExcludeConflict -f "Members","MembersToInclude","MembersToExclude") + } + + if($Members -eq $null) + { + ThrowInvalidArgumentError -ErrorId "GroupTestCmdlet_MembersIsNull" -ErrorMessage ($LocalizedData.MembersIsNull -f "Members","MembersToInclude","MembersToExclude") + } + + # Remove duplicate names as strings. + $ExpectedMembers = [String[]]@(RemoveDuplicates -Members $Members) + + # Get current members + $CurrentMembers = EnumerateMembersOnNanoServer -Group $group + + if($ExpectedMembers.Length -ne $CurrentMembers.Length) + { + Write-Log -Message ($LocalizedData.MembersNumberMismatch -f "Members", $ExpectedMembers.Length, $CurrentMembers.Length) + return $false; # The number of provided unique group members is different from the number of actual group members. Return $false. + } + + # Compare two members lists. + foreach ($ExpectedMember in $ExpectedMembers) + { + $matchFound = $false + + foreach($groupMember in $CurrentMembers) + { + if($ExpectedMember -eq $groupMember) + { + $matchFound = $true + break; + } + } + + if(-not $matchFound) + { + Write-Log -Message ($LocalizedData.MembersMemberMismatch -f $expectedMember, "Members", $group.Name) + return $false # At least one element does not have a match. Return $false + } + } + } + else + { + # Get current members + $CurrentMembers = EnumerateMembersOnNanoServer -Group $group + + if($PSBoundParameters.ContainsKey('MembersToInclude')) + { + $MembersToInclude = [String[]]@(RemoveDuplicates -Members $MembersToInclude) + + # Check if every element in $membersToIncludePrincipals has a match in $group.Members. + # Compare two members lists. + foreach($expectedMember in $MembersToInclude) + { + $matchFound = $false + + foreach($groupMember in $CurrentMembers) + { + if($expectedMember -eq $groupMember) + { + $matchFound = $true + break + } + } + + if(-not $matchFound) + { + Write-Log -Message ($LocalizedData.MembersMemberMismatch -f $expectedMember, "MembersToInclude", $group.Name) + return $false # At least one element from $MembersToInclude does not have a match. Return $false + } + } + } + + if($PSBoundParameters.ContainsKey('MembersToExclude')) + { + $MembersToExclude = [String[]]@(RemoveDuplicates -Members $MembersToExclude); + + foreach($expectedMember in $MembersToExclude) + { + foreach($groupMember in $CurrentMembers) + { + if($expectedMember -eq $groupMember) + { + Write-Log -Message ($LocalizedData.MemberToExcludeMatch -f $expectedMember, "MembersToExclude", $group.Name) + return $false # At least one element from $MembersToExclude has a match. Return $false + } + } + } + } + } + + # All properties match. Return $true. + return $true; +} + +function RemoveDuplicates +{ + param + ( + [System.String[]] $Members + ) + + Set-StrictMode -Version Latest + + $destIndex = 0; + for([int] $sourceIndex = 0 ; $sourceIndex -lt $Members.Count; $sourceIndex++) + { + $matchFound = $false + for([int] $matchIndex = 0; $matchIndex -lt $destIndex; $matchIndex++) + { + if($Members[$sourceIndex] -eq $Members[$matchIndex]) + { + # A duplicate is found. Discard the duplicate. + $matchFound = $true + continue + } + } + + if(!$matchFound) + { + $Members[$destIndex++] = $Members[$sourceIndex].ToLowerInvariant(); + } + } + + # Create the output array. + $destination = New-Object System.String[] -ArgumentList $destIndex + + # Copy only distinct elements from the original array to the destination array. + [System.Array]::Copy($Members, $destination, $destIndex); + + if ($destIndex -gt 0) + { + return $destination + } + return [System.String[]]@() +} + +function EnumerateMembersOnNanoServer +{ + [OutputType([System.String[]])] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNull()] + [Microsoft.PowerShell.Commands.LocalGroup] + $Group + ) + + Set-StrictMode -Version Latest + [System.Collections.ArrayList] $members = New-Object System.Collections.ArrayList + + # Get the group members. + $groupmembers = Get-LocalGroupMember -Group $Group + + foreach($member in $groupmembers) + { + if ($member.PrincipalSource -eq "Local") + { + $null = $members.Add($member.Name.Substring($member.Name.IndexOf("\")+1)) + } + else + { + Write-Verbose "$($member.Name) is not a local user (PrincipalSource = $($member.PrincipalSource))" + } + } + + if ($members.Count -gt 0) + { + return $members.ToArray() + } + return ,([System.String[]]@()) +} + +function EnumerateMembersOnFullSKU +{ + [OutputType([System.String[]])] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNull()] + [System.DirectoryServices.AccountManagement.GroupPrincipal] + $group, + + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + $principalContexts, + + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + [System.Collections.ArrayList] + $disposables, + + [System.Net.NetworkCredential] + $credential = $null + ) + + Set-StrictMode -Version Latest + [System.Collections.ArrayList] $members = New-Object System.Collections.ArrayList + + # Get the group members as Principal objects. + [System.DirectoryServices.AccountManagement.Principal[]] $principals = ResolveGroupMembersToPrincipals -group $group -principalContexts $principalContexts -disposables $disposables -credential $credential + + foreach($principal in $principals) + { + if($principal.ContextType -eq [System.DirectoryServices.AccountManagement.ContextType]::Domain) + { + # Select only the first part of the full domain name. + [String]$domainName = $principal.Context.Name; + [int] $separatorIndex = $domainName.IndexOf('.') + if ($separatorIndex -ne -1) + { + $domainName = $domainName.Substring(0, $separatorIndex) + } + + if($principal.StructuralObjectClass -eq "computer") + { + $null = $members.Add($domainName+'\'+$principal.Name) + } + else + { + $null = $members.Add($domainName+'\'+$principal.SamAccountName) + } + } + else + { + $null = $members.Add($principal.Name) + } + } + + return $members.ToArray() +} + +<# +.Synopsis + Resolves the members of a group to Principal instances. +#> +function ResolveGroupMembersToPrincipals +{ + [OutputType([System.DirectoryServices.AccountManagement.Principal[]])] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNull()] + [System.DirectoryServices.AccountManagement.GroupPrincipal] + $group, + + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + $principalContexts, + + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + [System.Collections.ArrayList] + $disposables, + + [System.Net.NetworkCredential] + $credential = $null + ) + Set-StrictMode -Version latest + + [System.Collections.ArrayList] $principals = New-Object System.Collections.ArrayList + + # NOTE: This logic enumerates the group members using the underlying DirectoryEntry API. + # The reason this is needed is due to the fact that enumerating the group + # members as principal instances causes a resolve to occur. Since there is no + # facility for passing credentials to perform the resolution, any members that + # cannot be resolved using the current user will fail; such as when the DSC + # Group resource runs as system. Dropping down to the underyling API + # allows us to access the account's SID which can then be used to + # resolve the associated principal using explicit credentials. + [System.DirectoryServices.DirectoryEntry] $groupDe = $group.GetUnderlyingObject() + + $enum = $groupDe.Invoke("Members") + foreach ($item in $enum) + { + [string] $scope = $null + [string] $accountName = $null + [string] $machineName = $env:COMPUTERNAME + [System.DirectoryServices.AccountManagement.Principal] $principal = $null + + # extract the objectSid from the underlying DirectoryEntry + [System.DirectoryServices.DirectoryEntry] $entry = New-Object System.DirectoryServices.DirectoryEntry($item) + [byte[]] $sidBytes = $entry.Properties["objectSid"].Value + + $null = $disposables.Add($entry) + + [string[]] $parts = $entry.Path.Split("/") + + if ($parts.Count -eq 4) + { + # parsing WinNT://domainname/accountname + # or WinNT://machinename/accountname + $scope = $parts[2] + $accountName = $parts[3] + } + elseif ($parts.Count -eq 5) + { + # parsing WinNT://domainname/machinename/accountname + $scope = $parts[3] + $accountName = $parts[4] + } + else + { + # the account is stale either becuase it was deleted or + # the machine was moved to a new domain without removing + # the domain members from the group. + # If we consider this a fatal error, the group is no longer + # managable by the DSC resource. Writing a warning allows + # the operation to complete while leaving the stale member in the + # group. + Write-Warning -Message ($LocalizedData.MemberNotValid -f $entry.Path) + continue + } + + + [bool] $isLocalMachine = [System.String]::CompareOrdinal($scope, $machineName) -eq 0 + + $principalContext = GetPrincipalContext -principalContexts $principalContexts -disposables $disposables -scope $scope -credential $credential + + # if local machine qualified, get the PrincipalContext for the local machine + if ($isLocalMachine -eq $true) + { + Write-Verbose -Message ($LocalizedData.ResolvingLocalAccount -f $accountName) + } + # the account is domain qualified - credentials required to resolve it. + elseif ($credential -ne $null -or $principalContext -ne $null) + { + Write-Verbose -Message ($LocalizedData.ResolvingDomainAccount -f $scope, $accountName) + } + else + { + # The provided name is not scoped to the local machine and no credentials were provided. + # This is an unsupported use case; credentials are required to resolve off-box. + ThrowInvalidArgumentError -ErrorId "PrincipalNotFoundNoCredential" -ErrorMessage ($LocalizedData.DomainCredentialsRequired -f $accountName) + } + + # create a sid to enable comparison againt the expected member's sid. + [System.Security.Principal.SecurityIdentifier] $sid = New-Object System.Security.Principal.SecurityIdentifier($sidBytes, 0) + + $principal = ResolveSidToPrincipal -principalContext $principalContext -sid $sid -isLocalMachineQualified $isLocalMachine + $null = $principals.Add($principal) + $null = $disposables.Add($principal) + } + + return $principals.ToArray() +} + +<# +.Synopsis + Resolves an array of object names to Principal instances. +#> +function ResolveNamesToPrincipals +{ + param + ( + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + [String[]] $objectNames, + + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + [System.Collections.ArrayList] $disposables, + + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + $principalContexts, + + [System.Net.NetworkCredential] + $credential = $null + ) + Set-StrictMode -Version Latest + + [System.Collections.ArrayList] $principals = New-Object System.Collections.ArrayList + $keys = @{} + + foreach($objectName in $objectNames) + { + $principal = ResolveNameToPrincipal -principalContexts $principalContexts -credential $credential -disposables $disposables -objectName $objectName + if ($principal -ne $null) + { + [string] $key = $null + # handle duplicate entries + if ($principal.ContextType -eq [System.DirectoryServices.AccountManagement.ContextType]::Domain) + { + $key = $principal.DistinguishedName + } + else + { + $key = $principal.SamAccountName + } + if ($keys.ContainsKey($key) -eq $false) + { + $keys.Add($key, $null) + $null = $principals.Add($principal) + } + } + } + + $keys.Clear() + return $principals.ToArray() +} + +<# +.Synopsis + resolves an object name to a Principal +#> +function ResolveNameToPrincipal +{ + [OutputType([System.DirectoryServices.AccountManagement.Principal])] + param + ( + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + $principalContexts, + + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + $disposables, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] $objectName, + + [System.Net.NetworkCredential] + $credential = $null + + ) + Set-StrictMode -Version Latest + + [string] $accountName = $null + + # the scope of the the object name when in the form of scope\name, UPN, or DN + [string] $scope = Parse-Scope -fullName $objectName -accountName ([ref] $accountName) + + # check for an object qualified to the local machine + [bool] $isLocalMachine = IsLocalMachine $scope + + [System.DirectoryServices.AccountManagement.PrincipalContext] $principalContext = $null + [bool] $UseDomainTrust = $false + + # if local machine qualified, get the PrincipalContext for the local machine + if ($isLocalMachine -eq $true) + { + Write-Verbose -Message ($LocalizedData.ResolvingLocalAccount -f $objectName) + } + # the account is domain qualified - credentials provided to resolve it. + elseif ($credential -ne $null) + { + Write-Verbose -Message ($LocalizedData.ResolvingDomainAccount -f $ObjectName, $scope) + } + # no credentials provided to resolve account name, so try with domain trust + else + { + # The provided name is not scoped to the local machine and no credentials were provided. + # If the object is a domain qualified name, we can try to resolve the user with domain trust, if setup. + $UseDomainTrust = $true + Write-Verbose -Message ($LocalizedData.ResolvingDomainAccountWithTrust -f $objectName) + } + + # Get a PrincipalContext to use to resolve the object + $principalContext = GetPrincipalContext -principalContexts $principalContexts -disposables $disposables -scope $scope -credential $credential + + if ($UseDomainTrust) + { + # When using domain trust, we use the object name to resolve. Object name can be in different formats such as a domain + # qualified name, UPN, or a distinguished name for the scope + $account = $objectName + } + else + { + $account = $accountName + } + + try + { + [System.DirectoryServices.AccountManagement.Principal] $principal = [System.DirectoryServices.AccountManagement.Principal]::FindByIdentity($principalContext, $account) + } + catch [System.Runtime.InteropServices.COMException] + { + ThrowInvalidArgumentError -ErrorId "PrincipalNotFound" -ErrorMessage ( $LocalizedData.UnableToResolveAccount -f $objectName, $_.Exception.Message, $_.Exception.HResult ) + } + + if ($principal -eq $null) + { + [string] $errorId = $null + if ($isLocalMachine) + { + $errorId = "PrincipalNotFound_LocalMachine" + } + else + { + $errorId = "PrincipalNotFound_ProvidedCredential" + } + + ThrowInvalidArgumentError -ErrorId $errorId -ErrorMessage ($LocalizedData.CouldNotFindPrincipal -f $objectName) + } + + return $principal +} + +<# +.Synopsis + Resolves a SID to a principal +#> +function ResolveSidToPrincipal +{ + [OutputType([System.DirectoryServices.AccountManagement.Principal])] + param + ( + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + [System.DirectoryServices.AccountManagement.PrincipalContext] $principalContext, + + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + [System.Security.Principal.SecurityIdentifier] $sid, + + [Parameter(Mandatory = $true)] + [bool] $isLocalMachineQualified + ) + Set-StrictMode -Version Latest + + [string] $sidValue = $Sid.Value + + # Try to find a matching principal. + $principal = [System.DirectoryServices.AccountManagement.Principal]::FindByIdentity($principalContext, [System.DirectoryServices.AccountManagement.IdentityType]::Sid, $sidValue) + + if ($principal -eq $null) + { + [string] $errorId = $null + if ($isLocalMachineQualified) + { + $errorId = "PrincipalNotFound_LocalMachine" + } + else + { + $errorId = "PrincipalNotFound_ProvidedCredential" + } + + ThrowInvalidArgumentError -ErrorId $errorId -ErrorMessage ($LocalizedData.CouldNotFindPrincipal -f $sid.ToString()) + } + + return $principal +} + +<# +.Synopsis + Gets a PrincipalContext to use to resolve an object in the specified $scope + $principalContexts is a hashtable of scope to PrincipalContext. This is used to + cache PrincipalContext instances for cases where it is used multiple times. + disposables is an array of disposable objects. When a new PrincipalContext is + created, it is added to the disposable list as well as the hashtable. + $credential is used when a new PrincipalContext needs to be created with explicit + credentials to a target domain +#> +function GetPrincipalContext +{ + [OutputType([System.DirectoryServices.AccountManagement.PrincipalContext])] + param + ( + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + $principalContexts, + + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + $disposables, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [object] $scope, + + [System.Net.NetworkCredential] + $credential = $null + ) + + # The PrincipalContext to use to resolve the account + [System.DirectoryServices.AccountManagement.PrincipalContext] $principalContext = $null + + # check for an object qualified to the local machine + [bool] $isLocalMachine = [System.String]::Compare($env:COMPUTERNAME, $scope) -eq 0 + + if ($isLocalMachine) + { + # check for a cached PrincipalContext for the local machine. + if ($principalContexts.ContainsKey($env:COMPUTERNAME)) + { + $principalContext = $principalContexts[$env:COMPUTERNAME] + } + else + { + # Create a PrincipalContext for the local machine + $principalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::Machine) + + # Cache the PrincipalContext for this scope for subsequent calls. + $principalContexts.Add($env:COMPUTERNAME, $principalContext) + $null = $disposables.Add($principalContext) + } + } + elseif ($principalContexts.ContainsKey($scope)) + { + $principalContext = $principalContexts[$scope] + } + elseif ($credential -ne $null) + { + # Create a PrincipalContext targeing $scope using the network credentials that were passed in. + + $name = [System.String]::Format("{0}\{1}", $credential.Domain, $credential.UserName) + $principalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::Domain, $scope, $name, $credential.Password) + + # Cache the PrincipalContext for this scope for subsequent calls. + $principalContexts.Add($scope, $principalContext) + $null = $disposables.Add($principalContext) + } + else + { + # Get a PrincipalContext for the current user in the target domain (even for local System account). + $principalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::Domain, $scope) + + # Cache the PrincipalContext for this scope for subsequent calls. + $principalContexts.Add($scope, $principalContext) + $null = $disposables.Add($principalContext) + } + + return $principalContext +} + + +<# +.Synopsis + Adds the entries defined in $Principals from $Group.Members. + Returns $true if the members changed (i.e., members were added); + otherwise, $false if all of the entries in $Principals were already present + in $Group.Members +#>function AddGroupMembers +{ + [OutputType([bool])] + param + ( + [System.DirectoryServices.AccountManagement.GroupPrincipal] $Group, + + [System.DirectoryServices.AccountManagement.Principal[]] $Principals + ) + Set-StrictMode -Version Latest + [bool] $updated = $false + + if ($Principals -ne $null) + { + # Make changes to the group. + foreach($principal in $Principals) + { + if ($group.Members.Contains($principal)) + { + continue + } + $group.Members.Add($principal) + # indicate a change was made to $Group.Members + $updated = $true + } + } + return $updated +} + +<# +.Synopsis + Removes the entries defined in $Principals from $Group.Members. + Returns $true if the members changed (i.e., members were removed); + otherwise, $false if none of the entries in $Principals were present + in $Group.Members +#> +function RemoveGroupMembers +{ + [OutputType([bool])] + param + ( + [System.DirectoryServices.AccountManagement.GroupPrincipal] $Group, + + [System.DirectoryServices.AccountManagement.Principal[]] $Principals + ) + Set-StrictMode -Version Latest + [bool] $updated = $false + + if ($Principals -ne $null) + { + # Make changes to the group. + foreach($principal in $Principals) + { + if ($group.Members.Remove($principal) -eq $true) + { + # indicated a change was made to the members. + $updated = $true + } + } + } + + return $updated +} + +#region Utilities + +<# +.Synopsis + Determines if a scope represents the current machine. +#> +function IsLocalMachine +{ + [OutputType([bool])] + param + ( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + $scope + ) + Set-StrictMode -Version latest + + if ($scope -eq ".") + { + return $true + } + + if ($scope -eq $env:COMPUTERNAME) + { + return $true + } + + if ($scope -eq "localhost") + { + return $true + } + + if ($scope.Contains(".")) + { + if ($scope -eq "127.0.0.1") + { + return $true + } + + # Determine if we have an ip address that matches an ip address on one of the + # network adapters. + # NOTE: This is likely overkill; consider removing it. + $items = @(Get-WmiObject Win32_NetworkAdapterConfiguration) + foreach ($item in $items) + { + if ($item.IPaddress -ne $null) + { + foreach ($addr in $item.IPaddress) + { + if ($addr -eq $scope) + { + return $true + } + } + } + } + } + return $false +} + +<# +.Synopsis + Determines if a specified domain is the same as the domain defined in a PrincipalContext. + This is used to determine if a new connection (PrincipalContext) needs to be created. + +.Notes + This method uses simple string compare and simple parsing to perform the match and + should only be used to determine if a new connection is required since some + comparisons may returned $false due to formatting differences. +#> +function IsSameDomain +{ + [OutputType([bool])] + param + ( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [System.DirectoryServices.AccountManagement.PrincipalContext] $principalContext, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [String] $domain + ) + Set-StrictMode -Version latest + + # Compare against Name of $principalContext - typically the undecorated domain name + [bool] $isSameDomain = [System.String]::Compare($domain, $principalContext.Name, [System.StringComparison]::OrdinalIgnoreCase) -eq 0 + + if ($isSameDomain -eq $false) + { + $dotIndex = $principalContext.ConnectedServer.IndexOf(".") + if ($dotIndex -ne -1) + { + $principalDomain = $principalContext.ConnectedServer.Substring($dotIndex + 1) + $isSameDomain = [System.String]::Compare($domain, $principalDomain, [System.StringComparison]::OrdinalIgnoreCase) -eq 0 + } + } + + return $isSameDomain +} + +<# +.Synopsis + Parses various object name formats to extract the machine or domain scope. + + The returned $scope is used to determine where to perform the resolution, + the local machine or a target domain while $accountName is the name + of the account to resolve. + + The following details the formats that are handled as well as how the + values are determined. + + Domain qualified names (domainname\username) + + The value is split on the first '\' character with the left hand side + returned as the scope and the right hand side is returned as the account name. + + UPN: (username@domainname) + + The value is split on the first '@' character with the left hand side + returned as the account name and the right hand side returned + as the scope + + DistinguishedName: + + The value at the first occurance of "DC=" is used to extract the unqualified + domain name. The incoming string is returned, as is, for the account + name. + + Unqualified account names: + + The incoming string is returned as the account name and the local + machine name is returned as the scope. Note that values that do + not fall into the above categories are interpreted as unqualified + account names. + +.Notes + ResolveNameToPrincipal will fail if a machine name is specified + as domainname\machinename. It will succeed if the machine name + is specified as the SAM name (domainname\machinename$) or + as the unqualified machine name. + Parse-Scope splits the scope and account name to avoid + the problem. +#> +function Parse-Scope +{ + [OutputType([string])] + param + ( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + $fullName, + + [Parameter(Mandatory=$true)] + [AllowEmptyString()] + [AllowNull()] + [ref] $accountName + ) + Set-StrictMode -Version latest + + # assume no scope is defined or $fullName is a DistinguishedName + $accountName.Value = $fullName + + # parse domain or machine qualified account name + [int] $separatorIndex = $fullName.IndexOf("\") + if ($separatorIndex -ne -1) + { + $scope = $fullName.Substring(0, $separatorIndex) + if (IsLocalMachine $scope) + { + $scope = $env:COMPUTERNAME + } + $accountName.Value = $fullName.Substring($separatorIndex+1) + return $scope + } + + # parse UPN for the scope + $separatorIndex = $fullName.IndexOf("@") + if ($separatorIndex -ne -1) + { + $scope = $fullName.Substring($separatorIndex + 1) + $accountName.Value = $fullName.Substring(0,$separatorIndex) + return $scope + } + + # parse distinguished name for the scope + $separatorIndex = $fullName.IndexOf("DC=", [System.StringComparison]::OrdinalIgnoreCase) + if ($separatorIndex -ne -1) + { + # NOTE: For distinguished name formats, the DistinguishedName is + # returned as the account name. See the initialization of $accountName + # above. + $startIndex = $separatorIndex + 3 + $endIndex = $fullName.IndexOf(",", $startIndex) + if ($endIndex -gt $startIndex) + { + $length = $endIndex - $separatorIndex - 3 + $scope = $fullName.Substring($startIndex, $length) + return $scope + } + } + return $env:COMPUTERNAME +} + +<# +.Synopsis + Disposes the contents of an array list containing IDisposable objects. +#> +function DisposeAll +{ + param + ( + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + [AllowEmptyCollection()] + [System.Collections.ArrayList] + $disposables + ) + Set-StrictMode -Version latest + + if ($disposables.Count -gt 0) + { + foreach ($disposable in $disposables) + { + if ($disposable -is [System.IDisposable]) + { + $disposable.Dispose() + } + } + } +} + +<# +.Synopsis + Gets a local windows group + +.Notes + The returned value is NOT added to the $disposables list. +#> +function GetGroup +{ + [OutputType([System.DirectoryServices.AccountManagement.GroupPrincipal])] + param + ( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] $groupName, + + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + [System.Collections.ArrayList] + [AllowEmptyCollection()] + $disposables, + + [Parameter(Mandatory = $true)] + [AllowEmptyCollection()] + $principalContexts + ) + + [System.DirectoryServices.AccountManagement.PrincipalContext] $principalContext = GetPrincipalContext -principalContexts $principalContexts -disposables $disposables -scope $env:COMPUTERNAME -credential $null + [System.DirectoryServices.AccountManagement.GroupPrincipal] $group = [System.DirectoryServices.AccountManagement.GroupPrincipal]::FindByIdentity($principalContext, $groupName) + # NOTE: $group is not automatically added to $disposables because the caller + # may need to call $group.Delete() which also disposes it. + return $group +} + +<# +.Synopsis +Validates the Group name for invalid characters. +#> +function ValidateGroupName +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $GroupName + ) + + # Check if the name consists of only periods and/or white spaces. + [bool] $wrongName = $true + + for($i = 0; $i -lt $GroupName.Length; $i++) + { + if(-not [Char]::IsWhiteSpace($GroupName, $i) -and $GroupName[$i] -ne '.') + { + $wrongName = $false + break + } + } + + $invalidChars = @('\','/','"','[',']',':','|','<','>','+','=',';',',','?','*','@') + + if($wrongName) + { + ThrowInvalidArgumentError -ErrorId "GroupNameHasOnlyWhiteSpacesAndDots" -ErrorMessage ($LocalizedData.InvalidGroupName -f $GroupName, [string]::Join(" ", $invalidChars)) + } + + if($GroupName.IndexOfAny($invalidChars) -ne -1) + { + ThrowInvalidArgumentError -ErrorId "GroupNameHasInvalidCharachter" -ErrorMessage ($LocalizedData.InvalidGroupName -f $GroupName, [string]::Join(" ", $invalidChars)) + } +} + +<# +.Synopsis +Throws an argument error. +#> +function ThrowInvalidArgumentError +{ + [CmdletBinding()] + param + ( + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $ErrorId, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $ErrorMessage + ) + + $errorCategory=[System.Management.Automation.ErrorCategory]::InvalidArgument + $exception = New-Object System.ArgumentException $ErrorMessage; + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $ErrorId, $errorCategory, $null + throw $errorRecord +} + +Function Throw-TerminatingError +{ + param( + [string] $Message, + [System.Management.Automation.ErrorRecord] $ErrorRecord, + [string] $ExceptionType + ) + + $exception = new-object "System.InvalidOperationException" $Message,$ErrorRecord.Exception + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception,"MachineStateIncorrect","InvalidOperation",$null + throw $errorRecord +} + +<# +.Synopsis +Writes either to Verbose or ShouldProcess channel. +#> +function Write-Log +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Message + ) + + if ($PSCmdlet.ShouldProcess($Message, $null, $null)) + { + Write-Verbose $Message + } +} + +#endregion + +Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/MSFT_GroupResource.schema.mof b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/MSFT_GroupResource.schema.mof new file mode 100644 index 0000000..9481126 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/MSFT_GroupResource.schema.mof differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/ko-KR/MSFT_GroupResource.schema.mfl b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/ko-KR/MSFT_GroupResource.schema.mfl new file mode 100644 index 0000000..6d9e2a1 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/ko-KR/MSFT_GroupResource.schema.mfl differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/ko-KR/MSFT_GroupResource.strings.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/ko-KR/MSFT_GroupResource.strings.psd1 new file mode 100644 index 0000000..cc1d372 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_GroupResource/ko-KR/MSFT_GroupResource.strings.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_LogResource/MSFT_LogResource.schema.mof b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_LogResource/MSFT_LogResource.schema.mof new file mode 100644 index 0000000..9216888 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_LogResource/MSFT_LogResource.schema.mof @@ -0,0 +1,7 @@ +#pragma namespace("\\\\.\\root\\microsoft\\windows\\DesiredstateConfiguration") + +[ClassVersion("1.0.0"),FriendlyName("Log")] +class MSFT_LogResource : OMI_BaseResource +{ + [required] string Message; +}; diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_LogResource/ko-KR/MSFT_LogResource.schema.mfl b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_LogResource/ko-KR/MSFT_LogResource.schema.mfl new file mode 100644 index 0000000..6cc19d8 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_LogResource/ko-KR/MSFT_LogResource.schema.mfl differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/MSFT_PackageResource.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/MSFT_PackageResource.psm1 new file mode 100644 index 0000000..c0b606e --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/MSFT_PackageResource.psm1 @@ -0,0 +1,811 @@ +data LocalizedData +{ + # culture="en-US" + # TODO: Support WhatIf + ConvertFrom-StringData @' +InvalidIdentifyingNumber=The specified IdentifyingNumber ({0}) is not a valid Guid +InvalidPath=The specified Path ({0}) is not in a valid format. Valid formats are local paths, UNC, and HTTP +InvalidNameOrId=The specified Name ({0}) and IdentifyingNumber ({1}) do not match Name ({2}) and IdentifyingNumber ({3}) in the MSI file +NeedsMoreInfo=Either Name or ProductId is required +InvalidBinaryType=The specified Path ({0}) does not appear to specify an EXE or MSI file and as such is not supported +CouldNotOpenLog=The specified LogPath ({0}) could not be opened +CouldNotStartProcess=The process {0} could not be started +UnexpectedReturnCode=The return code {0} was not expected. Configuration is likely not correct +PathDoesNotExist=The given Path ({0}) could not be found +CouldNotOpenDestFile=Could not open the file {0} for writing +CouldNotGetHttpStream=Could not get the {0} stream for file {1} +ErrorCopyingDataToFile=Encountered error while writing the contents of {0} to {1} +PackageConfigurationComplete=Package configuration finished +PackageConfigurationStarting=Package configuration starting +InstalledPackage=Installed package +UninstalledPackage=Uninstalled package +NoChangeRequired=Package found in desired state, no action required +RemoveExistingLogFile=Remove existing log file +CreateLogFile=Create log file +MountSharePath=Mount share to get media +DownloadHTTPFile=Download the media over HTTP or HTTPS +StartingProcessMessage=Starting process {0} with arguments {1} +RemoveDownloadedFile=Remove the downloaded file +PackageInstalled=Package has been installed +PackageUninstalled=Package has been uninstalled +MachineRequiresReboot=The machine requires a reboot +PackageDoesNotAppearInstalled=The package {0} is not installed +PackageAppearsInstalled=The package {0} is installed +PostValidationError=Package from {0} was installed, but the specified ProductId and/or Name does not match package details +ValidateStandardArgumentsPathwasPath = Validate-StandardArguments, Path was {0} +TheurischemewasuriScheme = The uri scheme was {0} +ThepathextensionwaspathExt = The path extension was {0} +ParsingProductIdasanidentifyingNumber = Parsing {0} as an identifyingNumber +ParsedProductIdasidentifyingNumber = Parsed {0} as {1} +EnsureisEnsure = Ensure is {0} +productisproduct = product {0} found +productasbooleanis = product as boolean is {0} +Creatingcachelocation = Creating cache location +NeedtodownloadfilefromschemedestinationwillbedestName = Need to download file from {0}, destination will be {1} +Creatingthedestinationcachefile = Creating the destination cache file +Creatingtheschemestream = Creating the {0} stream +Settingdefaultcredential = Setting default credential +Settingauthenticationlevel = Setting authentication level +Ignoringbadcertificates = Ignoring bad certificates +Gettingtheschemeresponsestream = Getting the {0} response stream +ErrorOutString = Error: {0} +Copyingtheschemestreambytestothediskcache = Copying the {0} stream bytes to the disk cache +Redirectingpackagepathtocachefilelocation = Redirecting package path to cache file location +ThebinaryisanEXE = The binary is an EXE +Userhasrequestedloggingneedtoattacheventhandlerstotheprocess = User has requested logging, need to attach event handlers to the process +StartingwithstartInfoFileNamestartInfoArguments = Starting {0} with {1} +'@ +} + +Import-LocalizedData LocalizedData -filename PackageProvider.psd1 + + +$Debug = $true +Function Trace-Message +{ + param([string] $Message) + if($Debug) + { + Write-Verbose $Message + } +} + +$CacheLocation = "$env:ProgramData\Microsoft\Windows\PowerShell\Configuration\BuiltinProvCache\MSFT_PackageResource" + +Function Throw-InvalidArgumentException +{ + param( + [string] $Message, + [string] $ParamName + ) + + $exception = new-object System.ArgumentException $Message,$ParamName + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception,$ParamName,"InvalidArgument",$null + throw $errorRecord +} + +Function Throw-InvalidNameOrIdException +{ + param( + [string] $Message + ) + + $exception = new-object System.ArgumentException $Message + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception,"NameOrIdNotInMSI","InvalidArgument",$null + throw $errorRecord +} + +Function Throw-TerminatingError +{ + param( + [string] $Message, + [System.Management.Automation.ErrorRecord] $ErrorRecord + ) + + $exception = new-object "System.InvalidOperationException" $Message,$ErrorRecord.Exception + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception,"MachineStateIncorrect","InvalidOperation",$null + throw $errorRecord +} + +Function Validate-StandardArguments +{ + param( + $Path, + $ProductId, + $Name + ) + + Trace-Message ($LocalizedData.ValidateStandardArgumentsPathwasPath -f $Path) + $uri = $null + try + { + $uri = [uri] $Path + } + catch + { + Throw-InvalidArgumentException ($LocalizedData.InvalidPath -f $Path) "Path" + } + + if(-not @("file", "http", "https") -contains $uri.Scheme) + { + Trace-Message ($Localized.TheurischemewasuriScheme -f $uri.Scheme) + Throw-InvalidArgumentException ($LocalizedData.InvalidPath -f $Path) "Path" + } + + $pathExt = [System.IO.Path]::GetExtension($Path) + Trace-Message ($LocalizedData.ThepathextensionwaspathExt -f $pathExt) + if(-not @(".msi",".exe") -contains $pathExt.ToLower()) + { + Throw-InvalidArgumentException ($LocalizedData.InvalidBinaryType -f $Path) "Path" + } + + $identifyingNumber = $null + if(-not $Name -and -not $ProductId) + { + #It's a tossup here which argument to blame, so just pick ProductId to encourage customers to use the most efficient version + Throw-InvalidArgumentException ($LocalizedData.NeedsMoreInfo -f $Path) "ProductId" + } + elseif($ProductId) + { + try + { + Trace-Message ($LocalizedData.ParsingProductIdasanidentifyingNumber -f $ProductId) + $identifyingNumber = "{{{0}}}" -f [Guid]::Parse($ProductId).ToString().ToUpper() + Trace-Message ($LocalizedData.ParsedProductIdasidentifyingNumber -f $ProductId, $identifyingNumber) + } + catch + { + Throw-InvalidArgumentException ($LocalizedData.InvalidIdentifyingNumber -f $ProductId) $ProductId + } + } + + return $uri, $identifyingNumber +} + +Function Get-ProductEntry +{ + param + ( + [string] $Name, + [string] $IdentifyingNumber + ) + + $uninstallKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" + $uninstallKeyWow64 = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" + + if($IdentifyingNumber) + { + $keyLocation = "$uninstallKey\$identifyingNumber" + $item = Get-Item $keyLocation -EA SilentlyContinue + if(-not $item) + { + $keyLocation = "$uninstallKeyWow64\$identifyingNumber" + $item = Get-Item $keyLocation -EA SilentlyContinue + } + + return $item + } + + foreach($item in (Get-ChildItem -EA Ignore $uninstallKey, $uninstallKeyWow64)) + { + if($Name -eq (Get-LocalizableRegKeyValue $item "DisplayName")) + { + return $item + } + } + + return $null +} + +function Test-TargetResource +{ + param + ( + [ValidateSet("Present", "Absent")] + [string] $Ensure = "Present", + + [parameter(Mandatory = $true)] + [AllowEmptyString()] + [string] $Name, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] $Path, + + [parameter(Mandatory = $true)] + [AllowEmptyString()] + [string] $ProductId, + + [string] $Arguments, + + [pscredential] $Credential, + + [int[]] $ReturnCode, + + [string] $LogPath + ) + + $uri, $identifyingNumber = Validate-StandardArguments $Path $ProductId $Name + $product = Get-ProductEntry $Name $identifyingNumber + Trace-Message ($LocalizedData.EnsureisEnsure -f $Ensure) + if($product) + { + Trace-Message ($LocalizedData.productisproduct -f $product) + } + else + { + Trace-Message "product installation cannot be determined" + } + Trace-Message ($LocalizedData.productasbooleanis -f [boolean]$product) + $res = ($product -ne $null -and $Ensure -eq "Present") -or ($product -eq $null -and $Ensure -eq "Absent") + + if ($product -ne $null) + { + $name = Get-LocalizableRegKeyValue $product "DisplayName" + Write-Verbose ($LocalizedData.PackageAppearsInstalled -f $name) + } + else + { + $displayName = $null + if($Name) + { + $displayName = $Name + } + else + { + $displayName = $ProductId + } + + Write-Verbose ($LocalizedData.PackageDoesNotAppearInstalled -f $displayName) + } + + return $res +} + +function Get-LocalizableRegKeyValue +{ + param( + [object] $RegKey, + [string] $ValueName + ) + + $res = $RegKey.GetValue("{0}_Localized" -f $ValueName) + if(-not $res) + { + $res = $RegKey.GetValue($ValueName) + } + + return $res +} + +function Get-TargetResource +{ + param + ( + [parameter(Mandatory = $true)] + [AllowEmptyString()] + [string] $Name, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] $Path, + + [parameter(Mandatory = $true)] + [AllowEmptyString()] + [string] $ProductId + ) + + #If the user gave the ProductId then we derive $identifyingNumber + $uri, $identifyingNumber = Validate-StandardArguments $Path $ProductId $Name + + $localMsi = $uri.IsFile -and -not $uri.IsUnc + + $product = Get-ProductEntry $Name $identifyingNumber + + if(-not $product) + { + return @{ + Ensure = "Absent" + Name = $Name + ProductId = $identifyingNumber + Installed = $false + } + } + + #$identifyingNumber can still be null here (e.g. remote MSI with Name specified, local EXE) + #If the user gave a ProductId just pass it through, otherwise fill it from the product + if(-not $identifyingNumber) + { + $identifyingNumber = Split-Path -Leaf $product.Name + } + + $date = $product.GetValue("InstallDate") + if($date) + { + try + { + $date = "{0:d}" -f [DateTime]::ParseExact($date, "yyyyMMdd",[System.Globalization.CultureInfo]::CurrentCulture).Date + } + catch + { + $date = $null + } + } + + $publisher = Get-LocalizableRegKeyValue $product "Publisher" + $size = $product.GetValue("EstimatedSize") + if($size) + { + $size = $size/1024 + } + + $version = $product.GetValue("DisplayVersion") + $description = $product.GetValue("Comments") + $name = Get-LocalizableRegKeyValue $product "DisplayName" + return @{ + Ensure = "Present" + Name = $name + Path = $Path + InstalledOn = $date + ProductId = $identifyingNumber + Size = $size + Installed = $true + Version = $version + PackageDescription = $description + Publisher = $publisher + } +} + +Function Get-MsiTools +{ + if($script:MsiTools) + { + return $script:MsiTools + } + + $sig = @' + [DllImport("msi.dll", CharSet = CharSet.Unicode, PreserveSig = true, SetLastError = true, ExactSpelling = true)] + private static extern UInt32 MsiOpenPackageExW(string szPackagePath, int dwOptions, out IntPtr hProduct); + + [DllImport("msi.dll", CharSet = CharSet.Unicode, PreserveSig = true, SetLastError = true, ExactSpelling = true)] + private static extern uint MsiCloseHandle(IntPtr hAny); + + [DllImport("msi.dll", CharSet = CharSet.Unicode, PreserveSig = true, SetLastError = true, ExactSpelling = true)] + private static extern uint MsiGetPropertyW(IntPtr hAny, string name, StringBuilder buffer, ref int bufferLength); + + private static string GetPackageProperty(string msi, string property) + { + IntPtr MsiHandle = IntPtr.Zero; + try + { + var res = MsiOpenPackageExW(msi, 1, out MsiHandle); + if (res != 0) + { + return null; + } + + int length = 256; + var buffer = new StringBuilder(length); + res = MsiGetPropertyW(MsiHandle, property, buffer, ref length); + return buffer.ToString(); + } + finally + { + if (MsiHandle != IntPtr.Zero) + { + MsiCloseHandle(MsiHandle); + } + } + } + public static string GetProductCode(string msi) + { + return GetPackageProperty(msi, "ProductCode"); + } + + public static string GetProductName(string msi) + { + return GetPackageProperty(msi, "ProductName"); + } +'@ + $script:MsiTools = Add-Type -PassThru -Namespace Microsoft.Windows.DesiredStateConfiguration.PackageResource ` + -Name MsiTools -Using System.Text -MemberDefinition $sig + return $script:MsiTools +} + + +Function Get-MsiProductEntry +{ + param + ( + [string] $Path + ) + + if(-not (Test-Path -PathType Leaf $Path) -and ($fileExtension -ne ".msi")) + { + Throw-TerminatingError ($LocalizedData.PathDoesNotExist -f $Path) + } + + $tools = Get-MsiTools + + $pn = $tools::GetProductName($Path) + + $pc = $tools::GetProductCode($Path) + + return $pn,$pc +} + + +function Set-TargetResource +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [ValidateSet("Present", "Absent")] + [string] $Ensure = "Present", + + [parameter(Mandatory = $true)] + [AllowEmptyString()] + [string] $Name, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] $Path, + + [parameter(Mandatory = $true)] + [AllowEmptyString()] + [string] $ProductId, + + [string] $Arguments, + + [pscredential] $Credential, + + [int[]] $ReturnCode, + + [string] $LogPath + ) + + $ErrorActionPreference = "Stop" + + if (Test-TargetResource -Ensure $Ensure -Name $Name -Path $Path -ProductId $ProductId) + { + return + } + + $uri, $identifyingNumber = Validate-StandardArguments $Path $ProductId $Name + $product = Get-ProductEntry $Name $identifyingNumber + + #Path gets overwritten in the download code path. Retain the user's original Path in case the install succeeded + #but the named package wasn't present on the system afterward so we can give a better message + $OrigPath = $Path + + Write-Verbose $LocalizedData.PackageConfigurationStarting + if(-not $ReturnCode) + { + # return code 1641 and 3010 are succeed indication when restart is requested per installation + $ReturnCode = @(0, 1641, 3010) + } + + $logStream = $null + $psdrive = $null + $downloadedFileName = $null + try + { + $fileExtension = [System.IO.Path]::GetExtension($Path).ToLower() + if($LogPath) + { + try + { + if($fileExtension -eq ".msi") + { + #We want to pre-verify the path exists and is writable ahead of time + #even in the MSI case, as detecting WHY the MSI log doesn't exist would + #be rather problematic for the user + if((Test-Path $LogPath) -and $PSCmdlet.ShouldProcess($LocalizedData.RemoveExistingLogFile,$null,$null)) + { + rm $LogPath + } + + if($PSCmdlet.ShouldProcess($LocalizedData.CreateLogFile, $null, $null)) + { + New-Item -Type File $LogPath | Out-Null + } + } + elseif($PSCmdlet.ShouldProcess($LocalizedData.CreateLogFile, $null, $null)) + { + $logStream = new-object "System.IO.StreamWriter" $LogPath,$false + } + } + catch + { + Throw-TerminatingError ($LocalizedData.CouldNotOpenLog -f $LogPath) $_ + } + } + + #Download or mount file as necessary + if(-not ($fileExtension -eq ".msi" -and $Ensure -eq "Absent")) + { + if($uri.IsUnc -and $PSCmdlet.ShouldProcess($LocalizedData.MountSharePath, $null, $null)) + { + $psdriveArgs = @{Name=([guid]::NewGuid());PSProvider="FileSystem";Root=(Split-Path $uri.LocalPath)} + if($Credential) + { + #We need to optionally include these and then splat the hash otherwise + #we pass a null for Credential which causes the cmdlet to pop a dialog up + $psdriveArgs["Credential"] = $Credential + } + + $psdrive = New-PSDrive @psdriveArgs + $Path = Join-Path $psdrive.Root (Split-Path -Leaf $uri.LocalPath) #Necessary? + } + elseif(@("http", "https") -contains $uri.Scheme -and $Ensure -eq "Present" -and $PSCmdlet.ShouldProcess($LocalizedData.DownloadHTTPFile, $null, $null)) + { + $scheme = $uri.Scheme + $outStream = $null + $responseStream = $null + + try + { + Trace-Message ($LocalizedData.Creatingcachelocation) + + if(-not (Test-Path -PathType Container $CacheLocation)) + { + mkdir $CacheLocation | Out-Null + } + + $destName = Join-Path $CacheLocation (Split-Path -Leaf $uri.LocalPath) + + Trace-Message ($LocalizedData.NeedtodownloadfilefromschemedestinationwillbedestName -f $scheme, $destName) + + try + { + Trace-Message ($LocalizedData.Creatingthedestinationcachefile) + $outStream = New-Object System.IO.FileStream $destName, "Create" + } + catch + { + #Should never happen since we own the cache directory + Throw-TerminatingError ($LocalizedData.CouldNotOpenDestFile -f $destName) $_ + } + + try + { + Trace-Message ($LocalizedData.Creatingtheschemestream -f $scheme) + $request = [System.Net.WebRequest]::Create($uri) + Trace-Message ($LocalizedData.Settingdefaultcredential) + $request.Credentials = [System.Net.CredentialCache]::DefaultCredentials + if ($scheme -eq "http") + { + Trace-Message ($LocalizedData.Settingauthenticationlevel) + # default value is MutualAuthRequested, which applies to https scheme + $request.AuthenticationLevel = [System.Net.Security.AuthenticationLevel]::None + } + if ($scheme -eq "https") + { + Trace-Message ($LocalizedData.Ignoringbadcertificates) + $request.ServerCertificateValidationCallBack = {$true} + } + Trace-Message ($LocalizedData.Gettingtheschemeresponsestream -f $scheme) + $responseStream = (([System.Net.HttpWebRequest]$request).GetResponse()).GetResponseStream() + } + catch + { + Trace-Message ($LocalizedData.ErrorOutString -f ($_ | Out-String)) + Throw-TerminatingError ($LocalizedData.CouldNotGetHttpStream -f $scheme, $Path) $_ + } + + try + { + Trace-Message ($LocalizedData.Copyingtheschemestreambytestothediskcache -f $scheme) + $responseStream.CopyTo($outStream) + $responseStream.Flush() + $outStream.Flush() + } + catch + { + Trace-Message ($LocalizedData.ErrorOutString -f ($_ | Out-String)) + Throw-TerminatingError ($LocalizedData.ErrorCopyingDataToFile -f $Path,$destName) $_ + } + } + finally + { + if($outStream) + { + $outStream.Close() + } + + if($responseStream) + { + $responseStream.Close() + } + } + Trace-Message ($LocalizedData.Redirectingpackagepathtocachefilelocation) + $Path = $downloadedFileName = $destName + } + } + + #At this point the Path ought to be valid unless it's an MSI uninstall case + if(-not (Test-Path -PathType Leaf $Path) -and -not ($Ensure -eq "Absent" -and $fileExtension -eq ".msi")) + { + Throw-TerminatingError ($LocalizedData.PathDoesNotExist -f $Path) + } + + $startInfo = New-Object System.Diagnostics.ProcessStartInfo + $startInfo.UseShellExecute = $false #Necessary for I/O redirection and just generally a good idea + $process = New-Object System.Diagnostics.Process + $process.StartInfo = $startInfo + $errLogPath = $LogPath + ".err" #Concept only, will never touch disk + + if($fileExtension -eq ".msi") + { + $startInfo.FileName = "$env:windir\system32\msiexec.exe" + if($Ensure -eq "Present") + { + # check if Msi package contains the ProductName and Code specified + + $pName,$pCode = Get-MsiProductEntry -Path $Path + + if ( + ( (-not [String]::IsNullOrEmpty($Name)) -and ($pName -ne $Name)) ` + -or ( (-not [String]::IsNullOrEmpty($identifyingNumber)) -and ($identifyingNumber -ne $pCode)) + ) + { + Throw-InvalidNameOrIdException ($LocalizedData.InvalidNameOrId -f $Name,$identifyingNumber,$pName,$pCode) + } + + $startInfo.Arguments = '/i "{0}"' -f $Path + } + else + { + $id = Split-Path -Leaf $product.Name #We may have used the Name earlier, now we need the actual ID + $startInfo.Arguments = ("/x{0}" -f $id) + } + + if($LogPath) + { + $startInfo.Arguments += ' /log "{0}"' -f $LogPath + } + + $startInfo.Arguments += " /quiet" + + if($Arguments) + { + $startInfo.Arguments += " " + $Arguments + } + } + else #EXE + { + Trace-Message ($LocalizedData.ThebinaryisanEXE) + if($Ensure -eq "Present") + { + $startInfo.FileName = $Path + $startInfo.Arguments = $Arguments + if($LogPath) + { + Trace-Message ($LocalizedData.Userhasrequestedloggingneedtoattacheventhandlerstotheprocess) + $startInfo.RedirectStandardError = $true + $startInfo.RedirectStandardOutput = $true + Register-ObjectEvent -InputObject $process -EventName "OutputDataReceived" -SourceIdentifier $LogPath + Register-ObjectEvent -InputObject $process -EventName "ErrorDataReceived" -SourceIdentifier $errLogPath + } + } else { + # Absent case + $startInfo.FileName = "$env:windir\system32\msiexec.exe" + $id = Split-Path -Leaf $product.Name + $startInfo.Arguments = ("/x{0} /quiet" -f $id) + # Never let the msiexec to restart automatically, DSC should handle reboot requests + $startInfo.Arguments += ' /norestart' + if($LogPath) + { + $startInfo.Arguments += ' /log "{0}"' -f $LogPath + } + + if($Arguments) + { + $startInfo.Arguments += " " + $Arguments + } + } + } + + Trace-Message ($LocalizedData.StartingwithstartInfoFileNamestartInfoArguments -f $startInfo.FileName, $startInfo.Arguments) + + if($PSCmdlet.ShouldProcess(($LocalizedData.StartingProcessMessage -f $startInfo.FileName, $startInfo.Arguments), $null, $null)) + { + try + { + $exitcode = 0 + $process.Start() | Out-Null + if($logStream) #Identical to $fileExtension -eq ".exe" -and $logPath + { + $process.BeginOutputReadLine(); + $process.BeginErrorReadLine(); + } + + $process.WaitForExit() + + if($process) + { + $exitCode = $process.ExitCode + } + + } + catch + { + Throw-TerminatingError ($LocalizedData.CouldNotStartProcess -f $Path) $_ + } + + + if($logStream) + { + #We have to re-mux these since they appear to us as different streams + #The underlying Win32 APIs prevent this problem, as would constructing a script + #on the fly and executing it, but the former is highly problematic from PowerShell + #and the latter doesn't let us get the return code for UI-based EXEs + $outputEvents = Get-Event -SourceIdentifier $LogPath + $errorEvents = Get-Event -SourceIdentifier $errLogPath + $masterEvents = @() + $outputEvents + $errorEvents + $masterEvents = $masterEvents | Sort-Object -Property TimeGenerated + + foreach($event in $masterEvents) + { + $logStream.Write($event.SourceEventArgs.Data); + } + + Remove-Event -SourceIdentifier $LogPath + Remove-Event -SourceIdentifier $errLogPath + } + + if(-not ($ReturnCode -contains $exitCode)) + { + Throw-TerminatingError ($LocalizedData.UnexpectedReturnCode -f $exitCode.ToString()) + } + } + } + finally + { + if($psdrive) + { + Remove-PSDrive -Force $psdrive + } + + if($logStream) + { + $logStream.Dispose() + } + } + + if($downloadedFileName -and $PSCmdlet.ShouldProcess($LocalizedData.RemoveDownloadedFile, $null, $null)) + { + #This is deliberately not in the Finally block. We want to leave the downloaded file on disk + #in the error case as a debugging aid for the user + rm $downloadedFileName + } + + $operationString = $LocalizedData.PackageUninstalled + if($Ensure -eq "Present") + { + $operationString = $LocalizedData.PackageInstalled + } + + # Check if reboot is required, if so notify CA. The MSFT_ServerManagerTasks provider is missing on client SKUs (Worked on both Server and Client Skus as in windows 10) + $featureData = invoke-wmimethod -EA Ignore -Name GetServerFeature -namespace root\microsoft\windows\servermanager -Class MSFT_ServerManagerTasks + $regData = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" "PendingFileRenameOperations" -EA Ignore + if(($featureData -and $featureData.RequiresReboot) -or $regData -or $exitcode -eq 3010 -or $exitcode -eq 1641) + { + Write-Verbose $LocalizedData.MachineRequiresReboot + $global:DSCMachineStatus = 1 + } + + if($Ensure -eq "Present") + { + $productEntry = Get-ProductEntry $Name $identifyingNumber + if(-not $productEntry) + { + Throw-TerminatingError ($LocalizedData.PostValidationError -f $OrigPath) + } + } + + Write-Verbose $operationString + Write-Verbose $LocalizedData.PackageConfigurationComplete +} + +Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/MSFT_PackageResource.schema.mof b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/MSFT_PackageResource.schema.mof new file mode 100644 index 0000000..d30eee9 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/MSFT_PackageResource.schema.mof differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/ko-KR/MSFT_PackageResource.schema.mfl b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/ko-KR/MSFT_PackageResource.schema.mfl new file mode 100644 index 0000000..ae86e29 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/ko-KR/MSFT_PackageResource.schema.mfl differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/ko-KR/PackageProvider.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/ko-KR/PackageProvider.psd1 new file mode 100644 index 0000000..6839d15 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_PackageResource/ko-KR/PackageProvider.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/MSFT_ProcessResource.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/MSFT_ProcessResource.psm1 new file mode 100644 index 0000000..32438d2 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/MSFT_ProcessResource.psm1 @@ -0,0 +1,722 @@ +data LocalizedData +{ + # culture="en-US" + ConvertFrom-StringData @' +FileNotFound=File not found in the environment path. +AbsolutePathOrFileName=Absolute path or file name expected. +InvalidArgument=Invalid argument: '{0}' with value: '{1}'. +InvalidArgumentAndMessage={0} {1} +ProcessStarted=Process matching path '{0}' started +ProcessesStopped=Proceses matching path '{0}' with Ids '({1})' stopped. +ProcessAlreadyStarted=Process matching path '{0}' found running and no action required. +ProcessAlreadyStopped=Process matching path '{0}' not found running and no action required. +ErrorStopping=Failure stopping processes matching path '{0}' with IDs '({1})'. Message: {2}. +ErrorStarting=Failure starting process matching path '{0}'. Message: {1}. +StartingProcessWhatif=Start-Process +ProcessNotFound=Process matching path '{0}' not found +PathShouldBeAbsolute=The path should be absolute +PathShouldExist=The path should exist +ParameterShouldNotBeSpecified=Parameter {0} should not be specified. +FailureWaitingForProcessesToStart=Failed to wait for processes to start +FailureWaitingForProcessesToStop=Failed to wait for processes to stop +ErrorParametersNotSupportedWithCredential=Can't specify StandardOutputPath, StandardInputPath or WorkingDirectory when trying to run a process under a user context. +VerboseInProcessHandle=In process handle {0} +ErrorRunAsCredentialParameterNotSupported= The PsDscRunAsCredential parameter is not supported by the Process resource. To start the process with user '{0}', add the Credential parameter. +ErrorCredentialParameterNotSupportedWithRunAsCredential= The PsDscRunAsCredential parameter is not supported by the Process resource, and cannot be used with the Credential parameter. To start the process with user '{0}', use only the Credential parameter, not the PsDscRunAsCredential parameter. +'@ +} + +Import-LocalizedData LocalizedData -filename MSFT_ProcessResource.strings.psd1 + +Import-Module "$PSScriptRoot\..\RunAsHelper.psm1" + +function ExtractArguments($functionBoundParameters,[string[]]$argumentNames,[string[]]$newArgumentNames) +{ + $returnValue=@{} + for($i=0;$i -lt $argumentNames.Count;$i++) + { + $argumentName=$argumentNames[$i] + + if($newArgumentNames -eq $null) + { + $newArgumentName=$argumentName + } + else + { + $newArgumentName=$newArgumentNames[$i] + } + + if($functionBoundParameters.ContainsKey($argumentName)) + { + $null=$returnValue.Add($newArgumentName,$functionBoundParameters[$argumentName]) + } + } + + return $returnValue +} + +function IsRunFromLocalSystemUser() +{ + (New-Object Security.Principal.WindowsPrincipal ( [Security.Principal.WindowsIdentity]::GetCurrent())).Identity.IsSystem +} + +function Get-TargetResource +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Path, + + [parameter(Mandatory = $true)] + [AllowEmptyString()] + [System.String] + $Arguments, + + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $Credential + ) + + $Path=(ResolvePath $Path) + $PSBoundParameters["Path"] = $Path + $getArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") + $processes = @(GetWin32_Process @getArguments) + + if($processes.Count -eq 0) + { + return @{ + Path=$Path + Arguments=$Arguments + Ensure='Absent' + } + } + + foreach($process in $processes) + { + # in case the process was killed between GetWin32_Process and this point, we should + # ignore errors which will generate empty entries in the return + $gpsProcess = (get-process -id $process.ProcessId -ErrorAction Ignore) + + @{ + Path=$process.Path + Arguments=(GetProcessArgumentsFromCommandLine $process.CommandLine) + PagedMemorySize=$gpsProcess.PagedMemorySize64 + NonPagedMemorySize=$gpsProcess.NonpagedSystemMemorySize64 + VirtualMemorySize=$gpsProcess.VirtualMemorySize64 + HandleCount=$gpsProcess.HandleCount + Ensure='Present' + ProcessId=$process.ProcessId + } + } +} + + +function Set-TargetResource +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Path, + + [parameter(Mandatory = $true)] + [AllowEmptyString()] + [System.String] + $Arguments, + + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $Credential, + + [System.String] + [ValidateSet("Present", "Absent")] + $Ensure="Present", + + [System.String] + $StandardOutputPath, + + [System.String] + $StandardErrorPath, + + [System.String] + $StandardInputPath, + + [System.String] + $WorkingDirectory + ) + + $Path=ResolvePath $Path + $PSBoundParameters["Path"] = $Path + $getArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") + $processes = @(GetWin32_Process @getArguments) + + if($Ensure -eq 'Absent') + { + "StandardOutputPath","StandardErrorPath","StandardInputPath","WorkingDirectory" | AssertParameterIsNotSpecified $PSBoundParameters + + if ($processes.Count -gt 0) + { + $processIds=$processes.ProcessId + + $err=Stop-Process -Id $processIds -force 2>&1 + + if($err -eq $null) + { + Write-Log ($LocalizedData.ProcessesStopped -f $Path,($processIds -join ",")) + } + else + { + Write-Log ($LocalizedData.ErrorStopping -f $Path,($processIds -join ","),($err | out-string)) + throw $err + } + + # Before returning from Set-TargetResource we have to ensure a subsequent Test-TargetResource is going to work + if (!(WaitForProcessCount @getArguments -waitCount 0)) + { + $message = $LocalizedData.ErrorStopping -f $Path,($processIds -join ","),$LocalizedData.FailureWaitingForProcessesToStop + Write-Log $message + ThrowInvalidArgumentError "FailureWaitingForProcessesToStop" $message + } + } + else + { + Write-Log ($LocalizedData.ProcessAlreadyStopped -f $Path) + } + } + else + { + "StandardInputPath","WorkingDirectory" | AssertAbsolutePath $PSBoundParameters -Exist + "StandardOutputPath","StandardErrorPath" | AssertAbsolutePath $PSBoundParameters + + if ($processes.Count -eq 0) + { + $startArguments = ExtractArguments $PSBoundParameters ` + ("Path", "Arguments", "Credential", "StandardOutputPath", "StandardErrorPath", "StandardInputPath", "WorkingDirectory") ` + ("FilePath", "ArgumentList", "Credential", "RedirectStandardOutput", "RedirectStandardError", "RedirectStandardInput", "WorkingDirectory") + + if([string]::IsNullOrEmpty($Arguments)) + { + $null=$startArguments.Remove("ArgumentList") + } + + if($PSCmdlet.ShouldProcess($Path,$LocalizedData.StartingProcessWhatif)) + { + # + # Start-Process calls .net Process.Start() + # If -Credential is present Process.Start() uses win32 api CreateProcessWithLogonW http://msdn.microsoft.com/en-us/library/0w4h05yb(v=vs.110).aspx + # CreateProcessWithLogonW cannot be called as LocalSystem user. + # Details http://msdn.microsoft.com/en-us/library/windows/desktop/ms682431(v=vs.85).aspx (section Remarks/Windows XP with SP2 and Windows Server 2003) + # + # In this case we call another api. + # + if($PSBoundParameters.ContainsKey("Credential") -and (IsRunFromLocalSystemUser)) + { + if($PSBoundParameters.ContainsKey("StandardOutputPath") -or $PSBoundParameters.ContainsKey("StandardInputPath") -or $PSBoundParameters.ContainsKey("WorkingDirectory")) + { + $exception = New-Object System.ArgumentException $LocalizedData.ErrorParametersNotSupportedWithCredential + $err = New-Object System.Management.Automation.ErrorRecord $exception, "InvalidCombinationOfArguments", InvalidArgument, $null + } + else + { + $Domain, $UserName = Get-DomainAndUserName $Credential + try + { + # + # Internally we use win32 api LogonUser() with dwLogonType == LOGON32_LOGON_NETWORK_CLEARTEXT. + # It grants process ability for second-hop. + # + Import-DscNativeMethods + [PSDesiredStateConfiguration.NativeMethods]::CreateProcessAsUser( "$Path $Arguments", $Domain, $UserName, $Credential.Password, $false, [ref] $null ) + } + catch + { + throw New-Object System.Management.Automation.ErrorRecord $_.Exception, "Win32Exception", OperationStopped, $null + } + } + } + else + { + $err=Start-Process @startArguments 2>&1 + } + if($err -eq $null) + { + Write-Log ($LocalizedData.ProcessStarted -f $Path) + } + else + { + Write-Log ($LocalizedData.ErrorStarting -f $Path,($err | Out-String)) + throw $err + } + + # Before returning from Set-TargetResource we have to ensure a subsequent Test-TargetResource is going to work + if (!(WaitForProcessCount @getArguments -waitCount 1)) + { + $message = $LocalizedData.ErrorStarting -f $Path,$LocalizedData.FailureWaitingForProcessesToStart + Write-Log $message + ThrowInvalidArgumentError "FailureWaitingForProcessesToStart" $message + } + } + } + else + { + Write-Log ($LocalizedData.ProcessAlreadyStarted -f $Path) + } + } +} + +function Test-TargetResource +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Path, + + [parameter(Mandatory = $true)] + [AllowEmptyString()] + [System.String] + $Arguments, + + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $Credential, + + [System.String] + [ValidateSet("Present", "Absent")] + $Ensure="Present", + + [System.String] + $StandardOutputPath, + + [System.String] + $StandardErrorPath, + + [System.String] + $StandardInputPath, + + [System.String] + $WorkingDirectory + ) + + if($PsDscContext.RunAsUser) + { + if($PSBoundParameters.ContainsKey("Credential")) + { + $exception = New-Object System.ArgumentException ($LocalizedData.ErrorCredentialParameterNotSupportedWithRunAsCredential -f $PsDscContext.RunAsUser) + $err = New-Object System.Management.Automation.ErrorRecord $exception, "InvalidArgument", InvalidArgument, $null + } + else + { + $exception = New-Object System.ArgumentException ($LocalizedData.ErrorRunAsCredentialParameterNotSupported -f $PsDscContext.RunAsUser) + $err = New-Object System.Management.Automation.ErrorRecord $exception, "InvalidCombinationOfArguments", InvalidArgument, $null + } + + Write-Log ($LocalizedData.ErrorStarting -f $Path,($err | Out-String)) + throw $err + } + + $Path=ResolvePath $Path + $PSBoundParameters["Path"] = $Path + $getArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") + $processes = @(GetWin32_Process @getArguments) + + + if($Ensure -eq 'Absent') + { + return ($processes.Count -eq 0) + } + else + { + return ($processes.Count -gt 0) + } +} + +function GetWin32ProcessOwner +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNull()] + $process + ) + + # if the process was killed by the time this is called, GetOwner + # will throw a WMIMethodException "Not found" + try + { + $owner = Invoke-CimMethod -InputObject $process -MethodName GetOwner + } + catch + { + } + + if($owner.Domain -ne $null) + { + return $owner.Domain + "\" + $owner.User + } + else + { + return $owner.User + } +} + +function WaitForProcessCount +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Path, + + [System.String] + $Arguments, + + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $Credential, + + [parameter(Mandatory=$true)] + $waitCount + ) + + $start = [DateTime]::Now + do + { + $getArguments = ExtractArguments $PSBoundParameters ("Path","Arguments","Credential") + $value = @(GetWin32_Process @getArguments).Count -eq $waitCount + } while(!$value -and ([DateTime]::Now - $start).TotalMilliseconds -lt 2000) + + return $value +} + +function GetWin32_Process +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Path, + + [System.String] + $Arguments, + + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $Credential, + + $useWmiObjectCount=8 + ) + + + + $fileName = [io.path]::GetFileNameWithoutExtension($Path) + + $gpsProcesses = @(get-process -Name $fileName -ErrorAction SilentlyContinue) + + if($gpsProcesses.Count -ge $useWmiObjectCount) + { + # if there are many processes it is faster to perform a Get-WmiObject + # in order to get Win32_Process objects for all processes + $Path=WQLEscape $Path + $filter = "ExecutablePath = '$Path'" + $processes = Get-CimInstance Win32_Process -Filter $filter + } + else + { + # if there are few processes, building a Win32_Process for + # each matching result of get-process is faster + $processes = foreach($gpsProcess in $gpsProcesses) + { + if(!($gpsProcess.Path -ieq $Path)) + { + continue + } + + try + { + Write-Verbose ($LocalizedData.VerboseInProcessHandle -f $gpsProcess.Id) + Get-CimInstance Win32_Process -Filter "ProcessId=$($gpsProcess.Id)" + } + catch + { + #ignore if could not retrieve process + } + } + } + + if($PSBoundParameters.ContainsKey('Credential')) + { + $Domain, $UserName = Get-DomainAndUserName $Credential + # Since there are credentials we need to call the GetOwner method in each process to search for matches + $processes = $processes | where { (GetWin32ProcessOwner $_) -eq "$Domain\$UserName" } + + } + + if($Arguments -eq $null) {$Arguments = ""} + $processes = $processes | where { (GetProcessArgumentsFromCommandLine $_.CommandLine) -eq $Arguments } + + return $processes +} + +<# +.Synopsis + Strips the Arguments part of a commandLine. In "c:\temp\a.exe X Y Z" the Arguments part is "X Y Z". +#> +function GetProcessArgumentsFromCommandLine +{ + param + ( + [System.String] + $commandLine + ) + + if($commandLine -eq $null) + { + return "" + } + + $commandLine=$commandLine.Trim() + + if($commandLine.Length -eq 0) + { + return "" + } + + if($commandLine[0] -eq '"') + { + $charToLookfor=[char]'"' + } + else + { + $charToLookfor=[char]' ' + } + + $endofCommand=$commandLine.IndexOf($charToLookfor ,1) + if($endofCommand -eq -1) + { + return "" + } + + return $commandLine.Substring($endofCommand+1).Trim() +} + +<# +.Synopsis + Escapes a string to be used in a WQL filter as the one passed to get-wmiobject +#> +function WQLEscape +{ + param + ( + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $query + ) + + return $query.Replace("\","\\").Replace('"','\"').Replace("'","\'") +} + +function ThrowInvalidArgumentError +{ + [CmdletBinding()] + param + ( + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $errorId, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $errorMessage + ) + + $errorCategory=[System.Management.Automation.ErrorCategory]::InvalidArgument + $exception = New-Object System.ArgumentException $errorMessage; + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null + throw $errorRecord +} + +function ResolvePath +{ + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Path + ) + + $Path = [Environment]::ExpandEnvironmentVariables($Path) + + if(IsRootedPath $Path) + { + if(!(Test-Path $Path -PathType Leaf)) + { + ThrowInvalidArgumentError "CannotFindRootedPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) + } + + return $Path + } + + if([string]::IsNullOrEmpty($env:Path)) + { + ThrowInvalidArgumentError "EmptyEnvironmentPath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) + } + + # This will block relative paths. The statement is only true id $Path contains a plain file name. + # Checking a relative path against segments of the $env:Path does not make sense + if((Split-Path $Path -Leaf) -ne $Path) + { + ThrowInvalidArgumentError "NotAbsolutePathOrFileName" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.AbsolutePathOrFileName) + } + + foreach($rawSegment in $env:Path.Split(";")) + { + $segment = [Environment]::ExpandEnvironmentVariables($rawSegment) + + # if an exception causes $segmentedRooted not to be set, we will consider it $false + $segmentRooted = $false + try + { + # If the whole path passed through [IO.Path]::IsPathRooted with no exceptions, it does not have + # invalid characters, so segment has no invalid characters and will not throw as well + $segmentRooted=[IO.Path]::IsPathRooted($segment) + } + catch {} + + if(!$segmentRooted) + { + continue + } + + $candidate = join-path $segment $Path + + if(Test-Path $candidate -PathType Leaf) + { + return $candidate + } + } + + ThrowInvalidArgumentError "CannotFindRelativePath" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $LocalizedData.FileNotFound) +} + + +function AssertAbsolutePath +{ + [CmdletBinding()] + param + ( + $ParentBoundParameters, + + [System.String] + [Parameter (ValueFromPipeline=$true)] + $ParameterName, + + [switch] + $Exist + ) + + Process + { + if(!$ParentBoundParameters.ContainsKey($ParameterName)) + { + return + } + + $path=$ParentBoundParameters[$ParameterName] + + if(!(IsRootedPath $Path)) + { + ThrowInvalidArgumentError "PathShouldBeAbsolute" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f $ParameterName,$Path), + $LocalizedData.PathShouldBeAbsolute) + } + + if(!$Exist.IsPresent) + { + return + } + + if(!(Test-Path $Path)) + { + ThrowInvalidArgumentError "PathShouldExist" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f $ParameterName,$Path), + $LocalizedData.PathShouldExist) + } + } +} + +function AssertParameterIsNotSpecified +{ + [CmdletBinding()] + param + ( + $ParentBoundParameters, + + [System.String] + [Parameter (ValueFromPipeline=$true)] + $ParameterName + ) + + Process + { + if($ParentBoundParameters.ContainsKey($ParameterName)) + { + ThrowInvalidArgumentError "ParameterShouldNotBeSpecified" ($LocalizedData.ParameterShouldNotBeSpecified -f $ParameterName) + } + } +} + +function IsRootedPath +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Path + ) + + try + { + return [IO.Path]::IsPathRooted($Path) + } + catch + { + # if the Path has invalid characters like >, <, etc, we cannot determine if it is rooted so we do not go on + ThrowInvalidArgumentError "CannotGetIsPathRooted" ($LocalizedData.InvalidArgumentAndMessage -f ($LocalizedData.InvalidArgument -f "Path",$Path), $_.Exception.Message) + } +} + +function Write-Log +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Message + ) + + if ($PSCmdlet.ShouldProcess($Message, $null, $null)) + { + Write-Verbose $Message + } +} + +Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/MSFT_ProcessResource.schema.mof b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/MSFT_ProcessResource.schema.mof new file mode 100644 index 0000000..e7dca62 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/MSFT_ProcessResource.schema.mof differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/ko-KR/MSFT_ProcessResource.schema.mfl b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/ko-KR/MSFT_ProcessResource.schema.mfl new file mode 100644 index 0000000..303732e Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/ko-KR/MSFT_ProcessResource.schema.mfl differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/ko-KR/MSFT_ProcessResource.strings.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/ko-KR/MSFT_ProcessResource.strings.psd1 new file mode 100644 index 0000000..ee347e5 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ProcessResource/ko-KR/MSFT_ProcessResource.strings.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/MSFT_RegistryResource.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/MSFT_RegistryResource.psm1 new file mode 100644 index 0000000..292a744 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/MSFT_RegistryResource.psm1 @@ -0,0 +1,1100 @@ +# This PS module contains functions for Desired State Configuration (DSC) Registry provider. It enables querying, creation, removal and update of Windows registry keys through Get, Set and Test operations on DSC managed nodes. + +# Fallback message strings in en-US +DATA localizedData +{ + # culture = "en-US" + ConvertFrom-StringData @' + ParameterValueInvalid = (ERROR) Parameter '{0}' has an invalid value '{1}' for type '{2}' + InvalidPSDriveSpecified = (ERROR) Invalid PSDrive '{0}' specified in registry key '{1}' + InvalidRegistryHiveSpecified = (ERROR) Invalid registry hive was specified in registry key '{0}' + SetRegValueFailed = (ERROR) Failed to set registry key value '{0}' to value '{1}' of type '{2}' + SetRegValueUnchanged = (UNCHANGED) No change to registry key value '{0}' containing '{1}' + SetRegKeyUnchanged = (UNCHANGED) No change to registry key '{0}' + SetRegValueSucceeded = (SET) Set registry key value '{0}' to '{1}' of type '{2}' + SetRegKeySucceeded = (SET) Create registry key '{0}' + SetRegKeyFailed = (ERROR) Failed to created registry key '{0}' + RemoveRegKeyTreeFailed = (ERROR) Registry Key '{0}' has subkeys, cannot remove without Force flag + RemoveRegKeySucceeded = (REMOVAL) Registry key '{0}' removed + RemoveRegKeyFailed = (ERROR) Failed to remove registry key '{0}' + RemoveRegValueSucceeded = (REMOVAL) Registry key value '{0}' removed + RemoveRegValueFailed = (ERROR) Failed to remove registry key value '{0}' + RegKeyDoesNotExist = Registry key '{0}' does not exist + RegKeyExists = Registry key '{0}' exists + RegValueExists = Found registry key value '{0}' with type '{1}' and data '{2}' + RegValueDoesNotExist = Registry key value '{0}' does not exist + RegValueTypeMismatch = Registry key value '{0}' of type '{1}' does not exist + RegValueDataMismatch = Registry key value '{0}' of type '{1}' does not contain data '{2}' + DefaultValueDisplayName = (Default) +'@ +} +Import-LocalizedData LocalizedData -filename MSFT_RegistryResource.strings.psd1 + +#-------------------------------------- +# The Get-TargetResourceInternal cmdlet +#-------------------------------------- +FUNCTION Get-TargetResourceInternal +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Key, + + # Default is [String]::Empty to cater for the (Default) RegValue + [System.String] + $ValueName = [String]::Empty + ) + + # Perform any required setup steps for the provider + SetupProvider -KeyName ([ref]$Key) + + $ValueNameSpecified = $PSBoundParameters.ContainsKey("ValueName") + + # First check if the specified key exists + $keyInfo = Get-Item -Path $Key -ErrorAction SilentlyContinue + + # If $keyInfo is $null, the registry key doesn't exist + if ($keyInfo -eq $null) + { + Write-Verbose ($localizedData.RegKeyDoesNotExist -f $Key) + + $retVal = @{Ensure='Absent'; Key=$Key} + + return $retVal + } + + # If the control reaches here, the key has been found at least + $retVal = @{Ensure='Present'; Key=$Key; Data=$keyInfo} + + # If $ValueName parameter has not been specified then we simply report success on finding the $Key + if (!$ValueNameSpecified) + { + Write-Verbose ($localizedData.RegKeyExists -f $Key) + + return $retVal + } + + # If the control reaches here, the $ValueName has been specified as a parameter and we should query it now + $valData = $keyInfo.GetValue($ValueName, $null, [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames) + + # If $ValueName is not found in the specified $Key + if($valData -eq $null) + { + Write-Verbose ($localizedData.RegValueDoesNotExist -f "$Key\$ValueName") + + $retVal = @{Ensure='Absent'; Key=$Key; ValueName=(GetValueDisplayName -ValueName $ValueName)} + + return $retVal + } + + # Finalize name, type and data to be returned + $finalName = GetValueDisplayName -ValueName $ValueName + $finalType = $keyInfo.GetValueKind($ValueName) + $finalData = $valData + + # Special case: For Binary type data we convert the received bytes back to a readable hex-strin + if ($finalType -ieq "Binary") + { + $finalData = ConvertByteArrayToHexString -Data $valData + } + + # Populate all config in the return object + $retVal.ValueName = $finalName + $retVal.ValueType = $finalType + $retVal.Data = $finalData + + # If the control reaches here, both the $Key and the $ValueName have been found, query is fully successful + Write-Verbose ($localizedData.RegValueExists -f "$Key\$ValueName", $retVal.ValueType, (ArrayToString $retVal.Data)) + + return $retVal +} + +#------------------------------ +# The Get-TargetResource cmdlet +#------------------------------ +FUNCTION Get-TargetResource +{ + param + ( + [Parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [System.String] + $Key, + + [Parameter(Mandatory)] + [ValidateNotNull()] + [AllowEmptyString()] + [System.String] + $ValueName, + + # Special-case: Used only as a boolean flag (along with ValueType) to determine if the target entity is the Default Value or the key itself. + [System.String[]] + $ValueData, + + # Special-case: Used only as a boolean flag (along with ValueData) to determine if the target entity is the Default Value or the key itself. + [System.String] + $ValueType + ) + + # If $ValueName is "" and ValueType and ValueData are both not specified, then we target the key itself (not Default Value) + if ($ValueName -eq "" -and !$PSBoundParameters.ContainsKey("ValueType") -and !$PSBoundParameters.ContainsKey("ValueData")) + { + $retVal = Get-TargetResourceInternal -Key $Key + } + else + { + $retVal = Get-TargetResourceInternal -Key $Key -ValueName $ValueName + + if ($retVal.Ensure -eq 'Present') + { + [string[]]$retVal.ValueData += $retVal.Data + + if ($retVal.ValueType -ieq "MultiString") + { + $retVal.ValueData = $retVal.Data + } + } + } + + $retVal.Remove("Data") + + return $retVal +} + + +#------------------------------ +# The Set-TargetResource cmdlet +#------------------------------ +FUNCTION Set-TargetResource +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [Parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [System.String] + $Key, + + [Parameter(Mandatory)] + [ValidateNotNull()] + [AllowEmptyString()] + [System.String] + $ValueName, + + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present", + + [ValidateNotNull()] + [System.String[]] + $ValueData = @(), + + [ValidateSet("String", "Binary", "DWord", "QWord", "MultiString", "ExpandString")] + [System.String] + $ValueType = "String", + + [System.Boolean] + $Hex = $false, + + [System.Boolean] + $Force = $false + ) + + # Perform any required setup steps for the provider + SetupProvider -KeyName ([ref]$Key) + + # Query if the RegVal related parameters have been specified + $ValueNameSpecified = $PSBoundParameters.ContainsKey("ValueName") + $ValueTypeSpecified = $PSBoundParameters.ContainsKey("ValueType") + $ValueDataSpecified = $PSBoundParameters.ContainsKey("ValueData") + $keyCreated = $false + + # If an empty string ValueName has been specified and no ValueType and no ValueData has been specified, + # treat this case as if ValueName was not specified and target the Key itself. This is to cater the limitation + # that both Key and ValueName are mandatory now and we must special-case like this to target the Key only. + if ($ValueName -eq "" -and !$ValueTypeSpecified -and !$ValueDataSpecified) + { + $ValueNameSpecified = $false + } + + # Now, query the specified key + $keyInfo = Get-TargetResourceInternal -Key $Key -Verbose:$false + + # ---------------- + # ENSURE = PRESENT + if ($Ensure -ieq "Present") + { + # If key doesn't exist, attempt to create it + if ($keyInfo.Ensure -ieq "Absent") + { + if ($PSCmdlet.ShouldProcess(($localizedData.SetRegKeySucceeded -f "$Key"), $null, $null)) + { + try + { + $keyInfo = CreateRegistryKey -Key $Key + $keyCreated = $true + } + catch [Exception] + { + Write-Verbose ($localizedData.SetRegKeyFailed -f "$Key") + + throw + } + } + } + + # If $ValueName, $ValueType and $ValueData are not specified, the simple existence/creation of the Regkey satisfies the Ensure=Present condition, just return + if (!$ValueNameSpecified -and !$ValueDataSpecified -and !$ValueTypeSpecified) + { + if (!$keyCreated) + { + Write-Log ($localizedData.SetRegKeyUnchanged -f "$Key") + } + + return + } + + # If $ValueType and $ValueData are both not specified, but $ValueName is specified, check if the Value exists, if yes return with status unchanged, otherwise report input error + if (!$ValueTypeSpecified -and !$ValueDataSpecified -and $ValueNameSpecified) + { + $valData = $keyInfo.Data.GetValue($ValueName) + + if ($valData -ne $null) + { + Write-Log ($localizedData.SetRegValueUnchanged -f "$Key\$ValueName", (ArrayToString -Value $valData)) + + return + } + } + + # Create a strongly-typed object (in accordance with the specified $ValueType) + $setVal = $null + GetTypedObject -Type $ValueType -Data $ValueData -Hex $Hex -ReturnValue ([ref]$setVal) + + # Get the appropriate display name for the specified ValueName (to handle the Default RegValue case) + $valDisplayName = GetValueDisplayName -ValueName $ValueName + + if ($PSCmdlet.ShouldProcess(($localizedData.SetRegValueSucceeded -f "$Key\$valDisplayName", (ArrayToString -Value $setVal), $ValueType), $null, $null)) + { + try + { + # Finally set the $ValueName here + [Microsoft.Win32.Registry]::SetValue($keyInfo.Data.Name, $ValueName, $setVal, $ValueType) + } + catch [Exception] + { + Write-Verbose ($localizedData.SetRegValueFailed -f "$Key\$valDisplayName", (ArrayToString -Value $setVal), $ValueType) + + throw + } + } + } + + # --------------- + # ENSURE = ABSENT + elseif ($Ensure -ieq "Absent") + { + # If key doesn't exist, no action is required + if ($keyInfo.Ensure -ieq "Absent") + { + Write-Log ($localizedData.RegKeyDoesNotExist -f "$Key") + + return + } + + # If the code reaches here, the key exists + + # If ValueName is "" and ValueType and ValueData have not been specified, target the key for removal + if(!$ValueNameSpecified -and !$ValueTypeSpecified -and !$ValueDataSpecified) + { + # If this is not a Force removal and the Key contains subkeys, report no change and return + if (!$Force -and ($keyInfo.Data.SubKeyCount -gt 0)) + { + $errorMessage = $localizedData.RemoveRegKeyTreeFailed -f "$Key" + + Write-Log $errorMessage + + ThrowError -ExceptionName "System.InvalidOperationException" -ExceptionMessage $errorMessage -ExceptionObject $Force -ErrorId "CannotRemoveKeyTreeWithoutForceFlag" -ErrorCategory NotSpecified + } + + # If the control reaches here, either the $Force flag was specified or the Regkey has no subkeys. In either case we simply remove it. + + if ($PSCmdlet.ShouldProcess(($localizedData.RemoveRegKeySucceeded -f $Key), $null, $null)) + { + try + { + # Formulate hiveName and subkeyName compatible with .NET APIs + $hiveName = $keyInfo.Data.PSDrive.Root.Replace("_","").Replace("HKEY","") + $subkeyName = $keyInfo.Data.Name.Substring($keyInfo.Data.Name.IndexOf("\")+1) + + # Finally remove the subkeytree + [Microsoft.Win32.Registry]::$hiveName.DeleteSubKeyTree($subkeyName) + } + catch [Exception] + { + Write-Verbose ($localizedData.RemoveRegKeyFailed -f "$Key") + + throw + } + } + + return + } + + # If the control reaches here, ValueName has been specified so a RegValue needs be removed (if found) + + # Get the appropriate display name for the specified ValueName (to handle the Default RegValue case) + $valDisplayName = GetValueDisplayName -ValueName $ValueName + + # Query the specified $ValueName + $valData = $keyInfo.Data.GetValue($ValueName) + + # If $ValueName is not found in the specified $Key + if($valData -eq $null) + { + Write-Log ($localizedData.RegValueDoesNotExist -f "$Key\$valDisplayName") + + return + } + + # If the control reaches here, the specified Value has been found and should be removed. + + if ($PSCmdlet.ShouldProcess(($localizedData.RemoveRegValueSucceeded -f "$Key\$valDisplayName"), $null, $null)) + { + try + { + # Formulate hiveName and subkeyName compatible with .NET APIs + $hiveName = $keyInfo.Data.PSDrive.Root.Replace("_","").Replace("HKEY","") + $subkeyName = $keyInfo.Data.Name.Substring($keyInfo.Data.Name.IndexOf("\")+1) + + # Finally open the subkey and remove the RegValue in subkey + $subkey = [Microsoft.Win32.Registry]::$hiveName.OpenSubKey($subkeyName, $true) + $subkey.DeleteValue($ValueName) + + } + catch [Exception] + { + Write-Verbose ($localizedData.RemoveRegValueFailed -f "$Key\$valDisplayName") + + throw + } + } + } +} + + +#------------------------------- +# The Test-TargetResource cmdlet +#------------------------------- +FUNCTION Test-TargetResource +{ + param + ( + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [System.String] + $Key, + + [parameter(Mandatory)] + [AllowEmptyString()] + [ValidateNotNull()] + [System.String] + $ValueName, + + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present", + + [ValidateNotNull()] + [System.String[]] + $ValueData = @(), + + [ValidateSet("String", "Binary", "DWord", "QWord", "MultiString", "ExpandString")] + [System.String] + $ValueType = "String", + + [System.Boolean] + $Hex = $false, + + # Force is not used in Test-TargetResource but is required by DSC engine to keep parameter-sets in parity for both SET and TEST + [System.Boolean] + $Force = $false + ) + + # Perform any required setup steps for the provider + SetupProvider -KeyName ([ref]$Key) + + # Query if the RegVal related parameters have been specified + $ValueNameSpecified = $PSBoundParameters.ContainsKey("ValueName") + $ValueTypeSpecified = $PSBoundParameters.ContainsKey("ValueType") + $ValueDataSpecified = $PSBoundParameters.ContainsKey("ValueData") + + # If an empty string ValueName has been specified and no ValueType and no ValueData has been specified, + # treat this case as if ValueName was not specified and target the Key itself. This is to cater the limitation + # that both Key and ValueName are mandatory now and we must special-case like this to target the Key only. + if (($ValueName -eq "") -and !$ValueTypeSpecified -and !$ValueDataSpecified) + { + $ValueNameSpecified = $false + } + + # Now, query the specified key + $keyInfo = Get-TargetResourceInternal -Key $Key -Verbose:$false + + # ---------------- + # ENSURE = PRESENT + if ($Ensure -ieq "Present") + { + # If key doesn't exist, the test fails + if ($keyInfo.Ensure -ieq "Absent") + { + Write-Verbose ($localizedData.RegKeyDoesNotExist -f $Key) + + return $false + } + + # If $ValueName, $ValueType and $ValueData are not specified, the simple existence of the Regkey satisfies the Ensure=Present condition, test is successful + if (!$ValueNameSpecified -and !$ValueDataSpecified -and !$ValueTypeSpecified) + { + Write-Verbose ($localizedData.RegKeyExists -f $Key) + + return $true + } + + # IF THE CONTROL REACHED HERE, THE KEY EXISTS AND A REGVALUE ATTRIBUTE HAS BEEN SPECIFIED + + # Get the appropriate display name for the specified ValueName (to handle the Default RegValue case) + $valDisplayName = GetValueDisplayName -ValueName $ValueName + + # Now query the specified Reg Value + $valData = Get-TargetResourceInternal -Key $Key -ValueName $ValueName -Verbose:$false + + # If the Value doesn't exist, the test has failed + if ($valData.Ensure -ieq "Absent") + { + Write-Verbose ($localizedData.RegValueDoesNotExist -f "$Key\$valDisplayName") + + return $false + } + + # IF THE CONTROL REACHED HERE, THE KEY EXISTS AND THE SPECIFIED (or Default) VALUE EXISTS + + # If the $ValueType has been specified and it doesn't match the type of the found RegValue, test fails + if ($ValueTypeSpecified -and ($ValueType -ine $valData.ValueType)) + { + Write-Verbose ($localizedData.RegValueTypeMismatch -f "$Key\$valDisplayName", $ValueType) + + return $false + } + + # If an explicit ValueType has not been specified, given the Value already exists in Registry, assume the ValueType to be of the existing Value + if (!$ValueTypeSpecified) + { + $ValueType = $valData.ValueType + } + + # If $ValueData has been specified, match the data of the found Regvalue. + if ($ValueDataSpecified -and !(ValueDataMatches -RetrievedValue $valData -ValueType $ValueType -ValueData $ValueData)) + { + # Since the $ValueData specified didn't match the data of the found RegValue, test failed + Write-Verbose ($localizedData.RegValueDataMismatch -f "$Key\$valDisplayName", $ValueType, (ArrayToString -Value $ValueData)) + + return $false + } + + # IF THE CONTROL REACHED HERE, ALL TESTS HAVE PASSED FOR THE SPECIFIED REGISTRY VALUE AND IT COMPLETELY MATCHES, REPORT SUCCESS + + Write-Verbose ($localizedData.RegValueExists -f "$Key\$valDisplayName", $valData.ValueType, (ArrayToString -Value $valData.Data)) + + return $true + } + + # --------------- + # ENSURE = ABSENT + elseif ($Ensure -ieq "Absent") + { + # If key doesn't exist, test is successful + if ($keyInfo.Ensure -ieq "Absent") + { + Write-Log ($localizedData.RegKeyDoesNotExist -f "$Key") + + return $true + } + + # IF CONTROL REACHED HERE, THE SPECIFIED KEY EXISTS + + # If $ValueName, $ValueType and $ValueData are not specified, the simple existence of the Regkey fails the test + if (!$ValueNameSpecified -and !$ValueDataSpecified -and !$ValueTypeSpecified) + { + Write-Verbose ($localizedData.RegKeyExists -f $Key) + + return $false + } + + # IF THE CONTROL REACHED HERE, THE KEY EXISTS AND A REGVALUE ATTRIBUTE HAS BEEN SPECIFIED + + # Get the appropriate display name for the specified ValueName (to handle the Default RegValue case) + $valDisplayName = GetValueDisplayName -ValueName $ValueName + + # Now query the specified RegValue + $valData = Get-TargetResourceInternal -Key $Key -ValueName $ValueName -Verbose:$false + + # If the Value doesn't exist, the test has passed + if ($valData.Ensure -ieq "Absent") + { + Write-Verbose ($localizedData.RegValueDoesNotExist -f "$Key\$valDisplayName") + + return $true + } + + # IF THE CONTROL REACHED HERE, THE KEY EXISTS AND THE SPECIFIED (or Default) VALUE EXISTS, THUS REPORT FAILURE + + Write-Verbose ($localizedData.RegValueExists -f "$Key\$valDisplayName", $valData.ValueType, (ArrayToString -Value $valData.Data)) + + return $false + } +} + + +#-------------------------------------------- +# Utility to create an arbitrary registry key +#-------------------------------------------- +FUNCTION CreateRegistryKey +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Key + ) + + # Trim any "\" back-slash(es) at the end of the specified RegKey + $Key = ([string]$Key).TrimEnd('\') + + # Extract the parent-key + $slashIndex = $Key.LastIndexOf('\') + $parentKey = $Key.Substring(0, $slashIndex) + + # Check if the parent-key exists, if not first create that (recurse). + if ((Get-TargetResourceInternal -Key $parentKey -Verbose:$false).Ensure -eq "Absent") + { + CreateRegistryKey -Key $parentKey | Out-Null + } + + # Create the Regkey + $retVal = New-Item -Path $Key 2>&1 + + # Report any errors + if ($retVal -and $retVal.GetType().Name -ieq "ErrorRecord") + { + throw $retVal + } + + # If the control reaches here, the key was created successfully + return (Get-TargetResourceInternal -Key $Key -Verbose:$false) +} + + +#------------------------------------------- +# Validate PSDrive specified in Registry Key +#------------------------------------------- +FUNCTION ValidatePSDrive +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Key + ) + + # Extract the PSDriveName from the specified Key + $psDriveName = $Key.Substring(0, $Key.IndexOf(':')) + + # Query the specified PSDrive + $psDrive = Get-PSDrive $psDriveName -ErrorAction SilentlyContinue + + # Validate that the specified psdrive is a valid + if (($psDrive -eq $null) -or ($psDrive.Provider -eq $null) -or ($psDrive.Provider.Name -ine "Registry") -or !(IsValidRegistryRoot -PSDriveRoot $psDrive.Root)) + { + $errorMessage = $localizedData.InvalidPSDriveSpecified -f $psDriveName, $Key + ThrowError -ExceptionName "System.ArgumentException" -ExceptionMessage $errorMessage -ExceptionObject $Key -ErrorId "InvalidPSDrive" -ErrorCategory InvalidArgument + } +} + + +#-------------------------------------------------- +# Check if the PSDriveRoot is a valid registry root +#-------------------------------------------------- +FUNCTION IsValidRegistryRoot +{ + param + ( + [System.String] + $PSDriveRoot + ) + + # List of valid registry roots + $validRegistryRoots = @("HKEY_CLASSES_ROOT", "HKEY_CURRENT_USER", "HKEY_LOCAL_MACHINE", "HKEY_USERS", "HKEY_CURRENT_CONFIG") + + # Extract the base of the PSDrive root + if ($PSDriveRoot.Contains('\')) + { + $PSDriveRoot = $PSDriveRoot.Substring(0, $PSDriveRoot.IndexOf('\')) + } + + return ($validRegistryRoots -icontains $PSDriveRoot) +} + + +#---------------------------------------- +# Utility to write WhatIf or Verbose logs +#---------------------------------------- +FUNCTION Write-Log +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Message + ) + + if ($PSCmdlet.ShouldProcess($Message, $null, $null)) + { + Write-Verbose $Message + } +} + + +#------------------------------------ +# Utility to throw an error/exception +#------------------------------------ +FUNCTION ThrowError +{ + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $ExceptionName, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $ExceptionMessage, + + [System.Object] + $ExceptionObject, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $ErrorId, + + [parameter(Mandatory = $true)] + [ValidateNotNull()] + [System.Management.Automation.ErrorCategory] + $ErrorCategory + ) + + $exception = New-Object $ExceptionName $ExceptionMessage; + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $ErrorId, $ErrorCategory, $ExceptionObject + throw $errorRecord +} + + +#---------------------------------------------------------------------- +# Utility to construct a strongly-typed object based on specified $Type +#---------------------------------------------------------------------- +FUNCTION GetTypedObject +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Type, + + [System.String[]] + $Data, + + [ValidateNotNull()] + [Boolean] + $Hex, + + [ref] $ReturnValue + ) + + $ArgumentExceptionScriptBlock = + { + Param($ErrorId) + + $errorMessage = $localizedData.ParameterValueInvalid -f "ValueData", (ArrayToString -Value $Data), $Type + Write-Verbose $errorMessage + ThrowError -ExceptionName "System.ArgumentException" -ExceptionMessage $errorMessage -ExceptionObject $Data -ErrorId $ErrorId -ErrorCategory InvalidArgument + } + + # The the $Type specified is not a multistring then we always expect a non-array $Data. If this is not the case, throw an error and let the user know. + if (($Type -ine "Multistring") -and ($Data -ne $null) -and ($Data.Count -gt 1)) + { + Invoke-Command -ScriptBlock $ArgumentExceptionScriptBlock -ArgumentList ([String]::Format("ArrayNotExpectedForType{0}", $Type)) + } + + Switch($Type) + { + # Case: String + "String" + { + if (($Data -eq $null) -or ($Data.Length -eq 0)) + { + $ReturnValue.Value = [String]::Empty + + return + } + + $ReturnValue.Value = [String]$Data[0] + } + + # Case: ExpandString + "ExpandString" + { + if (($Data -eq $null) -or ($Data.Length -eq 0)) + { + $ReturnValue.Value = [String]::Empty + + return + } + + $ReturnValue.Value = [String]$Data[0] + } + + # Case: MultiString + "MultiString" + { + if (($Data -eq $null) -or ($Data.Length -eq 0)) + { + $ReturnValue.Value = [String[]]@() + + return + } + + $ReturnValue.Value = [String[]]$Data + } + + # Case: DWord + "DWord" + { + if (($Data -eq $null) -or ($Data.Length -eq 0)) + { + $ReturnValue.Value = [Int32]0 + } + elseif ($Hex) + { + $retVal = $null + $val = $Data[0].TrimStart("0x") + + if ([Int32]::TryParse($val, "HexNumber", [System.Globalization.CultureInfo]::CurrentCulture, [ref] $retVal)) + { + $ReturnValue.Value = $retVal + } + else + { + Invoke-Command -ScriptBlock $ArgumentExceptionScriptBlock -ArgumentList "ValueDataNotInHexFormat" + } + } + else + { + $ReturnValue.Value = [Int32]::Parse($Data[0]) + } + } + + # Case: QWord + "QWord" + { + if (($Data -eq $null) -or ($Data.Length -eq 0)) + { + $ReturnValue.Value = [Int64]0 + } + elseif ($Hex) + { + $retVal = $null + $val = $Data[0].TrimStart("0x") + + if ([Int64]::TryParse($val, "HexNumber", [System.Globalization.CultureInfo]::CurrentCulture, [ref] $retVal)) + { + $ReturnValue.Value = $retVal + } + else + { + Invoke-Command -ScriptBlock $ArgumentExceptionScriptBlock -ArgumentList "ValueDataNotInHexFormat" + } + } + else + { + $ReturnValue.Value = [Int64]::Parse($Data[0]) + } + } + + # Case: Binary + "Binary" + { + if (($Data -eq $null) -or ($Data.Length -eq 0)) + { + $ReturnValue.Value = [Byte[]]@() + + return + } + + $binaryVal = $null + $val = $Data[0].TrimStart("0x") + if ($val.Length % 2 -ne 0) + { + $val = $val.PadLeft($val.Length+1, "0") + } + + try + { + $byteArray = [Byte[]]@() + + for ($i = 0 ; $i -lt ($val.Length-1) ; $i = $i+2) + { + $byteArray += [Byte]::Parse($val.Substring($i, 2), "HexNumber") + } + + $ReturnValue.Value = [Byte[]]$byteArray + } + catch [Exception] + { + Invoke-Command -ScriptBlock $ArgumentExceptionScriptBlock -ArgumentList "ValueDataNotInHexFormat" + } + } + } +} + + +#------------------------------------------------------- +# Utility to convert an array to a string representation +#------------------------------------------------------- +FUNCTION ArrayToString +{ + param + ( + [parameter(Mandatory = $true)] + [AllowEmptyCollection()] + [ValidateNotNull()] + [object[]] + $Value + ) + + if (!$Value.GetType().IsArray) + { + return $Value.ToString() + } + if ($Value.Length -eq 1) + { + return $Value[0].ToString() + } + + [System.Text.StringBuilder]$retString = "(" + + $Value | % {$retString = ($retString.ToString() + $_.ToString() + ", ")} + + $retString = $retString.ToString().TrimEnd(", ") + ")" + + return $retString.ToString() +} + + +#------------------------------------------------------- +# Utility to convert an array to a string representation +#------------------------------------------------------- +FUNCTION ConvertByteArrayToHexString +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNull()] + [System.Object] + $Data + ) + + $retString = "" + $Data | % {$retString += [String]::Format("{0:x2}", $_)} + + return $retString +} + + +#-------------------------------------------------------------- +# Utility to handle the display name for the (Default) RegValue +#-------------------------------------------------------------- +FUNCTION GetValueDisplayName +{ + param + ( + [System.String] + $ValueName + ) + + if ([String]::IsNullOrEmpty($ValueName)) + { + return $localizedData.DefaultValueDisplayName + } + + return $ValueName +} + + +#--------------------------------------------------------- +# Utility to mount the optional Registry hives as PSDrives +#--------------------------------------------------------- +FUNCTION MountRequiredRegistryHives +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $KeyName + ) + + $psDriveNames = (Get-PSDrive).Name.ToUpperInvariant() + + if ($KeyName.StartsWith("HKCR","OrdinalIgnoreCase") -and !$psDriveNames.Contains("HKCR")) + { + New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT -Scope "Script" -WhatIf:$false | Out-Null + } + elseif ($KeyName.StartsWith("HKUS","OrdinalIgnoreCase") -and !$psDriveNames.Contains("HKUS")) + { + New-PSDrive -Name HKUS -PSProvider Registry -Root HKEY_USERS -Scope "Script" -WhatIf:$false | Out-Null + } + elseif ($KeyName.StartsWith("HKCC","OrdinalIgnoreCase") -and !$psDriveNames.Contains("HKCC")) + { + New-PSDrive -Name HKCC -PSProvider Registry -Root HKEY_CURRENT_CONFIG -Scope "Script" -WhatIf:$false | Out-Null + } + elseif ($KeyName.StartsWith("HKCU","OrdinalIgnoreCase") -and !$psDriveNames.Contains("HKCU")) + { + New-PSDrive -Name HKCU -PSProvider Registry -Root HKEY_CURRENT_USER -Scope "Script" -WhatIf:$false | Out-Null + } + elseif ($KeyName.StartsWith("HKLM","OrdinalIgnoreCase") -and !$psDriveNames.Contains("HKLM")) + { + New-PSDrive -Name HKLM -PSProvider Registry -Root HKEY_LOCAL_MACHINE -Scope "Script" -WhatIf:$false | Out-Null + } +} + + +#--------------------------------------------------------- +# Utility to mount the optional Registry hives as PSDrives +#--------------------------------------------------------- +FUNCTION SetupProvider +{ + param + ( + [ValidateNotNull()] + [ref] $KeyName + ) + + # Fix $KeyName if required + if (!$KeyName.Value.ToString().Contains(":")) + { + if ($KeyName.Value.ToString().StartsWith("hkey_users","OrdinalIgnoreCase")) + { + $KeyName.Value = $KeyName.Value.ToString() -replace "hkey_users", "HKUS:" + } + elseif ($KeyName.Value.ToString().StartsWith("hkey_current_config","OrdinalIgnoreCase")) + { + $KeyName.Value = $KeyName.Value.ToString() -replace "hkey_current_config", "HKCC:" + } + elseif ($KeyName.Value.ToString().StartsWith("hkey_classes_root","OrdinalIgnoreCase")) + { + $KeyName.Value = $KeyName.Value.ToString() -replace "hkey_classes_root", "HKCR:" + } + elseif ($KeyName.Value.ToString().StartsWith("hkey_local_machine","OrdinalIgnoreCase")) + { + $KeyName.Value = $KeyName.Value.ToString() -replace "hkey_local_machine", "HKLM:" + } + elseif ($KeyName.Value.ToString().StartsWith("hkey_current_user","OrdinalIgnoreCase")) + { + $KeyName.Value = $KeyName.Value.ToString() -replace "hkey_current_user", "HKCU:" + } + else + { + $errorMessage = $localizedData.InvalidRegistryHiveSpecified -f $Key + ThrowError -ExceptionName "System.ArgumentException" -ExceptionMessage $errorMessage -ExceptionObject $KeyName -ErrorId "InvalidRegistryHive" -ErrorCategory InvalidArgument + } + } + + # Mount any required registry hives + MountRequiredRegistryHives -KeyName $KeyName.Value.ToString() + + # Check the target PSDrive to be a valid Registry Hive root + ValidatePSDrive -Key $KeyName.Value.ToString() +} + +#---------------------------------------------------------------------------------------- +# Refactored utility to decide if the ValueData specified matches the ValueData retrieved +#---------------------------------------------------------------------------------------- +FUNCTION ValueDataMatches +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNull()] + [System.Object] + $RetrievedValue, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $ValueType, + + [System.String[]] + $ValueData + ) + + # Convert the specified $ValueData into strongly-typed data for correct comparsion + $specifiedData = $null + $retrievedData = $RetrievedValue.Data + + GetTypedObject -Type $ValueType -Data $ValueData -Hex $Hex -ReturnValue ([ref]$specifiedData) + + # Special case for binary comparison (do hex-string comparison) + if ($ValueType -ieq "Binary") + { + $specifiedData = $ValueData[0].PadLeft($retrievedData.Length, '0') + } + + # If the ValueType is not multistring, do a simple comparison + if ($ValueType -ine "Multistring") + { + return ($specifiedData -ieq $retrievedData) + } + + # IF THE CONTROL REACHES HERE, THE ValueType IS A "MultiString" and we need a size-based and element-by-element comparsion for it + + # Array-size comparison + if ($specifiedData.Length -ne $retrievedData.Length) + { + # Size mismatch + return $false + } + + # Element-by-Element comparison + for ($i = 0 ; $i -lt $specifiedData.Length ; $i++) + { + if ($specifiedData[$i] -ine $retrievedData[$i]) + { + return $false + } + } + + # IF THE CONTROL REACHED HERE, THE Multistring COMPARISON WAS SUCCESSFUL + return $true +} + +Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/MSFT_RegistryResource.schema.mof b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/MSFT_RegistryResource.schema.mof new file mode 100644 index 0000000..4a40e1c Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/MSFT_RegistryResource.schema.mof differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/ko-KR/MSFT_RegistryResource.schema.mfl b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/ko-KR/MSFT_RegistryResource.schema.mfl new file mode 100644 index 0000000..1f31ec4 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/ko-KR/MSFT_RegistryResource.schema.mfl differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/ko-KR/MSFT_RegistryResource.strings.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/ko-KR/MSFT_RegistryResource.strings.psd1 new file mode 100644 index 0000000..6e9ddd3 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RegistryResource/ko-KR/MSFT_RegistryResource.strings.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/MSFT_RoleResource.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/MSFT_RoleResource.psm1 new file mode 100644 index 0000000..1028272 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/MSFT_RoleResource.psm1 @@ -0,0 +1,538 @@ +data LocalizedData +{ + # culture="en-US" + ConvertFrom-StringData @' +SetTargetResourceInstallwhatIfMessage=Trying to install feature {0} +SetTargetResourceUnInstallwhatIfMessage=Trying to Uninstall feature {0} +FeatureNotFoundError=The requested feature {0} is not found on the target machine. +FeatureDiscoveryFailureError=Failure to get the requested feature {0} information from the target machine. Wildcard pattern is not supported in the feature name. +FeatureInstallationFailureError=Failure to successfully install the feature {0} . +FeatureUnInstallationFailureError=Failure to successfully Unintstall the feature {0} . +QueryFeature=Querying for feature {0} using Server Manager cmdlet Get-WindowsFeature. +InstallFeature=Trying to install feature {0} using Server Manager cmdlet Add-WindowsFeature. +UninstallFeature=Trying to Uninstall feature {0} using Server Manager cmdlet Remove-WindowsFeature. +RestartNeeded=The Target machine needs to be restarted. +GetTargetResourceStartVerboseMessage=Begin executing Get functionality on the {0} feature. +GetTargetResourceEndVerboseMessage=End executing Get functionality on the {0} feature. +SetTargetResourceStartVerboseMessage=Begin executing Set functionality on the {0} feature. +SetTargetResourceEndVerboseMessage=End executing Set functionality on the {0} feature. +TestTargetResourceStartVerboseMessage=Begin executing Test functionality on the {0} feature. +TestTargetResourceEndVerboseMessage=End executing Test functionality on the {0} feature. +ServerManagerModuleNotFoundDebugMessage=ServerManager module is not installed on the machine. +SkuNotSupported=Installing roles and features using PowerShell Desired State Configuration is supported only on Server SKU's. It is not supported on Client SKU. +SourcePropertyNotSupportedDebugMessage=Source property in MSFT_RoleResource is not supported on this operating system and it was ignored. +EnableServerManagerPSHCmdletsFeature=Windows Server 2008R2 Core operating system detected: ServerManager-PSH-Cmdlets feature has been enabled. +UninstallSuccess=Successfully uninstalled the feature {0}. +InstallSuccess=Successfully installed the feature {0}. +'@ +} + +Import-LocalizedData LocalizedData -filename MSFT_RoleResourceStrings + +# The Get-TargetResource cmdlet is used to fetch the status of role or feature on the target machine. +# It gives the feature info of the requested role/feature on the target machine. +function Get-TargetResource +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + $Name, + + [Parameter(Mandatory=$false)] + [System.Management.Automation.PSCredential] + $Credential + ) + + $getTargetResourceResult = $null; + + $getTargetResourceStartVerboseMessage = $($LocalizedData.GetTargetResourceStartVerboseMessage) -f ${Name} ; + Write-Debug -Message $getTargetResourceStartVerboseMessage; + + ValidatePrerequisites ; + + $qyeryFeatureMessage = $($LocalizedData.QueryFeature) -f ${Name} ; + Write-Debug -Message $qyeryFeatureMessage; + + $isR2Sp1 = IsWinServer2008R2SP1; + if($isR2Sp1 -and $psboundparameters.ContainsKey("Credential")) + { + $parameters = $psboundparameters.Remove("Credential"); + $feature = Invoke-Command -ScriptBlock { Get-WindowsFeature @using:psboundparameters } -ComputerName . -Credential $Credential -ErrorVariable ev + $psboundparameters.Add("Credential", $Credential); + } + else + { + $feature = Get-WindowsFeature @psboundparameters -ErrorVariable ev + } + + if($null -eq $ev -or $ev.Count -eq 0) + { + $foundError = $false; + + ValidateFeature $feature $Name; + + # If a feature does not contain SubFeature then $includeAllSubFeature would be set to $false. + # If a feature contains one or more subfeatures then $includeAllSubFeature would be set to + # $true only if all the subfeatures are installed, or else $includeAllSubFeature would be set to $false. + $includeAllSubFeature = $true; + + if($feature.SubFeatures.Count -eq 0) + { + $includeAllSubFeature = $false; + } + else + { + foreach($currentSubFeature in $feature.SubFeatures) + { + if($foundError -eq $false) + { + $parameters = $psboundparameters.Remove("Name"); + $psboundparameters.Add("Name", $currentSubFeature); + + $isR2Sp1 = IsWinServer2008R2SP1; + if($isR2Sp1 -and $psboundparameters.ContainsKey("Credential")) + { + $parameters = $psboundparameters.Remove("Credential"); + $subFeature = Invoke-Command -ScriptBlock { Get-WindowsFeature @using:psboundparameters } -ComputerName . -Credential $Credential -ErrorVariable errorVar + $psboundparameters.Add("Credential", $Credential); + } + else + { + $subFeature = Get-WindowsFeature @psboundparameters -ErrorVariable errorVar + } + + if($null -eq $errorVar -or $errorVar.Count -eq 0) + { + ValidateFeature $subFeature $currentSubFeature; + + if(!$subFeature.Installed) + { + $includeAllSubFeature = $false; + break; + } + } + else + { + $foundError = $true;; + } + } + } + } + + if($foundError -eq $false) + { + if($feature.Installed) + { + $ensureResult = "Present"; + } + else + { + $ensureResult = "Absent"; + } + + # Add all feature properties to the hash table + $getTargetResourceResult = @{ + Name = $feature.Name; + DisplayName = $feature.DisplayName; + Ensure = $ensureResult; + IncludeAllSubFeature = $includeAllSubFeature; + } + + $getTargetResourceEndVerboseMessage = $($LocalizedData.GetTargetResourceEndVerboseMessage) -f ${Name} ; + Write-Debug -Message $getTargetResourceEndVerboseMessage; + + $getTargetResourceResult; + } + } +} + + +# The Set-TargetResource cmdlet is used to install or uninstall a role on the target machine. +# It also supports installing & uninstalling the role or feature specific subfeatures. +function Set-TargetResource +{ + [CmdletBinding(SupportsShouldProcess=$true, DefaultParameterSetName = "FeatureName")] + + param + ( + [parameter(Mandatory=$true, ParameterSetName = "FeatureName")] + [ValidateNotNullOrEmpty()] + [string] + $Name, + + [parameter()] + [ValidateSet("Present", "Absent")] + [string] + $Ensure = "Present", + + [parameter()] + [ValidateNotNullOrEmpty()] + [string] + $Source, + + [parameter()] + [switch] + $IncludeAllSubFeature, + + [Parameter(Mandatory=$false)] + [System.Management.Automation.PSCredential] + $Credential, + + [ValidateNotNullOrEmpty()] + [string] + $LogPath + ) + + $getTargetResourceResult = $null; + + $inputParameter = $null; + + $setTargetResourceStartVerboseMessage = $($LocalizedData.SetTargetResourceStartVerboseMessage) -f ${Name} ; + Write-Debug -Message $setTargetResourceStartVerboseMessage; + + ValidatePrerequisites ; + + # -Source Parameter is not applicable to Windows Server 2008 R2 SP1. Hence removing it. + # all role/feature spcific binaries are avaliable inboc on Windows Server 2008 R2 SP1, hence + # -Source is not supported on Windows Server 2008 R2 SP1. + $isR2Sp1 = IsWinServer2008R2SP1; + if($isR2Sp1 -and $psboundparameters.ContainsKey("Source")) + { + $sourcePropertyNotSupportedDebugMessage = $($LocalizedData.SourcePropertyNotSupportedDebugMessage) ; + Write-Debug -Message $sourcePropertyNotSupportedDebugMessage; + + $parameters = $psboundparameters.Remove("Source"); + } + + + if($Ensure -eq "Present") + { + $parameters = $psboundparameters.Remove("Ensure"); + + $installFeatureMessage = $($LocalizedData.InstallFeature) -f ${Name} ; + Write-Debug -Message $installFeatureMessage; + + $isR2Sp1 = IsWinServer2008R2SP1; + if($isR2Sp1 -and $psboundparameters.ContainsKey("Credential")) + { + $parameters = $psboundparameters.Remove("Credential"); + $feature = Invoke-Command -ScriptBlock { Add-WindowsFeature @using:psboundparameters } -ComputerName . -Credential $Credential -ErrorVariable ev + $psboundparameters.Add("Credential", $Credential); + } + else + { + $feature = Add-WindowsFeature @psboundparameters -ErrorVariable ev + } + + if($feature -ne $null -and $feature.Success -eq $true) + { + Write-Verbose ($LocalizedData.InstallSuccess -f $Name) + + # Check if reboot is required, if so notify CA. + if($feature.RestartNeeded -eq "Yes") + { + $restartNeededMessage = $($LocalizedData.RestartNeeded); + Write-Verbose -Message $restartNeededMessage; + + $global:DSCMachineStatus = 1; + } + } + else + { + # Add-WindowsFeature cmdlet falied to successfully install the requested feature. + # If there are errors from the Add-WindowsFeature cmdlet. We surface those errors. + # If Add-WindwosFeature cmdlet does not surface any errors. Then the provider throws a + # terminating error. + if($null -eq $ev -or $ev.Count -eq 0) + { + $errorId = "FeatureInstallationFailure"; + $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidOperation; + $errorMessage = $($LocalizedData.FeatureInstallationFailureError) -f ${Name} ; + $exception = New-Object System.InvalidOperationException $errorMessage ; + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null + + $PSCmdlet.ThrowTerminatingError($errorRecord); + } + } + } + else + { + $parameters = $psboundparameters.Remove("Ensure"); + $parameters = $psboundparameters.Remove("IncludeAllSubFeature"); + $parameters = $psboundparameters.Remove("Source"); + + $uninstallFeatureMessage = $($LocalizedData.UninstallFeature) -f ${Name} ; + Write-Debug -Message $uninstallFeatureMessage; + + $isR2Sp1 = IsWinServer2008R2SP1; + if($isR2Sp1 -and $psboundparameters.ContainsKey("Credential")) + { + $parameters = $psboundparameters.Remove("Credential"); + $feature = Invoke-Command -ScriptBlock { Remove-WindowsFeature @using:psboundparameters } -ComputerName . -Credential $Credential -ErrorVariable ev + $psboundparameters.Add("Credential", $Credential); + } + else + { + $feature = Remove-WindowsFeature @psboundparameters -ErrorVariable ev + } + + if($feature -ne $null -and $feature.Success -eq $true) + { + Write-Verbose ($LocalizedData.UninstallSuccess -f $Name) + + # Check if reboot is required, if so notify CA. + if($feature.RestartNeeded -eq "Yes") + { + $restartNeededMessage = $($LocalizedData.RestartNeeded); + Write-Verbose -Message $restartNeededMessage; + + $global:DSCMachineStatus = 1; + } + } + else + { + # Remove-WindowsFeature cmdlet falied to successfully Uninstall the requested feature. + # If there are errors from the Remove-WindowsFeature cmdlet. We surface those errors. + # If Remove-WindwosFeature cmdlet does not surface any errors. Then the provider throws a + # terminating error. + if($null -eq $ev -or $ev.Count -eq 0) + { + $errorId = "FeatureUnInstallationFailure"; + $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidOperation; + $errorMessage = $($LocalizedData.FeatureUnInstallationFailureError) -f ${Name} ; + $exception = New-Object System.InvalidOperationException $errorMessage ; + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null + + $PSCmdlet.ThrowTerminatingError($errorRecord); + } + } + } + + $setTargetResourceEndVerboseMessage = $($LocalizedData.SetTargetResourceEndVerboseMessage) -f ${Name} ; + Write-Debug -Message $setTargetResourceEndVerboseMessage; +} + +# The Test-TargetResource cmdlet is used to validate if the role or feature is in a state as expected in the instance document. +function Test-TargetResource +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + $Name, + + [parameter()] + [ValidateSet("Present", "Absent")] + [string] + $Ensure = "Present", + + [parameter()] + [ValidateNotNullOrEmpty()] + [string] + $Source, + + [parameter()] + [switch] + $IncludeAllSubFeature, + + [Parameter()] + [System.Management.Automation.PSCredential] + $Credential, + + [ValidateNotNullOrEmpty()] + [string] + $LogPath + + ) + + $testTargetResourceStartVerboseMessage = $($LocalizedData.TestTargetResourceStartVerboseMessage) -f ${Name} ; + Write-Debug -Message $testTargetResourceStartVerboseMessage; + + ValidatePrerequisites ; + + $testTargetResourceResult = $false; + + $parameters = $psboundparameters.Remove("Ensure"); + $parameters = $psboundparameters.Remove("IncludeAllSubFeature"); + $parameters = $psboundparameters.Remove("Source"); + + $qyeryFeatureMessage = $($LocalizedData.QueryFeature) -f ${Name} ; + Write-Debug -Message $qyeryFeatureMessage; + + $isR2Sp1 = IsWinServer2008R2SP1; + if($isR2Sp1 -and $psboundparameters.ContainsKey("Credential")) + { + $parameters = $psboundparameters.Remove("Credential"); + $feature = Invoke-Command -ScriptBlock { Get-WindowsFeature @using:psboundparameters } -ComputerName . -Credential $Credential -ErrorVariable ev + $psboundparameters.Add("Credential", $Credential); + } + else + { + $feature = Get-WindowsFeature @psboundparameters -ErrorVariable ev + } + + + if($null -eq $ev -or $ev.Count -eq 0) + { + ValidateFeature $feature $Name; + + + # Check if the feature is in the requested Ensure state. + # If so then check if then check if the subfeature is in the requested Ensure state. + if(($Ensure -eq "Present" -and $feature.Installed -eq $true) -or + ($Ensure -eq "Absent" -and $feature.Installed -eq $false)) + { + $testTargetResourceResult = $true; + + # IncludeAllSubFeature is set to $true, so we need to make + # sure that all Sub Features are alsi installed. + if($IncludeAllSubFeature) + { + + foreach($currentSubFeature in $feature.SubFeatures) + { + $parameters = $psboundparameters.Remove("Name"); + $parameters = $psboundparameters.Remove("Ensure"); + $parameters = $psboundparameters.Remove("IncludeAllSubFeature"); + $parameters = $psboundparameters.Remove("Source"); + $psboundparameters.Add("Name", $currentSubFeature); + + $isR2Sp1 = IsWinServer2008R2SP1; + if($isR2Sp1 -and $psboundparameters.ContainsKey("Credential")) + { + $parameters = $psboundparameters.Remove("Credential"); + $subFeature = Invoke-Command -ScriptBlock { Get-WindowsFeature @using:psboundparameters } -ComputerName . -Credential $Credential -ErrorVariable errorVar + $psboundparameters.Add("Credential", $Credential); + } + else + { + $subFeature = Get-WindowsFeature @psboundparameters -ErrorVariable errorVar + } + + + if($null -eq $errorVar -or $errorVar.Count -eq 0) + { + ValidateFeature $subFeature $currentSubFeature; + + if(!$subFeature.Installed) + { + $testTargetResourceResult = $false; + break; + } + } + } + } + } + + $testTargetResourceEndVerboseMessage = $($LocalizedData.TestTargetResourceEndVerboseMessage) -f ${Name} ; + Write-Debug -Message $testTargetResourceEndVerboseMessage; + + $testTargetResourceResult; + } +} + + +# ValidateFeature is a helper function used to validate the results of SM+ cmdlets +# Get-Windowsfeature for the user supplied feature name. +function ValidateFeature +{ + param + ( + [object] $feature, + + [string] $Name + ) + + if($null -eq $feature) + { + $errorId = "FeatureNotFound"; + $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidOperation + $errorMessage = $($LocalizedData.FeatureNotFoundError) -f ${Name} + $exception = New-Object System.InvalidOperationException $errorMessage + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null + + $PSCmdlet.ThrowTerminatingError($errorRecord); + } + + # WildCard pattern is not supported by the role provider. + # Hence we restrict user to request only one feature information in a single request. + if($feature.Count -gt 1) + { + $errorId = "FeatureDiscoveryFailure"; + $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidResult + $errorMessage = $($LocalizedData.FeatureDiscoveryFailureError) -f ${Name} + $exception = New-Object System.InvalidOperationException $errorMessage + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null + + $PSCmdlet.ThrowTerminatingError($errorRecord); + } +} + +# ValidatePrerequisites is a helper function used to validate if the MSFT_RoleResource is supported on the target machine. +# MSFT_RoleResource is supported only on Server SKU's. MSFT_RoleResource depend on ServerManagerModule which is avaliable +# only on Server SKU's. +function ValidatePrerequisites +{ + param + ( + ) + + #Enable ServerManager-PSH-Cmdlets feature if os is WS2008R2 Core. + $datacenterServerCore = 12 + $standardServerCore = 13 + $EnterpriseServerCore = 14 + + $operatingSystem = Get-WmiObject -Class Win32_operatingsystem + if($operatingSystem.Version.StartsWith('6.1.') -and + (($operatingSystem.OperatingSystemSKU -eq $datacenterServerCore) -or ($operatingSystem.OperatingSystemSKU -eq $standardServerCore) -or ($operatingSystem.OperatingSystemSKU -eq $EnterpriseServerCore))) + { + Write-Verbose -Message $($LocalizedData.EnableServerManagerPSHCmdletsFeature) + + # Update:ServerManager-PSH-Cmdlets has a depndency on Powershell 2 update: MicrosoftWindowsPowerShell + # Hence enabling MicrosoftWindowsPowerShell. + dism /online /enable-feature /FeatureName:MicrosoftWindowsPowerShell | Out-Null + dism /online /enable-feature /FeatureName:ServerManager-PSH-Cmdlets | Out-Null + } + + if(Import-Module ServerManager -PassThru -Verbose:$false -ErrorAction Ignore) + { + } + else + { + + $serverManagerModuleNotFoundDebugMessage = $($LocalizedData.ServerManagerModuleNotFoundDebugMessage); + Write-Debug -Message $serverManagerModuleNotFoundDebugMessage; + + $errorId = "SkuNotSupported"; + $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidOperation + $errorMessage = $($LocalizedData.SkuNotSupported) + $exception = New-Object System.InvalidOperationException $errorMessage + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null + + $PSCmdlet.ThrowTerminatingError($errorRecord); + } +} + + +# IsWinServer2008R2SP1 is a helper function to detect if the target machine is a Win 2008 R2 SP1. +function IsWinServer2008R2SP1 +{ + param + ( + ) + + # We are already checking for the Presence of ServerManager module before using this helper function. + # Hence checking for the version shoudl be good enough to confirm that the target machine is + # Windows Server 2008 R2 machine. + if([Environment]::OSVersion.Version.ToString().Contains("6.1.")) + { + return $true; + } + + return $false; +} + +Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/MSFT_RoleResource.schema.mof b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/MSFT_RoleResource.schema.mof new file mode 100644 index 0000000..7fea155 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/MSFT_RoleResource.schema.mof differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/ko-KR/MSFT_RoleResource.schema.mfl b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/ko-KR/MSFT_RoleResource.schema.mfl new file mode 100644 index 0000000..ce43b89 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/ko-KR/MSFT_RoleResource.schema.mfl differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/ko-KR/MSFT_RoleResourceStrings.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/ko-KR/MSFT_RoleResourceStrings.psd1 new file mode 100644 index 0000000..a517a1b Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_RoleResource/ko-KR/MSFT_RoleResourceStrings.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/MSFT_ScriptResource.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/MSFT_ScriptResource.psm1 new file mode 100644 index 0000000..2480853 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/MSFT_ScriptResource.psm1 @@ -0,0 +1,326 @@ + +data LocalizedData +{ + # culture="en-US" + ConvertFrom-StringData @' +SetScriptWhatIfMessage=Executing the SetScript with the user supplied credential +InValidResultFromGetScriptError=Failure to get the results from the script in a hash table format. +InValidResultFromTestScriptError=Failure to get a valid result from the execution of TestScript. The Test script should return True or False. +ScriptBlockProviderScriptExecutionFailureError=Failure to successfully execute the script. +GetTargetResourceStartVerboseMessage=Begin executing Get Script. +GetTargetResourceEndVerboseMessage=End executing Get Script. +SetTargetResourceStartVerboseMessage=Begin executing Set Script. +SetTargetResourceEndVerboseMessage=End executing Set Script. +TestTargetResourceStartVerboseMessage=Begin executing Test Script. +TestTargetResourceEndVerboseMessage=End executing Test Script. +ExecutingScriptMessage=Executing Script: {0} +ResourceNotAllowedWhenDeviceGuardIsEnabled='Script' resource from 'PSDesiredStateConfiguration' module is not supported when Device Guard is enabled. Please use 'Script' resource published by PSDscResources module from PowerShell Gallery. +WarningRunningScriptResourceInFullLanguageMode=Running 'Script' resource in FullLanguage mode as Device Guard is enabled in 'Audit' mode. +'@ +} + +$GenericMessageEventID=0x1005; +$ClassName="MSFT_ScriptResource" + + +Import-LocalizedData LocalizedData -filename MSFT_ScriptResourceStrings + + +# The Get-TargetResource cmdlet is used to fetch the desired state of the DSC managed node through a powershell script. +# This cmdlet executes the user supplied script (i.e., the script is responsible for validating the desired state of the +# DSC managed node). The result of the script execution is in the form of a hashtable containing all the inormation +# gathered from the GetScript execution. +function Get-TargetResource +{ + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + $GetScript, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string]$SetScript, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + $TestScript, + + [Parameter(Mandatory=$false)] + [System.Management.Automation.PSCredential] + $Credential + ) + + # Inbox 'Script' resource is not allowed to execute if Device Guard is enabled. + # Check and throw terminating error if Device Guard is enabled. + CheckDeviceGuardStatus + + $getTargetResourceResult = $null; + + $getTargetResourceStartVerboseMessage = $($LocalizedData.GetTargetResourceStartVerboseMessage); + Write-Debug -Message $getTargetResourceStartVerboseMessage; + + $script = [ScriptBlock]::Create($GetScript); + $parameters = $psboundparameters.Remove("GetScript"); + $psboundparameters.Add("ScriptBlock", $script); + + $parameters = $psboundparameters.Remove("SetScript"); + $parameters = $psboundparameters.Remove("TestScript"); + + $scriptResult = ScriptExecutionHelper @psboundparameters; + + $scriptResultAsErrorRescord = $scriptResult -as [System.Management.Automation.ErrorRecord] + if($null -ne $scriptResultAsErrorRescord) + { + $PSCmdlet.ThrowTerminatingError($scriptResultAsErrorRescord); + } + + $scriptResultAsHasTable = $scriptResult -as [hashtable] + + if($null -ne $scriptResultAsHasTable) + { + $getTargetResourceResult = $scriptResultAsHasTable ; + } + else + { + # Error message indicating failure to get valid hashtable as the result of the Get script execution. + $errorId = "InValidResultFromGetScript"; + $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidResult; + $exception = New-Object System.InvalidOperationException $($LocalizedData.InValidResultFromGetScriptError); + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null + + $PSCmdlet.ThrowTerminatingError($errorRecord); + } + + $getTargetResourceEndVerboseMessage = $($LocalizedData.GetTargetResourceEndVerboseMessage); + Write-Debug -Message $getTargetResourceEndVerboseMessage; + + $getTargetResourceResult; +} + + +# The Set-TargetResource cmdlet is used to Set the desired state of the DSC managed node through a powershell script. +# The method executes the user supplied script (i.e., the script is responsible for validating the desired state of the +# DSC managed node). If the DSC managed node requires a restart either during or after the execution of the SetScript, +# the SetScript notifies the PS Infrasturcure by setting the variable $DSCMachineStatus.IsRestartRequired to $true. +function Set-TargetResource +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + $SetScript, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + $GetScript, + + [Parameter(Mandatory=$false)] + [System.Management.Automation.PSCredential] + $Credential, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + $TestScript + + ) + + # Inbox 'Script' resource is not allowed to execute if Device Guard is enabled. + # Check and throw terminating error if Device Guard is enabled. + CheckDeviceGuardStatus + + $setscriptmessage = '$SetScript:' + $SetScript + $testscriptmessage = '$TestScript:' + $TestScript + if ($pscmdlet.ShouldProcess($($LocalizedData.SetScriptWhatIfMessage))) + { + $setTargetResourceStartVerboseMessage = $($LocalizedData.SetTargetResourceStartVerboseMessage); + Write-Debug -Message $setTargetResourceStartVerboseMessage; + + $script = [ScriptBlock]::Create($SetScript); + $parameters = $psboundparameters.Remove("SetScript"); + $psboundparameters.Add("ScriptBlock", $script); + + $parameters = $psboundparameters.Remove("GetScript"); + $parameters = $psboundparameters.Remove("TestScript"); + + $scriptResult = ScriptExecutionHelper @psboundparameters ; + + $scriptResultAsErrorRescord = $scriptResult -as [System.Management.Automation.ErrorRecord] + if($null -ne $scriptResultAsErrorRescord) + { + $PSCmdlet.ThrowTerminatingError($scriptResultAsErrorRescord); + } + + $setTargetResourceEndVerboseMessage = $($LocalizedData.SetTargetResourceEndVerboseMessage); + Write-Debug -Message $setTargetResourceEndVerboseMessage; + } +} + + +# The Test-TargetResource cmdlet is used to validate the desired state of the DSC managed node through a powershell script. +# The method executes the user supplied script (i.e., the script is responsible for validating the desired state of the +# DSC managed node). The result of the script execution should be true if the DSC managed machine is in the desired state +# or else false should be returned. +function Test-TargetResource +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + $TestScript, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string]$SetScript, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string]$GetScript, + + [Parameter(Mandatory=$false)] + [System.Management.Automation.PSCredential] + $Credential + ) + + # Inbox 'Script' resource is not allowed to execute if Device Guard is enabled. + # Check and throw terminating error if Device Guard is enabled. + CheckDeviceGuardStatus + + $testTargetResourceResult = $false; + + $testTargetResourceStartVerboseMessage = $($LocalizedData.TestTargetResourceStartVerboseMessage); + Write-Debug -Message $testTargetResourceStartVerboseMessage; + + $script = [ScriptBlock]::Create($TestScript); + $parameters = $psboundparameters.Remove("TestScript"); + $psboundparameters.Add("ScriptBlock", $script); + + $parameters = $psboundparameters.Remove("GetScript"); + $parameters = $psboundparameters.Remove("SetScript"); + + $scriptResult = ScriptExecutionHelper @psboundparameters ; + + $scriptResultAsErrorRescord = $scriptResult -as [System.Management.Automation.ErrorRecord] + if($null -ne $scriptResultAsErrorRescord) + { + $PSCmdlet.ThrowTerminatingError($scriptResultAsErrorRescord); + } + + if($null -eq $scriptResult) + { + $errorId = "InValidResultFromTestScript"; + $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidResult; + $exception = New-Object System.InvalidOperationException $($LocalizedData.InValidResultFromTestScriptError) ; + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null + + $PSCmdlet.ThrowTerminatingError($errorRecord); + } + + # If the script is returing multiple objects, then we consider the last object to be the result of script execution. + if($scriptResult.GetType().ToString() -eq 'System.Object[]') + { + $reultObject = $scriptResult[$scriptResult.Length -1]; + } + else + { + $reultObject = $scriptResult; + } + + if(($null -ne $reultObject) -and + (($reultObject -eq $true) -or ($reultObject -eq $false))) + { + $testTargetResourceResult = $reultObject; + } + else + { + $errorId = "InValidResultFromTestScript"; + $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidResult; + $exception = New-Object System.InvalidOperationException $($LocalizedData.InValidResultFromTestScriptError) ; + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null + + $PSCmdlet.ThrowTerminatingError($errorRecord); + } + + $testTargetResourceEndVerboseMessage = $($LocalizedData.TestTargetResourceEndVerboseMessage); + Write-Debug -Message $testTargetResourceEndVerboseMessage; + + $testTargetResourceResult; +} + +function CheckDeviceGuardStatus +{ + try + { + # Check if Device Guard is enabled. + $systemLockdownPolicy = [System.Management.Automation.Security.SystemPolicy]::GetSystemLockdownPolicy() + if($systemLockdownPolicy -eq [System.Management.Automation.Security.SystemEnforcementMode]::Enforce) + { + $errorId = "ResourceNotAllowedWhenDeviceGuardIsEnabled"; + $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidOperation; + $exception = New-Object System.InvalidOperationException $($LocalizedData.ResourceNotAllowedWhenDeviceGuardIsEnabled); + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null + $PSCmdlet.ThrowTerminatingError($errorRecord); + } + elseif ($systemLockdownPolicy -eq [System.Management.Automation.Security.SystemEnforcementMode]::Audit) + { + Write-Warning ($LocalizedData.WarningRunningScriptResourceInFullLanguageMode) + } + } + catch + { + if($_.FullyQualifiedErrorId -eq 'TypeNotFound') + { + # [System.Management.Automation.Security.SystemPolicy] Type not found. + # It may happen with old PowerShell version. + # Silently continue. + return + } + + # Failed to get Device Guard status. + throw $_ + } +} + +function ScriptExecutionHelper +{ + param + ( + [ScriptBlock] + $ScriptBlock, + + [System.Management.Automation.PSCredential] + $Credential + ) + + $scriptExecutionResult = $null; + + try + { + + $executingScriptMessage = $($LocalizedData.ExecutingScriptMessage) -f ${ScriptBlock} ; + Write-Debug -Message $executingScriptMessage; + + if($null -ne $Credential) + { + $scriptExecutionResult = Invoke-Command -ScriptBlock $ScriptBlock -ComputerName . -Credential $Credential + } + else + { + $scriptExecutionResult = &$ScriptBlock; + } + $scriptExecutionResult; + } + catch + { + # Surfacing the error thrown by the execution of Get/Set/Test script. + $_; + } +} diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/MSFT_ScriptResource.schema.mof b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/MSFT_ScriptResource.schema.mof new file mode 100644 index 0000000..125dc8a Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/MSFT_ScriptResource.schema.mof differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/ko-KR/MSFT_ScriptResource.schema.mfl b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/ko-KR/MSFT_ScriptResource.schema.mfl new file mode 100644 index 0000000..3b8fd49 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/ko-KR/MSFT_ScriptResource.schema.mfl differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/ko-KR/MSFT_ScriptResourceStrings.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/ko-KR/MSFT_ScriptResourceStrings.psd1 new file mode 100644 index 0000000..ad483a1 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ScriptResource/ko-KR/MSFT_ScriptResourceStrings.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/MSFT_ServiceResource.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/MSFT_ServiceResource.psm1 new file mode 100644 index 0000000..f3c714b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/MSFT_ServiceResource.psm1 @@ -0,0 +1,1256 @@ +data LocalizedData +{ + # culture="en-US" + ConvertFrom-StringData @" +ServiceNotFound=Service '{0}' not found. +CannotStartAndDisable=Cannot start and disable a service. +CannotStopServiceSetToStartAutomatically=Cannot stop a service and set it to start automatically. +ServiceAlreadyStarted=Service '{0}' already started, no action required. +ServiceStarted=Service '{0}' started. +ServiceStopped=Service '{0}' stopped. +ErrorStartingService=Failure starting service '{0}'. Please check the path '{1}' provided for the service. Message: '{2}' +OnlyOneParameterCanBeSpecified=Only one of the following parameters can be specified: '{0}', '{1}'. +StartServiceWhatIf=Start Service +ServiceAlreadyStopped=Service '{0}' already stopped, no action required. +ErrorStoppingService=Failure stopping service '{0}'. Message: '{1}' +ErrorRetrievingServiceInformation=Failure retrieving information for service '{0}'. Message: '{1}' +ErrorSettingServiceCredential=Failure setting credentials for service '{0}'. Message: '{1}' +SetCredentialWhatIf=Set Credential +SetStartupTypeWhatIf=Set Start Type +ErrorSettingServiceStartupType=Failure setting start type for service '{0}'. Message: '{1}' +TestUserNameMismatch=User name for service '{0}' is '{1}'. It does not match '{2}. +TestStartupTypeMismatch=Startup type for service '{0}' is '{1}'. It does not match '{2}'. +MethodFailed=The '{0}' method of '{1}' failed with error code: '{2}'. +ErrorChangingProperty=Failed to change '{0}' property. Message: '{1}' +ErrorSetingLogOnAsServiceRightsForUser=Error granting '{0}' the right to log on as a service. Message: '{1}'. +CannotOpenPolicyErrorMessage=Cannot open policy manager +UserNameTooLongErrorMessage=User name is too long +CannotLookupNamesErrorMessage=Failed to lookup user name +CannotOpenAccountErrorMessage=Failed to open policy for user +CannotCreateAccountAccessErrorMessage=Failed to create policy for user +CannotGetAccountAccessErrorMessage=Failed to get user policy rights +CannotSetAccountAccessErrorMessage=Failed to set user policy rights +BinaryPathNotSpecified=Specify the path to the executable when trying to create a new service +ServiceAlreadyExists=The service '{0}' to create already exists +ServiceExistsSamePath=The service '{0}' to create already exists with path '{1}' +ServiceNotExists=The service '{0}' does not exist. Specify the path to the executable to create a new service +ErrorDeletingService=Error in deleting service '{0}' +ServiceDeletedSuccessfully=Service '{0}' Deleted Successfully +TryDeleteAgain=Wait for 2 milliseconds for a service to get deleted +WritePropertiesIgnored=Service '{0}' already exists. Write properties such as Status, DisplayName, Description, Dependencies will be ignored for existing services. +"@ +} + +Import-LocalizedData LocalizedData -filename MSFT_ServiceResource.strings.psd1 +$EscapedLocalizedData = @{} +foreach( $key in $LocalizedData.Keys ) +{ + $EscapedLocalizedData.Add($key, $LocalizedData[$key].Replace('"','""')) +} +$LocalizedData = $EscapedLocalizedData +Import-Module "$PSScriptRoot\..\RunAsHelper.psm1" + +<# +.Synopsis +Gets a service resource +#> +function Get-TargetResource +{ + param + ( + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Name + ) + + $svc = GetServiceResource $Name + $svcWmi = GetWMIService $Name + + return @{ + Name=$svc.Name + StartupType=(NormalizeStartupType $svcWmi.StartMode).ToString() + BuiltInAccount=if($svcWmi.StartName -ieq "LocalSystem") {"LocalSystem"} ` + elseif($svcWmi.StartName -ieq "NT Authority\NetworkService") {"NetworkService"} ` + elseif($svcWmi.StartName -ieq "NT Authority\LocalService") {"LocalService"} else {$null} + State=$svc.Status.ToString() + Path=$svcWmi.PathName + DisplayName=$svc.DisplayName + Description=$svcWmi.Description + Dependencies=[string[]](@() + ($svc.ServicesDependedOn | %{$_.Name})) + } +} + + +<# +.Synopsis +Tests a service resource +#> +function Test-TargetResource +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Name, + + [System.String] + [ValidateSet("Automatic", "Manual", "Disabled")] + $StartupType, + + [System.String] + [ValidateSet("LocalSystem", "LocalService", "NetworkService")] + $BuiltInAccount, + + [System.Management.Automation.PSCredential] + [ValidateNotNull()] + $Credential, + + [System.String] + [ValidateSet("Running", "Stopped")] + $State="Running", + + [System.String] + [ValidateNotNullOrEmpty()] + $DisplayName, + + [System.String] + [ValidateNotNullOrEmpty()] + $Description, + + [System.String] + [ValidateNotNullOrEmpty()] + $Path, + + [System.String[]] + [ValidateNotNullOrEmpty()] + $Dependencies, + + [System.String] + [ValidateSet("Present", "Absent")] + $Ensure="Present" + ) + + ValidateStartupType $Name $StartupType $State + + $serviceExists = ServiceExists -Name $Name -Path $Path -ErrorAction SilentlyContinue + + if($Ensure -eq "Absent") + { + if($serviceExists) + { + return $false + } + return $true + } + + if(!$serviceExists) + { + return $false; + } + + $svc=GetServiceResource $Name + + if($PSBoundParameters.ContainsKey("StartupType") -or $PSBoundParameters.ContainsKey("BuiltInAccount") -or $PSBoundParameters.ContainsKey("Credential")) + { + $svcWmi = GetWMIService $Name + + $getUserNameAndPasswordArgs=@{} + if($PSBoundParameters.ContainsKey("BuiltInAccount")) {$null=$getUserNameAndPasswordArgs.Add("BuiltInAccount",$BuiltInAccount)} + if($PSBoundParameters.ContainsKey("Credential")) {$null=$getUserNameAndPasswordArgs.Add("Credential",$Credential)} + + $userName,$password=GetUserNameAndPassword @getUserNameAndPasswordArgs + if($userName -ne $null -and !(TestUserName $SvcWmi $userName)) + { + write-verbose ($LocalizedData.TestUserNameMismatch -f $svcWmi.Name,$svcWmi.StartName,$userName) + return $false + } + + if($PSBoundParameters.ContainsKey("StartupType") -and !(TestStartupType $SvcWmi $StartupType)) + { + write-verbose ($LocalizedData.TestStartupTypeMismatch -f $svcWmi.Name,$svcWmi.StartMode,$StartupType) + return $false + } + } + + return ($State -eq "Stopped" -and $svc.Status -eq "Stopped") -or ($svc.Status -eq "Running" -and $State -eq "Running") +} + +<# +.Synopsis +Sets properties for a service resource +#> +function Set-TargetResource +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Name, + + [System.String] + [ValidateSet("Automatic", "Manual", "Disabled")] + $StartupType, + + [System.String] + [ValidateSet("LocalSystem", "LocalService", "NetworkService")] + $BuiltInAccount, + + [System.Management.Automation.PSCredential] + [ValidateNotNull()] + $Credential, + + [System.String] + [ValidateSet("Running", "Stopped")] + $State="Running", + + [System.String] + [ValidateNotNullOrEmpty()] + $DisplayName, + + [System.String] + [ValidateNotNullOrEmpty()] + $Description, + + [System.String] + [ValidateNotNullOrEmpty()] + $Path, + + [System.String[]] + [ValidateNotNullOrEmpty()] + $Dependencies, + + [System.String] + [ValidateSet("Present", "Absent")] + $Ensure="Present" + ) + + ValidateStartupType $Name $StartupType $State + + if($Ensure -eq "Absent") + { + $svc = GetServiceResource $Name + StopService $svc + DeleteService $svc.Name + return + } + + $serviceExists = ServiceExists -Name $Name -ErrorAction SilentlyContinue + + if($PSBoundParameters.ContainsKey("Path") -and $serviceExists) + { + if(CompareServicePath -Path $Path -Name $Name) + { + ThrowInvalidArgumentError "ServiceExistsSamePath" ($LocalizedData.ServiceExistsSamePath -f $Name, $Path) + } + ThrowInvalidArgumentError "ServiceAlreadyExists" ($LocalizedData.ServiceAlreadyExists -f $Name) + } + elseif($PSBoundParameters.ContainsKey("Path") -and !$serviceExists) + { + $argumentsToNewService = @{} + $argumentsToNewService.Add("Name", $Name) + $argumentsToNewService.Add("BinaryPathName", $Path) + if($PSBoundParameters.ContainsKey("Credential")) + { + $argumentsToNewService.Add("Credential", $Credential) + } + if($PSBoundParameters.ContainsKey("StartupType")) + { + $argumentsToNewService.Add("StartupType", $StartupType) + } + if($PSBoundParameters.ContainsKey("DisplayName")) + { + $argumentsToNewService.Add("DisplayName", $DisplayName) + } + if($PSBoundParameters.ContainsKey("Description")) + { + $argumentsToNewService.Add("Description", $Description) + } + if($PSBoundParameters.ContainsKey("Dependencies")) + { + $argumentsToNewService.Add("DependsOn", $Dependencies) + } + try + { + New-Service @argumentsToNewService + $serviceIsNew = $true + } + catch + { + Write-Log ("Error creating service `"$($argumentsToNewService["Name"])`"", $_.Exception.Message) + throw $_ + } + } + elseif(!$PSBoundParameters.ContainsKey("Path") -and !$serviceExists) + { + throw $LocalizedData.ServiceNotExists -f $Name + } + + $svc=GetServiceResource $Name + + if(!$serviceIsNew) + { + Write-Verbose ($LocalizedData.WritePropertiesIgnored -f $Name) + } + + $writeWritePropertiesArguments=@{Name=$svc.name} + if($PSBoundParameters.ContainsKey("StartupType")) {$null=$writeWritePropertiesArguments.Add("StartupType",$StartupType)} + if($PSBoundParameters.ContainsKey("BuiltInAccount")) {$null=$writeWritePropertiesArguments.Add("BuiltInAccount",$BuiltInAccount)} + if($PSBoundParameters.ContainsKey("Credential")) {$null=$writeWritePropertiesArguments.Add("Credential",$Credential)} + + WriteWriteProperties @writeWritePropertiesArguments + + if($State -eq "Stopped") + { + # Ensure service is stopped + StopService $svc + return + } + + # Default state of a newly created service is 'stopped'. If $State=Running, ensure service is started. + if($State -eq "Running") + { + StartService $svc + } +} + +<# +.Synopsis +Validates if a service exist using the Name parameter +#> +function ServiceExists +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Name, + + [System.String] + $Path + ) + + $service = Get-Service -Name $Name -ErrorAction SilentlyContinue + if($service -ne $null) + { + if($Path -ne $null -and $Path -ne '' -and !(CompareServicePath -Name $Name -Path $Path)){ + return $false + } + return $true + } + return $false +} + +<# +.Synopsis +Compares path to the service path, if the service exists. Returns true when path is same as service path. +#> +function CompareServicePath +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Path, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Name + ) + + $servicePath = (Get-CimInstance -Class win32_service | where {$_.Name -eq $Name}).PathName + $result = [string]::Compare($Path, $servicePath, [System.Globalization.CultureInfo]::CurrentUICulture) + + if($result -ne 0) + { + return $false + } + return $true +} + +<# +.Synopsis +Validates a StartupType against the State parameter +#> +function ValidateStartupType +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Name, + + [System.String] + $StartupType, + + [System.String] + [ValidateSet("Running", "Stopped")] + $State="Running" + ) + + if($StartupType -eq $null) {return} + + if($State -eq "Stopped") + { + if($StartupType -eq "Automatic") + { + # State = Stopped conflicts with Automatic or Delayed + ThrowInvalidArgumentError "CannotStopServiceSetToStartAutomatically" ($LocalizedData.CannotStopServiceSetToStartAutomatically -f $Name) + } + } + else + { + if($StartupType -eq "Disabled") + { + # State = Running conflicts with Disabled + ThrowInvalidArgumentError "CannotStartAndDisable" ($LocalizedData.CannotStartAndDisable -f $Name) + } + } +} + + +<# +.Synopsis +Writes all write properties if not already correctly set, logging errors and respecting whatif +#> +function WriteWriteProperties +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNull()] + $Name, + + [System.String] + [ValidateSet("Automatic", "Manual", "Disabled")] + $StartupType, + + [System.String] + [ValidateSet("LocalSystem", "LocalService", "NetworkService")] + $BuiltInAccount, + + [System.Management.Automation.PSCredential] + [ValidateNotNull()] + $Credential + ) + + if(!$PSBoundParameters.ContainsKey("StartupType") -and !$PSBoundParameters.ContainsKey("BuiltInAccount") -and !$PSBoundParameters.ContainsKey("Credential")) + { + return + } + + $svcWmi = GetWMIService $Name + + $writeCredentialPropertiesArguments=@{"SvcWmi"=$svcWmi} + if($PSBoundParameters.ContainsKey("BuiltInAccount")) {$null=$writeCredentialPropertiesArguments.Add("BuiltInAccount",$BuiltInAccount)} + if($PSBoundParameters.ContainsKey("Credential")) {$null=$writeCredentialPropertiesArguments.Add("Credential",$Credential)} + + WriteCredentialProperties @writeCredentialPropertiesArguments + + $writeStartupArguments=@{"SvcWmi"=$svcWmi} + if($PSBoundParameters.ContainsKey("StartupType")) {$null=$writeStartupArguments.Add("StartupType",$StartupType)} + WriteStartupTypeProperty @writeStartupArguments +} + +<# +.Synopsis +Gets a Win32_Service object corresponding to the name +#> +function GetWMIService +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNull()] + $Name + ) + + try + { + return Get-CimInstance -ClassName Win32_Service -Filter "Name='$Name'" + } + catch + { + Write-Verbose ($LocalizedData.ErrorRetrievingServiceInformation -f $Name,$_.Exception.Message) + throw + } +} + +<# +.Synopsis +Writes StartupType if not already correctly set, logging errors and respecting whatif +#> +function WriteStartupTypeProperty +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNull()] + $SvcWmi, + + [System.String] + $StartupType + ) + + if($PSBoundParameters.ContainsKey("StartupType") -and !(TestStartupType $SvcWmi $StartupType) -and $PSCmdlet.ShouldProcess($svcWmi.Name,$LocalizedData.SetStartupTypeWhatIf)) + { + $ret = Invoke-CimMethod -InputObject $SvcWmi -MethodName Change -Arguments @{StartMode=$StartupType} + if($ret.ReturnValue -ne 0) + { + $innerMessage = $LocalizedData.MethodFailed -f "Change","Win32_Service",$ret.ReturnValue + $message = $LocalizedData.ErrorChangingProperty -f "StartupType",$innerMessage + ThrowInvalidArgumentError "ChangeStartupTypeFailed" $message + } + } +} + + +<# +.Synopsis +Writes credential properties if not already correctly set, logging errors and respecting whatif +#> +function WriteCredentialProperties +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + + [parameter(Mandatory = $true)] + [ValidateNotNull()] + $SvcWmi, + + + [System.String] + [ValidateSet("LocalSystem", "LocalService", "NetworkService")] + $BuiltInAccount, + + [System.Management.Automation.PSCredential] + $Credential + ) + + if(!$PSBoundParameters.ContainsKey("Credential") -and !$PSBoundParameters.ContainsKey("BuiltInAccount")) + { + return + } + + if($PSBoundParameters.ContainsKey("Credential") -and $PSBoundParameters.ContainsKey("BuiltInAccount")) + { + ThrowInvalidArgumentError "OnlyCredentialOrBuiltInAccount" ($LocalizedData.OnlyOneParameterCanBeSpecified -f "Credential","BuiltInAccount") + } + + $getUserNameAndPasswordArgs=@{} + if($PSBoundParameters.ContainsKey("BuiltInAccount")) {$null=$getUserNameAndPasswordArgs.Add("BuiltInAccount",$BuiltInAccount)} + if($PSBoundParameters.ContainsKey("Credential")) {$null=$getUserNameAndPasswordArgs.Add("Credential",$Credential)} + + $userName,$password=GetUserNameAndPassword @getUserNameAndPasswordArgs + + if($userName -ne $null -and !(TestUserName $SvcWmi $userName) -and $PSCmdlet.ShouldProcess($SvcWmi.Name,$LocalizedData.SetCredentialWhatIf)) + { + if($PSBoundParameters.ContainsKey("Credential")) + { + SetLogOnAsServicePolicy $userName + } + + $ret = Invoke-CimMethod -InputObject $SvcWmi -MethodName Change -Arguments @{StartName=$userName;StartPassword=$password} + if($ret.ReturnValue -ne 0) + { + $innerMessage = $LocalizedData.MethodFailed -f "Change","Win32_Service",$ret.ReturnValue + $message = $LocalizedData.ErrorChangingProperty -f "Credential",$innerMessage + ThrowInvalidArgumentError "ChangeCredentialFailed" $message + } + } +} + +<# +.Synopsis +Returns true if the service's StartName matches $UserName +#> +function TestUserName +{ + param + ( + $SvcWmi, + + [string] + $UserName + ) + + return (NormalizeUserName $SvcWmi.StartName) -ieq $UserName +} + +function TestStartupType +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNull()] + $SvcWmi, + + [System.String] + $StartupType + ) + + return (NormalizeStartupType $SvcWmi.StartMode) -ieq $StartupType +} + + +<# +.Synopsis +Retrieves user name and password out of the BuiltInAccount and Credential parameters +#> +function GetUserNameAndPassword +{ + param + ( + [System.String] + [ValidateSet("LocalSystem", "LocalService", "NetworkService")] + $BuiltInAccount, + + [System.Management.Automation.PSCredential] + $Credential + ) + + if($PSBoundParameters.ContainsKey("BuiltInAccount")) + { + return (NormalizeUserName $BuiltInAccount.ToString()),$null + } + + if($PSBoundParameters.ContainsKey("Credential")) + { + return (NormalizeUserName $Credential.UserName),$Credential.GetNetworkCredential().Password + } + + return $null,$null +} + +<# +.Synopsis +Stops a service if it is not already stopped logging the result +#> +function StopService +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNull()] + $svc + ) + + if($svc.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Stopped) + { + Write-Log ($LocalizedData.ServiceAlreadyStopped -f $svc.Name) + return + } + + # Exceptions will be thrown, caught and logged by the infrastructure + $err=Stop-Service $svc.Name -force 2>&1 + if($err -eq $null) + { + Write-Log ($LocalizedData.ServiceStopped -f $svc.Name) + } + else + { + Write-Log ($LocalizedData.ErrorStoppingService -f $svc.Name,($err | Out-String)) + throw $err + } +} + +<# +.Synopsis +Starts a service if it is not already started logging the result +#> +function StartService +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNull()] + $svc + ) + + if($svc.Status -eq [System.ServiceProcess.ServiceControllerStatus]::Running) + { + Write-Log ($LocalizedData.ServiceAlreadyStarted -f $svc.Name) + return + } + + if($PSCmdlet.ShouldProcess($svc.Name,$LocalizedData.StartServiceWhatIf)) + { + try + { + $svc.Start() + $twoSeconds = New-Object timespan 20000000 + $svc.WaitForStatus("Running",$twoSeconds) + } + catch + { + $servicePath = (Get-CimInstance -Class win32_service | where {$_.Name -eq $Name}).PathName + $message = $LocalizedData.ErrorStartingService -f $svc.Name,$servicePath,$_.Exception.Message + ThrowInvalidArgumentError "ErrorStartingService" $message + } + + Write-Log ($LocalizedData.ServiceStarted -f $svc.Name) + } + +} + +<# +.Synopsis +Deletes a service +#> +function DeleteService +{ + [CmdletBinding(SupportsShouldProcess = $true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNull()] + $Name + ) + + $err = & "sc.exe" "delete" "$Name" + + for($i = 1; $i -lt 1000; $i++) + { + if(!(ServiceExists -Name $Name)) + { + $serviceDeletedSuccessfully = $true + break + } + + #try again after 2 millisecs if the service is not deleted. + Write-Verbose ($LocalizedData.TryDeleteAgain) + Start-Sleep .002 + } + if(!$serviceDeletedSuccessfully) + { + Write-Log ($LocalizedData.ErrorDeletingService -f $Name) + throw $LocalizedData.ErrorDeletingService -f $Name + } + else + { + Write-Log ($LocalizedData.ServiceDeletedSuccessfully -f $Name) + } +} + +function NormalizeStartupType([string]$StartupType) +{ + if ($StartupType -ieq 'Auto') {return "Automatic"} + return $StartupType +} + +function NormalizeUserName([string]$UserName) +{ + if ($UserName -ieq 'NetworkService') {return "NT Authority\NetworkService"} + if ($UserName -ieq 'LocalService') {return "NT Authority\LocalService"} + if ($UserName -ieq 'LocalSystem') {return ".\LocalSystem"} + if ($UserName.IndexOf("\") -eq -1) { return ".\" + $userName } + return $UserName +} + +<# +.Synopsis +Throws an argument error +#> +function ThrowInvalidArgumentError +{ + [CmdletBinding()] + param + ( + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $errorId, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $errorMessage + ) + + $errorCategory=[System.Management.Automation.ErrorCategory]::InvalidArgument + $exception = New-Object System.ArgumentException $errorMessage; + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null + throw $errorRecord +} + +<# +.Synopsis +Gets a service corresponding to a name, throwing an error if not found +#> +function GetServiceResource +{ + param + ( + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Name + ) + + $svc=Get-Service $name -ErrorAction Ignore + + if($svc -eq $null) + { + ThrowInvalidArgumentError "ServiceNotFound" ($LocalizedData.ServiceNotFound -f $Name) + } + + return $svc +} + +<# +.Synopsis +Grants log on as service right to the given user +#> +function SetLogOnAsServicePolicy([string]$userName) +{ + $logOnAsServiceText=@" + namespace LogOnAsServiceHelper + { + using Microsoft.Win32.SafeHandles; + using System; + using System.Runtime.ConstrainedExecution; + using System.Runtime.InteropServices; + using System.Security; + + public class NativeMethods + { + #region constants + // from ntlsa.h + private const int POLICY_LOOKUP_NAMES = 0x00000800; + private const int POLICY_CREATE_ACCOUNT = 0x00000010; + private const uint ACCOUNT_ADJUST_SYSTEM_ACCESS = 0x00000008; + private const uint ACCOUNT_VIEW = 0x00000001; + private const uint SECURITY_ACCESS_SERVICE_LOGON = 0x00000010; + + // from LsaUtils.h + private const uint STATUS_OBJECT_NAME_NOT_FOUND = 0xC0000034; + + // from lmcons.h + private const int UNLEN = 256; + private const int DNLEN = 15; + + // Extra characteres for "\","@" etc. + private const int EXTRA_LENGTH = 3; + #endregion constants + + #region interop structures + /// + /// Used to open a policy, but not containing anything meaqningful + /// + [StructLayout(LayoutKind.Sequential)] + private struct LSA_OBJECT_ATTRIBUTES + { + public UInt32 Length; + public IntPtr RootDirectory; + public IntPtr ObjectName; + public UInt32 Attributes; + public IntPtr SecurityDescriptor; + public IntPtr SecurityQualityOfService; + + public void Initialize() + { + this.Length = 0; + this.RootDirectory = IntPtr.Zero; + this.ObjectName = IntPtr.Zero; + this.Attributes = 0; + this.SecurityDescriptor = IntPtr.Zero; + this.SecurityQualityOfService = IntPtr.Zero; + } + } + + /// + /// LSA string + /// + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] + private struct LSA_UNICODE_STRING + { + internal ushort Length; + internal ushort MaximumLength; + [MarshalAs(UnmanagedType.LPWStr)] + internal string Buffer; + + internal void Set(string src) + { + this.Buffer = src; + this.Length = (ushort)(src.Length * sizeof(char)); + this.MaximumLength = (ushort)(this.Length + sizeof(char)); + } + } + + /// + /// Structure used as the last parameter for LSALookupNames + /// + [StructLayout(LayoutKind.Sequential)] + private struct LSA_TRANSLATED_SID2 + { + public uint Use; + public IntPtr SID; + public int DomainIndex; + public uint Flags; + }; + #endregion interop structures + + #region safe handles + /// + /// Handle for LSA objects including Policy and Account + /// + private class LsaSafeHandle : SafeHandleZeroOrMinusOneIsInvalid + { +#if CORECLR + [DllImport("api-ms-win-security-lsapolicy-l1-1-0.dll")] +#else + [DllImport("advapi32.dll")] +#endif + private static extern uint LsaClose(IntPtr ObjectHandle); + + /// + /// Prevents a default instance of the LsaPolicySafeHAndle class from being created. + /// + private LsaSafeHandle(): base(true) + { + } + + /// + /// Calls NativeMethods.CloseHandle(handle) + /// + /// the return of NativeMethods.CloseHandle(handle) +#if !CORECLR + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] +#endif + protected override bool ReleaseHandle() + { + long returnValue = LsaSafeHandle.LsaClose(this.handle); + return returnValue != 0; + + } + } + + /// + /// Handle for IntPtrs returned from Lsa calls that have to be freed with + /// LsaFreeMemory + /// + private class SafeLsaMemoryHandle : SafeHandleZeroOrMinusOneIsInvalid + { +#if CORECLR + [DllImport("api-ms-win-security-lsapolicy-l1-1-0.dll")] +#else + [DllImport("advapi32")] +#endif + internal static extern int LsaFreeMemory(IntPtr Buffer); + + private SafeLsaMemoryHandle() : base(true) { } + + private SafeLsaMemoryHandle(IntPtr handle) + : base(true) + { + SetHandle(handle); + } + + private static SafeLsaMemoryHandle InvalidHandle + { + get { return new SafeLsaMemoryHandle(IntPtr.Zero); } + } + + override protected bool ReleaseHandle() + { + return SafeLsaMemoryHandle.LsaFreeMemory(handle) == 0; + } + + internal IntPtr Memory + { + get + { + return this.handle; + } + } + } + #endregion safe handles + + #region interop function declarations + /// + /// Opens LSA Policy + /// +#if CORECLR + [DllImport("api-ms-win-security-lsapolicy-l1-1-0.dll", SetLastError = true, PreserveSig = true)] +#else + [DllImport("advapi32.dll", SetLastError = true, PreserveSig = true)] +#endif + private static extern uint LsaOpenPolicy( + IntPtr SystemName, + ref LSA_OBJECT_ATTRIBUTES ObjectAttributes, + uint DesiredAccess, + out LsaSafeHandle PolicyHandle + ); + + /// + /// Convert the name into a SID which is used in remaining calls + /// +#if CORECLR + [DllImport("api-ms-win-security-lsapolicy-l1-1-0.dll", CharSet = CharSet.Unicode, SetLastError = true)] +#else + [DllImport("advapi32", CharSet = CharSet.Unicode, SetLastError = true), SuppressUnmanagedCodeSecurityAttribute] +#endif + private static extern uint LsaLookupNames2( + LsaSafeHandle PolicyHandle, + uint Flags, + uint Count, + LSA_UNICODE_STRING[] Names, + out SafeLsaMemoryHandle ReferencedDomains, + out SafeLsaMemoryHandle Sids + ); + + /// + /// Opens the LSA account corresponding to the user's SID + /// +#if CORECLR + [DllImport("advapi32legacy.dll", SetLastError = true, PreserveSig = true)] +#else + [DllImport("advapi32.dll", SetLastError = true, PreserveSig = true)] +#endif + private static extern uint LsaOpenAccount( + LsaSafeHandle PolicyHandle, + IntPtr Sid, + uint Access, + out LsaSafeHandle AccountHandle); + + /// + /// Creates an LSA account corresponding to the user's SID + /// +#if CORECLR + [DllImport("advapi32legacy.dll", SetLastError = true, PreserveSig = true)] +#else + [DllImport("advapi32.dll", SetLastError = true, PreserveSig = true)] +#endif + private static extern uint LsaCreateAccount( + LsaSafeHandle PolicyHandle, + IntPtr Sid, + uint Access, + out LsaSafeHandle AccountHandle); + + /// + /// Gets the LSA Account access + /// +#if CORECLR + [DllImport("advapi32legacy.dll", SetLastError = true, PreserveSig = true)] +#else + [DllImport("advapi32.dll", SetLastError = true, PreserveSig = true)] +#endif + private static extern uint LsaGetSystemAccessAccount( + LsaSafeHandle AccountHandle, + out uint SystemAccess); + + /// + /// Sets the LSA Account access + /// +#if CORECLR + [DllImport("advapi32legacy.dll", SetLastError = true, PreserveSig = true)] +#else + [DllImport("advapi32.dll", SetLastError = true, PreserveSig = true)] +#endif + private static extern uint LsaSetSystemAccessAccount( + LsaSafeHandle AccountHandle, + uint SystemAccess); + #endregion interop function declarations + + /// + /// Sets the Log On As A Service Policy for , if not already set. + /// + /// the user name we want to allow logging on as a service + /// If the is null or empty. + /// In the following cases: + /// Failure opening the LSA Policy. + /// The is too large. + /// Failure looking up the user name. + /// Failure opening LSA account (other than account not found). + /// Failure creating LSA account. + /// Failure getting LSA account policy access. + /// Failure setting LSA account policy access. + /// + public static void SetLogOnAsServicePolicy(string userName) + { + if (String.IsNullOrEmpty(userName)) + { + throw new ArgumentNullException("userName"); + } + + LSA_OBJECT_ATTRIBUTES objectAttributes = new LSA_OBJECT_ATTRIBUTES(); + objectAttributes.Initialize(); + + // All handles are delcared in advance so they can be closed on finally + LsaSafeHandle policyHandle = null; + SafeLsaMemoryHandle referencedDomains = null; + SafeLsaMemoryHandle sids = null; + LsaSafeHandle accountHandle = null; + + try + { + uint status = LsaOpenPolicy( + IntPtr.Zero, + ref objectAttributes, + POLICY_LOOKUP_NAMES | POLICY_CREATE_ACCOUNT, + out policyHandle); + + if (status != 0) + { + throw new InvalidOperationException(@"CannotOpenPolicyErrorMessage"); + } + + // Unicode strings have a maximum length of 32KB. We don't want to create + // LSA strings with more than that. User lengths are much smaller so this check + // ensures userName's length is useful + if (userName.Length > UNLEN + DNLEN + EXTRA_LENGTH) + { + throw new InvalidOperationException(@"UserNameTooLongErrorMessage"); + } + + LSA_UNICODE_STRING lsaUserName = new LSA_UNICODE_STRING(); + lsaUserName.Set(userName); + + LSA_UNICODE_STRING[] names = new LSA_UNICODE_STRING[1]; + names[0].Set(userName); + + status = LsaLookupNames2( + policyHandle, + 0, + 1, + new LSA_UNICODE_STRING[] { lsaUserName }, + out referencedDomains, + out sids); + + if (status != 0) + { + throw new InvalidOperationException(@"CannotLookupNamesErrorMessage"); + } + + LSA_TRANSLATED_SID2 sid = (LSA_TRANSLATED_SID2)Marshal.PtrToStructure(sids.Memory, typeof(LSA_TRANSLATED_SID2)); + + + status = LsaOpenAccount(policyHandle, + sid.SID, + ACCOUNT_VIEW | ACCOUNT_ADJUST_SYSTEM_ACCESS, + out accountHandle); + + uint currentAccess = 0; + + if (status == 0) + { + status = LsaGetSystemAccessAccount(accountHandle, out currentAccess); + + if (status != 0) + { + throw new InvalidOperationException(@"CannotGetAccountAccessErrorMessage"); + } + + } + else if (status == STATUS_OBJECT_NAME_NOT_FOUND) + { + status = LsaCreateAccount( + policyHandle, + sid.SID, + ACCOUNT_ADJUST_SYSTEM_ACCESS, + out accountHandle); + + if (status != 0) + { + throw new InvalidOperationException(@"CannotCreateAccountAccessErrorMessage"); + } + } + else + { + throw new InvalidOperationException(@"CannotOpenAccountErrorMessage"); + } + + if ((currentAccess & SECURITY_ACCESS_SERVICE_LOGON) == 0) + { + status = LsaSetSystemAccessAccount( + accountHandle, + currentAccess | SECURITY_ACCESS_SERVICE_LOGON); + if (status != 0) + { + throw new InvalidOperationException(@"CannotSetAccountAccessErrorMessage"); + } + } + } + finally + { + if (policyHandle != null) { policyHandle.Close(); } + if (referencedDomains != null) { referencedDomains.Close(); } + if (sids != null) { sids.Close(); } + if (accountHandle != null) { accountHandle.Close(); } + } + } + } + } +"@ + + try + { + $existingType=[LogOnAsServiceHelper.NativeMethods] + } + catch + { + $logOnAsServiceText=$logOnAsServiceText.Replace("CannotOpenPolicyErrorMessage",$LocalizedData.CannotOpenPolicyErrorMessage) + $logOnAsServiceText=$logOnAsServiceText.Replace("UserNameTooLongErrorMessage",$LocalizedData.UserNameTooLongErrorMessage) + $logOnAsServiceText=$logOnAsServiceText.Replace("CannotLookupNamesErrorMessage",$LocalizedData.CannotLookupNamesErrorMessage) + $logOnAsServiceText=$logOnAsServiceText.Replace("CannotOpenAccountErrorMessage",$LocalizedData.CannotOpenAccountErrorMessage) + $logOnAsServiceText=$logOnAsServiceText.Replace("CannotCreateAccountAccessErrorMessage",$LocalizedData.CannotCreateAccountAccessErrorMessage) + $logOnAsServiceText=$logOnAsServiceText.Replace("CannotGetAccountAccessErrorMessage",$LocalizedData.CannotGetAccountAccessErrorMessage) + $logOnAsServiceText=$logOnAsServiceText.Replace("CannotSetAccountAccessErrorMessage",$LocalizedData.CannotSetAccountAccessErrorMessage) + + if(IsNanoServer) + { + $logOnAsServiceText = "#define CORECLR`n" + $logOnAsServiceText + } + $null = Add-Type $logOnAsServiceText -PassThru -Debug:$false + } + + if($userName.StartsWith(".\")) + { + $userName = $userName.Substring(2) + } + + try + { + [LogOnAsServiceHelper.NativeMethods]::SetLogOnAsServicePolicy($userName) + } + catch + { + $message = $LocalizedData.ErrorSetingLogOnAsServiceRightsForUser -f $userName,$_.Exception.Message + ThrowInvalidArgumentError "ErrorSetingLogOnAsServiceRightsForUser" $message + } +} + +function Write-Log +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Message + ) + + if ($PSCmdlet.ShouldProcess($Message, $null, $null)) + { + Write-Verbose $Message + } +} + +Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/MSFT_ServiceResource.schema.mof b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/MSFT_ServiceResource.schema.mof new file mode 100644 index 0000000..5e9fe81 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/MSFT_ServiceResource.schema.mof differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/ko-KR/MSFT_ServiceResource.schema.mfl b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/ko-KR/MSFT_ServiceResource.schema.mfl new file mode 100644 index 0000000..31e4524 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/ko-KR/MSFT_ServiceResource.schema.mfl differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/ko-KR/MSFT_ServiceResource.strings.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/ko-KR/MSFT_ServiceResource.strings.psd1 new file mode 100644 index 0000000..2247316 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_ServiceResource/ko-KR/MSFT_ServiceResource.strings.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/MSFT_UserResource.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/MSFT_UserResource.psm1 new file mode 100644 index 0000000..f50a7df --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/MSFT_UserResource.psm1 @@ -0,0 +1,1136 @@ +# A global variable that contains localized messages. +data LocalizedData +{ +# culture="en-US" +ConvertFrom-StringData @' +UserWithName=User: {0} +RemoveOperation=Remove +AddOperation=Add +SetOperation=Set +ConfigurationStarted=Configuration of user {0} started. +ConfigurationCompleted=Configuration of user {0} completed successfully. +UserCreated=User {0} created successfully. +UserUpdated=User {0} properties updated successfully. +UserRemoved=User {0} removed successfully. +NoConfigurationRequired=User {0} exists on this node with the desired properties. No action required. +NoConfigurationRequiredUserDoesNotExist=User {0} does not exist on this node. No action required. +InvalidUserName=The name {0} cannot be used. Names may not consist entirely of periods and/or spaces, or contain these characters: {1} +UserExists=A user with the name {0} exists. +UserDoesNotExist=A user with the name {0} does not exist. +PropertyMismatch=The value of the {0} property is expected to be {1} but it is {2}. +PasswordPropertyMismatch=The value of the {0} property does not match. +AllUserPropertisMatch=All {0} {1} properties match. +ConnectionError = There could be a possible connection error while trying to use the System.DirectoryServices API's. +MultipleMatches = There could be a possible multiple matches exception while trying to use the System.DirectoryServices API's. +'@ +} + +Import-LocalizedData LocalizedData -FileName MSFT_UserResource.strings.psd1 + +Import-Module "$PSScriptRoot\..\DSCResourceHelper.psm1" + +if (-not (IsNanoServer)) +{ + Add-Type -AssemblyName 'System.DirectoryServices.AccountManagement' +} + +<# +.Synopsys +The Get-TargetResource cmdlet. +#> +function Get-TargetResource +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $UserName + ) + + if (IsNanoServer) + { + Get-TargetResourceOnNanoServer @PSBoundParameters + } + else + { + Get-TargetResourceOnFullSKU @PSBoundParameters + } +} + +<# +.Synopsys +The Set-TargetResource cmdlet. +#> +function Set-TargetResource +{ + [CmdletBInding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $UserName, + + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present", + + [System.String] + $FullName, + + [System.String] + $Description, + + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $Password, + + [System.Boolean] + $Disabled, + + [System.Boolean] + $PasswordNeverExpires, + + [System.Boolean] + $PasswordChangeRequired, + + [System.Boolean] + $PasswordChangeNotAllowed + ) + + if (IsNanoServer) + { + Set-TargetResourceOnNanoServer @PSBoundParameters + } + else + { + Set-TargetResourceOnFullSKU @PSBoundParameters + } +} + +<# +.Synopsys +The Test-TargetResource cmdlet is used to validate if the resource is in a state as expected in the instance document. +#> +function Test-TargetResource +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $UserName, + + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present", + + [System.String] + $FullName, + + [System.String] + $Description, + + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $Password, + + [System.Boolean] + $Disabled, + + [System.Boolean] + $PasswordNeverExpires, + + [System.Boolean] + $PasswordChangeRequired, + + [System.Boolean] + $PasswordChangeNotAllowed + ) + + if (IsNanoServer) + { + Test-TargetResourceOnNanoServer @PSBoundParameters + } + else + { + Test-TargetResourceOnFullSKU @PSBoundParameters + } +} + + +<# +.Synopsys +The Get-TargetResource cmdlet. +#> +function Get-TargetResourceOnFullSKU +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $UserName + ) + + Set-StrictMode -Version Latest + + ValidateUserName -UserName $UserName + + # Try to find a user by a name. + $principalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext -ArgumentList ([System.DirectoryServices.AccountManagement.ContextType]::Machine) + + try + { + $user = [System.DirectoryServices.AccountManagement.UserPrincipal]::FindByIdentity($principalContext, $UserName); + if($user -ne $null) + { + # The user is found. Return all user properties and Ensure="Present". + $returnValue = @{ + UserName = $user.Name; + Ensure = "Present"; + FullName = $user.DisplayName; + Description = $user.Description; + Disabled = -not $user.Enabled; + PasswordNeverExpires = $user.PasswordNeverExpires; + PasswordChangeRequired = $null; + PasswordChangeNotAllowed = $user.UserCannotChangePassword; + } + + return $returnValue; + } + + # The user is not found. Return Ensure=Absent. + return @{ + UserName = $UserName; + Ensure = "Absent"; + } + } + catch + { + ThrowExceptionDueToDirectoryServicesError -ErrorId "MultipleMatches" -ErrorMessage ($LocalizedData.MultipleMatches + $_) + } + finally + { + if($user -ne $null) + { + $user.Dispose(); + } + + $principalContext.Dispose(); + } +} + +<# +.Synopsys +The Set-TargetResource cmdlet. +#> +function Set-TargetResourceOnFullSKU +{ + [CmdletBInding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $UserName, + + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present", + + [System.String] + $FullName, + + [System.String] + $Description, + + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $Password, + + [System.Boolean] + $Disabled, + + [System.Boolean] + $PasswordNeverExpires, + + [System.Boolean] + $PasswordChangeRequired, + + [System.Boolean] + $PasswordChangeNotAllowed + ) + + Set-StrictMode -Version Latest + + Write-Verbose -Message ($LocalizedData.ConfigurationStarted -f $UserName) + + ValidateUserName -UserName $UserName + + + # Try to find a user by a name. + $principalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext -ArgumentList ([System.DirectoryServices.AccountManagement.ContextType]::Machine) + + try + { + $user = [System.DirectoryServices.AccountManagement.UserPrincipal]::FindByIdentity($principalContext, $UserName); + if($Ensure -eq "Present") + { + # Ensure is set to "Present". + + $whatIfShouldProcess = $true; + $userExists = $false; + $saveChanges = $false; + + if($user -eq $null) + { + # A user does not exist. Check WhatIf for adding a user. + $whatIfShouldProcess = $pscmdlet.ShouldProcess($LocalizedData.UserWithName -f $UserName, $LocalizedData.AddOperation); + } + else + { + # A user exists. + $userExists = $true; + + # Check WhatIf for setting a user. + $whatIfShouldProcess = $pscmdlet.ShouldProcess($LocalizedData.UserWithName -f $UserName, $LocalizedData.SetOperation); + } + + if($whatIfShouldProcess) + { + if(-not $userExists) + { + # The user with the provided name does not exist. Add a new user. + $user = New-Object System.DirectoryServices.AccountManagement.UserPrincipal -ArgumentList $principalContext + $user.Name = $UserName; + $saveChanges = $true; + } + + # Set user properties. + if($PSBoundParameters.ContainsKey('FullName') -and (-not $userExists -or $FullName -ne $user.DisplayName)) + { + $user.DisplayName = $FullName; + $saveChanges = $true; + } + else + { + if(-not $userExists) + { + # For a newly created user, set the DisplayName property to an empty string. By default DisplayName is set to user's name. + $user.DisplayName = [String]::Empty; + } + } + + if($PSBoundParameters.ContainsKey('Description') -and (-not $userExists -or $Description -ne $user.Description)) + { + $user.Description = $Description; + $saveChanges = $true; + } + + # Password. Set the password regardless of the state of the user. + if($PSBoundParameters.ContainsKey('Password')) + { + $user.SetPassword($Password.GetNetworkCredential().Password); + $saveChanges = $true; + } + + if($PSBoundParameters.ContainsKey('Disabled') -and (-not $userExists -or $Disabled -eq $user.Enabled)) + { + $user.Enabled = -not $Disabled; + $saveChanges = $true; + } + + if($PSBoundParameters.ContainsKey('PasswordNeverExpires') -and (-not $userExists -or $PasswordNeverExpires -ne $user.PasswordNeverExpires)) + { + $user.PasswordNeverExpires = $PasswordNeverExpires; + $saveChanges = $true; + } + + if($PSBoundParameters.ContainsKey('PasswordChangeRequired')) + { + if($PasswordChangeRequired) + { + # Expire the password. This will force the user to change the password at the next logon. + $user.ExpirePasswordNow(); + $saveChanges = $true; + } + } + + if($PSBoundParameters.ContainsKey('PasswordChangeNotAllowed') -and (-not $userExists -or $PasswordChangeNotAllowed -ne $user.UserCannotChangePassword)) + { + $user.UserCannotChangePassword = $PasswordChangeNotAllowed; + $saveChanges = $true; + + } + + if($saveChanges) + { + $user.Save(); + + # Send an operation success verbose message. + if($userExists) + { + Write-Verbose -Message ($LocalizedData.UserUpdated -f $UserName) + } + else + { + Write-Verbose -Message ($LocalizedData.UserCreated -f $UserName) + } + } + else + { + Write-Verbose -Message ($LocalizedData.NoConfigurationRequired -f $UserName) + } + } + } + else + { + # Ensure is set to "Absent". + if($user -ne $null) + { + # The user exists. + if($pscmdlet.ShouldProcess($LocalizedData.UserWithName -f $UserName, $LocalizedData.RemoveOperation)) + { + # Remove the user by the provided name. + $user.Delete(); + } + + Write-Verbose -Message ($LocalizedData.UserRemoved -f $UserName) + } + else + { + Write-Verbose -Message ($LocalizedData.NoConfigurationRequiredUserDoesNotExist -f $UserName) + } + } + } + catch + { + ThrowExceptionDueToDirectoryServicesError -ErrorId "MultipleMatches" -ErrorMessage ($LocalizedData.MultipleMatches + $_) + } + finally + { + if($user -ne $null) + { + $user.Dispose(); + } + + $principalContext.Dispose(); + } + + Write-Verbose -Message ($LocalizedData.ConfigurationCompleted -f $UserName) +} + +<# +.Synopsys +The Test-TargetResource cmdlet is used to validate if the resource is in a state as expected in the instance document. +#> +function Test-TargetResourceOnFullSKU +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $UserName, + + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present", + + [System.String] + $FullName, + + [System.String] + $Description, + + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $Password, + + [System.Boolean] + $Disabled, + + [System.Boolean] + $PasswordNeverExpires, + + [System.Boolean] + $PasswordChangeRequired, + + [System.Boolean] + $PasswordChangeNotAllowed + ) + + Set-StrictMode -Version Latest + + ValidateUserName -UserName $UserName + + # Try to find a user by a name. + $principalContext = New-Object System.DirectoryServices.AccountManagement.PrincipalContext -ArgumentList ([System.DirectoryServices.AccountManagement.ContextType]::Machine) + + try + { + $user = [System.DirectoryServices.AccountManagement.UserPrincipal]::FindByIdentity($principalContext, $UserName); + if($user -eq $null) + { + # A user with the provided name does not exist. + Write-Log -Message ($LocalizedData.UserDoesNotExist -f $UserName) + + if($Ensure -eq "Absent") + { + return $true; + } + else + { + return $false; + } + } + + # A user with the provided name exists. + Write-Log -Message ($LocalizedData.UserExists -f $UserName) + + # Validate separate properties. + if($Ensure -eq "Absent") + { + Write-Log -Message ($LocalizedData.PropertyMismatch -f "Ensure", "Absent", "Present") + return $false; # The Ensure property does not match. Return $false; + } + + if($PSBoundParameters.ContainsKey('FullName') -and $FullName -ne $user.DisplayName) + { + Write-Log -Message ($LocalizedData.PropertyMismatch -f "FullName", $FullName, $user.DisplayName) + return $false; # The FullName property does not match. Return $false; + } + + if($PSBoundParameters.ContainsKey('Description') -and $Description -ne $user.Description) + { + Write-Log -Message ($LocalizedData.PropertyMismatch -f "Description", $Description, $user.Description) + return $false; # The Description property does not match. Return $false; + } + + # Password + if($PSBoundParameters.ContainsKey('Password')) + { + if(-not $principalContext.ValidateCredentials($UserName, $Password.GetNetworkCredential().Password)) + { + Write-Log -Message ($LocalizedData.PasswordPropertyMismatch -f "Password") + return $false; # The Password property does not match. Return $false; + } + } + + if($PSBoundParameters.ContainsKey('Disabled') -and $Disabled -eq $user.Enabled) + { + Write-Log -Message ($LocalizedData.PropertyMismatch -f "Disabled", $Disabled, $user.Enabled) + return $false; # The Disabled property does not match. Return $false; + } + + if($PSBoundParameters.ContainsKey('PasswordNeverExpires') -and $PasswordNeverExpires -ne $user.PasswordNeverExpires) + { + Write-Log -Message ($LocalizedData.PropertyMismatch -f "PasswordNeverExpires", $PasswordNeverExpires, $user.PasswordNeverExpires) + return $false; # The PasswordNeverExpires property does not match. Return $false; + } + + if($PSBoundParameters.ContainsKey('PasswordChangeNotAllowed') -and $PasswordChangeNotAllowed -ne $user.UserCannotChangePassword) + { + Write-Log -Message ($LocalizedData.PropertyMismatch -f "PasswordChangeNotAllowed", $PasswordChangeNotAllowed, $user.UserCannotChangePassword) + return $false; # The PasswordChangeNotAllowed property does not match. Return $false; + } + } + catch + { + ThrowExceptionDueToDirectoryServicesError -ErrorId "ConnectionError" -ErrorMessage ($LocalizedData.ConnectionError + $_) + } + + finally + { + if($user -ne $null) + { + $user.Dispose(); + } + + $principalContext.Dispose(); + + } + + # All properties match. Return $true. + Write-Log -Message ($LocalizedData.AllUserPropertisMatch -f "User", $UserName) + return $true; +} + + +<# +.Synopsys +The Get-TargetResource cmdlet. +#> +function Get-TargetResourceOnNanoServer +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $UserName + ) + + Set-StrictMode -Version Latest + + ValidateUserName -UserName $UserName + + # Try to find a user by a name. + try + { + [Microsoft.PowerShell.Commands.LocalUser] $user = Get-LocalUser -Name $UserName -ErrorAction Stop + } + catch [System.Exception] + { + if ($_.CategoryInfo.ToString().Contains('UserNotFoundException')) + { + # The user is not found. Return Ensure=Absent. + return @{ + UserName = $UserName; + Ensure = "Absent"; + } + } + Throw-TerminatingError -ErrorRecord $_ + } + + # The user is found. Return all user properties and Ensure="Present". + $returnValue = @{ + UserName = $user.Name; + Ensure = "Present"; + FullName = $user.FullName; + Description = $user.Description; + Disabled = -not $user.Enabled; + PasswordChangeRequired = $null; + PasswordChangeNotAllowed = -not $user.UserMayChangePassword; + } + + if ($user.PasswordExpires) + { + $returnValue.Add('PasswordNeverExpires', $false) + } + else + { + $returnValue.Add('PasswordNeverExpires', $true) + } + + return $returnValue; +} + +<# +.Synopsys +The Set-TargetResource cmdlet. +#> +function Set-TargetResourceOnNanoServer +{ + [CmdletBInding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $UserName, + + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present", + + [System.String] + $FullName, + + [System.String] + $Description, + + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $Password, + + [System.Boolean] + $Disabled, + + [System.Boolean] + $PasswordNeverExpires, + + [System.Boolean] + $PasswordChangeRequired, + + [System.Boolean] + $PasswordChangeNotAllowed + ) + + Set-StrictMode -Version Latest + + Write-Verbose -Message ($LocalizedData.ConfigurationStarted -f $UserName) + + ValidateUserName -UserName $UserName + + ## Try to find a user by a name. + [bool] $userExists = $false + try + { + [Microsoft.PowerShell.Commands.LocalUser] $user = Get-LocalUser -Name $UserName -ErrorAction Stop + $userExists = $true; + } + catch [System.Exception] + { + if ($_.CategoryInfo.ToString().Contains('UserNotFoundException')) + { + # The user is not found. + Write-Log -Message ($LocalizedData.UserDoesNotExist -f $UserName) + } + else + { + Throw-TerminatingError -ErrorRecord $_ + } + } + + if($Ensure -eq "Present") + { + # Ensure is set to "Present". + + if(-not $userExists) + { + # The user with the provided name does not exist. Add a new user. + New-LocalUser -Name $UserName -NoPassword + Write-Verbose -Message ($LocalizedData.UserCreated -f $UserName) + } + + # Set user properties. + if($PSBoundParameters.ContainsKey('FullName')) + { + if (-not $userExists -or $FullName -ne $user.FullName) + { + if ($FullName -eq $null) + { + Set-LocalUser -Name $UserName -FullName ([String]::Empty) + } + else + { + Set-LocalUser -Name $UserName -FullName $FullName + } + } + } + else + { + if (-not $userExists) + { + # For a newly created user, set the DisplayName property to an empty string. By default DisplayName is set to user's name. + Set-LocalUser -Name $UserName -FullName ([String]::Empty) + } + } + + if($PSBoundParameters.ContainsKey('Description') -and (-not $userExists -or $Description -ne $user.Description)) + { + if ($Description -eq $null) + { + Set-LocalUser -Name $UserName -Description ([String]::Empty) + } + else + { + Set-LocalUser -Name $UserName -Description $Description + } + } + + # Password. Set the password regardless of the state of the user. + if($PSBoundParameters.ContainsKey('Password')) + { + Set-LocalUser -Name $UserName -Password $Password.Password + } + + if($PSBoundParameters.ContainsKey('Disabled') -and (-not $userExists -or $Disabled -eq $user.Enabled)) + { + if ($Disabled) + { + Disable-LocalUser -Name $UserName + } + else + { + Enable-LocalUser -Name $UserName + } + } + + $existingUserPasswordNeverExpires = (($userExists) -and ($user.PasswordExpires -eq $null)) + if($PSBoundParameters.ContainsKey('PasswordNeverExpires') -and (-not $userExists -or ($PasswordNeverExpires -ne $existingUserPasswordNeverExpires))) + { + Set-LocalUser -Name $UserName -PasswordNeverExpires:$passwordNeverExpires + } + + # NOTE: The parameter name and the property name have opposite meaning. + [bool] $expected = -not $PasswordChangeNotAllowed + [bool] $actual = $expected + if($userExists) { + $actual = $user.UserMayChangePassword + } + if($PSBoundParameters.ContainsKey('PasswordChangeNotAllowed') -and (-not $userExists -or $expected -ne $actual)) + { + Set-LocalUser -Name $UserName -UserMayChangePassword $expected + } + } + else + { + # Ensure is set to "Absent". + if($userExists) + { + # The user exists. + Remove-LocalUser -Name $UserName + + Write-Verbose -Message ($LocalizedData.UserRemoved -f $UserName) + } + else + { + Write-Verbose -Message ($LocalizedData.NoConfigurationRequiredUserDoesNotExist -f $UserName) + } + } + + + Write-Verbose -Message ($LocalizedData.ConfigurationCompleted -f $UserName) +} + +<# +.Synopsys +The Test-TargetResource cmdlet is used to validate if the resource is in a state as expected in the instance document. +#> +function Test-TargetResourceOnNanoServer +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $UserName, + + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present", + + [System.String] + $FullName, + + [System.String] + $Description, + + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $Password, + + [System.Boolean] + $Disabled, + + [System.Boolean] + $PasswordNeverExpires, + + [System.Boolean] + $PasswordChangeRequired, + + [System.Boolean] + $PasswordChangeNotAllowed + ) + + Set-StrictMode -Version Latest + + ValidateUserName -UserName $UserName + + # Try to find a user by a name. + try + { + [Microsoft.PowerShell.Commands.LocalUser] $user = Get-LocalUser -Name $UserName -ErrorAction Stop + } + catch [System.Exception] + { + if ($_.CategoryInfo.ToString().Contains('UserNotFoundException')) + { + # The user is not found. Return Ensure=Absent. + if($Ensure -eq "Absent") + { + return $true + } + else + { + return $false + } + } + Throw-TerminatingError -ErrorRecord $_ + } + + # A user with the provided name exists. + Write-Log -Message ($LocalizedData.UserExists -f $UserName) + + # Validate separate properties. + if($Ensure -eq "Absent") + { + Write-Log -Message ($LocalizedData.PropertyMismatch -f "Ensure", "Absent", "Present") + return $false; # The Ensure property does not match. Return $false; + } + + if($PSBoundParameters.ContainsKey('FullName') -and $FullName -ne $user.FullName) + { + Write-Log -Message ($LocalizedData.PropertyMismatch -f "FullName", $FullName, $user.FullName) + return $false; # The FullName property does not match. Return $false; + } + + if($PSBoundParameters.ContainsKey('Description') -and $Description -ne $user.Description) + { + Write-Log -Message ($LocalizedData.PropertyMismatch -f "Description", $Description, $user.Description) + return $false; # The Description property does not match. Return $false; + } + + if($PSBoundParameters.ContainsKey('Password')) + { + if(-not (ValidateCredentialsOnNanoServer -UserName $UserName -Password $Password.Password)) + { + Write-Log -Message ($LocalizedData.PasswordPropertyMismatch -f "Password") + return $false; # The Password property does not match. Return $false; + } + } + + if($PSBoundParameters.ContainsKey('Disabled') -and $Disabled -eq $user.Enabled) + { + Write-Log -Message ($LocalizedData.PropertyMismatch -f "Disabled", $Disabled, $user.Enabled) + return $false; # The Disabled property does not match. Return $false; + } + + $existingUserPasswordNeverExpires = ($user.PasswordExpires -eq $null) + if($PSBoundParameters.ContainsKey('PasswordNeverExpires') -and $PasswordNeverExpires -ne $existingUserPasswordNeverExpires) + { + Write-Log -Message ($LocalizedData.PropertyMismatch -f "PasswordNeverExpires", $PasswordNeverExpires, $existingUserPasswordNeverExpires) + return $false; # The PasswordNeverExpires property does not match. Return $false; + } + + if($PSBoundParameters.ContainsKey('PasswordChangeNotAllowed') -and $PasswordChangeNotAllowed -ne (-not $user.UserMayChangePassword)) + { + Write-Log -Message ($LocalizedData.PropertyMismatch -f "PasswordChangeNotAllowed", $PasswordChangeNotAllowed, (-not $user.UserMayChangePassword)) + return $false; # The PasswordChangeNotAllowed property does not match. Return $false; + } + + # All properties match. Return $true. + Write-Log -Message ($LocalizedData.AllUserPropertisMatch -f "User", $UserName) + return $true; +} + +<# +.Synopsis +Validates the User name for invalid charecters. +#> +function ValidateUserName +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $UserName + ) + + # Check if the name consists of only periods and/or white spaces. + $wrongName = $true; + for($i = 0; $i -lt $UserName.Length; $i++) + { + if(-not [Char]::IsWhiteSpace($UserName, $i) -and $UserName[$i] -ne '.') + { + $wrongName = $false; + break; + } + } + + $invalidChars = @('\','/','"','[',']',':','|','<','>','+','=',';',',','?','*','@') + + if($wrongName) + { + ThrowInvalidArgumentError -ErrorId "UserNameHasOnlyWhiteSpacesAndDots" -ErrorMessage ($LocalizedData.InvalidUserName -f $UserName, [string]::Join(" ", $invalidChars)) + } + + if($UserName.IndexOfAny($invalidChars) -ne -1) + { + ThrowInvalidArgumentError -ErrorId "UserNameHasInvalidCharachter" -ErrorMessage ($LocalizedData.InvalidUserName -f $UserName, [string]::Join(" ", $invalidChars)) + } +} + +<# +.Synopsis +Throws an argument error. +#> +function ThrowInvalidArgumentError +{ + [CmdletBinding()] + param + ( + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $ErrorId, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $ErrorMessage + ) + + $errorCategory=[System.Management.Automation.ErrorCategory]::InvalidArgument + $exception = New-Object System.ArgumentException $ErrorMessage; + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $ErrorId, $errorCategory, $null + throw $errorRecord +} + +function ThrowExceptionDueToDirectoryServicesError +{ + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $ErrorId, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $ErrorMessage + ) + + $errorCategory = [System.Management.Automation.ErrorCategory]::ConnectionError + $exception = New-Object System.ArgumentException $ErrorMessage + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $ErrorId, $errorCategory, $null + throw $errorRecord +} + +Function Throw-TerminatingError +{ + param( + [string] $Message, + [System.Management.Automation.ErrorRecord] $ErrorRecord + ) + + + if ($ErrorRecord -ne $null) + { + $exception = new-object "System.InvalidOperationException" $Message,$ErrorRecord.Exception + } + else + { + $exception = new-object "System.InvalidOperationException" $Message + } + $errorRecord = New-Object System.Management.Automation.ErrorRecord $exception,"MachineStateIncorrect","InvalidOperation",$null + throw $errorRecord +} + +<# +.Synopsis +Writes either to Verbose or ShouldProcess channel. +#> +function Write-Log +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $Message + ) + + if ($PSCmdlet.ShouldProcess($Message, $null, $null)) + { + Write-Verbose $Message + } +} + +<# +.Synopsis +Validates the local user's credentials on the local machine. +#> +Function ValidateCredentialsOnNanoServer +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $UserName, + + [ValidateNotNullOrEmpty()] + [securestring] + $Password + ) + + $source = @' + [Flags] + private enum LogonType + { + Logon32LogonInteractive = 2, + Logon32LogonNetwork, + Logon32LogonBatch, + Logon32LogonService, + Logon32LogonUnlock, + Logon32LogonNetworkCleartext, + Logon32LogonNewCredentials + } + + [Flags] + private enum LogonProvider + { + Logon32ProviderDefault = 0, + Logon32ProviderWinnt35, + Logon32ProviderWinnt40, + Logon32ProviderWinnt50 + } + + [DllImport("api-ms-win-security-logon-l1-1-1.dll", CharSet = CharSet.Unicode, SetLastError = true)] + private static extern Boolean LogonUser( + String lpszUserName, + String lpszDomain, + IntPtr lpszPassword, + LogonType dwLogonType, + LogonProvider dwLogonProvider, + out IntPtr phToken + ); + + + [DllImport("api-ms-win-core-handle-l1-1-0.dll", + EntryPoint = "CloseHandle", SetLastError = true, + CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)] + internal static extern bool CloseHandle(IntPtr handle); + + public static bool ValidateCredentials(string username, SecureString password) + { + IntPtr tokenHandle = IntPtr.Zero; + IntPtr unmanagedPassword = IntPtr.Zero; + + unmanagedPassword = SecureStringMarshal.SecureStringToCoTaskMemUnicode(password); + + try + { + return LogonUser( + username, + null, + unmanagedPassword, + LogonType.Logon32LogonInteractive, + LogonProvider.Logon32ProviderDefault, + out tokenHandle); + } + catch + { + return false; + } + finally + { + if (tokenHandle != IntPtr.Zero) + { + CloseHandle(tokenHandle); + } + if (unmanagedPassword != IntPtr.Zero) { + Marshal.ZeroFreeCoTaskMemUnicode(unmanagedPassword); + } + unmanagedPassword = IntPtr.Zero; + } + } +'@ + + Add-Type -PassThru -Namespace Microsoft.Windows.DesiredStateConfiguration.NanoServer.UserResource ` + -Name CredentialsValidationTool -MemberDefinition $source -Using System.Security -ReferencedAssemblies System.Security.SecureString.dll | Out-Null + return [Microsoft.Windows.DesiredStateConfiguration.NanoServer.UserResource.CredentialsValidationTool]::ValidateCredentials($UserName, $Password) +} + + +Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/MSFT_UserResource.schema.mof b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/MSFT_UserResource.schema.mof new file mode 100644 index 0000000..2287266 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/MSFT_UserResource.schema.mof differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/ko-KR/MSFT_UserResource.schema.mfl b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/ko-KR/MSFT_UserResource.schema.mfl new file mode 100644 index 0000000..1b9725c Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/ko-KR/MSFT_UserResource.schema.mfl differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/ko-KR/MSFT_UserResource.strings.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/ko-KR/MSFT_UserResource.strings.psd1 new file mode 100644 index 0000000..ef7543b Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_UserResource/ko-KR/MSFT_UserResource.strings.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAll/MSFT_WaitForAll.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAll/MSFT_WaitForAll.psm1 new file mode 100644 index 0000000..f16256d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAll/MSFT_WaitForAll.psm1 @@ -0,0 +1,113 @@ +# +# WaitForAll +# + +# +# The Get-TargetResource cmdlet. +# +function Get-TargetResource +{ + param + ( + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string] $ResourceName, + + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string[]] $NodeName, + + [ValidateRange(1,[Uint64]::MaxValue)] + [Uint64] $RetryIntervalSec = 1, + + [Uint32] $RetryCount = 0, + + [Uint32] $ThrottleLimit = 32 #Powershell New-CimSession default throttle value + ) + + + Import-Module $PSScriptRoot\..\..\PSDSCxMachine.psm1 -Verbose:$false + + return PSDSCxMachine\Get-_InternalPSDscXMachineTR ` + -RemoteResourceId $ResourceName ` + -RemoteMachine $NodeName ` + -MinimalNumberOfMachineInState $NodeName.Count ` + -RetryIntervalSec $RetryIntervalSec ` + -RetryCount $RetryCount ` + -ThrottleLimit $ThrottleLimit +} + +# +# The Set-TargetResource cmdlet. +# +function Set-TargetResource +{ + param + ( + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string] $ResourceName, + + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string[]] $NodeName, + + [ValidateRange(1,[Uint64]::MaxValue)] + [Uint64] $RetryIntervalSec = 1, + + [Uint32] $RetryCount = 0, + + [Uint32] $ThrottleLimit = 32 #Powershell New-CimSession default throttle value + ) + + Import-Module $PSScriptRoot\..\..\PSDSCxMachine.psm1 -Verbose:$false + + PSDSCxMachine\Set-_InternalPSDscXMachineTR ` + -RemoteResourceId $ResourceName ` + -RemoteMachine $NodeName ` + -MinimalNumberOfMachineInState $NodeName.Count ` + -RetryIntervalSec $RetryIntervalSec ` + -RetryCount $RetryCount ` + -ThrottleLimit $ThrottleLimit ` + -Verbose:$($PSBoundParameters["Verbose"] -eq $true) +} + +# +# Test-TargetResource +# +# +function Test-TargetResource +{ + param + ( + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string] $ResourceName, + + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string[]] $NodeName, + + [ValidateRange(1,[Uint64]::MaxValue)] + [Uint64] $RetryIntervalSec = 1, + + [Uint32] $RetryCount = 0, + + [Uint32] $ThrottleLimit = 32 #Powershell New-CimSession default throttle value + ) + + Import-Module $PSScriptRoot\..\..\PSDSCxMachine.psm1 -Verbose:$false + + return PSDSCxMachine\Test-_InternalPSDscXMachineTR ` + -RemoteResourceId $ResourceName ` + -RemoteMachine $NodeName ` + -MinimalNumberOfMachineInState $NodeName.Count ` + -RetryIntervalSec $RetryIntervalSec ` + -RetryCount $RetryCount ` + -ThrottleLimit $ThrottleLimit ` + -Verbose:$($PSBoundParameters["Verbose"] -eq $true) +} + + + +Export-ModuleMember -Function *-TargetResource \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAll/MSFT_WaitForAll.schema.mof b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAll/MSFT_WaitForAll.schema.mof new file mode 100644 index 0000000..52f0af5 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAll/MSFT_WaitForAll.schema.mof differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAll/ko-KR/MSFT_WaitForAll.schema.mfl b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAll/ko-KR/MSFT_WaitForAll.schema.mfl new file mode 100644 index 0000000..1c738ef Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAll/ko-KR/MSFT_WaitForAll.schema.mfl differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAny/MSFT_WaitForAny.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAny/MSFT_WaitForAny.psm1 new file mode 100644 index 0000000..16457be --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAny/MSFT_WaitForAny.psm1 @@ -0,0 +1,113 @@ +# +# WaitForAny +# + +# +# The Get-TargetResource cmdlet. +# +function Get-TargetResource +{ + param + ( + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string] $ResourceName, + + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string[]] $NodeName, + + [ValidateRange(1,[Uint64]::MaxValue)] + [Uint64] $RetryIntervalSec = 1, + + [Uint32] $RetryCount = 0, + + [Uint32] $ThrottleLimit = 32 #Powershell New-CimSession default throttle value + ) + + Import-Module $PSScriptRoot\..\..\PSDSCxMachine.psm1 -Verbose:$false + + return PSDSCxMachine\Get-_InternalPSDscXMachineTR ` + -RemoteResourceId $ResourceName ` + -RemoteMachine $NodeName ` + -MinimalNumberOfMachineInState 1 ` + -RetryIntervalSec $RetryIntervalSec ` + -RetryCount $RetryCount ` + -ThrottleLimit $ThrottleLimit +} + +# +# The Set-TargetResource cmdlet. +# +function Set-TargetResource +{ + param + ( + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string] $ResourceName, + + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string[]] $NodeName, + + [ValidateRange(1,[Uint64]::MaxValue)] + [Uint64] $RetryIntervalSec = 1, + + [Uint32] $RetryCount = 0, + + [Uint32] $ThrottleLimit = 32 #Powershell New-CimSession default throttle value + ) + + Import-Module $PSScriptRoot\..\..\PSDSCxMachine.psm1 -Verbose:$false + + + PSDSCxMachine\Set-_InternalPSDscXMachineTR ` + -RemoteResourceId $ResourceName ` + -RemoteMachine $NodeName ` + -MinimalNumberOfMachineInState 1 ` + -RetryIntervalSec $RetryIntervalSec ` + -RetryCount $RetryCount ` + -ThrottleLimit $ThrottleLimit ` + -Verbose:$($PSBoundParameters["Verbose"] -eq $true) +} + +# +# Test-TargetResource +# +# +function Test-TargetResource +{ + param + ( + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string] $ResourceName, + + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string[]] $NodeName, + + [ValidateRange(1,[Uint64]::MaxValue)] + [Uint64] $RetryIntervalSec = 1, + + [Uint32] $RetryCount = 0, + + [Uint32] $ThrottleLimit = 32 #Powershell New-CimSession default throttle value + ) + + Import-Module $PSScriptRoot\..\..\PSDSCxMachine.psm1 -Verbose:$false + + return PSDSCxMachine\Test-_InternalPSDscXMachineTR ` + -RemoteResourceId $ResourceName ` + -RemoteMachine $NodeName ` + -MinimalNumberOfMachineInState 1 ` + -RetryIntervalSec $RetryIntervalSec ` + -RetryCount $RetryCount ` + -ThrottleLimit $ThrottleLimit ` + -Verbose:$($PSBoundParameters["Verbose"] -eq $true) +} + + + +Export-ModuleMember -Function *-TargetResource \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAny/MSFT_WaitForAny.schema.mof b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAny/MSFT_WaitForAny.schema.mof new file mode 100644 index 0000000..f3bd8fc Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAny/MSFT_WaitForAny.schema.mof differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAny/ko-KR/MSFT_WaitForAny.schema.mfl b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAny/ko-KR/MSFT_WaitForAny.schema.mfl new file mode 100644 index 0000000..8ab9689 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForAny/ko-KR/MSFT_WaitForAny.schema.mfl differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForSome/MSFT_WaitForSome.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForSome/MSFT_WaitForSome.psm1 new file mode 100644 index 0000000..166a917 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForSome/MSFT_WaitForSome.psm1 @@ -0,0 +1,129 @@ +# +# WaitForSome +# + +# +# The Get-TargetResource cmdlet. +# +function Get-TargetResource +{ + param + ( + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string] $ResourceName, + + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string[]] $NodeName, + + [parameter(Mandatory)] + [Uint32] $NodeCount, + + [ValidateRange(1,[Uint64]::MaxValue)] + [Uint64] $RetryIntervalSec = 1, + + [Uint32] $RetryCount = 0, + + [Uint32] $ThrottleLimit = 32 #Powershell New-CimSession default throttle value + ) + + Import-Module $PSScriptRoot\..\..\PSDSCxMachine.psm1 -Verbose:$false + + $result = PSDSCxMachine\Get-_InternalPSDscXMachineTR ` + -RemoteResourceId $ResourceName ` + -RemoteMachine $NodeName ` + -MinimalNumberOfMachineInState $NodeCount ` + -RetryIntervalSec $RetryIntervalSec ` + -RetryCount $RetryCount ` + -ThrottleLimit $ThrottleLimit + $result.NodeCount = $NodeCount + + $result +} + +# +# The Set-TargetResource cmdlet. +# +function Set-TargetResource +{ + param + ( + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string] $ResourceName, + + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string[]] $NodeName, + + [parameter(Mandatory)] + [Uint32] $NodeCount, + + [ValidateRange(1,[Uint64]::MaxValue)] + [Uint64] $RetryIntervalSec = 1, + + [Uint32] $RetryCount = 0, + + [Uint32] $ThrottleLimit = 32 #Powershell New-CimSession default throttle value + ) + + Import-Module $PSScriptRoot\..\..\PSDSCxMachine.psm1 -Verbose:$false + + PSDSCxMachine\Set-_InternalPSDscXMachineTR ` + -RemoteResourceId $ResourceName ` + -RemoteMachine $NodeName ` + -MinimalNumberOfMachineInState $NodeCount ` + -RetryIntervalSec $RetryIntervalSec ` + -RetryCount $RetryCount ` + -ThrottleLimit $ThrottleLimit ` + -Verbose:$($PSBoundParameters["Verbose"] -eq $true) +} + +# +# Test-TargetResource +# +# +function Test-TargetResource +{ + param + ( + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string] $ResourceName, + + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string[]] $NodeName, + + [parameter(Mandatory)] + [Uint32] $NodeCount, + + [ValidateRange(1,[Uint64]::MaxValue)] + [Uint64] $RetryIntervalSec = 1, + + [Uint32] $RetryCount = 0, + + [Uint32] $ThrottleLimit = 32 #Powershell New-CimSession default throttle value + ) + + if ($NodeCount -gt $NodeName.Count) + { + throw "Invalid input NodeCount!" + } + + Import-Module $PSScriptRoot\..\..\PSDSCxMachine.psm1 -Verbose:$false + + return PSDSCxMachine\Test-_InternalPSDscXMachineTR ` + -RemoteResourceId $ResourceName ` + -RemoteMachine $NodeName ` + -MinimalNumberOfMachineInState $NodeCount ` + -RetryIntervalSec $RetryIntervalSec ` + -RetryCount $RetryCount ` + -ThrottleLimit $ThrottleLimit ` + -Verbose:$($PSBoundParameters["Verbose"] -eq $true) +} + + + +Export-ModuleMember -Function *-TargetResource \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForSome/MSFT_WaitForSome.schema.mof b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForSome/MSFT_WaitForSome.schema.mof new file mode 100644 index 0000000..058bbb9 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForSome/MSFT_WaitForSome.schema.mof differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForSome/ko-KR/MSFT_WaitForSome.schema.mfl b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForSome/ko-KR/MSFT_WaitForSome.schema.mfl new file mode 100644 index 0000000..b1ee5a0 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WaitForSome/ko-KR/MSFT_WaitForSome.schema.mfl differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/MSFT_WindowsOptionalFeature.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/MSFT_WindowsOptionalFeature.psm1 new file mode 100644 index 0000000..5db7fd6 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/MSFT_WindowsOptionalFeature.psm1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/MSFT_WindowsOptionalFeature.schema.mof b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/MSFT_WindowsOptionalFeature.schema.mof new file mode 100644 index 0000000..3b7d191 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/MSFT_WindowsOptionalFeature.schema.mof differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/ko-KR/MSFT_WindowsOptionalFeature.schema.mfl b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/ko-KR/MSFT_WindowsOptionalFeature.schema.mfl new file mode 100644 index 0000000..9f469e8 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/ko-KR/MSFT_WindowsOptionalFeature.schema.mfl differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/ko-KR/MSFT_WindowsOptionalFeature.strings.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/ko-KR/MSFT_WindowsOptionalFeature.strings.psd1 new file mode 100644 index 0000000..6de0ed3 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/MSFT_WindowsOptionalFeature/ko-KR/MSFT_WindowsOptionalFeature.strings.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/ProcessSet/ProcessSet.Schema.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/ProcessSet/ProcessSet.Schema.psm1 new file mode 100644 index 0000000..aa9161c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/ProcessSet/ProcessSet.Schema.psm1 @@ -0,0 +1,49 @@ +Import-Module "$PSScriptRoot\..\CompositeResourceHelper.psm1" + +Configuration ProcessSet +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [System.String[]] + $Path, + + [ValidateNotNullOrEmpty()] + [System.Management.Automation.PSCredential] + $Credential, + + [ValidateSet('Present','Absent')] + [System.String] + $Ensure, + + [System.String] + $StandardOutputPath, + + [System.String] + $StandardErrorPath, + + [System.String] + $StandardInputPath, + + [System.String] + $WorkingDirectory + ) + + $psboundParams = $PSBoundParameters + $optionalParameters = @("Credential","Ensure","StandardOutputPath","StandardErrorPath","StandardInputPath","WorkingDirectory") + $keyParamName = "Path" + $resourceName = "WindowsProcess" + + #build common parameters for all WindowsProcess resource nodes + [string] $commonParameters = BuildResourceCommonParameters -KeyParamName $keyParamName -OptionalParams $optionalParameters -PSBoundParams $psboundParams + + #Arguments is a key parameter in WindowsProcess resource. Adding it as default parameter with an empty value string + $defaultParam = 'Arguments = ""' + + #build WindowsProcess resource string + [string] $resourceString = BuildResourceString -KeyParam $Path -KeyParamName $keyParamName -CommonParams $commonParameters -ResourceName $resourceName -DefaultParams $defaultParam + + $configScript = [scriptblock]::Create($resourceString) + . $configScript +} \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/ProcessSet/ProcessSet.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/ProcessSet/ProcessSet.psd1 new file mode 100644 index 0000000..7d3e6d7 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/ProcessSet/ProcessSet.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/RunAsHelper.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/RunAsHelper.psm1 new file mode 100644 index 0000000..b92f3f5 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/RunAsHelper.psm1 @@ -0,0 +1,480 @@ +########################################################################### +# built-in DSCResources common functions for Credentials and RunAs support +########################################################################### + +Set-StrictMode -version Latest + +Import-Module "$PSScriptRoot\DSCResourceHelper.psm1" + +data LocalizedData +{ + # culture="en-US" + ConvertFrom-StringData @' +ErrorInvalidUserName=UserName {0} is not valid. +UserCouldNotBeLoggedError=The user could not be logged on. Ensure that the user has an existing profile on the machine and that correct credentials are provided. Logon error # +OpenProcessTokenError=Open process token error # +PrivilegeLookingUpError=Error in looking up privilege of the process. This should not happen if DSC is running as LocalSystem Lookup privilege error # +TokenElevationError=Token elevation error # +DuplicateTokenError=Duplicate Token error # +CouldNotCreateProcessError=The process could not be created. Create process as user error # +WaitFailedError=Wait during create process failed user error # +RetriveStatusError=Retrieving status error # +'@ +} + +Import-LocalizedData LocalizedData -filename RunAsHelper.strings.psd1 +$EscapedLocalizedData = @{} +foreach( $key in $LocalizedData.Keys ) +{ + $EscapedLocalizedData.Add($key, $LocalizedData[$key].Replace('"','""')) +} +$LocalizedData = $EscapedLocalizedData + +# +# The goal of this function is to get domain and username from PSCredential +# without calling GetNetworkCredential() method. +# Call to GetNetworkCredential() expose password as a plain text in memory. +# +function Get-DomainAndUserName([PSCredential]$Credential) +{ + # + # Supported formats: DOMAIN\username, username@domain + # + $wrongFormat = $false + if ($Credential.UserName.Contains('\')) + { + $segments = $Credential.UserName.Split('\') + if ($segments.Length -gt 2) + { + # i.e. domain\user\foo + $wrongFormat = $true + } else { + $Domain = $segments[0] + $UserName = $segments[1] + } + } + elseif ($Credential.UserName.Contains('@')) + { + $segments = $Credential.UserName.Split('@') + if ($segments.Length -gt 2) + { + # i.e. user@domain@foo + $wrongFormat = $true + } else { + $UserName = $segments[0] + $Domain = $segments[1] + } + } + else + { + # support for default domain (localhost) + return @( $env:COMPUTERNAME, $Credential.UserName ) + } + + if ($wrongFormat) + { + $message = $LocalizedData.ErrorInvalidUserName -f $Credential.UserName + Write-Verbose $message + $exception = New-Object System.ArgumentException $message + throw New-Object System.Management.Automation.ErrorRecord $exception, "InvalidUserName", InvalidArgument, $null + } + + return @( $Domain, $UserName ) +} + +function Import-DscNativeMethods +{ +$script:ProgramSource = @" + +using System; +using System.Collections.Generic; +using System.Text; +using System.Security; +using System.Runtime.InteropServices; +using System.Diagnostics; +using System.Security.Principal; +#if !CORECLR +using System.ComponentModel; +#endif +using System.IO; + +namespace PSDesiredStateConfiguration +{ +#if !CORECLR + [SuppressUnmanagedCodeSecurity] +#endif + public static class NativeMethods + { + //The following structs and enums are used by the various Win32 API's that are used in the code below + + [StructLayout(LayoutKind.Sequential)] + public struct STARTUPINFO + { + public Int32 cb; + public string lpReserved; + public string lpDesktop; + public string lpTitle; + public Int32 dwX; + public Int32 dwY; + public Int32 dwXSize; + public Int32 dwXCountChars; + public Int32 dwYCountChars; + public Int32 dwFillAttribute; + public Int32 dwFlags; + public Int16 wShowWindow; + public Int16 cbReserved2; + public IntPtr lpReserved2; + public IntPtr hStdInput; + public IntPtr hStdOutput; + public IntPtr hStdError; + } + + [StructLayout(LayoutKind.Sequential)] + public struct PROCESS_INFORMATION + { + public IntPtr hProcess; + public IntPtr hThread; + public Int32 dwProcessID; + public Int32 dwThreadID; + } + + [Flags] + public enum LogonType + { + LOGON32_LOGON_INTERACTIVE = 2, + LOGON32_LOGON_NETWORK = 3, + LOGON32_LOGON_BATCH = 4, + LOGON32_LOGON_SERVICE = 5, + LOGON32_LOGON_UNLOCK = 7, + LOGON32_LOGON_NETWORK_CLEARTEXT = 8, + LOGON32_LOGON_NEW_CREDENTIALS = 9 + } + + [Flags] + public enum LogonProvider + { + LOGON32_PROVIDER_DEFAULT = 0, + LOGON32_PROVIDER_WINNT35, + LOGON32_PROVIDER_WINNT40, + LOGON32_PROVIDER_WINNT50 + } + [StructLayout(LayoutKind.Sequential)] + public struct SECURITY_ATTRIBUTES + { + public Int32 Length; + public IntPtr lpSecurityDescriptor; + public bool bInheritHandle; + } + + public enum SECURITY_IMPERSONATION_LEVEL + { + SecurityAnonymous, + SecurityIdentification, + SecurityImpersonation, + SecurityDelegation + } + + public enum TOKEN_TYPE + { + TokenPrimary = 1, + TokenImpersonation + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + internal struct TokPriv1Luid + { + public int Count; + public long Luid; + public int Attr; + } + + public const int GENERIC_ALL_ACCESS = 0x10000000; + public const int CREATE_NO_WINDOW = 0x08000000; + internal const int SE_PRIVILEGE_ENABLED = 0x00000002; + internal const int TOKEN_QUERY = 0x00000008; + internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020; + internal const string SE_INCRASE_QUOTA = "SeIncreaseQuotaPrivilege"; + +#if CORECLR + [DllImport("api-ms-win-core-handle-l1-1-0.dll", +#else + [DllImport("kernel32.dll", +#endif + EntryPoint = "CloseHandle", SetLastError = true, + CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] + public static extern bool CloseHandle(IntPtr handle); + +#if CORECLR + [DllImport("api-ms-win-core-processthreads-l1-1-2.dll", +#else + [DllImport("advapi32.dll", +#endif + EntryPoint = "CreateProcessAsUser", SetLastError = true, + CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] + public static extern bool CreateProcessAsUser( + IntPtr hToken, + string lpApplicationName, + string lpCommandLine, + ref SECURITY_ATTRIBUTES lpProcessAttributes, + ref SECURITY_ATTRIBUTES lpThreadAttributes, + bool bInheritHandle, + Int32 dwCreationFlags, + IntPtr lpEnvrionment, + string lpCurrentDirectory, + ref STARTUPINFO lpStartupInfo, + ref PROCESS_INFORMATION lpProcessInformation + ); + +#if CORECLR + [DllImport("api-ms-win-security-base-l1-1-0.dll", EntryPoint = "DuplicateTokenEx")] +#else + [DllImport("advapi32.dll", EntryPoint = "DuplicateTokenEx")] +#endif + public static extern bool DuplicateTokenEx( + IntPtr hExistingToken, + Int32 dwDesiredAccess, + ref SECURITY_ATTRIBUTES lpThreadAttributes, + Int32 ImpersonationLevel, + Int32 dwTokenType, + ref IntPtr phNewToken + ); + +#if CORECLR + [DllImport("api-ms-win-security-logon-l1-1-1.dll", CharSet = CharSet.Unicode, SetLastError = true)] +#else + [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)] +#endif + public static extern Boolean LogonUser( + String lpszUserName, + String lpszDomain, + IntPtr lpszPassword, + LogonType dwLogonType, + LogonProvider dwLogonProvider, + out IntPtr phToken + ); + +#if CORECLR + [DllImport("api-ms-win-security-base-l1-1-0.dll", ExactSpelling = true, SetLastError = true)] +#else + [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] +#endif + internal static extern bool AdjustTokenPrivileges( + IntPtr htok, + bool disall, + ref TokPriv1Luid newst, + int len, + IntPtr prev, + IntPtr relen + ); + +#if CORECLR + [DllImport("api-ms-win-downlevel-kernel32-l1-1-0.dll", ExactSpelling = true)] +#else + [DllImport("kernel32.dll", ExactSpelling = true)] +#endif + internal static extern IntPtr GetCurrentProcess(); + +#if CORECLR + [DllImport("api-ms-win-downlevel-advapi32-l1-1-1.dll", ExactSpelling = true, SetLastError = true)] +#else + [DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] +#endif + internal static extern bool OpenProcessToken( + IntPtr h, + int acc, + ref IntPtr phtok + ); + +#if CORECLR + [DllImport("api-ms-win-downlevel-kernel32-l1-1-0.dll", ExactSpelling = true)] +#else + [DllImport("kernel32.dll", ExactSpelling = true)] +#endif + internal static extern int WaitForSingleObject( + IntPtr h, + int milliseconds + ); + +#if CORECLR + [DllImport("api-ms-win-downlevel-kernel32-l1-1-0.dll", ExactSpelling = true)] +#else + [DllImport("kernel32.dll", ExactSpelling = true)] +#endif + internal static extern bool GetExitCodeProcess( + IntPtr h, + out int exitcode + ); + +#if CORECLR + [DllImport("api-ms-win-downlevel-advapi32-l4-1-0.dll", SetLastError = true)] +#else + [DllImport("advapi32.dll", SetLastError = true)] +#endif + internal static extern bool LookupPrivilegeValue( + string host, + string name, + ref long pluid + ); + + internal static void ThrowException( + string message + ) + { +#if CORECLR + throw new Exception(message); +#else + throw new Win32Exception(message); +#endif + } + + public static void CreateProcessAsUser(string strCommand, string strDomain, string strName, SecureString secureStringPassword, bool waitForExit, ref int ExitCode) + { + var hToken = IntPtr.Zero; + var hDupedToken = IntPtr.Zero; + TokPriv1Luid tp; + var pi = new PROCESS_INFORMATION(); + var sa = new SECURITY_ATTRIBUTES(); + sa.Length = Marshal.SizeOf(sa); + Boolean bResult = false; + try + { + IntPtr unmanagedPassword = IntPtr.Zero; + try + { +#if CORECLR + unmanagedPassword = SecureStringMarshal.SecureStringToCoTaskMemUnicode(secureStringPassword); +#else + unmanagedPassword = Marshal.SecureStringToGlobalAllocUnicode(secureStringPassword); +#endif + bResult = LogonUser( + strName, + strDomain, + unmanagedPassword, + LogonType.LOGON32_LOGON_NETWORK_CLEARTEXT, + LogonProvider.LOGON32_PROVIDER_DEFAULT, + out hToken + ); + } + finally + { + Marshal.ZeroFreeGlobalAllocUnicode(unmanagedPassword); + } + if (!bResult) + { + ThrowException(@"$($LocalizedData.UserCouldNotBeLoggedError)" + Marshal.GetLastWin32Error().ToString()); + } + IntPtr hproc = GetCurrentProcess(); + IntPtr htok = IntPtr.Zero; + bResult = OpenProcessToken( + hproc, + TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, + ref htok + ); + if (!bResult) + { + ThrowException(@"$($LocalizedData.OpenProcessTokenError)" + Marshal.GetLastWin32Error().ToString()); + } + tp.Count = 1; + tp.Luid = 0; + tp.Attr = SE_PRIVILEGE_ENABLED; + bResult = LookupPrivilegeValue( + null, + SE_INCRASE_QUOTA, + ref tp.Luid + ); + if (!bResult) + { + ThrowException(@"$($LocalizedData.PrivilegeLookingUpError)" + Marshal.GetLastWin32Error().ToString()); + } + bResult = AdjustTokenPrivileges( + htok, + false, + ref tp, + 0, + IntPtr.Zero, + IntPtr.Zero + ); + if (!bResult) + { + ThrowException(@"$($LocalizedData.TokenElevationError)" + Marshal.GetLastWin32Error().ToString()); + } + + bResult = DuplicateTokenEx( + hToken, + GENERIC_ALL_ACCESS, + ref sa, + (int)SECURITY_IMPERSONATION_LEVEL.SecurityIdentification, + (int)TOKEN_TYPE.TokenPrimary, + ref hDupedToken + ); + if (!bResult) + { + ThrowException(@"$($LocalizedData.DuplicateTokenError)" + Marshal.GetLastWin32Error().ToString()); + } + var si = new STARTUPINFO(); + si.cb = Marshal.SizeOf(si); + si.lpDesktop = ""; + bResult = CreateProcessAsUser( + hDupedToken, + null, + strCommand, + ref sa, + ref sa, + false, + 0, + IntPtr.Zero, + null, + ref si, + ref pi + ); + if (!bResult) + { + ThrowException(@"$($LocalizedData.CouldNotCreateProcessError)" + Marshal.GetLastWin32Error().ToString()); + } + if (waitForExit) { + int status = WaitForSingleObject(pi.hProcess, -1); + if(status == -1) + { + ThrowException(@"$($LocalizedData.WaitFailedError)" + Marshal.GetLastWin32Error().ToString()); + } + + bResult = GetExitCodeProcess(pi.hProcess, out ExitCode); + if(!bResult) + { + ThrowException(@"$($LocalizedData.RetriveStatusError)" + Marshal.GetLastWin32Error().ToString()); + } + } + } + finally + { + if (pi.hThread != IntPtr.Zero) + { + CloseHandle(pi.hThread); + } + if (pi.hProcess != IntPtr.Zero) + { + CloseHandle(pi.hProcess); + } + if (hDupedToken != IntPtr.Zero) + { + CloseHandle(hDupedToken); + } + } + } + } +} + +"@ + + if(IsNanoServer) + { + $ProgramSource = "#define CORECLR`n" + $ProgramSource + Add-Type -TypeDefinition $ProgramSource -ReferencedAssemblies System.Security.SecureString.dll + } + else + { + Add-Type -TypeDefinition $ProgramSource -ReferencedAssemblies "System.ServiceProcess" + } +} + +Export-ModuleMember -Function Get-DomainAndUserName,Import-DscNativeMethods,IsNanoServer \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/ServiceSet/ServiceSet.Schema.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/ServiceSet/ServiceSet.Schema.psm1 new file mode 100644 index 0000000..04aaf2b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/ServiceSet/ServiceSet.Schema.psm1 @@ -0,0 +1,46 @@ +Import-Module "$PSScriptRoot\..\CompositeResourceHelper.psm1" + +Configuration ServiceSet +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [System.String[]] + $Name, + + [ValidateSet('Automatic','Manual','Disabled')] + [System.String] + $StartupType, + + [ValidateSet('LocalSystem','LocalService','NetworkService')] + [System.String] + $BuiltInAccount, + + [ValidateSet('Running','Stopped')] + [System.String] + $State, + + [ValidateSet('Present','Absent')] + [System.String] + $Ensure, + + [ValidateNotNull()] + [System.Management.Automation.PSCredential] + $Credential + ) + + $psboundParams = $PSBoundParameters + $optionalParameters = @("StartupType","BuiltInAccount","State","Ensure","Credential") + $keyParamName = "Name" + $resourceName = "Service" + + #build common parameters for all Service resource nodes + [string] $commonParameters = BuildResourceCommonParameters -KeyParamName $keyParamName -OptionalParams $optionalParameters -PSBoundParams $psboundParams + + #build Service resource string + [string] $resourceString = BuildResourceString -KeyParam $Name -KeyParamName $keyParamName -CommonParams $commonParameters -ResourceName $resourceName + + $configScript = [scriptblock]::Create($resourceString) + . $configScript +} \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/ServiceSet/ServiceSet.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/ServiceSet/ServiceSet.psd1 new file mode 100644 index 0000000..e1faa52 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/ServiceSet/ServiceSet.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/WindowsFeatureSet/WindowsFeatureSet.Schema.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/WindowsFeatureSet/WindowsFeatureSet.Schema.psm1 new file mode 100644 index 0000000..7a6bdf0 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/WindowsFeatureSet/WindowsFeatureSet.Schema.psm1 @@ -0,0 +1,45 @@ +Import-Module "$PSScriptRoot\..\CompositeResourceHelper.psm1" + +Configuration WindowsFeatureSet +{ + [CmdletBinding(SupportsShouldProcess=$true)] + param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [System.String[]] + $Name, + + [ValidateSet('Present','Absent')] + [System.String] + $Ensure, + + [ValidateNotNullOrEmpty()] + [System.String] + $Source, + + [System.Boolean] + $IncludeAllSubFeature, + + [ValidateNotNull()] + [System.Management.Automation.PSCredential] + $Credential, + + [ValidateNotNullOrEmpty()] + [System.String] + $LogPath + ) + + $psboundParams = $PSBoundParameters + $optionalParameters = @("Ensure","Source","IncludeAllSubFeature","Credential","LogPath") + $keyParamName = "Name" + $resourceName = "WindowsFeature" + + #build common parameters for all WindowsFeature resource nodes + [string] $commonParameters = BuildResourceCommonParameters -KeyParamName $keyParamName -OptionalParams $optionalParameters -PSBoundParams $psboundParams + + #build WindowsFeature resource string + [string] $resourceString = BuildResourceString -KeyParam $Name -KeyParamName $keyParamName -CommonParams $commonParameters -ResourceName $resourceName + + $configScript = [scriptblock]::Create($resourceString) + . $configScript +} \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/WindowsFeatureSet/WindowsFeatureSet.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/WindowsFeatureSet/WindowsFeatureSet.psd1 new file mode 100644 index 0000000..add6377 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/WindowsFeatureSet/WindowsFeatureSet.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/WindowsOptionalFeatureSet/WindowsOptionalFeatureSet.Schema.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/WindowsOptionalFeatureSet/WindowsOptionalFeatureSet.Schema.psm1 new file mode 100644 index 0000000..1e1ea9a --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/WindowsOptionalFeatureSet/WindowsOptionalFeatureSet.Schema.psm1 @@ -0,0 +1,49 @@ +Import-Module "$PSScriptRoot\..\CompositeResourceHelper.psm1" + +Configuration WindowsOptionalFeatureSet +{ + [CmdletBinding()] + param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [System.String[]] + $Name, + + [Parameter(Mandatory=$true)] + [ValidateSet('Enable','Disable')] + [System.String] + $Ensure, + + [ValidateNotNullOrEmpty()] + [System.String[]] + $Source, + + [System.Boolean] + $RemoveFilesOnDisable, + + [ValidateNotNullOrEmpty()] + [System.String] + $LogPath, + + [System.Boolean] + $NoWindowsUpdateCheck, + + [ValidateSet('ErrorsOnly','ErrorsAndWarning','ErrorsAndWarningAndInformation')] + [System.String] + $LogLevel + ) + + $psboundParams = $PSBoundParameters + $optionalParameters = @("Ensure","Source","RemoveFilesOnDisable","LogPath","NoWindowsUpdateCheck","LogLevel") + $keyParamName = "Name" + $resourceName = "WindowsOptionalFeature" + + #build common parameters for all WindowsOptionalFeature resource nodes + [string] $commonParameters = BuildResourceCommonParameters -KeyParamName $keyParamName -OptionalParams $optionalParameters -PSBoundParams $psboundParams + + #build WindowsOptionalFeature resource string + [string] $resourceString = BuildResourceString -KeyParam $Name -KeyParamName $keyParamName -CommonParams $commonParameters -ResourceName $resourceName + + $configScript = [scriptblock]::Create($resourceString) + . $configScript +} \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/WindowsOptionalFeatureSet/WindowsOptionalFeatureSet.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/WindowsOptionalFeatureSet/WindowsOptionalFeatureSet.psd1 new file mode 100644 index 0000000..f1c5be9 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/WindowsOptionalFeatureSet/WindowsOptionalFeatureSet.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/ko-KR/RunAsHelper.strings.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/ko-KR/RunAsHelper.strings.psd1 new file mode 100644 index 0000000..bb990a5 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DSCResources/ko-KR/RunAsHelper.strings.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Disable-DscDebug.cdxml b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Disable-DscDebug.cdxml new file mode 100644 index 0000000..15c15ad --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Disable-DscDebug.cdxml @@ -0,0 +1,28 @@ + + + + + 2.0.0.0 + DscDebug + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DownloadManager/DSCFileDownloadManager/DSCFileDownloadManager.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DownloadManager/DSCFileDownloadManager/DSCFileDownloadManager.psd1 new file mode 100644 index 0000000..190ea65 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DownloadManager/DSCFileDownloadManager/DSCFileDownloadManager.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DownloadManager/DSCFileDownloadManager/Microsoft.PowerShell.DSC.FileDownloadManager.dll b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DownloadManager/DSCFileDownloadManager/Microsoft.PowerShell.DSC.FileDownloadManager.dll new file mode 100644 index 0000000..cb124fd Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DownloadManager/DSCFileDownloadManager/Microsoft.PowerShell.DSC.FileDownloadManager.dll differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DownloadManager/DSCFileDownloadManager/ko/Microsoft.PowerShell.DSC.FileDownloadManager.Resources.dll b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DownloadManager/DSCFileDownloadManager/ko/Microsoft.PowerShell.DSC.FileDownloadManager.Resources.dll new file mode 100644 index 0000000..449004a Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/DownloadManager/DSCFileDownloadManager/ko/Microsoft.PowerShell.DSC.FileDownloadManager.Resources.dll differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Enable-DscDebug.cdxml b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Enable-DscDebug.cdxml new file mode 100644 index 0000000..a7e39c7 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Enable-DscDebug.cdxml @@ -0,0 +1,35 @@ + + + + + 2.0.0.0 + DscDebug + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Get-DSCLocalConfigurationManager.cdxml b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Get-DSCLocalConfigurationManager.cdxml new file mode 100644 index 0000000..edd6104 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Get-DSCLocalConfigurationManager.cdxml @@ -0,0 +1,34 @@ + + + + + 2.0.0.0 + DscLocalConfigurationManager + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Get-DscConfiguration.cdxml b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Get-DscConfiguration.cdxml new file mode 100644 index 0000000..871f9d4 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Get-DscConfiguration.cdxml @@ -0,0 +1,34 @@ + + + + + 2.0.0.0 + DscConfiguration + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Get-DscConfigurationStatus.cdxml b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Get-DscConfigurationStatus.cdxml new file mode 100644 index 0000000..bf48b36 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Get-DscConfigurationStatus.cdxml @@ -0,0 +1,39 @@ + + + + + 2.0.0.0 + DscConfigurationStatus + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.format.ps1xml b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.format.ps1xml new file mode 100644 index 0000000..9827883 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.format.ps1xml @@ -0,0 +1,368 @@ + + + + + DSCResourceSyntax + + Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo + + + + + 15 + + + 25 + + + 30 + + + 10 + + + 50 + + + + + + + ImplementedAs + + + Name + + + ModuleName + + + Version + + + Properties + + + + + + + + TestDscConfiguration + + Microsoft.Management.Infrastructure.CimMethodResult#MSFT_DSCLocalConfigurationManager#TestConfiguration + + + + + + 15 + + + + 30 + + + + 30 + + + + 15 + + + + + + + PSComputerName + + + ResourcesInDesiredState + + + ResourcesNotInDesiredState + + + InDesiredState + + + + + + + + GetMetaConfiguration + + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/MSFT_DSCMetaConfiguration + + + + + + + ActionAfterReboot + + + AgentId + + + AllowModuleOverWrite + + + CertificateID + + + ConfigurationDownloadManagers + + + ConfigurationID + + + ConfigurationMode + + + ConfigurationModeFrequencyMins + + + Credential + + + DebugMode + + + DownloadManagerCustomData + + + DownloadManagerName + + + LCMCompatibleVersions + + + LCMState + + + LCMStateDetail + + + LCMVersion + + + StatusRetentionTimeInDays + + + SignatureValidationPolicy + + + SignatureValidations + + + MaximumDownloadSizeMB + + + PartialConfigurations + + + RebootNodeIfNeeded + + + RefreshFrequencyMins + + + RefreshMode + + + ReportManagers + + + ResourceModuleManagers + + + PSComputerName + + + + + + + + GetDscConfigurationStatus + + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/MSFT_DSCConfigurationStatus + + + + + + 10 + + + + 25 + + + + 15 + + + + 5 + + + + 20 + + + + 30 + + + + + + + Status + + + StartDate + + + Type + + + Mode + + + RebootRequested + + + NumberOfResources + + + + + + + + GetDscConfigurationStatus + + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/MSFT_DSCConfigurationStatus + + + + + + + JobID + + + HostName + + + Error + + + Locale + + + IPV4Addresses + + + IPV6Addresses + + + MACAddresses + + + LCMVersion + + + Mode + + + NumberOfResources + + + MetaData + + + MetaConfiguration + + + Type + + + Status + + + StartDate + + + DurationInSeconds + + + RebootRequested + + + ResourcesInDesiredState + + + ResourcesNotInDesiredState + + + PSComputerName + + + + + + + + InvokeDscResourceTest + + Microsoft.Management.Infrastructure.CimMethodResult#MSFT_DSCLocalConfigurationManager#ResourceTest + + + + + 15 + + + + + + + + InDesiredState + + + + + + + + InvokeDscResourceSet + + Microsoft.Management.Infrastructure.CimMethodResult#MSFT_DSCLocalConfigurationManager#ResourceSet + + + + + 15 + + + + + + + + RebootRequired + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psd1 new file mode 100644 index 0000000..0429563 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psm1 new file mode 100644 index 0000000..30ac7a0 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.psm1 @@ -0,0 +1,4822 @@ +########################################################### +# +# 'PSDesiredStateConfiguration' logic module +# +########################################################### +data LocalizedData +{ + # culture="en-US" + ConvertFrom-StringData -StringData @' + CheckSumFileExists = File '{0}' already exists. Please specify -Force parameter to overwrite existing checksum files. + CreateChecksumFile = Create checksum file '{0}' + OverwriteChecksumFile = Overwrite checksum file '{0}' + OutpathConflict = (ERROR) Cannot create directory '{0}'. A file exists with the same name. + InvalidConfigPath = (ERROR) Invalid configuration path '{0}' specified. + InvalidOutpath = (ERROR) Invalid OutPath '{0}' specified. + InvalidConfigurationName = Invalid Configuration Name '{0}' is specified. Standard names may only contain letters (a-z, A-Z), numbers (0-9), period (.), hyphen (-) and underscore (_). The name may not be null or empty, and should start with a letter. + NoValidConfigFileFound = No valid config files (mof,zip) were found. + InputFileNotExist=File {0} doesn't exist. + FileReadError=Error Reading file {0}. + MatchingFileNotFound=No matching file found. + CertificateFileReadError=Error Reading certificate file {0}. + CertificateStoreReadError=Error Reading certificate store for {0}. + CannotCreateOutputPath=Invalid Configuration name and output path combination :{0}. Please make sure output parameter is a valid path segment. + ConflictingDuplicateResource=A conflict was detected between resources '{0}' and '{1}' in node '{2}'. Resources have identical key properties but there are differences in the following non-key properties: '{3}'. Values '{4}' don't match values '{5}'. Please update these property values so that they are identical in both cases. + ConfiguratonDataNeedAllNodes=ConfigurationData parameter need to have property AllNodes. + ConfiguratonDataAllNodesNeedHashtable=ConfigurationData parameter property AllNodes needs to be a collection. + AllNodeNeedToBeHashtable=all elements of AllNodes need to be hashtable and has a property 'NodeName'. + DuplicatedNodeInConfigurationData=There are duplicated NodeNames '{0}' in the configurationData passed in. + EncryptedToPlaintextNotAllowed=Converting and storing encrypted passwords as plain text is not recommended. For more information on securing credentials in MOF file, please refer to MSDN blog: https://go.microsoft.com/fwlink/?LinkId=393729 + DomainCredentialNotAllowed=It is not recommended to use domain credential for node '{0}'. In order to suppress the warning, you can add a property named 'PSDscAllowDomainUser' with a value of $true to your DSC configuration data for node '{0}'. + NestedNodeNotAllowed=Defining node '{0}' inside the current node '{1}' is not allowed since node definitions cannot be nested. Please move the definition for node '{0}' to the top level of the configuration '{2}'. + FailToProcessNode=An exception was raised while processing Node '{0}': {1} + LocalHostNodeNotAllowed=Defining a 'localhost' node in the configuration '{0}' is not allowed since the configuration already contains one or more resource definitions that are not associated with any nodes. + InvalidMOFDefinition=Invalid MOF definition for node '{0}': {1} + RequiredResourceNotFound=Resource '{0}' required by '{1}' does not exist. Please ensure that the required resource exists and the name is properly formed. + ReferencedManagerNotFound=Download Manager '{0}' referenced by '{1}' does not exist. Please ensure that the referenced download manager exists and the name is properly formed. + ReferencedResourceSourceNotFound=Resource Repository '{0}' referenced by '{1}' does not exist. Please ensure that the referenced resource repository exists and the name is properly formed. + DependsOnLinkTooDeep=DependsOn link exceeded max depth limitation '{0}'. + DependsOnLoopDetected=Circular DependsOn exists '{0}'. Please make sure there are no circular reference. + FailToProcessConfiguration=Compilation errors occurred while processing configuration '{0}'. Please review the errors reported in error stream and modify your configuration code appropriately. + FailToProcessProperty={0} error processing property '{1}' OF TYPE '{2}': {3} + NodeNameIsRequired=Node processing is skipped since the node name is empty. + ConvertValueToPropertyFailed=Cannot convert '{0}' to type '{1}' for property '{2}' in resource '{3}'. + ResourceNotFound=The term '{0}' is not recognized as the name of a {1}. + GetDscResourceInputName=The Get-DscResource input '{0}' parameter value is '{1}'. + ResourceNotMatched=Skipping resource '{0}' as it does not match the requested name. + InitializingClassCache=Initializing class cache + LoadingDefaultCimKeywords=Loading default CIM keywords + GettingModuleList=Getting module list + CreatingResourceList=Creating resource list + CreatingResource=Creating resource '{0}'. + SchemaFileForResource=Schema file name for resource {0} + UnsupportedReservedKeyword=The '{0}' keyword is not supported in this version of the language. + UnsupportedReservedProperty=The '{0}' property is not supported in this version of the language. + MetaConfigurationHasMoreThanOneLocalConfigurationManager=The meta configuration for node '{0}' contain more than one definitions for LocalConfigurationManager which is not allowed. + MetaConfigurationSettingsMissing=The settings definition for node '{0}' is missing. A default empty settings definition is added for the node. + ConflictInExclusiveResources=The partial configuration '{0}' and '{1}' have coflicting exclusive resource declarations. + ReferencedModuleNotExist=The referenced module '{0}' does not exist on the machine. Please use Get-DscResource to find out what exists on the machine. + ReferencedResourceNotExist=The referenced resource '{0}' does not exist on the machine. Please use Get-DscResource to find out what exists on the machine. + ReferencedModuleResourceNotExist=The referenced module\resource '{0}' does not exist on the machine. Please use Get-DscResource to find out what exists on the machine. + DuplicatedResourceInModules=The referenced resource '{0}' exists in module {1} and module {2} on the machine. Please make sure it exists in only one module. + CannotConvertStringToBool=Cannot convert value "System.String" to type "System.Boolean". Boolean parameters accept only Boolean values and numbers, such as $True, $False, 1 or 0. + NoModulesPresent=There are no modules present in the system with the given module specification. + ImportDscResourceWarningForInbuiltResource=The configuration '{0}' is loading one or more built-in resources without explicitly importing associated modules. Add Import-DscResource -ModuleName 'PSDesiredStateConfiguration' to your configuration to avoid this message. + PasswordTooLong=An error occurred during encryption of a password in node '{0}'. Most likely the password entered is too long to be encrypted using the selected certificate. Please either use a shorter password or select a certificate with a larger key. + HashtableElementTypeNotAllowed=Value of type '{0}' is not allowed in hashtable. Supported types : [String], [Char], [Int64], [UInt64], [Double], [Bool] ,[DateTime] and [ScriptBlock]. + PullModeWithoutDownloadManager=Meta configuration is set to pull mode which requires a DownloadManager to be specified. + PullModeWithoutConfigurationRepository=Meta configuration is set to pull mode which requires a ConfigurationRepository to be specified. + DownloadManagerWithoutPullMode=A DownloadManager is specified without setting the refresh mode into PULL. + ConfigurationRepositoryWithoutPullMode=A ConfigurationRepository is specified without setting the refresh mode into PULL. + ReferencedPolicyNotDefined=The referenced SignatureValidationPolicy '{0}' is not defined. Please define a SignatureValidation block with the same name. + IncorrectSignatureValidationPolicyFormat =The value provided for SignatureValidationPolicy has incorrect format. Please provide its value in the form of '[SignatureValidation]'. +'@ +} +Set-StrictMode -Off + +# In case localized resource is not available we revert back to English as defined in LocalizedData section so ignore the error instead of showing it to user. +Import-LocalizedData -BindingVariable LocalizedData -FileName PSDesiredStateConfiguration.Resource.psd1 -ErrorAction SilentlyContinue + +$script:V1MetaConfigPropertyList = @('ConfigurationModeFrequencyMins', 'RebootNodeIfNeeded', 'ConfigurationMode', 'ActionAfterReboot', 'RefreshMode', 'CertificateID', 'ConfigurationID', 'DownloadManagerName', 'DownloadManagerCustomData', 'RefreshFrequencyMins', 'AllowModuleOverwrite', 'DebugMode', 'Credential') +$script:DirectAccessMetaConfigPropertyList = @('AllowModuleOverWrite', 'CertificateID', 'ConfigurationDownloadManagers', 'ResourceModuleManagers', 'DebugMode', 'RebootNodeIfNeeded', 'RefreshMode', 'ConfigurationAgent') + +################################################################# +# Code to determin what version related info is needed +# and fixup the configuration document is it is already generated +################################################################# +function Generate-VersionInfo +{ + param( + [Parameter(Mandatory)] + $KeywordData, + [Parameter(Mandatory)] + [Hashtable] + $Value + ) + + $SystemProperties = @('ResourceID', 'SourceInfo', 'ModuleName', 'ModuleVersion') + $HasAdditionalProperty = $false + foreach ($key in $KeywordData.Keys) + { + if (($Value.Contains($key)) -and ($script:V1MetaConfigPropertyList -notcontains $key) -and ($SystemProperties -notcontains $key)) + { + $HasAdditionalProperty = $true + break + } + } + + if($HasAdditionalProperty) + { + Set-PSMetaConfigVersionInfoV2 + } + else + { + $script:PSMetaConfigDocumentInstVersionInfo['MinimumCompatibleVersion'] = ($script:PSMetaConfigDocumentInstVersionInfo['MinimumCompatibleVersion'], "1.0.0" | Measure-Object -Maximum).Maximum + } + + $script:PSMetaConfigDocumentInstVersionInfo['CompatibleVersionAdditionalProperties'] = @('MSFT_DSCMetaConfiguration:StatusRetentionTimeInDays') + $script:PSMetaConfigurationProcessed = $true +} + +# indicate whether meta configuration is processed before document instance +function Set-PSMetaConfigDocInsProcessedBeforeMeta +{ + $Script:PSMetaConfigDocInsProcessedBeforeMeta = $true +} + +function Get-PSMetaConfigurationProcessed +{ + return $script:PSMetaConfigurationProcessed +} + +function Get-PSMetaConfigDocumentInstVersionInfo +{ + return $script:PSMetaConfigDocumentInstVersionInfo +} + +function Set-PSMetaConfigVersionInfoV2 +{ + $script:PSMetaConfigDocumentInstVersionInfo['MinimumCompatibleVersion'] = '2.0.0' + if($Script:PSMetaConfigDocInsProcessedBeforeMeta) #fixup configuration document instance version info + { + [string]$data = Get-MofInstanceText '$OMI_ConfigurationDocument1ref' + $Script:NoNameNodeInstanceAliases['$OMI_ConfigurationDocument1ref'] = $data -replace 'MinimumCompatibleVersion = "1.0.0"', 'MinimumCompatibleVersion = "2.0.0"' + Set-PSDefaultConfigurationDocument $Script:NoNameNodeInstanceAliases['$OMI_ConfigurationDocument1ref'] + } +} + +function Get-CompatibleVersionAddtionaPropertiesStr +{ + '{' + if($script:PSMetaConfigDocumentInstVersionInfo['CompatibleVersionAdditionalProperties']) + { + $len = @($script:PSMetaConfigDocumentInstVersionInfo['CompatibleVersionAdditionalProperties']).Length + foreach ($e in @($script:PSMetaConfigDocumentInstVersionInfo['CompatibleVersionAdditionalProperties'])) + { + "`"$e`"" + $(if (--$len -gt 0) + { + ', ' + } + else + { + '' + } + ) + } + } + '}' +} + +########################################################### +# The MOF generation code +########################################################### + +# +# This scriptblock takes a type name and a list of properties and produces +# the MOF source text to define an instance of that type +# +function ConvertTo-MOFInstance +{ + param ( + [Parameter(Mandatory)] + [string] + $Type, + [Parameter(Mandatory)] + [AllowNull()] + [hashtable] + $Properties + ) + + + # remove ModuleVersion, this will be handled during final validation. + if($properties.ContainsKey('ModuleName') -and $properties['ModuleName'] -ieq 'PsDesiredStateConfiguration') + { + $script:PsDscModuleVersion = $properties['ModuleVersion'] + $properties.Remove('ModuleVersion') + } + if($properties.ContainsKey('PsDscRunAsCredential')) + { + $script:PsDscCompatibleVersion = "2.0.0" + } + # Look up the property definitions for this keyword. + $PropertyTypes = [System.Management.Automation.Language.DynamicKeyword]::GetKeyword($Type).Properties + + # and the CIM type name to use since the keyword might be an alias. + $ResourceName = [System.Management.Automation.Language.DynamicKeyword]::GetKeyword($Type).ResourceName + + if($script:IsMetaConfig -and ($ResourceName -eq 'MSFT_DSCMetaConfigurationV2')) + { + Generate-VersionInfo $PropertyTypes $Properties + } + + # + # Function to convert .NET datetime object to MOF datetime string format + # We're not using [System.Management.ManagementDateTimeConverter]::ToDmtfDateTime() + # because it has known bugs which are not going to be fixed. + # + function ConvertTo-MofDateTimeString ([datetime] $d) + { + $utcOffset = ($d -$d.ToUniversalTime()).TotalMinutes + $utcOffsetString = if ($utcOffset -ge 0) + { + '+' + } + else + { + '-' + } + $utcOffsetString += ([System.Math]::Abs(($utcOffset)).ToString().PadLeft(3,'0')) + '{0}{1}' -f + $d.ToString('yyyyMMddHHmmss.ffffff'), + $utcOffsetString + } + + # + # Utility routine to find if username specified is + # a domain user. + # + + function IsDomainUser() + { + param( + [Parameter(Mandatory)] + [string] + $UserName + ) + # if username contains '\' example: domain\username or '@' example: username@mydomain.com + # it may not be a local user. + if( -not( $UserName.Contains('\') -or $UserName.Contains('@'))) + { + # it is a local user + return $false + } + elseif( $UserName.Contains('@')) + { + return $true + } + else + { + # In case of '\', domain name can be local machine. + $result = $UserName.Split('\') + if( $result.Count -ge 2) + { + $domain = $result[0] + $localMachineNames = @("localhost","127.0.0.1","::1",$env:COMPUTERNAME) + $isDomainUser = $true + if( $localMachineNames -icontains $domain) + { + $isDomainUser = $false + } + return $isDomainUser + } + } + $true + } + + # + # Utility routine to render a property + # as a string in MOF syntax. + # + function stringify ($Value, $asArray = $false, $targetType = [string]) + { + $result = if ($Value -is [array] -or $asArray) + { + '{' + $len = @($Value).Length + foreach ($e in $Value) + { + ' ' + (stringify $e -targetType $targetType) + + $(if (--$len -gt 0) + { + ',' + } + else + { + '' + } + ) + } + '}' + } + elseif ($Value -is [PSCredential] ) + { + # If the input object is a PSCredential, turn it into an MSFT_Credential with an encrypted password. + $clearText = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::GetStringFromSecureString($Value.Password) + $newValue = @{ + UserName = $Value.UserName + Password = $clearText + } + # Recurse to build the object. + ConvertTo-MOFInstance MSFT_Credential $newValue + } + elseif ($Value -is [System.Collections.Hashtable]) + { + # Collect the individual strings + $elementsAsStrings = foreach ($p in $Value.GetEnumerator()) + { + if($p.Value -isnot [string] -and + $p.Value -isnot [char] -and + $p.Value -isnot [int64] -and + $p.Value -isnot [uint64] -and + $p.Value -isnot [double] -and + $p.Value -isnot [bool] -and + $p.Value -isnot [datetime] -and + $p.Value -isnot [ScriptBlock]) + { + $errorMessage = $LocalizedData.HashtableElementTypeNotAllowed -f $($p.Value.GetType()) + ThrowError -ExceptionName 'System.ArgumentException' -ExceptionMessage $errorMessage -ExceptionObject $Value -ErrorId 'NestedHashtableNotAllowed' -ErrorCategory InvalidArgument + } + + ConvertTo-MOFInstance MSFT_KeyValuePair @{ + Key = $p.Key + Value = $p.Value + } + } + # Produce a single formatted string. + ' ' + ($elementsAsStrings -join ",`n ") + "`n" + } + elseif ($Value -is [ScriptBlock] ) + { + # Find all $using: variables used in the script and replace them with normal variables + $scriptText = "$Value" + # Need to create a new scriptblock so the extent offsets are correct + $scriptAst = [scriptblock]::Create($scriptText).Ast + # get the $using: variable asts into an array + $variables = $scriptAst.FindAll({ + param ($ast) + $ast.GetType().FullName -match 'VariableExpressionAst' -and + $ast.Extent.Text -match '^\$using:' + } + , $true).ToArray() + + # do the substitutions in reverse order + [Array]::Reverse($variables) + $variables | ForEach-Object -Process { + $start = $_.Extent.StartOffset + $length = $_.Extent.EndOffset - $start + $newName = '$' + $_.VariablePath.UserPath + $scriptText = $scriptText.Remove($start, $length).Insert($start, $newName) + } + + $completeScript = '' + # generate assignement statements to set the variable values on the other side + # using serialized values passed from the local environment + $varNames = @($variables).VariablePath.UserPath | Sort-Object -Unique + foreach ($v in $varNames) + { + # If the ScriptBlock was defined in a module, then use the module for lookups + if ($Value.Module) + { + $var = $Value.Module.SessionState.PSVariable.Get($v) + } + else + { + # Otherwise look up in the callers context + $var = $ExecutionContext.SessionState.Module.GetVariableFromCallersModule($v) + } + + if ($var) + { + $varValue = $var.Value + # Skip null values but preserve empty arrays and strings for type propigation + if ($varValue -ne $null) + { + # Pass strings quoted; amn explicit type check is needed because -is recognizes too many things as strings + if ($varValue -is [string]) + { + $completeScript += "`$$v ='" + ($varValue -replace "'", "''") + "'`n" + } + else + { + # Serialize everything else + $serializedValue = [System.Management.Automation.PSSerializer]::Serialize($varValue) -replace "'", "''" + $completeScript += "`$$v = [System.Management.Automation.PSSerializer]::Deserialize('$serializedValue')`n" + } + } + } + } + + # Merge in the actual scriptblock body + $completeScript += $scriptText + + # Quote the string so it's suitable to embed in the MOF file... + '"' + ($completeScript -replace '\\', '\\' -replace "[`r]*`n", '\n' -replace '"', '\"') + '"' + } + elseif ($targetType -eq [datetime]) + { + # If the target is a datetime, convert the argument to a datetime and then render that + # as a DMTF datetime... + '"' + (ConvertTo-MofDateTimeString $Value) + '"' + } + elseif ($targetType -eq [double]) + { + # MOF syntax requires reals to always have a decimal point so add + # so add one if the string representation does contain one. + [string] $dblAsString = [double] $Value + if ( -not $dblAsString.Contains('.') ) + { + $dblAsString += '.0' + } + $dblAsString + } + elseif ($targetType -eq [char]) + { + # A char16 is encode as a single quoted character + "'$Value'" + } + elseif ($targetType -eq [int64]) + { + [int64] $Value + } + elseif ($targetType -eq [uint64]) + { + [uint64] $Value + } + elseif ($targetType -eq [bool]) + { + if($Value -is [string]) + { + $errorMessage = $LocalizedData.CannotConvertStringToBool + ThrowError -ExceptionName 'System.ArgumentException' -ExceptionMessage $errorMessage -ExceptionObject $Value -ErrorId 'CannotConvertStringToBool' -ErrorCategory InvalidArgument + } + else + { + [bool]$Value + } + } + elseif ($targetType -ne [string]) + { + # Cast the value to the target type... + $Value -as $targetType + } + elseif ($Value -is [string] -and -not $InstanceAliases[$Value] ) + { + '"' + ($Value -replace '\\', '\\' -replace "`r?`n", '\n' -replace '"', '\"') + '"' + } + elseif ($Value -eq $null) + { + 'NULL' + } + elseif (($targetType -eq [string]) -and ($Value -isnot [string])) + { + # Cast value to string if it is not already a string, this is for covering cases like when a user assign an integer while the + # CIM property type is string + '"' + ($Value -replace '\\', '\\' -replace "`r?`n", '\n' -replace '"', '\"') + '"' + } + else + { + $Value + } + + $result -join "`n" + } + + Write-Debug -Message " BEGIN MOF GENERATION FOR $Type" + + # Generate the MOF instance alias to use for the current node + if ( (Get-PSCurrentConfigurationNode) ) + { + if($Script:NodeTypeRefCount[ (Get-PSCurrentConfigurationNode) ] -eq $null) + { + $Script:NodeTypeRefCount[ (Get-PSCurrentConfigurationNode) ] = + New-Object -TypeName 'System.Collections.Generic.Dictionary[string, System.Collections.Generic.Dictionary[string,int]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + } + + $MofAliasString = '$' + $ResourceName + ++$Script:NodeTypeRefCount[ (Get-PSCurrentConfigurationNode) ][$ResourceName] + 'ref' + $InstanceAliases = $Script:NodeInstanceAliases[ (Get-PSCurrentConfigurationNode) ] + } + else # Generate the MOF instance alias to use for the default (unnamed) node. + { + $MofAliasString = '$' + $ResourceName + ++$Script:NoNameNodeTypeRefCount[$ResourceName] + 'ref' + $InstanceAliases = $Script:NoNameNodeInstanceAliases + } + + # Start generating the MOF source text for this instance + $result = "instance of $ResourceName as $MofAliasString`n{`n" + + #special case psdesiredstateConfiguration module. Insert '0.0' as module if user hasn't explicilty asked for the version + if( $Properties.ContainsKey("ModuleName") -and ($Properties["ModuleName"] -ieq 'PsDesiredStateConfiguration')) + { + if(-not $Script:ExplicitlyImportedModules.ContainsKey('PsDesiredStateConfiguration')) + { + $script:ShowImportDscResourceWarning = $true + } + } + + # generate the property definitions + $oldOFS = $OFS + $OFS = ' ' + try + { + if ($Properties -and $Properties.Count) + { + $result += foreach ($p in $Properties.GetEnumerator()) + { + Write-Debug -Message " Generating property data for '$($p.Name)' = '$($p.Value)'" + + if ($p.Name -eq 'RefreshMode' -and $p.Value -eq 'PULL') + { + $script:MetaConfigSetToPull = $true + } + + if ($p.Name -eq 'DownloadManagerName') + { + $script:SpecifiedV1DownloadManagerName = $true + } + + $targetTypeName = $PropertyTypes[$p.Name].TypeConstraint + + # see if the target type is an array + $asArray = $p.Name -eq 'DependsOn' -or $targetTypeName -match 'Array' -or ((-not [string]::IsNullOrEmpty($targetTypeName)) -and $targetTypeName.EndsWith('[]')) + + # Convert the CIM typename to the appropriate .NET type to use + # to convert the input object into an appropriately encoded string + # using the PowerShell type conversion semantics. + switch -regex ($targetTypeName) + { + # unsigned integer types + '^sint[0-9]{1,2}' + { + $targetType = [int64] + break + } + # Single 16 bit character (note - this type is deprecated and removed in MOFv3 + '^char16' + { + $targetType = [char] + break + } + # signed integer types + '^uint[0-9]{0,2}' + { + $targetType = [uint64] + break + } + # reals + '^real32|^real64' + { + $targetType = [double] + break + } + # boolean + '^boolean' + { + $targetType = [bool] + } + # datetime + 'datetime' + { + $targetType = [datetime] + } + # everything else render directly as a string... + default + { + $targetType = [string] + } + } + + # + # If the scalar target types is a credential, then we need to encrypt the Password property value + # before generating the MOF text + # + if(($Type -match 'MSFT_Credential') -and $p.Name -match 'Password') + { + # For MSFT_Credential we'll have a password that may need to be encrypted depending + # on the availability of a key. This may need to change to the base class of MSFT_WindowCredential + # if we're using the class to refer to non-Windows machines where a Domain may be irrelevant. + + $p.Name + ' = ' + (stringify -value (Get-EncryptedPassword $p.Value) -asArray $asArray -targetType $targetType ) + ";`n" + } + else + { + #embeded instances cannot be null + if($p.Value -eq $null -and $PropertyTypes[$p.Name].TypeConstraint -eq 'Instance') + { + $errorMessage = $LocalizedData.ConvertValueToPropertyFailed -f @('$null', $Type, $p.Name, $ResourceName) + $errorMessage += Get-PositionInfo $Properties['SourceInfo'] + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidArgument -ErrorId FailToProcessProperty + Update-ConfigurationErrorCount + } + if($p.Value -is [PSCredential]) + { + [bool] $PSDscAllowPlainTextPassword = $false + [bool] $PSDscAllowDomainUser = $false + + $key = 'HKLM:\SOFTWARE\Microsoft\PowerShell\3\DSC' + $reg = Get-ItemProperty -path $key -name "PSDscAllowPlainTextPassword" -ea SilentlyContinue + + if ($reg -ne $null -and $reg.PSDscAllowPlainTextPassword -ne $null) + { + $PSDscAllowPlainTextPassword = ((Get-ItemProperty -Path $key -Name PSDscAllowPlainTextPassword).PSDscAllowPlainTextPassword -eq "True") + } + + $reg = Get-ItemProperty -path $key -name "PSDscAllowDomainUser" -ea SilentlyContinue + if ($reg -ne $null -and $reg.PSDscAllowDomainUser -ne $null) + { + $PSDscAllowDomainUser = ((Get-ItemProperty -Path $key -Name PSDscAllowDomainUser).PSDscAllowDomainUser -eq "True") + } + [bool] $PSDscDomainUser = IsDomainUser -username $p.Value.UserName + + if($Node -and $selectedNodesData) + { + if($selectedNodesData -is [array]) + { + foreach($target in $selectedNodesData) + { + if($target['NodeName'] -and $target['NodeName'] -eq $Node) + { + $currentNode = $target + } + } + } + else + { + $currentNode = $selectedNodesData + } + } + # where user need to specify properties for resources not in a node, + # they can do it through localhost nodeName in $allNodes + elseif($allnodes -and $allnodes.AllNodes) + { + foreach($target in $allnodes.AllNodes) + { + if($target['NodeName'] -and $target['NodeName'] -eq 'localhost') + { + $currentNode = $target + } + } + } + + if($currentNode) + { + # PSDscAllowDomainUser set to true would indicate that we want to allow + # domain credential. It takes precedence over PSDscAllowPlainTextPassword behavior + if($currentNode['PSDscAllowDomainUser']) + { + $PSDscAllowDomainUser = $currentNode['PSDscAllowDomainUser'] + } + if($PSDscDomainUser -and (-not $PSDscAllowDomainUser)) + { + if($Script:NodeUsingDomainCred -eq $null) + { + $Script:NodeUsingDomainCred = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,bool]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + } + $Script:NodeUsingDomainCred[$currentNode['NodeName']] = $true + } + # PSDscAllowPlainTextPassword set to true would indicate that we want to allow the + # automatic conversion of the encrypted password to plaintext if a certificate or + # certificate id is not specified. + # if a certid or cert file is specified, it taks precedence over PSDscAllowPlainTextPassword + if($currentNode['PSDscAllowPlainTextPassword']) + { + $PSDscAllowPlainTextPassword = $currentNode['PSDscAllowPlainTextPassword'] + } + + $certificateid = $currentNode['CertificateID'] + + if ( -not $certificateid) + { + # CertificateFile is the public key file + $certificatefile = $currentNode['CertificateFile'] + + if (( -not $certificatefile) -and (-not $PSDscAllowPlainTextPassword)) + { + $errorMessage = $($LocalizedData.EncryptedToPlaintextNotAllowed) + ThrowError -ExceptionName 'System.InvalidOperationException' -ExceptionMessage $errorMessage -ExceptionObject $p -ErrorId 'InvalidPathSpecified' -ErrorCategory InvalidOperation + } + } + + if($currentNode['NodeName'] -and ($certificatefile -or $certificateid)) + { + $Script:NodesPasswordEncrypted[$currentNode['NodeName']] = $true + } + + $p.Name + ' = ' + (stringify -value $p.Value -asArray $asArray -targetType $targetType ) + ";`n" + } + else + { + $errorMessage = $($LocalizedData.EncryptedToPlaintextNotAllowed) + ThrowError -ExceptionName 'System.InvalidOperationException' -ExceptionMessage $errorMessage -ExceptionObject $p -ErrorId 'InvalidPathSpecified' -ErrorCategory InvalidOperation + } + } + else + { + if ($targetTypeName -match 'StringArray') + { + $p.Name + ' = ' + (stringify -value $p.Value -asArray $asArray -targetType $targetType ) + ";`n" + } + elseif ($targetTypeName -notmatch 'Array' -or $p.Value.Count) + { + $p.Name + ' = ' + (stringify -value $p.Value -asArray $asArray -targetType $targetType ) + ";`n" + } + } + } + } + } + else + { + if ($Type -notmatch 'OMI_ConfigurationDocument') + { + $result += "// This instance definition of $Type had no properties`n" + } + Write-Debug -Message " ENCOUNTERED INSTANCE OF TYPE '$Type' WITH NO PROPERTIES" + } + } + catch + { + $errorMessage = $_.Exception.Message + (Get-PositionInfo $Properties['SourceInfo']) + $errorMessage = $LocalizedData.FailToProcessProperty -f @($_.Exception.GetType().FullName, $p.Name, $Type, $errorMessage) + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId FailToProcessProperty + Update-ConfigurationErrorCount + } + finally + { + $OFS = $oldOFS + } + + # + # Add extra information about Author, GenerationHost, GenerationDate and Name if they are not specified + # + if ($Type -match 'OMI_ConfigurationDocument' -and $Properties) + { + if (-not $Properties.ContainsKey('Author')) + { + $result += " Author = `"$([system.environment]::UserName)`";`n" + } + + if (-not $Properties.ContainsKey('GenerationDate')) + { + $result += " GenerationDate = `"$(Get-Date)`";`n" + } + + if (-not $Properties.ContainsKey('GenerationHost')) + { + $result += " GenerationHost = `"$([system.environment]::MachineName)`";`n" + } + + # todo: report error is configuration name does't match + if (-not $Properties.ContainsKey('Name')) + { + $result += " Name = `"$(Get-PSTopConfigurationName)`";`n" + } + } + + # + # Append the completed mof instance text to the overall document + # + $instanceText = "`n" + $result + "`n};`n" + + # + # Record and return the alias for that document + # + Write-Debug -Message " Added alias $MofAliasString to InstanceAliases array for node '$(Get-PSCurrentConfigurationNode)'" + + if ( Get-PSCurrentConfigurationNode ) + { + if($Script:NodeInstanceAliases[ (Get-PSCurrentConfigurationNode) ] -eq $null) + { + $Script:NodeInstanceAliases[ (Get-PSCurrentConfigurationNode) ] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + $Script:NodeResourceIdAliases[ (Get-PSCurrentConfigurationNode) ] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + } + + $Script:NodeInstanceAliases[ (Get-PSCurrentConfigurationNode) ][$MofAliasString] = $instanceText + + if($Properties.ContainsKey('ResourceID')) + { + $Script:NodeResourceIdAliases[ (Get-PSCurrentConfigurationNode) ][$Properties['ResourceID']] = $MofAliasString + } + } + else + { + $Script:NoNameNodeInstanceAliases[$MofAliasString] = $instanceText + + if($Properties.ContainsKey('ResourceID')) + { + $Script:NoNameNodeResourceIdAliases[$Properties['ResourceID']] = $MofAliasString + } + } + + # todo: we can check error for duplicated alias in a node and report it here + # because this can live acrose configurationelement calls + Write-Debug -Message " MOF GENERATION COMPLETED FOR $Type" + $MofAliasString +} + +# +# +# Returns the MOF text for the instance that +# corresponds to the aliasId +# +function Get-MofInstanceText +{ + param ( + [Parameter(Mandatory)] + [string] + $aliasId + ) + + if ( Get-PSCurrentConfigurationNode ) + { + $Script:NodeInstanceAliases[ (Get-PSCurrentConfigurationNode) ][$aliasId] + } + else + { + $Script:NoNameNodeInstanceAliases[$aliasId] + } +} + +# +# Get the position message based on the SourceMetadata +# +function Get-PositionInfo +{ + param( + [string] + $sourceMetadata + ) + + $positionMessage = '' + if ($sourceMetadata) + { + $positionMessage = "`nAt" + $infoItems = $sourceMetadata -split '::' + + # File name may be empty + if ($infoItems[0]) + { + $positionMessage += " $($infoItems[0]):$($infoItems[1])" + } + else + { + $positionMessage += " line:$($infoItems[1])" + } + + $positionMessage += " char:$($infoItems[2])" + $positionMessage += "`n+ $($infoItems[3])" + } + + $positionMessage +} + + +################################################################################### +# +# A function that implements the 'Node' keyword logic. The Node keyword accumulates +# the resource instances to define for a specific node or nodes. It's passed into the +# configuration statement using the ScriptBlock.InvokeWithContext() method +# +function Node +{ + [OutputType([void])] + param ( + [Parameter(Mandatory)] + $KeywordData, # Not used in this function.... + [string[]] + $Name, # the list of nodes to process in this call + [Parameter(Mandatory)] + [ScriptBlock] + $Value, # The scriptblock that generates the configuration in each node. + [Parameter(Mandatory)] + $sourceMetadata # Not used in this function + ) + + + if (-not $Name) + { + Write-Debug -Message 'The name parameter was empty, no nodes generated' + return + } + + Write-Debug -Message "*PROCESSING STARTED FOR NODE SET {$(@($Name) -join ',')} " + + # Save any global level resources and initialize for the resources defined for this node. + $Script:PSOuterConfigurationNodes.Push( (Get-PSCurrentConfigurationNode) ) + $OldNodeResources = $Script:NodeResources + $OldNodeKeys = $Script:NodeKeys + + try + { + $OuterNode = $Script:PSOuterConfigurationNodes.Peek() + if(( $OuterNode -eq [string]::Empty) -or + (($OuterNode -ne [string]::Empty) -and ($Name -contains $OuterNode))) + { + # + # Set up a map from node name to data + # + $nodeDataMap = @{} + + # + # Copy the AllNodes data into the map + # + + if($script:ConfigurationData) + { + $script:ConfigurationData.AllNodes | ForEach-Object -Process { + $nodeDataMap[$_.NodeName] = $_ + } + } + + # + # Create the SelectedNodes list for this Node statement + # + $selectedNodesData = foreach ($nn in $Name) + { + # If there is no data for this node, create a dummy node + # with at least the node name + if ( -not $nodeDataMap[$nn] ) + { + $nodeDataMap[$nn] = @{ + NodeName = $nn + } + } + $nodeDataMap[$nn] + } + + foreach ($Node in $Name) + { + if(($OuterNode -ne [string]::Empty) -and ($OuterNode -ne $Node)) + { + continue + } + + Set-PSCurrentConfigurationNode $Node + + if( $Script:NodesInThisConfiguration[$Node] ) + { + $Script:NodeResources = $Script:NodesInThisConfiguration[$Node] + } + else + { + $Script:NodesInThisConfiguration[$Node] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,[string[]]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + $Script:NodeResources = $Script:NodesInThisConfiguration[$Node] + } + + #this for tracking referenced configuration managers + if( $Script:NodesManagerInThisConfiguration[$Node] ) + { + $Script:NodeManager = $Script:NodesManagerInThisConfiguration[$Node] + } + else + { + $Script:NodesManagerInThisConfiguration[$Node] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + $Script:NodeManager = $Script:NodesManagerInThisConfiguration[$Node] + } + + #this for tracking exclusive resources + if( $Script:NodesExclusiveResourcesInThisConfiguration[$Node] ) + { + $Script:NodeExclusiveResources = $Script:NodesExclusiveResourcesInThisConfiguration[$Node] + } + else + { + $Script:NodesExclusiveResourcesInThisConfiguration[$Node] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + $Script:NodeExclusiveResources = $Script:NodesExclusiveResourcesInThisConfiguration[$Node] + } + + #this for tracking referenced Resource Module Source + if( $Script:NodesResourceSourceInThisConfiguration[$Node] ) + { + $Script:NodeResourceSource = $Script:NodesResourceSourceInThisConfiguration[$Node] + } + else + { + $Script:NodesResourceSourceInThisConfiguration[$Node] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + $Script:NodeResourceSource = $Script:NodesResourceSourceInThisConfiguration[$Node] + } + + if(-not $Script:NodeTypeRefCount[$Node]) + { + $Script:NodeTypeRefCount[$Node] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string, System.Collections.Generic.Dictionary[string,int]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + $Script:NodeInstanceAliases[$Node] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string, System.Collections.Generic.Dictionary[string,string]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + $Script:NodeResourceIdAliases[$Node] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string, System.Collections.Generic.Dictionary[string,string]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + } + + if(-not $script:NodesKeysInThisConfiguration[$Node]) + { + $script:NodesKeysInThisConfiguration[$Node] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.HashSet[string]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + } + $Script:NodeKeys = $script:NodesKeysInThisConfiguration[$Node] + + # + # Set up the context variable list. + # + $variablesToDefine = @( + New-Object -TypeName PSVariable -ArgumentList ('SelectedNodes', $selectedNodesData) + New-Object -TypeName PSVariable -ArgumentList ('Node', $nodeDataMap[$Node]) + New-Object -TypeName PSVariable -ArgumentList ('NodeName', $Node) + ) + + # Initialize dictionary to detect duplicate resources + if ($Script:DuplicateResources -eq $null) + { + $Script:DuplicateResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.Dictionary[string,System.Collections.Generic.List[System.Collections.Hashtable]]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + } + + if (-not $Script:DuplicateResources.ContainsKey($Name)) + { + $Script:DuplicateResources[$Name] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.List[System.Collections.Hashtable]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + } + + try + { + # Evaluate the node's business logic scriptblock + Write-Debug -Message "*$Node : NODE PROCESSING STARTED FOR THIS NODE." + $Value.InvokeWithContext($functionsToDefine, $variablesToDefine) + } + catch [System.Management.Automation.MethodInvocationException] + { + # Write the unwrapped exception message + $pscmdlet.CommandRuntime.WriteError((Get-InnerMostErrorRecord $_)) + Update-ConfigurationErrorCount + } + + # Display warning if domain credential is used in the configuration. + if($Script:NodeUsingDomainCred.ContainsKey($Node) -and $Script:NodeUsingDomainCred[$Node]) + { + $nameMessage = $LocalizedData.DomainCredentialNotAllowed -f @($Node, $Node) + $UserWarningPreference = $WarningPreference + if($ArgsToBody['WarningAction'] -ne $null) + { + $UserWarningPreference = $ArgsToBody['WarningAction'] + } + Write-Warning -Message $nameMessage -WarningAction $UserWarningPreference + } + + # Validate make sure all of the required resources are defined + # if so, add the DependsOn fields for all resources + ValidateNodeResources + # + # Fixup ModuleVersion + # + Update-ModuleVersion $Script:NodeResources $Script:NodeInstanceAliases[$Node] $Script:NodeResourceIdAliases[$Node] + + # Validate make sure all of the referenced download managers are defined + ValidateNodeManager + + # Validate make sure all of the referenced resource source are defined + ValidateNodeResourceSource + + # Validate make sure no conflict between exclusive resources + # also validate exclusive resource exist + ValidateNodeExclusiveResources + + # Validate make sure all of the required resources are defined + ValidateNoCircleInNodeResources + + Write-Debug -Message "*$Node : NODE PROCESSING COMPLETED FOR THIS NODE. configuration errors encountered so far: $(Get-ConfigurationErrorCount)" + } + } + else + { + $errorMessage = $LocalizedData.NestedNodeNotAllowed -f @(($Name -join ','), (Get-PSCurrentConfigurationNode), $Script:PSConfigurationName) + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId NestedNodeNotAllowed + Update-ConfigurationErrorCount + } + } + catch + { + $errorMessage = $_.Exception.Message + (Get-PositionInfo $sourceMetadata) + $errorMessage = $LocalizedData.FailToProcessNode -f @($Node, $errorMessage) + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId FailToProcessNode + Update-ConfigurationErrorCount + } + finally + { + Set-PSCurrentConfigurationNode ($Script:PSOuterConfigurationNodes.Pop()) + $Script:NodeResources = $OldNodeResources + $Script:NodeKeys = $OldNodeKeys + Write-Debug -Message "*NODE STATEMENT PROCESSING COMPLETED. Configuration errors encountered so far: $(Get-ConfigurationErrorCount)" + } +} + +# +# Utility used to track the number of errors encountered while processing the configuration +# +function Update-ConfigurationErrorCount +{ + [OutputType([void])] + param() + + $Script:PSConfigurationErrors++ +} + +function Get-ConfigurationErrorCount +{ + [OutputType([int])] + param() + + $Script:PSConfigurationErrors +} + +function Get-ComplexResourceQualifier +{ + [OutputType([string])] + param() + + # walk the call stack to get at all of the enclosing configuration resource IDs + $stackedConfigs = @(Get-PSCallStack | + where { ($_.InvocationInfo.MyCommand -ne $null) -and ($_.InvocationInfo.MyCommand.CommandType -eq 'Configuration') }) + + $complexResourceQualifier = $null + # keep all but the top-most + if(@($stackedConfigs).Length -ge 3) + { + $stackedConfigs = $stackedConfigs[1..(@($stackedConfigs).Length - 2)] + # and build the complex resource ID suffix. + $complexResourceQualifier = ( $stackedConfigs | foreach { '[' + $_.Command + ']' + $_.InvocationInfo.BoundParameters['InstanceName'] } ) -join '::' + } + + return $complexResourceQualifier + } + +# +# A function to set the document text for default (unnamed) node +# +function Set-PSDefaultConfigurationDocument +{ + [OutputType([void])] + param ( + [Parameter()] + [string] + $documentText = '' + ) + + $Script:PSDefaultConfigurationDocument = $documentText +} + +# +# Get the text associated with the default (unnamed) node. +# +function Get-PSDefaultConfigurationDocument +{ + [OutputType([string])] + param() + + return $Script:PSDefaultConfigurationDocument +} + +################################################## +# +# Returns the name of the configuration currently being configured +# +function Get-PSTopConfigurationName +{ + [OutputType([string])] + param() + + return $Script:PSTopConfigurationName +} + +function Set-PSTopConfigurationName +{ + [OutputType([void])] + param ( + [Parameter()] + [string] + $Name + ) + + $Script:PSTopConfigurationName = $Name +} + +################################################## +# +# Returns the name of the node currently being configured +# +function Get-PSCurrentConfigurationNode +{ + [OutputType([string])] + param() + + return $Script:PSCurrentConfigurationNode +} + +function Set-PSCurrentConfigurationNode +{ + [OutputType([void])] + param ( + [Parameter()] + [string] + $nodeName + ) + + $Script:PSCurrentConfigurationNode = $nodeName +} + +################################################# + +function Set-NodeResources +{ + [OutputType([void])] + param ( + [Parameter(Mandatory)] + [string] + $resourceId, + [Parameter(Mandatory)] + [AllowNull()] + [AllowEmptyCollection()] + [string[]] + $requiredResourceList + ) + + if ($Script:NodeResources -eq $null) + { + $Script:NodeResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,[string[]]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + } + $Script:NodeResources[$resourceId] = $requiredResourceList +} + +function Test-NodeResources +{ + [OutputType([bool])] + param ( + [Parameter(Mandatory)] + + [string] + $resourceId + ) + + if ( -not $Script:NodeResources) + { + $false + } + else + { + $Script:NodeResources.ContainsKey($resourceId) + } +} + +# +# update a mapping of a partial configuration resource and the managers it referenced +# +function Set-NodeManager +{ + [OutputType([void])] + param ( + [Parameter(Mandatory)] + [string] + $resourceId, + [Parameter(Mandatory)] + [AllowNull()] + [string[]] + $referencedManagers + ) + + if ($Script:NodeManager -eq $null) + { + $Script:NodeManager = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + } + $Script:NodeManager[$resourceId] = $referencedManagers +} + +# +# +# +function Test-NodeManager +{ + [OutputType([bool])] + param ( + [Parameter(Mandatory)] + + [string] + $resourceId + ) + + if ( -not $Script:NodeManager) + { + $false + } + else + { + $Script:NodeManager.ContainsKey($resourceId) + } +} + +# +# update a mapping of a partial configuration resource and the managers it referenced +# +function Set-NodeResourceSource +{ + [OutputType([void])] + param ( + [Parameter(Mandatory)] + [string] + $resourceId, + [Parameter(Mandatory)] + [AllowNull()] + [string[]] + $referencedResourceSources + ) + + if ($Script:NodeResourceSource -eq $null) + { + $Script:NodeResourceSource = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + } + $Script:NodeResourceSource[$resourceId] = $referencedResourceSources +} + +# +# +# +function Test-NodeResourceSource +{ + [OutputType([bool])] + param ( + [Parameter(Mandatory)] + + [string] + $resourceId + ) + + if ( -not $Script:NodeResourceSource) + { + $false + } + else + { + $Script:NodeResourceSource.ContainsKey($resourceId) + } +} + +# +# update a mapping of a partial configuration resource and the managers it referenced +# resource format can be moduleName\* moduleName\resourceName and resourceName +# this is validated during mof generation/cananic stage +# +function Set-NodeExclusiveResources +{ + [OutputType([string[]])] + param ( + [Parameter(Mandatory)] + [string] + $resourceId, + [Parameter(Mandatory)] + [AllowNull()] + [string[]] + $exclusiveResource + ) + + $Script:NodeExclusiveResources[$resourceId] = $exclusiveResource + return $exclusiveResource +} + + +function Add-NodeKeys +{ + [OutputType([void])] + param ( + [Parameter(Mandatory)] + [string] + $ResourceKey, + [parameter(Mandatory)] + [string] + $keywordName + ) + + if ($Script:NodeKeys -eq $null) + { + $Script:NodeKeys = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.HashSet[string]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + } + + if( -not $Script:NodeKeys.ContainsKey($keywordName)) + { + $Script:NodeKeys[$keywordName] = New-Object -TypeName 'System.Collections.Generic.HashSet[string]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + } + + if(-not $Script:NodeKeys[$keywordName].Contains($ResourceKey)) + { + $null = $Script:NodeKeys[$keywordName].Add($ResourceKey) + } + +} + +########################################################### +# +# A function to verify there's no duplicate conflicting resources in the configuration +# +# Conflict detecting algorithm works by going through all previuosly visited resources of same type and checking whether previously visited +# resource contains any properties which currently analyzed resource does not have or whether +# they have same properties but with different values. If that's the case, we mark that either key or non-key properties don't match. +# After that we check whether currently analyzed resource contains properties which the previously analyzed resource did not have at all. If that's the case we mark that +# non-key properties don't match (since all key properties were covered in the first phase). +# +# Once we processed all previous resources, we return error about duplicate conflicting resources if and only if key properties match and non key properties don't match. +# +########################################################### +function Test-ConflictingResources +{ + [OutputType([void])] + param ( + [string] + $keyword, + [parameter(Mandatory)] + [Hashtable] + $properties, + [Parameter(Mandatory)] + $keywordData + ) + $resourceID = $properties['ResourceID'] + $sourceInfo = $properties['SourceInfo'] + + $nonConflictingKeywords = @("PartialConfiguration", "WaitForAny", "WaitForSome", "WaitForAll") + if ($keyword -in $nonConflictingKeywords) + { + return + } + + # Get name of the current node + $currentNodeName = Get-PSCurrentConfigurationNode + if (-not $currentNodeName) + { + $currentNodeName = 'localhost' + } + + # Initialize $Script:DuplicateResources if not already initialized + if ($Script:DuplicateResources -eq $null) + { + $Script:DuplicateResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.Dictionary[string,System.Collections.Generic.List[System.Collections.Hashtable]]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + } + + if (-not $Script:DuplicateResources.ContainsKey($currentNodeName)) + { + $Script:DuplicateResources[$currentNodeName] = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.List[System.Collections.Hashtable]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + } + + if ( -not $Script:DuplicateResources[$currentNodeName].ContainsKey($keyword)) + { + $Script:DuplicateResources[$currentNodeName][$keyword] = New-Object 'System.Collections.Generic.List[System.Collections.Hashtable]' + } + + # Find if current resource is duplicate and conflicting. + foreach($resource in $Script:DuplicateResources[$currentNodeName][$keyword]) + { + $keyPropertiesMatch = $true + $nonKeyPropertiesMatch = $true + $unmatchedNonKeyPropertiesNames = "" + $unmatchedNonKeyPropertiesCurrentValues = "" + $unmatchedNonKeyPropertiesPreviousValues = "" + + # For every property in previously analyzed resource + foreach($property in $resource.Keys) + { + $nonConflictingProperties = @("DependsOn", "ResourceID", "SourceInfo", "ModuleVersion") + if ($property -in $nonConflictingProperties) + { + continue + } + + # If currently analyzed resource does not have the property + if ( -not $properties.ContainsKey($property)) + { + $nonKeyPropertiesMatch = $false + $unmatchedNonKeyPropertiesNames += $property.ToString() + ';' + # Calling ToString() explicitly so that the value is not converted to Boolean/Integer + if ($resource[$property]) + { + $unmatchedNonKeyPropertiesPreviousValues += $resource[$property].ToString() + ';' + } + else + { + $unmatchedNonKeyPropertiesPreviousValues = $unmatchedNonKeyPropertiesPreviousValues.ToString() + 'NULL;' + } + $unmatchedNonKeyPropertiesCurrentValues = $unmatchedNonKeyPropertiesCurrentValues.ToString() + 'NULL;' + } + # If currently analyzed resource has property, but with different value + elseif ( $resource[$property] -ne $properties[$property] ) + { + # If it's a key property + if ($keywordData.Properties[$property].IsKey) + { + $keyPropertiesMatch = $false + break + } + # If it's a non-key property + else + { + $nonKeyPropertiesMatch = $false + $unmatchedNonKeyPropertiesNames += $property.ToString() + ';' + if ($resource[$property]) + { + $unmatchedNonKeyPropertiesPreviousValues += $resource[$property].ToString() + ';' + } + else + { + $unmatchedNonKeyPropertiesPreviousValues = $unmatchedNonKeyPropertiesPreviousValues.ToString() + 'NULL;' + } + + if ($properties[$property]) + { + $unmatchedNonKeyPropertiesCurrentValues += $properties[$property].ToString() + ';' + } + else + { + $unmatchedNonKeyPropertiesCurrentValues = $unmatchedNonKeyPropertiesCurrentValues.ToString() + 'NULL;' + } + } + } + } + + if ($keyPropertiesMatch) + { + foreach($property in $properties.Keys) + { + # If previously analyzed resource does not have property + if ((-not $resource.containsKey($property)) -and ($property -ne "ModuleVersion")) + { + $nonKeyPropertiesMatch = $false + $unmatchedNonKeyPropertiesNames += $property.ToString() + ';' + $unmatchedNonKeyPropertiesPreviousValues = $unmatchedNonKeyPropertiesPreviousValues.ToString() + 'NULL;' + if ($properties[$property]) + { + $unmatchedNonKeyPropertiesCurrentValues += $properties[$property].ToString() + ';' + } + else + { + $unmatchedNonKeyPropertiesCurrentValues = $unmatchedNonKeyPropertiesCurrentValues.ToString() + 'NULL;' + } + } + } + } + + # If resource is duplicate and conflicting we should return error + if ($keyPropertiesMatch -and (-not $nonKeyPropertiesMatch)) + { + $unmatchedNonKeyPropertiesNames = $unmatchedNonKeyPropertiesNames.Substring(0, $unmatchedNonKeyPropertiesNames.Length-1) + $unmatchedNonKeyPropertiesPreviousValues = $unmatchedNonKeyPropertiesPreviousValues.Substring(0, $unmatchedNonKeyPropertiesPreviousValues.Length-1) + $unmatchedNonKeyPropertiesCurrentValues = $unmatchedNonKeyPropertiesCurrentValues.Substring(0, $unmatchedNonKeyPropertiesCurrentValues.Length-1) + + $previousResourceIdentifier = $resource["ResourceID"] + " (" + $resource["SourceInfo"] + ")" + $currentResourceIdentifier = $resourceID + " (" + $sourceInfo + ")" + $errorMessage = $LocalizedData.ConflictingDuplicateResource -f @($previousResourceIdentifier, $currentResourceIdentifier, $currentNodeName, $unmatchedNonKeyPropertiesNames, $unmatchedNonKeyPropertiesPreviousValues, $unmatchedNonKeyPropertiesCurrentValues) + $exception = New-Object System.InvalidOperationException $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ConflictingDuplicateResource + Update-ConfigurationErrorCount + } + } + + $Script:DuplicateResources[$currentNodeName][$keyword].Add($properties) + +} + +################################################# +# +# A function to get the innermost error record. +# +function Get-InnerMostErrorRecord +{ + param ( + [Parameter(Mandatory)] + [System.Management.Automation.ErrorRecord] + $ErrorRecord + ) + + $exception = $ErrorRecord.Exception + while ($exception.InnerException -and $exception.InnerException.ErrorRecord) + { + $exception = $exception.InnerException + $ErrorRecord = $exception.ErrorRecord + } + $ErrorRecord +} + +########################################################### +# +# A function to set up all of the module-scoped state variables. +# +function Initialize-ConfigurationRuntimeState +{ + param ( + [Parameter()] + [string] + $ConfigurationName = '' + ) + + # The overall name of the configuration being processed + [string] $Script:PSConfigurationName = $ConfigurationName + + # The ModuleVersion used for PsDesiredStateConfiguration module. + [string] $Script:PsDscModuleVersion = "0.0" + + # The compatibility version for the document.. + [string] $Script:PsDscCompatibleVersion = "1.0.0" + + # The list of modules explicitly imported using import-dscresorce + $Script:ExplicitlyImportedModules = New-Object -TypeName 'System.Collections.Generic.Dictionary[String,String]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For the current configuration, this contains the name of the node currently being processed + [string] $Script:PSCurrentConfigurationNode = '' + + # For the current node, this contains a map of resource instance to resource prerequisites (DependsOn resources). + [System.Collections.Generic.Dictionary[string,string[]]] ` + $Script:NodeResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,[string[]]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For the current node, this contains a map of partial configuration instance to configuration managers. + [System.Collections.Generic.Dictionary[string,string]] ` + $Script:NodeManager = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For the current node, this contains a map of partial configuration instance to Resource Source. + [System.Collections.Generic.Dictionary[string,string]] ` + $Script:NodeResourceSource = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For the current node, this contains a map of partial configuration instance to its exclusive resources. + [System.Collections.Generic.Dictionary[string,string[]]] ` + $Script:NodeExclusiveResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For all nodes except the unnamed node, this contains the per-node per-type reference counter used to generate the CIM aliases for each instance + [System.Collections.Generic.Dictionary[string, System.Collections.Generic.Dictionary[string,int]]] ` + $Script:NodeTypeRefCount = New-Object -TypeName 'System.Collections.Generic.Dictionary[string, System.Collections.Generic.Dictionary[string,int]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For all nodes except the unnamed node, this maps the node name to the node's table of alias to mof text mappings. + [System.Collections.Generic.Dictionary[string,System.Collections.Generic.Dictionary[string,string]]] ` + $Script:NodeInstanceAliases = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.Dictionary[string,string]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For all nodes except the unnamed node, this maps the node name to the node's table of resourceID to mof text mappings. + [System.Collections.Generic.Dictionary[string,System.Collections.Generic.Dictionary[string,string]]] ` + $Script:NodeResourceIdAliases = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.Dictionary[string,string]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For all nodes except the unnamed node, this maps the node name to the node's map of resource instance to resource prerequisites + [System.Collections.Generic.Dictionary[string,object]] ` + $Script:NodesInThisConfiguration = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,object]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For all nodes except the unnamed node, this maps the node name to the node's map of partial configuration resource instance to reference resource source. + [System.Collections.Generic.Dictionary[string,object]] ` + $Script:NodesResourceSourceInThisConfiguration = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,object]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For all nodes except the unnamed node, this maps the node name to the node's map of partial configuration resource instance to reference configuraiton manager. + [System.Collections.Generic.Dictionary[string,object]] ` + $Script:NodesManagerInThisConfiguration = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,object]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For all nodes except the unnamed node, this maps the node name to the node's map of resource instance to exclusive resource + [System.Collections.Generic.Dictionary[string,object]] ` + $Script:NodesExclusiveResourcesInThisConfiguration = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,object]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For the unnamed (default) node, this contains a map of resource instance to resource prerequisites (required resources). + [System.Collections.Generic.Dictionary[String,String[]]] ` + $Script:NoNameNodesResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[String,String[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For the unnamed (default) node, this contains a map of partial configuration resource instance to reference configuration manager. + [System.Collections.Generic.Dictionary[String,String]] ` + $Script:NoNameNodeManager = New-Object -TypeName 'System.Collections.Generic.Dictionary[String,String[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For the unnamed (default) node, this contains a map of partial configuration resource instance to reference resource source. + [System.Collections.Generic.Dictionary[String,String]] ` + $Script:NoNameNodeResourceSource = New-Object -TypeName 'System.Collections.Generic.Dictionary[String,String[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For the unnamed (default) node, this contains a map of partial configuration resource instance to its exclusive resources. + [System.Collections.Generic.Dictionary[String,String[]]] ` + $Script:NoNameNodeExclusiveResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[String,String[]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For the unnamed (default) node, this contains the per-node per-type reference counter used to generate the CIM aliases for each instance + [System.Collections.Generic.Dictionary[String,int]] ` + $Script:NoNameNodeTypeRefCount = New-Object -TypeName 'System.Collections.Generic.Dictionary[String,int]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For the unnamed (default) node, this maps the node name to the node's table of alias to mof text mappings. + # Alias to mof text mapping for the unnamed node. + [System.Collections.Generic.Dictionary[string,string]] ` + $Script:NoNameNodeInstanceAliases = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For the unnamed (default) node, this maps the node name to the node's table of resourceId to mof text mappings. + # Alias to mof text mapping for the unnamed node. + [System.Collections.Generic.Dictionary[string,string]] ` + $Script:NoNameNodeResourceIdAliases = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,string]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + #dictionary to save whether a node has encrypted password + [System.Collections.Generic.Dictionary[string,bool]] ` + $Script:NodesPasswordEncrypted = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,bool]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For all nodes, contain information about node using domain credential or not + [System.Collections.Generic.Dictionary[string,bool]] ` + $Script:NodeUsingDomainCred = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,bool]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + [System.Collections.Generic.Stack[String]] $Script:PSOuterConfigurationNodes = New-Object -TypeName 'System.Collections.Generic.Stack[String]' + + # The number of errors that have occurred while processing this configuration. + [int] $Script:PSConfigurationErrors = 0 + + # Set up a variable to hold a top-level OMI_ConfigurationDocument value + # which will be used by all nodes if it's present. + [string] $Script:PSDefaultConfigurationDocument = '' + + + # Set up a hastable to hold user specified info for OMI_ConfigurationDocument value for meta config + # we will need update it last after processing meta config to figure out what V2 property it uses + [hashtable] $script:PSMetaConfigDocumentInstVersionInfo = @{} + + [bool] $Script:PSMetaConfigDocInsProcessedBeforeMeta = $false + [bool] $script:PSMetaConfigurationProcessed = $false + + # For all nodes except the unnamed node, this maps the node name to the node's map of keys of resources. + [System.Collections.Generic.Dictionary[string,object]] ` + $script:NodesKeysInThisConfiguration = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,object]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For the current node, this contains keys of resource instances. + [System.Collections.Generic.Dictionary[string,System.Collections.Generic.HashSet[string]]] ` + $Script:NodeKeys = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.HashSet[string]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For the unnamed (default) node, this contains keys of resource instances. + [System.Collections.Generic.Dictionary[String,System.Collections.Generic.HashSet[string]]] ` + $Script:NoNameNodeKeys = New-Object -TypeName 'System.Collections.Generic.Dictionary[String,System.Collections.Generic.HashSet[string]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # For the current configuration, $Script:DuplicateResources["Type"] contains list with properties of all resources of the specific type + [System.Collections.Generic.Dictionary[string,System.Collections.Generic.Dictionary[string,System.Collections.Generic.List[System.Collections.Hashtable]]]] ` + $Script:DuplicateResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,System.Collections.Generic.Dictionary[string,System.Collections.Generic.List[System.Collections.Hashtable]]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + + # Show Import-DscResource warning if in-build resources are used in the Configuration without Import-DscResource statement. + [bool] $script:ShowImportDscResourceWarning = $false + + # For testing whether setting meta configuration into PULL mode without appropriate configuration manager + [bool] $script:MetaConfigSetToPull = $false + [bool] $script:SpecifiedV1DownloadManagerName = $false + [bool] $script:SpecifiedV2DownloadManager = $false +} + +# +# Then call it to enact the default state. This happens +# only once during the module load. Thereafter the +# configuration function is responsible for resetting state. +# +Initialize-ConfigurationRuntimeState + +# make sure configuration data format: +# 1. Is a hashtable +# 2. Has a collection AllNodes +# 3. Allnodes is an collection of Hashtable +# 4. Each element of Allnodes has NodeName +# 5. We will copy values from NodeName="*" to all node if they don't exist +function ValidateUpdate-ConfigurationData +{ + param ( + [Parameter()] + [hashtable] + $ConfigurationData + ) + + if( -not $ConfigurationData.ContainsKey('AllNodes')) + { + $errorMessage = $LocalizedData.ConfiguratonDataNeedAllNodes + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ConfiguratonDataNeedAllNodes + return $false + } + + if($ConfigurationData.AllNodes -isnot [array]) + { + $errorMessage = $LocalizedData.ConfiguratonDataAllNodesNeedHashtable + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ConfiguratonDataAllNodesNeedHashtable + return $false + } + + $nodeNames = New-Object -TypeName 'System.Collections.Generic.HashSet[string]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + foreach($Node in $ConfigurationData.AllNodes) + { + if($Node -isnot [hashtable] -or -not $Node.NodeName) + { + $errorMessage = $LocalizedData.AllNodeNeedToBeHashtable + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ConfiguratonDataAllNodesNeedHashtable + return $false + } + + if($nodeNames.Contains($Node.NodeName)) + { + $errorMessage = $LocalizedData.DuplicatedNodeInConfigurationData -f $Node.NodeName + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId DuplicatedNodeInConfigurationData + return $false + } + + if($Node.NodeName -eq '*') + { + $AllNodeSettings = $Node + } + [void] $nodeNames.Add($Node.NodeName) + } + + if($AllNodeSettings) + { + foreach($Node in $ConfigurationData.AllNodes) + { + if($Node.NodeName -ne '*') + { + foreach($nodeKey in $AllNodeSettings.Keys) + { + if(-not $Node.ContainsKey($nodeKey)) + { + $Node.Add($nodeKey, $AllNodeSettings[$nodeKey]) + } + } + } + } + + $ConfigurationData.AllNodes = @($ConfigurationData.AllNodes | Where-Object -FilterScript { + $_.NodeName -ne '*' + } + ) + } + + return $true +} + +############################################################## +# +# Checks to see if a module defining composite resources should be reloaded +# based the last write time of the schema file. Returns true if the file exists +# and the last modified time was either not recorded or has change. +# +function Test-ModuleReloadRequired +{ + [OutputType([bool])] + param ( + [Parameter(Mandatory)] + [string] + $SchemaFilePath + ) + + if (-not $SchemaFilePath -or $SchemaFilePath -notmatch '\.schema\.psm1$') + { + # not a composite res + return $false + } + + # If the path doesn't exist, then we can't reload it. + # Note: this condition is explicitly not an error for this function. + if ( -not (Test-Path $SchemaFilePath)) + { + if ($schemaFileLastUpdate.ContainsKey($SchemaFilePath)) + { + $schemaFileLastUpdate.Remove($SchemaFilePath) + } + return $false + } + + # If we have a modified date, then return it. + if ($schemaFileLastUpdate.ContainsKey($SchemaFilePath)) + { + if ( (Get-Item $SchemaFilePath).LastWriteTime -eq $schemaFileLastUpdate[$SchemaFilePath] ) + { + return $false + } + else + { + return $true + } + } + + # Otherwise, record the last write time and return true. + $script:schemaFileLastUpdate[$SchemaFilePath] = (Get-Item $SchemaFilePath).LastWriteTime + $true +} +# Holds the schema file to lastwritetime mapping. +[System.Collections.Generic.Dictionary[string,DateTime]] $script:schemaFileLastUpdate = +New-Object -TypeName 'System.Collections.Generic.Dictionary[string,datetime]' + +########################################################### +# Configuration keyword implementation +########################################################### +# +# Implements the 'configuration' keyword logic that accumulates and writes +# out the generated DSC MOF files +# +function Configuration +{ + [CmdletBinding(HelpUri = 'https://go.microsoft.com/fwlink/?LinkId=517195')] + param ( + # there are extra [] around Tuple arguments + [System.Collections.Generic.List[System.Tuple[[string[]], [Microsoft.PowerShell.Commands.ModuleSpecification[]], [Version]]]] + $ResourceModuleTuplesToImport, + $OutputPath = '.', + $Name, + [scriptblock] + $Body, + [hashtable] + $ArgsToBody, + [hashtable] + $ConfigurationData = @{ + AllNodes = @() + }, + [string] + $InstanceName = '' + ) + + + function ConvertModuleDefnitionToModuleInfo + { + param( + [Microsoft.PowerShell.Commands.ModuleSpecification[]]$moduleToImport, + [Version]$moduleVersion = $null + ) + + if (-not $moduleToImport) { + return $null + } + + $moduleToImport | % { + $versionToUse = $_.Version + if( [string]::IsNullOrEmpty($versionToUse)) + { + $versionToUse = $_.RequiredVersion + } + $Script:ExplicitlyImportedModules[ $_.Name ] = $versionToUse + } + $moduleInfos = Get-Module -ListAvailable -FullyQualifiedName $moduleToImport | sort -Property Version -Descending + + # Import-DscResource matches exact version of the module if ‘ModuleVersion’ is specified. + # This is intentional, ModuleVersion keyword doesn’t refer to the latest version in Import-DscResource. + # Find the module that matches specified version. + $modules = New-Object -TypeName System.Collections.ObjectModel.Collection[System.Management.Automation.PSModuleInfo] + if (($moduleInfos.Count -gt 0) -and ($moduleToImport.Version -or $moduleToImport.Guid)) + { + foreach ($moduleInfo in $moduleInfos) + { + if (($moduleToImport.Guid -and $moduleToImport.Guid.Equals($moduleInfo.Guid.ToString())) -or + ($moduleToImport.Version -and $moduleToImport.Version.Equals($moduleInfo.Version))) + { + $modules.Add($moduleInfo) + break + } + } + } + elseif ($moduleInfos.Count -eq 1) + { + $modules.Add($moduleInfos) + } + + return $modules + } + + try + { + Write-Debug -Message "BEGIN CONFIGURATION '$Name' PROCESSING: OutputPath: '$OutputPath'" + + if ($Name -inotmatch '^[a-z][a-z0-9_./-]*$') + { + $errorId = 'InvalidConfigurationName' + $errorMessage = $($LocalizedData.InvalidConfigurationName) -f ${Name} + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId $errorId + } + + $script:IsMetaConfig = $false + foreach($attri in $Body.Attributes) + { + if ($attri.GetType() -eq [System.Management.Automation.DscLocalConfigurationManagerAttribute]) + { + $script:IsMetaConfig = $true + $Script:PSMetaConfigDocInsProcessedBeforeMeta = $false + $script:PSMetaConfigurationProcessed = $false + break + } + } + + # True if this is the top-most level of the configuration statement. + # + [bool] $topLevel = $false + + if ($Script:PSConfigurationName -eq '') + { + Write-Debug -Message " $Name : TOP-LEVEL CONFIGURATION STARTED" + $topLevel = $true + Set-PSTopConfigurationName $Name + # + # Define a dictionary to hold the "driver" functions that will be created for each CIM class/keyword. + # This dictionary is passed into the body scriptblock, defining these functions in the body scope + # which simplifies cleanup. + # + $script:functionsToDefine = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,ScriptBlock]'([System.StringComparer]::OrdinalIgnoreCase) + + if($ConfigurationData -eq $null) + { + $ConfigurationData = @{ + AllNodes = @() + } + } + + $dataValidated = ValidateUpdate-ConfigurationData $ConfigurationData + + if (-not $dataValidated) + { + Update-ConfigurationErrorCount + Write-Debug -Message 'ConfigurationData validation failed' + return + } + else + { + $script:ConfigurationData = $ConfigurationData + } + + if($OutputPath -eq '.' -or $OutputPath -eq $null -or $OutputPath -eq '') + { + $OutputPath = ".\$Name" + } + # Load the default CIM keyword/function definitions set, populating the function collection + # with the default functions. + [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::LoadDefaultCimKeywords($functionsToDefine) + + # Set up the rest of the configuration runtime state. + Initialize-ConfigurationRuntimeState $Name + + # Create the output directory only if it does not exist. + # If it exists then the document MOF files will overwrite + # any existing MOF files with the same name but otherwise + # leave contents of existing directory alone. + $ConfigurationOutputDirectory = "$OutputPath" + if (!(Test-Path $ConfigurationOutputDirectory)) + { + $mkdirError = $null + mkdir -ErrorVariable mkdirError -Force $ConfigurationOutputDirectory > $null 2> $null + if (! $?) + { + Update-ConfigurationErrorCount + } + + if ($mkdirError) + { + $errorId = 'InvalidOutputPath' + $errorCategory = [System.Management.Automation.ErrorCategory]::InvalidOperation + $errorMessage = $($LocalizedData.CannotCreateOutputPath) -f ${ConfigurationOutputDirectory} + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + $ErrorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord -ArgumentList $exception, $errorId, $errorCategory, $null + Write-Error $ErrorRecord + foreach ($e in $mkdirError) + { + Write-Error -Exception $e.Exception + Update-ConfigurationErrorCount + } + } + } + + # + # Add the utility functions used by the resource implementation functions. + # + $functionsToDefine.Add('Get-MofInstanceText', ${function:Get-MofInstanceText} ) + $functionsToDefine.Add('ConvertTo-MOFInstance', ${function:ConvertTo-MOFInstance} ) + $functionsToDefine.Add('Update-ConfigurationErrorCount', ${function:Update-ConfigurationErrorCount} ) + $functionsToDefine.Add('Get-ConfigurationErrorCount', ${function:Get-ConfigurationErrorCount} ) + $functionsToDefine.Add('Set-PSDefaultConfigurationDocument', ${function:Set-PSDefaultConfigurationDocument} ) + $functionsToDefine.Add('Get-PSDefaultConfigurationDocument', ${function:Get-PSDefaultConfigurationDocument} ) + $functionsToDefine.Add('Get-PSCurrentConfigurationNode', ${function:Get-PSCurrentConfigurationNode} ) + $functionsToDefine.Add('Set-NodeResources', ${function:Set-NodeResources} ) + $functionsToDefine.Add('Test-NodeResources', ${function:Test-NodeResources} ) + $functionsToDefine.Add('Set-NodeManager', ${function:Set-NodeManager} ) + $functionsToDefine.Add('Test-NodeManager', ${function:Test-NodeManager} ) + $functionsToDefine.Add('Set-NodeResourceSource', ${function:Set-NodeResourceSource} ) + $functionsToDefine.Add('Test-NodeResourceSource', ${function:Test-NodeResourceSource} ) + $functionsToDefine.Add('Set-NodeExclusiveResources', ${function:Set-NodeExclusiveResources} ) + $functionsToDefine.Add('Add-NodeKeys', ${function:Add-NodeKeys} ) + $functionsToDefine.Add('Test-ConflictingResources', ${function:Test-ConflictingResources} ) + $functionsToDefine.Add('Set-PSMetaConfigDocInsProcessedBeforeMeta', ${function:Set-PSMetaConfigDocInsProcessedBeforeMeta} ) + $functionsToDefine.Add('Get-PSMetaConfigDocumentInstVersionInfo', ${function:Get-PSMetaConfigDocumentInstVersionInfo} ) + $functionsToDefine.Add('Get-PSMetaConfigurationProcessed', ${function:Get-PSMetaConfigurationProcessed} ) + $functionsToDefine.Add('Set-PSMetaConfigVersionInfoV2', ${function:Set-PSMetaConfigVersionInfoV2}) + + # + # Add the node keyword implementation function which must be module qualified even though + # it's not exported from the module because the parsing logic always adds the module name + # to the command call. + # + $functionsToDefine.Add('PSDesiredStateConfiguration\node', ${function:Node}) + + Write-Debug -Message " $Name : $($functionsToDefine.Count) type handler functions loaded." + Write-Debug -Message " $Name TOP-LEVEL INITIALIZATION COMPLETED" + } + else + { + Write-Debug -Message " $Name : NESTED CONFIGURATION STARTED" + $oldFunctionsToDefine = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,ScriptBlock]' + } + + # + # Load all of the required resource definition modules + # + + foreach ($tuple in $ResourceModuleTuplesToImport) + { + $res = $tuple.Item1 + $modulesInfo = ConvertModuleDefnitionToModuleInfo -moduleToImport $tuple.Item2 -moduleVersion $tuple.Item3 + + if ($modulesInfo.Count -eq 0) { + # Module name is not specified. Try to load resource from all available modules. + $modulesInfo = Get-Module -ListAvailable + } + + foreach ($mod in $modulesInfo) { + + $resourcesFound = ImportClassResourcesFromModule -Module $mod -Resources $res -functionsToDefine $functionsToDefine + $dscResourcesPath = Join-Path -Path $mod.ModuleBase -ChildPath 'DSCResources' + if(Test-Path $dscResourcesPath) + { + foreach($requiredResource in $res) + { + if ($requiredResource.Contains('*')) { + # we historically resolve wildcards by Get-Item File System rules. + # We don't support wildcards resolutions for Friendly names. + foreach ($resource in Get-ChildItem -Path $dscResourcesPath -Directory -Name -Filter $requiredResource) + { + $foundResource = ImportCimAndScriptKeywordsFromModule -Module $mod -Resource $resource -functionsToDefine $functionsToDefine + } + } else { + # ImportCimAndScriptKeywordsFromModule takes care about resolving $requiredResources names to ClassNames or FriendlyNames. + $foundResource = ImportCimAndScriptKeywordsFromModule -Module $mod -Resource $requiredResource -functionsToDefine $functionsToDefine + } + } + } + elseif ($moduleInfos.Count -eq 1) + { + $modules.Add($moduleInfos) + } + } + } + + if (-not (Get-PSCurrentConfigurationNode)) + { + # A dictionary maps a resourceId to its list of required resources list for any resources + # defined outside of a node statement + $Script:NodeResources = $Script:NoNameNodesResources + $Script:NodeKeys = $Script:NoNameNodeKeys + [System.Collections.Generic.Dictionary[string,string[]]] $OldNodeResources = + New-Object -TypeName 'System.Collections.Generic.Dictionary[string,[string[]]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + $Script:NodeManager = $Script:NoNameNodeManager + $Script:NodeExclusiveResources = $Script:NoNameNodeExclusiveResources + $Script:NodeResourceSource = $Script:NoNameNodeResourceSource + + } + else + { + $Script:NodeResources = $Script:NodesInThisConfiguration[(Get-PSCurrentConfigurationNode)] + $Script:NodeManager = $Script:NodesManagerInThisConfiguration[(Get-PSCurrentConfigurationNode)] + $Script:NodeResourceSource = $Script:NodesResourceSourceInThisConfiguration[(Get-PSCurrentConfigurationNode)] + $Script:NodeExclusiveResources = $Script:NodesExclusiveResourcesInThisConfiguration[(Get-PSCurrentConfigurationNode)] + } + + # + # Evaluate the configuration statement body which will generate the resource definitons + # for this configuration. + # + Write-Debug -Message " $Name : Evaluating configuration statement body..." + try + { + $variablesToDefine = @( + # + # Figure out the "type" of this resource, with is the name of the driver function that was called. + # + New-Object -TypeName PSVariable -ArgumentList ('ConfigurationData', $script:ConfigurationData ) + New-Object -TypeName PSVariable -ArgumentList ('MyTypeName', $ExecutionContext.SessionState.Module.GetVariableFromCallersModule('MyInvocation').Value.MyCommand.Name) + New-Object -TypeName PSVariable -ArgumentList ('IsMetaConfig', $script:IsMetaConfig) + New-Object -TypeName PSVariable -ArgumentList ('V1MetaConfigPropertyList', $script:V1MetaConfigPropertyList) + if($script:ConfigurationData) + { + New-Object -TypeName PSVariable -ArgumentList ('AllNodes', $script:ConfigurationData.AllNodes) + } + ) + + $variablesToDefine += foreach ($key in $ArgsToBody.Keys) + { + # + # we need to process dependsOn seperately to + # 1. combined depends on with possible upper level configuration statement (composite resource case + # 2. in case of 1, we also need to fix up the dependson to append the suffix of ::$complexResourceQualifier similar in func:Test-DependsOn in CimDSCParser + # + # we need to process PsDscRunAsCredential seperately as well + # because it will be set recursively to all composite resources + if(($key -ne 'DependsOn') -and ($key -ne 'PsDscRunAsCredential')) + { + New-Object -TypeName PSVariable -ArgumentList ($key, $ArgsToBody[$key]) + } + } + + if($DependsOn -or $ArgsToBody['DependsOn']) + { + $complexResourceQualifier = Get-ComplexResourceQualifier + if($complexResourceQualifier) + { + $updatedDependsOn = foreach($DependsOnVar in @($ArgsToBody['DependsOn'])) + { + if($DependsOnVar) + { + "$DependsOnVar::$complexResourceQualifier" + } + } + $DependsOn = @($DependsOn) + @($updatedDependsOn) + } + else + { + $DependsOn = @($DependsOn) + @($ArgsToBody['DependsOn']) + } + + $variablesToDefine += New-Object -TypeName PSVariable -ArgumentList('DependsOn', $DependsOn) + } + + # If PsDscRunAsCredential is specified both in Outer configuration and inner composite resource we give error when merging PsDscRunAsCredential + if($PsDscRunAsCredential -and $ArgsToBody['PsDscRunAsCredential']) + { + Update-ConfigurationErrorCount + Write-Error -ErrorRecord ([Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::PsDscRunAsCredentialMergeErrorForCompositeResources($InstanceName)) + } + + # If PsDscRunAsCredential is specified in Configuration Argment or in outer configuration as $PsDscRunAsCredential + # set it as a varaible for current configurtaion. + if($PsDscRunAsCredential -or $ArgsToBody['PsDscRunAsCredential']) + { + if($ArgsToBody['PsDscRunAsCredential']) + { + $PsDscRunAsCredential = $ArgsToBody['PsDscRunAsCredential'] + } + $variablesToDefine += New-Object -TypeName PSVariable -ArgumentList('PsDscRunAsCredential', $PsDscRunAsCredential) + } + + $result = $Body.InvokeWithContext($functionsToDefine, $variablesToDefine) + } + catch [System.Management.Automation.MethodInvocationException] + { + Write-Debug -Message " $Name : Top level exception: $($_ | Out-String)" + # Write the unwrapped exception message + $pscmdlet.CommandRuntime.WriteError((Get-InnerMostErrorRecord $_)) + Update-ConfigurationErrorCount + } + + # + # write the generated files to disk and return the resulting files to stdout. + # + + if( $topLevel ) + { + if($Script:NoNameNodeInstanceAliases.Count -gt 0) + { + if ($Script:NodeInstanceAliases.ContainsKey('localhost')) + { + $errorMessage = $LocalizedData.LocalHostNodeNotAllowed -f "$Name" + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId LocalHostNodeNotAllowed + Update-ConfigurationErrorCount + } + + # + # Fixup DependsOn + # + ValidateNoNameNodeResources + Update-DependsOn $Script:NoNameNodesResources $Script:NoNameNodeInstanceAliases $Script:NoNameNodeResourceIdAliases + + + Write-Debug -Message " $Name : Evaluation completed, validating the generated resource set." + ValidateNodeResources + Write-Debug -Message " $Name Validation completed." + + # + # Fixup ModuleVersion + # + Update-ModuleVersion $Script:NoNameNodesResources $Script:NoNameNodeInstanceAliases $Script:NoNameNodeResourceIdAliases + + Write-Debug -Message " $Name : Evaluation completed, validating the generated resource set has no circle." + ValidateNoCircleInNodeResources + Write-Debug -Message " $Name Validation circle completed." + + if($script:IsMetaConfig) + { + # Validate make sure all of the referenced download managers are defined + Write-Debug -Message " $Name : Evaluation completed, validating the generated resource set reference download manager." + ValidateNodeManager + Write-Debug -Message " $Name Validation completed." + + # Validate make sure all of the referenced resource source are defined + Write-Debug -Message " $Name : Evaluation completed, validating the generated resource set reference resource source." + ValidateNodeResourceSource + Write-Debug -Message " $Name Validation completed." + + # Validate make sure new conflict between exclusive resources + Write-Debug -Message " $Name : Evaluation completed, validating no conflict between exclusive resources." + ValidateNodeExclusiveResources + Write-Debug -Message " $Name Validation completed." + + Write-MetaConfigFile $Name 'localhost' $Script:NoNameNodeInstanceAliases + } + else + { + Update-ConfigurationDocumentRef $Script:NoNameNodesResources $Script:NoNameNodeInstanceAliases $Script:NoNameNodeResourceIdAliases $Name + # + # Write the mof instance texts to files + # + Write-NodeMOFFile $Name 'localhost' $Script:NoNameNodeInstanceAliases + } + + # If no script-level $ConfigurationData variable is set, this code + # tries to get it first, from a global PowerShell ConfigurationData variable, + # then if that doesn't work it trys the environment + # variable $ENV:ConfigurationData when is expected to contain a JSON string + # that will be converted to objects. + # + if (-not $script:ConfigurationData) + { + $script:ConfigurationData = try + { + if ($global:ConfigurationData) + { + $global:ConfigurationData + } + elseif ($ENV:ConfigurationData) + { + $ENV:ConfigurationData | ConvertFrom-Json + } + else + { + @() + } + } + catch + { + Write-Error $_ + Update-ConfigurationErrorCount + @() + } + } + } + + if($script:ShowImportDscResourceWarning) + { + $message = $LocalizedData.ImportDscResourceWarningForInbuiltResource -f @(Get-PSTopConfigurationName) + $ImportDscResourceWarningPreference = $WarningPreference + if($ArgsToBody['WarningAction'] -ne $null) + { + $ImportDscResourceWarningPreference = $ArgsToBody['WarningAction'] + } + Write-Warning -Message $message -WarningAction $ImportDscResourceWarningPreference + } + + # + # write using the top-level hashtable + # + foreach($mofNode in $Script:NodeInstanceAliases.Keys) + { + # + # Fixup DependsOn + # + Update-DependsOn $Script:NodesInThisConfiguration[$mofNode] $Script:NodeInstanceAliases[$mofNode] $Script:NodeResourceIdAliases[$mofNode] + + if($script:IsMetaConfig) + { + Write-MetaConfigFile $Name $mofNode $Script:NodeInstanceAliases[$mofNode] + } + else + { + Update-ConfigurationDocumentRef $Script:NodesInThisConfiguration[$mofNode] $Script:NodeInstanceAliases[$mofNode] $Script:NodeResourceIdAliases[$mofNode] $Name + # + # Write the mof instance texts to files + # + Write-NodeMOFFile $Name $mofNode $Script:NodeInstanceAliases[$mofNode] + } + } + + if ($Script:PSConfigurationErrors -gt 0) + { + $errorMessage = $LocalizedData.FailToProcessConfiguration -f "$Name" + ThrowError -ExceptionName 'System.InvalidOperationException' -ExceptionMessage $errorMessage -ExceptionObject "$Name" -ErrorId 'FailToProcessConfiguration' -ErrorCategory InvalidOperation + } + } + } + finally + { + if($topLevel) + { + Write-Debug -Message " CONFIGURATION $Name : DOING TOP-LEVEL CLEAN UP" + [System.Management.Automation.Language.DynamicKeyword]::Reset() + [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ClearCache() + + Initialize-ConfigurationRuntimeState + } + Write-Debug -Message "END CONFIGURATION '$Name' PROCESSING. OutputPath: '$OutputPath'" + } +} +Export-ModuleMember -Function Configuration + +function Update-ModuleVersion +{ + [OutputType([void])] + param( + [Parameter(Mandatory)] + [System.Collections.Generic.Dictionary[String,String[]]] + $NodeResources, + + [Parameter(Mandatory)] + [System.Collections.Generic.Dictionary[string,string]] + $NodeInstanceAliases, + + [Parameter(Mandatory)] + [System.Collections.Generic.Dictionary[string,string]] + $NodeResourceIdAliases + ) + + $moduleVersionValue = '0.0' + + # explicit import-dscresource with version for psdesiredstateconfiguration module was not done. + if( $Script:ExplicitlyImportedModules.ContainsKey('PsDesiredStateConfiguration') -and + (-not [string]::IsNullOrEmpty($Script:ExplicitlyImportedModules['PsDesiredStateConfiguration']))) + { + $moduleVersionValue= $script:PsDscModuleVersion + } + # generating compatible document. + elseif($script:PsDscCompatibleVersion -eq '1.0.0') + { + $moduleVersionValue='1.0' + } + + # The logic is to insert correct moduleVersion for PsDesiredStateConfiguration module. In case of composite + # configuration,determination of what module version to use can happen later. Hence we update all objects + # after processing of every composite configuration to reflect upon with up to date information. + foreach($resourceId in $NodeResources.keys) + { + $alias = $NodeResourceIdAliases[$resourceId] + $instanceText = $NodeInstanceAliases[$alias] + $curlyPosition = $instanceText.LastIndexOf('}') + # check if the resource is from PsDesiredStateConfiguraiton Module. + if(($curlyPosition -gt 0) -and ($instanceText -imatch 'ModuleName[\s]*=[\s]*["]PsDesiredStateConfiguration["]')) + { + $moduleVersionstring = "ModuleVersion = " + $moduleVersionstring += "`"$moduleVersionValue`"" + ";" + + # if ModuleVersion field is not there + if($instanceText -inotmatch 'ModuleVersion[\s]*=') + { + $first = $instanceText.Substring(0, $curlyPosition) + $NodeInstanceAliases[$alias] = $first + $moduleVersionstring + "`r`n};" + } + else + { + #match pattern for eg: 'ModuleVersion = "1.0"' + $regexExpression = 'ModuleVersion[\s]*=[\s]*["][\d.]*["][\s]*;' + $NodeInstanceAliases[$alias] = $instanceText -replace $regexExpression, $moduleVersionstring + } + } + } +} + +function Update-DependsOn +{ + [OutputType([void])] + param( + [Parameter(Mandatory)] + [System.Collections.Generic.Dictionary[String,String[]]] + $NodeResources, + + [Parameter(Mandatory)] + [System.Collections.Generic.Dictionary[string,string]] + $NodeInstanceAliases, + + [Parameter(Mandatory)] + [System.Collections.Generic.Dictionary[string,string]] + $NodeResourceIdAliases + ) + + foreach($resourceId in $NodeResources.keys) + { + $alias = $NodeResourceIdAliases[$resourceId] + $needAdd = $false + $instanceText = $NodeInstanceAliases[$alias] + if($NodeResources[$resourceId]) + { + $curlyPosition = $instanceText.LastIndexOf('}') + if(($curlyPosition -gt 0) -and ($instanceText -notmatch 'dependsOn[\s]*=')) + { + $needAdd = $true + $first = $instanceText.Substring(0, $curlyPosition) + + $dependsOn = "DependsOn = {`r`n" + $len = @($NodeResources[$resourceId]).Length + $dependsOn += foreach ($resourceId in $NodeResources[$resourceId]) + { + ' ' + "`"$($resourceId -replace '\\', '\\' -replace '"', '\"')`"" + + $(if (--$len -gt 0) + { + ",`r`n" + } + else + { + '' + } + ) + } + $dependsOn += '};' + } + } + + if($needAdd) + { + $NodeInstanceAliases[$alias] = $first + $dependsOn + "`r`n};" + } + } +} + +# +# add a reference to each resource to point to the OMI_ConfigurationDocument +# so it can be differiencated after merging of partical configurations +# +function Update-ConfigurationDocumentRef +{ + [OutputType([void])] + param( + [Parameter(Mandatory)] + [System.Collections.Generic.Dictionary[String,String[]]] + $NodeResources, + + [Parameter(Mandatory)] + [System.Collections.Generic.Dictionary[string,string]] + $NodeInstanceAliases, + + [Parameter(Mandatory)] + [System.Collections.Generic.Dictionary[string,string]] + $NodeResourceIdAliases, + + [Parameter(Mandatory)] + [string] + $ConfigurationName + ) + + foreach($resourceId in $NodeResources.keys) + { + $alias = $NodeResourceIdAliases[$resourceId] + $instanceText = $NodeInstanceAliases[$alias] + $needAdd = $false + $curlyPosition = $instanceText.LastIndexOf('}') + if($curlyPosition -gt 0) + { + $needAdd = $true + $first = $instanceText.Substring(0, $curlyPosition).TrimEnd() + + $ConfigurationNameRef = "`r`n ConfigurationName = `"$ConfigurationName`";" + } + + if($needAdd) + { + $NodeInstanceAliases[$alias] = $first + $ConfigurationNameRef + "`r`n};" + } + } +} + +function ImportClassResourcesFromModule +{ + param ( + [Parameter(Mandatory)] + [PSModuleInfo] + $Module, + + [Parameter(Mandatory)] + [System.Collections.Generic.List[string]] + $Resources, + + [System.Collections.Generic.Dictionary[string, scriptblock]] + $functionsToDefine + ) + + $resourcesFound = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ImportClassResourcesFromModule($Module, $Resources, $functionsToDefine) + return ,$resourcesFound +} + +function ImportCimAndScriptKeywordsFromModule +{ + param ( + [Parameter(Mandatory)] + $Module, + + [Parameter(Mandatory)] + $resource, + + $functionsToDefine + ) + + trap + { + continue + } + + $SchemaFilePath = $null + $oldCount = $functionsToDefine.Count + + $keywordErrors = New-Object -TypeName 'System.Collections.ObjectModel.Collection[System.Exception]' + + $foundCimSchema = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ImportCimKeywordsFromModule( + $Module, $resource, [ref] $SchemaFilePath, $functionsToDefine, $keywordErrors) + + foreach($ex in $keywordErrors) + { + Write-Error -Exception $ex + if($ex.InnerException) + { + Write-Error -Exception $ex.InnerException + } + } + + $functionsAdded = $functionsToDefine.Count - $oldCount + Write-Debug -Message " $Name : PROCESSING RESOURCE FILE: Added $functionsAdded type handler functions from '$SchemaFilePath'" + + $SchemaFilePath = $null + $oldCount = $functionsToDefine.Count + + $foundScriptSchema = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ImportScriptKeywordsFromModule( + $Module, $resource, [ref] $SchemaFilePath, $functionsToDefine ) + + $functionsAdded = $functionsToDefine.Count - $oldCount + Write-Debug -Message " $Name : PROCESSING RESOURCE FILE: Added $functionsAdded type handler functions from '$SchemaFilePath'" + + if ($foundScriptSchema -and $SchemaFilePath) + { + $resourceDirectory = Split-Path $SchemaFilePath + if($resourceDirectory -ne $null) + { + Import-Module -Force: (Test-ModuleReloadRequired $SchemaFilePath) -Verbose:$false -Name $resourceDirectory -Global -ErrorAction SilentlyContinue + } + } + + return $foundCimSchema -or $foundScriptSchema +} + +# +# A function to write the MOF instance texts of a node to files as meta config +# +function Write-MetaConfigFile +{ + param( + [string] + $ConfigurationName, + + [string] + $mofNode, + + [System.Collections.Generic.Dictionary[string,string]] + $mofNodeHash + + ) + + # Set up prefix for both the configuration and metaconfiguration documents. + $nodeDoc = "/*`n@TargetNode='$mofNode'`n" + "@GeneratedBy=$([system.environment]::UserName)`n@GenerationDate=$(Get-Date)`n@GenerationHost=$([system.environment]::MachineName)`n*/`n" + $nodeConfigurationDocument = $null + [int]$nodeDocCount = 0 + $resourceManagers = $null + $resourceManagersCount = 0 + $reportManagers = $null + $reportManagersCount = 0 + $downloadManagers = $null + $downloadManagersCount = 0 + $localConfigManager = $null + $partialConfiguratons = $null + $partialConfigurationCount = 0 + $signatureValidationPolicies = $null + $signatureValidationCount = 0 + + foreach($mofTypeName in $mofNodeHash.Keys) + { + if($mofTypeName -match 'OMI_ConfigurationDocument') + { + $nodeConfigurationDocument = $mofNodeHash[$mofTypeName] + } + + if($mofTypeName -match 'MSFT_WebDownloadManager' -or $mofTypeName -match 'MSFT_FileDownloadManager') + { + $r = $mofNodeHash[$mofTypeName] -match '\$\w*' + if($r) + { + if($downloadManagersCount++ -gt 0) + { + $downloadManagers += ",`n" + } + $downloadManagers += ' ' + $Matches[0] + } + $script:SpecifiedV2DownloadManager = $true + } + + if($mofTypeName -match 'MSFT_WebResourceManager' -or $mofTypeName -match 'MSFT_FileResourceManager') + { + $r = $mofNodeHash[$mofTypeName] -match '\$\w*' + if($r) + { + if($resourceManagersCount++ -gt 0) + { + $resourceManagers += ",`n" + } + $resourceManagers += ' ' +$Matches[0] + } + } + + if($mofTypeName -match 'MSFT_OaaSReportManager' -or $mofTypeName -match 'MSFT_WebReportManager') + { + $r = $mofNodeHash[$mofTypeName] -match '\$\w*' + if($r) + { + if($reportManagersCount++ -gt 0) + { + $reportManagers += ",`n" + } + $reportManagers += ' ' +$Matches[0] + } + } + + #MSFT_PartialConfiguration + if($mofTypeName -match 'MSFT_PartialConfiguration') + { + $r = $mofNodeHash[$mofTypeName] -match '\$\w*' + if($r) + { + if($partialConfigurationCount++ -gt 0) + { + $partialConfiguratons += ",`n" + } + $partialConfiguratons += ' ' +$Matches[0] + } + } + + #MSFT_SignatureValidation + if($mofTypeName -match 'MSFT_SignatureValidation') + { + $r = $mofNodeHash[$mofTypeName] -match '\$\w*' + if($r) + { + if($signatureValidationCount++ -gt 0) + { + $signatureValidations += ",`n" + } + $signatureValidations += ' ' +$Matches[0] + } + } + + if($mofTypeName -notmatch 'MSFT_DSCMetaConfiguration') + { + $nodeDoc += $mofNodeHash[$mofTypeName] + } + else + { + if($localConfigManager -eq $null) + { + # save the localConfigManager which need to be fixed up to add additional manager info as embedded resources + $localConfigManager = $mofNodeHash[$mofTypeName] -replace 'MSFT_DSCMetaConfigurationV2', 'MSFT_DSCMetaConfiguration' + } + else + { + $errorMessage = $LocalizedData.MetaConfigurationHasMoreThanOneLocalConfigurationManager -f @($mofNode) + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId InvalidMOFDefinition + Update-ConfigurationErrorCount + return + } + } + + $nodeDocCount++ + } + + if ($script:MetaConfigSetToPull -and (-not $script:SpecifiedV2DownloadManager)) + { + $errorMessage = $LocalizedData.PullModeWithoutConfigurationRepository + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId PullModeWithoutConfigurationRepository + Update-ConfigurationErrorCount + } + + if ($script:SpecifiedV2DownloadManager -and (-not $script:MetaConfigSetToPull)) + { + Write-Warning -Message $LocalizedData.ConfigurationRepositoryWithoutPullMode + } + + if($localConfigManager -eq $null) + { + # Print verbose message that empty settings definition is added. + $emptySettingVerboseMessage = $LocalizedData.MetaConfigurationSettingsMissing -f @($mofNode) + Write-Verbose -Message $emptySettingVerboseMessage + + # Assign default settings + $localConfigManager = "`ninstance of MSFT_DSCMetaConfiguration as `$MSFT_DSCMetaConfiguration1ref `n{`n};" + } + + # fixup to add embedded instances + $nodeDoc += Update-LocalConfigManager $localConfigManager $resourceManagers $reportManagers $downloadManagers $partialConfiguratons $signatureValidations + + + $nodeOutfile = "$ConfigurationOutputDirectory/$($mofNode).meta.mof" + + # add/update OMI_ConfigurationDocument of meta config + if ($nodeDoc -notmatch 'OMI_ConfigurationDocument') + { + if (Get-PSDefaultConfigurationDocument) + { + Write-Debug -Message " ${ConfigurationName}: Adding OMI_ConfigurationDocument from $(Get-PSDefaultConfigurationDocument)" + $nodeDoc += Get-PSDefaultConfigurationDocument + } + else + { + Write-Debug -Message " ${ConfigurationName}: Adding missing OMI_ConfigurationDocument element to the document" + if($Script:NodesPasswordEncrypted[$mofNode]) + { + $nodeDoc += "`ninstance of OMI_ConfigurationDocument`n{`n Version=`"2.0.0`";`n MinimumCompatibleVersion = `"$($script:PSMetaConfigDocumentInstVersionInfo['MinimumCompatibleVersion'])`";`n CompatibleVersionAdditionalProperties= $(Get-CompatibleVersionAddtionaPropertiesStr);`n Author=`"$([system.environment]::UserName)`";`n GenerationDate=`"$(Get-Date)`";`n GenerationHost=`"$([system.environment]::MachineName)`";`n ContentType=`"PasswordEncrypted`";`n Name=`"$(Get-PSTopConfigurationName)`";`n};" + } + else + { + $nodeDoc += "`ninstance of OMI_ConfigurationDocument`n{`n Version=`"2.0.0`";`n MinimumCompatibleVersion = `"$($script:PSMetaConfigDocumentInstVersionInfo['MinimumCompatibleVersion'])`";`n CompatibleVersionAdditionalProperties= $(Get-CompatibleVersionAddtionaPropertiesStr);`n Author=`"$([system.environment]::UserName)`";`n GenerationDate=`"$(Get-Date)`";`n GenerationHost=`"$([system.environment]::MachineName)`";`n Name=`"$(Get-PSTopConfigurationName)`";`n};" + } + } + } + + # Fix up newlines to be CRLF + $nodeDoc = $nodeDoc -replace "`n", "`r`n" + + # todo: meta configuration might not be verifiable currently + $errMsg = Test-MofInstanceText $nodeDoc + if($errMsg) + { + $errorMessage = $LocalizedData.InvalidMOFDefinition -f @($mofNode, $errMsg) + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId InvalidMOFDefinition + Update-ConfigurationErrorCount + $nodeOutfile = "$ConfigurationOutputDirectory/$($mofNode).meta.mof.error" + } + + if($nodeDocCount -gt 0) + { + # Write to a file only if no error was generated or we are writing to .mof.error file + if ($Script:PSConfigurationErrors -eq 0 -or $nodeOutfile.EndsWith('mof.error')) + { + $nodeDoc > $nodeOutfile + Get-ChildItem $nodeOutfile + } + } +} + +# fixup localConfigmanager to have embedded instance +function Update-LocalConfigManager +{ + param( + [string] + $localConfigManager, + [string] + $resourceManagers, + [string] + $reportManagers, + [string] + $downloadManagers, + [string] + $partialConfigurations, + [string] + $signatureValidations + ) + + $curlyPostion = $localConfigManager.LastIndexOf('}') + if($curlyPostion -gt 0) + { + $first = $localConfigManager.Substring(0, $curlyPostion) + if($resourceManagers) + { + $first += " ResourceModuleManagers = {`n" + $resourceManagers + " `n };`n" + } + + if($reportManagers) + { + $first += " ReportManagers = {`n" + $reportManagers + " `n };`n" + } + + if($downloadManagers) + { + $first += " ConfigurationDownloadManagers = {`n" + $downloadManagers + " `n };`n" + } + + #PartialConfigurations + if($partialConfigurations) + { + $first += " PartialConfigurations = {`n" + $partialConfigurations + " `n };`n" + } + if($signatureValidations) + { + $first += " SignatureValidations = {`n" + $signatureValidations + " `n };`n" + } + + $first += "};`n" + + $first + } +} + +function Get-MofInstanceName +{ + param( + [string] + $mofInstance + ) +} +# +# A function to write the MOF instance texts of a node to files +# +function Write-NodeMOFFile +{ + param( + [string] + $ConfigurationName, + + [string] + $mofNode, + + [System.Collections.Generic.Dictionary[string,string]] + $mofNodeHash + ) + + if ($script:MetaConfigSetToPull -and (-not $script:SpecifiedV1DownloadManagerName)) + { + $errorMessage = $LocalizedData.PullModeWithoutDownloadManager + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId PullModeWithoutDownloadManager + Update-ConfigurationErrorCount + } + + if ($script:SpecifiedV1DownloadManagerName -and (-not $script:MetaConfigSetToPull)) + { + Write-Warning -Message $LocalizedData.DownloadManagerWithoutPullMode + } + + # Set up prefix for both the configuration and metaconfiguration documents. + $nodeDoc = "/*`n@TargetNode='$mofNode'`n" + "@GeneratedBy=$([system.environment]::UserName)`n@GenerationDate=$(Get-Date)`n@GenerationHost=$([system.environment]::MachineName)`n*/`n" + $nodeMetaDoc = $nodeDoc + $nodeConfigurationDocument = $null + [int]$metaDocCount = 0 + [int]$nodeDocCount = 0 + + foreach($mofTypeName in $mofNodeHash.Keys) + { + if($mofTypeName -match 'MSFT_DSCMetaConfiguration') + { + $tempMetaDoc = $mofNodeHash[$mofTypeName] + $metaDocCount++ + break + } + } + + foreach($mofTypeName in $mofNodeHash.Keys) + { + if(($mofTypeName -notmatch 'MSFT_DSCMetaConfiguration')) + { + if(($metaDocCount -gt 0) -and ($tempMetaDoc -match [regex]::Escape($mofTypeName))) + { + $nodeMetaDoc += $mofNodeHash[$mofTypeName] + } + else + { + if($mofTypeName -match 'OMI_ConfigurationDocument') + { + $nodeConfigurationDocument = $mofNodeHash[$mofTypeName] + } + $nodeDoc += $mofNodeHash[$mofTypeName] + $nodeDocCount++ + } + } + } + + $nodeMetaDoc += $tempMetaDoc + + $nodeOutfile = "$ConfigurationOutputDirectory/$($mofNode).mof" + if($metaDocCount -gt 0) + { + $nodeMetaOutfile = "$ConfigurationOutputDirectory/$($mofNode).meta.mof" + # this meta config uses v1 schema so will not have v2 properties + if ($nodeConfigurationDocument) + { + Write-Debug -Message " ${ConfigurationName}: Adding OMI_ConfigurationDocument from the current node '$mofNode': $nodeConfigurationDocument" + $nodeMetaDoc += $nodeConfigurationDocument + } + elseif (Get-PSDefaultConfigurationDocument) + { + Write-Debug -Message " ${ConfigurationName}: Adding OMI_ConfigurationDocument from $(Get-PSDefaultConfigurationDocument)" + $nodeMetaDoc += Get-PSDefaultConfigurationDocument + } + else + { + Write-Debug -Message " ${ConfigurationName}: Adding missing OMI_ConfigurationDocument element to the document" + if($Script:NodesPasswordEncrypted[$mofNode]) + { + $nodeMetaDoc += "`ninstance of OMI_ConfigurationDocument`n{`n Version=`"2.0.0`";`n MinimumCompatibleVersion = `"1.0.0`";`n CompatibleVersionAdditionalProperties= $(Get-CompatibleVersionAddtionaPropertiesStr);`n Author=`"$([system.environment]::UserName)`";`n GenerationDate=`"$(Get-Date)`";`n GenerationHost=`"$([system.environment]::MachineName)`";`n ContentType=`"PasswordEncrypted`";`n Name=`"$(Get-PSTopConfigurationName)`";`n};" + } + else + { + $nodeMetaDoc += "`ninstance of OMI_ConfigurationDocument`n{`n Version=`"2.0.0`";`n MinimumCompatibleVersion = `"1.0.0`";`n CompatibleVersionAdditionalProperties= $(Get-CompatibleVersionAddtionaPropertiesStr);`n Author=`"$([system.environment]::UserName)`";`n GenerationDate=`"$(Get-Date)`";`n GenerationHost=`"$([system.environment]::MachineName)`";`n Name=`"$(Get-PSTopConfigurationName)`";`n};" + } + } + } + + if ($nodeDoc -notmatch 'OMI_ConfigurationDocument') + { + if (Get-PSDefaultConfigurationDocument) + { + Write-Debug -Message " ${ConfigurationName}: Adding OMI_ConfigurationDocument from $(Get-PSDefaultConfigurationDocument)" + $nodeDoc += Get-PSDefaultConfigurationDocument + } + else + { + Write-Debug -Message " ${ConfigurationName}: Adding missing OMI_ConfigurationDocument element to the document" + if($Script:NodesPasswordEncrypted[$mofNode]) + { + if($nodeDoc.Contains("PsDscRunAsCredential")) + { + $nodeDoc += "`ninstance of OMI_ConfigurationDocument`n + {`n Version=`"2.0.0`";`n + MinimumCompatibleVersion = `"2.0.0`";`n + CompatibleVersionAdditionalProperties= {`"Omi_BaseResource:ConfigurationName`"};`n + Author=`"$([system.environment]::UserName)`";`n + GenerationDate=`"$(Get-Date)`";`n + GenerationHost=`"$([system.environment]::MachineName)`";`n + ContentType=`"PasswordEncrypted`";`n + Name=`"$(Get-PSTopConfigurationName)`";`n + };" + } + else + { + $nodeDoc += "`ninstance of OMI_ConfigurationDocument`n + {`n Version=`"2.0.0`";`n + MinimumCompatibleVersion = `"1.0.0`";`n + CompatibleVersionAdditionalProperties= {`"Omi_BaseResource:ConfigurationName`"};`n + Author=`"$([system.environment]::UserName)`";`n + GenerationDate=`"$(Get-Date)`";`n + GenerationHost=`"$([system.environment]::MachineName)`";`n + ContentType=`"PasswordEncrypted`";`n + Name=`"$(Get-PSTopConfigurationName)`";`n + };" + } + } + else + { + if($nodeDoc.Contains("PsDscRunAsCredential")) + { + $nodeDoc += "`ninstance of OMI_ConfigurationDocument`n + {`n Version=`"2.0.0`";`n + MinimumCompatibleVersion = `"2.0.0`";`n + CompatibleVersionAdditionalProperties= {`"Omi_BaseResource:ConfigurationName`"};`n + Author=`"$([system.environment]::UserName)`";`n + GenerationDate=`"$(Get-Date)`";`n + GenerationHost=`"$([system.environment]::MachineName)`";`n + Name=`"$(Get-PSTopConfigurationName)`";`n + };" + } + else + { + $nodeDoc += "`ninstance of OMI_ConfigurationDocument`n + {`n Version=`"2.0.0`";`n + MinimumCompatibleVersion = `"1.0.0`";`n + CompatibleVersionAdditionalProperties= {`"Omi_BaseResource:ConfigurationName`"};`n + Author=`"$([system.environment]::UserName)`";`n + GenerationDate=`"$(Get-Date)`";`n + GenerationHost=`"$([system.environment]::MachineName)`";`n + Name=`"$(Get-PSTopConfigurationName)`";`n + };" + } + } + } + } + # Fix up newlines to be CRLF + $nodeDoc = $nodeDoc -replace "`n", "`r`n" + + $errMsg = Test-MofInstanceText $nodeDoc + if($errMsg) + { + $errorMessage = $LocalizedData.InvalidMOFDefinition -f @($mofNode, $errMsg) + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId InvalidMOFDefinition + Update-ConfigurationErrorCount + $nodeOutfile = "$ConfigurationOutputDirectory/$($mofNode).mof.error" + } + + if($nodeDocCount -gt 0) + { + # Write to a file only if no error was generated or we are writing to .mof.error file + if ($Script:PSConfigurationErrors -eq 0 -or $nodeOutfile.EndsWith('mof.error')) + { + $nodeDoc > $nodeOutfile + Get-ChildItem $nodeOutfile + } + } + + if($nodeMetaDoc -match 'MSFT_DSCMetaConfiguration' -and $Script:PSConfigurationErrors -eq 0) + { + $nodeMetaDoc = $nodeMetaDoc -replace "`n", "`r`n" + $nodeMetaDoc > $nodeMetaOutfile + Get-ChildItem $nodeMetaOutfile + } +} + +# +# A function to make sure that only valid resources are referenced within a node. It +# operates off of the $Script:NodeResources dictionary. An empty dictionary is not +# considered an error since this function is called at both the node level and the configuration +# level. +# This function also expand the dependsOn to composite resources +# +function ValidateNodeResources +{ + Write-Debug -Message " Validating resource set for node: $(Get-PSCurrentConfigurationNode)" + $newNodeResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,[string[]]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + if ($Script:NodeResources) + { + foreach ($resourceId in $Script:NodeResources.Keys) + { + Write-Debug -Message " Checking node $resourceId" + $newDependsOn = foreach ($requiredResource in $Script:NodeResources[$resourceId]) + { + # Skip resources that have no DependsOn. + if ($requiredResource) + { + Write-Debug -Message " > Checking for required node $requiredResource" + + if (-not $Script:NodeResources.ContainsKey($requiredResource)) + { + Write-Debug -Message " > trying expand for required node $requiredResource" + $expandedDependsOn = foreach($rId in $Script:NodeResources.keys) + { + if($rId.EndsWith($requiredResource, [System.StringComparison]::InvariantCultureIgnoreCase)) + { + $rId + } + } + + + if(-not $expandedDependsOn) + { + $errorMessage = $LocalizedData.RequiredResourceNotFound -f @($requiredResource, $resourceId) + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId RequiredResourceNotFound + Update-ConfigurationErrorCount + } + else + { + $expandedDependsOn + } + } + else + { + $requiredResource + } + } + } + + if($newDependsOn) + { + $newNodeResources[$resourceId] = $newDependsOn + } + } + + if($newNodeResources) + { + foreach($id in $newNodeResources.keys) + { + $Script:NodeResources[$id] = $newNodeResources[$id] + } + } + } + Write-Debug -Message " Validation complete for node: $(Get-PSCurrentConfigurationNode)" +} + +# +# A function to make sure that only valid resources are referenced within the resource without node. +# This function also expand the dependsOn to composite resources +# +function ValidateNoNameNodeResources +{ + Write-Debug -Message ' Validating resource set for resources in the default configuration' + $newNodeResources = New-Object -TypeName 'System.Collections.Generic.Dictionary[string,[string[]]]' -ArgumentList ([System.StringComparer]::OrdinalIgnoreCase) + if ($Script:NoNameNodesResources) + { + foreach ($resourceId in $Script:NoNameNodesResources.Keys) + { + Write-Debug -Message " Checking node $resourceId" + $newDependsOn = foreach ($requiredResource in $Script:NoNameNodesResources[$resourceId]) + { + # Skip resources that have no DependsOn. + if ($requiredResource) + { + Write-Debug -Message " > Checking for required node $requiredResource" + + if (-not $Script:NoNameNodesResources.ContainsKey($requiredResource)) + { + Write-Debug -Message " > trying expand for required node $requiredResource" + $expandedDependsOn = foreach($rId in $Script:NoNameNodesResources.keys) + { + if($rId.EndsWith($requiredResource, [System.StringComparison]::InvariantCultureIgnoreCase)) + { + $rId + } + } + + if(-not $expandedDependsOn) + { + # When Node name is not specified in the configuration, $NoNameNodesResources & $NodeResources list are same. + # Do not throw error here to avoid duplicate errors, these errors will be throw by ‘ValidateNodeResources’ when $NodeResources list will be validated. + if(-not $Script:NodeResources.ContainsKey($resourceId)) + { + $errorMessage = $LocalizedData.RequiredResourceNotFound -f @($requiredResource, $resourceId) + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId RequiredResourceNotFound + Update-ConfigurationErrorCount + } + } + else + { + $expandedDependsOn + } + } + else + { + $requiredResource + } + } + } + + if($newDependsOn) + { + $newNodeResources[$resourceId] = $newDependsOn + } + } + + if($newNodeResources) + { + foreach($id in $newNodeResources.keys) + { + $Script:NoNameNodesResources[$id] = $newNodeResources[$id] + } + } + } + Write-Debug -Message ' Validation complete for default resources.' +} + +# +# A function to make sure that only valid Manager are referenced within a node. It +# operates off of the $Script:NodeManager dictionary. +# An empty dictionary is not +# considered an error since this function is called at both the node level and the configuration +# level. +# +function ValidateNodeManager +{ + Write-Debug -Message " Validating manager set for node: $(Get-PSCurrentConfigurationNode)" + if ($Script:NodeManager) + { + foreach ($resourceId in $Script:NodeManager.Keys) + { + Write-Debug -Message " Checking node $resourceId" + $refManagers = $Script:NodeManager[$resourceId] + # Skip partial configuration that have no Manager. + if ($refManagers) + { + Write-Debug -Message " > Checking for required manager $refManagers" + + foreach ($refManager in $refManagers) + { + if (-not $Script:NodeResources.ContainsKey($refManager)) + { + $errorMessage = $LocalizedData.ReferencedManagerNotFound -f @($refManager, $resourceId) + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ReferencedManagerNotFound + Update-ConfigurationErrorCount + } + } + } + } + } + + if ($IsMetaConfig) + { + #region Reference check for SignatureValidationPolicy + $referencedSignaturePolicy = $null; + $nodeAliases = @{} + + if ($NoNameNodeInstanceAliases.Count -ne 0) + { + $nodeAliases = $NoNameNodeInstanceAliases + } + else + { + $nodeAliases = $NodeInstanceAliases[$Node] + } + $metaConfigReferenceId = $nodeAliases.Keys | Where-Object -FilterScript {$_ -like '$MSFT_DSCMetaConfiguration*'} + # If there is no setting block defined. + if(!$metaConfigReferenceId) {return} + $v2MetaConfigReference = $nodeAliases.Item($metaConfigReferenceId) + + # Check if user specified the signature policy in the setting block. + $signatrueValidationIsSpecified = $v2MetaConfigReference -match 'SignatureValidationPolicy[ ]*=' + if ($signatrueValidationIsSpecified) + { + $referencedSignaturePolicyMatches = $v2MetaConfigReference -match '\[SignatureValidation\][^"]+' + if ($referencedSignaturePolicyMatches) + { + $referencedSignaturePolicy = $Matches[0] + } + else + { + $errorMessage = $LocalizedData.IncorrectSignatureValidationPolicyFormat + $exception = New-Object -TypeName System.ArgumentException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidArgument -ErrorId IncorrectSignatureValidationPolicyFormat + Update-ConfigurationErrorCount + } + + # If there is a referenced policy ensure that its value matches one of the defined signature validation resources. + if ($referencedSignaturePolicy) + { + if (-not $Script:NodeResources.ContainsKey($referencedSignaturePolicy)) + { + $errorMessage = $LocalizedData.ReferencedPolicyNotDefined -f @($referencedSignaturePolicy) + $exception = New-Object -TypeName System.ArgumentException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidArgument -ErrorId ReferencedPolicyNotDefined + Update-ConfigurationErrorCount + } + } + } + } + #endregion + + Write-Debug -Message " Validation complete for node: $(Get-PSCurrentConfigurationNode)" +} + +# +# A function to make sure that only valid resource source are referenced within a node. It +# operates off of the $Script:NodeResourceSource dictionary. +# An empty dictionary is not +# considered an error since this function is called at both the node level and the configuration +# level. +# +function ValidateNodeResourceSource +{ + Write-Debug -Message " Validating resource source set for node: $(Get-PSCurrentConfigurationNode)" + if ($Script:NodeResourceSource) + { + foreach ($resourceId in $Script:NodeResourceSource.Keys) + { + Write-Debug -Message " Checking node $resourceId" + $refResourceSources = $Script:NodeResourceSource[$resourceId] + # Skip partial configuration that have no Manager. + if ($refResourceSources) + { + Write-Debug -Message " > Checking for required manager $refManagers" + + foreach ($refResourceSource in $refResourceSources) + { + if (-not $Script:NodeResources.ContainsKey($refResourceSource)) + { + $errorMessage = $LocalizedData.ReferencedResourceSourceNotFound -f @($refResourceSource, $resourceId) + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ReferencedResourceSourceNotFound + Update-ConfigurationErrorCount + } + } + } + } + } + Write-Debug -Message " Validation complete for node: $(Get-PSCurrentConfigurationNode)" +} + +# +# A function to make sure that exclusive resources among partial configurations do not conflict with each other +# it is already of format modulename\resourcName or modulename\* or resourceName +# It also validate they exist +function ValidateNodeExclusiveResources +{ + Write-Debug -Message " Validating exclusive resources for node: $(Get-PSCurrentConfigurationNode)" + if ($Script:NodeExclusiveResources) + { + # map will be of format {moduleName, {Id=ResourceId; ContainsAll = $true/$false; Resources=@('r1','r2'...)}} + $ModuleBasedExclusiveResourceMap = @{} + # map for resource that doesn't have module + $NoModuleExclusiveResourceMap = @{} + + foreach ($resourceId in $Script:NodeExclusiveResources.Keys) + { + Write-Debug -Message " Checking node $resourceId" + + # Remove duplicate entries from exclusive Resource array + $exclusiveResourceList = $Script:NodeExclusiveResources[$resourceId] | select -uniq + + foreach($refResource in $exclusiveResourceList) + { + $resourceSegs = $refResource -split '\\' + + if($resourceSegs.Length -eq 2) + { + if($ModuleBasedExclusiveResourceMap[$resourceSegs[0]] -eq $null) + { + $ModuleBasedExclusiveResourceMap[$resourceSegs[0]] = @{ + Id = $resourceId + } + if($resourceSegs[1] -eq '*') + { + $ModuleBasedExclusiveResourceMap[$resourceSegs[0]]['ContainsAll'] = $true + } + else + { + $ModuleBasedExclusiveResourceMap[$resourceSegs[0]]['ContainsAll'] = $false + $ModuleBasedExclusiveResourceMap[$resourceSegs[0]]['Resources'] = @($resourceSegs[1]) + } + } + else + { + # 'Module\Resource' in PartialConfiguration1 conflicts with 'Module\*' in PartialConfiguration2 + # or 'Module\*' in PartialConfiguration1 conflicts with 'Module\Resource' in PartialConfiguration2 + if(($resourceSegs[1] -eq '*') -or $ModuleBasedExclusiveResourceMap[$resourceSegs[0]]['ContainsAll']) + { + $errorMessage = $LocalizedData.ConflictInExclusiveResources -f @($ModuleBasedExclusiveResourceMap[$resourceSegs[0]]['Id'], $resourceId) + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ConflictInExclusiveResources + Update-ConfigurationErrorCount + break + } + # 'Module\Resource' in PartialConfiguration1 conflicts with 'Module\Resource' in PartialConfiguration2 + # or 'Module\Resource' in PartialConfiguration1 conflicts with 'Resource' in PartialConfiguration2 + elseif($ModuleBasedExclusiveResourceMap[$resourceSegs[0]]['Resources'] -icontains $resourceSegs[1] ` + -or $NoModuleExclusiveResourceMap[$resourceSegs[1]] -ne $null) + { + $errorMessage = $LocalizedData.ConflictInExclusiveResources -f @($ModuleBasedExclusiveResourceMap[$resourceSegs[0]]['Id'], $resourceId) + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ConflictInExclusiveResources + Update-ConfigurationErrorCount + break + } + else + { + $ModuleBasedExclusiveResourceMap[$resourceSegs[0]]['Resources'] += @($resourceSegs[1]) + } + } + } + else # no module name, normally means binary resource + { + if($NoModuleExclusiveResourceMap[$refResource] -eq $null) + { + $resourceFound = $false + $ModuleBasedExclusiveResourceMap.GetEnumerator() | % { + if($_.Value.Resources -icontains $refResource) { + $resourceFound = $true + $ConflictingPartialConfigurationId = $_.Value.Id + } + } + + # 'Resource' in PartialConfiguration1 conflicts with 'Module\Resource' in PartialConfiguration2 + if($resourceFound){ + $errorMessage = $LocalizedData.ConflictInExclusiveResources -f @($ConflictingPartialConfigurationId, $resourceId) + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ConflictInExclusiveResources + Update-ConfigurationErrorCount + break + } + + $NoModuleExclusiveResourceMap[$refResource] = @{ + Id = $resourceId + } + } + # 'Resource' in PartialConfiguration1 conflicts with 'Resource' in PartialConfiguration2 + else + { + $errorMessage = $LocalizedData.ConflictInExclusiveResources -f @($NoModuleExclusiveResourceMap[$refResource]['Id'], $resourceId) + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId ConflictInExclusiveResources + Update-ConfigurationErrorCount + break + } + } + } + } + } + Write-Debug -Message " Validation complete for node: $(Get-PSCurrentConfigurationNode)" +} + +# +# A function to make sure that only valid resources are referenced within a node. It +# operates off of the $Script:NodeResources dictionary. An empty dictionary is not +# considered an error since this function is called at both the node level and the configuration +# level. +# it uses Tarjan strongly connected component algorithms +# +function ValidateNoCircleInNodeResources +{ + Write-Debug -Message " Validating resource set for node: $(Get-PSCurrentConfigurationNode)" + [int] $script:CircleIndex = 0 + [System.Collections.Generic.Stack[string]] $script:resourceIdStack = + New-Object -TypeName 'System.Collections.Generic.Stack[string]' + [hashtable] $script:resourceIndex = @{} + [hashtable] $script:resourceLowIndex = @{} + [int] $script:ComponentDepth = 0 + [int] $script:MaxComponentDepth = 1024 + + if ($Script:NodeResources) + { + foreach ($resourceId in $Script:NodeResources.Keys) + { + if(($Script:NodeResources[$resourceId] -ne $null) -and $Script:NodeResources[$resourceId].Contains($resourceId)) + { + $errorMessage = $LocalizedData.DependsOnLoopDetected -f "$resourceId->$resourceId" + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId DependsOnLoopDetected + Update-ConfigurationErrorCount + } + + if($resourceIndex[$resourceId] -eq $null) + { + $script:ComponentDepth = 0 + StrongConnect($resourceId) + } + } + } + Write-Debug -Message " Validation circular reference completed for node: $(Get-PSCurrentConfigurationNode)" +} + +function StrongConnect +{ + param ([string]$resourceId) + + $script:resourceIndex[$resourceId] = $script:CircleIndex + $script:resourceLowIndex[$resourceId] = $script:CircleIndex + $script:CircleIndex++ + $script:ComponentDepth++ + if($script:ComponentDepth -gt $script:MaxComponentDepth) + { + $errorMessage = $LocalizedData.DependsOnLinkTooDeep -f $script:MaxComponentDepth + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId DependsOnLinkTooDeep + Update-ConfigurationErrorCount + } + + $script:resourceIdStack.Push($resourceId) + + foreach ($requiredResource in $Script:NodeResources[$resourceId]) + { + Write-Debug -Message " > Checking for required node $requiredResource" + #$requiredResource is not visited yet + if(($requiredResource -ne $null) -and ($script:resourceIndex[$requiredResource] -eq $null)) + { + StrongConnect($requiredResource) + $script:resourceLowIndex[$resourceId] = [math]::Min($script:resourceLowIndex[$resourceId], $script:resourceLowIndex[$requiredResource]) + } + elseif($script:resourceIdStack -Contains $requiredResource) + { + $script:resourceLowIndex[$resourceId] = [math]::Min($script:resourceLowIndex[$resourceId], $script:resourceIndex[$requiredResource]) + } + } + + if($script:resourceIndex[$resourceId] -eq $script:resourceLowIndex[$resourceId]) + { + $resourceCount = 0 + $circularLinks = '' + do + { + $a = $script:resourceIdStack.Pop() + $circularLinks += "->$a" + $resourceCount++ + } + while($a -ne $resourceId) + + if($resourceCount -gt 1) + { + $errorMessage = $LocalizedData.DependsOnLoopDetected -f $circularLinks + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId DependsOnLoopDetected + Update-ConfigurationErrorCount + } + } +} + +# +# Returns any validation error messages +# +function Test-MofInstanceText +{ + param ( + [Parameter(Mandatory)] + $instanceText + ) + + # Ignore empty instances... + if ( $instanceText) + { + try + { + [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ValidateInstanceText($instanceText) + } + catch [System.Management.Automation.MethodInvocationException] + { + # Return the exception message from the inner most ErrorRecord + $ErrorRecord = Get-InnerMostErrorRecord $_ + $ErrorRecord.Exception.Message + } + } +} + +# +# Encrypt a password using CMS +# +function Get-EncryptedPassword +{ + param ( + [Parameter()] + $Value = $null + ) + + $cert = $null + + + if($Node -and $selectedNodesData) + { + if($selectedNodesData -is [array]) + { + foreach($target in $selectedNodesData) + { + # Node name should be exactly the same as one defined in AllNodes + # -eq does case in sensitive comparison + if($target['NodeName'] -and $target['NodeName'] -eq $Node) + { + $currentNode = $target + } + } + } + else + { + $currentNode = $selectedNodesData + } + } + # where user need to specify properties for resources not in a node, + # they can do it through localhost nodeName in $allNodes + elseif($allnodes -and $allnodes.AllNodes) + { + foreach($target in $allnodes.AllNodes) + { + if($target['NodeName'] -and $target['NodeName'] -eq 'localhost') + { + $currentNode = $target + } + } + } + + if($currentNode) + { + # if Certificate is provided, it override PSDscAllowPlainTextPassword : bug 565167 + # CertificateID is currently assumed to be the 'thumbprint' from the certificate + # Protect-CmsMessage [-To] takes actual cert, path to cert file, path to a directory contains cert, thumbprint or subject name of cert + # we only support cert file and thumbprint as before now + $certificateid = $currentNode['CertificateID'] + + # If there is no certificateid defined, just return the original value... + if ( -not $certificateid) + { + # CertificateFile is the public key file + $certificatefile = $currentNode['CertificateFile'] + + if ( -not $certificatefile) + { + return $Value + } + else + { + $CmsMessageRecipient = $certificatefile + } + } + else + { + $CmsMessageRecipient = $certificateid + } + } + + if($CmsMessageRecipient -and $Value -is [string]) + { + # Encrypt using the public key + $encMsg =Protect-CmsMessage -To $CmsMessageRecipient -Content $Value + + # Reverse bytes for unmanaged decryption + #[Array]::Reverse($encbytes) + + #$encMsg = $encMsg -replace '-----BEGIN CMS-----','' + #$encMsg = $encMsg -replace "`n",'' + #$encMsg = $encMsg -replace '-----END CMS-----','' + + return $encMsg + } + else + { + # passwords should be some type of string so this is probably an error but pass + # back the incoming value. Also if there is no key, then we just pass through the + # password as is. + + $Value + } +} + + +# +# Retrieve a public key that can be used for encryption. Matching on thumbprint +# +function Get-PublicKeyFromStore +{ + param( + [Parameter(Mandatory)] + [string] + $certificateid + ) + + $cert = $null + + foreach($certIndex in Get-ChildItem -Path cert:\LocalMachine\My) + { + if($certIndex.Thumbprint -match $certificateid) + { + $cert = $certIndex + break + } + } + + if(-not $cert) + { + $errorMessage = $($LocalizedData.CertificateStoreReadError) -f $certificateid + ThrowError -ExceptionName 'System.InvalidOperationException' -ExceptionMessage $errorMessage -ExceptionObject $certificateid -ErrorId 'InvalidPathSpecified' -ErrorCategory InvalidOperation + } + else + { + $cert + } +} + +# +# Retrieve a public key that can be used for encryption. Certificate loaded from +# a certificate file +# +function Get-PublicKeyFromFile +{ + param( + [Parameter(Mandatory)] + [string] + $certificatefile + ) + + try + { + $cert = New-Object -TypeName System.Security.Cryptography.X509Certificates.X509Certificate2 + + if($cert) + { + $cert.Import($certificatefile) + $cert + } + } + catch + { + $errorMessage = $($LocalizedData.CertificateFileReadError) -f $certificatefile + ThrowError -ExceptionName 'System.InvalidOperationException' -ExceptionMessage $errorMessage -ExceptionObject $certificatefile -ErrorId 'InvalidPathSpecified' -ErrorCategory InvalidOperation + } +} + + +########################################################### +# +# Checksum generation functions. +# +########################################################### + +#----------------------------------------------------------------------------------------------------- +# New-DscChecksum cmdlet is used to create corresponding checksum files for a specified file or folder +#----------------------------------------------------------------------------------------------------- +function New-DscChecksum +{ + [CmdletBinding(SupportsShouldProcess = $true, HelpUri = 'https://go.microsoft.com/fwlink/?LinkId=403986')] + param( + [Parameter(Mandatory)] + [Alias('ConfigurationPath')] + [ValidateNotNullOrEmpty()] + [string[]] + $Path, + + [Parameter()] + [ValidateNotNullOrEmpty()] + [string] + $OutPath = $null, + + [switch] + $Force + ) + + # Check validity of all configuration paths specified, throw if any of them is invalid + for ($i = 0 ; $i -lt $Path.Length ; $i++) + { + if (!(Test-Path -Path $Path[$i])) + { + $errorMessage = $LocalizedData.InvalidConfigPath -f $Path[$i] + ThrowError -ExceptionName 'System.ArgumentException' -ExceptionMessage $errorMessage -ExceptionObject $Path[$i] -ErrorId 'InvalidConfigurationPath' -ErrorCategory InvalidArgument + } + } + + # If an OutPath is specified, handle its creation and error conditions + if ($OutPath) + { + # If and invalid path syntax is specified in $Outpath, throw + if(([System.IO.Path]::GetInvalidPathChars() | ForEach-Object -Process { + $OutPath.Contains($_) + } + ).IndexOf($true)[0] -ne -1) + { + $errorMessage = $LocalizedData.InvalidOutpath -f $OutPath + ThrowError -ExceptionName 'System.ArgumentException' -ExceptionMessage $errorMessage -ExceptionObject $OutPath -ErrorId 'InvalidOutPath' -ErrorCategory InvalidArgument + } + + # If the specified $Outpath conflicts with an existing file, throw + if(Test-Path -Path $OutPath -PathType Leaf) + { + $errorMessage = $LocalizedData.OutpathConflict -f $OutPath + ThrowError -ExceptionName 'System.ArgumentException' -ExceptionMessage $errorMessage -ExceptionObject $OutPath -ErrorId 'InvalidOutPath' -ErrorCategory InvalidArgument + } + + # IF THE CONTROL REACHED HERE, $OutPath IS A VALID DIRECTORY PATH WHICH HAS NO CONFLICT WITH AN EXISTING FILE + + # If $OutPath doesn't exist, create it + if(!(Test-Path -Path $OutPath)) + { + $null = New-Item -Path $OutPath -ItemType Directory + } + + $OutPath = (Resolve-Path $OutPath).ProviderPath + } + + # Retrieve all valid configuration files at the specified $Path + $allConfigFiles = $Path | ForEach-Object -Process { + (Get-ChildItem -Path $_ -Recurse | Where-Object -FilterScript { + $_.Extension -eq '.mof' -or $_.Extension -eq '.zip' + } + ) + } + + # If no valid config file was found, log this and return + if ($allConfigFiles.Length -eq 0) + { + Write-Log -Message $LocalizedData.NoValidConfigFileFound + + return + } + + # IF THE CONTROL REACHED HERE, VALID CONFIGURATION FILES HAVE BEEN FOUND AND WE NEED TO CALCULATE THEIR HASHES + + foreach ($file in $allConfigFiles) + { + $fileOutpath = "$($file.FullName).checksum" + if ($OutPath) + { + $fileOutpath = "$OutPath\$($file.Name).checksum" + } + + # If the Force parameter was not specified and the hash file already exists for the current file, log this, and skip this file + if (!$Force -and (Get-Item -Path $fileOutpath -ErrorAction SilentlyContinue)) + { + Write-Log -Message ($LocalizedData.CheckSumFileExists -f $fileOutpath) + continue + } + + # Devise appropriate message + $message = $LocalizedData.CreateChecksumFile -f $fileOutpath + if (Test-Path -Path $fileOutpath) + { + $message = $LocalizedData.OverwriteChecksumFile -f $fileOutpath + } + + # Finally, if the hash file doesn't exist already or -Force has been specified, then output the corresponding hash file + if ($pscmdlet.ShouldProcess($message, $null, $null)) + { + [String]$checksum = (Get-FileHash -Path $file.FullName -Algorithm SHA256).Hash + + WriteFile -Path $fileOutpath -Value $checksum + } + } +} +Export-ModuleMember -Function New-DscChecksum + + +#------------------------------------ +# Utility to throw an error/exception +#------------------------------------ +function ThrowError +{ + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $ExceptionName, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $ExceptionMessage, + + [System.Object] + $ExceptionObject, + + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $errorId, + + [parameter(Mandatory = $true)] + [ValidateNotNull()] + [System.Management.Automation.ErrorCategory] + $errorCategory + ) + + $exception = New-Object $ExceptionName $ExceptionMessage + $ErrorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord -ArgumentList $exception, $errorId, $errorCategory, $ExceptionObject + throw $ErrorRecord +} + +#---------------------------------------- +# Utility to write WhatIf or Verbose logs +#---------------------------------------- +function Write-Log +{ + [CmdletBinding(SupportsShouldProcess = $true)] + param + ( + [parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [System.String] + $message + ) + + if ($pscmdlet.ShouldProcess($message, $null, $null)) + { + Write-Verbose -Message $message + } +} + +# WriteFile is a helper function used to write the content to the file +function WriteFile +{ + param( + [parameter(Mandatory)] + [string] + $Value, + + [parameter(Mandatory)] + [string] + $Path) + + try + { + [system.io.streamwriter]$stream = New-Object -TypeName system.io.StreamWriter -ArgumentList ($Path, $false) + try + { + [void] $stream.Write($Value) + } + finally + { + if ($stream) + { + $stream.Close() + } + } + } + catch + { + $errorMessage = $LocalizedData.FileReadError -f $Path + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId InvalidPathSpecified + Update-ConfigurationErrorCount + } +} + +# +# ReadEnvironmentFile imports the contents of a +# file as ConfigurationData +# +function ReadEnvironmentFile +{ + param( + [parameter(Mandatory)] + [string] + $FilePath) + + try + { + $resolvedPath = Resolve-Path $FilePath + } + catch + { + $errorMessage = $LocalizedData.FilePathError -f $FilePath + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId InvalidPathSpecified + Update-ConfigurationErrorCount + } + + try + { + $content = Get-Content $resolvedPath -Raw + $sb = [scriptblock]::Create($content) + $sb.CheckRestrictedLanguage($null, $null, $true) + $sb.Invoke() + } + catch + { + $errorMessage = $LocalizedData.EnvironmentContentError -f $FilePath + $exception = New-Object -TypeName System.InvalidOperationException -ArgumentList $errorMessage + Write-Error -Exception $exception -Message $errorMessage -Category InvalidOperation -ErrorId InvalidEnvironmentContentSpecified + Update-ConfigurationErrorCount + } +} + +function Get-DSCResourceModules +{ + $listPSModuleFolders = $env:PSModulePath.Split(";") + $dscModuleFolderList = [System.Collections.Generic.HashSet[System.String]]::new() + + foreach ($folder in $listPSModuleFolders) + { + $folder = $folder.Trim() + if (!(Test-Path $folder)) + { + continue + } + + foreach($moduleFolder in Get-ChildItem $folder -Directory) + { + $addModule = $false + + $dscFolders = Get-childitem "$($moduleFolder.FullName)\DscResources","$($moduleFolder.FullName)\*\DscResources" -ErrorAction Ignore + if($dscFolders -ne $null) + { + $addModule = $true + } + + if(-not $addModule) + { + foreach($psd1 in Get-ChildItem -Recurse -Filter "$($moduleFolder.Name).psd1" -Path $moduleFolder.fullname -Depth 2) + { + $containsDSCResource = select-string -LiteralPath $psd1 -pattern '^(?!#).*\bDscResourcesToExport\b.*' + if($containsDSCResource -ne $null) + { + $addModule = $true + } + } + } + + if($addModule) + { + $dscModuleFolderList.Add($moduleFolder.Name) + } + } + } + + $dscModuleFolderList +} + +########################################################### +# Get-DSCResource +########################################################### + +# +# Gets DSC resources on the machine. Allows to filter on a particular resource. +# It parses all the resources defined in the schema.mof file and also the composite +# resources defined or imported from PowerShell modules +# +function Get-DscResource +{ + [CmdletBinding(HelpUri = 'https://go.microsoft.com/fwlink/?LinkId=403985')] + [OutputType('Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo[]')] + [OutputType('string[]')] + param ( + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNullOrEmpty()] + [string[]] + $Name, + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNullOrEmpty()] + [Object] + $Module, + + [Parameter()] + [switch] + $Syntax + ) + + Begin + { + $initialized = $false + $ModuleString = $null + Write-Progress -Id 1 -Activity $LocalizedData.LoadingDefaultCimKeywords + + $keywordErrors = New-Object -TypeName 'System.Collections.ObjectModel.Collection[System.Exception]' + + # Load the default Inbox providers (keyword) in cache, also allow caching the resources from multiple versions of modules. + [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::LoadDefaultCimKeywords($keywordErrors, $true) + + foreach($ex in $keywordErrors) + { + Write-Error -Exception $ex + if($ex.InnerException) + { + Write-Error -Exception $ex.InnerException + } + } + + Write-Progress -Id 2 -Activity $LocalizedData.GettingModuleList + + $initialized = $true + + if($Module) #Pick from the specified module if there's one + { + $moduleSpecificName = [System.Management.Automation.LanguagePrimitives]::ConvertTo($Module,[Microsoft.PowerShell.Commands.ModuleSpecification]) + $modules = Get-Module -ListAvailable -FullyQualifiedName $moduleSpecificName + if($Module -is [System.Collections.Hashtable]) + { + $ModuleString = $Module.ModuleName + } + else + { + $ModuleString = $Module + } + } + else + { + $modules = Get-Module -ListAvailable -Name (Get-DSCResourceModules) + } + + foreach ($mod in $modules) + { + if ($mod.ExportedDscResources.Count -gt 0) + { + $null = ImportClassResourcesFromModule -Module $mod -Resources * -functionsToDefine $functionsToDefine + } + + $dscResources = Join-Path -Path $mod.ModuleBase -ChildPath 'DSCResources' + if(Test-Path $dscResources) + { + foreach ($resource in Get-ChildItem -Path $dscResources -Directory -Name) + { + $null = ImportCimAndScriptKeywordsFromModule -Module $mod -Resource $resource -functionsToDefine $functionsToDefine + } + } + } + + $Resources = @() + } + + Process + { + try + { + if ($Name -ne $null) + { + $nameMessage = $LocalizedData.GetDscResourceInputName -f @('Name', [system.string]::Join(', ', $Name)) + Write-Verbose -Message $nameMessage + } + if($Module -and !$modules) + { + #Return if no modules were found with the required specification + Write-Warning -Message $LocalizedData.NoModulesPresent + return + } + $ignoreResourceParameters = @('InstanceName', 'OutputPath', 'ConfigurationData') + [System.Management.Automation.Cmdlet]::CommonParameters + [System.Management.Automation.Cmdlet]::OptionalCommonParameters + + $patterns = GetPatterns $Name + + Write-Progress -Id 3 -Activity $LocalizedData.CreatingResourceList + + # Get resources for CIM cache + $keywords = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::GetCachedKeywords() | Where-Object -FilterScript { + (!$_.IsReservedKeyword) -and ($_.ResourceName -ne $null) -and !(IsHiddenResource $_.ResourceName) -and (![bool]$Module -or ($_.ImplementingModule -like $ModuleString)) + } + + $Resources += $keywords | + ForEach-Object -Process { + GetResourceFromKeyword -keyword $_ -patterns $patterns -modules $modules + } | + Where-Object -FilterScript { + $_ -ne $null + } + + # Get composite resources + $Resources += Get-Command -CommandType Configuration | + ForEach-Object -Process { + GetCompositeResource $patterns $_ $ignoreResourceParameters -modules $modules + } | + Where-Object -FilterScript { + $_ -ne $null -and (![bool]$ModuleString -or ($_.Module -like $ModuleString)) -and + ($_.Path -and ((Split-Path -Leaf $_.Path) -eq "$($_.Name).schema.psm1")) + } + + # check whether all resources are found + CheckResourceFound $Name $Resources + } + catch + { + if ($initialized) + { + [System.Management.Automation.Language.DynamicKeyword]::Reset() + [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ClearCache() + + $initialized = $false + } + + throw $_ + } + } + + End + { + $Resources = $Resources | Sort-Object -Property Module, Name + foreach ($resource in $Resources) + { + # return formatted string if required + if ($Syntax) + { + GetSyntax $resource | Write-Output + } + else + { + Write-Output -InputObject $resource + } + } + + if ($initialized) + { + [System.Management.Automation.Language.DynamicKeyword]::Reset() + [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::ClearCache() + + $initialized = $false + } + } +} + +# +# Get DSC resoruce for a dynamic keyword +# +function GetResourceFromKeyword +{ + [OutputType('Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo')] + param ( + [Parameter(Mandatory)] + [System.Management.Automation.Language.DynamicKeyword] + $keyword, + [System.Management.Automation.WildcardPattern[]] + $patterns, + [Parameter(Mandatory)] + [System.Management.Automation.PSModuleInfo[]] + $modules + ) + + # Find whether $name follows the pattern + $matched = (IsPatternMatched $patterns $keyword.ResourceName) -or (IsPatternMatched $patterns $keyword.Keyword) + if ($matched -eq $false) + { + $message = $LocalizedData.ResourceNotMatched -f @($keyword.Keyword) + Write-Verbose -Message ($message) + return + } + else + { + $message = $LocalizedData.CreatingResource -f @($keyword.Keyword) + Write-Verbose -Message $message + } + + $resource = New-Object -TypeName Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo + + $resource.ResourceType = $keyword.ResourceName + + if ($keyword.ResourceName -ne $keyword.Keyword) + { + $resource.FriendlyName = $keyword.Keyword + } + + $resource.Name = $keyword.Keyword + + $schemaFiles = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::GetFileDefiningClass($keyword.ResourceName) + if ($schemaFiles.Count) + { + # Find the correct schema file that matches module name and version + # if same module/version is installed in multiple locations, then pick the first schema file. + foreach ($schemaFileName in $schemaFiles){ + $moduleInfo = GetModule $modules $schemaFileName; + if ($moduleInfo.Name -eq $keyword.ImplementingModule -and $moduleInfo.Version -eq $keyword.ImplementingModuleVersion){ + break + } + } + + # if the class is not a resource we will ignore it except if it is DSC inbox resource. + if(-not $schemaFileName.StartsWith("$env:windir\system32\configuration",[stringComparison]::OrdinalIgnoreCase)) + { + $classesFromSchema = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::GetCachedClassByFileName($schemaFileName) + if( $classesFromSchema -ne $null) + { + # check if the resource is proper DSC resource that always derives from OMI_BaseResource. + $schemaToProcess = $classesFromSchema | ForEach-Object -Process { + if(($_.CimSystemProperties.ClassName -ieq $keyword.ResourceName) -and ($_.CimSuperClassName -ieq 'OMI_BaseResource')) + { + $_ + } + } + if( $schemaToProcess -eq $null) + { + return + } + } + } + + $message = $LocalizedData.SchemaFileForResource -f @($schemaFileName) + Write-Verbose -Message $message + + $resource.Module = $moduleInfo + $resource.Path = GetImplementingModulePath $schemaFileName + $resource.ParentPath = Split-Path $schemaFileName + } + else + { + $Module = $modules | Where-Object -FilterScript { + $_.Name -eq $keyword.ImplementingModule -and + $_.Version -eq $keyword.ImplementingModuleVersion + } + + # Get cim classes defined under $Module + $cachedClasses = [Microsoft.PowerShell.DesiredStateConfiguration.Internal.DscClassCache]::GetCachedClassesForModule($Module) + + # Check if it is a DSC Resource that is always derived from OMI_BaseResource class. + $isDscResource = $false + foreach($cachedClasse in $cachedClasses) { + if($cachedClasse.CimSystemProperties.ClassName -ieq $keyword.Keyword -and ($cachedClasse.CimSuperClassName -ieq 'OMI_BaseResource')) + { + $isDscResource = $true + break + } + } + if(-not $isDscResource) + { + return + } + + if ($Module -and $Module.ExportedDscResources -contains $keyword.Keyword) + { + $resource.Module = $Module + $resource.Path = $Module.Path + $resource.ParentPath = Split-Path -Path $Module.Path + } + } + + if ([system.string]::IsNullOrEmpty($resource.Path) -eq $false) + { + $resource.ImplementedAs = [Microsoft.PowerShell.DesiredStateConfiguration.ImplementedAsType]::PowerShell + } + else + { + $resource.ImplementedAs = [Microsoft.PowerShell.DesiredStateConfiguration.ImplementedAsType]::Binary + } + + if ($resource.Module -ne $null) + { + $resource.CompanyName = $resource.Module.CompanyName + } + + # add properties + $keyword.Properties.Values | ForEach-Object -Process { + AddDscResourceProperty $resource $_ + } + + # sort properties + $updatedProperties = $resource.Properties | Sort-Object -Property @{ + expression = 'IsMandatory' + Descending = $true + }, @{ + expression = 'Name' + Ascending = $true + } + $resource.UpdateProperties($updatedProperties) + + return $resource +} + +# +# Gets composite resource +# +function GetCompositeResource +{ + [OutputType('Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo')] + param ( + [System.Management.Automation.WildcardPattern[]] + $patterns, + [Parameter(Mandatory)] + [System.Management.Automation.ConfigurationInfo] + $configInfo, + $ignoreParameters, + [Parameter(Mandatory)] + [System.Management.Automation.PSModuleInfo[]] + $modules + ) + + # Find whether $name follows the pattern + $matched = IsPatternMatched $patterns $configInfo.Name + if ($matched -eq $false) + { + $message = $LocalizedData.ResourceNotMatched -f @($configInfo.Name) + Write-Verbose -Message ($message) + + return $null + } + else + { + $message = $LocalizedData.CreatingResource -f @($configInfo.Name) + Write-Verbose -Message $message + } + + $resource = New-Object -TypeName Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo + + $resource.ResourceType = $configInfo.Name + $resource.FriendlyName = $null + $resource.Name = $configInfo.Name + $resource.ImplementedAs = [Microsoft.PowerShell.DesiredStateConfiguration.ImplementedAsType]::Composite + + if ($configInfo.Module -ne $null) + { + $resource.Module = GetModule $modules $configInfo.Module.Path + if($resource.Module -eq $null) + { + $resource.Module = $configInfo.Module + } + $resource.CompanyName = $configInfo.Module.CompanyName + $resource.Path = $configInfo.Module.Path + $resource.ParentPath = Split-Path -Path $resource.Path + } + + # add properties + $configInfo.Parameters.Values | ForEach-Object -Process { + AddDscResourcePropertyFromMetadata $resource $_ $ignoreParameters + } + + return $resource +} + +# +# Adds property to a DSC resource +# +function AddDscResourceProperty +{ + param ( + [Parameter(Mandatory)] + [Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo] + $dscresource, + [Parameter(Mandatory)] + $property + ) + + $convertTypeMap = @{ + 'MSFT_Credential'='[PSCredential]'; + 'MSFT_KeyValuePair'='[HashTable]'; + 'MSFT_KeyValuePair[]'='[HashTable]' + } + + $ignoreProperties = @('ResourceId', 'ConfigurationName') + if ($ignoreProperties -contains $property.Name) + { + return + } + + $dscProperty = New-Object -TypeName Microsoft.PowerShell.DesiredStateConfiguration.DscResourcePropertyInfo + $dscProperty.Name = $property.Name + if ($convertTypeMap.ContainsKey($property.TypeConstraint)) + { + $type = $convertTypeMap[$property.TypeConstraint] + } + else + { + $Type = [System.Management.Automation.LanguagePrimitives]::ConvertTypeNameToPSTypeName($property.TypeConstraint) + if([string]::IsNullOrEmpty($Type)) + { + $Type = "[$($property.TypeConstraint)]" + } + } + + if ($property.ValueMap -ne $null) + { + $property.ValueMap.Keys | + Sort-Object | + ForEach-Object -Process { + $dscProperty.Values.Add($_) + } + } + + $dscProperty.PropertyType = $Type + $dscProperty.IsMandatory = $property.Mandatory + + $dscresource.Properties.Add($dscProperty) +} + +# +# Adds property to a DSC resource +# +function AddDscResourcePropertyFromMetadata +{ + param ( + [Parameter(Mandatory)] + [Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo] + $dscresource, + [Parameter(Mandatory)] + [System.Management.Automation.ParameterMetadata] + $parameter, + $ignoreParameters + ) + + if ($ignoreParameters -contains $parameter.Name) + { + return + } + + $dscProperty = New-Object -TypeName Microsoft.PowerShell.DesiredStateConfiguration.DscResourcePropertyInfo + $dscProperty.Name = $parameter.Name + + # adding [] in Type name to keep it in sync with the name returned from LanguagePrimitives.ConvertTypeNameToPSTypeName + $dscProperty.PropertyType = '[' +$parameter.ParameterType.Name + ']' + $dscProperty.IsMandatory = $parameter.Attributes.Mandatory + + $dscresource.Properties.Add($dscProperty) +} + +# +# Gets syntax for a DSC resource +# +function GetSyntax +{ + [OutputType('string')] + param ( + [Parameter(Mandatory)] + [Microsoft.PowerShell.DesiredStateConfiguration.DscResourceInfo] + $dscresource + ) + + $output = $dscresource.Name + " [String] #ResourceName`n" + $output += "{`n" + foreach ($property in $dscresource.Properties) + { + $output += ' ' + if ($property.IsMandatory -eq $false) + { + $output += '[' + } + + $output += $property.Name + + $output += ' = ' + $property.PropertyType + '' + + # Add possible values + if ($property.Values.Count -gt 0) + { + $output += '{ ' + [system.string]::Join(' | ', $property.Values) + ' }' + } + + if ($property.IsMandatory -eq $false) + { + $output += ']' + } + + $output += "`n" + } + + $output += "}`n" + + return $output +} + +# +# Checks whether a resource is found or not +# +function CheckResourceFound($names, $Resources) +{ + if ($names -eq $null) + { + return + } + + $namesWithoutWildcards = $names | Where-Object -FilterScript { + [System.Management.Automation.WildcardPattern]::ContainsWildcardCharacters($_) -eq $false + } + + foreach ($Name in $namesWithoutWildcards) + { + $foundResources = $Resources | Where-Object -FilterScript { + ($_.Name -eq $Name) -or ($_.ResourceType -eq $Name) + } + if ($foundResources.Count -eq 0) + { + $errorMessage = $LocalizedData.ResourceNotFound -f @($Name, 'Resource') + Write-Error -Message $errorMessage + } + } +} + +# +# Get implementing module path +# +function GetImplementingModulePath +{ + param ( + [Parameter(Mandatory)] + [string] + $schemaFileName + ) + + $moduleFileName = ($schemaFileName -replace ".schema.mof$", '') + '.psd1' + if (Test-Path $moduleFileName) + { + return $moduleFileName + } + + $moduleFileName = ($schemaFileName -replace ".schema.mof$", '') + '.psm1' + if (Test-Path $moduleFileName) + { + return $moduleFileName + } + + return +} + +# +# Gets module for a DSC resource +# +function GetModule +{ + [OutputType('System.Management.Automation.PSModuleInfo')] + param ( + [Parameter(Mandatory)] + [System.Management.Automation.PSModuleInfo[]] + $modules, + [Parameter(Mandatory)] + [string] + $schemaFileName + ) + + if($schemaFileName -eq $null) + { + return $null + } + + $schemaFileExt = $null + if ($schemaFileName -match '.schema.mof') + { + $schemaFileExt = ".schema.mof$" + } + + if ($schemaFileName -match '.schema.psm1') + { + $schemaFileExt = ".schema.psm1$" + } + + if(!$schemaFileExt) + { + return $null + } + + # get module from parent directory. + # Desired structure is : /DSCResources//schema.File + $validResource = $false + $schemaDirectory = Split-Path $schemaFileName + if($schemaDirectory) + { + $subDirectory = [System.IO.Directory]::GetParent($schemaDirectory) + + if ($subDirectory -and ($subDirectory.Name -eq 'DSCResources') -and $subDirectory.Parent) + { + $moduleDirectory = [System.IO.Directory]::GetParent($subDirectory) + $results = $modules | Where-Object -FilterScript { + $_.ModuleBase -eq $subDirectory.Parent.FullName + } + + if ($results) + { + # Log Resource is internally handled by the CA. There is no formal provider for it. + if ($schemaFileName -match 'MSFT_LogResource') + { + $validResource = $true + } + else + { + # check for proper resource module + foreach ($ext in @('.psd1', '.psm1', '.dll', '.cdxml')) + { + $resModuleFileName = ($schemaFileName -replace $schemaFileExt, '') + $ext + if(Test-Path($resModuleFileName)) + { + $validResource = $true + break + } + } + } + } + } + } + + if ($results -and $validResource) + { + return $results[0] + } + else + { + return $null + } +} + +# +# Checks whether a resource is hidden or not +# +function IsHiddenResource +{ + param ( + [Parameter(Mandatory)] + [string] + $ResourceName + ) + + $hiddenResources = @( + 'OMI_BaseResource', + 'MSFT_KeyValuePair', + 'MSFT_BaseConfigurationProviderRegistration', + 'MSFT_CimConfigurationProviderRegistration', + 'MSFT_PSConfigurationProviderRegistration', + 'OMI_ConfigurationDocument', + 'MSFT_Credential', + 'MSFT_DSCMetaConfiguration', + 'OMI_ConfigurationDownloadManager', + 'OMI_ResourceModuleManager', + 'OMI_ReportManager', + 'MSFT_FileDownloadManager', + 'MSFT_WebDownloadManager', + 'MSFT_FileResourceManager', + 'MSFT_WebResourceManager', + 'MSFT_WebReportManager', + 'OMI_MetaConfigurationResource', + 'MSFT_PartialConfiguration', + 'MSFT_DSCMetaConfigurationV2' + ) + + return $hiddenResources -contains $ResourceName +} + +# +# Gets patterns for names +# +function GetPatterns +{ + [OutputType('System.Management.Automation.WildcardPattern[]')] + param ( + [string[]] + $names + ) + + $patterns = @() + + if ($names -eq $null) + { + return $patterns + } + + foreach ($Name in $names) + { + $patterns += New-Object -TypeName System.Management.Automation.WildcardPattern -ArgumentList @($Name, [System.Management.Automation.WildcardOptions]::IgnoreCase) + } + + return $patterns +} + +# +# Checks whether an input name matches one of the patterns +# $pattern is not expected to have an empty or null values +# +function IsPatternMatched +{ + [OutputType('bool')] + param ( + [System.Management.Automation.WildcardPattern[]] + $patterns, + [Parameter(Mandatory)] + [string] + $Name + ) + + if ($patterns -eq $null) + { + return $true + } + + foreach ($pattern in $patterns) + { + if ($pattern.IsMatch($Name)) + { + return $true + } + } + + return $false +} + +Export-ModuleMember -Function Get-DscResource +########################################################### + + +########################################################### +# Aliases +########################################################### +New-Alias -Name 'sacfg' -Value 'Start-DSCConfiguration' +New-Alias -Name 'tcfg' -Value 'Test-DSCConfiguration' +New-Alias -Name 'gcfg' -Value 'Get-DSCConfiguration' +New-Alias -Name 'rtcfg' -Value 'Restore-DSCConfiguration' +New-Alias -Name 'glcm' -Value 'Get-DSCLocalConfigurationManager' +New-Alias -Name 'slcm' -Value 'Set-DSCLocalConfigurationManager' +New-Alias -Name 'pbcfg' -Value 'Publish-DSCConfiguration' +New-Alias -Name 'ulcm' -Value 'Update-DscLocalConfigurationManager' +New-Alias -Name 'upcfg' -Value 'Update-DSCConfiguration' +New-Alias -Name 'gcfgs' -Value 'Get-DscConfigurationStatus' + +Export-ModuleMember -Alias * \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.types.ps1xml b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.types.ps1xml new file mode 100644 index 0000000..f816fe6 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/PSDesiredStateConfiguration.types.ps1xml @@ -0,0 +1,107 @@ + + + + + + GetDscConfigurationType + + + CimClassName + + if ($this.CimClass -ne $null) { $this.CimClass.CimClassName } else {""} + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/MSFT_PartialConfiguration + + + ToString + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/OMI_ConfigurationDownloadManager + + + ToString + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/OMI_ResourceModuleManager + + + ToString + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/OMI_ReportManager + + + ToString + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/MSFT_ResourceInDesiredState + + + ToString + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/MSFT_ResourceNotInDesiredState + + + ToString + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/DesiredStateConfiguration/MSFT_DSCConfigurationStatus + + + ToString + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/PSDscXMachine.psm1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/PSDscXMachine.psm1 new file mode 100644 index 0000000..494da2f --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/PSDscXMachine.psm1 @@ -0,0 +1,376 @@ +# internal functions for WaitForX + +# Fallback message strings in en-US +DATA localizedData +{ + # culture = "en-US" + ConvertFrom-StringData @' + InvalidInputParam = Invalid input parameters! + InvalidInputThrottle = Invalid input throttle limit! + CheckRemoteState = Checking remote resource '{0}' state ... + RemoteResourceNotReady = Remote resource '{0}' is not ready. + RemoteResourceNotReadyAndRetry = Remote resource '{0}' is not ready. Retrying after {1} second(s) + RemoteResourceReady = Remote resource '{0}' is ready + RemoteConfigNotReady = Resource '{0}' on machine(s) '{1}' is not ready. + RemoteConfigNotReadyWithRetry = Resource '{0}' on machine(s) '{1}' is not ready after '{2}' retries with retry interval of '{3}' second(s). + NodeNameHasDuplicates = NodeName contains duplicate machine names! Check the NodeName and expected MinimalNumberOfMachineInState parameters. + RemoteConnectivityFailure = Cannot create remote session to machine '{0}' +'@ +} +Import-LocalizedData LocalizedData -filename PSDSCxMachine.strings.psd1 + +$script:NodeInDesiredState = @() +$script:NodeNameIsDuplicated = $false + +function Get-_InternalPSDscXMachineTR +{ + param + ( + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string] $RemoteResourceId, + + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string[]] $RemoteMachine, + + [Uint32] $MinimalNumberOfMachineInState = $RemoteMachine.Length, + + [ValidateRange(1,[Uint64]::MaxValue)] + [Uint64] $RetryIntervalSec = 1, + + [Uint32] $RetryCount = 0, + + [Uint32] $ThrottleLimit = 32 + ) + + return @{ + ResourceName = $RemoteResourceId + NodeName = $RemoteMachine + RetryIntervalSec = $RetryIntervalSec + RetryCount = $RetryCount + ThrottleLimit = $ThrottleLimit + } +} + +function IsAccessDeniedIssue +{ + param ( $er) + + $ci = $er.CategoryInfo + [xml]$xml = $er.Exception.Message + return ($ci.TargetName -ilike "*MSFT_DscProxy") -and ($er.Exception.HResult -eq 0x80131509 ) -and ( -not (($xml.ChildNodes.Count -gt 0) -and ($xml.ChildNodes[0].Code -eq 5))) +} + +function Set-_InternalPSDscXMachineTR +{ + param + ( + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string] $RemoteResourceId, + + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string[]] $RemoteMachine, + + [Uint32] $MinimalNumberOfMachineInState = $RemoteMachine.Length, + + [ValidateRange(1,[Uint64]::MaxValue)] + [Uint64] $RetryIntervalSec = 1, + + [Uint32] $RetryCount = 0, + + [Uint32] $ThrottleLimit = 32 + ) + + if ($MinimalNumberOfMachineInState -gt $remoteMachine.Count) + { + throw $localizedData.InvalidInputParam + } + + if ($ThrottleLimit -eq 0) + { + throw $localizedData.InvalidInputThrottle + } + + $bState = $false + $retry = 0 + + Write-Debug -Message ($localizedData.CheckRemoteState -f $RemoteResourceId) + for ($retry = 0; $retry -lt $RetryCount; $retry++) + { + Write-Verbose -Message ($localizedData.RemoteResourceNotReadyAndRetry -f $RemoteResourceId, $RetryIntervalSec) + Sleep -Seconds $RetryIntervalSec + + $Iterations = [math]::Ceiling($RemoteMachine.Count / $ThrottleLimit) + $initialItr = $retry * $Iterations + for ($itr = $initialItr; $itr -lt $initialItr+$Iterations; $itr++) + { + try + { + $machinesToConnect = Get-MachinesToEnsureConnection -remoteMachine $remoteMachine -iteration $itr -throttleLimit $ThrottleLimit + if ($machinesToConnect.Count -eq 0) + { + $bState = $true; + } + else + { + $bState = Get-RemoteResourceState -remoteMachine $machinesToConnect -RemoteResourceId $RemoteResourceId -MinimalNumberOfMachineInState $MinimalNumberOfMachineInState + } + } + catch + { + if (IsAccessDeniedIssue -er $_) + { + Write-Debug -Message "Exception: $_" + } + else + { + Write-Verbose -Message "Exception: $_" + } + } + + if ($bState) + { + Write-Verbose -Message ($localizedData.RemoteResourceReady -f $RemoteResourceId) + return + } + } + } + if ($script:NodeNameIsDuplicated) + { + # reset $NodeNameIsDuplicated + $script:NodeNameIsDuplicated = $false + throw $localizedData.NodeNameHasDuplicates + } + else + { + if ($RetryCount -gt 0) + { + throw ($localizedData.RemoteConfigNotReadyWithRetry -f $RemoteResourceId, "$($RemoteMachine)", $RetryCount, $RetryIntervalSec ) + } + else + { + throw ($localizedData.RemoteConfigNotReady -f $RemoteResourceId, "$($RemoteMachine)") + } + } +} + +function Test-_InternalPSDscXMachineTR +{ + param + ( + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string] $RemoteResourceId, + + [parameter(Mandatory)] + [ValidateNotNullOrEmpty()] + [string[]] $RemoteMachine, + + [Uint32] $MinimalNumberOfMachineInState = $RemoteMachine.Length, + + [ValidateRange(1,[Uint64]::MaxValue)] + [Uint64] $RetryIntervalSec = 1, + + [Uint32] $RetryCount = 0, + + [Uint32] $ThrottleLimit = 32 + ) + + if ($MinimalNumberOfMachineInState -gt $remoteMachine.Count) + { + throw $localizedData.InvalidInputParam + } + + if ($ThrottleLimit -eq 0) + { + throw $localizedData.InvalidInputThrottle + } + + $bState = $false + + Write-Debug -Message ($localizedData.CheckRemoteState -f $RemoteResourceId) + + $script:NodeInDesiredState = @() + + $TotalRetryCount = 1 + $MaxRetryCount = 5 + for ($retry = 0; $retry -lt $TotalRetryCount; $retry++) + { + if ($retry -gt 0) { Sleep -Milliseconds 200 } + + # according to algorithm described in Get-MachinesToEnusreConnection, the number of iterations to cover all machines at least once is calculated as stoping condition in following for loop + for ($iteration = 0; $iteration -lt [math]::Ceiling($RemoteMachine.Count / $ThrottleLimit); $iteration++) + { + try + { + $machinesToConnect = Get-MachinesToEnsureConnection -remoteMachine $remoteMachine -iteration $iteration -throttleLimit $ThrottleLimit + $bState = Get-RemoteResourceState -remoteMachine $machinesToConnect -RemoteResourceId $RemoteResourceId -MinimalNumberOfMachineInState $MinimalNumberOfMachineInState + } + catch + { + if (IsAccessDeniedIssue -er $_) + { + Write-Debug -Message "Exception: $_" + $TotalRetryCount = $MaxRetryCount + } + else + { + Write-Verbose -Message "Exception: $_" + $TotalRetryCount = $retry # stop TotalRetryCount as non-connectivity issue. + } + } + + if ($bState) + { + Write-Verbose -Message ($localizedData.RemoteResourceReady -f $RemoteResourceId) + return $true + } + } + } + + Write-Verbose -Message ($localizedData.RemoteResourceNotReady -f $RemoteResourceId) + + return $false +} + +function Get-MachinesToEnsureConnection +{ + param( + [ValidateNotNullOrEmpty()][string[]] $remoteMachine, + [int] $iteration, + [int] $throttleLimit + ) + + $allMachines = @() + foreach ($machine in $remoteMachine) + { + if ($machine -notin $script:NodeInDesiredState) + { + $allMachines += $machine + } + } + + <# the algorithm works like this: + suppose we have 10 machines (0-9) and throttle limit is 3 + following is the machines alively connected in each iteration + iteration machines + 0 0,1,2 + 1 3,4,5 + 2 6,7,8 + 3 9,0,1 + 4 2,3,4 + ... + #> + + if ($throttleLimit -ge $allMachines.Count) + { + return $allMachines + } + else + { + $machinesToConnect = @() + $start = ($iteration * $throttleLimit) % ($allMachines.Count) + + $count = 0 + for ($i = $start; $i -lt $allMachines.Count -and $count -lt $throttleLimit; $i++) + { + $machinesToConnect += $allMachines[$i] + $count++ + } + + if ($count -lt $throttleLimit) + { + for ($i = 0; $i -lt ($throttleLimit - $count); $i++) + { + $machinesToConnect += $allMachines[$i] + } + } + return $machinesToConnect + } +} + +function Get-RemoteResourceState +{ + param ( + + [ValidateNotNullOrEmpty()][string[]] $remoteMachine, + [ValidateNotNullOrEmpty()][string] $RemoteResourceId, + [Uint32] $MinimalNumberOfMachineInState = $remoteMachine.Count + ) + + Write-Debug "Get-RemoteResourceState ..." + + if ($script:NodeInDesiredState.Count -eq $MinimalNumberOfMachineInState) + { + return $true + } + + $remoteMachineException = $null + + foreach ($machine in $remoteMachine) + { + Write-Debug "Get resource state on remoteMachine: $machine" + #Remove duplicate machine names from $remoteMachine list + if ($script:NodeInDesiredState -contains $machine) + { + $script:NodeNameIsDuplicated = $true + continue + } + try + { + if (Get-RemoteResourceStateOnMachine -RemoteResourceId $RemoteResourceId -MachineName $machine) + { + $script:NodeInDesiredState += $machine + + if ($script:NodeInDesiredState.Count -eq $MinimalNumberOfMachineInState) + { + return $true + } + } + else + { + Write-Debug "Resource $RemoteResourceId on machine $machine is not ready" + } + } + catch + { + # continue here to iterate every machine from $remoteMachine list + $remoteMachineException = $_ + } + } + # re-throw the original exception once browsing all the machines is complete + if($remoteMachineException -ne $null) + { + throw $remoteMachineException + } + + $false +} + +function Get-RemoteResourceStateOnMachine +{ + param ( + [ValidateNotNullOrEmpty()][string] $RemoteResourceId, + [ValidateNotNullOrEmpty()][string] $MachineName + ) + + Write-Debug "Get-RemoteResourceStateOnMachine on machine: $MachineName and resource: $RemoteRecourceId..." + + $buf = [Text.Encoding]::Unicode.GetBytes($RemoteResourceId) + $data = [System.Convert]::ToBase64String($buf) + + $result = Invoke-WSManAction -ResourceURI http://schemas.microsoft.com/wbem/wsman/1/wmi/root/microsoft/windows/DesiredStateConfigurationProxy/MSFT_DscProxy ` + -action GetResourceState -ComputerName $MachineName -valueset @{ConfigurationData = "$data" } ` + -Authentication None + $retV = $result.State + + Write-Debug "Get state ($retV) on machine: $MachineName and resource: $RemoteRecourceId" + + return $retV -ieq 'true' +} + +Export-ModuleMember -Function *-_InternalPSDscXMachineTR + diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Remove-DscConfigurationDocument.cdxml b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Remove-DscConfigurationDocument.cdxml new file mode 100644 index 0000000..bc6a8d4 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Remove-DscConfigurationDocument.cdxml @@ -0,0 +1,50 @@ + + + + + 2.0.0.0 + DscConfigurationDocument + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Restore-DscConfiguration.cdxml b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Restore-DscConfiguration.cdxml new file mode 100644 index 0000000..e2d0865 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Restore-DscConfiguration.cdxml @@ -0,0 +1,28 @@ + + + + + 2.0.0.0 + DscConfiguration + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Stop-DscConfiguration.cdxml b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Stop-DscConfiguration.cdxml new file mode 100644 index 0000000..ceb0502 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/Stop-DscConfiguration.cdxml @@ -0,0 +1,35 @@ + + + + + 2.0.0.0 + DscConfiguration + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/WebDownloadManager/WebDownloadManager.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/WebDownloadManager/WebDownloadManager.psd1 new file mode 100644 index 0000000..5c523bd Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/WebDownloadManager/WebDownloadManager.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/ko-KR/PSDSCxMachine.strings.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/ko-KR/PSDSCxMachine.strings.psd1 new file mode 100644 index 0000000..3eac90c Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/ko-KR/PSDSCxMachine.strings.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/ko-KR/PSDesiredStateConfiguration.Resource.psd1 b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/ko-KR/PSDesiredStateConfiguration.Resource.psd1 new file mode 100644 index 0000000..ce54e74 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDesiredStateConfiguration/ko-KR/PSDesiredStateConfiguration.Resource.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSDiagnostics/PSDiagnostics.psd1 b/newton-cn/bin/v1.0/Modules/PSDiagnostics/PSDiagnostics.psd1 new file mode 100644 index 0000000..ba9d444 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSDiagnostics/PSDiagnostics.psd1 @@ -0,0 +1,14 @@ +@{ + GUID="c61d6278-02a3-4618-ae37-a524d40a7f44 " + Author="Microsoft Corporation" + CompanyName="Microsoft Corporation" + Copyright="© Microsoft Corporation. All rights reserved." + ModuleVersion="1.0.0.0" + PowerShellVersion = '5.1' + CLRVersion="2.0.50727" + ModuleToProcess="PSDiagnostics.psm1" + AliasesToExport = @() + CmdletsToExport = @() + FunctionsToExport="Disable-PSTrace","Disable-PSWSManCombinedTrace","Disable-WSManTrace","Enable-PSTrace","Enable-PSWSManCombinedTrace","Enable-WSManTrace","Get-LogProperties","Set-LogProperties","Start-Trace","Stop-Trace" + CompatiblePSEditions = @('Desktop') +} diff --git a/newton-cn/bin/v1.0/Modules/PSDiagnostics/PSDiagnostics.psm1 b/newton-cn/bin/v1.0/Modules/PSDiagnostics/PSDiagnostics.psm1 new file mode 100644 index 0000000..bc893f1 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSDiagnostics/PSDiagnostics.psm1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSScheduledJob/PSScheduledJob.Format.ps1xml b/newton-cn/bin/v1.0/Modules/PSScheduledJob/PSScheduledJob.Format.ps1xml new file mode 100644 index 0000000..94605a6 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSScheduledJob/PSScheduledJob.Format.ps1xml differ diff --git a/newton-cn/bin/v1.0/Modules/PSScheduledJob/PSScheduledJob.psd1 b/newton-cn/bin/v1.0/Modules/PSScheduledJob/PSScheduledJob.psd1 new file mode 100644 index 0000000..0c0ff94 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSScheduledJob/PSScheduledJob.psd1 @@ -0,0 +1,34 @@ +@{ + +ModuleToProcess = 'Microsoft.PowerShell.ScheduledJob.dll' + +ModuleVersion = '1.1.0.0' + +GUID = '50cdb55f-5ab7-489f-9e94-4ec21ff51e59' + +Author = 'Microsoft Corporation' + +CompanyName = 'Microsoft Corporation' + +Copyright = '© Microsoft Corporation. All rights reserved.' + +PowerShellVersion = '5.1' + +CLRVersion = '4.0' + +TypesToProcess = 'PSScheduledJob.types.ps1xml' + +FormatsToProcess="PSScheduledJob.Format.ps1xml" + +CmdletsToExport = 'New-JobTrigger', 'Add-JobTrigger', 'Remove-JobTrigger', + 'Get-JobTrigger', 'Set-JobTrigger', 'Enable-JobTrigger', + 'Disable-JobTrigger', 'New-ScheduledJobOption', 'Get-ScheduledJobOption', + 'Set-ScheduledJobOption', 'Register-ScheduledJob', 'Get-ScheduledJob', + 'Set-ScheduledJob', 'Unregister-ScheduledJob', 'Enable-ScheduledJob', + 'Disable-ScheduledJob' +AliasesToExport = @() +FunctionsToExport = @() + +HelpInfoURI = 'https://go.microsoft.com/fwlink/?linkid=390816' +CompatiblePSEditions = @('Desktop') +} diff --git a/newton-cn/bin/v1.0/Modules/PSScheduledJob/PSScheduledJob.types.ps1xml b/newton-cn/bin/v1.0/Modules/PSScheduledJob/PSScheduledJob.types.ps1xml new file mode 100644 index 0000000..5476073 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSScheduledJob/PSScheduledJob.types.ps1xml differ diff --git a/newton-cn/bin/v1.0/Modules/PSWorkflow/PSWorkflow.psd1 b/newton-cn/bin/v1.0/Modules/PSWorkflow/PSWorkflow.psd1 new file mode 100644 index 0000000..b618efe --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSWorkflow/PSWorkflow.psd1 @@ -0,0 +1,16 @@ +@{ +GUID="{3b6cc51d-c096-4b38-b78d-0fed6277096a}" +Author="Microsoft Corporation" +CompanyName="Microsoft Corporation" +Copyright="© Microsoft Corporation. All rights reserved." +ModuleVersion="2.0.0.0" +PowerShellVersion = '5.1' +CLRVersion="4.0" +CmdletsToExport='New-PSWorkflowExecutionOption' +AliasesToExport = 'nwsn' +FunctionsToExport = 'New-PSWorkflowSession' +NestedModules="Microsoft.PowerShell.Activities","Microsoft.PowerShell.Workflow.ServiceCore","PSWorkflow.psm1" +TypesToProcess="PSWorkflow.types.ps1xml" +HelpInfoURI = 'https://go.microsoft.com/fwlink/?linkid=390817' +CompatiblePSEditions = @('Desktop') +} diff --git a/newton-cn/bin/v1.0/Modules/PSWorkflow/PSWorkflow.psm1 b/newton-cn/bin/v1.0/Modules/PSWorkflow/PSWorkflow.psm1 new file mode 100644 index 0000000..ea10548 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSWorkflow/PSWorkflow.psm1 differ diff --git a/newton-cn/bin/v1.0/Modules/PSWorkflow/PSWorkflow.types.ps1xml b/newton-cn/bin/v1.0/Modules/PSWorkflow/PSWorkflow.types.ps1xml new file mode 100644 index 0000000..267a72e Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSWorkflow/PSWorkflow.types.ps1xml differ diff --git a/newton-cn/bin/v1.0/Modules/PSWorkflowUtility/PSWorkflowUtility.psd1 b/newton-cn/bin/v1.0/Modules/PSWorkflowUtility/PSWorkflowUtility.psd1 new file mode 100644 index 0000000..6ea66b7 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PSWorkflowUtility/PSWorkflowUtility.psd1 @@ -0,0 +1,15 @@ +@{ +GUID="{e40bae2f-9558-479f-939b-e52407a19c86}" +Author="Microsoft Corporation" +CompanyName="Microsoft Corporation" +Copyright="© Microsoft Corporation. All rights reserved." +ModuleVersion="1.0.0.0" +PowerShellVersion = '5.1' +CLRVersion="4.0" +AliasesToExport = @() +CmdletsToExport = @() +FunctionsToExport = 'Invoke-AsWorkflow' +NestedModules="PSWorkflowUtility.psm1" +HelpInfoURI = 'https://go.microsoft.com/fwlink/?linkid=390818' +CompatiblePSEditions = @('Desktop') +} diff --git a/newton-cn/bin/v1.0/Modules/PSWorkflowUtility/PSWorkflowUtility.psm1 b/newton-cn/bin/v1.0/Modules/PSWorkflowUtility/PSWorkflowUtility.psm1 new file mode 100644 index 0000000..839010c Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PSWorkflowUtility/PSWorkflowUtility.psm1 differ diff --git a/newton-cn/bin/v1.0/Modules/PcsvDevice/CIM_PhysicalComputerSystemView.cdxml b/newton-cn/bin/v1.0/Modules/PcsvDevice/CIM_PhysicalComputerSystemView.cdxml new file mode 100644 index 0000000..685a375 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PcsvDevice/CIM_PhysicalComputerSystemView.cdxml @@ -0,0 +1,275 @@ + + + + 1.0 + PcsvDevice + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PcsvDevice/PcsvDevice.format.ps1xml b/newton-cn/bin/v1.0/Modules/PcsvDevice/PcsvDevice.format.ps1xml new file mode 100644 index 0000000..f776532 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PcsvDevice/PcsvDevice.format.ps1xml @@ -0,0 +1,56 @@ + + + + + Table + + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/HardwareManagement/MSFT_PCSVDevice + + + + + + 25 + + + + 25 + + + + 25 + + + + 15 + + + + 17 + + + + + + + TargetAddress + + + Manufacturer + + + Model + + + SerialNumber + + + Status + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PcsvDevice/PcsvDevice.psd1 b/newton-cn/bin/v1.0/Modules/PcsvDevice/PcsvDevice.psd1 new file mode 100644 index 0000000..843340a --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PcsvDevice/PcsvDevice.psd1 @@ -0,0 +1,26 @@ +@{ + GUID = '576ff287-7d01-46a3-8a88-94df7581a2b0' + Author="Microsoft Corporation" + CompanyName="Microsoft" + Copyright="© Microsoft. All rights reserved." + HelpInfoUri="http://go.microsoft.com/fwlink/?linkid=390809" + NestedModules = @('CIM_PhysicalComputerSystemView.cdxml') + ModuleVersion = '1.0.0.0' + AliasesToExport = @() + CmdletsToExport = @() + FunctionsToExport = @( + 'Get-PcsvDevice', + 'Start-PcsvDevice', + 'Stop-PcsvDevice', + 'Restart-PcsvDevice', + 'Set-PcsvDeviceBootConfiguration', + 'Set-PcsvDeviceNetworkConfiguration', + 'Set-PcsvDeviceUserPassword', + 'Clear-PcsvDeviceLog', + 'Get-PcsvDeviceLog' + ) + PowerShellVersion = '5.1' + TypesToProcess = @('PCSVDevice.types.ps1xml') + FormatsToProcess = @('PCSVDevice.format.ps1xml') + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/PcsvDevice/PcsvDevice.types.ps1xml b/newton-cn/bin/v1.0/Modules/PcsvDevice/PcsvDevice.types.ps1xml new file mode 100644 index 0000000..050811f --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PcsvDevice/PcsvDevice.types.ps1xml @@ -0,0 +1,28 @@ + + + + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/HardwareManagement/MSFT_PCSVDevice + + + Status + + $cimValue = $this.PSBase.CimInstanceProperties['EnabledState'].Value + if ($cimValue -eq $null) + { + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PcsvDevice.State]::Unknown + } + else + { + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PcsvDevice.State]$cimValue + } + + + + Name + + $this.PSBase.CimSystemProperties['ServerName'].Value + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PersistentMemory/Microsoft.Storage.PersistentMemory.Management.Commands.dll b/newton-cn/bin/v1.0/Modules/PersistentMemory/Microsoft.Storage.PersistentMemory.Management.Commands.dll new file mode 100644 index 0000000..b9db44c Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PersistentMemory/Microsoft.Storage.PersistentMemory.Management.Commands.dll differ diff --git a/newton-cn/bin/v1.0/Modules/PersistentMemory/PersistentMemory.psd1 b/newton-cn/bin/v1.0/Modules/PersistentMemory/PersistentMemory.psd1 new file mode 100644 index 0000000..d0d31c7 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PersistentMemory/PersistentMemory.psd1 @@ -0,0 +1,53 @@ +# +# Module manifest for the persistent memory management module. +# +# Generated by: Microsoft Corporation +# + +@{ + +# Script module or binary module file associated with this manifest +RootModule = 'Microsoft.Storage.PersistentMemory.Management.Commands.dll' + +# Version number of this module. +ModuleVersion = '1.0.0.0' + +# ID used to uniquely identify this module +GUID = 'E5905ED9-12BC-4765-B20D-40A37D69C3DD' + +# Author of this module +Author = 'Microsoft Corporation' + +# Company or vendor of this module +CompanyName = 'Microsoft Corporation' + +# Copyright statement for this module +Copyright = '(c) Microsoft Corporation. All rights reserved.' + +# Minimum version of the Windows PowerShell engine required by this module +PowerShellVersion = '5.1' + +# Minimum version of the common language runtime (CLR) required by this module +CLRVersion = '4.0' + +# Format files (.ps1xml) to be loaded when importing this module +FormatsToProcess = @( + 'PmemPhysicalDevice.ps1xml', + 'PmemDisk.ps1xml' + ) + +# Cmdlets to export from this module +CmdletsToExport = @( + 'Get-PmemDisk', + 'Get-PmemPhysicalDevice', + 'Get-PmemUnusedRegion', + 'New-PmemDisk', + 'Remove-PmemDisk', + 'Initialize-PmemPhysicalDevice' + ) + +# HelpInfo - TBD +# HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=390775" + +CompatiblePSEditions = @('Desktop') +} diff --git a/newton-cn/bin/v1.0/Modules/PersistentMemory/PmemDisk.ps1xml b/newton-cn/bin/v1.0/Modules/PersistentMemory/PmemDisk.ps1xml new file mode 100644 index 0000000..b526004 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PersistentMemory/PmemDisk.ps1xml @@ -0,0 +1,52 @@ + + + + + Persistent memory disk + + Microsoft.Storage.PersistentMemory.Management.PmemDisk + + + + + + + + + + + + + + + + + + DiskNumber + + + + "{0:#.##}" -f ($_.SizeInBytes / 1GB) + " GB" + + + HealthStatus + + + AtomicityType + + + CanBeRemoved + + + PhysicalDeviceIds + + + UnsafeShutdownCount + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PersistentMemory/PmemPhysicalDevice.ps1xml b/newton-cn/bin/v1.0/Modules/PersistentMemory/PmemPhysicalDevice.ps1xml new file mode 100644 index 0000000..32824ef --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PersistentMemory/PmemPhysicalDevice.ps1xml @@ -0,0 +1,64 @@ + + + + + Physical persistent memory device + + Microsoft.Storage.PersistentMemory.Management.PmemPhysicalDevice + + + + + + + + + + + + + + + + + + + + + DeviceId + + + DeviceType + + + HealthStatus + + + OperationalStatus + + + PhysicalLocation + + + FirmwareRevision + + + + "{0:0.##}" -f ($_.PersistentMemorySizeInBytes / 1GB) + " GB" + + + + if ($_.VolatileMemorySizeInBytes -eq $null) { + "Unknown" + } else { + "{0:0.##}" -f ($_.VolatileMemorySizeInBytes / 1GB) + " GB" + } + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PersistentMemory/ko/Microsoft.Storage.PersistentMemory.Management.Commands.Resources.dll b/newton-cn/bin/v1.0/Modules/PersistentMemory/ko/Microsoft.Storage.PersistentMemory.Management.Commands.Resources.dll new file mode 100644 index 0000000..c00c048 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PersistentMemory/ko/Microsoft.Storage.PersistentMemory.Management.Commands.Resources.dll differ diff --git a/newton-cn/bin/v1.0/Modules/PersistentMemory/scmbridge.dll b/newton-cn/bin/v1.0/Modules/PersistentMemory/scmbridge.dll new file mode 100644 index 0000000..d176454 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PersistentMemory/scmbridge.dll differ diff --git a/newton-cn/bin/v1.0/Modules/PnpDevice/PnpDevice.Format.ps1xml b/newton-cn/bin/v1.0/Modules/PnpDevice/PnpDevice.Format.ps1xml new file mode 100644 index 0000000..fca9c64 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PnpDevice/PnpDevice.Format.ps1xml @@ -0,0 +1,96 @@ + + + + + + Win32_PnPDeviceProperty.TableView + + Microsoft.Management.Infrastructure.CimInstance#ROOT/cimv2/Win32_PnPDeviceProperty + Microsoft.Management.Infrastructure.CimInstance#Win32_PnPDeviceProperty + + + + + 10 + + + 41 + + + 10 + + + 59 + + + + + + + InstanceId + + + KeyName + + + Type + + + Data + + + + + + + + PnpDevice.TableView + + Microsoft.Management.Infrastructure.CimInstance#Win32_PnPEntity + Microsoft.Management.Infrastructure.CimInstance#ROOT/cimv2/Win32_PnPEntity + + + + + 10 + + + 15 + + + 80 + + + 15 + + + + + + + Status + + + Class + + + FriendlyName + + + InstanceId + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PnpDevice/PnpDevice.Resource.psd1 b/newton-cn/bin/v1.0/Modules/PnpDevice/PnpDevice.Resource.psd1 new file mode 100644 index 0000000..5458ed4 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PnpDevice/PnpDevice.Resource.psd1 @@ -0,0 +1,72 @@ +######################################################################################### +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# Localized PnpDevice.Resource.psd1 +# +######################################################################################### + +ConvertFrom-StringData @' +###PSLOC + IDS_PROB_NOT_CONFIGURED=This device is not configured correctly. {0} + IDS_PROB_DEVLOADERFAILED=Windows cannot load the driver for this device. {0} + IDS_PROB_OUT_OF_MEMORY=The driver for this device might be corrupted, or your system may be running low on memory or other resources. {0} + IDS_PROB_WRONG_TYPE=This device is not working properly. One of its drivers or your registry might be corrupted. {0} + IDS_PROB_LACKEDARBITRATOR=The driver for this device needs a resource that Windows cannot manage. {0} + IDS_PROB_BOOT_CONFIG_CONFLICT=The boot configuration for this device conflicts with other devices. {0} + IDS_PROB_FAILED_FILTER=Cannot filter. {0} + IDS_PROB_DEVLOADER_NOT_FOUND=The driver loader for the device is missing. {0} + IDS_PROB_INVALID_DATA=Windows cannot identify this hardware because it does not have a valid hardware identification number. {0}\r\n\r\nFor assistance, contact the hardware manufacturer. + IDS_PROB_FAILED_START=This device cannot start. {0} + IDS_PROB_LIAR=This device failed. {0} + IDS_PROB_NORMAL_CONFLICT=This device cannot find enough free resources that it can use. {0}\r\n\r\nIf you want to use this device, you will need to disable one of the other devices on this system. + IDS_PROB_NOT_VERIFIED=Windows cannot verify this device's resources. {0} + IDS_PROB_NEEDRESTART=This device cannot work properly until you restart your computer. {0} + IDS_PROB_REENUMERATION=This device is not working properly because there is probably a reenumeration problem. {0} + IDS_PROB_PARTIALCONFIG=Windows cannot identify all the resources this device uses. {0} + IDS_PROB_UNKNOWN_RESOURCE=This device is asking for an unknown resource type. {0} + IDS_PROB_REINSTALL=Reinstall the drivers for this device. {0} + IDS_PROB_REGISTRY=Windows cannot start this hardware device because its configuration information (in the registry) is incomplete or damaged. {0} + IDS_PROB_WILL_BE_REMOVED=Windows is uninstalling this device. {0} + IDS_PROB_DISABLED=This device is disabled. {0} + IDS_DEVICE_NOT_THERE=This device is not present, is not working properly, or does not have all its drivers installed. {0} + IDS_PROB_MOVED=Windows is still setting up this device. {0} + IDS_PROB_TOO_EARLY=Windows is still setting up this device. {0} + IDS_PROB_NO_VALID_LOG_CONF=This device does not have valid log configuration. {0} + IDS_PROB_FAILEDINSTALL=The drivers for this device are not installed. {0} + IDS_PROB_HARDWAREDISABLED=This device is disabled because the firmware of the device did not give it the required resources. {0} + IDS_PROB_CANT_SHARE_IRQ=This device is using an Interrupt Request (IRQ) resource that another device is using. {0} + IDS_PROB_FAILED_ADD=This device is not working properly because Windows cannot load the drivers required for this device. {0} + IDS_PROB_DISABLED_SERVICE=A driver (service) for this device has been disabled. An alternate driver may be providing this functionality. {0} + IDS_PROB_TRANSLATION_FAILED=Windows cannot determine which resources are required for this device. {0} + IDS_PROB_NO_SOFTCONFIG=Windows cannot determine the settings for this device. Consult the documentation that came with this device and use the Resource tab to set the configuration. {0} + IDS_PROB_BIOS_TABLE=Your computer's system firmware does not include enough information to properly configure and use this device. To use this device, contact your computer manufacturer to obtain a firmware or BIOS update. {0} + IDS_PROB_IRQ_TRANSLATION_FAILED=This device is requesting a PCI interrupt but is configured for an ISA interrupt (or vice versa). Please use the computer's system setup program to reconfigure the interrupt for this device. {0} + IDS_PROB_FAILED_DRIVER_ENTRY=Windows cannot initialize the device driver for this hardware. {0} + IDS_PROB_DRIVER_FAILED_PRIOR_UNLOAD=Windows cannot load the device driver for this hardware because a previous instance of the device driver is still in memory. {0} + IDS_PROB_DRIVER_FAILED_LOAD=Windows cannot load the device driver for this hardware. The driver may be corrupted or missing. {0} + IDS_PROB_DRIVER_SERVICE_KEY_INVALID=Windows cannot access this hardware because its service key information in the registry is missing or recorded incorrectly. {0} + IDS_PROB_LEGACY_SERVICE_NO_DEVICES=Windows successfully loaded the device driver for this hardware but cannot find the hardware device. {0} + IDS_PROB_DUPLICATE_DEVICE=Windows cannot load the device driver for this hardware because there is a duplicate device already running in the system. {0} + IDS_PROB_FAILED_POST_START=Windows has stopped this device because it has reported problems. {0} + IDS_PROB_HALTED=An application or service has shut down this hardware device. {0} + IDS_PROB_PHANTOM=Currently, this hardware device is not connected to the computer. {0}\r\n\r\nTo fix this problem, reconnect this hardware device to the computer. + IDS_PROB_SYSTEM_SHUTDOWN=Windows cannot gain access to this hardware device because the operating system is in the process of shutting down. {0}\r\n\r\nThe hardware device should work correctly next time you start your computer. + IDS_PROB_HELD_FOR_EJECT=Windows cannot use this hardware device because it has been prepared for ""safe removal"", but it has not been removed from the computer. {0}\r\n\r\nTo fix this problem, unplug this device from your computer and then plug it in again. + IDS_PROB_DRIVER_BLOCKED=The software for this device has been blocked from starting because it is known to have problems with Windows. Contact the hardware vendor for a new driver. {0} + IDS_PROB_REGISTRY_TOO_LARGE=Windows cannot start new hardware devices because the system hive is too large (exceeds the Registry Size Limit). {0}\r\n\r\nTo fix this problem, you should first try uninstalling any hardware devices that you are no longer using. If that doesn't solve the problem, then you will have to reinstall Windows. + IDS_PROB_SETPROPERTIES_FAILED=Windows cannot apply all of the properties for this device. Device properties may include information that describes the device's capabilities and settings (such as security settings for example). {0}\r\n\r\nTo fix this problem, you can try reinstalling this device. However, it is recommended that you contact the hardware manufacturer for a new driver. + IDS_PROB_SYSTEMFAILURE=System failure: Try changing the driver for this device. If that doesn't work, see your hardware documentation. {0} + IDS_PROB_NOPROBLEM=This device is working properly. + IDS_PROB_UNKNOWN=This device has a problem, but Windows cannot determine what the problem is. + IDS_PROB_UNKNOWN_WITHCODE=This device has a problem that Windows cannot identify. {0} + IDS_PROB_CODE=(Code {0}). + IDS_PROB_WAITING_ON_DEPENDENCY=This device is currently waiting on another device or set of devices to start. {0} + IDS_PROB_UNSIGNED_DRIVER=Windows cannot verify the digital signature for the drivers required for this device. A recent hardware or software change might have installed a file that is signed incorrectly or damaged, or that might be malicious software from an unknown source. {0} + IDS_PROB_USED_BY_DEBUGGER=This device has been reserved for use by the Windows kernel debugger for the duration of this boot session. {0} + IDS_PROB_DEVICE_RESET=This device has failed and is undergoing a reset. {0} + IDS_PROB_CONSOLE_LOCKED=This device is blocked from starting while the user is not logged in. {0} + IDS_PROB_NEED_CLASS_CONFIG=Windows is still setting up the class configuration for this device. {0} + IDS_PROB_GUEST_ASSIGNMENT_FAILED=This device could not be assigned to a guest partition. {0} +###PSLOCC +'@ \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PnpDevice/PnpDevice.Types.ps1xml b/newton-cn/bin/v1.0/Modules/PnpDevice/PnpDevice.Types.ps1xml new file mode 100644 index 0000000..c54062a --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PnpDevice/PnpDevice.Types.ps1xml @@ -0,0 +1,283 @@ + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Cimv2/Win32_PnPEntity + + + Class + PNPClass + + + FriendlyName + Name + + + InstanceId + DeviceID + + + Problem + ConfigManagerErrorCode + + + ConfigManagerErrorCode + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PnpDevice.Problem]($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value) + + + + ProblemDescription + + Microsoft.PowerShell.Utility\Import-LocalizedData LocalizedData -filename PnpDevice.Resource.psd1 + switch([Microsoft.PowerShell.Cmdletization.GeneratedTypes.PnpDevice.Problem]($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + { + CM_PROB_NONE + { + $str = $LocalizedData.IDS_PROB_NOPROBLEM + } + CM_PROB_NOT_CONFIGURED + { + $str = $LocalizedData.IDS_PROB_NOT_CONFIGURED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_DEVLOADER_FAILED + { + $str = $LocalizedData.IDS_PROB_DEVLOADERFAILED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_OUT_OF_MEMORY + { + $str = $LocalizedData.IDS_PROB_OUT_OF_MEMORY -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_ENTRY_IS_WRONG_TYPE + { + $str = $LocalizedData.IDS_PROB_WRONG_TYPE -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_LACKED_ARBITRATOR + { + $str = $LocalizedData.IDS_PROB_LACKEDARBITRATOR -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_BOOT_CONFIG_CONFLICT + { + $str = $LocalizedData.IDS_PROB_BOOT_CONFIG_CONFLICT -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_FAILED_FILTER + { + $str = $LocalizedData.IDS_PROB_FAILED_FILTER -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_DEVLOADER_NOT_FOUND + { + $str = $LocalizedData.IDS_PROB_DEVLOADER_NOT_FOUND -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_INVALID_DATA + { + $str = $LocalizedData.IDS_PROB_INVALID_DATA -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_FAILED_START + { + $str = $LocalizedData.IDS_PROB_FAILED_START -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_LIAR + { + $str = $LocalizedData.IDS_PROB_LIAR -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_NORMAL_CONFLICT + { + $str = $LocalizedData.IDS_PROB_NORMAL_CONFLICT -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_NOT_VERIFIED + { + $str = $LocalizedData.IDS_PROB_NOT_VERIFIED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_NEED_RESTART + { + $str = $LocalizedData.IDS_PROB_NEEDRESTART -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_REENUMERATION + { + $str = $LocalizedData.IDS_PROB_REENUMERATION -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_PARTIAL_LOG_CONF + { + $str = $LocalizedData.IDS_PROB_PARTIALCONFIG -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_UNKNOWN_RESOURCE + { + $str = $LocalizedData.IDS_PROB_UNKNOWN_RESOURCE -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_REINSTALL + { + $str = $LocalizedData.IDS_PROB_REINSTALL -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_REGISTRY + { + $str = $LocalizedData.IDS_PROB_REGISTRY -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_WILL_BE_REMOVED + { + $str = $LocalizedData.IDS_PROB_WILL_BE_REMOVED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_DISABLED + { + $str = $LocalizedData.IDS_PROB_DISABLED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_DEVICE_NOT_THERE + { + $str = $LocalizedData.IDS_DEVICE_NOT_THERE -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_MOVED + { + $str = $LocalizedData.IDS_PROB_MOVED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_TOO_EARLY + { + $str = $LocalizedData.IDS_PROB_TOO_EARLY -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_NO_VALID_LOG_CONF + { + $str = $LocalizedData.IDS_PROB_NO_VALID_LOG_CONF -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_FAILED_INSTALL + { + $str = $LocalizedData.IDS_PROB_FAILEDINSTALL -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_HARDWARE_DISABLED + { + $str = $LocalizedData.IDS_PROB_HARDWAREDISABLED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_CANT_SHARE_IRQ + { + $str = $LocalizedData.IDS_PROB_CANT_SHARE_IRQ -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_FAILED_ADD + { + $str = $LocalizedData.IDS_PROB_FAILED_ADD -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_DISABLED_SERVICE + { + $str = $LocalizedData.IDS_PROB_DISABLED_SERVICE -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_TRANSLATION_FAILED + { + $str = $LocalizedData.IDS_PROB_TRANSLATION_FAILED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_NO_SOFTCONFIG + { + $str = $LocalizedData.IDS_PROB_NO_SOFTCONFIG -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_BIOS_TABLE + { + $str = $LocalizedData.IDS_PROB_BIOS_TABLE -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_IRQ_TRANSLATION_FAILED + { + $str = $LocalizedData.IDS_PROB_IRQ_TRANSLATION_FAILED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_FAILED_DRIVER_ENTRY + { + $str = $LocalizedData.IDS_PROB_FAILED_DRIVER_ENTRY -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_DRIVER_FAILED_PRIOR_UNLOAD + { + $str = $LocalizedData.IDS_PROB_DRIVER_FAILED_PRIOR_UNLOAD -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_DRIVER_FAILED_LOAD + { + $str = $LocalizedData.IDS_PROB_DRIVER_FAILED_LOAD -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_DRIVER_SERVICE_KEY_INVALID + { + $str = $LocalizedData.IDS_PROB_DRIVER_SERVICE_KEY_INVALID -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_LEGACY_SERVICE_NO_DEVICES + { + $str = $LocalizedData.IDS_PROB_LEGACY_SERVICE_NO_DEVICES -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_DUPLICATE_DEVICE + { + $str = $LocalizedData.IDS_PROB_DUPLICATE_DEVICE -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_FAILED_POST_START + { + $str = $LocalizedData.IDS_PROB_FAILED_POST_START -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_HALTED + { + $str = $LocalizedData.IDS_PROB_HALTED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_PHANTOM + { + $str = $LocalizedData.IDS_PROB_PHANTOM -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_SYSTEM_SHUTDOWN + { + $str = $LocalizedData.IDS_PROB_SYSTEM_SHUTDOWN -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_HELD_FOR_EJECT + { + $str = $LocalizedData.IDS_PROB_HELD_FOR_EJECT -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_DRIVER_BLOCKED + { + $str = $LocalizedData.IDS_PROB_DRIVER_BLOCKED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_REGISTRY_TOO_LARGE + { + $str = $LocalizedData.IDS_PROB_REGISTRY_TOO_LARGE -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_SETPROPERTIES_FAILED + { + $str = $LocalizedData.IDS_PROB_SETPROPERTIES_FAILED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_WAITING_ON_DEPENDENCY + { + $str = $LocalizedData.IDS_PROB_WAITING_ON_DEPENDENCY -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_UNSIGNED_DRIVER + { + $str = $LocalizedData.IDS_PROB_UNSIGNED_DRIVER -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_USED_BY_DEBUGGER + { + $str = $LocalizedData.IDS_PROB_USED_BY_DEBUGGER -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_DEVICE_RESET + { + $str = $LocalizedData.IDS_PROB_DEVICE_RESET -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_CONSOLE_LOCKED + { + $str = $LocalizedData.IDS_PROB_CONSOLE_LOCKED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_NEED_CLASS_CONFIG + { + $str = $LocalizedData.IDS_PROB_NEED_CLASS_CONFIG -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + CM_PROB_GUEST_ASSIGNMENT_FAILED + { + $str = $LocalizedData.IDS_PROB_GUEST_ASSIGNMENT_FAILED -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + Default + { + $str = $LocalizedData.IDS_PROB_UNKNOWN_WITHCODE -f ($LocalizedData.IDS_PROB_CODE -f ($this.PSBase.CimInstanceProperties['ConfigManagerErrorCode'].Value)) + } + } + return $str + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Cimv2/Win32_PnPDeviceProperty + + + InstanceId + DeviceID + + + Type + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PnpDeviceProperty.Type]($this.PSBase.CimInstanceProperties['Type'].Value) + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PnpDevice/PnpDevice.cdxml b/newton-cn/bin/v1.0/Modules/PnpDevice/PnpDevice.cdxml new file mode 100644 index 0000000..7ee672b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PnpDevice/PnpDevice.cdxml @@ -0,0 +1,268 @@ + + + + 1.0 + PnpDevice + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OK + ERROR + DEGRADED + UNKNOWN + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PnpDevice/PnpDevice.psd1 b/newton-cn/bin/v1.0/Modules/PnpDevice/PnpDevice.psd1 new file mode 100644 index 0000000..628f8a9 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PnpDevice/PnpDevice.psd1 @@ -0,0 +1,28 @@ +@{ + GUID = 'ad34bc8b-1cf8-47d8-bd82-f681c5358e1c' + Author = "Microsoft Corporation" + CompanyName = "Microsoft Corporation" + Copyright = "© Microsoft Corporation. All rights reserved." + ModuleVersion = '1.0.0.0' + PowerShellVersion = '5.1' + HelpInfoUri="https://go.microsoft.com/fwlink/?LinkID=524801" + NestedModules = @( + 'PnpDevice.cdxml') + TypesToProcess = @( + 'PnpDevice.Types.ps1xml') + FormatsToProcess = @( + 'PnpDevice.format.ps1xml') + FileList = @( + 'PnpDevice.cdxml', + 'PnpDevice.Types.ps1xml', + 'PnpDevice.format.ps1xml', + 'PnpDevice.Resource.psd1') + AliasesToExport = @() + CmdletsToExport = @() + FunctionsToExport = @( + 'Get-PnpDevice', + 'Get-PnpDeviceProperty', + 'Enable-PnpDevice', + 'Disable-PnpDevice') + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_3DPrinter.format.ps1xml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_3DPrinter.format.ps1xml new file mode 100644 index 0000000..c874ce0 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_3DPrinter.format.ps1xml @@ -0,0 +1,150 @@ + + + + + + Formatting For MSFT_3DPrinter (Table View) + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_3DPrinter + + + + + 30 + + + 15 + + + 12 + + + 25 + + + 15 + + + 8 + + + 10 + + + 15 + + + + + + + Name + + + ComputerName + + + Type + + + DriverName + + + PortName + + + Shared + + + Published + + + DeviceType + + + + + + + + Formatting For MSFT_3DPrinter (List View) + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_3DPrinter + + + + + + + Name + + + ComputerName + + + Type + + + ShareName + + + PortName + + + DriverName + + + Location + + + Comment + + + PrintProcessor + + + Datatype + + + Shared + + + Published + + + DeviceType + + + PermissionSDDL + + + Priority + + + DefaultJobPriority + + + StartTime + + + UntilTime + + + PrinterStatus + + + JobCount + + + DisableBranchOfficeLogging + + + BranchOfficeOfflineLogSizeMB + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_3DPrinter_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_3DPrinter_v1.0.cdxml new file mode 100644 index 0000000..9ed4c73 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_3DPrinter_v1.0.cdxml @@ -0,0 +1,7 @@ + + + + 1.0 + Printer + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_AdaptivePrinterPort.format.ps1xml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_AdaptivePrinterPort.format.ps1xml new file mode 100644 index 0000000..18a8a87 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_AdaptivePrinterPort.format.ps1xml @@ -0,0 +1,80 @@ + + + + + Formatting For MSFT_AdaptivePrinterPort (Table View) + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_AdaptivePrinterPort + + + + + 20 + + + 20 + + + 20 + + + 20 + + + + + + + Name + + + ComputerName + + + Description + + + DiscoveryMethod + + + + + + + + Formatting For MSFT_AdaptivePrinterPort (List View) + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_AdaptivePrinterPort + + + + + + + Name + + + ComputerName + + + Description + + + DiscoveryMethod + + + DeviceUUID + + + DeviceURL + + + IppURL + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_AdaptivePrinterPort.types.ps1xml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_AdaptivePrinterPort.types.ps1xml new file mode 100644 index 0000000..81c3bfe --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_AdaptivePrinterPort.types.ps1xml @@ -0,0 +1,15 @@ + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_AdaptivePrinterPort + + + DiscoveryMethod + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.AdaptivePrinterPort.DiscoveryMethodEnum]($this.PSBase.CimInstanceProperties['DiscoveryMethod'].Value) + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_AdaptivePrinterPort_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_AdaptivePrinterPort_v1.0.cdxml new file mode 100644 index 0000000..3fa116a --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_AdaptivePrinterPort_v1.0.cdxml @@ -0,0 +1,13 @@ + + + + 1.0 + PrinterPort + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_LocalPrinterPort.format.ps1xml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_LocalPrinterPort.format.ps1xml new file mode 100644 index 0000000..2e9c8c4 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_LocalPrinterPort.format.ps1xml @@ -0,0 +1,62 @@ + + + + + Formatting For MSFT_LocalPrinterPort (Table View) + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_LocalPrinterPort + + + + + 20 + + + 20 + + + 20 + + + + + + + Name + + + ComputerName + + + Description + + + + + + + + Formatting For MSFT_LocalPrinterPort (List View) + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_LocalPrinterPort + + + + + + + Name + + + ComputerName + + + Description + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_LocalPrinterPort_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_LocalPrinterPort_v1.0.cdxml new file mode 100644 index 0000000..8c81736 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_LocalPrinterPort_v1.0.cdxml @@ -0,0 +1,7 @@ + + + + 1.0 + PrinterPort + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_LprPrinterPort.format.ps1xml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_LprPrinterPort.format.ps1xml new file mode 100644 index 0000000..b6f0ecc --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_LprPrinterPort.format.ps1xml @@ -0,0 +1,68 @@ + + + + + Formatting For MSFT_LprPrinterPort (Table View) + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_LprPrinterPort + + + + + 20 + + + 20 + + + 20 + + + + + + + Name + + + ComputerName + + + Description + + + + + + + + Formatting For MSFT_LprPrinterPort (List View) + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_LprPrinterPort + + + + + + + Name + + + ComputerName + + + Description + + + HostName + + + PrinterName + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_LprPrinterPort_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_LprPrinterPort_v1.0.cdxml new file mode 100644 index 0000000..c70d662 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_LprPrinterPort_v1.0.cdxml @@ -0,0 +1,7 @@ + + + + 1.0 + PrinterPort + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrintJob.format.ps1xml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrintJob.format.ps1xml new file mode 100644 index 0000000..8ef8bc9 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrintJob.format.ps1xml @@ -0,0 +1,116 @@ + + + + + + Formatting For MSFT_PrintJob (Table View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_PrintJob + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrintJob + + + + + 5 + + + 15 + + + 15 + + + 20 + + + 20 + + + 15 + + + + + + + Id + + + ComputerName + + + PrinterName + + + DocumentName + + + SubmittedTime + + + JobStatus + + + + + + + + Formatting For MSFT_PrintJob (List View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_PrintJob + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrintJob + + + + + + + Id + + + ComputerName + + + PrinterName + + + UserName + + + DocumentName + + + Datatype + + + Priority + + + Position + + + SubmittedTime + + + Size + + + JobTime + + + PagesPrinted + + + TotalPages + + + JobStatus + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrintJob.types.ps1xml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrintJob.types.ps1xml new file mode 100644 index 0000000..b334c47 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrintJob.types.ps1xml @@ -0,0 +1,26 @@ + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrintJob + + + JobStatus + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PrintJob.JobStatus]($this.PSBase.CimInstanceProperties['JobStatus'].Value) + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_PrintJob + + + JobStatus + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PrintJob.JobStatus]($this.PSBase.CimInstanceProperties['JobStatus'].Value) + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrintJob_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrintJob_v1.0.cdxml new file mode 100644 index 0000000..5a0a7b4 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrintJob_v1.0.cdxml @@ -0,0 +1,386 @@ + + + + 1.0 + PrintJob + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_Printer.format.ps1xml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_Printer.format.ps1xml new file mode 100644 index 0000000..fc3dfca --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_Printer.format.ps1xml @@ -0,0 +1,163 @@ + + + + + + Formatting For MSFT_Printer (Table View for ALL subclasses.) + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_Printer + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_3DPrinter + + + + + 30 + + + 15 + + + 12 + + + 25 + + + 15 + + + 8 + + + 10 + + + 15 + + + + + + + Name + + + ComputerName + + + Type + + + DriverName + + + PortName + + + Shared + + + Published + + + DeviceType + + + + + + + + Formatting For MSFT_Printer (List View) + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_Printer + + + + + + + Name + + + ComputerName + + + Type + + + ShareName + + + PortName + + + DriverName + + + Location + + + Comment + + + SeparatorPageFile + + + PrintProcessor + + + Datatype + + + Shared + + + Published + + + DeviceType + + + PermissionSDDL + + + RenderingMode + + + KeepPrintedJobs + + + Priority + + + DefaultJobPriority + + + StartTime + + + UntilTime + + + PrinterStatus + + + JobCount + + + DisableBranchOfficeLogging + + + BranchOfficeOfflineLogSizeMB + + + WorkflowPolicy + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_Printer.types.ps1xml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_Printer.types.ps1xml new file mode 100644 index 0000000..9515faa --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_Printer.types.ps1xml @@ -0,0 +1,38 @@ + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_Printer + + + RenderingMode + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Printer.RenderingModeEnum]($this.PSBase.CimInstanceProperties['RenderingMode'].Value) + + + param($value) + $this.PSBase.CimInstanceProperties['RenderingMode'].Value = + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Printer.RenderingModeEnum]$value + + + + PrinterStatus + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Printer.PrinterStatus]($this.PSBase.CimInstanceProperties['PrinterStatus'].Value) + + + + Type + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Printer.TypeEnum]($this.PSBase.CimInstanceProperties['Type'].Value) + + + + DeviceType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.Printer.DeviceTypeEnum]($this.PSBase.CimInstanceProperties['DeviceType'].Value) + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterConfiguration.format.ps1xml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterConfiguration.format.ps1xml new file mode 100644 index 0000000..918a146 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterConfiguration.format.ps1xml @@ -0,0 +1,86 @@ + + + + + + Formatting For MSFT_PrinterConfiguration (Table View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_PrinterConfiguration + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterConfiguration + + + + + 15 + + + 15 + + + 10 + + + 10 + + + 20 + + + + + + + PrinterName + + + ComputerName + + + Collate + + + Color + + + DuplexingMode + + + + + + + + Formatting For MSFT_PrinterConfiguration (List View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_PrinterConfiguration + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterConfiguration + + + + + + + PrinterName + + + ComputerName + + + Collate + + + Color + + + DuplexingMode + + + PaperSize + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterConfiguration.types.ps1xml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterConfiguration.types.ps1xml new file mode 100644 index 0000000..0567215 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterConfiguration.types.ps1xml @@ -0,0 +1,31 @@ + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_PrinterConfiguration + + + DuplexingMode + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PrinterConfiguration.DuplexingModeEnum]($this.PSBase.CimInstanceProperties['DuplexingMode'].Value) + + + param($value) + $this.PSBase.CimInstanceProperties['DuplexingMode'].Value = + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PrinterConfiguration.DuplexingModeEnum]$value + + + + PaperSize + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PrinterConfiguration.PaperSizeEnum]($this.PSBase.CimInstanceProperties['PaperSize'].Value) + + + param($value) + $this.PSBase.CimInstanceProperties['PaperSize'].Value = + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PrinterConfiguration.PaperSizeEnum]$value + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterConfiguration_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterConfiguration_v1.0.cdxml new file mode 100644 index 0000000..293d5a8 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterConfiguration_v1.0.cdxml @@ -0,0 +1,323 @@ + + + + 1.0 + PrintConfiguration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterDriver.format.ps1xml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterDriver.format.ps1xml new file mode 100644 index 0000000..699a36c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterDriver.format.ps1xml @@ -0,0 +1,131 @@ + + + + + Formatting For MSFT_PrinterDriver (Table View) + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterDriver + + + + + 35 + + + 18 + + + 15 + + + 25 + + + + + + + Name + + + PrinterEnvironment + + + MajorVersion + + + Manufacturer + + + + + + + + Formatting For MSFT_PrinterDriver (List View) + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterDriver + + + + + + + Name + + + ComputerName + + + PrinterEnvironment + + + Path + + + DataFile + + + ConfigFile + + + HelpFile + + + DependentFiles + + + Monitor + + + DefaultDatatype + + + Date + + + MajorVersion + + + DriverVersion + + + Manufacturer + + + OEMUrl + + + HardwareID + + + Provider + + + PrintProcessor + + + VendorSetup + + + ColorProfiles + + + InfPath + + + IsPackageAware + + + CoreDriverDependencies + + + PreviousCompatibleNames + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterDriver_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterDriver_v1.0.cdxml new file mode 100644 index 0000000..b336d54 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterDriver_v1.0.cdxml @@ -0,0 +1,114 @@ + + + + 1.0 + PrinterDriver + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterNfcTag.format.ps1xml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterNfcTag.format.ps1xml new file mode 100644 index 0000000..f5f7e26 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterNfcTag.format.ps1xml @@ -0,0 +1,63 @@ + + + + + + Formatting For MSFT_PrinterNfcTag (Table View) + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterNfcTag + + + + + 30 + + + 30 + + + 10 + + + + + + + SharePath + + + WsdAddress + + + Locked + + + + + + + + Formatting For MSFT_PrinterNfcTag (List View) + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterNfcTag + + + + + + + SharePath + + + WsdAddress + + + Locked + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterNfcTagTasks_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterNfcTagTasks_v1.0.cdxml new file mode 100644 index 0000000..33429f0 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterNfcTagTasks_v1.0.cdxml @@ -0,0 +1,77 @@ + + + + 1.0 + PrinterNfcTag + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterNfcTag_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterNfcTag_v1.0.cdxml new file mode 100644 index 0000000..92047a6 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterNfcTag_v1.0.cdxml @@ -0,0 +1,7 @@ + + + + 1.0 + PrinterNfcTag + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterPort.format.ps1xml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterPort.format.ps1xml new file mode 100644 index 0000000..857e07d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterPort.format.ps1xml @@ -0,0 +1,49 @@ + + + + + Formatting For MSFT_PrinterPort (Table View for ALL subclasses.) + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterPort + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_LocalPrinterPort + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_TcpIpPrinterPort + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_AdaptivePrinterPort + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_LprPrinterPort + + + + + 20 + + + 20 + + + 20 + + + 20 + + + + + + + Name + + + ComputerName + + + Description + + + PortMonitor + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterPortTasks_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterPortTasks_v1.0.cdxml new file mode 100644 index 0000000..b350a08 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterPortTasks_v1.0.cdxml @@ -0,0 +1,158 @@ + + + + 1.0 + PrinterPort + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterPort_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterPort_v1.0.cdxml new file mode 100644 index 0000000..a4a0be5 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterPort_v1.0.cdxml @@ -0,0 +1,57 @@ + + + + 1.0 + PrinterPort + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterProperty.format.ps1xml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterProperty.format.ps1xml new file mode 100644 index 0000000..f85f3d0 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterProperty.format.ps1xml @@ -0,0 +1,81 @@ + + + + + + Formatting For MSFT_PrinterProperty (Table View) + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterProperty + + + + + 20 + + + 20 + + + 20 + + + 10 + + + 30 + + + + + + + ComputerName + + + PrinterName + + + PropertyName + + + Type + + + Value + + + + + + + + Formatting For MSFT_PrinterProperty (List View) + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterProperty + + + + + + + ComputerName + + + PrinterName + + + PropertyName + + + Type + + + Value + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterProperty.types.ps1xml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterProperty.types.ps1xml new file mode 100644 index 0000000..753fe9b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterProperty.types.ps1xml @@ -0,0 +1,15 @@ + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_PrinterProperty + + + Type + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.PrinterProperty.PropertyTypeEnum]($this.PSBase.CimInstanceProperties['Type'].Value) + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterProperty_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterProperty_v1.0.cdxml new file mode 100644 index 0000000..40dd233 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_PrinterProperty_v1.0.cdxml @@ -0,0 +1,138 @@ + + + + 1.0 + PrinterProperty + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_Printer_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_Printer_v1.0.cdxml new file mode 100644 index 0000000..6ac7272 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_Printer_v1.0.cdxml @@ -0,0 +1,639 @@ + + + + 1.0 + Printer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_TcpIpPrinterPort.format.ps1xml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_TcpIpPrinterPort.format.ps1xml new file mode 100644 index 0000000..755838e --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_TcpIpPrinterPort.format.ps1xml @@ -0,0 +1,101 @@ + + + + + Formatting For MSFT_TcpIpPrinterPort (Table View) + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_TcpIpPrinterPort + + + + + 20 + + + 20 + + + 20 + + + 20 + + + 20 + + + + + + + Name + + + ComputerName + + + Description + + + PrinterHostAddress + + + PortNumber + + + + + + + + Formatting For MSFT_TcpIpPrinterPort (List View) + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_TcpIpPrinterPort + + + + + + + Name + + + ComputerName + + + Description + + + Protocol + + + PrinterHostAddress + + + PrinterHostIP + + + PortNumber + + + SNMPIndex + + + SNMPCommunity + + + SNMPEnabled + + + LprQueueName + + + LprByteCounting + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_TcpIpPrinterPort.types.ps1xml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_TcpIpPrinterPort.types.ps1xml new file mode 100644 index 0000000..e992647 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_TcpIpPrinterPort.types.ps1xml @@ -0,0 +1,15 @@ + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/StandardCimv2/MSFT_TcpIpPrinterPort + + + Protocol + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.TcpIpPort.ProtocolEnum]($this.PSBase.CimInstanceProperties['Protocol'].Value) + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_TcpIpPrinterPort_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_TcpIpPrinterPort_v1.0.cdxml new file mode 100644 index 0000000..b2b77a2 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/PrintManagement/MSFT_TcpIpPrinterPort_v1.0.cdxml @@ -0,0 +1,13 @@ + + + + 1.0 + PrinterPort + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/PrintManagement/PrintManagement.psd1 b/newton-cn/bin/v1.0/Modules/PrintManagement/PrintManagement.psd1 new file mode 100644 index 0000000..abc98a8 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/PrintManagement/PrintManagement.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/ProcessMitigations/Microsoft.ProcessMitigations.Commands.dll b/newton-cn/bin/v1.0/Modules/ProcessMitigations/Microsoft.ProcessMitigations.Commands.dll new file mode 100644 index 0000000..232e349 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/ProcessMitigations/Microsoft.ProcessMitigations.Commands.dll differ diff --git a/newton-cn/bin/v1.0/Modules/ProcessMitigations/Microsoft.ProcessMitigations.Commands.dll-Help.xml b/newton-cn/bin/v1.0/Modules/ProcessMitigations/Microsoft.ProcessMitigations.Commands.dll-Help.xml new file mode 100644 index 0000000..81bb2bd --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ProcessMitigations/Microsoft.ProcessMitigations.Commands.dll-Help.xml @@ -0,0 +1,749 @@ + + + + +ConvertTo-ProcessMitigationPolicy +ConvertTo +ProcessMitigationPolicy +Converts an mitigation policy file formats. + + + +Converts an EMET policy file or pinning rule file to a new Windows 10 format. + + +ConvertTo-ProcessMitigationPolicy +EMETFilePath +File that either contains cert pinning rules or an existing EMET process mitigation configuration file. + + +String +String + +None + +OutputFilePath +Resulting new Windows10 process mitigation/pinning rules format. + + +String +String + +None + + + +EMETFilePath +File that either contains cert pinning rules or an existing EMET process mitigation configuration file. + + +String +String + +None + +OutputFilePath +Resulting new Windows10 process mitigation/pinning rules format. + + +String +String + +None + + +System.String + + + + + + +System.Object + + + + + + + + + + +Example 1 +PS C:\> ConvertTo-ProcessMitigationPolicy -EMETFile policy.xml -Output result.xml +Converts EMET file policy.xml to result.xml, may also generate a CI file CI-result.xml if necessary. + + + + + + + +Get-ProcessMitigation +Get +ProcessMitigation +Gets the current process mitigation settings, either from the registry, from a running process, or saves all to a XML. + + + +Gets all process mitigation settings either by process name (either running or from -Registry), or by process ID. Can also save all settings to an XML file. + + +Get-ProcessMitigation +FullPolicy +Returns every processes' current mitigation settings in the registry + + +SwitchParameter + +False + + +Get-ProcessMitigation +Id +Process Id to retrieve current running process mitigation settings from + + +Int32[] +Int32[] + +None + + +Get-ProcessMitigation +Name +Current process name to get current running (Or from registry) process mitigation settings from one (Can be more than one instance) + + +String +String + +None + +RunningProcesses +Pull the current process mitigation settings from a running instance instead of the registry. + + +SwitchParameter + +False + + +Get-ProcessMitigation +RegistryConfigFilePath +File to save the current registry process mitigation configuration to + + +String +String + +None + + +Get-ProcessMitigation +System +Pulls the current system defaults for process mitigations. + + +SwitchParameter + +False + + + +FullPolicy +Returns every processes' current mitigation settings in the registry + + +SwitchParameter +SwitchParameter + +False + +Id +Process Id to retrieve current running process mitigation settings from + + +Int32[] +Int32[] + +None + +Name +Current process name to get current running (Or from registry) process mitigation settings from one (Can be more than one instance) + + +String +String + +None + +RegistryConfigFilePath +File to save the current registry process mitigation configuration to + + +String +String + +None + +RunningProcesses +Pull the current process mitigation settings from a running instance instead of the registry. + + +SwitchParameter +SwitchParameter + +False + +System +Pulls the current system defaults for process mitigations. + + +SwitchParameter +SwitchParameter + +False + + +System.Int32[] + + + + + + +System.Object + + + + + + + + + + +Example 1 +PS C:\> Get-ProcessMitigation -Name notepad.exe -RunningProcess +Gets the current settings on all running instances of notepad.exe + + + +Example 2 +PS C:\> Get-ProcessMitigation -Name notepad.exe +Gets the current settings in the registry for notepad.exe + + + +Example 3 +PS C:\> Get-ProcessMitigation -Id 1304 +Gets the current settings for the running process with pid 1304 + + + +Example 4 +PS C:\> Get-ProcessMitigation -RegistryConfigFilePath settings.xml +Gets the all process mitigation settings from the registry and saves them to the xml file settings.xml + + + +Example 5 +PS C:\> Get-ProcessMitigation -FullPolicy +Gets all policies for all processes set in the registry. + + + +Example 6 +PS C:\> Get-ProcessMitigation -System +Gets the current system process mitigation defaults stored in the registry. + + + +Example 7 +PS C:\> Get-Process notepad | Get-ProcessMitigation +Gets the current process mitigation settings for all running instances of notepad.exe + + + + + + + +Set-ProcessMitigation +Set +ProcessMitigation +Commands to enable and disable process mitigations or set them in bulk from an XML file. + + + +Used to turn on and off various process mitigation settings. Can also apply (Or Validate) an XML file to apply settings for many processes at once. + + +Set-ProcessMitigation +Name +Name of the process to apply mitigation settings to. Can be in the format "notepad" or "notepad.exe" + + +String +String + +None + +Disable +Comma separated list of mitigations to disable. Disable list takes priority over enable list. If specified in both, it will be disabled. + + +DEP +EmulateAtlThunks +SEHOP +ForceRelocate +RequireInfo +BottomUp +HighEntropy +StrictHandle +DisableWin32kSystemCalls +AuditSystemCall +ExtensionPoint +DynamicCode +AuditDynamicCode +CFG +SuppressExports +StrictCFG +BlockNonMicrosoftSigned +AllowStoreSigned +AuditMicrosoftSigned +AuditStoreSigned +EnforceModuleDepencySigning +DisableNonSystemFonts +FontAuditOnly +AuditFont +BlockRemoteImages +BlockLowLabel +PreferSystem32 +AuditImageLoad +EnableExportAddressFilter +AuditEnableExportAddressFilter +EnableExportAddressFilterPlus +AuditEnableExportAddressFilterPlus +EnableImportAddressFilter +AuditEnableImportAddressFilter +EnableRopStackPivot +AuditEnableRopStackPivot +EnableRopCallerCheck +AuditEnableRopCallerCheck +EnableRopSimExec +AuditEnableRopSimExec +SEHOP +AuditSEHOP +SEHOPTelemetry +TerminateOnHeapError +DisallowChildProcessCreation +AuditChildProcess +UserShadowStack +UserShadowStackStrictMode +AuditUserShadowStack + +String[] +String[] + +None + +EAFModules +Modules to be added to the EAF+ mitigation. + + +String[] +String[] + +None + +Enable +Comma separated list of mitigations to enable. Disable list takes priority over enable list. If specified in both, it will be disabled. + + +DEP +EmulateAtlThunks +SEHOP +ForceRelocate +RequireInfo +BottomUp +HighEntropy +StrictHandle +DisableWin32kSystemCalls +AuditSystemCall +ExtensionPoint +DynamicCode +AuditDynamicCode +CFG +SuppressExports +StrictCFG +BlockNonMicrosoftSigned +AllowStoreSigned +AuditMicrosoftSigned +AuditStoreSigned +EnforceModuleDepencySigning +DisableNonSystemFonts +FontAuditOnly +AuditFont +BlockRemoteImages +BlockLowLabel +PreferSystem32 +AuditImageLoad +EnableExportAddressFilter +EnableExportAddressFilterPlus +EnableImportAddressFilter +EnableRopStackPivot +EnableRopCallerCheck +EnableRopSimExec +SEHOP +AuditSEHOP +SEHOPTelemetry +TerminateOnHeapError +DisallowChildProcessCreation +AuditChildProcess +UserShadowStack +UserShadowStackStrictMode +AuditUserShadowStack + +String[] +String[] + +None + +Force +Overrides a system setting either on or off depending on the level this is set at. Will force "on"/"off" all mitigations provided in the -Enable list + + +on +off +notset + +String +String + +None + +Remove +Removes a mitigation entry from the registry. + + +SwitchParameter + +False + +Reset +Resets a specific mitigation entry to defer. + + +SwitchParameter + +False + + +Set-ProcessMitigation +Disable +Comma separated list of mitigations to disable. Disable list takes priority over enable list. If specified in both, it will be disabled. + + +DEP +EmulateAtlThunks +SEHOP +ForceRelocate +RequireInfo +BottomUp +HighEntropy +StrictHandle +SystemCall +AuditSystemCall +ExtensionPoint +DynamicCode +AuditDynamicCode +CFG +SuppressExports +StrictCFG +BlockNonMicrosoftSigned +AllowStoreSigned +AuditMicrosoftSigned +AuditStoreSigned +EnforceModuleDepencySigning +DisableNonSystemFonts +FontAuditOnly +AuditFont +BlockRemoteImages +BlockLowLabel +PreferSystem32 +AuditImageLoad +EnableExportAddressFilter +EnableExportAddressFilterPlus +EnableImportAddressFilter +EnableRopStackPivot +EnableRopCallerCheck +EnableRopSimExec +SEHOP +AuditSEHOP +SEHOPTelemetry +TerminateOnHeapError +DisallowChildProcessCreation +AuditChildProcess +UserShadowStack +UserShadowStackStrictMode +AuditUserShadowStack + +String[] +String[] + +None + +EAFModules +Modules to be added to the EAF+ mitigation. + + +String[] +String[] + +None + +Enable +Comma separated list of mitigations to enable. Disable list takes priority over enable list. If specified in both, it will be disabled. + + +DEP +EmulateAtlThunks +SEHOP +ForceRelocate +RequireInfo +BottomUp +HighEntropy +StrictHandle +SystemCall +AuditSystemCall +ExtensionPoint +DynamicCode +AuditDynamicCode +CFG +SuppressExports +StrictCFG +BlockNonMicrosoftSigned +AllowStoreSigned +AuditMicrosoftSigned +AuditStoreSigned +EnforceModuleDepencySigning +DisableNonSystemFonts +FontAuditOnly +AuditFont +BlockRemoteImages +BlockLowLabel +PreferSystem32 +AuditImageLoad +EnableExportAddressFilter +EnableExportAddressFilterPlus +EnableImportAddressFilter +EnableRopStackPivot +EnableRopCallerCheck +EnableRopSimExec +SEHOP +AuditSEHOP +SEHOPTelemetry +TerminateOnHeapError +DisallowChildProcessCreation +AuditChildProcess +UserShadowStack +UserShadowStackStrictMode +AuditUserShadowStack + +String[] +String[] + +None + +Force +Overrides a system setting either on or off depending on the level this is set at. Will force "on"/"off" all mitigations provided in the -Enable list + + +on +off +notset + +String +String + +None + +Remove +Removes a mitigation entry from the registry. + + +SwitchParameter + +False + +Reset +Resets a specific mitigation entry to defer. + + +SwitchParameter + +False + +System +Used to configure system defaults rather than individual apps. + + +SwitchParameter + +False + + +Set-ProcessMitigation +IsValid +Set to check the given XML file for validity. Requires local .xsd + + +SwitchParameter + +False + +PolicyFilePath +An XML file with mitigation settings for many processes that is applied to the registry + + +String +String + +None + + + +Disable +Comma separated list of mitigations to disable. Disable list takes priority over enable list. If specified in both, it will be disabled. + + +String[] +String[] + +None + +EAFModules +Modules to be added to the EAF+ mitigation. + + +String[] +String[] + +None + +Enable +Comma separated list of mitigations to enable. Disable list takes priority over enable list. If specified in both, it will be disabled. + + +String[] +String[] + +None + +Force +Overrides a system setting either on or off depending on the level this is set at. Will force "on"/"off" all mitigations provided in the -Enable list + + +String +String + +None + +IsValid +Set to check the given XML file for validity. Requires local .xsd + + +SwitchParameter +SwitchParameter + +False + +Name +Name of the process to apply mitigation settings to. Can be in the format "notepad" or "notepad.exe" + + +String +String + +None + +PolicyFilePath +An XML file with mitigation settings for many processes that is applied to the registry + + +String +String + +None + +Remove +Removes a mitigation entry from the registry. + + +SwitchParameter +SwitchParameter + +False + +Reset +Resets a specific mitigation entry to defer. + + +SwitchParameter +SwitchParameter + +False + +System +Used to configure system defaults rather than individual apps. + + +SwitchParameter +SwitchParameter + +False + + +System.String + + + + + + +System.Object + + + + + + + + + + +Example 1 +PS C:\> set-ProcessMitigation -Name Notepad.exe -Enable SEHOP -Disable MandatoryASLR +Gets the current process mitigation for "notepad.exe" from the registry and then enables SEHOP, and disables MandatoryASLR. + + + +Example 2 +PS C:\> set-ProcessMitigation -PolicyFilePath settings.xml +Applies all settings inside settings.xml + + + +Example 3 +PS C:\> set-ProcessMitigation -PolicyFilePath settings.xml -IsValid +Checks if the given file is a valid settings.xml, requires local .xsd + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/ProcessMitigations/Microsoft.ProcessMitigations.Commands.ps1xml b/newton-cn/bin/v1.0/Modules/ProcessMitigations/Microsoft.ProcessMitigations.Commands.ps1xml new file mode 100644 index 0000000..b36da0f --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ProcessMitigations/Microsoft.ProcessMitigations.Commands.ps1xml @@ -0,0 +1,1422 @@ + + + + + + + AppMitigations + + Microsoft.Samples.PowerShell.Commands.AppMitigations + + + + + + + depControl + + + + + Enable : + + Enable + + + EmulateAtlThunks : + + EmulateAtlThunks + + + Override DEP : + + OverrideDEP + + + + + + + + + + + aslrControl + + + + + BottomUp : + + BottomUp + + + Override BottomUp : + + OverrideBottomUp + + + ForceRelocateImages : + + ForceRelocateImages + + + RequireInfo : + + RequireInfo + + + Override ForceRelocate : + + OverrideForceRelocateImages + + + HighEntropy : + + HighEntropy + + + Override High Entropy : + + OverrideHighEntropy + + + + + + + + + + + strictHandleControl + + + + + Enable : + + Enable + + + Override StrictHandle : + + OverrideStrictHandle + + + + + + + + + + + systemCallControl + + + + + DisableWin32kSystemCalls : + + DisableWin32kSystemCalls + + + Audit : + + Audit + + + Override SystemCall : + + OverrideSystemCall + + + + + + + + + + + extensionPointControl + + + + + DisableExtensionPoints : + + DisableExtensionPoints + + + Override ExtensionPoint : + + OverrideExtensionPoint + + + + + + + + + + + dynamicCodeControl + + + + + BlockDynamicCode : + + BlockDynamicCode + + + AllowThreadsToOptOut : + + AllowThreadsToOptOut + + + Audit : + + Audit + + + Override DynamicCode : + + OverrideDynamicCode + + + + + + + + + + + CFGControl + + + + + Enable : + + Enable + + + SuppressExports : + + SuppressExports + + + Override CFG : + + OverrideCFG + + + StrictControlFlowGuard : + + StrictControlFlowGuard + + + Override StrictCFG : + + OverrideStrictCFG + + + + + + + + + + + binarySignatureControl + + + + + MicrosoftSignedOnly : + + MicrosoftSignedOnly + + + AllowStoreSignedBinaries : + + AllowStoreSignedBinaries + + + EnforceModuleDependencySigning : + + EnforceModuleDependencySigning + + + AuditMicrosoftSignedOnly : + + Audit + + + AuditStoreSigned : + + AuditStoreSigned + + + AuditEnforceModuleDependencySigning: + + AuditEnforceModuleDependencySigning + + + Override MicrosoftSignedOnly : + + OverrideMicrosoftSignedOnly + + + Override DependencySigning : + + OverrideEnforceModuleDependencySigning + + + + + + + + + + + fontDisableControl + + + + + DisableNonSystemFonts : + + DisableNonSystemFonts + + + Audit : + + Audit + + + Override FontDisable : + + OverrideFontDisable + + + + + + + + + + + imageLoadControl + + + + + BlockRemoteImageLoads : + + BlockRemoteImageLoads + + + AuditRemoteImageLoads : + + AuditRemoteImageLoads + + + Override BlockRemoteImages : + + OverrideBlockRemoteImageLoads + + + BlockLowLabelImageLoads : + + BlockLowLabelImageLoads + + + AuditLowLabelImageLoads : + + AuditLowLabelImageLoads + + + Override BlockLowLabel : + + OverrideBlockLowLabel + + + PreferSystem32 : + + PreferSystem32 + + + AuditPreferSystem32 : + + AuditPreferSystem32 + + + Override PreferSystem32 : + + OverridePreferSystem32 + + + + + + + + + + + payloadControl + + + + + EnableExportAddressFilter : + + EnableExportAddressFilter + + + AuditEnableExportAddressFilter : + + AuditEnableExportAddressFilter + + + Override ExportAddressFilter : + + OverrideEnableExportAddressFilter + + + EnableExportAddressFilterPlus : + + EnableExportAddressFilterPlus + + + AuditEnableExportAddressFilterPlus : + + AuditEnableExportAddressFilterPlus + + + Override ExportAddressFilterPlus : + + OverrideEnableExportAddressFilterPlus + + + EAFModules : + + EAFModules + + + EnableImportAddressFilter : + + EnableImportAddressFilter + + + AuditEnableImportAddressFilter : + + AuditEnableImportAddressFilter + + + Override ImportAddressFilter : + + OverrideEnableImportAddressFilter + + + EnableRopStackPivot : + + EnableRopStackPivot + + + AuditEnableRopStackPivot : + + AuditEnableRopStackPivot + + + Override EnableRopStackPivot : + + OverrideEnableRopStackPivot + + + EnableRopCallerCheck : + + EnableRopCallerCheck + + + AuditEnableRopCallerCheck : + + AuditEnableRopCallerCheck + + + Override EnableRopCallerCheck : + + OverrideEnableRopCallerCheck + + + EnableRopSimExec : + + EnableRopSimExec + + + AuditEnableRopSimExec : + + AuditEnableRopSimExec + + + Override EnableRopSimExec : + + OverrideEnableRopSimExec + + + + + + + + + + + SEHOPControl + + + + + Enable : + + Enable + + + TelemetryOnly : + + TelemetryOnly + + + Audit : + + Audit + + + Override SEHOP : + + OverrideSEHOP + + + + + + + + + + + HeapControl + + + + + TerminateOnError : + + TerminateOnError + + + Override HEAP : + + OverrideHeap + + + + + + + + + + + ChildProcessControl + + + + + DisallowChildProcessCreation : + + DisallowChildProcessCreation + + + Audit : + + Audit + + + Override ChildProcess : + + OverrideChildProcess + + + + + + + + + + + UserShadowStackControl + + + + + UserShadowStack : + + UserShadowStack + + + UserShadowStackStrictMode : + + UserShadowStackStrictMode + + + AuditUserShadowStack : + + AuditUserShadowStack + + + Override UserShadowStack : + + OverrideUserShadowStack + + + + + + + + + + + + + + + + + ProcessName : + + ProcessName + + + Source : + + Source + + + Id : + + Id + + + + DEP: + + + 4 + + + Dep + depControl + + + + + ASLR: + + + 4 + + + aslr + aslrControl + + + + + StrictHandle: + + + 4 + + + strictHandle + strictHandleControl + + + + + System Call: + + + 4 + + + SystemCall + systemCallControl + + + + + ExtensionPoint: + + + 4 + + + extensionPoint + extensionPointControl + + + + + DynamicCode: + + + 4 + + + dynamicCode + dynamicCodeControl + + + + + CFG: + + + 4 + + + cfg + CFGControl + + + + + BinarySignature: + + + 4 + + + binarySignature + binarySignatureControl + + + + + FontDisable: + + + 4 + + + fontDisable + fontDisableControl + + + + + ImageLoad: + + + 4 + + + imageLoad + imageLoadControl + + + + + Payload: + + + 4 + + + Payload + payloadControl + + + + + SEHOP: + + + 4 + + + SEHOP + SEHOPControl + + + + + Heap: + + + 4 + + + Heap + HeapControl + + + + + Child Process: + + + 4 + + + ChildProcess + ChildProcessControl + + + + + User Shadow Stack: + + + 4 + + + UserShadowStack + UserShadowStackControl + + + + + + + + + + + + ProcessMitigations + + Microsoft.Samples.PowerShell.Commands.ProcessMitigations + + + + + + + depControl + + + + + Enable : + + Enable + + + EmulateAtlThunks : + + EmulateAtlThunks + + + + + + + + + + + aslrControl + + + + + BottomUp : + + BottomUp + + + ForceRelocateImages : + + ForceRelocateImages + + + RequireInfo : + + RequireInfo + + + HighEntropy : + + HighEntropy + + + + + + + + + + + strictHandleControl + + + + + Enable : + + Enable + + + + + + + + + + + systemCallControl + + + + + DisableWin32kSystemCalls : + + DisableWin32kSystemCalls + + + Audit : + + Audit + + + + + + + + + + + extensionPointControl + + + + + DisableExtensionPoints : + + DisableExtensionPoints + + + + + + + + + + + dynamicCodeControl + + + + + BlockDynamicCode : + + BlockDynamicCode + + + AllowThreadsToOptOut : + + AllowThreadsToOptOut + + + Audit : + + Audit + + + + + + + + + + + CFGControl + + + + + Enable : + + Enable + + + SuppressExports : + + SuppressExports + + + StrictControlFlowGuard : + + StrictControlFlowGuard + + + + + + + + + + + binarySignatureControl + + + + + MicrosoftSignedOnly : + + MicrosoftSignedOnly + + + AllowStoreSignedBinaries : + + AllowStoreSignedBinaries + + + AuditMicrosoftSignedOnly : + + Audit + + + AuditStoreSigned : + + AuditStoreSigned + + + + + + + + + + + fontDisableControl + + + + + DisableNonSystemFonts : + + DisableNonSystemFonts + + + Audit : + + Audit + + + + + + + + + + + imageLoadControl + + + + + BlockRemoteImageLoads : + + BlockRemoteImageLoads + + + AuditRemoteImageLoads : + + AuditRemoteImageLoads + + + BlockLowLabelImageLoads : + + BlockLowLabelImageLoads + + + AuditLowLabelImageLoads : + + AuditLowLabelImageLoads + + + PreferSystem32 : + + PreferSystem32 + + + AuditPreferSystem32 : + + AuditPreferSystem32 + + + + + + + + + + + payloadControl + + + + + EnableExportAddressFilter : + + EnableExportAddressFilter + + + AuditEnableExportAddressFilter : + + AuditEnableExportAddressFilter + + + EnableExportAddressFilterPlus : + + EnableExportAddressFilterPlus + + + AuditEnableExportAddressFilterPlus : + + AuditEnableExportAddressFilterPlus + + + EnableImportAddressFilter : + + EnableImportAddressFilter + + + AuditEnableImportAddressFilter : + + AuditEnableImportAddressFilter + + + EnableRopStackPivot : + + EnableRopStackPivot + + + AuditEnableRopStackPivot : + + AuditEnableRopStackPivot + + + EnableRopCallerCheck : + + EnableRopCallerCheck + + + AuditEnableRopCallerCheck : + + AuditEnableRopCallerCheck + + + EnableRopSimExec : + + EnableRopSimExec + + + AuditEnableRopCallerCheck : + + AuditEnableRopCallerCheck + + + + + + + + + + + ChildProcessControl + + + + + DisallowChildProcessCreation : + + DisallowChildProcessCreation + + + Audit : + + Audit + + + + + + + + + + + UserShadowStackControl + + + + + UserShadowStack : + + UserShadowStack + + + UserShadowStackStrictMode : + + UserShadowStackStrictMode + + + AuditUserShadowStack : + + AuditUserShadowStack + + + SetContextIpValidation : + + SetContextIpValidation + + + AuditSetContextIpValidation : + + AuditSetContextIpValidation + + + BlockNonCetBinaries : + + BlockNonCetBinaries + + + BlockNonCetBinariesNonEhcont : + + BlockNonCetBinariesNonEhcont + + + AuditBlockNonCetBinaries : + + AuditBlockNonCetBinaries + + + + + + + + + + + + + + + + + ProcessName : + + ProcessName + + + Source : + + Source + + + Id : + + Id + + + + DEP: + + + 4 + + + Dep + depControl + + + + + ASLR: + + + 4 + + + aslr + aslrControl + + + + + StrictHandle: + + + 4 + + + strictHandle + strictHandleControl + + + + + System Call: + + + 4 + + + SystemCall + systemCallControl + + + + + ExtensionPoint: + + + 4 + + + extensionPoint + extensionPointControl + + + + + DynamicCode: + + + 4 + + + dynamicCode + dynamicCodeControl + + + + + CFG: + + + 4 + + + cfg + CFGControl + + + + + BinarySignature: + + + 4 + + + binarySignature + binarySignatureControl + + + + + FontDisable: + + + 4 + + + fontDisable + fontDisableControl + + + + + ImageLoad: + + + 4 + + + imageLoad + imageLoadControl + + + + + Payload: + + + 4 + + + Payload + payloadControl + + + + + Child Process: + + + 4 + + + ChildProcess + ChildProcessControl + + + + + User Shadow Stack: + + + 4 + + + UserShadowStack + UserShadowStackControl + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/ProcessMitigations/ProcessMitigations.psd1 b/newton-cn/bin/v1.0/Modules/ProcessMitigations/ProcessMitigations.psd1 new file mode 100644 index 0000000..7185004 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ProcessMitigations/ProcessMitigations.psd1 @@ -0,0 +1,15 @@ +@{ +GUID = "{1e8f5a4c-f11b-41a5-bdbd-4695ca4a503e}" +Author = "Microsoft Corporation" +CompanyName = "Microsoft Corporation" +Copyright = "© Microsoft Corporation. All rights reserved." +RootModule = 'Microsoft.ProcessMitigations.Commands.dll' +ModuleVersion = "1.0.12" +PowerShellVersion = '5.1' +CLRVersion = "2.0" +FormatsToProcess = 'Microsoft.ProcessMitigations.Commands.ps1xml' +CmdletsToExport="Get-ProcessMitigation", "Set-ProcessMitigation", "ConvertTo-ProcessMitigationPolicy" +# Location from which to download updateable help +HelpInfoURI = "https://go.microsoft.com/fwlink/?linkid=845399" +CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/Provisioning/provautologger_add.reg b/newton-cn/bin/v1.0/Modules/Provisioning/provautologger_add.reg new file mode 100644 index 0000000..88b6d2d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Provisioning/provautologger_add.reg @@ -0,0 +1,176 @@ +Windows Registry Editor Version 5.00 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning] +"Guid"="{0c225950-4d2c-4d9d-9b19-ec40855b7eec}" +"Start"=dword:00000001 +"Status"=dword:00000000 +"FileName"="{LogFile}" +"FileMax"=dword:0000000A +"BufferSize"=dword:00000040 +"MaxFileSize"=dword:00000400 +"LogFileMode"=dword:00000022 +"FlushTimer"=dword:00000001 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{A6A847B7-4429-49AA-BBA6-2AD8C191AC8C}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{0BBE6221-EF09-4A3F-82EE-BE00DBB6A98A}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{42C60CEA-0FE7-4541-A86B-9E11F95BD9BF}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{B876B1FC-C7F1-443E-9012-86677F7DE580}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{7EDBED09-1FF7-4FEE-B8C3-5DB694420830}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{82ADD491-01D7-4B85-9EAD-192C3CAACA23}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{16E12400-A2D8-44B7-9479-004568EC7819}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{0383D92C-2337-4F25-A0B5-A51767F04746}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{7F99598F-B2C1-4371-9911-63DEE13B9EB1}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{B1F30020-8BC3-4888-BB1B-4DD681F24209}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{55239D60-0EB6-495B-874E-15DE5D5F9A70}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{B55883E6-6C45-45C2-AB9D-800BB7B66B13}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{2BF4B6BA-556E-4D05-8534-CAFEDF19FED8}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{00BB69FC-60BC-4502-9438-25608F375CCB}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{E74EFD1A-B62D-4B83-AB00-66F4A166A2D3}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{F9E3B648-9AF1-4DC3-9A8E-BF42C0FBCE9A}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{C02087CB-200C-404B-9AB4-E0EACCEFCDC3}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{468E4CDB-B802-4624-BCDC-80658ABF3A02}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{78F60602-7581-4AB5-908F-8D23F8976FB1}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{0BA3FB88-9AF5-4D80-B3B3-A94AC136B6C5}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{A109A7C6-D975-46CC-B593-2B079B604E34}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{0A8E17FD-ED19-4C54-A1E7-5A2829BF507F}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{8CC7D9C9-09AF-45CA-86CE-4CECF680F2B7}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{FADD8651-7B42-423F-B37D-3B98B9E81560}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{18F2AB69-92B9-47E4-B9DB-B4AC2E4C7115}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{2F94E1CC-A8C5-4FE7-A1C3-53D7BDA8E73E}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{E3E3DA3E-B97E-47BA-A47E-9D00A92D607A}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{0e71a49b-ca69-5999-a395-626493eb0cbd}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{CF69DF80-7690-41DA-99C9-186E46860E7D}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning\{A9F17D57-43D6-498C-94E4-EB0E9E7E19C2}] +"Enabled"=dword:00000001 +"EnableLevel"=dword:00000005 +"Status"=dword:00000000 + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Provisioning/provautologger_del.reg b/newton-cn/bin/v1.0/Modules/Provisioning/provautologger_del.reg new file mode 100644 index 0000000..98cafd8 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Provisioning/provautologger_del.reg @@ -0,0 +1,17 @@ +Windows Registry Editor Version 5.00 + +[-HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\WMI\AutoLogger\Provisioning] + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Provisioning/provcmdlets.dll b/newton-cn/bin/v1.0/Modules/Provisioning/provcmdlets.dll new file mode 100644 index 0000000..4802ab3 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/Provisioning/provcmdlets.dll differ diff --git a/newton-cn/bin/v1.0/Modules/Provisioning/provcommon.dll b/newton-cn/bin/v1.0/Modules/Provisioning/provcommon.dll new file mode 100644 index 0000000..ac146bb Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/Provisioning/provcommon.dll differ diff --git a/newton-cn/bin/v1.0/Modules/Provisioning/provisioning.psd1 b/newton-cn/bin/v1.0/Modules/Provisioning/provisioning.psd1 new file mode 100644 index 0000000..35691a9 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/Provisioning/provisioning.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/Provisioning/provisioning.psm1 b/newton-cn/bin/v1.0/Modules/Provisioning/provisioning.psm1 new file mode 100644 index 0000000..29acac3 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Provisioning/provisioning.psm1 @@ -0,0 +1,16 @@ +# +# Script Module file for provcmdlets module. +# +# Copyright (c) Microsoft Corporation +# + +# +# Cmdlet aliases +# + +Set-Alias Add-ProvisioningPackage Install-ProvisioningPackage +Set-Alias Remove-ProvisioningPackage Uninstall-ProvisioningPackage +Set-Alias Add-TrustedProvisioningCertificate Install-TrustedProvisioningCertificate +Set-Alias Remove-TrustedProvisioningCertificate Uninstall-TrustedProvisioningCertificate + +Export-ModuleMember -Alias * -Function * -Cmdlet * diff --git a/newton-cn/bin/v1.0/Modules/Provisioning/provpackageapi.dll b/newton-cn/bin/v1.0/Modules/Provisioning/provpackageapi.dll new file mode 100644 index 0000000..4b8edd2 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/Provisioning/provpackageapi.dll differ diff --git a/newton-cn/bin/v1.0/Modules/Provisioning/provtrace.wprp b/newton-cn/bin/v1.0/Modules/Provisioning/provtrace.wprp new file mode 100644 index 0000000..c79ded0 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Provisioning/provtrace.wprp @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Provisioning/wiminterop.dll b/newton-cn/bin/v1.0/Modules/Provisioning/wiminterop.dll new file mode 100644 index 0000000..539e84a Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/Provisioning/wiminterop.dll differ diff --git a/newton-cn/bin/v1.0/Modules/ScheduledTasks/MSFT_ScheduledTask.format.ps1xml b/newton-cn/bin/v1.0/Modules/ScheduledTasks/MSFT_ScheduledTask.format.ps1xml new file mode 100644 index 0000000..e909d64 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ScheduledTasks/MSFT_ScheduledTask.format.ps1xml @@ -0,0 +1,69 @@ + + + + + Formatting For MSFT_ScheduledTask (Table View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_ScheduledTask + + + + + 46 + + + 33 + + + 10 + + + + + + + + TaskPath + + + TaskName + + + State + + + + + + + + Formatting For MSFT_ClusteredScheduledTask (Table View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_ClusteredScheduledTask + + + + + 16 + + + 33 + + + + + + + + TaskName + + + TaskType + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/ScheduledTasks/MSFT_ScheduledTask.types.ps1xml b/newton-cn/bin/v1.0/Modules/ScheduledTasks/MSFT_ScheduledTask.types.ps1xml new file mode 100644 index 0000000..128c40b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ScheduledTasks/MSFT_ScheduledTask.types.ps1xml @@ -0,0 +1,179 @@ + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_ScheduledTask + + + State + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.StateEnum]($this.PSBase.CimInstanceProperties['State'].Value) + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_TaskSettings + + + MultipleInstances + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.MultipleInstancesEnum]($this.PSBase.CimInstanceProperties['MultipleInstances'].Value) + + + $this.PSBase.CimInstanceProperties['MultipleInstances'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.MultipleInstancesEnum]($args[0]) + + + + Compatibility + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.CompatibilityEnum]($this.PSBase.CimInstanceProperties['Compatibility'].Value) + + + $this.PSBase.CimInstanceProperties['Compatibility'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.CompatibilityEnum]($args[0]) + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_TaskSettings2 + + + MultipleInstances + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.MultipleInstancesEnum]($this.PSBase.CimInstanceProperties['MultipleInstances'].Value) + + + $this.PSBase.CimInstanceProperties['MultipleInstances'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.MultipleInstancesEnum]($args[0]) + + + + Compatibility + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.CompatibilityEnum]($this.PSBase.CimInstanceProperties['Compatibility'].Value) + + + $this.PSBase.CimInstanceProperties['Compatibility'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.CompatibilityEnum]($args[0]) + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_TaskSettings3 + + + MultipleInstances + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.MultipleInstancesEnum]($this.PSBase.CimInstanceProperties['MultipleInstances'].Value) + + + $this.PSBase.CimInstanceProperties['MultipleInstances'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.MultipleInstancesEnum]($args[0]) + + + + Compatibility + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.CompatibilityEnum]($this.PSBase.CimInstanceProperties['Compatibility'].Value) + + + $this.PSBase.CimInstanceProperties['Compatibility'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.CompatibilityEnum]($args[0]) + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_TaskPrincipal + + + RunLevel + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.RunLevelEnum]($this.PSBase.CimInstanceProperties['RunLevel'].Value) + + + $this.PSBase.CimInstanceProperties['RunLevel'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.RunLevelEnum]($args[0]) + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_TaskPrincipal + + + LogonType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.LogonTypeEnum]($this.PSBase.CimInstanceProperties['LogonType'].Value) + + + $this.PSBase.CimInstanceProperties['LogonType'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.LogonTypeEnum]($args[0]) + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_TaskPrincipal2 + + + RunLevel + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.RunLevelEnum]($this.PSBase.CimInstanceProperties['RunLevel'].Value) + + + $this.PSBase.CimInstanceProperties['RunLevel'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.RunLevelEnum]($args[0]) + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_TaskPrincipal2 + + + LogonType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.LogonTypeEnum]($this.PSBase.CimInstanceProperties['LogonType'].Value) + + + $this.PSBase.CimInstanceProperties['LogonType'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.LogonTypeEnum]($args[0]) + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_TaskPrincipal2 + + + ProcessTokenSidType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.ProcessTokenSidTypeEnum]($this.PSBase.CimInstanceProperties['ProcessTokenSidType'].Value) + + + $this.PSBase.CimInstanceProperties['ProcessTokenSidType'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.ProcessTokenSidTypeEnum]($args[0]) + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_ClusteredScheduledTask + + + TaskType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.ClusterTaskTypeEnum]($this.PSBase.CimInstanceProperties['TaskType'].Value) + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/ScheduledTasks/MSFT_ScheduledTask_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/ScheduledTasks/MSFT_ScheduledTask_v1.0.cdxml new file mode 100644 index 0000000..1ebcf31 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ScheduledTasks/MSFT_ScheduledTask_v1.0.cdxml @@ -0,0 +1,73 @@ + + + + 1.0 + ScheduledTask + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/ScheduledTasks/PS_ClusteredScheduledTask_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/ScheduledTasks/PS_ClusteredScheduledTask_v1.0.cdxml new file mode 100644 index 0000000..3e11c9b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ScheduledTasks/PS_ClusteredScheduledTask_v1.0.cdxml @@ -0,0 +1,391 @@ + + + + 1.0 + ClusteredScheduledTask + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/ScheduledTasks/PS_ScheduledTask.types.ps1xml b/newton-cn/bin/v1.0/Modules/ScheduledTasks/PS_ScheduledTask.types.ps1xml new file mode 100644 index 0000000..50e9272 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ScheduledTasks/PS_ScheduledTask.types.ps1xml @@ -0,0 +1,54 @@ + + + + Microsoft.Management.Infrastructure.CimInstance#PS_ScheduledTask + + + RunLevel + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.RunLevelEnum]($this.PSBase.CimInstanceProperties['RunLevel'].Value) + + + $this.PSBase.CimInstanceProperties['RunLevel'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.RunLevelEnum]($args[0]) + + + + MultipleInstances + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.ScheduledTask.MultipleInstancesEnum]($this.PSBase.CimInstanceProperties['MultipleInstances'].Value) + + + $this.PSBase.CimInstanceProperties['MultipleInstances'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.MultipleInstancesEnum]($args[0]) + + + + Compatibility + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.ScheduledTask.CompatibilityEnum]($this.PSBase.CimInstanceProperties['Compatibility'].Value) + + + $this.PSBase.CimInstanceProperties['Compatibility'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.CompatibilityEnum]($args[0]) + + + + LogonType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.LogonTypeEnum]($this.PSBase.CimInstanceProperties['LogonType'].Value) + + + $this.PSBase.CimInstanceProperties['LogonType'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.LogonTypeEnum]($args[0]) + + + + ProcessTokenSidType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.ProcessTokenSidTypeEnum]($this.PSBase.CimInstanceProperties['ProcessTokenSidType'].Value) + + + $this.PSBase.CimInstanceProperties['ProcessTokenSidType'].Value = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.ScheduledTask.ProcessTokenSidTypeEnum]($args[0]) + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/ScheduledTasks/PS_ScheduledTask_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/ScheduledTasks/PS_ScheduledTask_v1.0.cdxml new file mode 100644 index 0000000..deac266 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ScheduledTasks/PS_ScheduledTask_v1.0.cdxml @@ -0,0 +1,1348 @@ + + + + 1.0 + ScheduledTask + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/ScheduledTasks/ScheduledTasks.psd1 b/newton-cn/bin/v1.0/Modules/ScheduledTasks/ScheduledTasks.psd1 new file mode 100644 index 0000000..2483a49 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/ScheduledTasks/ScheduledTasks.psd1 @@ -0,0 +1,52 @@ + +@{ + GUID = '5378EE8E-E349-49BB-83B9-F3D9C396C0A6' + + Author = 'Microsoft Corporation' + + CompanyName = 'Microsoft Corporation' + + ClrVersion = '4.0' + + Copyright = '© Microsoft Corporation. All rights reserved.' + + ModuleVersion = '1.0.0.0' + + PowerShellVersion = '5.1' + + HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=390822" + + NestedModules = @( 'MSFT_ScheduledTask_v1.0.cdxml', + 'PS_ScheduledTask_v1.0.cdxml', + 'PS_ClusteredScheduledTask_v1.0.cdxml') + + TypesToProcess = @( 'MSFT_ScheduledTask.types.ps1xml', + 'PS_ScheduledTask.types.ps1xml' ) + + FormatsToProcess = @( 'MSFT_ScheduledTask.format.ps1xml' ) + + AliasesToExport = @() + + CmdletsToExport = @() + + FunctionsToExport = @( 'Get-ScheduledTask', + 'Set-ScheduledTask', + 'Register-ScheduledTask', + 'Unregister-ScheduledTask', + 'Enable-ScheduledTask', + 'Disable-ScheduledTask', + 'Export-ScheduledTask', + 'New-ScheduledTask', + 'New-ScheduledTaskAction', + 'New-ScheduledTaskPrincipal', + 'New-ScheduledTaskSettingsSet', + 'New-ScheduledTaskTrigger', + 'Start-ScheduledTask', + 'Stop-ScheduledTask', + 'Get-ScheduledTaskInfo' + 'Get-ClusteredScheduledTask', + 'Set-ClusteredScheduledTask', + 'Register-ClusteredScheduledTask', + 'Unregister-ClusteredScheduledTask' ) + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/SecureBoot/SecureBoot.psd1 b/newton-cn/bin/v1.0/Modules/SecureBoot/SecureBoot.psd1 new file mode 100644 index 0000000..5590ed0 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SecureBoot/SecureBoot.psd1 @@ -0,0 +1,18 @@ +@{ +GUID="{a5bd98e1-e44c-44fb-b88f-5af9bde66fdf}" +Author="Microsoft Corporation" +CompanyName="Microsoft Corporation" +Copyright="© Microsoft Corporation. All rights reserved." +ModuleVersion="2.0.0.0" +ModuleToProcess="Microsoft.SecureBoot.Commands" +PowerShellVersion = '5.1' +CLRVersion="4.0" +CmdletsToExport= + "Confirm-SecureBootUEFI", + "Set-SecureBootUEFI", + "Get-SecureBootUEFI", + "Format-SecureBootUEFI", + "Get-SecureBootPolicy" +HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=390823" +CompatiblePSEditions = @('Desktop','Core') +} diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/Smb.format.ps1xml b/newton-cn/bin/v1.0/Modules/SmbShare/Smb.format.ps1xml new file mode 100644 index 0000000..d70dbbb --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/Smb.format.ps1xml @@ -0,0 +1,1220 @@ + + + + + SmbClientConfigurationTypes + + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbClientConfiguration + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/SMB/MSFT_SmbClientConfiguration + + + + SmbClientNetworkInterfaceTypes + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbClientNetworkInterface + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbClientNetworkInterface + + + + SmbMappingTypes + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbMapping + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbMapping + + + + SmbGlobalMappingTypes + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbGlobalMapping + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbGlobalMapping + + + + SmbMultichannelConnectionTypes + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbMultichannelConnection + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbMultichannelConnection + + + + SmbOpenFileTypes + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbOpenFile + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbOpenFile + + + + SmbServerConfigurationTypes + + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbServerConfiguration + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/SMB/MSFT_SmbServerConfiguration + + + + SmbServerNetworkInterfaceTypes + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbServerNetworkInterface + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbServerNetworkInterface + + + + SmbSessionTypes + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbSession + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbSession + + + + SmbShareTypes + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbShare + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbShare + + + + SmbShareAccessControlEntryTypes + + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/SMB/MSFT_SmbShareAccessControlEntry + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbShareAccessControlEntry + + + + SmbConnectionTypes + + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/SMB/MSFT_SmbConnection + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbConnection + + + + SmbBandwidthLimitTypes + + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/SMB/MSFT_SmbBandwidthLimit + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbBandwidthLimit + + + + SmbServerCertificateMappingTypes + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbServerCertificateMapping + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbServerCertificateMapping + + + + + + + SmbClientConfigurationListView + + SmbClientConfigurationTypes + + + + + + + ConnectionCountPerRssNetworkInterface + + + DirectoryCacheEntriesMax + + + DirectoryCacheEntrySizeMax + + + DirectoryCacheLifetime + + + DormantFileLimit + + + EnableBandwidthThrottling + + + EnableByteRangeLockingOnReadOnlyFiles + + + EnableInsecureGuestLogons + + + EnableLargeMtu + + + EnableLoadBalanceScaleOut + + + EnableMultiChannel + + + EnableSecuritySignature + + + ExtendedSessionTimeout + + + FileInfoCacheEntriesMax + + + FileInfoCacheLifetime + + + FileNotFoundCacheEntriesMax + + + FileNotFoundCacheLifetime + + + KeepConn + + + MaxCmds + + + MaximumConnectionCountPerServer + + + OplocksDisabled + + + RequireSecuritySignature + + + SessionTimeout + + + UseOpportunisticLocking + + + WindowSizeThreshold + + + + + + + + SmbClientNetworkInterfaceTableView + + SmbClientNetworkInterfaceTypes + + + + + + + + + + + + + + + + + + + + + + + + + + + InterfaceIndex + + + RssCapable + + + RdmaCapable + + + + Import-Module SmbShare\SmbShare.Format.Helper.psm1 + Format-LinkSpeed $_.LinkSpeed + + + + IpAddresses + + + FriendlyName + + + + + + + + SmbClientNetworkInterfaceListView + + SmbClientNetworkInterfaceTypes + + + + + + + InterfaceIndex + + + RssCapable + + + RdmaCapable + + + + + Import-Module SmbShare\SmbShare.Format.Helper.psm1 + Format-LinkSpeed $_.LinkSpeed + + + + IpAddresses + + + FriendlyName + + + + + + + + SmbMappingTableView + + SmbMappingTypes + + + + + + + + + + + + + + + + + + Status + + + LocalPath + + + RemotePath + + + + + + + + SmbMappingListView + + SmbMappingTypes + + + + + + + Status + + + LocalPath + + + RemotePath + + + + + + + + SmbGlobalMappingTableView + + SmbGlobalMappingTypes + + + + + + + + + + + + + + + + + + Status + + + LocalPath + + + RemotePath + + + + + + + + SmbGlobalMappingListView + + SmbGlobalMappingTypes + + + + + + + Status + + + LocalPath + + + RemotePath + + + + + + + + SmbConnectiontNetworkInterfaceTableView + + SmbMultichannelConnectionTypes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ServerName + + + Selected + + + ClientIpAddress + + + ServerIpAddress + + + ClientInterfaceIndex + + + ServerInterfaceIndex + + + ClientRSSCapable + + + ClientRdmaCapable + + + + + + + + SmbMultichannelConnectionListView + + SmbMultichannelConnectionTypes + + + + + + + ServerName + + + Selected + + + Failed + + + FailureCount + + + ClientInterfaceIndex + + + ClientRSSCapable + + + ClientRdmaCapable + + + + + Import-Module SmbShare\SmbShare.Format.Helper.psm1 + Format-LinkSpeed $_.ClientLinkSpeed + + + + ClientIpAddress + + + ServerInterfaceIndex + + + ServerRSSCapable + + + ServerRdmaCapable + + + + + Import-Module SmbShare\SmbShare.Format.Helper.psm1 + Format-LinkSpeed $_.ServerLinkSpeed + + + + ServerIpAddress + + + MaxChannels + + + CurrentChannels + + + + + + + + SmbOpenFilenTableView + + SmbOpenFileTypes + + + + + + + + + + + + + + + + + + + + + + + + + + + FileId + + + SessionId + + + Path + + + ShareRelativePath + + + ClientComputerName + + + ClientUserName + + + + + + + + SmbOpenFileListView + + SmbOpenFileTypes + + + + + + + FileId + + + SessionId + + + Path + + + ShareRelativePath + + + ClientComputerName + + + ClientUserName + + + + + + + + SmbServerConfigurationListView + + SmbServerConfigurationTypes + + + + + + + AnnounceComment + + + AnnounceServer + + + AsynchronousCredits + + + AuditSmb1Access + + + AutoDisconnectTimeout + + + AutoShareServer + + + AutoShareWorkstation + + + CachedOpenLimit + + + DurableHandleV2TimeoutInSeconds + + + EnableAuthenticateUserSharing + + + EnableDownlevelTimewarp + + + EnableForcedLogoff + + + EnableLeasing + + + EnableMultiChannel + + + EnableOplocks + + + EnableSecuritySignature + + + EnableSMB1Protocol + + + EnableSMB2Protocol + + + EnableStrictNameChecking + + + EncryptData + + + IrpStackSize + + + KeepAliveTime + + + MaxChannelPerSession + + + MaxMpxCount + + + MaxSessionPerConnection + + + MaxThreadsPerQueue + + + MaxWorkItems + + + NullSessionPipes + + + NullSessionShares + + + OplockBreakWait + + + PendingClientTimeoutInSeconds + + + RejectUnencryptedAccess + + + RequireSecuritySignature + + + ServerHidden + + + Smb2CreditsMax + + + Smb2CreditsMin + + + SmbServerNameHardeningLevel + + + TreatHostAsStableStorage + + + ValidateAliasNotCircular + + + ValidateShareScope + + + ValidateShareScopeNotAliased + + + ValidateTargetName + + + + + + + + SmbServerNetworkInterfaceTableView + + SmbServerNetworkInterfaceTypes + + + + + + + + + + + + + + + + + + + + + + + + + + + ScopeName + + + InterfaceIndex + + + RssCapable + + + RdmaCapable + + + + Import-Module SmbShare\SmbShare.Format.Helper.psm1 + Format-LinkSpeed $_.LinkSpeed + + + + IpAddress + + + + + + + + SmbServerNetworkInterfaceListView + + SmbServerNetworkInterfaceTypes + + + + + + + ScopeName + + + InterfaceIndex + + + RssCapable + + + RdmaCapable + + + + + Import-Module SmbShare\SmbShare.Format.Helper.psm1 + Format-LinkSpeed $_.LinkSpeed + + + + IpAddress + + + + + + + + SmbSessionTableView + + SmbSessionTypes + + + + + + + + + + + + + + + + + + + + + SessionId + + + ClientComputerName + + + ClientUserName + + + NumOpens + + + + + + + + SmbSessionListView + + SmbSessionTypes + + + + + + + SessionId + + + ClientComputerName + + + ClientUserName + + + NumOpens + + + SecondsIdle + + + SecondsExists + + + + + + + + SmbShareAccessControlEntryTableView + + SmbShareAccessControlEntryTypes + + + + + + + + + + + + + + + + + + + + + + + + Name + + + ScopeName + + + AccountName + + + AccessControlType + + + AccessRight + + + + + + + + SmbShareAccessControlEntryListView + + SmbShareAccessControlEntryTypes + + + + + + + Name + + + ScopeName + + + AccountName + + + AccessControlType + + + AccessRight + + + + + + + + SmbShareTableView + + SmbShareTypes + + + + + + + + + + + + + + + + + + + + + Name + + + ScopeName + + + Path + + + Description + + + + + + + + SmbShareListView + + SmbShareTypes + + + + + + + Name + + + ScopeName + + + Path + + + Description + + + + + + + + SmbConnectionTableView + + SmbConnectionTypes + + + + + + + + + + + + + + + + + + + + + + + + + + + ServerName + + + ShareName + + + UserName + + + Credential + + + Dialect + + + NumOpens + + + + + + + + SmbConnectionListView + + SmbConnectionTypes + + + + + + + ServerName + + + ShareName + + + UserName + + + Credential + + + Dialect + + + NumOpens + + + + + + + + SmbBandwidthLimitTableView + + SmbBandwidthLimitTypes + + + + + + + + + + + + + + + Category + + + BytesPerSecond + + + + + + + + SmbServerCertificateMappingTableView + + SmbServerCertificateMappingTypes + + + + + + + + + + + + + + + + + + + + + + + + Name + + + Subject + + + Thumbprint + + + DisplayName + + + Type + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/Smb.types.ps1xml b/newton-cn/bin/v1.0/Modules/SmbShare/Smb.types.ps1xml new file mode 100644 index 0000000..3dd9cfe --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/Smb.types.ps1xml @@ -0,0 +1,453 @@ + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbShare + + + PresetPathAcl + + $acl = Get-Acl ($this.PSBase.CimInstanceProperties['Path'].Value) + $acl.SetSecurityDescriptorSddlForm( $this.PSBase.CimInstanceProperties['SecurityDescriptor'].Value, [System.Security.AccessControl.AccessControlSections]::Access ) + + $newacl = Get-Acl ($this.PSBase.CimInstanceProperties['Path'].Value) + $newacl.SetSecurityDescriptorSddlForm( $this.PSBase.CimInstanceProperties['SecurityDescriptor'].Value, [System.Security.AccessControl.AccessControlSections]::Access ) + + + $type = [System.Security.Principal.SecurityIdentifier] + $flag = [System.Security.AccessControl.InheritanceFlags]::ContainerInherit,[System.Security.AccessControl.InheritanceFlags]::ObjectInherit + $rules = $acl.GetAccessRules( $true, $false, $type) + + # + # First clear all rules fron $newacl + # + For( $i=0; $i -lt $rules.Count; $i++ ) + { + $newacl.PurgeAccessRules( $rules[$i].IdentityReference ) + } + + # + # Now add the rules back with Container Inheritance and Object Inheritance flags set + # + For( $i=0; $i -lt $rules.Count; $i++ ) + { + $modifiedRule = new-object System.Security.AccessControl.FileSystemAccessRule $rules[$i].IdentityReference,$rules[$i].FileSystemRights,$flag,$rules[$i].PropagationFlags,$rules[$i].AccessControlType + + $newacl.AddAccessRule( $modifiedRule) + } + + $newacl + + + + + ShareState + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.ShareState] ($this.PSBase.CimInstanceProperties['ShareState'].Value) + + + + AvailabilityType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.AvailabilityType] ($this.PSBase.CimInstanceProperties['AvailabilityType'].Value) + + + + ShareType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.ShareType] ($this.PSBase.CimInstanceProperties['ShareType'].Value) + + + + FolderEnumerationMode + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.FolderEnumerationMode] ($this.PSBase.CimInstanceProperties['FolderEnumerationMode'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['FolderEnumerationMode'].Value = [System.UInt32] [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.FolderEnumerationMode] $newValue + + + + CachingMode + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.CachingMode] ($this.PSBase.CimInstanceProperties['CachingMode'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['CachingMode'].Value = [System.UInt32] [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.CachingMode] $newValue + + + + LeasingMode + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.LeasingMode] ($this.PSBase.CimInstanceProperties['LeasingMode'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['LeasingMode'].Value = [System.UInt32] [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.LeasingMode] $newValue + + + + SmbInstance + + if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) + { + $SmbInstance = 0; + } + else + { + $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); + } + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbShare + + + ShareState + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.ShareState] ($this.PSBase.CimInstanceProperties['ShareState'].Value) + + + + AvailabilityType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.AvailabilityType] ($this.PSBase.CimInstanceProperties['AvailabilityType'].Value) + + + + ShareType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.ShareType] ($this.PSBase.CimInstanceProperties['ShareType'].Value) + + + + FolderEnumerationMode + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.FolderEnumerationMode] ($this.PSBase.CimInstanceProperties['FolderEnumerationMode'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['FolderEnumerationMode'].Value = [System.UInt32] [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.FolderEnumerationMode] $newValue + + + + CachingMode + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.CachingMode] ($this.PSBase.CimInstanceProperties['CachingMode'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['CachingMode'].Value = [System.UInt32] [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.CachingMode] $newValue + + + + SmbInstance + + if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) + { + $SmbInstance = 0; + } + else + { + $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); + } + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbShareAccessControlEntry + + + AccessControlType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.ShareAccessControlType] ($this.PSBase.CimInstanceProperties['AccessControlType'].Value) + + + + AccessRight + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.ShareAccessRight] ($this.PSBase.CimInstanceProperties['AccessRight'].Value) + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/SMB/MSFT_SmbShareAccessControlEntry + + + AccessControlType + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.ShareAccessControlType] ($this.PSBase.CimInstanceProperties['AccessControlType'].Value) + + + + AccessRight + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.ShareAccessRight] ($this.PSBase.CimInstanceProperties['AccessRight'].Value) + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbMapping + + + Status + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.MappingStatus] ($this.PSBase.CimInstanceProperties['Status'].Value) + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbMapping + + + Status + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.MappingStatus] ($this.PSBase.CimInstanceProperties['Status'].Value) + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbGlobalMapping + + + Status + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.MappingStatus] ($this.PSBase.CimInstanceProperties['Status'].Value) + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbGlobalMapping + + + Status + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.MappingStatus] ($this.PSBase.CimInstanceProperties['Status'].Value) + + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbBandwidthLimit + + + Category + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.BandwidthLimitCategory] ($this.PSBase.CimInstanceProperties['Category'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Category'].Value = [System.UInt32] [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.BandwidthLimitCategory] $newValue + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbBandwidthLimit + + + Category + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.BandwidthLimitCategory] ($this.PSBase.CimInstanceProperties['Category'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['Category'].Value = [System.UInt32] [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.BandwidthLimitCategory] $newValue + + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbSession + + + SmbInstance + + if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) + { + $SmbInstance = 0; + } + else + { + $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); + } + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbSession + + + SmbInstance + + if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) + { + $SmbInstance = 0; + } + else + { + $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); + } + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) + + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbOpenFile + + + SmbInstance + + if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) + { + $SmbInstance = 0; + } + else + { + $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); + } + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbOpenFile + + + SmbInstance + + if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) + { + $SmbInstance = 0; + } + else + { + $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); + } + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) + + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbConnection + + + SmbInstance + + if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) + { + $SmbInstance = 0; + } + else + { + $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); + } + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbConnection + + + SmbInstance + + if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) + { + $SmbInstance = 0; + } + else + { + $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); + } + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) + + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbMultichannelConnection + + + SmbInstance + + if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) + { + $SmbInstance = 0; + } + else + { + $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); + } + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbMultichannelConnection + + + SmbInstance + + if ($null -eq ($this.PSBase.CimInstanceProperties['SmbInstance'].Value)) + { + $SmbInstance = 0; + } + else + { + $SmbInstance = ($this.PSBase.CimInstanceProperties['SmbInstance'].Value); + } + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbShare.SmbInstance] ($SmbInstance) + + + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbServerCertificateMapping + + + Type + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbServerCertificateMapping.Type] ($this.PSBase.CimInstanceProperties['Type'].Value) + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbServerCertificateMapping + + + Type + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbServerCertificateMapping.Type] ($this.PSBase.CimInstanceProperties['Type'].Value) + + + + + diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/SmbBandwidthLimit.cdxml b/newton-cn/bin/v1.0/Modules/SmbShare/SmbBandwidthLimit.cdxml new file mode 100644 index 0000000..cabd254 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/SmbBandwidthLimit.cdxml @@ -0,0 +1,105 @@ + + + + + 1.0 + + SmbBandwidthLimit + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/SmbClientConfiguration.cdxml b/newton-cn/bin/v1.0/Modules/SmbShare/SmbClientConfiguration.cdxml new file mode 100644 index 0000000..256185a --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/SmbClientConfiguration.cdxml @@ -0,0 +1,237 @@ + + + + 1.0 + + SmbClientConfiguration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/SmbClientNetworkInterface.cdxml b/newton-cn/bin/v1.0/Modules/SmbShare/SmbClientNetworkInterface.cdxml new file mode 100644 index 0000000..6a9a01d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/SmbClientNetworkInterface.cdxml @@ -0,0 +1,26 @@ + + + + 1.0 + + SmbClientNetworkInterface + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/SmbComponent.cdxml b/newton-cn/bin/v1.0/Modules/SmbShare/SmbComponent.cdxml new file mode 100644 index 0000000..15d54c2 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/SmbComponent.cdxml @@ -0,0 +1,41 @@ + + + + + 1.0 + SmbComponent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/SmbConnection.cdxml b/newton-cn/bin/v1.0/Modules/SmbShare/SmbConnection.cdxml new file mode 100644 index 0000000..0358b15 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/SmbConnection.cdxml @@ -0,0 +1,56 @@ + + + + 1.0 + + SmbConnection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/SmbGlobalMapping.cdxml b/newton-cn/bin/v1.0/Modules/SmbShare/SmbGlobalMapping.cdxml new file mode 100644 index 0000000..3071864 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/SmbGlobalMapping.cdxml @@ -0,0 +1,169 @@ + + + + 1.0 + SmbGlobalMapping + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/SmbMapping.cdxml b/newton-cn/bin/v1.0/Modules/SmbShare/SmbMapping.cdxml new file mode 100644 index 0000000..389b918 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/SmbMapping.cdxml @@ -0,0 +1,177 @@ + + + + 1.0 + + SmbMapping + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/SmbMultichannelConnection.cdxml b/newton-cn/bin/v1.0/Modules/SmbShare/SmbMultichannelConnection.cdxml new file mode 100644 index 0000000..827fdf5 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/SmbMultichannelConnection.cdxml @@ -0,0 +1,83 @@ + + + + 1.0 + + SmbMultichannelConnection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/SmbMultichannelConstraint.cdxml b/newton-cn/bin/v1.0/Modules/SmbShare/SmbMultichannelConstraint.cdxml new file mode 100644 index 0000000..a1d73fc --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/SmbMultichannelConstraint.cdxml @@ -0,0 +1,168 @@ + + + + + 1.0 + + SmbMultichannelConstraint + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/SmbOpenFile.cdxml b/newton-cn/bin/v1.0/Modules/SmbShare/SmbOpenFile.cdxml new file mode 100644 index 0000000..c32a50e --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/SmbOpenFile.cdxml @@ -0,0 +1,149 @@ + + + + 1.0 + + SmbOpenFile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/SmbScriptModule.psm1 b/newton-cn/bin/v1.0/Modules/SmbShare/SmbScriptModule.psm1 new file mode 100644 index 0000000..9dbba10 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/SmbScriptModule.psm1 @@ -0,0 +1,185 @@ + data _system_translations + { + ConvertFrom-StringData @' + + # Fallback text + # Copy all the strings in the psd1 file here + + msg_ad_forest = SMB Delegation cmdlets require the Active Directory forest to be in Windows Server 2012 forest functional level. + + msg_ad_cmdlets = SMB Delegation cmdlets require the installation of the Active Directory module for Windows PowerShell. + +'@ +} + +Import-LocalizedData -BindingVariable _system_translations -fileName SmbLocalization.psd1 + + function Set-SmbPathAcl + { + [CmdletBinding()] + param( + [Parameter(Mandatory=$true)] + [string] + $ShareName, + + [Parameter()] + [string] + $ScopeName = $null + ) + + if( ($null -ne $ScopeName ) -and ( "" -ne $ScopeName) ) + { + (Get-SmbShare -Name $ShareName -ScopeName $ScopeName ).PresetPathACL | Set-Acl + } + else + { + (Get-SmbShare -Name $ShareName ).PresetPathACL | Set-Acl + } + + } + +function CheckDelegationPrerequisites +{ + if( $null -eq (Get-Command -Module ActiveDirectory) ) + { + Write-Error $_system_translations.msg_ad_cmdlets + + return $false + } + + # + # Forest mode should be greater than or equal to Windows2012Forest + # + if( (Get-AdForest).ForestMode.ToInt32($null) -lt [Microsoft.ActiveDirectory.Management.AdForestMode]::Windows2012Forest.ToInt32($null) ) + { + Write-Error $_system_translations.msg_ad_forest + + return $false + } + + return $true +} + + function Get-SmbDelegation + { + [CmdletBinding()] + param( + [Parameter(Mandatory=$true)] + [string] + $SmbServer + ) + + $check = CheckDelegationPrerequisites + + if( -not $check ) + { + return + } + + $result = @() + + $fsAD = Get-ADComputer -filter {Name -Like $SmbServer} -Properties 'msds-allowedtoactonbehalfofotheridentity' + + foreach ($AllowedAccount in $fsAD."msDS-AllowedToActOnBehalfOfOtherIdentity".Access) + { + $samAccountName = $AllowedAccount.IdentityReference.Value + $samAccountName = $samAccountName.Remove(0, ($samAccountName.IndexOf("\")+1)) + + $result += Get-ADComputer -Filter {SamAccountName -Like $samAccountName} + } + + $result.Name + } + + function Enable-SmbDelegation + { + [CmdletBinding()] + param( + [Parameter(Mandatory=$true)] + [string] + $SmbClient, + + [Parameter(Mandatory=$true)] + [string] + $SmbServer + ) + + $check = CheckDelegationPrerequisites + + if( -not $check ) + { + return + } + + $delegationPrinciples = @() + $fsAD = Get-ADComputer -Filter {Name -Like $SmbServer} -Properties msDS-AllowedToActOnBehalfOfOtherIdentity + + foreach ($AllowedAccount in $fsAD."msDS-AllowedToActOnBehalfOfOtherIdentity".Access) + { + $samAccountName = $AllowedAccount.IdentityReference.Value + $samAccountName = $samAccountName.Remove(0, ($samAccountName.IndexOf("\")+1)) + + $delegationPrinciples += Get-ADComputer -Filter {SamAccountName -Like $samAccountName} + } + + $delegationPrinciples += Get-ADComputer -Identity $SmbClient + $fsAD | Set-ADComputer -PrincipalsAllowedToDelegateToAccount $delegationPrinciples + } + + + function Disable-SmbDelegation + { + [CmdletBinding()] + param( + [Parameter()] + [string] + $SmbClient, + + [Parameter(Mandatory=$true)] + [string] + $SmbServer, + + [System.Management.Automation.SwitchParameter] + [bool] + $Force = $false + ) + + $check = CheckDelegationPrerequisites + + if( -not $check ) + { + return + } + + $delegationPrinciples = @() + $fsAD = Get-ADComputer -Filter {Name -Like $SmbServer} -Properties msDS-AllowedToActOnBehalfOfOtherIdentity + + if( ($null -ne $SmbClient) -and ("" -ne $SmbClient) ) + { + foreach ($AllowedAccount in $fsAD."msDS-AllowedToActOnBehalfOfOtherIdentity".Access) + { + $samAccountName = $AllowedAccount.IdentityReference.Value + $samAccountName = $samAccountName.Remove(0, ($samAccountName.IndexOf("\")+1)) + + $adc = Get-ADComputer -Filter {SamAccountName -Like $samAccountName} + + if( $adc.Name -ne $SmbClient ) + { + $delegationPrinciples += $adc + } + } + } + + $fsAD | Set-ADComputer -PrincipalsAllowedToDelegateToAccount $delegationPrinciples + } + + Set-Alias -Name ssmbp -Value Set-SmbPathAcl + Set-Alias -Name gsmbd -Value Get-SmbDelegation + Set-Alias -Name esmbd -Value Enable-SmbDelegation + Set-Alias -Name dsmbd -Value Disable-SmbDelegation + + + Export-ModuleMember -Function Set-SmbPathAcl -Alias ssmbp + Export-ModuleMember -Function Get-SmbDelegation -Alias gsmbd + Export-ModuleMember -Function Enable-SmbDelegation -Alias esmbd + Export-ModuleMember -Function Disable-SmbDelegation -Alias dsmbd \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/SmbServerCertificateMapping.cdxml b/newton-cn/bin/v1.0/Modules/SmbShare/SmbServerCertificateMapping.cdxml new file mode 100644 index 0000000..b20d89c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/SmbServerCertificateMapping.cdxml @@ -0,0 +1,198 @@ + + + + + 1.0 + + SmbServerCertificateMapping + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/SmbServerConfiguration.cdxml b/newton-cn/bin/v1.0/Modules/SmbShare/SmbServerConfiguration.cdxml new file mode 100644 index 0000000..cf28b0b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/SmbServerConfiguration.cdxml @@ -0,0 +1,350 @@ + + + + 1.0 + + SmbServerConfiguration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/SmbServerNetworkInterface.cdxml b/newton-cn/bin/v1.0/Modules/SmbShare/SmbServerNetworkInterface.cdxml new file mode 100644 index 0000000..fd433a3 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/SmbServerNetworkInterface.cdxml @@ -0,0 +1,26 @@ + + + + 1.0 + + SmbServerNetworkInterface + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/SmbSession.cdxml b/newton-cn/bin/v1.0/Modules/SmbShare/SmbSession.cdxml new file mode 100644 index 0000000..dc8b5a4 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/SmbSession.cdxml @@ -0,0 +1,136 @@ + + + + 1.0 + + SmbSession + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/SmbShare.Format.Helper.psm1 b/newton-cn/bin/v1.0/Modules/SmbShare/SmbShare.Format.Helper.psm1 new file mode 100644 index 0000000..bcb34a6 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/SmbShare.Format.Helper.psm1 @@ -0,0 +1,43 @@ +<# + +Copyright (c) 2011 Microsoft Corporation. All Rights Reserved. + +Module Name: + + SmbShare.Format.Helper.psm1 + +Description: + + Provides helper routines for formatting the output of + SmbShare CmdLets. + +#> + +function Format-LinkSpeed($LinkSpeed) +<# +Function Description: + This function returns the link speed of a network adapter + +Arguments: + $LinkSpeed + +Return Value: + Formatted link speed +#> +{ + $out= + if($LinkSpeed -eq $null) + {"Unknown"} + else + { + switch ($LinkSpeed) + { + {$_ -lt 1000} {"$_ bps"; break} + {$_ -lt 1000000} {"$($_/1000) Kbps"; break} + {$_ -lt 1000000000} {"$($_/1000000) Mbps"; break} + default {"$($_/1000000000) Gbps"} + } + } + + return $out +} \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/SmbShare.cdxml b/newton-cn/bin/v1.0/Modules/SmbShare/SmbShare.cdxml new file mode 100644 index 0000000..1067238 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/SmbShare.cdxml @@ -0,0 +1,776 @@ + + + + + 1.0 + + SmbShare + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/SmbShare.psd1 b/newton-cn/bin/v1.0/Modules/SmbShare/SmbShare.psd1 new file mode 100644 index 0000000..6445c63 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/SmbShare.psd1 @@ -0,0 +1,114 @@ + +@{ + GUID = '3af1699d-cc54-4e54-81cf-28d2df5cce0a' + Author="Microsoft Corporation" + CompanyName="Microsoft Corporation" + Copyright="© Microsoft Corporation. All rights reserved." + HelpInfoUri="http://go.microsoft.com/fwlink/?linkid=390827" + NestedModules = @('SmbShare.cdxml', + 'SmbSession.cdxml', + 'SmbServerNetworkInterface.cdxml', + 'SmbServerConfiguration.cdxml', + 'SmbOpenFile.cdxml', + 'SmbMultichannelConnection.cdxml', + 'SmbMapping.cdxml', + 'SmbGlobalMapping.cdxml', + 'SmbClientNetworkInterface.cdxml', + 'SmbClientConfiguration.cdxml', + 'SmbConnection.cdxml', + 'SmbMultichannelConstraint.cdxml', + 'SmbBandwidthLimit.cdxml', + 'SmbServerCertificateMapping.cdxml', + 'SmbComponent.cdxml', + 'SmbScriptModule.psm1') + FormatsToProcess = @('Smb.format.ps1xml') + TypesToProcess = @('Smb.types.ps1xml') + ModuleVersion = '2.0.0.0' + AliasesToExport = @('gsmbs', + 'nsmbs', + 'rsmbs', + 'ssmbs', + 'gsmba', + 'grsmba', + 'rksmba', + 'blsmba', + 'ulsmba', + 'gsmbse', + 'cssmbse', + 'gsmbo', + 'cssmbo', + 'gsmbsc', + 'ssmbsc', + 'gsmbcc', + 'ssmbcc', + 'gsmbc', + 'gsmbm', + 'nsmbm', + 'rsmbm', + 'gsmbcn', + 'gsmbsn', + 'gsmbmc', + 'udsmbmc', + 'gsmbt', + 'nsmbt', + 'rsmbt', + 'ssmbp', + 'gsmbb', + 'ssmbb', + 'rsmbb', + 'gsmbd', + 'esmbd', + 'dsmbd', + 'gsmbgm', + 'nsmbgm', + 'rsmbgm', + 'gsmbscm', + 'rsmbscm', + 'nsmbscm', + 'rsmbc') + CmdletsToExport = @() + FunctionsToExport = @('Get-SmbShare', + 'Remove-SmbShare', + 'Set-SmbShare', + 'Block-SmbShareAccess', + 'Unblock-SmbShareAccess', + 'Grant-SmbShareAccess', + 'Revoke-SmbShareAccess', + 'Get-SmbShareAccess', + 'New-SmbShare', + 'Get-SmbSession', + 'Close-SmbSession', + 'Get-SmbServerNetworkInterface', + 'Get-SmbServerConfiguration', + 'Set-SmbServerConfiguration', + 'Get-SmbOpenFile', + 'Close-SmbOpenFile', + 'Get-SmbMultichannelConnection', + 'Update-SmbMultichannelConnection', + 'Get-SmbMapping', + 'Remove-SmbMapping', + 'New-SmbMapping', + 'Get-SmbClientNetworkInterface', + 'Get-SmbClientConfiguration', + 'Set-SmbClientConfiguration', + 'Get-SmbConnection', + 'Get-SmbMultichannelConstraint', + 'New-SmbMultichannelConstraint', + 'Remove-SmbMultichannelConstraint', + 'Set-SmbPathAcl', + 'Get-SmbBandWidthLimit', + 'Set-SmbBandwidthLimit', + 'Remove-SmbBandwidthLimit', + 'Get-SmbDelegation', + 'Enable-SmbDelegation', + 'Disable-SmbDelegation', + 'Get-SmbGlobalMapping', + 'Remove-SmbGlobalMapping', + 'New-SmbGlobalMapping', + 'Get-SmbServerCertificateMapping', + 'New-SmbServerCertificateMapping', + 'Remove-SmbServerCertificateMapping', + 'Remove-SMBComponent') + PowerShellVersion = '5.1' + CompatiblePSEditions = @('Desktop','Core') +} diff --git a/newton-cn/bin/v1.0/Modules/SmbShare/en-US/SmbLocalization.psd1 b/newton-cn/bin/v1.0/Modules/SmbShare/en-US/SmbLocalization.psd1 new file mode 100644 index 0000000..621b912 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbShare/en-US/SmbLocalization.psd1 @@ -0,0 +1,11 @@ +# Localized 12/07/2019 01:04 AM (GMT) 303:6.40.20520 SmbLocalization.psd1 +# Only add new (name,value) pairs to the end of this table +# Do not remove, insert or re-arrange entries + +ConvertFrom-StringData @' + + msg_ad_forest = SMB Delegation cmdlets require the Active Directory forest to be in Windows Server 2012 forest functional level. + + msg_ad_cmdlets = SMB Delegation cmdlets require the installation of the Active Directory module for Windows PowerShell. + +'@ diff --git a/newton-cn/bin/v1.0/Modules/SmbWitness/SmbWitness.Format.ps1xml b/newton-cn/bin/v1.0/Modules/SmbWitness/SmbWitness.Format.ps1xml new file mode 100644 index 0000000..5230543 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbWitness/SmbWitness.Format.ps1xml @@ -0,0 +1,65 @@ + + + + SmbWitnessClientEntryType + + Microsoft.Management.Infrastructure.CimInstance#root\Microsoft\Windows\SMBWitness\MSFT_SmbWitnessClient + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbWitnessClient + + + + + + SmbWitnessClientTableView + + SmbWitnessClientEntryType + + + + + + + + + + + + + + + + + + + + + + + + + + + ClientName + + + WitnessNodeName + + + FileServerNodeName + + + NetworkName + + + ShareName + + + State + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/SmbWitness/SmbWitness.psd1 b/newton-cn/bin/v1.0/Modules/SmbWitness/SmbWitness.psd1 new file mode 100644 index 0000000..9adc04c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbWitness/SmbWitness.psd1 @@ -0,0 +1,19 @@ + +@{ + GUID = 'ef018256-3318-4e74-a823-158022778487' + Author="Microsoft Corporation" + CompanyName="Microsoft Corporation" + Copyright="© Microsoft Corporation. All rights reserved." + NestedModules = @('SmbWitnessWmiClient.cdxml') + FormatsToProcess = @('SmbWitness.format.ps1xml') + TypesToProcess = @('SmbWitness.types.ps1xml') + ModuleVersion = '2.0.0.0' + AliasesToExport = @('gsmbw', + 'msmbw', + 'Move-SmbClient') + FunctionsToExport = @('Get-SmbWitnessClient', + 'Move-SmbWitnessClient') + PowerShellVersion = '5.1' + HelpInfoUri= "http://go.microsoft.com/fwlink/?linkid=390828" + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/SmbWitness/SmbWitness.types.ps1xml b/newton-cn/bin/v1.0/Modules/SmbWitness/SmbWitness.types.ps1xml new file mode 100644 index 0000000..36208d1 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbWitness/SmbWitness.types.ps1xml @@ -0,0 +1,37 @@ + + + + Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/SMB/MSFT_SmbWitnessClient + + + State + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbWitnessClient.State] ($this.PSBase.CimInstanceProperties['State'].Value) + + + + Flags + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbWitnessClient.Flags] ($this.PSBase.CimInstanceProperties['Flags'].Value) + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_SmbWitnessClient + + + State + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbWitnessClient.State] ($this.PSBase.CimInstanceProperties['State'].Value) + + + + Flags + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.SmbWitnessClient.Flags] ($this.PSBase.CimInstanceProperties['Flags'].Value) + + + + + diff --git a/newton-cn/bin/v1.0/Modules/SmbWitness/SmbWitnessWmiClient.cdxml b/newton-cn/bin/v1.0/Modules/SmbWitness/SmbWitnessWmiClient.cdxml new file mode 100644 index 0000000..c7e19b1 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/SmbWitness/SmbWitnessWmiClient.cdxml @@ -0,0 +1,80 @@ + + + + + 1.0 + SmbWitnessClient + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/StartLayout/GetStartApps.psm1 b/newton-cn/bin/v1.0/Modules/StartLayout/GetStartApps.psm1 new file mode 100644 index 0000000..3f5adc1 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/StartLayout/GetStartApps.psm1 @@ -0,0 +1,14 @@ +function Get-StartApps($Name) { + Get-AllStartApps | Where-Object { $_.Name -like "*$Name*" } +} + +function Get-AllStartApps { + (New-Object -ComObject Shell.Application). + NameSpace("shell:::{4234d49b-0245-4df3-b780-3893943456e1}"). # FOLDERID_AppsFolder + Items() | % { + [PSCustomObject]@{ + 'Name'=$_.Name + 'AppID'=$_.Path + } + } +} \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/StartLayout/StartLayout.psd1 b/newton-cn/bin/v1.0/Modules/StartLayout/StartLayout.psd1 new file mode 100644 index 0000000..0aadcdb --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/StartLayout/StartLayout.psd1 @@ -0,0 +1,15 @@ +@{ +GUID="C361139B-C043-44A9-B94F-513FBAF1AF0D" +Author="Microsoft Corporation" +CompanyName="Microsoft Corporation" +Copyright="© Microsoft Corporation. All rights reserved." +ModuleVersion="1.0.0.2" +PowerShellVersion = '5.1' +ClrVersion="4.0" +RootModule="Microsoft.Windows.StartLayout.Commands" +NestedModules="GetStartApps.psm1" +CmdletsToExport="Export-StartLayout", "Import-StartLayout", "Export-StartLayoutEdgeAssets" +FunctionsToExport="Get-StartApps" +HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=390831" +CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/Storage/Disk.cdxml b/newton-cn/bin/v1.0/Modules/Storage/Disk.cdxml new file mode 100644 index 0000000..77a39c2 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/Disk.cdxml @@ -0,0 +1,562 @@ + + + 1.0.0.0 + Disk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/DiskImage.cdxml b/newton-cn/bin/v1.0/Modules/Storage/DiskImage.cdxml new file mode 100644 index 0000000..872dd18 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/DiskImage.cdxml @@ -0,0 +1,150 @@ + + + 1.0.0.0 + DiskImage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/Storage/FileIntegrity.cdxml b/newton-cn/bin/v1.0/Modules/Storage/FileIntegrity.cdxml new file mode 100644 index 0000000..ea1f5d7 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/FileIntegrity.cdxml @@ -0,0 +1,92 @@ + + + 1.0.0.0 + FileIntegrity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/FileServer.cdxml b/newton-cn/bin/v1.0/Modules/Storage/FileServer.cdxml new file mode 100644 index 0000000..e1846f8 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/FileServer.cdxml @@ -0,0 +1,210 @@ + + + 1.0.0.0 + StorageFileServer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/Storage/FileShare.cdxml b/newton-cn/bin/v1.0/Modules/Storage/FileShare.cdxml new file mode 100644 index 0000000..ba1b170 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/FileShare.cdxml @@ -0,0 +1,386 @@ + + + 1.0.0.0 + FileShare + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/Storage/FileStorageTier.cdxml b/newton-cn/bin/v1.0/Modules/Storage/FileStorageTier.cdxml new file mode 100644 index 0000000..d270f61 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/FileStorageTier.cdxml @@ -0,0 +1,269 @@ + + + 1.0.0.0 + FileStorageTier + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/InitiatorId.cdxml b/newton-cn/bin/v1.0/Modules/Storage/InitiatorId.cdxml new file mode 100644 index 0000000..9a7bc44 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/InitiatorId.cdxml @@ -0,0 +1,139 @@ + + + 1.0.0.0 + InitiatorId + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/InitiatorPort.cdxml b/newton-cn/bin/v1.0/Modules/Storage/InitiatorPort.cdxml new file mode 100644 index 0000000..977454c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/InitiatorPort.cdxml @@ -0,0 +1,152 @@ + + + 1.0.0.0 + InitiatorPort + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/MaskingSet.cdxml b/newton-cn/bin/v1.0/Modules/Storage/MaskingSet.cdxml new file mode 100644 index 0000000..3b88138 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/MaskingSet.cdxml @@ -0,0 +1,524 @@ + + + 1.0.0.0 + MaskingSet + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/OffloadDataTransferSetting.cdxml b/newton-cn/bin/v1.0/Modules/Storage/OffloadDataTransferSetting.cdxml new file mode 100644 index 0000000..86c2d2d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/OffloadDataTransferSetting.cdxml @@ -0,0 +1,26 @@ + + + 1.0.0.0 + OffloadDataTransferSetting + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/Storage/Partition.cdxml b/newton-cn/bin/v1.0/Modules/Storage/Partition.cdxml new file mode 100644 index 0000000..2c0bdf1 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/Partition.cdxml @@ -0,0 +1,404 @@ + + + 1.0.0.0 + Partition + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/PhysicalDisk.cdxml b/newton-cn/bin/v1.0/Modules/Storage/PhysicalDisk.cdxml new file mode 100644 index 0000000..23c102f --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/PhysicalDisk.cdxml @@ -0,0 +1,6 @@ + + + 1.0.0.0 + PhysicalDisk + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/ResiliencySetting.cdxml b/newton-cn/bin/v1.0/Modules/Storage/ResiliencySetting.cdxml new file mode 100644 index 0000000..69f9257 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/ResiliencySetting.cdxml @@ -0,0 +1,123 @@ + + + 1.0.0.0 + ResiliencySetting + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/Storage/Storage.format.ps1xml b/newton-cn/bin/v1.0/Modules/Storage/Storage.format.ps1xml new file mode 100644 index 0000000..158aaf6 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/Storage.format.ps1xml @@ -0,0 +1,2933 @@ + + + + + DeviceInformation + + + + + DeviceNumber : + + DeviceNumber + + + DeviceGuid : + + DeviceGuid + + + FriendlyName : + + FriendlyName + + + SerialNumber : + + SerialNumber + + + AdapterSerialNumber : + + AdapterSerialNumber + + + FirmwareRevision : + + FirmwareRevision + + + BusType : + + BusType + + + MediaType : + + MediaType + + + IoTimeout : + + + if ($_.IoTimeout -gt 0) + { + $_.IoTimeout.ToString() + " seconds" + } + else + { + "Not available" + } + + + + + + + + + + + + DiskTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_Disk + + + + + + 6 + + + + + + + 32 + + + + 20 + + + + 20 + + + + 12 + + + + 10 + + + + + + + Number + + + FriendlyName + + + SerialNumber + + + HealthStatus + + + OperationalStatus + + + Right + + $size = $_.Size; + $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) + for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } + return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; + + + + PartitionStyle + + + + + + + + DiskListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_Disk + + + + + + + UniqueId + + + Number + + + Path + + + Manufacturer + + + Model + + + SerialNumber + + + + + $size = $_.Size; + $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) + for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } + return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; + + + + AllocatedSize + + + LogicalSectorSize + + + PhysicalSectorSize + + + NumberOfPartitions + + + PartitionStyle + + + IsReadOnly + + + IsSystem + + + IsBoot + + + + + + + + + PartitionTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_Partition + + + DiskId + + + + + + + 16 + + + + 11 + + + + + + + 10 + + + + + + + + + + PartitionNumber + + + DriveLetter + + + Offset + + + Right + + $size = $_.Size; + $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) + for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } + return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; + + + + Type + + + + + + + + PartitionListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_Partition + + + + + + + UniqueId + + + AccessPaths + + + DiskNumber + + + DiskPath + + + DriveLetter + + + Guid + + + IsActive + + + IsBoot + + + IsHidden + + + IsOffline + + + IsReadOnly + + + IsShadowCopy + + + IsDAX + + + IsSystem + + + NoDefaultDriveLetter + + + Offset + + + OperationalStatus + + + PartitionNumber + + + + + $size = $_.Size; + $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) + for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } + return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; + + + + Type + + + + + + + + + VirtualDiskTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_VirtualDisk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FriendlyName + + + ResiliencySettingName + + + PhysicalDiskRedundancy + + + OperationalStatus + + + HealthStatus + + + Right + + $size = $_.Size; + $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) + for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } + return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; + + + + Right + + $footprint = $_.FootprintOnPool; + $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) + for ($i=0; $footprint -ge 1024 -and $i -lt $postfixes.Length; $i++) { $footprint = $footprint / 1024; } + return "" + [System.Math]::Round($footprint,2) + " " + $postfixes[$i]; + + + + Right + + $efficiency = ""; + if ($_.FootprintOnPool -gt 0) { $efficiency = ($_.AllocatedSize / $_.FootprintOnPool).ToString("P"); } + return $efficiency + + + + + + + + + + StorageTierTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageTier + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FriendlyName + + + TierClass + + + MediaType + + + ResiliencySettingName + + + PhysicalDiskRedundancy + + + Right + + $size = $_.Size; + $postfixes = @( "B ", "KB", "MB", "GB", "TB", "PB" ) + for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } + return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; + + + + Right + + $footprint = $_.FootprintOnPool; + $postfixes = @( "B ", "KB", "MB", "GB", "TB", "PB" ) + for ($i=0; $footprint -ge 1024 -and $i -lt $postfixes.Length; $i++) { $footprint = $footprint / 1024; } + return "" + [System.Math]::Round($footprint,2) + " " + $postfixes[$i]; + + + + Right + + $efficiency = ""; + if ($_.FootprintOnPool -gt 0) { $efficiency = ($_.Size / $_.FootprintOnPool).ToString("P"); } + return $efficiency + + + + + + + + + + StorageFaultDomainView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageFaultDomain + + + + + + 24 + + + + + + + + + + + + + 14 + + + + + + + + + + + return $_.ClassName.Replace('MSFT_', ''); + + + + FriendlyName + + + SerialNumber + + + PhysicalLocation + + + HealthStatus + + + OperationalStatus + + + + + + + + + PhysicalDiskTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_PhysicalDisk + + + + + + + + + + + + + + + + + + 9 + + + + + + + 14 + + + + 14 + + + + 10 + + + + + + + DeviceId + + + FriendlyName + + + SerialNumber + + + MediaType + + + CanPool + + + OperationalStatus + + + HealthStatus + + + Usage + + + Right + + $size = $_.Size; + $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) + for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } + return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; + + + + + + + + + AdvancedPhysicalDiskTableView + + Microsoft.Windows.StorageManagement.PhysicalDiskAdvancedProperties + + + + + + + + + + + + 20 + + + + 24 + + + + + + + $_.PhysicalDisk.FriendlyName + + + $_.PhysicalDisk.SerialNumber + + + Right + IsPowerProtected + + + Right + IsDeviceCacheEnabled + + + + + + + + + StorageError_v1TableView + + Microsoft.Windows.StorageManagement.StorageError_v1 + + + DeviceGuid + DeviceInformation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Right + + [DateTime]$datetime = $_.EventTime.ToString('yyyy/MM/dd HH:MM:00') + return $datetime.ToShortDateString() + + + + Right + + [DateTime]$datetime = $_.EventTime.ToString('yyyy/MM/dd HH:MM:00') + return $datetime.ToShortTimeString() + + + + Right + + return "0x" + [String]::Format('{0:x2}',$_.Command) + + + + Right + + return "0x" + [String]::Format('{0:x2}',$_.SrbStatus) + + + + Right + + return "0x" + [String]::Format('{0:x2}',$_.ScsiStatus) + + + + Right + + return "0x" + [String]::Format('{0:x2}',$_.SenseKey) + + + + Right + + return "0x" + [String]::Format('{0:x2}',$_.SenseCode) + + + + Right + + return "0x" + [String]::Format('{0:x2}',$_.SenseCodeQualifier) + + + + Right + + return [String]::Format('{0:N0}',$_.IoSize) + + + + Right + + return [String]::Format('{0:N0}',$_.LBA) + + + + + + + + + + StorageHistory_v5TableView + + Microsoft.Windows.StorageManagement.StorageHistory_v5 + + + DeviceGuid + DeviceInformation + + + + + + + + + + + + + + + + + + + + + + + + + + + Right + + [DateTime]$datetime = $_.EventTime.ToString('yyyy/MM/dd HH:00:00') + return $datetime.ToShortDateString() + + + + Right + + [DateTime]$datetime = $_.EventTime.ToString('yyyy/MM/dd HH:00:00') + return $datetime.ToShortTimeString() + + + + Right + + return [String]::Format('{0:N0}',$_.TotalIoCount) + + + + Right + MaxOutstandingCount + + + Right + + return [String]::Format('{0:N1}',$_.AvgIoLatency/10) + + + + Right + + return [String]::Format('{0:N1}',$_.MaxIoLatency/10) + + + + + + + + + StorageHistory_v11TableView + + Microsoft.Windows.StorageManagement.StorageHistory_v11 + + + DeviceGuid + DeviceInformation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Right + + [DateTime]$datetime = $_.EventTime.ToString('yyyy/MM/dd HH:00:00') + return $datetime.ToShortDateString() + + + + Right + + [DateTime]$datetime = $_.EventTime.ToString('yyyy/MM/dd HH:00:00') + return $datetime.ToShortTimeString() + + + + Right + + return [String]::Format('{0:N0}',$_.TotalIoCount) + + + + Right + + return [String]::Format('{0:N0}',$_.FailedIoCount) + + + + Right + MaxOutstandingCount + + + Right + + return [String]::Format('{0:N1}',$_.AvgIoLatency/10) + + + + Right + + return [String]::Format('{0:N1}',$_.MaxIoLatency/10) + + + + Right + + return [String]::Format('{0:N0}',$_.TotalQueueIoCount) + + + + Right + + return [String]::Format('{0:N1}',$_.AvgQueueIoWaitTime/10) + + + + Right + + return [String]::Format('{0:N1}',$_.MaxQueueIoWaitTime/10) + + + + Right + + return [String]::Format('{0:N0}',$_.QueueIoWaitExceededTimeoutCount) + + + + + + + + + + StorageHistoryAggregate_v5TableView + + Microsoft.Windows.StorageManagement.StorageHistoryAggregate_v5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DeviceNumber + + + FriendlyName + + + SerialNumber + + + BusType + + + MediaType + + + Right + + return [String]::Format('{0:N0}',$_.TotalIoCount) + + + + Right + + return [String]::Format('{0:N1}',$_.AvgIoLatency/10) + + + + Right + + return [String]::Format('{0:N1}',$_.MaxIoLatency/10) + + + + Right + EventCount + + + Right + + if ($_.BucketHighestLatencyCount[0] -gt 0) + { + return $_.BucketHighestLatencyCount[0] + } + + + + Right + + if ($_.BucketHighestLatencyCount[1] -gt 0) + { + return $_.BucketHighestLatencyCount[1] + } + + + + Right + + if ($_.BucketHighestLatencyCount[2] -gt 0) + { + return $_.BucketHighestLatencyCount[2] + } + + + + Right + + if ($_.BucketHighestLatencyCount[3] -gt 0) + { + return $_.BucketHighestLatencyCount[3] + } + + + + Right + + if ($_.BucketHighestLatencyCount[4] -gt 0) + { + return $_.BucketHighestLatencyCount[4] + } + + + + + + + + + StorageHistoryAggregate_v11TableView + + Microsoft.Windows.StorageManagement.StorageHistoryAggregate_v11 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DeviceNumber + + + FriendlyName + + + SerialNumber + + + BusType + + + MediaType + + + Right + + return [String]::Format('{0:N0}',$_.TotalIoCount) + + + + Right + + return [String]::Format('{0:N0}',$_.FailedIoCount) + + + + Right + + return [String]::Format('{0:N0}',$_.TotalQueueIoCount) + + + + Right + + return [String]::Format('{0:N1}',$_.AvgIoLatency/10) + + + + Right + + return [String]::Format('{0:N1}',$_.MaxIoLatency/10) + + + + Right + EventCount + + + Right + + if ($_.BucketHighestLatencyCount[0] -gt 0) + { + return $_.BucketHighestLatencyCount[0] + } + + + + Right + + if ($_.BucketHighestLatencyCount[1] -gt 0) + { + return $_.BucketHighestLatencyCount[1] + } + + + + Right + + if ($_.BucketHighestLatencyCount[2] -gt 0) + { + return $_.BucketHighestLatencyCount[2] + } + + + + Right + + if ($_.BucketHighestLatencyCount[3] -gt 0) + { + return $_.BucketHighestLatencyCount[3] + } + + + + Right + + if ($_.BucketHighestLatencyCount[4] -gt 0) + { + return $_.BucketHighestLatencyCount[4] + } + + + + Right + + if ($_.BucketHighestLatencyCount[5] -gt 0) + { + return $_.BucketHighestLatencyCount[5] + } + + + + Right + + if ($_.BucketHighestLatencyCount[6] -gt 0) + { + return $_.BucketHighestLatencyCount[6] + } + + + + Right + + if ($_.BucketHighestLatencyCount[7] -gt 0) + { + return $_.BucketHighestLatencyCount[7] + } + + + + Right + + if ($_.BucketHighestLatencyCount[8] -gt 0) + { + return $_.BucketHighestLatencyCount[8] + } + + + + Right + + if ($_.BucketHighestLatencyCount[9] -gt 0) + { + return $_.BucketHighestLatencyCount[9] + } + + + + Right + + if ($_.BucketHighestLatencyCount[10] -gt 0) + { + return $_.BucketHighestLatencyCount[10] + } + + + + Right + + if ($_.BucketHighestLatencyCount[11] -gt 0) + { + return $_.BucketHighestLatencyCount[11] + } + + + + + + + + + + StoragePoolTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StoragePool + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FriendlyName + + + OperationalStatus + + + HealthStatus + + + IsPrimordial + + + IsReadOnly + + + Right + + $size = $_.Size; + $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) + for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } + return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; + + + + Right + + $allocatedSize = $_.AllocatedSize; + $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) + for ($i=0; $allocatedSize -ge 1024 -and $i -lt $postfixes.Length; $i++) { $allocatedSize = $allocatedSize / 1024; } + return "" + [System.Math]::Round($allocatedSize,2) + " " + $postfixes[$i]; + + + + + + + + + + ResiliencySettingTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_ResiliencySetting + + + StoragePoolFriendlyName + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + NumberOfDataCopiesDefault + + + PhysicalDiskRedundancyDefault + + + NumberOfColumnsDefault + + + InterleaveDefault + + + NumberOfGroupsDefault + + + + + + + + + StorageEnclosureTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageEnclosure + + + + + + + + + + + + + + + 13 + + + + 14 + + + + + + + + + + FriendlyName + + + SerialNumber + + + OperationalStatus + + + HealthStatus + + + NumberOfSlots + + + + $ElementTypesInError = @( ); + foreach ( $status in $_.SlotOperationalStatus ) + { + if ( ( $status -ne "OK" ) -and ( $status -ne "Not Installed" ) -and ( $status -ne "Off" ) -and ( $status -ne "No Access Allowed" ) -and ( $status -ne "Not Reported" ) ) + { + $ElementTypesInError = $ElementTypesInError + "Slot"; + break; + } + } + foreach ( $status in $_.PowerSupplyOperationalStatus ) + { + if ( ( $status -ne "OK" ) -and ( $status -ne "Not Installed" ) -and ( $status -ne "Off" ) -and ( $status -ne "No Access Allowed" ) -and ( $status -ne "Not Reported" ) ) + { + $ElementTypesInError = $ElementTypesInError + "PowerSupply"; + break; + } + } + foreach ( $status in $_.FanOperationalStatus ) + { + if ( ( $status -ne "OK" ) -and ( $status -ne "Not Installed" ) -and ( $status -ne "Off" ) -and ( $status -ne "No Access Allowed" ) -and ( $status -ne "Not Reported" ) ) + { + $ElementTypesInError = $ElementTypesInError + "Fan"; + break; + } + } + foreach ( $status in $_.TemperatureSensorOperationalStatus ) + { + if ( ( $status -ne "OK" ) -and ( $status -ne "Not Installed" ) -and ( $status -ne "Off" ) -and ( $status -ne "No Access Allowed" ) -and ( $status -ne "Not Reported" ) ) + { + $ElementTypesInError = $ElementTypesInError + "TemperatureSensor"; + break; + } + } + foreach ( $status in $_.VoltageSensorOperationalStatus ) + { + if ( ( $status -ne "OK" ) -and ( $status -ne "Not Installed" ) -and ( $status -ne "Off" ) -and ( $status -ne "No Access Allowed" ) -and ( $status -ne "Not Reported" ) ) + { + $ElementTypesInError = $ElementTypesInError + "VoltageSensor"; + break; + } + } + foreach ( $status in $_.CurrentSensorOperationalStatus ) + { + if ( ( $status -ne "OK" ) -and ( $status -ne "Not Installed" ) -and ( $status -ne "Off" ) -and ( $status -ne "No Access Allowed" ) -and ( $status -ne "Not Reported" ) ) + { + $ElementTypesInError = $ElementTypesInError + "CurrentSensor"; + break; + } + } + foreach ( $status in $_.IOControllerOperationalStatus ) + { + if ( ( $status -ne "OK" ) -and ( $status -ne "Not Installed" ) -and ( $status -ne "Off" ) -and ( $status -ne "No Access Allowed" ) -and ( $status -ne "Not Reported" ) ) + { + $ElementTypesInError = $ElementTypesInError + "IOController"; + break; + } + } + return $ElementTypesInError; + + + + + + + + + + StorageProviderTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageProvider + + + + + + 7 + + + + + + + + + + + + + Type + + + Name + + + Manufacturer + + + + + + + + StorageProviderListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageProvider + + + + + + + UniqueId + + + Name + + + Manufacturer + + + Version + + + + + + + + StorageProviderWideView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageProvider + + + + + + Name + + + + + + + + StorageSubSystemTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageSubSystem + + + + + + + + + + + + + + + + + + FriendlyName + + + HealthStatus + + + OperationalStatus + + + + + + + + + StorageNodeTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageNode + + + + + + + + + + + + + + + + + + + + + + + + Name + + + Manufacturer + + + Model + + + SerialNumber + + + OperationalStatus + + + + + + + + + VolumeTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_Volume + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DriveLetter + + + FileSystemLabel + + + FileSystemType + + + DriveType + + + HealthStatus + + + OperationalStatus + + + Right + + $size = $_.SizeRemaining; + $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) + for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } + return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; + + + + Right + + $size = $_.Size; + $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) + for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } + return "" + [System.Math]::Round($size,2) + " " + $postfixes[$i]; + + + + + + + + + + InitiatorPortTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_InitiatorPort + + + + + + + + + + + + + + + + + + + + + InstanceName + + + NodeAddress + + + PortAddress + + + ConnectionType + + + + + + + + + InitiatorIdTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_InitiatorId + + + + + + + + + + + + + + + + + + InitiatorAddress + + + Type + + + HostType + + + + + + + + + TargetPortTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_TargetPort + + + + + + + + + + + + + + + + + + + + + + + + + + + FriendlyName + + + NodeAddress + + + PortAddress + + + ConnectionType + + + HealthStatus + + + OperationalStatus + + + + + + + + + TargetPortalTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_TargetPortal + + + + + + + + + + + + + + + + + + + + + IPv4Address + + + IPv6Address + + + PortNumber + + + SubnetMask + + + + + + + + + MaskingSetTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_MaskingSet + + + + + + + + + + + + + + + FriendlyName + + + HostType + + + + + + + + + StorageJobTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageJob + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + IsBackgroundTask + + + ElapsedTime + + + JobState + + + PercentComplete + + + Right + + $bytesProcessed = $_.BytesProcessed; + $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) + for ($i=0; $bytesProcessed -ge 1024 -and $i -lt $postfixes.Length; $i++) { $bytesProcessed = $bytesProcessed / 1024; } + return "" + [System.Math]::Round($bytesProcessed,2) + " " + $postfixes[$i]; + + + + Right + + $bytesTotal = $_.BytesTotal; + $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) + for ($i=0; $bytesTotal -ge 1024 -and $i -lt $postfixes.Length; $i++) { $bytesTotal = $bytesTotal / 1024; } + return "" + [System.Math]::Round($bytesTotal,2) + " " + $postfixes[$i]; + + + + + + + + + + FileIntegrityTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_FileIntegrity + + + + + + + + + + + + + + + + + + FileName + + + Enabled + + + Enforced + + + + + + + + + FileStorageTierTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_FileStorageTier + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FilePath + + + FileSize + + + DesiredStorageTierClass + + + FileSizeOnPerformanceTierClass + + + FileSizeOnCapacityTierClass + + + PlacementStatus + + + State + + + + "{0:P}" -f ($_.FileSizeOnDesiredStorageTierClass / $_.FileSize); + + + + + + + + + + StorageNodeToDisk + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageNodeToDisk + + + StorageNodeObjectId + + + + + + + + DiskNumber + + + HealthStatus + + + OperationalStatus + + + IsReadOnly + + + IsOffline + + + OfflineReason + + + StorageNode + + + Disk + + + + + + + + + FileServerTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_FileServer + + + + + + + + + + + + + + + + + + FriendlyName + + + HealthStatus + + + OperationalStatus + + + + + + + + + FileShareTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_FileShare + + + + + + + + + + + + + + + + + + Name + + + HealthStatus + + + OperationalStatus + + + + + + + + + StorageReliabilityCounterTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageReliabilityCounter + + + + + + + + + + + + + + + + + + + + + + + + DeviceId + + + + if( $_.Temperature ) + { + $_str += $_.Temperature; + $_str += " C" + } + return $_str + + + + ReadErrorsUncorrected + + + Wear + + + PowerOnHours + + + + + + + + + StorageNodeToPhysicalDisk + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageNodeToPhysicalDisk + + + StorageNodeObjectId + + + + + + + + DiskNumber + + + IsPhysicallyConnected + + + HealthStatus + + + OperationalStatus + + + IsMpioEnabled + + + LoadBalancePolicy + + + PathId + + + PathState + + + StorageNode + + + PhysicalDisk + + + + + + + + + StorageNodeToStorageEnclosure + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageNodeToStorageEnclosure + + + StorageNodeObjectId + + + + + + + + EnclosureNumber + + + IsPhysicallyConnected + + + HealthStatus + + + SlotOperationalStatus + + + PowerSupplyOperationalStatus + + + FanOperationalStatus + + + TemperatureSensorOperationalStatus + + + VoltageSensorOperationalStatus + + + CurrentSensorOperationalStatus + + + IOControllerOperationalStatus + + + StorageNode + + + StorageEnclosure + + + + + + + + + HealthActionTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_HealthAction + + + + + + 18 + + + + 25 + + + + 25 + + + + + + + + true + + + PercentComplete + + + State + + + StartTime + + + Reason + + + + + + + + + StorageDiagnoseResultListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageDiagnoseResult + + + PerceivedSeverity + + + + + + + + Reason + + + + $($_.RecommendedActions -join "`r`n") + + + + FaultingObjectLocation + + + + FaultingObjectDescription + + + + + + + + StorageDiagnoseResultTableView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageDiagnoseResult + + + PerceivedSeverity + + + + + + + + + + + + + + true + + + Reason + + + FaultingObjectDescription + + + + + + + + + StorageDiagnoseResultTableView + + Microsoft.Management.Infrastructure.CimMethodStreamedResult#MSFT_StorageHealth#GetReport + + + true + + + true + + + + $postfixes = @( "B", "KB", "MB", "GB", "TB", "PB" ) + $bytesPerSecond = @( "B/S", "KB/S", "MB/S", "GB/S", "TB/S", "PB/S" ) + $Seconds = @( "min", "s", "ms", "us","ns" ) + $nameLength = 0 + $valueLength = 0 + $values = @() + $postFx = @() + + foreach($r in $_.ItemValue.Records) + { + if ($r.Name.Length -gt $nameLength) + { + $nameLength = $r.Name.Length + } + + $localValue="" + switch($r.Units) + { + 0{ + $size = $r.Value; + for ($i=0; $size -ge 1024 -and $i -lt $postfixes.Length; $i++) { $size = $size / 1024; } + + $localValue = "{0}" -f [System.Math]::Round($size,2) + $values += $localValue + $postfx += $postfixes[$i]; + } + 1{ + $size = $r.Value; + for ($i=0; $size -ge 1024 -and $i -lt $bytesPerSecond.Length; $i++) { $size = $size / 1024; } + + $localValue = "{0}" -f [System.Math]::Round($size,2) + $values += $localValue + $postfx += $bytesPerSecond[$i]; + } + 2{ + $localValue = "{0}" -f [System.Math]::Round($r.Value,2) + $values += $localValue + $postfx += "/S"; + } + 3{ + $size = $r.Value; + $i = 1 + if ($size -lt 1) + { + for($i = 1; $size -le 1 -and $i -lt $Seconds.Length; $i++ ) { $size = $size * 1000; } + } + else + { + if($size -gt 60) + { + $size = $size / 60 + $i-- + } + } + + $localValue = "{0}" -f [System.Math]::Round($size,2) + $values += $localValue + $postfx += $Seconds[$i]; + } + 4{ + $localValue = "{0}" -f [System.Math]::Round($r.Value,2) + $values += $localValue + $postfx += "%"; + } + default + { + $values += $r.Value + $postfx += ""; + } + } + + if($localValue.Length -gt $valueLength) + { + $valueLength = $localValue.Length + } + } + $j=0; + foreach($r in $_.ItemValue.Records) + { + $s = "{0,-$nameLength} : {1,$valueLength} {2}" -f @($r.Name, $values[$j], $postfx[$j] ) + Write-host $s + $j++ + } + + write-host "" + + + + + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_HealthRecord + Microsoft.Management.Infrastructure.CimInstance#MSFT_HealthRecordUInt64 + Microsoft.Management.Infrastructure.CimInstance#MSFT_HealthRecordReal64 + + Both + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/Storage.psd1 b/newton-cn/bin/v1.0/Modules/Storage/Storage.psd1 new file mode 100644 index 0000000..3e78b28 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/Storage.psd1 @@ -0,0 +1,213 @@ +@{ + GUID = '41486F7D-842F-40F1-ACE4-8405F9C2ED9B' + Author="Microsoft Corporation" + CompanyName="Microsoft Corporation" + Copyright="© Microsoft Corporation. All rights reserved." + ModuleVersion = '2.0.0.0' + PowerShellVersion = '5.1' + FormatsToProcess = 'Storage.format.ps1xml' + TypesToProcess = 'Storage.types.ps1xml' + NestedModules = @( + 'Disk.cdxml', + 'DiskImage.cdxml', + 'FileIntegrity.cdxml', + 'FileServer.cdxml', + 'FileShare.cdxml', + 'FileStorageTier.cdxml', + 'InitiatorId.cdxml', + 'InitiatorPort.cdxml', + 'MaskingSet.cdxml', + 'OffloadDataTransferSetting.cdxml', + 'Partition.cdxml', + 'PhysicalDisk.cdxml', + 'ResiliencySetting.cdxml', + 'StorageCmdlets.cdxml', + 'StorageEnclosure.cdxml', + 'StorageJob.cdxml', + 'StorageHealth.cdxml', + 'StorageNode.cdxml', + 'StoragePool.cdxml', + 'StorageProvider.cdxml', + 'StorageReliabilityCounter.cdxml', + 'StorageSetting.cdxml', + 'StorageSubSystem.cdxml', + 'StorageTier.cdxml', + 'TargetPort.cdxml', + 'TargetPortal.cdxml', + 'VirtualDisk.cdxml', + 'Volume.cdxml', + 'StorageScripts.psm1' + ) + AliasesToExport = @( + 'Disable-PhysicalDiskIndication', + 'Disable-StorageDiagnosticLog', + 'Enable-PhysicalDiskIndication', + 'Enable-StorageDiagnosticLog', + 'Flush-Volume', + 'Initialize-Volume', + 'Write-FileSystemCache', + 'Get-PhysicalDiskSNV', + 'Get-DiskSNV', + 'Get-StorageEnclosureSNV' + ) + CmdletsToExport = @() + FunctionsToExport = @( + 'Add-InitiatorIdToMaskingSet', + 'Add-PartitionAccessPath', + 'Add-PhysicalDisk', + 'Add-StorageFaultDomain', + 'Add-TargetPortToMaskingSet', + 'Add-VirtualDiskToMaskingSet', + 'Block-FileShareAccess', + 'Clear-Disk', + 'Clear-FileStorageTier', + 'Clear-StorageDiagnosticInfo', + 'Connect-VirtualDisk', + 'Debug-FileShare', + 'Debug-StorageSubSystem', + 'Debug-Volume', + 'Disable-PhysicalDiskIdentification', + 'Disable-StorageEnclosureIdentification', + 'Disable-StorageEnclosurePower', + 'Disable-StorageHighAvailability', + 'Disable-StorageMaintenanceMode', + 'Disconnect-VirtualDisk', + 'Dismount-DiskImage', + 'Enable-PhysicalDiskIdentification', + 'Enable-StorageEnclosureIdentification', + 'Enable-StorageEnclosurePower', + 'Enable-StorageHighAvailability', + 'Enable-StorageMaintenanceMode', + 'Format-Volume', + 'Get-DedupProperties', + 'Get-Disk', + 'Get-DiskImage', + 'Get-DiskStorageNodeView', + 'Get-FileIntegrity', + 'Get-FileStorageTier', + 'Get-StorageFileServer', + 'Get-FileShare', + 'Get-FileShareAccessControlEntry', + 'Get-InitiatorId', + 'Get-InitiatorPort', + 'Get-MaskingSet', + 'Get-Partition', + 'Get-PartitionSupportedSize', + 'Get-PhysicalDisk', + 'Get-PhysicalDiskStorageNodeView', + 'Get-PhysicalExtent', + 'Get-PhysicalExtentAssociation', + 'Get-ResiliencySetting', + 'Get-StorageAdvancedProperty', + 'Get-StorageChassis', + 'Get-StorageDiagnosticInfo', + 'Get-StorageEnclosure', + 'Get-StorageEnclosureStorageNodeView', + 'Get-StorageEnclosureVendorData', + 'Get-StorageExtendedStatus', + 'Get-StorageFaultDomain', + 'Get-StorageFirmwareInformation', + 'Get-StorageHealthAction', + 'Get-StorageHealthReport', + 'Get-StorageHealthSetting', + 'Get-StorageJob', + 'Get-StorageNode', + 'Get-StorageHistory', + 'Get-StoragePool', + 'Get-StorageProvider', + 'Get-StorageRack', + 'Get-StorageReliabilityCounter', + 'Get-StorageScaleUnit', + 'Get-StorageSetting', + 'Get-StorageSite', + 'Get-StorageSubSystem', + 'Get-StorageTier', + 'Get-StorageTierSupportedSize', + 'Get-SupportedFileSystems', + 'Get-SupportedClusterSizes', + 'Get-TargetPort', + 'Get-TargetPortal', + 'Get-VirtualDisk', + 'Get-VirtualDiskSupportedSize', + 'Get-OffloadDataTransferSetting' + 'Get-Volume', + 'Get-VolumeCorruptionCount', + 'Get-VolumeScrubPolicy', + 'Grant-FileShareAccess', + 'Hide-VirtualDisk', + 'Initialize-Disk', + 'Mount-DiskImage', + 'New-MaskingSet', + 'New-Partition', + 'New-StorageFileServer', + 'New-FileShare', + 'New-StoragePool', + 'New-StorageSubsystemVirtualDisk', + 'New-StorageTier', + 'New-VirtualDisk', + 'New-VirtualDiskClone', + 'New-VirtualDiskSnapshot', + 'New-Volume', + 'Optimize-Volume', + 'Optimize-StoragePool' + 'Register-StorageSubsystem', + 'Remove-FileShare', + 'Remove-InitiatorId', + 'Remove-InitiatorIdFromMaskingSet', + 'Remove-MaskingSet', + 'Remove-Partition', + 'Remove-PartitionAccessPath', + 'Remove-PhysicalDisk', + 'Remove-StorageFaultDomain', + 'Remove-StorageFileServer', + 'Remove-StorageHealthIntent', + 'Remove-StorageHealthSetting', + 'Remove-StoragePool', + 'Remove-StorageTier', + 'Remove-TargetPortFromMaskingSet', + 'Remove-VirtualDisk', + 'Remove-VirtualDiskFromMaskingSet', + 'Rename-MaskingSet', + 'Repair-FileIntegrity', + 'Repair-VirtualDisk', + 'Repair-Volume', + 'Reset-PhysicalDisk', + 'Reset-StorageReliabilityCounter', + 'Resize-Partition', + 'Resize-StorageTier', + 'Resize-VirtualDisk', + 'Revoke-FileShareAccess', + 'Set-Disk', + 'Set-FileIntegrity', + 'Set-FileStorageTier', + 'Set-FileShare', + 'Set-InitiatorPort', + 'Set-Partition', + 'Set-PhysicalDisk', + 'Set-ResiliencySetting', + 'Set-StorageFileServer', + 'Set-StorageHealthSetting', + 'Set-StoragePool', + 'Set-StorageProvider', + 'Set-StorageSetting', + 'Set-StorageSubSystem', + 'Set-StorageTier', + 'Set-VirtualDisk', + 'Set-Volume', + 'Set-VolumeScrubPolicy', + 'Show-StorageHistory', + 'Show-VirtualDisk', + 'Start-StorageDiagnosticLog', + 'Stop-StorageDiagnosticLog', + 'Stop-StorageJob', + 'Unregister-StorageSubsystem', + 'Unblock-FileShareAccess', + 'Update-Disk', + 'Update-HostStorageCache', + 'Update-StorageFirmware', + 'Update-StoragePool', + 'Update-StorageProviderCache', + 'Write-VolumeCache') + HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=390832" + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/Storage/Storage.types.ps1xml b/newton-cn/bin/v1.0/Modules/Storage/Storage.types.ps1xml new file mode 100644 index 0000000..7109033 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/Storage.types.ps1xml @@ -0,0 +1,3472 @@ + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_Disk + + + DiskNumber + Number + + + PartitionStyle + + switch ($this.psBase.CimInstanceProperties["PartitionStyle"].Value) + { + 0 { "RAW" } + 1 { "MBR" } + 2 { "GPT" } + Default { "Unknown" } + } + + + + ProvisioningType + + switch ($this.psBase.CimInstanceProperties["ProvisioningType"].Value) + { + 0 { "Unknown" } + 1 { "Thin" } + 2 { "Fixed" } + Default { "Unknown" } + } + + + + OperationalStatus + + $_status = @(); + foreach( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) + { + switch ( $status ) + { + 1 { $_status += "Other" } + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 4 { $_status += "Stressed" } + 5 { $_status += "Predictive Failure" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 8 { $_status += "Starting" } + 9 { $_status += "Stopping" } + 10 { $_status += "Stopped" } + 11 { $_status += "InService" } + 12 { $_status += "No Contact" } + 13 { $_status += "Lost Communication" } + 14 { $_status += "Aborted" } + 15 { $_status += "Dormant" } + 16 { $_status += "Supporting Entity in Error" } + 17 { $_status += "Completed" } + 18 { $_status += "Power Mode" } + 19 { $_status += "Relocating" } + 53264 { $_status += "Online" } + 53265 { $_status += "Not Ready" } + 53266 { $_status += "No Media" } + 53267 { $_status += "Offline" } + 53268 { $_status += "Failed" } + Default { $_status += "Unknown" } + } + } + $_status; + + + + HealthStatus + + switch ($this.psBase.CimInstanceProperties["HealthStatus"].Value) + { + 0 { "Healthy" } + 1 { "Warning" } + 2 { "Unhealthy" } + Default { "Unknown" } + } + + + + BusType + + switch ($this.psBase.CimInstanceProperties["BusType"].Value) + { + 0 { "Unknown" } + 1 { "SCSI" } + 2 { "ATAPI" } + 3 { "ATA" } + 4 { "1394" } + 5 { "SSA" } + 6 { "Fibre Channel" } + 7 { "USB" } + 8 { "RAID" } + 9 { "iSCSI" } + 10 { "SAS" } + 11 { "SATA" } + 12 { "SD" } + 13 { "MMC" } + 14 { "Virtual" } + 15 { "File Backed Virtual" } + 16 { "Spaces" } + 17 { "NVMe" } + 18 { "SCM" } + 19 { "UFS" } + Default { "Unknown" } + } + + + + UniqueIdFormat + + switch ($this.psBase.CimInstanceProperties["UniqueIdFormat"].Value) + { + 0 { "Vendor Specific" } + 1 { "Vendor Id" } + 2 { "EUI64" } + 3 { "FCPH Name" } + 8 { "SCSI Name String" } + } + + + + OfflineReason + + switch ($this.psBase.CimInstanceProperties["OfflineReason"].Value) + { + 1 { "Policy" } + 2 { "Redundant Path" } + 3 { "Snapshot" } + 4 { "Collision" } + 5 { "Resource Exhaustion" } + 6 { "Critical Write Failures" } + 7 { "Data Integrity Scan Required" } + Default { $null } + } + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_Partition + + + OperationalStatus + + switch ($this.psBase.CimInstanceProperties["OperationalStatus"].Value) + { + 0 { "Unknown" } + 1 { "Online" } + 3 { "No Media" } + 5 { "Failed" } + 4 { "Offline" } + Default { "Unknown" } + } + + + + Type + + if ($this.psBase.CimInstanceProperties["MbrType"].Value -gt 0) + { + switch ($this.psBase.CimInstanceProperties["MbrType"].Value) + { + 1 { "FAT12" } + 2 { "Xenix" } + 3 { "Xenix" } + 4 { "FAT16" } + 5 { "Extended" } + 6 { "Logical" } + 7 { "IFS" } + 10 { "OS/2 BootMgr" } + 11 { "FAT32" } + 12 { "FAT32 XINT13" } + 14 { "XINT13" } + 15 { "XINT13 Extended" } + 65 { "PReP" } + 66 { "LDM" } + 99 { "Unix" } + 231 { "Space Protective" } + Default { "Unknown" } + } + } + else + { + switch ($this.psBase.CimInstanceProperties["GptType"].Value) + { + "{c12a7328-f81f-11d2-ba4b-00a0c93ec93b}" { "System" } + "{e3c9e316-0b5c-4db8-817d-f92df00215ae}" { "Reserved" } + "{ebd0a0a2-b9e5-4433-87c0-68b6b72699c7}" { "Basic" } + "{5808c8aa-7e8f-42e0-85d2-e1e90434cfb3}" { "LDM Metadata" } + "{af9b60a0-1431-4f62-bc68-3311714a69ad}" { "LDM Data" } + "{de94bba4-06d1-4d40-a16a-bfd50179d6ac}" { "Recovery" } + "{e75caf8f-f680-4cee-afa3-b001e56efc2d}" { "Space Protective" } + "{eeff8352-dd2a-44db-ae83-bee1cf7481dc}" { "S2D Cache" } + "{03aaa829-ebfc-4e7e-aac9-c4d76c63b24b}" { "S2D Cache Metadata" } + Default { "Unknown" } + } + } + + + + DiskPath + + if ( $this.psBase.CimInstanceProperties["DiskId"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + $this.psBase.CimInstanceProperties["DiskId"].Value + } + else + { + $null + } + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_VirtualDisk + + + Usage + + if ( $this.psBase.CimInstanceProperties["Usage"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["Usage"].Value) + { + 0 { "Unknown" } + 1 { "Other" } + 2 { "Unrestricted" } + 3 { "Reserved for ComputerSystem (the block server)" } + 4 { "Reserved by Replication Services" } + 5 { "Reserved by Migration Services" } + 6 { "Local Replica Source" } + 7 { "Remote Replica Source" } + 8 { "Local Replica Target" } + 9 { "Remote Replica Target" } + 10 { "Local Replica Source or Target" } + 11 { "Remote Replica Source or Target" } + 12 { "Delta Replica Target" } + 13 { "Element Component" } + 14 { "Reserved as Pool Contributer" } + 15 { "Composite Volume Member" } + 16 { "Composite LogicalDisk Member" } + 17 { "Reserved for Sparing" } + 18 { "Configuration" } + 19 { "Data" } + 20 { "Journal" } + 21 { "Read Cache" } + 22 { "Write Cache" } + 23 { "Dirty Region Tracking" } + 24 { "Valid Data Tracking" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + NameFormat + + if ( $this.psBase.CimInstanceProperties["NameFormat"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["NameFormat"].Value) + { + 0 { "Unknown" } + 1 { "Other" } + 2 { "VPD83NAA6" } + 3 { "VPD83NAA5" } + 4 { "VPD83Type2" } + 5 { "VPD83Type1" } + 6 { "VPD83Type0" } + 7 { "SNVM" } + 8 { "NodeWWN" } + 9 { "NAA" } + 10 { "EUI64" } + 11 { "T10VID" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + OperationalStatus + + $_status = @(); + foreach( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) + { + switch ( $status ) + { + 1 { $_status += "Other" } + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 4 { $_status += "Stressed" } + 5 { $_status += "Predictive Failure" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 8 { $_status += "Starting" } + 9 { $_status += "Stopping" } + 10 { $_status += "Stopped" } + 11 { $_status += "InService" } + 12 { $_status += "No Contact" } + 13 { $_status += "Lost Communication" } + 14 { $_status += "Aborted" } + 15 { $_status += "Dormant" } + 16 { $_status += "Supporting Entity in Error" } + 17 { $_status += "Completed" } + 18 { $_status += "Power Mode" } + 19 { $_status += "Relocating" } + 53250 { $_status += "Detached" } + 53251 { $_status += "Incomplete" } + 53275 { $_status += "Suboptimal" } + 53284 { $_status += "No Redundancy" } + Default { $_status += "Unknown" } + } + } + $_status; + + + + HealthStatus + + switch ($this.psBase.CimInstanceProperties["HealthStatus"].Value) + { + 0 { "Healthy" } + 1 { "Warning" } + 2 { "Unhealthy" } + 5 { "Unknown" } + Default { "Unknown" } + } + + + + ProvisioningType + + if ( $this.psBase.CimInstanceProperties["ProvisioningType"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["ProvisioningType"].Value) + { + 0 { "Unknown" } + 1 { "Thin" } + 2 { "Fixed" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + AllocationUnitSize + + if ( $this.psBase.CimInstanceProperties["AllocationUnitSize"].Value -eq [System.UInt64]::MaxValue ) + { + "Auto" + } + else + { + $this.psBase.CimInstanceProperties["AllocationUnitSize"].Value + } + + + + MediaType + + if ( $this.psBase.CimInstanceProperties["MediaType"].Flags.HasFlag( [Microsoft.Management.Infrastructure.CimFlags]::NullValue ) -eq $false ) + { + switch ( $this.psBase.CimInstanceProperties["MediaType"].Value ) + { + 0 { "Unspecified" } + 3 { "HDD" } + 4 { "SSD" } + 5 { "SCM" } + Default { "Unspecified" } + } + } + else + { + $null + } + + + + ParityLayout + + if ( $this.psBase.CimInstanceProperties["ParityLayout"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["ParityLayout"].Value) + { + 1 { "Non-rotated Parity" } + 2 { "Rotated Parity" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + Access + + if ( $this.psBase.CimInstanceProperties["Access"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["Access"].Value) + { + 0 { "Unknown" } + 1 { "Readable" } + 2 { "Writeable" } + 3 { "Read/Write" } + 4 { "Write Once" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + UniqueIdFormat + + if ( $this.psBase.CimInstanceProperties["UniqueIdFormat"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["UniqueIdFormat"].Value) + { + 0 { "Vendor Specific" } + 1 { "Vendor Id" } + 2 { "EUI64" } + 3 { "FCPH Name" } + 8 { "SCSI Name String" } + } + } + else + { + $null + } + + + + DetachedReason + + if ( $this.psBase.CimInstanceProperties["DetachedReason"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["DetachedReason"].Value) + { + 0 { "Unknown" } + 1 { "None" } + 2 { "By Policy" } + 3 { "Majority Disks Unhealthy" } + 4 { "Incomplete" } + 5 { "Timeout" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + WriteCacheSize + + if ( $this.psBase.CimInstanceProperties["WriteCacheSize"].Value -eq [System.UInt64]::MaxValue ) + { + "Auto" + } + else + { + $this.psBase.CimInstanceProperties["WriteCacheSize"].Value + } + + + + FaultDomainAwareness + + if ( $this.psBase.CimInstanceProperties["FaultDomainAwareness"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["FaultDomainAwareness"].Value) + { + 1 { "PhysicalDisk" } + 2 { "StorageEnclosure" } + 3 { "StorageScaleUnit" } + 4 { "StorageChassis" } + 5 { "StorageRack" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + ColumnIsolation + + if ( $this.psBase.CimInstanceProperties["ColumnIsolation"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["ColumnIsolation"].Value) + { + 1 { "PhysicalDisk" } + 2 { "StorageEnclosure" } + 3 { "StorageScaleUnit" } + 4 { "StorageChassis" } + 5 { "StorageRack" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + GetSecurityDescriptor + + + + SetSecurityDescriptor + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageFaultDomain + + + ClassName + + if ($this.CimClass -ne $null) { $this.CimClass.CimClassName } else {""} + + + + HealthStatus + + switch ( $this.psBase.CimInstanceProperties["HealthStatus"].Value ) + { + 0 { "Healthy" } + 1 { "Warning" } + 2 { "Unhealthy" } + 5 { "Unknown" } + Default { "Unknown" } + } + + + + OperationalStatus + + $_status = @(); + foreach( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) + { + switch ( $status ) + { + 1 { $_status += "Other" } + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 4 { $_status += "Stressed" } + 5 { $_status += "Predictive Failure" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 8 { $_status += "Starting" } + 9 { $_status += "Stopping" } + 10 { $_status += "Stopped" } + 11 { $_status += "InService" } + 12 { $_status += "No Contact" } + 13 { $_status += "Lost Communication" } + 14 { $_status += "Aborted" } + 15 { $_status += "Dormant" } + 16 { $_status += "Supporting Entity in Error" } + 17 { $_status += "Completed" } + 18 { $_status += "Power Mode" } + 19 { $_status += "Relocating" } + 53252 { $_status += "Failed Media" } + 53253 { $_status += "Split" } + 53254 { $_status += "Stale Metadata" } + 53255 { $_status += "IO Error" } + 53256 { $_status += "Unrecognized Metadata" } + 53269 { $_status += "Removing From Pool" } + 53270 { $_status += "In Maintenance Mode" } + 53271 { $_status += "Updating Firmware" } + 53272 { $_status += "Device Hardware Error" } + 53273 { $_status += "Not Usable" } + 53274 { $_status += "Transient Error" } + 53276 { $_status += "Starting Maintenance Mode"} + 53277 { $_status += "Stopping Maintenance Mode"} + 53285 { $_status += "Threshold Exceeded"} + 53286 { $_status += "Abnormal Latency"} + Default { $_status += "Unknown" } + } + } + $_status; + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_PhysicalDisk + + + Usage + + if ( $this.psBase.CimInstanceProperties["Usage"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ( $this.psBase.CimInstanceProperties["Usage"].Value ) + { + 0 { "Unknown" } + 1 { "Auto-Select" } + 2 { "Manual-Select" } + 3 { "Hot Spare" } + 4 { "Retired" } + 5 { "Journal" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + OperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) + { + switch ( $status ) + { + 1 { $_status += "Other" } + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 4 { $_status += "Stressed" } + 5 { $_status += "Predictive Failure" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 8 { $_status += "Starting" } + 9 { $_status += "Stopping" } + 10 { $_status += "Stopped" } + 11 { $_status += "In Service" } + 12 { $_status += "No Contact" } + 13 { $_status += "Lost Communication" } + 14 { $_status += "Aborted" } + 15 { $_status += "Dormant" } + 16 { $_status += "Supporting Entity in Error" } + 17 { $_status += "Completed" } + 18 { $_status += "Power Mode" } + 19 { $_status += "Relocating" } + 53252 { $_status += "Failed Media" } + 53253 { $_status += "Split" } + 53254 { $_status += "Stale Metadata" } + 53255 { $_status += "IO Error" } + 53256 { $_status += "Unrecognized Metadata" } + 53269 { $_status += "Removing From Pool" } + 53270 { $_status += "In Maintenance Mode" } + 53271 { $_status += "Updating Firmware" } + 53272 { $_status += "Device Hardware Error" } + 53273 { $_status += "Not Usable" } + 53274 { $_status += "Transient Error" } + 53276 { $_status += "Starting Maintenance Mode"} + 53277 { $_status += "Stopping Maintenance Mode"} + 53285 { $_status += "Threshold Exceeded"} + 53286 { $_status += "Abnormal Latency"} + Default { "Unknown" } + } + } + $_status; + + + + UniqueIdFormat + + if ( $this.psBase.CimInstanceProperties["UniqueIdFormat"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["UniqueIdFormat"].Value) + { + 0 { "Vendor Specific" } + 1 { "Vendor Id" } + 2 { "EUI64" } + 3 { "FCPH Name" } + 8 { "SCSI Name String" } + } + } + else + { + $null + } + + + + HealthStatus + + switch ( $this.psBase.CimInstanceProperties["HealthStatus"].Value ) + { + 0 { "Healthy" } + 1 { "Warning" } + 2 { "Unhealthy" } + 5 { "Unknown" } + Default { "Unknown" } + } + + + + BusType + + if ( $this.psBase.CimInstanceProperties["BusType"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ( $this.psBase.CimInstanceProperties["BusType"].Value ) + { + 0 { "Unknown" } + 1 { "SCSI" } + 2 { "ATAPI" } + 3 { "ATA" } + 4 { "1394" } + 5 { "SSA" } + 6 { "Fibre Channel" } + 7 { "USB" } + 8 { "RAID" } + 9 { "iSCSI" } + 10 { "SAS" } + 11 { "SATA" } + 12 { "SD" } + 13 { "MMC" } + 14 { "Virtual" } + 15 { "File Backed Virtual" } + 16 { "Spaces" } + 17 { "NVMe" } + 18 { "SCM" } + 19 { "UFS" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + CannotPoolReason + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["CannotPoolReason"].Value ) + { + switch ( $status ) + { + 0 { $_status += "Unknown" } + 1 { $_status += "Other" } + 2 { $_status += "In a Pool" } + 3 { $_status += "Not Healthy" } + 4 { $_status += "Removable Media" } + 5 { $_status += "In Use by Cluster" } + 6 { $_status += "Offline" } + 7 { $_status += "Insufficient Capacity" } + 8 { $_status += "Spare Disk" } + 9 { $_status += "Reserved by Subsystem" } + 10 { $_status += "Starting" } + 11 { $_status += "Partial SCM" } + 12 { $_status += "Discovery Disabled" } + 32768 { $_status += "Verification in progress" } + 32769 { $_status += "Verification failed" } + 32770 { $_status += "Firmware not compliant" } + 32771 { $_status += "Hardware not compliant" } + Default { "Unknown" } + } + } + $_status; + + + + SupportedUsages + + $_usages = @(); + foreach ( $_usage in $this.psBase.CimInstanceProperties["SupportedUsages"].Value ) + { + switch ( $_usage ) + { + 1 { $_usages += "Auto-Select" } + 2 { $_usages += "Manual-Select" } + 3 { $_usages += "Hot Spare" } + 4 { $_usages += "Retired" } + 5 { $_usages += "Journal" } + Default { "Unknown" } + } + } + $_usages; + + + + MediaType + + switch ( $this.psBase.CimInstanceProperties["MediaType"].Value ) + { + 0 { "Unspecified" } + 3 { "HDD" } + 4 { "SSD" } + 5 { "SCM" } + Default { "Unspecified" } + } + + + + SpindleSpeed + + $speed = $this.psBase.CimInstanceProperties["SpindleSpeed"].Value; + if ( $speed -eq [System.UInt32]::MaxValue ) { + "Unknown"; + } + else + { + $speed; + } + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageEnclosure + + + BusType + + switch ($this.psBase.CimInstanceProperties["BusType"].Value) + { + 0 { "Unknown" } + 1 { "SCSI" } + 2 { "ATAPI" } + 3 { "ATA" } + 4 { "1394" } + 5 { "SSA" } + 6 { "Fibre Channel" } + 7 { "USB" } + 8 { "RAID" } + 9 { "iSCSI" } + 10 { "SAS" } + 11 { "SATA" } + 12 { "SD" } + 13 { "MMC" } + 14 { "Virtual" } + 15 { "File Backed Virtual" } + 16 { "Spaces" } + 17 { "NVMe" } + 18 { "SCM" } + 19 { "UFS" } + Default { "Unknown" } + } + + + + HealthStatus + + switch ( $this.psBase.CimInstanceProperties["HealthStatus"].Value ) + { + 0 { "Healthy" } + 1 { "Warning" } + 2 { "Unhealthy" } + 5 { "Unknown" } + Default { "Unknown" } + } + + + + OperationalStatus + + $_status = @(); + foreach( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) + { + switch ( $status ) + { + 1 { $_status += "Other" } + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 4 { $_status += "Stressed" } + 5 { $_status += "Predictive Failure" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 8 { $_status += "Starting" } + 9 { $_status += "Stopping" } + 10 { $_status += "Stopped" } + 11 { $_status += "InService" } + 12 { $_status += "No Contact" } + 13 { $_status += "Lost Communication" } + 14 { $_status += "Aborted" } + 15 { $_status += "Dormant" } + 16 { $_status += "Supporting Entity in Error" } + 17 { $_status += "Completed" } + 18 { $_status += "Power Mode" } + 19 { $_status += "Relocating" } + 53250 { $_status += "Detached" } + 53251 { $_status += "Incomplete" } + Default { $_status += "Unknown" } + } + } + $_status; + + + + SlotOperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["SlotOperationalStatus"].Value ) + { + switch ( $status ) + { + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 53257 { $_status += "Not Installed" } + 53258 { $_status += "Off" } + 53259 { $_status += "No Access Allowed" } + 53260 { $_status += "Not Reported" } + Default { "Unknown" } + } + } + $_status; + + + + PowerSupplyOperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["PowerSupplyOperationalStatus"].Value ) + { + switch ( $status ) + { + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 53257 { $_status += "Not Installed" } + 53258 { $_status += "Off" } + 53259 { $_status += "No Access Allowed" } + 53260 { $_status += "Not Reported" } + Default { "Unknown" } + } + } + $_status; + + + + FanOperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["FanOperationalStatus"].Value ) + { + switch ( $status ) + { + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 53257 { $_status += "Not Installed" } + 53258 { $_status += "Off" } + 53259 { $_status += "No Access Allowed" } + 53260 { $_status += "Not Reported" } + Default { "Unknown" } + } + } + $_status; + + + + TemperatureSensorOperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["TemperatureSensorOperationalStatus"].Value ) + { + switch ( $status ) + { + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 53257 { $_status += "Not Installed" } + 53258 { $_status += "Off" } + 53259 { $_status += "No Access Allowed" } + 53260 { $_status += "Not Reported" } + Default { "Unknown" } + } + } + $_status; + + + + VoltageSensorOperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["VoltageSensorOperationalStatus"].Value ) + { + switch ( $status ) + { + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 53257 { $_status += "Not Installed" } + 53258 { $_status += "Off" } + 53259 { $_status += "No Access Allowed" } + 53260 { $_status += "Not Reported" } + Default { "Unknown" } + } + } + $_status; + + + + CurrentSensorOperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["CurrentSensorOperationalStatus"].Value ) + { + switch ( $status ) + { + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 53257 { $_status += "Not Installed" } + 53258 { $_status += "Off" } + 53259 { $_status += "No Access Allowed" } + 53260 { $_status += "Not Reported" } + Default { "Unknown" } + } + } + $_status; + + + + IOControllerOperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["IOControllerOperationalStatus"].Value ) + { + switch ( $status ) + { + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 53257 { $_status += "Not Installed" } + 53258 { $_status += "Off" } + 53259 { $_status += "No Access Allowed" } + 53260 { $_status += "Not Reported" } + Default { "Unknown" } + } + } + $_status; + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageNode + + + NameFormat + + if ( $this.psBase.CimInstanceProperties["NameFormat"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["NameFormat"].Value) + { + 1 { "Other" } + 2 { "IP" } + 3 { "Dial" } + 4 { "HID" } + 5 { "NWA" } + 6 { "HWA" } + 7 { "X25" } + 8 { "ISDN" } + 9 { "IPX" } + 10 { "DCC" } + 11 { "ICD" } + 12 { "E.164" } + 13 { "SNA" } + 14 { "OID/OSI" } + 15 { "WWN" } + 16 { "NAA" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + OperationalStatus + + switch ($this.psBase.CimInstanceProperties["OperationalStatus"].Value) + { + 0 { "Unknown" } + 2 { "Up" } + 6 { "Down" } + 8 { "Joining" } + 10 { "Paused" } + } + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StoragePool + + + Usage + + if ( $this.psBase.CimInstanceProperties["Usage"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["Usage"].Value) + { + 0 { "Unknown" } + 1 { "Other" } + 2 { "Unrestricted" } + 3 { "Reserved for ComputerSystem (the block server)" } + 4 { "Reserved as a Delta Replica Container" } + 5 { "Reserved for Migration Services" } + 6 { "Reserved for Local Replication Services" } + 7 { "Reserved for Remote Replication Services" } + 8 { "Reserved for Sparing" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + OperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) + { + switch ( $status ) + { + 1 { $_status += "Other" } + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 4 { $_status += "Stressed" } + 5 { $_status += "Predictive Failure" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 8 { $_status += "Starting" } + 9 { $_status += "Stopping" } + 10 { $_status += "Stopped" } + 11 { $_status += "In Service" } + 12 { $_status += "No Contact" } + 13 { $_status += "Lost Communication" } + 14 { $_status += "Aborted" } + 15 { $_status += "Dormant" } + 16 { $_status += "Supporting Entity in Error" } + 17 { $_status += "Completed" } + 18 { $_status += "Power Mode" } + 19 { $_status += "Relocating" } + 53248 { $_status += "Read-only" } + 53249 { $_status += "Incomplete" } + Default { "Unknown" } + } + } + $_status; + + + + HealthStatus + + switch ($this.psBase.CimInstanceProperties["HealthStatus"].Value) + { + 0 { "Healthy" } + 1 { "Warning" } + 2 { "Unhealthy" } + 5 { "Unknown" } + Default { "Unknown" } + } + + + + ProvisioningTypeDefault + + if ( $this.psBase.CimInstanceProperties["ProvisioningTypeDefault"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["ProvisioningTypeDefault"].Value) + { + 0 { "Unknown" } + 1 { "Thin" } + 2 { "Fixed" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + SupportedProvisioningTypes + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["SupportedProvisioningTypes"].Value ) + { + switch ( $status ) + { + 0 { $_status += "Unknown" } + 1 { $_status += "Thin" } + 2 { $_status += "Fixed" } + Default { "Unknown" } + } + } + $_status; + + + + MediaTypeDefault + + if ( $this.psBase.CimInstanceProperties["MediaTypeDefault"].Flags.HasFlag( [Microsoft.Management.Infrastructure.CimFlags]::NullValue ) -eq $false ) + { + switch ( $this.psBase.CimInstanceProperties["MediaTypeDefault"].Value ) + { + 0 { "Unspecified" } + 3 { "HDD" } + 4 { "SSD" } + 5 { "SCM" } + Default { "Unspecified" } + } + } + else + { + $null + } + + + + ReadOnlyReason + + if ( $this.psBase.CimInstanceProperties["ReadOnlyReason"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["ReadOnlyReason"].Value) + { + 0 { "Unknown" } + 1 { "None" } + 2 { "By Policy" } + 3 { "Majority Disks Unhealthy" } + 4 { "Starting" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + RepairPolicy + + if ( $this.psBase.CimInstanceProperties["RepairPolicy"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ( $this.psBase.CimInstanceProperties["RepairPolicy"].Value ) + { + 2 { "Sequential" } + 3 { "Parallel" } + Default { "Parallel" } + } + } + else + { + $null + } + + + + RetireMissingPhysicalDisks + + if ( $this.psBase.CimInstanceProperties["RetireMissingPhysicalDisks"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ( $this.psBase.CimInstanceProperties["RetireMissingPhysicalDisks"].Value ) + { + 0 { "Unknown" } + 1 { "Auto" } + 2 { "Always" } + 3 { "Never" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + WriteCacheSizeDefault + + if ( $this.psBase.CimInstanceProperties["WriteCacheSizeDefault"].Value -eq [System.UInt64]::MaxValue ) + { + "Auto" + } + else + { + $this.psBase.CimInstanceProperties["WriteCacheSizeDefault"].Value + } + + + + Version + + # ScVersionWindows8 + if ( $this.psBase.CimInstanceProperties["Version"].Value -eq 1 ) + { + "Windows Server 2012" + } + + # ScVersionWindowsBlueInternal1 + # ScVersionWindowsBlueInternal2 + # ScVersionWindowsBlueInternal3 + # ScVersionWindowsBlueInternal4 + # ScVersionWindowsBlueInternal5 + elseif ( $this.psBase.CimInstanceProperties["Version"].Value -eq 2 ) + { + "Windows Server 2012 R2 Preview" + } + + # ScVersionWindowsBlue + elseif ( $this.psBase.CimInstanceProperties["Version"].Value -eq 3 ) + { + "Windows Server 2012 R2" + } + + # ScVersionWindowsThresholdInternal1 + # ScVersionWindowsThresholdInternal2 + # ScVersionWindowsThresholdInternal3 + # ScVersionWindowsThresholdInternal4 + # ScVersionWindowsThresholdInternal5 + # ScVersionWindowsThresholdInternal6 + # ScVersionWindowsThreshold + # ScVersionWindowsThreshold2 + # ScVersionWindowsRedstone1Internal1 + # ScVersionWindowsRedstone1Internal2 + # ScVersionWindowsRedstone1Internal3 + elseif ( $this.psBase.CimInstanceProperties["Version"].Value -ge 4 -and $this.psBase.CimInstanceProperties["Version"].Value -le 18 ) + { + "Windows Server 2016 Preview" + } + + # ScVersionWindowsRedstone1 + elseif ( $this.psBase.CimInstanceProperties["Version"].Value -eq 19 ) + { + "Windows Server 2016" + } + + # ScVersionWindowsRedstone3 + elseif ( $this.psBase.CimInstanceProperties["Version"].Value -eq 20 ) + { + "Windows Server 2016 RS3" + } + + # ScVersionWindowsRedstone5Internal1 + elseif ( $this.psBase.CimInstanceProperties["Version"].Value -eq 21 ) + { + "Windows Server 2019 Preview" + } + + # ScVersionWindowsRedstone5 + elseif ( $this.psBase.CimInstanceProperties["Version"].Value -eq 22 ) + { + "Windows Server 2019" + } + + # >= ScVersionWindows19H1Internal1 + elseif ( $this.psBase.CimInstanceProperties["Version"].Value -ge 23 ) + { + "Windows Server vNext" + } + + + + FaultDomainAwarenessDefault + + switch ($this.psBase.CimInstanceProperties["FaultDomainAwarenessDefault"].Value) + { + 1 { "PhysicalDisk" } + 2 { "StorageEnclosure" } + 3 { "StorageScaleUnit" } + 4 { "StorageChassis" } + 5 { "StorageRack" } + Default { "Unknown" } + } + + + + GetSecurityDescriptor + + + + SetSecurityDescriptor + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_ResiliencySetting + + + ParityLayout + + if ( $this.psBase.CimInstanceProperties["ParityLayout"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["ParityLayout"].Value) + { + 1 { "Non-rotated Parity" } + 2 { "Rotated Parity" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + NumberOfColumnsDefault + + if ( $this.psBase.CimInstanceProperties["NumberOfColumnsDefault"].Value -eq [System.UInt16]::MaxValue ) + { + "Auto" + } + else + { + $this.psBase.CimInstanceProperties["NumberOfColumnsDefault"].Value + } + + + + NumberOfGroupsDefault + + if ( $this.psBase.CimInstanceProperties["NumberOfGroupsDefault"].Value -eq [System.UInt16]::MaxValue ) + { + "Auto" + } + else + { + $this.psBase.CimInstanceProperties["NumberOfGroupsDefault"].Value + } + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageProvider + + + Type + + switch ($this.psBase.CimInstanceProperties["Type"].Value) + { + 1 { "SMP" } + 2 { "SMI-S" } + Default { "Unknown" } + } + + + + RemoteSubsystemCacheMode + + switch ($this.psBase.CimInstanceProperties["RemoteSubsystemCacheMode"].Value) + { + 0 { "Unknown" } + 2 { "Disabled" } + 3 { "Manual-Discovery" } + Default { "Unknown" } + } + + + + SupportedRemoteSubsystemCacheModes + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["SupportedRemoteSubsystemCacheModes"].Value ) + { + switch ( $status ) + { + 0 { $_status += "Unknown" } + 2 { $_status += "Disabled" } + 3 { $_status += "Manual-Discovery" } + Default { "Unknown" } + } + } + $_status; + + + + GetSecurityDescriptor + + + + SetSecurityDescriptor + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageSubSystem + + + NameFormat + + if ( $this.psBase.CimInstanceProperties["NameFormat"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["NameFormat"].Value) + { + 1 { "Other" } + 2 { "IP" } + 3 { "Dial" } + 4 { "HID" } + 5 { "NWA" } + 6 { "HWA" } + 7 { "X25" } + 8 { "ISDN" } + 9 { "IPX" } + 10 { "DCC" } + 11 { "ICD" } + 12 { "E.164" } + 13 { "SNA" } + 14 { "OID/OSI" } + 15 { "WWN" } + 16 { "NAA" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + HealthStatus + + switch ($this.psBase.CimInstanceProperties["HealthStatus"].Value) + { + 0 { "Healthy" } + 1 { "Warning" } + 2 { "Unhealthy" } + Default { "Unknown" } + } + + + + OperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) + { + switch ( $status ) + { + 1 { $_status += "Other" } + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 4 { $_status += "Stressed" } + 5 { $_status += "Predictive Failure" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 8 { $_status += "Starting" } + 9 { $_status += "Stopping" } + 10 { $_status += "Stopped" } + 11 { $_status += "In Service" } + 12 { $_status += "No Contact" } + 13 { $_status += "Lost Communication" } + 14 { $_status += "Aborted" } + 15 { $_status += "Dormant" } + 16 { $_status += "Supporting Entity in Error" } + 17 { $_status += "Completed" } + 18 { $_status += "Power Mode" } + 19 { $_status += "Relocating" } + Default { $_status += "Unknown" } + } + } + $_status; + + + + FaultDomainAwarenessDefault + + switch ($this.psBase.CimInstanceProperties["FaultDomainAwarenessDefault"].Value) + { + 1 { "PhysicalDisk" } + 2 { "StorageEnclosure" } + 3 { "StorageScaleUnit" } + 4 { "StorageChassis" } + 5 { "StorageRack" } + Default { "Unknown" } + } + + + + MaskingValidInitiatorIdTypes + + $_type = @(); + foreach ( $type in $this.psBase.CimInstanceProperties["MaskingValidInitiatorIdTypes"].Value ) + { + switch ( $type ) + { + 1 { $_type += "Other" } + 2 { $_type += "Port WWN" } + 3 { $_type += "Node WWN" } + 4 { $_type += "Host Name" } + 5 { $_type += "iSCSI Name" } + 6 { $_type += "Switch WWN" } + 7 { $_type += "SAS Address" } + Default { $_type += "Unknown" } + } + } + $_type; + + + + MaskingPortsPerView + + switch ($this.psBase.CimInstanceProperties["MaskingPortsPerView"].Value) + { + 2 { "One TargetPort per view" } + 3 { "Multiple target ports per view" } + 4 { "All target ports share the same view" } + Default { "Unknown" } + } + + + + DataTieringType + + if ( $this.psBase.CimInstanceProperties["DataTieringType"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["DataTieringType"].Value) + { + 0 { "Unknown" } + 1 { "Not Supported" } + 2 { "Manual" } + 3 { "Auto" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + iSCSITargetCreationScheme + + if ( $this.psBase.CimInstanceProperties["iSCSITargetCreationScheme"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["iSCSITargetCreationScheme"].Value) + { + 0 { "Unknown" } + 1 { "Not Supported" } + 2 { "Manual" } + 3 { "Auto" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + SupportedHostType + + $_type = @(); + foreach ( $type in $this.psBase.CimInstanceProperties["SupportedHostType"].Value ) + { + switch ( $type ) + { + 0 { $_type += "Unknown" } + 1 { $_type += "Other" } + 2 { $_type += "Standard" } + 3 { $_type += "Solaris" } + 4 { $_type += "HPUX" } + 5 { $_type += "OpenVMS" } + 6 { $_type += "Tru64" } + 7 { $_type += "Netware" } + 8 { $_type += "Sequent" } + 9 { $_type += "AIX" } + 10 { $_type += "DGUX" } + 11 { $_type += "Dynix" } + 12 { $_type += "Irix" } + 13 { $_type += "Cisco iSCSI Storage Router" } + 14 { $_type += "Linux" } + 15 { $_type += "Microsoft Windows" } + 16 { $_type += "OS400" } + 17 { $_type += "TRESPASS" } + 18 { $_type += "HI-UX" } + 19 { $_type += "VMware ESXi" } + 20 { $_type += "Microsoft Windows Server 2008" } + 21 { $_type += "Microsoft Windows Server 2003" } + Default { $_type += "Unknown" } + } + } + $_type; + + + + SupportedDeduplicationObjectTypes + + $_type = @(); + foreach ( $type in $this.psBase.CimInstanceProperties["SupportedDeduplicationObjectTypes"].Value ) + { + switch ( $type ) + { + 2 { $_type += "Volume" } + 4 { $_type += "VirtualDisk" } + 8 { $_type += "Partition" } + 16 { $_type += "StoragePool" } + Default { $_type += "Unknown" } + } + } + $_type; + + + + SupportedDeduplicationFileSystemTypes + + $_type = @(); + foreach ( $type in $this.psBase.CimInstanceProperties["SupportedDeduplicationFileSystemTypes"].Value ) + { + switch ( $type ) + { + 0 { $_type += "Unknown" } + 1 { $_type += "Threshold" } + 2 { $_type += "UFS" } + 3 { $_type += "HFS" } + 4 { $_type += "FAT" } + 5 { $_type += "FAT16" } + 6 { $_type += "FAT32" } + 7 { $_type += "NTFS4" } + 8 { $_type += "NTFS5" } + 9 { $_type += "XFS" } + 10 { $_type += "AFS" } + 11 { $_type += "EXT2" } + 12 { $_type += "EXT3" } + 13 { $_type += "ReiserFS" } + 14 { $_type += "NTFS" } + 15 { $_type += "ReFS" } + 32768 { $_type += "CSVFS_NTFS" } + 32769 { $_type += "CSVFS_ReFS" } + Default { $_type += "Unknown" } + } + } + $_type; + + + + SupportedFileSystems + + $_type = @(); + foreach ( $type in $this.psBase.CimInstanceProperties["SupportedFileSystems"].Value ) + { + switch ( $type ) + { + 0 { $_type += "Unknown" } + 2 { $_type += "UFS" } + 3 { $_type += "HFS" } + 4 { $_type += "FAT" } + 5 { $_type += "FAT16" } + 6 { $_type += "FAT32" } + 7 { $_type += "NTFS4" } + 8 { $_type += "NTFS5" } + 9 { $_type += "XFS" } + 10 { $_type += "AFS" } + 11 { $_type += "EXT2" } + 12 { $_type += "EXT3" } + 13 { $_type += "ReiserFS" } + 14 { $_type += "NTFS" } + 15 { $_type += "ReFS" } + 32768 { $_type += "CSVFS_NTFS" } + 32769 { $_type += "CSVFS_ReFS" } + Default { $_type += "Unknown" } + } + } + $_type; + + + + StorageConnectionType + + switch ( $this.psBase.CimInstanceProperties["StorageConnectionType"].Value ) + { + 0 { "Unknown" } + 1 { "Shared Storage" } + 2 { "Local Storage" } + Default { "Unknown" } + } + + + + SupportedFileServerProtocols + + $_protos = @(); + foreach ( $p in $this.psBase.CimInstanceProperties["SupportedFileServerProtocols"].Value ) + { + switch ( $p ) + { + 2 { $_protos += "NFS" } + 3 { $_protos += "SMB" } + Default { "Unknown" } + } + } + $_protos; + + + + GetSecurityDescriptor + + + + SetSecurityDescriptor + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_Volume + + + OperationalStatus + + $_status = @(); + foreach( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) + { + switch ( $status ) + { + 1 { $_status += "Other" } + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 4 { $_status += "Stressed" } + 5 { $_status += "Predictive Failure" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 8 { $_status += "Starting" } + 9 { $_status += "Stopping" } + 10 { $_status += "Stopped" } + 11 { $_status += "InService" } + 12 { $_status += "No Contact" } + 13 { $_status += "Lost Communication" } + 14 { $_status += "Aborted" } + 15 { $_status += "Dormant" } + 16 { $_status += "Supporting Entity in Error" } + 17 { $_status += "Completed" } + 18 { $_status += "Power Mode" } + 19 { $_status += "Relocating" } + 53261 { $_status += "Scan Needed" } + 53262 { $_status += "Spot Fix Needed" } + 53263 { $_status += "Full Repair Needed" } + 53267 { $_status += "Offline" } + Default { $_status += "Unknown" } + } + } + $_status; + + + + HealthStatus + + switch ($this.psBase.CimInstanceProperties["HealthStatus"].Value) + { + 0 { "Healthy" } + 1 { "Warning" } + 2 { "Unhealthy" } + Default { "Unknown" } + } + + + + DriveType + + switch ($this.psBase.CimInstanceProperties["DriveType"].Value) + { + 0 { "Unknown" } + 1 { "Invalid Root Path" } + 2 { "Removable" } + 3 { "Fixed" } + 4 { "Remote" } + 5 { "CD-ROM" } + 6 { "RAM Disk" } + Default { "Unknown" } + } + + + + FileSystemType + + switch ($this.psBase.CimInstanceProperties["FileSystemType"].Value) + { + 0 { "Unknown" } + 2 { "UFS" } + 3 { "HFS" } + 4 { "FAT" } + 5 { "FAT16" } + 6 { "FAT32" } + 7 { "NTFS4" } + 8 { "NTFS5" } + 9 { "XFS" } + 10 { "AFS" } + 11 { "EXT2" } + 12 { "EXT3" } + 13 { "ReiserFS" } + 14 { "NTFS" } + 15 { "ReFS" } + 32768 { "CSVFS_NTFS" } + 32769 { "CSVFS_ReFS" } + Default { $null } + } + + + + DedupMode + + switch ($this.psBase.CimInstanceProperties["DedupMode"].Value) + { + 0 { "Disabled" } + 1 { "GeneralPurpose" } + 2 { "HyperV" } + 3 { "Backup" } + 4 { "NotAvailable" } + Default { "Unknown" } + } + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_TargetPort + + + ConnectionType + + if ( $this.psBase.CimInstanceProperties["ConnectionType"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["ConnectionType"].Value) + { + 1 { "Other" } + 2 { "Fibre Channel" } + 3 { "Parallel SCSI" } + 4 { "SSA" } + 5 { "IEEE 1394" } + 6 { "RDMA" } + 7 { "iSCSI" } + 8 { "SAS" } + 9 { "ADT " } + } + } + else + { + $null + } + + + + Role + + if ( $this.psBase.CimInstanceProperties["Role"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["Role"].Value) + { + 0 { "Unknown" } + 1 { "Initiator" } + 2 { "Target" } + 3 { "Both Initiator and Target" } + } + } + else + { + $null; + } + + + + OperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) + { + switch ( $status ) + { + 1 { $_status += "Other" } + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 4 { $_status += "Stressed" } + 5 { $_status += "Predictive Failure" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 8 { $_status += "Starting" } + 9 { $_status += "Stopping" } + 10 { $_status += "Stopped" } + 11 { $_status += "InService" } + 12 { $_status += "No Contact" } + 13 { $_status += "Lost Communication" } + 14 { $_status += "Aborted" } + 15 { $_status += "Dormant" } + 16 { $_status += "Supporting Entity in Error" } + 17 { $_status += "Completed" } + 18 { $_status += "Power Mode" } + 19 { $_status += "Relocating" } + Default { $_status += "Unknown" } + } + } + $_status; + + + + HealthStatus + + switch ($this.psBase.CimInstanceProperties["HealthStatus"].Value) + { + 0 { "Healthy" } + 1 { "Warning" } + 2 { "Unhealthy" } + Default { "Unknown" } + } + + + + LinkTechnology + + if ( $this.psBase.CimInstanceProperties["LinkTechnology"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["LinkTechnology"].Value) + { + 0 { "Unknown" } + 1 { "Other" } + 2 { "Ethernet" } + 3 { "IB" } + 4 { "FC" } + 5 { "FDDI" } + 6 { "ATM" } + 7 { "Token Ring" } + 8 { "Frame Relay" } + 9 { "Infrared" } + 10 { "Bluetooth" } + 11 { "Wireless LAN" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + PortType + + if ( $this.psBase.CimInstanceProperties["PortType"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["PortType"].Value) + { + 0 { "Unknown" } + 1 { "Other" } + 10 { "N" } + 11 { "NL" } + 12 { "F/NL" } + 13 { "Nx" } + 14 { "E" } + 15 { "F" } + 16 { "FL" } + 17 { "B" } + 18 { "G" } + 50 {"10BaseT" } + 51 { "10-100BaseT" } + 52 { "100BaseT" } + 53 { "1000BaseT" } + 54 { "2500BaseT" } + 55 { "10GBaseT" } + 56 { "10GBase-CX4" } + 94 { "SAS" } + 100 { "100Base-FX" } + 101 { "100Base-SX" } + 102 { "1000Base-SX" } + 103 { "1000Base-LX" } + 104 { "1000Base-CX" } + 105 { "10GBase-SR" } + 106 { "10GBase-SW" } + 107 { "10GBase-LX4" } + 108 { "10GBase-LR" } + 109 { "10GBase-LW" } + 110 { "10GBase-ER" } + 111 { "10GBase-EW" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + UsageRestriction + + if ( $this.psBase.CimInstanceProperties["UsageRestriction"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["UsageRestriction"].Value) + { + 0 { "Unknown" } + 2 { "Front-end only" } + 3 { "Back-end only" } + 4 { "Not restricted" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_InitiatorId + + + Type + + if ( $this.psBase.CimInstanceProperties["Type"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["Type"].Value) + { + 1 { "Other" } + 2 { "PortWWN" } + 3 { "NodeWWN" } + 4 { "Hostname" } + 5 { "iSCSI Name" } + 6 { "SwitchWWN" } + 7 { "SASAddress" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + HostType + + if ( $this.psBase.CimInstanceProperties["HostType"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["HostType"].Value) + { + 0 { "Unknown" } + 1 { "Other" } + 2 { "Standard" } + 3 { "Solaris" } + 4 { "HPUX" } + 5 { "OpenVMS" } + 6 { "Tru64" } + 7 { "Netware" } + 8 { "Sequent" } + 9 { "AIX" } + 10 { "DGUX" } + 11 { "Dynix" } + 12 { "Irix" } + 13 { "Cisco iSCSI Storage Router" } + 14 { "Linux" } + 15 { "Microsoft Windows" } + 16 { "OS400" } + 17 { "TRESPASS" } + 18 { "HI-UX" } + 19 { "VMware ESXi" } + 20 { "Microsoft Windows Server 2008" } + 21 { "Microsoft Windows Server 2003" } + Default { "Unknown" } + } + } + else + { + $null; + } + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_InitiatorPort + + + PortType + + switch ($this.psBase.CimInstanceProperties["PortType"].Value) + { + 1 { "Unknown" } + 2 { "Other" } + 3 { "Not present" } + 5 { "Fabric" } + 6 { "Public Loop" } + 7 { "FL Port" } + 8 { "Fabric Port" } + 9 { "Fabric expansion port" } + 10 { "Generic Fabric Port" } + 20 { "Private Loop" } + 21 { "Point to Point" } + Default { "Unknown" } + } + + + + ConnectionType + + switch ($this.psBase.CimInstanceProperties["ConnectionType"].Value) + { + 0 { "Other" } + 1 { "Fibre Channel" } + 2 { "iSCSI" } + 3 { "SAS" } + Default { "Unknown" } + } + + + + OperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) + { + switch ( $status ) + { + 1 { $_status += "Unknown" } + 2 { $_status += "Operational" } + 3 { $_status += "User Offline" } + 4 { $_status += "Bypassed" } + 5 { $_status += "In diagnostics mode" } + 6 { $_status += "Link Down" } + 7 { $_status += "Port Error" } + 8 { $_status += "Loopback" } + } + } + $_status; + + + + PortSupportedSpeed + + switch ($this.psBase.CimInstanceProperties["PortSupportedSpeed"].Value) + { + 1 { "1 GBit/sec" } + 2 { "2 GBit/sec" } + 4 { "10 GBit/sec" } + 8 { "4 GBit/sec" } + Default { "Unknown" } + } + + + + PortSpeed + + switch ($this.psBase.CimInstanceProperties["PortSpeed"].Value) + { + 1 { "1 GBit/sec" } + 2 { "2 GBit/sec" } + 4 { "10 GBit/sec" } + 8 { "4 GBit/sec" } + Default { "Unknown" } + } + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_MaskingSet + + + HostType + + if ( $this.psBase.CimInstanceProperties["HostType"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["HostType"].Value) + { + 0 { "Unknown" } + 1 { "Other" } + 2 { "Standard" } + 3 { "Solaris" } + 4 { "HPUX" } + 5 { "OpenVMS" } + 6 { "Tru64" } + 7 { "Netware" } + 8 { "Sequent" } + 9 { "AIX" } + 10 { "DGUX" } + 11 { "Dynix" } + 12 { "Irix" } + 13 { "Cisco iSCSI Storage Router" } + 14 { "Linux" } + 15 { "Microsoft Windows" } + 16 { "OS400" } + 17 { "TRESPASS" } + 18 { "HI-UX" } + 19 { "VMware ESXi" } + 20 { "Microsoft Windows Server 2008" } + 21 { "Microsoft Windows Server 2003" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageSetting + + + NewDiskPolicy + + switch ($this.psBase.CimInstanceProperties["NewDiskPolicy"].Value) + { + 0 { "Unknown" } + 1 { "OnlineAll" } + 2 { "OfflineShared" } + 3 { "OfflineAll" } + 4 { "OfflineInternal" } + Default { "OfflineShared" } + } + + + + ScrubPolicy + + switch ($this.psBase.CimInstanceProperties["ScrubPolicy"].Value) + { + 0 { "Off" } + 1 { "IntegrityStreams" } + 2 { "All" } + Default { "Integrity Streams" } + } + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageJob + + + OperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) + { + switch ( $status ) + { + 1 { $_status += "Other" } + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 4 { $_status += "Stressed" } + 5 { $_status += "Predictive Failure" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 8 { $_status += "Starting" } + 9 { $_status += "Stopping" } + 10 { $_status += "Stopped" } + 11 { $_status += "In Service" } + 12 { $_status += "No Contact" } + 13 { $_status += "Lost Communication" } + 14 { $_status += "Aborted" } + 15 { $_status += "Dormant" } + 16 { $_status += "Supporting Entity in Error" } + 17 { $_status += "Completed" } + 18 { $_status += "Power Mode" } + 19 { $_status += "Relocating" } + 32772 { $_status += "Failed Media" } + 32773 { $_status += "Split" } + 32774 { $_status += "Stale Metadata" } + 32775 { $_status += "IO Error" } + 32776 { $_status += "Unrecognized Metadata" } + Default { "Unknown" } + } + } + $_status; + + + + JobState + + switch ( $this.psBase.CimInstanceProperties["JobState"].Value ) + { + 2 { "New" } + 3 { "Starting" } + 4 { "Running" } + 5 { "Suspended" } + 6 { "Shutting Down" } + 7 { "Completed" } + 8 { "Terminated" } + 9 { "Killed" } + 10 { "Exception" } + 11 { "Service" } + 12 { "Query Pending" } + Default { "Unknown" } + } + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_FileStorageTier + + + PlacementStatus + + switch ( $this.psBase.CimInstanceProperties["PlacementStatus"].Value ) + { + 0 { "Unknown" } + 1 { "Completely on tier" } + 2 { "Partially on tier" } + 3 { "Not on tier" } + Default { "Unknown" } + } + + + + State + + switch ( $this.psBase.CimInstanceProperties["State"].Value ) + { + 0 { "Unknown" } + 1 { "OK" } + 2 { "Insufficent Capacity" } + 3 { "In Process" } + 4 { "Pending" } + Default { "Unknown" } + } + + + + DesiredStorageTierClass + + switch ( $this.psBase.CimInstanceProperties["DesiredStorageTierClass"].Value ) + { + 1 { "Capacity" } + 2 { "Performance" } + Default { "Unknown" } + } + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageTier + + + Usage + + switch ( $this.psBase.CimInstanceProperties["Usage"].Value ) + { + 0 { "Unknown" } + 1 { "Data" } + 2 { "Read Cache" } + 3 { "Write Cache" } + 4 { "Dirty Region Tracking" } + 5 { "Valid Data Tracking" } + Default { "Unknown" } + } + + + + ProvisioningType + + switch ( $this.psBase.CimInstanceProperties["ProvisioningType"].Value ) + { + 0 { "Unknown" } + 1 { "Thin" } + 2 { "Fixed" } + Default { "Unknown" } + } + + + + AllocationUnitSize + + if ( $this.psBase.CimInstanceProperties["AllocationUnitSize"].Value -eq [System.UInt64]::MaxValue ) + { + "Auto" + } + else + { + $this.psBase.CimInstanceProperties["AllocationUnitSize"].Value + } + + + + MediaType + + switch ( $this.psBase.CimInstanceProperties["MediaType"].Value ) + { + 0 { "Unspecified" } + 3 { "HDD" } + 4 { "SSD" } + 5 { "SCM" } + Default { "Unspecified" } + } + + + + TierClass + + switch ( $this.psBase.CimInstanceProperties["TierClass"].Value ) + { + 0 { "Unknown" } + 1 { "Capacity" } + 2 { "Performance" } + Default { "Unknown" } + } + + + + FaultDomainAwareness + + switch ($this.psBase.CimInstanceProperties["FaultDomainAwareness"].Value) + { + 1 { "PhysicalDisk" } + 2 { "StorageEnclosure" } + 3 { "StorageScaleUnit" } + 4 { "StorageChassis" } + 5 { "StorageRack" } + Default { "Unknown" } + } + + + + ColumnIsolation + + switch ($this.psBase.CimInstanceProperties["ColumnIsolation"].Value) + { + 1 { "PhysicalDisk" } + 2 { "StorageEnclosure" } + 3 { "StorageScaleUnit" } + 4 { "StorageChassis" } + 5 { "StorageRack" } + Default { "Unknown" } + } + + + + NumberOfColumns + + if ( $this.psBase.CimInstanceProperties["NumberOfColumns"].Value -eq [System.UInt16]::MaxValue ) + { + "Auto" + } + else + { + $this.psBase.CimInstanceProperties["NumberOfColumns"].Value + } + + + + NumberOfGroups + + if ( $this.psBase.CimInstanceProperties["NumberOfGroups"].Value -eq [System.UInt16]::MaxValue ) + { + "Auto" + } + else + { + $this.psBase.CimInstanceProperties["NumberOfGroups"].Value + } + + + + ParityLayout + + if ( $this.psBase.CimInstanceProperties["ParityLayout"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ($this.psBase.CimInstanceProperties["ParityLayout"].Value) + { + 1 { "Non-rotated Parity" } + 2 { "Rotated Parity" } + Default { "Unknown" } + } + } + else + { + $null + } + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_PhysicalExtent + + + Flags + + $_flags = $this.psBase.CimInstanceProperties["Flags"].Value + $_flagsToHex = "{0:x16}" -f $_flags + '0x' + $_flagsToHex; + + + + OperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) + { + switch ( $status ) + { + 13 { $_status += "Lost Communication" } + 53254 { $_status += "Stale Metadata" } + 53278 { $_status += "Active" } + 53279 { $_status += "Need Reallocation" } + 53280 { $_status += "Need Regeneration" } + 53281 { $_status += "Regenerating" } + 53282 { $_status += "Not Allocated" } + 53283 { $_status += "Pending Deletion" } + Default { "Unknown" } + } + } + $_status; + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageNodeToDisk + + + HealthStatus + + switch ($this.psBase.CimInstanceProperties["HealthStatus"].Value) + { + 0 { "Healthy" } + 1 { "Warning" } + 2 { "Unhealthy" } + Default { "Unknown" } + } + + + + OperationalStatus + + $_status = @(); + foreach( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) + { + switch ( $status ) + { + 1 { $_status += "Other" } + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 4 { $_status += "Stressed" } + 5 { $_status += "Predictive Failure" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 8 { $_status += "Starting" } + 9 { $_status += "Stopping" } + 10 { $_status += "Stopped" } + 11 { $_status += "InService" } + 12 { $_status += "No Contact" } + 13 { $_status += "Lost Communication" } + 14 { $_status += "Aborted" } + 15 { $_status += "Dormant" } + 16 { $_status += "Supporting Entity in Error" } + 17 { $_status += "Completed" } + 18 { $_status += "Power Mode" } + 19 { $_status += "Relocating" } + 53264 { $_status += "Online" } + 53265 { $_status += "Not Ready" } + 53266 { $_status += "No Media" } + 53267 { $_status += "Offline" } + 53268 { $_status += "Failed" } + Default { $_status += "Unknown" } + } + } + $_status; + + + + OfflineReason + + switch ($this.psBase.CimInstanceProperties["OfflineReason"].Value) + { + 1 { "Policy" } + 2 { "Redundant Path" } + 3 { "Snapshot" } + 4 { "Collision" } + 5 { "Resource Exhaustion" } + 6 { "Critical Write Failures" } + 7 { "Data Integrity Scan Required" } + Default { $null } + } + + + + StorageNodeObjectId + + $this.psBase.CimInstanceProperties["StorageNode"].Value.ObjectId + + + + DiskObjectId + + $this.psBase.CimInstanceProperties["Disk"].Value.ObjectId + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_FileServer + + + HealthStatus + + switch ( $this.psBase.CimInstanceProperties["HealthStatus"].Value ) + { + 0 { "Healthy" } + 1 { "Warning" } + 2 { "Unhealthy" } + 5 { "Unknown" } + Default { "Unknown" } + } + + + + OperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) + { + switch ( $status ) + { + 1 { $_status += "Other" } + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 4 { $_status += "Stressed" } + 5 { $_status += "Predictive Failure" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 8 { $_status += "Starting" } + 9 { $_status += "Stopping" } + 10 { $_status += "Stopped" } + 11 { $_status += "In Service" } + 12 { $_status += "No Contact" } + 13 { $_status += "Lost Communication" } + 14 { $_status += "Aborted" } + 15 { $_status += "Dormant" } + 16 { $_status += "Supporting Entity in Error" } + 17 { $_status += "Completed" } + 18 { $_status += "Power Mode" } + 19 { $_status += "Relocating" } + 53248 { $_status += "Read-Only" } + 53248 { $_status += "Incomplete" } + Default { "Unknown" } + } + } + $_status; + + + + FileSharingProtocols + + $_protos = @(); + foreach ( $p in $this.psBase.CimInstanceProperties["FileSharingProtocols"].Value ) + { + switch ( $p ) + { + 2 { $_protos += "NFS" } + 3 { $_protos += "SMB" } + Default { "Unknown" } + } + } + $_protos; + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_FileShare + + + HealthStatus + + switch ( $this.psBase.CimInstanceProperties["HealthStatus"].Value ) + { + 0 { "Healthy" } + 1 { "Warning" } + 2 { "Unhealthy" } + 5 { "Unknown" } + Default { "Unknown" } + } + + + + OperationalStatus + + $_status = @(); + foreach( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) + { + switch ( $status ) + { + 1 { $_status += "Other" } + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 4 { $_status += "Stressed" } + 5 { $_status += "Predictive Failure" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 8 { $_status += "Starting" } + 9 { $_status += "Stopping" } + 10 { $_status += "Stopped" } + 11 { $_status += "InService" } + 12 { $_status += "No Contact" } + 13 { $_status += "Lost Communication" } + 14 { $_status += "Aborted" } + 15 { $_status += "Dormant" } + 16 { $_status += "Supporting Entity in Error" } + 17 { $_status += "Completed" } + 18 { $_status += "Power Mode" } + 19 { $_status += "Relocating" } + 53264 { $_status += "Online" } + 53265 { $_status += "Not Ready" } + 53266 { $_status += "No Media" } + 53267 { $_status += "Offline" } + 53268 { $_status += "Failed" } + Default { $_status += "Unknown" } + } + } + $_status; + + + + ShareState + + switch ( $this.psBase.CimInstanceProperties["ShareState"].Value ) + { + 0 { "Pending" } + 1 { "Online" } + 2 { "Offline" } + Default { "Unknown" } + } + + + + FileSharingProtocol + + switch ( $this.psBase.CimInstanceProperties["FileSharingProtocol"].Value ) + { + 2 { "NFS" } + 3 { "SMB" } + Default { "Unknown" } + } + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageNodeToPhysicalDisk + + + HealthStatus + + switch ($this.psBase.CimInstanceProperties["HealthStatus"].Value) + { + 0 { "Healthy" } + 1 { "Warning" } + 2 { "Unhealthy" } + 5 { "Unknown" } + Default { "Unknown" } + } + + + + OperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["OperationalStatus"].Value ) + { + switch ( $status ) + { + 1 { $_status += "Other" } + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 4 { $_status += "Stressed" } + 5 { $_status += "Predictive Failure" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 8 { $_status += "Starting" } + 9 { $_status += "Stopping" } + 10 { $_status += "Stopped" } + 11 { $_status += "In Service" } + 12 { $_status += "No Contact" } + 13 { $_status += "Lost Communication" } + 14 { $_status += "Aborted" } + 15 { $_status += "Dormant" } + 16 { $_status += "Supporting Entity in Error" } + 17 { $_status += "Completed" } + 18 { $_status += "Power Mode" } + 19 { $_status += "Relocating" } + 53252 { $_status += "Failed Media" } + 53253 { $_status += "Split" } + 53254 { $_status += "Stale Metadata" } + 53255 { $_status += "IO Error" } + 53256 { $_status += "Unrecognized Metadata" } + 53269 { $_status += "Removing from pool" } + 53270 { $_status += "In Maintenance Mode" } + 53271 { $_status += "Updating firmware" } + 53272 { $_status += "Device Hardware Error" } + 53273 { $_status += "Not Usable" } + 53274 { $_status += "Transient Error" } + 53276 { $_status += "Starting Maintenance Mode"} + 53277 { $_status += "Stopping Maintenance Mode"} + 53285 { $_status += "Threshold Exceeded"} + 53286 { $_status += "Abnormal Latency"} + Default { "Unknown" } + } + } + $_status; + + + + LoadBalancePolicy + + if ( $this.psBase.CimInstanceProperties["LoadBalancePolicy"].Flags.HasFlag([Microsoft.Management.Infrastructure.CimFlags]::NullValue) -eq $false ) + { + switch ( $this.psBase.CimInstanceProperties["LoadBalancePolicy"].Value ) + { + 0 { "Unknown" } + 1 { "Fail Over" } + 2 { "Round Robin" } + 3 { "Round Robin with Subset" } + 4 { "Least Queue Depth" } + 5 { "Weighted Paths" } + 6 { "Least Blocks" } + 7 { "Vendor Specific" } + } + } + + + + PathState + + $_state = @(); + foreach ( $state in $this.psBase.CimInstanceProperties["PathState"].Value ) + { + switch ( $state ) + { + 0 { $_state += "Unavailable" } + 1 { $_state += "Active/Unoptimized" } + 2 { $_state += "Standby" } + 3 { $_state += "Active/Optimized" } + 4 { $_state += "Failed" } + } + } + $_state; + + + + StorageNodeObjectId + + $this.psBase.CimInstanceProperties["StorageNode"].Value.ObjectId + + + + PhysicalDiskObjectId + + $this.psBase.CimInstanceProperties["PhysicalDisk"].Value.ObjectId + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageNodeToStorageEnclosure + + + HealthStatus + + switch ($this.psBase.CimInstanceProperties["HealthStatus"].Value) + { + 0 { "Healthy" } + 1 { "Warning" } + 2 { "Unhealthy" } + 5 { "Unknown" } + Default { "Unknown" } + } + + + + SlotOperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["SlotOperationalStatus"].Value ) + { + switch ( $status ) + { + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 53257 { $_status += "Not Installed" } + 53258 { $_status += "Off" } + 53259 { $_status += "No Access Allowed" } + 53260 { $_status += "Not Reported" } + Default { "Unknown" } + } + } + $_status; + + + + PowerSupplyOperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["PowerSupplyOperationalStatus"].Value ) + { + switch ( $status ) + { + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 53257 { $_status += "Not Installed" } + 53258 { $_status += "Off" } + 53259 { $_status += "No Access Allowed" } + 53260 { $_status += "Not Reported" } + Default { "Unknown" } + } + } + $_status; + + + + FanOperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["FanOperationalStatus"].Value ) + { + switch ( $status ) + { + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 53257 { $_status += "Not Installed" } + 53258 { $_status += "Off" } + 53259 { $_status += "No Access Allowed" } + 53260 { $_status += "Not Reported" } + Default { "Unknown" } + } + } + $_status; + + + + TemperatureSensorOperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["TemperatureSensorOperationalStatus"].Value ) + { + switch ( $status ) + { + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 53257 { $_status += "Not Installed" } + 53258 { $_status += "Off" } + 53259 { $_status += "No Access Allowed" } + 53260 { $_status += "Not Reported" } + Default { "Unknown" } + } + } + $_status; + + + + VoltageSensorOperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["VoltageSensorOperationalStatus"].Value ) + { + switch ( $status ) + { + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 53257 { $_status += "Not Installed" } + 53258 { $_status += "Off" } + 53259 { $_status += "No Access Allowed" } + 53260 { $_status += "Not Reported" } + Default { "Unknown" } + } + } + $_status; + + + + CurrentSensorOperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["CurrentSensorOperationalStatus"].Value ) + { + switch ( $status ) + { + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 53257 { $_status += "Not Installed" } + 53258 { $_status += "Off" } + 53259 { $_status += "No Access Allowed" } + 53260 { $_status += "Not Reported" } + Default { "Unknown" } + } + } + $_status; + + + + IOControllerOperationalStatus + + $_status = @(); + foreach ( $status in $this.psBase.CimInstanceProperties["IOControllerOperationalStatus"].Value ) + { + switch ( $status ) + { + 2 { $_status += "OK" } + 3 { $_status += "Degraded" } + 6 { $_status += "Error" } + 7 { $_status += "Non-Recoverable Error" } + 53257 { $_status += "Not Installed" } + 53258 { $_status += "Off" } + 53259 { $_status += "No Access Allowed" } + 53260 { $_status += "Not Reported" } + Default { "Unknown" } + } + } + $_status; + + + + StorageNodeObjectId + + $this.psBase.CimInstanceProperties["StorageNode"].Value.ObjectId + + + + StorageEnclosureObjectId + + $this.psBase.CimInstanceProperties["StorageEnclosure"].Value.ObjectId + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageDiagnoseResult + + + PerceivedSeverity + + switch ( $this.psBase.CimInstanceProperties["PerceivedSeverity"].Value ) + { + 0 { "Unknown" } + 2 { "Information" } + 3 { "Degraded/Warning" } + 4 { "Minor" } + 5 { "Major" } + 6 { "Critical" } + 7 { "Fatal/NonRecoverable" } + } + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_HealthAction + + + State + + switch ( $this.psBase.CimInstanceProperties["State"].Value ) + { + 0 { "None" } + 1 { "Scheduled" } + 2 { "Running" } + 3 { "Paused" } + 1024 { "Succeeded" } + 1025 { "Failed" } + 1026 { "Canceled" } + } + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/StorageCmdlets.cdxml b/newton-cn/bin/v1.0/Modules/Storage/StorageCmdlets.cdxml new file mode 100644 index 0000000..219b64b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/StorageCmdlets.cdxml @@ -0,0 +1,3187 @@ + + + 1.0.0.0 + NoExport + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/StorageEnclosure.cdxml b/newton-cn/bin/v1.0/Modules/Storage/StorageEnclosure.cdxml new file mode 100644 index 0000000..4c51f4e --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/StorageEnclosure.cdxml @@ -0,0 +1,339 @@ + + + 1.0.0.0 + StorageEnclosure + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/StorageHealth.cdxml b/newton-cn/bin/v1.0/Modules/Storage/StorageHealth.cdxml new file mode 100644 index 0000000..8341214 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/StorageHealth.cdxml @@ -0,0 +1,151 @@ + + + 1.0.0.0 + StorageHealth + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/Storage/StorageJob.cdxml b/newton-cn/bin/v1.0/Modules/Storage/StorageJob.cdxml new file mode 100644 index 0000000..fa537a2 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/StorageJob.cdxml @@ -0,0 +1,172 @@ + + + 1.0.0.0 + StorageJob + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/StorageNode.cdxml b/newton-cn/bin/v1.0/Modules/Storage/StorageNode.cdxml new file mode 100644 index 0000000..b009ffe --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/StorageNode.cdxml @@ -0,0 +1,113 @@ + + + 1.0.0.0 + StorageNode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/StoragePool.cdxml b/newton-cn/bin/v1.0/Modules/Storage/StoragePool.cdxml new file mode 100644 index 0000000..66f2753 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/StoragePool.cdxml @@ -0,0 +1,786 @@ + + + 1.0.0.0 + StoragePool + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/Storage/StorageProvider.cdxml b/newton-cn/bin/v1.0/Modules/Storage/StorageProvider.cdxml new file mode 100644 index 0000000..c7041e1 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/StorageProvider.cdxml @@ -0,0 +1,227 @@ + + + 1.0.0.0 + StorageProvider + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/StorageReliabilityCounter.cdxml b/newton-cn/bin/v1.0/Modules/Storage/StorageReliabilityCounter.cdxml new file mode 100644 index 0000000..30b834d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/StorageReliabilityCounter.cdxml @@ -0,0 +1,49 @@ + + + 1.0.0.0 + StorageReliabilityCounter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/Storage/StorageScripts.psm1 b/newton-cn/bin/v1.0/Modules/Storage/StorageScripts.psm1 new file mode 100644 index 0000000..ad25618 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/StorageScripts.psm1 @@ -0,0 +1,7951 @@ +############################ +# +# Copyright (c) Microsoft Corporation +# +# Abstract: +# SMAPI script cmdlets +# +############################ + +using namespace System.Management.Automation.Runspaces + +import-module Storage\StorageHealth.cdxml +import-module Storage\StorageSubSystem.cdxml + +$StorageNamespace = 'root\microsoft\windows\storage' +$WmiNamespace = 'root\wmi' +$ClusterNamespace = 'root\mscluster' + +$Global:StorageHistoryCharts = [Hashtable]::Synchronized(@{}) + +function CreateErrorRecord +{ + Param + ( + [String] + $ErrorId, + + [String] + $ErrorMessage, + + [System.Management.Automation.ErrorCategory] + $ErrorCategory, + + [Exception] + $Exception, + + [Object] + $TargetObject + ) + + if($Exception -eq $null) + { + $Exception = New-Object System.Management.Automation.RuntimeException $ErrorMessage + } + + $errorRecord = New-Object System.Management.Automation.ErrorRecord @($Exception, $ErrorId, $ErrorCategory, $TargetObject) + return $errorRecord +} + +class StorageHistory +{ + [UInt16]$Version + [String]$FriendlyName + [String]$SerialNumber + [String]$AdapterSerialNumber + [String]$FirmwareRevision + [String]$DeviceGuid + [String]$DeviceNumber + [String]$BusType + [String]$MediaType + [DateTime]$EventTime + [UInt32]$MaxQueueCount + [UInt32]$MaxOutstandingCount + [UInt64]$TotalIoCount + [UInt64]$SuccessIoCount + [UInt64]$FailedIoCount + [UInt64]$TotalReadBytes + [UInt64]$TotalWriteBytes + [UInt64]$TotalIoLatency + [UInt64]$AvgIoLatency + [UInt64]$MaxIoLatency + [UInt64]$MaxFlushLatency + [UInt64]$MaxUnmapLatency + [UInt64]$TotalQueueIoCount + [UInt64]$TotalQueueIoWaitTime + [UInt64]$AvgQueueIoWaitTime + [UInt64]$MaxQueueIoWaitTime + [UInt32]$IoTimeout + [UInt64]$QueueIoWaitExceededTimeoutCount + [UInt64]$QueueIoBusyCount + [UInt64]$QueueIoPausedCount + [UInt64]$QueueIoUntaggedCommandOutstandingCount + [UInt64]$QueueIoPausedForUntaggedCount + [UInt64]$TotalErrors + [UInt64]$TotalReadWriteErrors + [UInt64]$TotalImpendingDeviceFailureErrors + [UInt64]$TotalDeviceFailureErrors + [UInt16]$BucketCount + [UInt64[]]$BucketIoLatency + [UInt64[]]$BucketSuccessIoCount + [UInt64[]]$BucketFailedIoCount + [UInt64[]]$BucketTotalIoCount + [UInt64[]]$BucketTotalIoTime + [Single[]]$BucketIoPercent + [UInt16]$HighestLatencyBucket + [System.Collections.ArrayList]$UnresponsiveTime + [System.Collections.ArrayList]$ResponsiveTime +} + +class StorageHistoryAggregate +{ + [UInt16]$Version + [String]$FriendlyName + [String]$SerialNumber + [String]$AdapterSerialNumber + [String]$FirmwareRevision + [String]$DeviceGuid + [String]$DeviceNumber + [String]$BusType + [String]$MediaType + [DateTime]$StartTime + [DateTime]$EndTime + [UInt32]$EventCount + [UInt32]$MaxQueueCount + [UInt32]$MaxOutstandingCount + [Double]$TotalIoCount + [Double]$SuccessIoCount + [Double]$FailedIoCount + [Double]$TotalReadBytes + [Double]$TotalWriteBytes + [Double]$TotalIoLatency + [UInt64]$AvgIoLatency + [UInt64]$MaxIoLatency + [UInt64]$MaxFlushLatency + [UInt64]$MaxUnmapLatency + [Double]$TotalQueueIoCount + [Double]$TotalQueueIoWaitTime + [UInt64]$AvgQueueIoWaitTime + [UInt64]$MaxQueueIoWaitTime + [UInt32]$IoTimeout + [Double]$QueueIoWaitExceededTimeoutCount + [Double]$QueueIoBusyCount + [Double]$QueueIoPausedCount + [Double]$QueueIoUntaggedCommandOutstandingCount + [Double]$QueueIoPausedForUntaggedCount + [Double]$TotalErrors + [Double]$TotalReadWriteErrors + [Double]$TotalImpendingDeviceFailureErrors + [Double]$TotalDeviceFailureErrors + [UInt16]$BucketCount + [UInt64[]]$BucketIoLatency + [Double[]]$BucketSuccessIoCount + [Double[]]$BucketFailedIoCount + [Double[]]$BucketTotalIoCount + [Double[]]$BucketTotalIoTime + [UInt32[]]$BucketIoPercent + [UInt32[]]$BucketHighestLatencyCount +} + +class StorageError +{ + [UInt16]$Version + [String]$FriendlyName + [String]$SerialNumber + [String]$AdapterSerialNumber + [String]$FirmwareRevision + [String]$DeviceGuid + [String]$DeviceNumber + [String]$BusType + [String]$MediaType + [DateTime]$EventTime + [UInt32]$ServiceDuration + [UInt32]$QueueWaitDuration + [Byte]$Command + [Byte]$SrbStatus + [Byte]$ScsiStatus + [Byte]$SenseKey + [Byte]$SenseCode + [Byte]$SenseCodeQualifier + [UInt32]$IoSize + [UInt32]$QueueDepth + [UInt64]$LBA +} + + +$PopulateStorageError = { + + Param + ( + [Ref] + $Object, + + [System.Diagnostics.Eventing.Reader.EventRecord] + $EventRecord, + + [System.String] + $FriendlyName, + + [System.String] + $SerialNumber, + + [System.String] + $AdapterSerialNumber, + + [System.String] + $FirmwareRevision, + + [System.String] + $DeviceGuid, + + [System.String] + $Number, + + [System.String] + $BusType, + + [System.String] + $MediaType + ) + + $eventXml = [XML]$EventRecord.ToXml() + $tempObject = [PsCustomObject]@{} + + for ($index = 0; $index -lt $eventXml.Event.EventData.Data.Count; $index++) + { + $tempObject | Add-Member -MemberType NoteProperty ` + -Name $eventXml.Event.EventData.Data[$index].Name ` + -Value $eventXml.Event.EventData.Data[$index].'#Text' + } + + $Object.Value.PSObject.TypeNames.Insert( 0, "Microsoft.Windows.StorageManagement.StorageError" ) + $Object.Value.PSObject.TypeNames.Insert( 1, "Microsoft.Windows.StorageManagement.StorageError_v1" ) + + $Object.Value.Version = [UInt16]$tempObject.Version + + if ([String]::IsNullOrEmpty($FriendlyName) -eq $false) + { + $Object.Value.FriendlyName = $FriendlyName + } + else + { + $Object.Value.FriendlyName = $tempObject.ProductId + } + + if ([String]::IsNullOrEmpty($SerialNumber) -eq $false) + { + $Object.Value.SerialNumber = $SerialNumber + } + else + { + $Object.Value.SerialNumber = $tempObject.SerialNumber + } + + if ([String]::IsNullOrEmpty($AdapterSerialNumber) -eq $false) + { + $Object.Value.AdapterSerialNumber = $AdapterSerialNumber + } + else + { + $Object.Value.AdapterSerialNumber = $tempObject.AdapterSerialNumber + } + + if ([String]::IsNullOrEmpty($FirmwareRevision) -eq $false) + { + $Object.Value.FirmwareRevision = $FirmwareRevision + } + + $Object.Value.DeviceGuid = $DeviceGuid + $Object.Value.DeviceNumber = $Number + + if ([String]::IsNullOrEmpty($BusType) -eq $false) + { + $Object.Value.BusType = $BusType + } + else + { + switch ($tempObject.BusType) + { + "8" { $Object.Value.BusType = "RAID" } + "10" { $Object.Value.BusType = "SAS" } + "11" { $Object.Value.BusType = "SATA" } + "14" { $Object.Value.BusType = "Virtual" } + "17" { $Object.Value.BusType = "NVMe" } + "19" { $Object.Value.BusType = "UFS" } + default { $Object.Value.BusType = "Unknown" } + } + } + + $Object.Value.MediaType = $MediaType + $Object.Value.EventTime = $event.TimeCreated + $Object.Value.ServiceDuration = $tempObject.RequestDuration_ms + $Object.Value.QueueWaitDuration = $tempObject.WaitDuration_ms + $Object.Value.Command = $tempObject.Command + $Object.Value.SrbStatus = $tempObject.SrbStatus + $Object.Value.ScsiStatus = $tempObject.ScsiStatus + $Object.Value.SenseKey = $tempObject.SenseKey + $Object.Value.SenseCode = $tempObject.AddSense + $Object.Value.SenseCodeQualifier = $tempObject.AddSenseQ + $Object.Value.IoSize = $tempObject.IoSize + $Object.Value.QueueDepth = $tempObject.QueueDepth + $Object.Value.LBA = $tempObject.LBA +} + + +$PopulateStorageHistory = { + + Param + ( + [Ref] + $Object, + + [System.Diagnostics.Eventing.Reader.EventRecord] + $EventRecord, + + [System.String] + $FriendlyName, + + [System.String] + $SerialNumber, + + [System.String] + $AdapterSerialNumber, + + [System.String] + $FirmwareRevision, + + [System.String] + $DeviceGuid, + + [System.String] + $Number, + + [System.String] + $BusType, + + [System.String] + $MediaType + ) + + $eventXml = [XML]$EventRecord.ToXml() + $tempObject = [PsCustomObject]@{} + + for ($index = 0; $index -lt $eventXml.Event.EventData.Data.Count; $index++) + { + $tempObject | Add-Member -MemberType NoteProperty ` + -Name $eventXml.Event.EventData.Data[$index].Name ` + -Value $eventXml.Event.EventData.Data[$index].'#Text' + } + + $Object.Value.PSObject.TypeNames.Insert( 0, "Microsoft.Windows.StorageManagement.StorageHistory" ) + + $Object.Value.Version = [UInt16]$tempObject.Version + + if ([String]::IsNullOrEmpty($FriendlyName) -eq $false) + { + $Object.Value.FriendlyName = $FriendlyName + } + else + { + $Object.Value.FriendlyName = $tempObject.ProductId + } + + if ([String]::IsNullOrEmpty($SerialNumber) -eq $false) + { + $Object.Value.SerialNumber = $SerialNumber + } + else + { + $Object.Value.SerialNumber = $tempObject.SerialNumber + } + + if ([String]::IsNullOrEmpty($AdapterSerialNumber) -eq $false) + { + $Object.Value.AdapterSerialNumber = $AdapterSerialNumber + } + else + { + $Object.Value.AdapterSerialNumber = $tempObject.AdapterSerialNumber + } + + if ([String]::IsNullOrEmpty($FirmwareRevision) -eq $false) + { + $Object.Value.FirmwareRevision = $FirmwareRevision + } + else + { + $Object.Value.FirmwareRevision = $tempObject.FirmwareRevision + } + + $Object.Value.DeviceGuid = $DeviceGuid + $Object.Value.DeviceNumber = $Number + + if ([String]::IsNullOrEmpty($BusType) -eq $false) + { + $Object.Value.BusType = $BusType + } + else + { + switch ($tempObject.BusType) + { + "8" { $Object.Value.BusType = "RAID" } + "10" { $Object.Value.BusType = "SAS" } + "11" { $Object.Value.BusType = "SATA" } + "14" { $Object.Value.BusType = "Virtual" } + "17" { $Object.Value.BusType = "NVMe" } + "19" { $Object.Value.BusType = "UFS" } + default { $Object.Value.BusType = "Unknown" } + } + } + + $Object.Value.MediaType = $MediaType + $Object.Value.EventTime = $event.TimeCreated + $Object.Value.MaxQueueCount = [UInt32]$tempObject.MaxDeviceQueueCount + $Object.Value.MaxOutstandingCount = [UInt32]$tempObject.MaxOutstandingCount + + if ($Object.Value.Version -eq 5) + { + $Object.Value.PSObject.TypeNames.Insert( 1, "Microsoft.Windows.StorageManagement.StorageHistory_v5" ) + + $Object.Value.BucketCount = 5 + $Object.Value.BucketIoLatency = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount + $Object.Value.BucketSuccessIoCount = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount + $Object.Value.BucketFailedIoCount = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount + $Object.Value.BucketTotalIoCount = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount + $Object.Value.BucketTotalIoTime = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount + $Object.Value.BucketIoPercent = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount + + $Object.Value.BucketIoLatency[0] = 16 * 10000 # 16 ms in 100ns + $Object.Value.BucketIoLatency[1] = 64 * 10000 # 64 ms in 100ns + $Object.Value.BucketIoLatency[2] = 2048 * 10000 # 2048 ms in 100ns + $Object.Value.BucketIoLatency[3] = 5120 * 10000 # 5120 ms in 100ns + $Object.Value.BucketIoLatency[4] = 10000 * 10000 # 5120+ ms approx to 10000 ms in 100ns + + for ($index = 0; $index -lt $Object.Value.BucketCount; $index++) + { + $field = "BucketIoCount" + [System.String]($index + 1) + $Object.Value.BucketTotalIoCount[$index] = $($tempObject.$field) + $Object.Value.BucketTotalIoTime[$index] = $Object.Value.BucketTotalIoCount[$index] * $Object.Value.BucketIoLatency[$index] + + $Object.Value.TotalIoCount += $Object.Value.BucketTotalIoCount[$index] + $Object.Value.TotalIoLatency += $Object.Value.BucketTotalIoTime[$index] + + if ($Object.Value.BucketTotalIoCount[$index] -gt 0) + { + $Object.Value.MaxIoLatency = $Object.Value.BucketIoLatency[$index] + $Object.Value.HighestLatencyBucket = $index + } + } + + if ($Object.Value.TotalIoCount -gt 0) + { + for ($index = 0; $index -lt $Object.Value.BucketCount; $index++) + { + $Object.Value.BucketIoPercent[$index] = ($Object.Value.BucketTotalIoCount[$index] * 100) / $Object.Value.TotalIoCount + } + } + } + elseif (($Object.Value.Version -ge 9) -or ($Object.Value.Version -le 11)) + { + $Object.Value.PSObject.TypeNames.Insert( 1, "Microsoft.Windows.StorageManagement.StorageHistory_v11" ) + + $Object.Value.TotalIoCount = $tempObject.TotalIoCount + $Object.Value.TotalReadBytes = $tempObject.TotalReadBytes + $Object.Value.TotalWriteBytes = $tempObject.TotalWriteBytes + $Object.Value.MaxIoLatency = $tempObject.MaxReadWriteLatency_100ns + $Object.Value.MaxFlushLatency = $tempObject.MaxFlushLatency_100ns + $Object.Value.MaxUnmapLatency = $tempObject.MaxUnmapLatency_100ns + + if ($Object.Value.Version -eq 11) + { + $Object.Value.TotalQueueIoCount = $tempObject.TotalDeviceQueueIoCount + $Object.Value.TotalQueueIoWaitTime = $tempObject.TotalDeviceQueueIoWaitDuration_100ns + $Object.Value.MaxQueueIoWaitTime = $tempObject.MaxDeviceQueueIoWaitDuration_100ns + $Object.Value.IoTimeout = $tempObject.IoTimeout_s + $Object.Value.QueueIoWaitExceededTimeoutCount = $tempObject.DeviceQueueIoWaitExceededTimeoutCount + $Object.Value.QueueIoBusyCount = $tempObject.DeviceQueueIoBusyCount + $Object.Value.QueueIoPausedCount = $tempObject.DeviceQueueIoPausedCount + $Object.Value.QueueIoUntaggedCommandOutstandingCount = $tempObject.DeviceQueueIoUntaggedCommandOutstandingCount + $Object.Value.QueueIoPausedForUntaggedCount = $tempObject.DeviceQueueIoPausedForUntaggedCount + } + + $Object.Value.BucketCount = 12 + $Object.Value.BucketIoLatency = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount + $Object.Value.BucketSuccessIoCount = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount + $Object.Value.BucketFailedIoCount = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount + $Object.Value.BucketTotalIoCount = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount + $Object.Value.BucketTotalIoTime = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount + $Object.Value.BucketIoPercent = New-Object -TypeName System.UInt64[] $Object.Value.BucketCount + + $Object.Value.BucketIoLatency[0] = 256 * 10 # 256 us in 100ns + $Object.Value.BucketIoLatency[1] = 1 * 10000 # 1 ms in 100ns + $Object.Value.BucketIoLatency[2] = 4 * 10000 # 4 ms in 100ns + $Object.Value.BucketIoLatency[3] = 16 * 10000 # 16 ms in 100ns + $Object.Value.BucketIoLatency[4] = 64 * 10000 # 64 ms in 100ns + $Object.Value.BucketIoLatency[5] = 128 * 10000 # 128 ms in 100ns + $Object.Value.BucketIoLatency[6] = 256 * 10000 # 256 ms in 100ns + $Object.Value.BucketIoLatency[7] = 2000 * 10000 # 2000 ms in 100ns + $Object.Value.BucketIoLatency[8] = 6000 * 10000 # 6000 ms in 100ns + $Object.Value.BucketIoLatency[9] = 10000 * 10000 # 10000 ms in 100ns + $Object.Value.BucketIoLatency[10] = 20000 * 10000 # 20000 ms in 100ns + $Object.Value.BucketIoLatency[11] = 30000 * 10000 # 20000+ ms approx to 30000 ms in 100ns + + for ($index = 0; $index -lt $Object.Value.BucketCount; $index++) + { + $field = "BucketIoSuccess" + [System.String]($index + 1) + $Object.Value.BucketSuccessIoCount[$index] = $($tempObject.$field) + + $field = "BucketIoFailed" + [System.String]($index + 1) + $Object.Value.BucketFailedIoCount[$index] = $($tempObject.$field) + + $field = "BucketIoLatency" + [System.String]($index + 1) + "_100ns" + $Object.Value.BucketTotalIoTime[$index] = $($tempObject.$field) + + $Object.Value.BucketTotalIoCount[$index] = $Object.Value.BucketSuccessIoCount[$index] + $Object.Value.BucketFailedIoCount[$index] + + $Object.Value.SuccessIoCount += $Object.Value.BucketSuccessIoCount[$index] + $Object.Value.FailedIoCount += $Object.Value.BucketFailedIoCount[$index] + $Object.Value.TotalIoLatency += $Object.Value.BucketTotalIoTime[$index] + + if ($Object.Value.TotalIoCount -gt 0) + { + $Object.Value.BucketIoPercent[$index] = ($Object.Value.BucketTotalIoCount[$index] * 100) / $Object.Value.TotalIoCount + } + + if ($Object.Value.BucketTotalIoCount[$index] -gt 0) + { + $Object.Value.HighestLatencyBucket = $index + } + } + } + + if ($Object.Value.TotalIoCount -gt 0) + { + $Object.Value.AvgIoLatency = $Object.Value.TotalIoLatency / $Object.Value.TotalIoCount + } + + if (($Object.Value.Version -eq 11) -and ($Object.Value.TotalQueueIoCount -gt 0)) + { + $Object.Value.AvgQueueIoWaitTime = $Object.Value.TotalQueueIoWaitTime / $Object.Value.TotalQueueIoCount + } +} + + +$AugmentStorageHistory = { + + Param + ( + [Ref] + $Object, + + [System.Diagnostics.Eventing.Reader.EventRecord] + $EventRecord + ) + + $eventXml = [XML]$EventRecord.ToXml() + $tempObject = [PsCustomObject]@{} + + for ($index = 0; $index -lt $eventXml.Event.EventData.Data.Count; $index++) + { + $tempObject | Add-Member -MemberType NoteProperty ` + -Name $eventXml.Event.EventData.Data[$index].Name ` + -Value $eventXml.Event.EventData.Data[$index].'#Text' + } + + if ($EventRecord.Id -eq 502) + { + if ($Object.Value.UnresponsiveTime -eq $null) + { + $Object.Value.UnresponsiveTime = New-Object System.Collections.ArrayList + } + + $Object.Value.UnresponsiveTime.Add($EventRecord.TimeCreated) + } + elseif ($EventRecord.Id -eq 503) + { + if ($Object.Value.ResponsiveTime -eq $null) + { + $Object.Value.ResponsiveTime = New-Object System.Collections.ArrayList + } + + $Object.Value.ResponsiveTime.Add($EventRecord.TimeCreated) + } + elseif ($EventRecord.Id -eq 504) + { + $Object.Value.TotalErrors = $tempObject.TotalErrors + $Object.Value.TotalReadWriteErrors = $tempObject.TotalReadWriteErrors + $Object.Value.TotalImpendingDeviceFailureErrors = $tempObject.TotalImpendingDeviceFailureErrors + $Object.Value.TotalDeviceFailureErrors = $tempObject.TotalDeviceFailureErrors + } +} + + +$PopulateStorageHistoryAggregate = { + + Param + ( + [Ref] + $AggregateObject, + + [Ref] + $Object + ) + + if ($AggregateObject.Value.Version -eq 0) + { + $AggregateObject.Value.PSObject.TypeNames.Insert( 0, "Microsoft.Windows.StorageManagement.StorageHistoryAggregate" ) + + if ($Object.Value.Version -eq 5) + { + $AggregateObject.Value.PSObject.TypeNames.Insert( 1, "Microsoft.Windows.StorageManagement.StorageHistoryAggregate_v5" ) + } + elseif (($Object.Value.Version -ge 9) -or ($Object.Value.Version -le 11)) + { + $AggregateObject.Value.PSObject.TypeNames.Insert( 1, "Microsoft.Windows.StorageManagement.StorageHistoryAggregate_v11" ) + } + + $AggregateObject.Value.Version = $Object.Value.Version + $AggregateObject.Value.FriendlyName = $Object.Value.FriendlyName + $AggregateObject.Value.SerialNumber = $Object.Value.SerialNumber + $AggregateObject.Value.AdapterSerialNumber = $Object.Value.AdapterSerialNumber + $AggregateObject.Value.FirmwareRevision = $Object.Value.FirmwareRevision + $AggregateObject.Value.DeviceGuid = $Object.Value.DeviceGuid + $AggregateObject.Value.DeviceNumber = $Object.Value.DeviceNumber + $AggregateObject.Value.BusType = $Object.Value.BusType + $AggregateObject.Value.MediaType = $Object.Value.MediaType + $AggregateObject.Value.StartTime = $Object.Value.EventTime + $AggregateObject.Value.EndTime = $Object.Value.EventTime + $AggregateObject.Value.EventCount = 1 + $AggregateObject.Value.MaxQueueCount = $Object.Value.MaxQueueCount + $AggregateObject.Value.MaxOutstandingCount = $Object.Value.MaxOutstandingCount + $AggregateObject.Value.TotalIoCount = $Object.Value.TotalIoCount + $AggregateObject.Value.SuccessIoCount = $Object.Value.SuccessIoCount + $AggregateObject.Value.FailedIoCount = $Object.Value.FailedIoCount + $AggregateObject.Value.TotalReadBytes = $Object.Value.TotalReadBytes + $AggregateObject.Value.TotalWriteBytes = $Object.Value.TotalWriteBytes + $AggregateObject.Value.TotalIoLatency = $Object.Value.TotalIoLatency + $AggregateObject.Value.MaxIoLatency = $Object.Value.MaxIoLatency + $AggregateObject.Value.MaxFlushLatency = $Object.Value.MaxFlushLatency + $AggregateObject.Value.MaxUnmapLatency = $Object.Value.MaxUnmapLatency + $AggregateObject.Value.TotalQueueIoCount = $Object.Value.TotalQueueIoCount + $AggregateObject.Value.TotalQueueIoWaitTime = $Object.Value.TotalQueueIoWaitTime + $AggregateObject.Value.MaxQueueIoWaitTime = $Object.Value.MaxQueueIoWaitTime + + if ($Object.Value.IoTimeout) + { + $AggregateObject.Value.IoTimeout = $Object.Value.IoTimeout + } + + $AggregateObject.Value.QueueIoWaitExceededTimeoutCount = $Object.Value.QueueIoWaitExceededTimeoutCount + $AggregateObject.Value.QueueIoBusyCount = $Object.Value.QueueIoBusyCount + $AggregateObject.Value.QueueIoPausedCount = $Object.Value.QueueIoPausedCount + $AggregateObject.Value.QueueIoUntaggedCommandOutstandingCount = $Object.Value.QueueIoUntaggedCommandOutstandingCount + $AggregateObject.Value.QueueIoPausedForUntaggedCount = $Object.Value.QueueIoPausedForUntaggedCount + $AggregateObject.Value.TotalErrors = $Object.Value.TotalErrors + $AggregateObject.Value.TotalReadWriteErrors = $Object.Value.TotalReadWriteErrors + $AggregateObject.Value.TotalImpendingDeviceFailureErrors = $Object.Value.TotalImpendingDeviceFailureErrors + $AggregateObject.Value.TotalDeviceFailureErrors = $Object.Value.TotalDeviceFailureErrors + $AggregateObject.Value.BucketCount = $Object.Value.BucketCount + + $AggregateObject.Value.BucketIoLatency = New-Object -TypeName System.UInt64[] $AggregateObject.Value.BucketCount + $AggregateObject.Value.BucketSuccessIoCount = New-Object -TypeName System.UInt64[] $AggregateObject.Value.BucketCount + $AggregateObject.Value.BucketFailedIoCount = New-Object -TypeName System.UInt64[] $AggregateObject.Value.BucketCount + $AggregateObject.Value.BucketTotalIoCount = New-Object -TypeName System.UInt64[] $AggregateObject.Value.BucketCount + $AggregateObject.Value.BucketTotalIoTime = New-Object -TypeName System.UInt64[] $AggregateObject.Value.BucketCount + $AggregateObject.Value.BucketIoPercent = New-Object -TypeName System.UInt64[] $AggregateObject.Value.BucketCount + $AggregateObject.Value.BucketHighestLatencyCount = New-Object -TypeName System.UInt32[] $AggregateObject.Value.BucketCount + + for ($index = 0; $index -lt $AggregateObject.Value.BucketCount; $index++) + { + $AggregateObject.Value.BucketIoLatency[$index] = $Object.Value.BucketIoLatency[$index] + $AggregateObject.Value.BucketSuccessIoCount[$index] = $Object.Value.BucketSuccessIoCount[$index] + $AggregateObject.Value.BucketFailedIoCount[$index] = $Object.Value.BucketFailedIoCount[$index] + $AggregateObject.Value.BucketTotalIoCount[$index] = $Object.Value.BucketTotalIoCount[$index] + $AggregateObject.Value.BucketTotalIoTime[$index] = $Object.Value.BucketTotalIoTime[$index] + } + + $AggregateObject.Value.BucketHighestLatencyCount[$($Object.Value.HighestLatencyBucket)]++ + + } + else + { + if ($Object.Value.Version -ne $AggregateObject.Value.Version) + { + return + } + + if ($Object.Value.EventTime -lt $AggregateObject.Value.StartTime) + { + $AggregateObject.Value.StartTime = $Object.Value.EventTime + } + + if ($Object.Value.EventTime -gt $AggregateObject.Value.EndTime) + { + $AggregateObject.Value.EndTime = $Object.Value.EventTime + } + + $AggregateObject.Value.EventCount++ + + if ($Object.Value.MaxQueueCount -gt $AggregateObject.Value.MaxQueueCount) + { + $AggregateObject.Value.MaxQueueCount = $Object.Value.MaxQueueCount + } + + if ($Object.Value.MaxOutstandingCount -gt $AggregateObject.Value.MaxOutstandingCount) + { + $AggregateObject.Value.MaxOutstandingCount = $Object.Value.MaxOutstandingCount + } + + $AggregateObject.Value.TotalIoCount += $Object.Value.TotalIoCount + $AggregateObject.Value.SuccessIoCount += $Object.Value.SuccessIoCount + $AggregateObject.Value.FailedIoCount += $Object.Value.FailedIoCount + $AggregateObject.Value.TotalReadBytes += $Object.Value.TotalReadBytes + $AggregateObject.Value.TotalWriteBytes += $Object.Value.TotalWriteBytes + $AggregateObject.Value.TotalIoLatency += $Object.Value.TotalIoLatency + + if ($Object.Value.MaxIoLatency -gt $AggregateObject.Value.MaxIoLatency) + { + $AggregateObject.Value.MaxIoLatency = $Object.Value.MaxIoLatency + } + + if ($Object.Value.MaxFlushLatency -gt $AggregateObject.Value.MaxFlushLatency) + { + $AggregateObject.Value.MaxFlushLatency = $Object.Value.MaxFlushLatency + } + + if ($Object.Value.MaxUnmapLatency -gt $AggregateObject.Value.MaxUnmapLatency) + { + $AggregateObject.Value.MaxUnmapLatency = $Object.Value.MaxUnmapLatency + } + + $AggregateObject.Value.TotalQueueIoCount += $Object.Value.TotalQueueIoCount + $AggregateObject.Value.TotalQueueIoWaitTime += $Object.Value.TotalQueueIoWaitTime + + if ($Object.Value.MaxQueueIoWaitTime -gt $AggregateObject.Value.MaxQueueIoWaitTime) + { + $AggregateObject.Value.MaxQueueIoWaitTime = $Object.Value.MaxQueueIoWaitTime + } + + if ($Object.Value.IoTimeout) + { + $AggregateObject.Value.IoTimeout = $Object.Value.IoTimeout + } + + $AggregateObject.Value.QueueIoWaitExceededTimeoutCount += $Object.Value.QueueIoWaitExceededTimeoutCount + $AggregateObject.Value.QueueIoBusyCount += $Object.Value.QueueIoBusyCount + $AggregateObject.Value.QueueIoPausedCount += $Object.Value.QueueIoPausedCount + $AggregateObject.Value.QueueIoUntaggedCommandOutstandingCount += $Object.Value.QueueIoUntaggedCommandOutstandingCount + $AggregateObject.Value.QueueIoPausedForUntaggedCount += $Object.Value.QueueIoPausedForUntaggedCount + $AggregateObject.Value.TotalErrors += $Object.Value.TotalErrors + $AggregateObject.Value.TotalReadWriteErrors += $Object.Value.TotalReadWriteErrors + $AggregateObject.Value.TotalImpendingDeviceFailureErrors += $Object.Value.TotalImpendingDeviceFailureErrors + $AggregateObject.Value.TotalDeviceFailureErrors += $Object.Value.TotalDeviceFailureErrors + + for ($index = 0; $index -lt $AggregateObject.Value.BucketCount; $index++) + { + $AggregateObject.Value.BucketSuccessIoCount[$index] += $Object.Value.BucketSuccessIoCount[$index] + $AggregateObject.Value.BucketFailedIoCount[$index] += $Object.Value.BucketFailedIoCount[$index] + $AggregateObject.Value.BucketTotalIoCount[$index] += $Object.Value.BucketTotalIoCount[$index] + $AggregateObject.Value.BucketTotalIoTime[$index] += $Object.Value.BucketTotalIoTime[$index] + } + + $AggregateObject.Value.BucketHighestLatencyCount[$($Object.Value.HighestLatencyBucket)]++ + } +} + + +function Get-StorageHistory +{ + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $PhysicalDisk, + + [System.String] + [Parameter( + ParameterSetName = 'ByDeviceGuid', + ValueFromPipeline = $false, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("DeviceId")] + $DeviceGuid, + + [System.String] + [Parameter( + ParameterSetName = 'ByDeviceNumber', + ValueFromPipeline = $false, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $DeviceNumber, + + #### ------------------------- PhysicalDisk parameters -----------------------#### + + [System.Management.Automation.PSCredential] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + Mandatory = $false)] + $Credential, + + #### ------------------------- Common method parameters ----------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDeviceGuid', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDeviceNumber', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $LogFile, + + [UInt32] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDeviceGuid', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDeviceNumber', + Mandatory = $false)] + $NumberOfHours, + + [Switch] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDeviceGuid', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDeviceNumber', + Mandatory = $false)] + $Disaggregate, + + [Switch] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDeviceGuid', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDeviceNumber', + Mandatory = $false)] + $Errors + ) + + Begin + { + } + + Process + { + # + # Get the device id based on the parameter set + # + + switch -regex ($psCmdlet.ParameterSetName) + { + { @( ` + "ByPhysicalDisk", ` + "ByDeviceNumber" ` + ) -contains $_ ` + } + { + # + # If device number is specified, + # get the corresponding device + # + + try + { + if ($DeviceNumber) + { + $PhysicalDisk = Get-PhysicalDisk -DeviceNumber $DeviceNumber + } + } + catch + { + $errorObject = CreateErrorRecord -ErrorId "ObjectNotFound" ` + -ErrorMessage "A physical disk matching the input criteria was not found" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + + # + # If log file is not specified, + # get the node name where the + # device is connected + # + + if (-not $LogFile) + { + $subsystem = $PhysicalDisk | get-storagesubsystem + + if ($subsystem.Model -eq "Clustered Windows Storage" -and + $subsystem.StorageConnectionType -eq "Local Storage") + { + # If the subsystem is clustered local (storage spaces direct) use + # SSU mapping since it works for 'Lost Communication' drives + + $storageScaleUnit = $PhysicalDisk | Get-StorageScaleUnit + + if (-not $storageScaleUnit) + { + $errorObject = CreateErrorRecord -ErrorId "ObjectNotFound" ` + -ErrorMessage "A storage scale unit was not found for the physical disk" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + + $computerName = $storageScaleUnit.FriendlyName + } + else + { + $storageNode = $PhysicalDisk | Get-StorageNode -PhysicallyConnected + + if (-not $storageNode) + { + $errorObject = CreateErrorRecord -ErrorId "ObjectNotFound" ` + -ErrorMessage "A storage node was not found for the physical disk" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + + $computerName = $storageNode.Name + } + } + + # Extract the device guid from the object id + # It is of the format ' <>:PD:" ' + $guid = $PhysicalDisk.ObjectId.Split(":")[2].TrimEnd('"') + + $friendlyName = $PhysicalDisk.FriendlyName + $serialNumber = $PhysicalDisk.SerialNumber + $adapterSerialNumber = $PhysicalDisk.AdapterSerialNumber + $firmwareRevision = $PhysicalDisk.FirmwareVersion + + if ($PhysicalDisk.DeviceId -ge 0) + { + $deviceNumber = $PhysicalDisk.DeviceId + } + + $busType = $PhysicalDisk.BusType + $mediaType = $PhysicalDisk.MediaType + } + + { @( ` + "ByDeviceGuid" ` + ) -contains $_ ` + } + { + try + { + [System.Guid]::Parse($DeviceGuid) | Out-Null + $guid = $DeviceGuid + } + catch + { + $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` + -ErrorMessage "DeviceGuid (or DeviceId) should be a GUID of the format 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' or '{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}'" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + } + } + + # + # Build the query to look for the specific events in storport log + # + + if ($PSBoundParameters.ContainsKey("Errors")) + { + $eventFilter = "EventID=549" + } + else + { + $eventFilter = "EventID=502 or ` + EventID=503 or ` + EventID=504 or ` + EventID=505" + } + + if ($NumberOfHours) + { + $query = "*[System[($eventFilter) and TimeCreated[timediff(@SystemTime) <= $($NumberOfHours*3600*1000)]]] and *[EventData[Data[@Name='ClassDeviceGuid'] and (Data='$guid')]]" + } + else + { + $query = "*[System[($eventFilter)]] and *[EventData[Data[@Name='ClassDeviceGuid'] and (Data='$guid')]]" + } + + # + # Retrive the events depending on the parameters + # + + Write-Progress -Activity "Get-StorageHistory" -PercentComplete 0 -CurrentOperation "Gathering events" -Status "0/2" + + try + { + if ($computerName) + { + if ($Credential) + { + $events = Get-WinEvent -LogName Microsoft-Windows-Storage-Storport/Operational ` + -FilterXPath $query ` + -ComputerName $computerName ` + -Credential $Credential ` + -ErrorAction Stop ` + -Oldest + } + else + { + $events = Get-WinEvent -LogName Microsoft-Windows-Storage-Storport/Operational ` + -FilterXPath $query ` + -ComputerName $computerName ` + -ErrorAction Stop ` + -Oldest + } + } + else + { + if ($LogFile) + { + $events = Get-WinEvent -Path $LogFile ` + -FilterXPath $query ` + -ErrorAction Stop ` + -Oldest + } + else + { + $events = Get-WinEvent -LogName Microsoft-Windows-Storage-Storport/Operational ` + -FilterXPath $query ` + -ErrorAction Stop ` + -Oldest + } + } + } + catch + { + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + + $psCmdlet.WriteError($errorObject) + return + } + + # + # Construct StorageHistory and StorageHistoryAggregate objects + # + + Write-Progress -Activity "Get-StorageHistory" -PercentComplete 0 -CurrentOperation "Constructing storage history objects" -Status "1/2" + + if ($PSBoundParameters.ContainsKey("Errors")) + { + for ($index = 0; $index -lt $events.count;) + { + $event = $events[$index] + $index++ + + [StorageError]$data = [StorageError]::new() + + &$PopulateStorageError -Object ([ref]$data) ` + -EventRecord $event ` + -FriendlyName $friendlyName ` + -SerialNumber $serialNumber ` + -AdapterSerialNumber $adapterSerialNumber ` + -FirmwareRevision $firmwareRevision ` + -DeviceGuid $guid ` + -Number $deviceNumber ` + -BusType $busType ` + -MediaType $mediaType | Out-Null + + $psCmdlet.WriteObject($data) + } + } + else + { + $firstEvent = $true + + for ($index = 0; $index -lt $events.count;) + { + $event = $events[$index] + $index++ + + # + # A StorageHistory object is created for every 505 event. + # Following non-505 events are collaped into it till + # the next 505 event is encountered. All non-505 events + # before the first 505 event are ignored + # + if ($event.Id -ne 505) + { + continue + } + + [StorageHistory]$data = [StorageHistory]::new() + + &$PopulateStorageHistory -Object ([ref]$data) ` + -EventRecord $event ` + -FriendlyName $friendlyName ` + -SerialNumber $serialNumber ` + -AdapterSerialNumber $adapterSerialNumber ` + -FirmwareRevision $firmwareRevision ` + -DeviceGuid $guid ` + -Number $deviceNumber ` + -BusType $busType ` + -MediaType $mediaType | Out-Null + + # + # If there are no IOs, skip + # + + if ($data.TotalIoCount -eq 0) + { + continue + } + + # + # Check if there are any non-505 events following it + # + + for (; $index -lt $events.count; $index++) + { + $event = $events[$index] + + if ($event.Id -eq 505) + { + break + } + + &$AugmentStorageHistory -Object ([ref]$data) ` + -EventRecord $event | Out-Null + } + + if ($PSBoundParameters.ContainsKey("Disaggregate")) + { + $psCmdlet.WriteObject($data) + } + else + { + if ($firstEvent) + { + [StorageHistoryAggregate]$aggregateData = [StorageHistoryAggregate]::new() + $firstEvent = $false + } + + &$PopulateStorageHistoryAggregate -AggregateObject ([ref]$aggregateData) ` + -Object ([ref]$data) | Out-Null + } + } + + if ($aggregateData) + { + $aggregateData.AvgIoLatency = $aggregateData.TotalIoLatency / $aggregateData.TotalIoCount + + if ($aggregateData.TotalQueueIoCount -gt 0) + { + $aggregateData.AvgQueueIoWaitTime = $aggregateData.TotalQueueIoWaitTime / $aggregateData.TotalQueueIoCount + } + + for ($index = 0; $index -lt $aggregateData.BucketCount; $index++) + { + $aggregateData.BucketIoPercent[$index] = ($aggregateData.BucketTotalIoCount[$index] * 100) / $aggregateData.TotalIoCount + } + + $psCmdlet.WriteObject($aggregateData) + } + } + + Write-Progress -Activity "Get-StorageHistory" -Completed -Status "2/2" + } +} + + +$DisplayTimeSeriesChart = { + + Param + ( + [System.String] + $ChartId, + + [System.String] + $Title, + + [System.Collections.ArrayList] + $StorageHistory, + + [System.Boolean] + $ShowDefault, + + [System.Boolean] + $ShowAvgLatency, + + [System.Boolean] + $ShowMaxLatency + ) + + # + # Build a device table with the + # data to chart. + # + + $deviceTable = New-Object System.Collections.Hashtable + + ForEach ($data in $StorageHistory) + { + if ($deviceTable.Contains($data.DeviceId) -eq $false) + { + $deviceData = New-Object -TypeName PsObject + $deviceData | Add-Member -NotePropertyName "DeviceNumber" -NotePropertyValue $data.DeviceNumber + $deviceData | Add-Member -NotePropertyName "FriendlyName" -NotePropertyValue $data.FriendlyName + $deviceData | Add-Member -NotePropertyName "SerialNumber" -NotePropertyValue $data.SerialNumber + + $dataList = New-Object System.Collections.ArrayList + $deviceData | Add-Member -NotePropertyName "DataList" -NotePropertyValue $dataList + + $deviceTable.Add($data.DeviceId, $deviceData) + } + else + { + $deviceData = $deviceTable[$data.DeviceId] + $dataList = $deviceData.DataList + } + + $dataPoint = New-Object -TypeName PsObject + $dataPoint | Add-Member -NotePropertyName "DateTime" -NotePropertyValue $data.EventTime + $dataPoint | Add-Member -NotePropertyName "AvgIoLatency" -NotePropertyValue ($data.AvgIoLatency/10) + $dataPoint | Add-Member -NotePropertyName "MaxIoLatency" -NotePropertyValue ($data.MaxIoLatency/10) + $dataPoint | Add-Member -NotePropertyName "MaxQueueDepth" -NotePropertyValue $data.MaxOutstandingCount + $dataPoint | Add-Member -NotePropertyName "UnresponsiveTime" -NotePropertyValue $data.UnresponsiveTime + $dataPoint | Add-Member -NotePropertyName "ResponsiveTime" -NotePropertyValue $data.ResponsiveTime + + [void]$dataList.Add($dataPoint) + } + + # + # Create a chart + # + + $chart = New-object Windows.Forms.DataVisualization.Charting.Chart + $chart.Anchor = [Windows.Forms.AnchorStyles]::Bottom -bor + [Windows.Forms.AnchorStyles]::Right -bor + [Windows.Forms.AnchorStyles]::Top -bor + [Windows.Forms.AnchorStyles]::Left + + $chart.Width = 1000 + $chart.Height = 800 + $chart.Left = 40 + $chart.Top = 30 + $chart.BackColor = [Drawing.Color]::White + [void]$chart.Titles.Add($Title) + $chart.Titles[0].Font = "segoeuilight,12pt" + + # + # Create a chart area to draw on + # + + $chartArea = New-Object Windows.Forms.DataVisualization.Charting.ChartArea + $chartarea.Name = "TimeSeries" + $chartarea.AxisX.IntervalType = [Windows.Forms.DataVisualization.Charting.DateTimeIntervalType]::Hours + $chartarea.AxisX.IntervalAutoMode = [Windows.Forms.DataVisualization.Charting.IntervalAutoMode]::VariableCount + $chartarea.AxisX.MajorGrid.Enabled = $false + $chartarea.AxisX.LabelStyle.Format = "yyyy/MM/dd h tt" + $chartarea.AxisX.ScaleView.Zoomable = $true + $chartarea.AxisX.ScrollBar.IsPositionedInside = $true + $chartarea.AxisX.ScrollBar.ButtonStyle = [Windows.Forms.DataVisualization.Charting.ScrollBarButtonStyles]::All + $chartarea.CursorX.IsUserEnabled = $true + $chartarea.CursorX.IsUserSelectionEnabled = $true + $chartarea.CursorX.IntervalType = [Windows.Forms.DataVisualization.Charting.DateTimeIntervalType]::Hours + $chartarea.CursorX.AutoScroll = $true + $chartArea.AxisY.Title = "Latency (us)" + $chartArea.AxisY.TitleFont = "segoeuilight,12pt" + $chartarea.AxisY.LabelStyle.Format = "N0" + $chartarea.AxisY.MinorGrid.Enabled = $true + $chartarea.AxisY.MinorGrid.LineDashStyle = [Windows.Forms.DataVisualization.Charting.ChartDashStyle]::Dot + + $chart.ChartAreas.Add($chartArea) + + $legend = New-Object Windows.Forms.DataVisualization.Charting.Legend + $legend.Name = "TimeSeries" + $legend.Docking = [Windows.Forms.DataVisualization.Charting.Docking]::Right + $legend.LegendStyle = [Windows.Forms.DataVisualization.Charting.LegendStyle]::Column + $chart.Legends.Add($legend) + + # + # Build the data to chart + # + + if ($ShowDefault -eq $true) + { + $ShowAvgLatency = $true + + if ($deviceTable.Count -eq 1) + { + $ShowMaxLatency = $true + } + else + { + $ShowMaxLatency = $false + } + } + + ForEach ($deviceId in $deviceTable.Keys) + { + $deviceData = $deviceTable[$deviceId] + $dataList = $deviceData.DataList + + if ($deviceTable.Count -eq 1) + { + [void]$chart.Titles.Add("Latency plot for " + + $deviceData.DeviceNumber + " : " + + $deviceData.FriendlyName + " : " + + $deviceData.SerialNumber) + } + + # + # Show max and avg latencies + # + + if ($ShowAvgLatency -eq $true) + { + if ($deviceTable.Count -eq 1) + { + $seriesName = "Avg" + } + else + { + $seriesName = "$($deviceData.DeviceNumber) : $($deviceData.SerialNumber) : Avg" + } + + [void]$chart.Series.Add($seriesName) + $chart.Series[$seriesName].ChartType = [Windows.Forms.DataVisualization.Charting.SeriesChartType]::Line + $chart.Series[$seriesName].XValueType = [Windows.Forms.DataVisualization.Charting.ChartValueType]::DateTime + $chart.Series[$seriesName].Legend = "TimeSeries" + $chart.Series[$seriesName].MarkerStyle = [Windows.Forms.DataVisualization.Charting.MarkerStyle]::Circle + + if ($deviceTable.Count -eq 1) + { + $chart.Series[$seriesName].Color = [Drawing.Color]::Green + } + + ForEach ($dataPoint in $dataList) + { + $point = New-Object Windows.Forms.DataVisualization.Charting.DataPoint + $point.SetValueXY($dataPoint.DateTime, $dataPoint.AvgIoLatency) + $point.Tooltip = "Value: #VALY{N0} us\n" + + "At: #VALX{yyyy/MM/dd h:mm tt}\n" + + "Max QD: $($dataPoint.MaxQueueDepth)" + + $chart.Series[$seriesName].Points.Add($point) + } + } + + if ($ShowMaxLatency -eq $true) + { + if ($deviceTable.Count -eq 1) + { + $seriesName = "Max" + } + else + { + $seriesName = "$($deviceData.DeviceNumber) : $($deviceData.SerialNumber) : Max" + } + + [void]$chart.Series.Add($seriesName) + $chart.Series[$seriesName].ChartType = [Windows.Forms.DataVisualization.Charting.SeriesChartType]::Line + $chart.Series[$seriesName].XValueType = [Windows.Forms.DataVisualization.Charting.ChartValueType]::DateTime + $chart.Series[$seriesName].Legend = "TimeSeries" + $chart.Series[$seriesName].MarkerStyle = [Windows.Forms.DataVisualization.Charting.MarkerStyle]::Circle + + if ($deviceTable.Count -eq 1) + { + $chart.Series[$seriesName].Color = [Drawing.Color]::Orange + } + + ForEach ($dataPoint in $dataList) + { + $point = New-Object Windows.Forms.DataVisualization.Charting.DataPoint + $point.SetValueXY($dataPoint.DateTime, $dataPoint.MaxIoLatency) + $point.Tooltip = "Value: #VALY{N0} us\n" + + "At: #VALX{yyyy/MM/dd h:mm tt}\n" + + "Max QD: $($dataPoint.MaxQueueDepth)" + + $chart.Series[$seriesName].Points.Add($point) + } + } + + # + # Show interesting events when there + # is a single device + # + + if ($deviceTable.Count -eq 1) + { + $seriesName = "Events" + + [void]$chart.Series.Add($seriesName) + $chart.Series[$seriesName].ChartType = [Windows.Forms.DataVisualization.Charting.SeriesChartType]::Point + $chart.Series[$seriesName].XValueType = [Windows.Forms.DataVisualization.Charting.ChartValueType]::DateTime + $chart.Series[$seriesName].Legend = "TimeSeries" + $chart.Series[$seriesName].MarkerStyle = [Windows.Forms.DataVisualization.Charting.MarkerStyle]::Square + $chart.Series[$seriesName].MarkerSize = 5 + $chart.Series[$seriesName].Color = [Drawing.Color]::Red + + # + # Find the level at which to show the points + # + + $value = 0 + + ForEach ($dataPoint in $dataList) + { + if ($ShowMaxLatency -eq $true) + { + if ($dataPoint.MaxIoLatency -gt $value) + { + $value = $dataPoint.MaxIoLatency + } + } + else + { + if ($dataPoint.AvgIoLatency -gt $value) + { + $value = $dataPoint.AvgIoLatency + } + } + } + + ForEach ($dataPoint in $dataList) + { + ForEach ($time in $dataPoint.UnresponsiveTime) + { + $point = New-Object Windows.Forms.DataVisualization.Charting.DataPoint + $point.SetValueXY($time, $value) + $point.Tooltip = "Marked unresponsive at #VALX{yyyy/MM/dd h:mm tt}\n" + + $chart.Series[$seriesName].Points.Add($point) + } + + ForEach ($time in $dataPoint.ResponsiveTime) + { + $point = New-Object Windows.Forms.DataVisualization.Charting.DataPoint + $point.SetValueXY($time, $value) + $point.Tooltip = "Marked responsive at #VALX{yyyy/MM/dd h:mm tt}\n" + + $chart.Series[$seriesName].Points.Add($point) + } + } + } + } + + $chart.ChartAreas[0].AxisX.LabelStyle.Angle = -45 + + # + # Display the chart on a form + # + + $form = New-Object Windows.Forms.Form + $form.Text = "Storage Performance Chart" + $form.Width = 1100 + $form.Height = 900 + $form.controls.add($chart) + $form.Add_Shown({$form.Activate()}) + + [void]$form.ShowDialog() + $form.Close() + $form.Dispose() + + [void]$StorageHistoryCharts.Host.Runspace.Events.GenerateEvent("StorageHistoryChart.Close", $null, $null, $ChartId) +} + + +$DisplaySummaryChart = { + + Param + ( + [System.String] + $ChartId, + + [System.String] + $Title, + + [System.Collections.ArrayList] + $StorageHistory, + + [System.Boolean] + $ShowDefault, + + [System.Boolean] + $ShowAvgLatency, + + [System.Boolean] + $ShowMaxLatency + ) + + # + # Create a chart + # + + $chart = New-object Windows.Forms.DataVisualization.Charting.Chart + $chart.Anchor = [Windows.Forms.AnchorStyles]::Bottom -bor + [Windows.Forms.AnchorStyles]::Right -bor + [Windows.Forms.AnchorStyles]::Top -bor + [Windows.Forms.AnchorStyles]::Left + + $chart.Width = 1000 + $chart.Height = 800 + $chart.Left = 40 + $chart.Top = 30 + $chart.BackColor = [Drawing.Color]::White + [void]$chart.Titles.Add($Title) + $chart.Titles[0].Font = "segoeuilight,12pt" + + if ($StorageHistory.Count -eq 1) + { + [void]$chart.Titles.Add("IO Distribution for " + + $StorageHistory[0].DeviceNumber + " : " + + $StorageHistory[0].FriendlyName + " : " + + $StorageHistory[0].SerialNumber) + } + else + { + [void]$chart.Titles.Add("Latency comparison") + } + + # + # Create a chart area to draw on + # + + $chartArea = New-Object Windows.Forms.DataVisualization.Charting.ChartArea + $chartarea.Name = "Summary" + $chartarea.AxisX.Interval = 1 + $chartarea.AxisX.IntervalAutoMode = [Windows.Forms.DataVisualization.Charting.IntervalAutoMode]::FixedCount + $chartarea.AxisX.MajorGrid.Enabled = $false + + # For a single device show IO distribution. + # For multiple devices show avg and max latency. + + if ($StorageHistory.Count -eq 1) + { + $chartArea.AxisX.Title = "Latency buckets (us)" + $chartArea.AxisX.TitleFont = "segoeuilight,12pt" + $chartArea.AxisY.Title = "IO Count" + } + else + { + $chartarea.AxisX.ScaleView.Size = [Math]::Min($StorageHistory.Count, 40) + $chartarea.AxisX.ScaleView.Zoomable = $true + $chartarea.AxisX.ScrollBar.IsPositionedInside = $true + $chartarea.AxisX.ScrollBar.ButtonStyle = [Windows.Forms.DataVisualization.Charting.ScrollBarButtonStyles]::All + $chartarea.CursorX.IsUserEnabled = $true + $chartarea.CursorX.IsUserSelectionEnabled = $true + $chartarea.CursorX.AutoScroll = $true + $chartArea.AxisY.Title = "Latency (us)" + } + + $chartArea.AxisY.TitleFont = "segoeuilight,12pt" + $chartarea.AxisY.LabelStyle.Format = "N0" + $chartarea.AxisY.MinorGrid.Enabled = $true + $chartarea.AxisY.MinorGrid.LineDashStyle = [Windows.Forms.DataVisualization.Charting.ChartDashStyle]::Dot + $chart.ChartAreas.Add($chartArea) + + $legend = New-Object Windows.Forms.DataVisualization.Charting.Legend + $legend.Name = "Summary" + $legend.Docking = [Windows.Forms.DataVisualization.Charting.Docking]::Right + $legend.LegendStyle = [Windows.Forms.DataVisualization.Charting.LegendStyle]::Column + $chart.Legends.Add($legend) + + # + # Build the data to chart + # + + if ($StorageHistory.Count -eq 1) + { + $data = $StorageHistory[0] + + $seriesName = "SuccessIoCount" + + [void]$chart.Series.Add($seriesName) + $chart.Series[$seriesName].ChartType = [Windows.Forms.DataVisualization.Charting.SeriesChartType]::StackedColumn + $chart.Series[$seriesName].XValueType = [Windows.Forms.DataVisualization.Charting.ChartValueType]::String + $chart.Series[$seriesName].Legend = "Summary" + $chart.Series[$seriesName].Color = [Drawing.Color]::Green + + for ($index = 0; $index -lt $data.BucketCount; $index++) + { + $point = New-Object Windows.Forms.DataVisualization.Charting.DataPoint + $point.SetValueXY([String]::Format('{0:N0}', $data.BucketIoLatency[$index] / 10), + $data.BucketSuccessIoCount[$index]) + $point.Tooltip = [String]::Format('Success: {0:N0}\nTotal: {1:N0}', + $data.BucketSuccessIoCount[$index], + $data.BucketTotalIoCount[$index]) + + $chart.Series[$seriesName].Points.Add($point) + } + + $seriesName = "FailedIoCount" + + [void]$chart.Series.Add($seriesName) + $chart.Series[$seriesName].ChartType = [Windows.Forms.DataVisualization.Charting.SeriesChartType]::StackedColumn + $chart.Series[$seriesName].XValueType = [Windows.Forms.DataVisualization.Charting.ChartValueType]::String + $chart.Series[$seriesName].Legend = "Summary" + $chart.Series[$seriesName].Color = [Drawing.Color]::Red + + for ($index = 0; $index -lt $data.BucketCount; $index++) + { + $point = New-Object Windows.Forms.DataVisualization.Charting.DataPoint + $point.SetValueXY([String]::Format('{0:N0}', $data.BucketIoLatency[$index] / 10), + $data.BucketFailedIoCount[$index]) + $point.Tooltip = [String]::Format('Failed: {0:N0}\nTotal: {1:N0}', + $data.BucketFailedIoCount[$index], + $data.BucketTotalIoCount[$index]) + + $chart.Series[$seriesName].Points.Add($point) + } + } + else + { + if ($ShowDefault -eq $true) + { + $ShowAvgLatency = $true + $ShowMaxLatency = $true + } + + if ($ShowAvgLatency -eq $true) + { + $seriesName = "Avg" + + [void]$chart.Series.Add($seriesName) + $chart.Series[$seriesName].ChartType = [Windows.Forms.DataVisualization.Charting.SeriesChartType]::Column + $chart.Series[$seriesName].XValueType = [Windows.Forms.DataVisualization.Charting.ChartValueType]::String + $chart.Series[$seriesName].Legend = "Summary" + $chart.Series[$seriesName].Color = [Drawing.Color]::Green + + ForEach ($data in $StorageHistory) + { + $point = New-Object Windows.Forms.DataVisualization.Charting.DataPoint + $point.SetValueXY($data.DeviceNumber + " : " + $data.SerialNumber, + $data.AvgIoLatency / 10) + $point.Tooltip = "Avg: #VALY{N0} us\n" + + [String]::Format('Total Io Count: {0:N0}\nSuccess Io Count: {1:N0}\nFailed Io Count: {2:N0}', + $data.TotalIoCount, $data.SuccessIoCount, $data.FailedIoCount) + + $chart.Series[$seriesName].Points.Add($point) + } + } + + if ($ShowMaxLatency -eq $true) + { + $seriesName = "Max" + + [void]$chart.Series.Add($seriesName) + $chart.Series[$seriesName].ChartType = [Windows.Forms.DataVisualization.Charting.SeriesChartType]::Column + $chart.Series[$seriesName].XValueType = [Windows.Forms.DataVisualization.Charting.ChartValueType]::String + $chart.Series[$seriesName].Legend = "Summary" + $chart.Series[$seriesName].Color = [Drawing.Color]::Orange + + ForEach ($data in $StorageHistory) + { + $point = New-Object Windows.Forms.DataVisualization.Charting.DataPoint + $point.SetValueXY($data.DeviceNumber + " : " + $data.SerialNumber, + $data.MaxIoLatency / 10) + $point.Tooltip = "Max: #VALY{N0} us\n" + + [String]::Format('Total Io Count: {0:N0}\nSuccess Io Count: {1:N0}\nFailed Io Count: {2:N0}', + $data.TotalIoCount, $data.SuccessIoCount, $data.FailedIoCount) + + $chart.Series[$seriesName].Points.Add($point) + } + } + + $chart.ChartAreas[0].AxisX.LabelStyle.Angle = -45 + } + + # + # Display the chart on a form + # + + $form = New-Object Windows.Forms.Form + $form.Text = "Storage Performance Chart" + $form.Width = 1100 + $form.Height = 900 + $form.controls.add($chart) + $form.Add_Shown({$form.Activate()}) + + [void]$form.ShowDialog() + $form.Close() + $form.Dispose() + + [void]$StorageHistoryCharts.Host.Runspace.Events.GenerateEvent("StorageHistoryChart.Close", $null, $null, $ChartId) +} + + +$StorageHistoryChartClose = { + + $chartId = $event.MessageData + $runspace = $Global:StorageHistoryCharts[$chartId] + + $runspace.Close() + $runspace.Dispose() + + $Global:StorageHistoryCharts.Remove($chartId) +} + + +function Show-StorageHistory +{ + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [System.Collections.ArrayList] + [Parameter( + ParameterSetName = 'ByObjects', + ValueFromPipeline = $false, + Mandatory = $true, + Position = 0)] + [ValidateNotNullOrEmpty()] + $Objects, + + #### ------------------------- Common method parameters ----------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'ByObjects', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $Title, + + [Switch] + [Parameter( + ParameterSetName = 'ByObjects', + Mandatory = $false)] + $DisplayAvgLatency, + + [Switch] + [Parameter( + ParameterSetName = 'ByObjects', + Mandatory = $false)] + $DisplayMaxLatency + ) + + Begin + { + } + + Process + { + if ($PSEdition -ne "Desktop") + { + # + # Full PowerShell is required for charting + # + $errorObject = CreateErrorRecord -ErrorId "NotSupported" ` + -ErrorMessage "This cmdlet requires full powershell support" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::NotEnabled) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + + # + # Global state initialization + # + + Add-Type -AssemblyName System.Windows.Forms + Add-Type -AssemblyName System.Windows.Forms.DataVisualization + + $Global:StorageHistoryCharts.Host = $Host + + $subscriber = Get-EventSubscriber -SourceIdentifier "StorageHistoryChart.Close" ` + -ErrorAction SilentlyContinue + + if ($subscriber -eq $null) + { + Register-EngineEvent -SourceIdentifier "StorageHistoryChart.Close" ` + -Action $StorageHistoryChartClose | Out-Null + } + + # + # Display chart based on the data passed + # + + $type = [String]::Empty + $storageHistory = New-Object System.Collections.ArrayList + + ForEach ($object in $Objects) + { + if ([String]::IsNullOrEmpty($type)) + { + $type = $object.PSObject.TypeNames[0] + } + + if ($object.PSObject.TypeNames[0] -eq $type) + { + [void]$storageHistory.Add($object) + } + } + + $chartId = [System.Guid]::newguid().ToString() + + $runspace = [RunspaceFactory]::CreateRunspace() + $runspace.ApartmentState = "STA" + $runspace.ThreadOptions = "ReuseThread" + $runspace.Open() + $runspace.SessionStateProxy.SetVariable("StorageHistoryCharts",$Global:StorageHistoryCharts) + + $Global:StorageHistoryCharts.Add($chartId, $runspace) + + $powershell = [PowerShell]::Create() + + $showDefault = $true + $showAvgLatency = $false + $showMaxLatency = $false + + if ($PSBoundParameters.ContainsKey("DisplayAvgLatency")) + { + $showDefault = $false + $showAvgLatency = $true + } + + if ($PSBoundParameters.ContainsKey("DisplayMaxLatency")) + { + $showDefault = $false + $showMaxLatency = $true + } + + if ($type -eq "Microsoft.Windows.StorageManagement.StorageHistory") + { + [void]$powershell.AddScript($DisplayTimeSeriesChart) + } + elseif ($type -eq "Microsoft.Windows.StorageManagement.StorageHistoryAggregate") + { + [void]$powershell.AddScript($DisplaySummaryChart) + } + else + { + return + } + + [void]$powershell.AddArgument($chartId) + [void]$powershell.AddArgument($Title) + [void]$powershell.AddArgument($storageHistory) + [void]$powershell.AddArgument($showDefault) + [void]$powershell.AddArgument($showAvgLatency) + [void]$powershell.AddArgument($showMaxLatency) + + $powershell.Runspace = $runspace + + [void]$powershell.BeginInvoke() + } +} + + +function Get-PhysicalDisk +{ + [CmdletBinding( DefaultParameterSetName = "ByUniqueId" )] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'ByUniqueId', + ValueFromPipeline = $true, + ValueFromPipelineByPropertyName = $true, + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + [Alias("Id")] + $UniqueId, + + [System.String] + [Parameter( + ParameterSetName = 'ByObjectId', + ValueFromPipeline = $true, + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + [Alias("PhysicalDiskObjectId")] + $ObjectId, + + [System.String] + [Parameter( + ParameterSetName = 'ByDeviceNumber', + ValueFromPipeline = $false, + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $DeviceNumber, + + [System.String] + [Parameter( + ParameterSetName = 'ByName', + ValueFromPipeline = $true, + Mandatory = $false, + Position = 0)] + [ValidateNotNullOrEmpty()] + $FriendlyName, + + [System.String] + [Parameter( + ParameterSetName = 'ByName', + ValueFromPipeline = $true, + Mandatory = $false, + Position = 1)] + [ValidateNotNullOrEmpty()] + $SerialNumber, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] + [Parameter( + ParameterSetName = 'ByInputObject', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $InputObject, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubsystem")] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageSubsystem, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageEnclosure")] + [Parameter( + ParameterSetName = 'ByStorageEnclosure', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageEnclosure, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageScaleUnit")] + [Parameter( + ParameterSetName = 'ByStorageScaleUnit', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageScaleUnit, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageChassis")] + [Parameter( + ParameterSetName = 'ByStorageChassis', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageChassis, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageRack")] + [Parameter( + ParameterSetName = 'ByStorageRack', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageRack, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSite")] + [Parameter( + ParameterSetName = 'ByStorageSite', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageSite, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageNode")] + [Parameter( + ParameterSetName = 'ByStorageNode', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageNode, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StoragePool")] + [Parameter( + ParameterSetName = 'ByStoragePool', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StoragePool, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_VirtualDisk")] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $VirtualDisk, + + #### ------------------ VirtualDisk association parameters -------------------#### + + [System.UInt64] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + Mandatory = $false)] + $VirtualRangeMin, + + [System.UInt64] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + Mandatory = $false)] + $VirtualRangeMax, + + [System.Boolean] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + Mandatory = $false)] + $HasAllocations, + + [System.Boolean] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + Mandatory = $false)] + $SelectedForUse, + + [Switch] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + Mandatory = $false)] + $NoRedundancy, + + #### --------- StoragePool and VirtualDisk association parameters ------------#### + + [Switch] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + Mandatory = $false)] + $HasMetadata, + + #### ------------------ StorageNode association parameters -------------------#### + + [Switch] + [Parameter( + ParameterSetName = 'ByStorageNode', + Mandatory = $false)] + $PhysicallyConnected, + + #### ------------------------- Common parameters -----------------------------#### + + [PhysicalDiskUsage] + [Parameter( + ParameterSetName = 'ByUniqueId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByObjectId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDeviceNumber', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageEnclosure', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageScaleUnit', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageChassis', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageRack', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSite', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageNode', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + Mandatory = $false)] + $Usage, + + [System.String] + [Parameter( + ParameterSetName = 'ByUniqueId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByObjectId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDeviceNumber', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageEnclosure', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageScaleUnit', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageChassis', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageRack', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSite', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageNode', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $Description, + + [System.String] + [Parameter( + ParameterSetName = 'ByUniqueId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByObjectId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDeviceNumber', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageEnclosure', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageScaleUnit', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageChassis', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageRack', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSite', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageNode', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $Manufacturer, + + [System.String] + [Parameter( + ParameterSetName = 'ByUniqueId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByObjectId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDeviceNumber', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageEnclosure', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageScaleUnit', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageChassis', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageRack', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSite', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageNode', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $Model, + + [System.Boolean] + [Parameter( + ParameterSetName = 'ByUniqueId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByObjectId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDeviceNumber', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageEnclosure', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageScaleUnit', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageChassis', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageRack', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSite', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageNode', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + Mandatory = $false)] + $CanPool, + + [PhysicalDiskHealthStatus] + [Parameter( + ParameterSetName = 'ByUniqueId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByObjectId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDeviceNumber', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageEnclosure', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageScaleUnit', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageChassis', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageRack', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSite', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageNode', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + Mandatory = $false)] + $HealthStatus, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession + ) + + Begin + { + [flagsattribute()] + Enum PhysicalDiskUsage + { + Unknown = 0 + AutoSelect = 1 + ManualSelect = 2 + HotSpare = 3 + Retired = 4 + Journal = 5 + } + + [flagsattribute()] + Enum PhysicalDiskHealthStatus + { + Healthy = 0 + Warning = 1 + Unhealthy = 2 + Unknown = 5 + } + } + + Process + { + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + ## Gather the instance objects. + + $options = New-Object Microsoft.Management.Infrastructure.Options.CimOperationOptions + + switch -regex ($psCmdlet.ParameterSetName) + { + { @( ` + "ByInputObject" ` + ) -contains $_ ` + } + { + $cimInstance = New-Object Microsoft.Management.Infrastructure.CimInstance("MSFT_PhysicalDisk") + + $cimInstance.CimInstanceProperties.Add([Microsoft.Management.Infrastructure.CimProperty]::Create("ObjectId", $InputObject.ObjectId, "String", "Key")) + + $instance = $CimSession.GetInstance($StorageNamespace, + $cimInstance); + break; + } + + { @( ` + "ByObjectId", ` + "ByUniqueId", ` + "ByDeviceNumber", ` + "ByName" ` + ) -contains $_ ` + } + { + $results = $CimSession.EnumerateInstances($StorageNamespace, + "MSFT_PhysicalDisk"); + break; + } + + { @( ` + "ByStorageSubsystem", ` + "ByStoragePool", ` + "ByStorageEnclosure", ` + "ByStorageNode", ` + "ByVirtualDisk" ` + ) -contains $_ ` + } + { + if ($PSBoundParameters.ContainsKey("StorageSubsystem")) + { + $subsystem = $StorageSubsystem + } + elseif ($PSBoundParameters.ContainsKey("StoragePool")) + { + $subsystem = $StoragePool | get-storagesubsystem -CimSession $CimSession + } + elseif ($PSBoundParameters.ContainsKey("StorageEnclosure")) + { + $subsystem = $StorageEnclosure | get-storagesubsystem -CimSession $CimSession + } + elseif ($PSBoundParameters.ContainsKey("StorageNode")) + { + $subsystem = $StorageNode | get-storagesubsystem -CimSession $CimSession + } + elseif ($PSBoundParameters.ContainsKey("VirtualDisk")) + { + $subsystem = $VirtualDisk | get-storagesubsystem -CimSession $CimSession + } + + # If the subsystem model is "Windows Storage", + # perform associations using enumeration + + if ($PSBoundParameters.ContainsKey("StorageSubsystem")) + { + $options.SetCustomOption("InputClassName", "MSFT_StorageSubsystem", $false) + $options.SetCustomOption("InputObjectId", $StorageSubsystem.ObjectId, $false) + + if ($subsystem.Model -like "*Windows Storage*") + { + $results = $CimSession.EnumerateInstances($StorageNamespace, + "MSFT_PhysicalDisk", + $options) + } + else + { + $results = $CimSession.EnumerateAssociatedInstances($StorageNamespace, + $StorageSubsystem, + "MSFT_StorageSubsystemToPhysicalDisk", + "MSFT_PhysicalDisk", + "StorageSubsystem", + "PhysicalDisk", + $options) + } + } + elseif ($PSBoundParameters.ContainsKey("StoragePool")) + { + $options.SetCustomOption("InputClassName", "MSFT_StoragePool", $false) + $options.SetCustomOption("InputObjectId", $StoragePool.ObjectId, $false) + + if ($PSBoundParameters.ContainsKey("HasMetadata")) + { + $options.SetCustomOption("HasMetadata", $HasMetadata, $false) + } + + if ($subsystem.Model -like "*Windows Storage*") + { + $results = $CimSession.EnumerateInstances($StorageNamespace, + "MSFT_PhysicalDisk", + $options) + } + else + { + $results = $CimSession.EnumerateAssociatedInstances($StorageNamespace, + $StoragePool, + "MSFT_StoragePoolToPhysicalDisk", + "MSFT_PhysicalDisk", + "StoragePool", + "PhysicalDisk", + $options) + } + } + elseif ($PSBoundParameters.ContainsKey("StorageEnclosure")) + { + $options.SetCustomOption("InputClassName", "MSFT_StorageEnclosure", $false) + $options.SetCustomOption("InputObjectId", $StorageEnclosure.ObjectId, $false) + + if ($subsystem.Model -like "*Windows Storage*") + { + $results = $CimSession.EnumerateInstances($StorageNamespace, + "MSFT_PhysicalDisk", + $options); + } + else + { + $results = $CimSession.EnumerateAssociatedInstances($StorageNamespace, + $StorageEnclosure, + "MSFT_StorageEnclosureToPhysicalDisk", + "MSFT_PhysicalDisk", + "StorageEnclosure", + "PhysicalDisk", + $options); + } + } + elseif ($PSBoundParameters.ContainsKey("StorageNode")) + { + $options.SetCustomOption("InputClassName", "MSFT_StorageNode", $false) + $options.SetCustomOption("InputObjectId", $StorageNode.ObjectId, $false) + + if ($PSBoundParameters.ContainsKey("PhysicallyConnected")) + { + $options.SetCustomOption("PhysicallyConnected", $true, $false) + } + + if ($subsystem.Model -like "*Windows Storage*") + { + $results = $CimSession.EnumerateInstances($StorageNamespace, + "MSFT_PhysicalDisk", + $options); + } + else + { + $results = $CimSession.EnumerateAssociatedInstances($StorageNamespace, + $StorageNode, + "MSFT_StorageNodeToPhysicalDisk", + "MSFT_PhysicalDisk", + "StorageNode", + "PhysicalDisk", + $options); + } + } + elseif ($PSBoundParameters.ContainsKey("VirtualDisk")) + { + $options.SetCustomOption("InputClassName", "MSFT_VirtualDisk", $false) + $options.SetCustomOption("InputObjectId", $VirtualDisk.ObjectId, $false) + + if ($PSBoundParameters.ContainsKey("VirtualRangeMin")) + { + $options.SetCustomOption("VirtualRangeMin", $VirtualRangeMin, [Microsoft.Management.Infrastructure.CimType]::UInt64, $false) + } + + if ($PSBoundParameters.ContainsKey("VirtualRangeMax")) + { + $options.SetCustomOption("VirtualRangeMax", $VirtualRangeMax, [Microsoft.Management.Infrastructure.CimType]::UInt64, $false) + } + + if ($PSBoundParameters.ContainsKey("HasAllocations")) + { + $options.SetCustomOption("HasAllocations", $HasAllocations, $false) + } + + if ($PSBoundParameters.ContainsKey("SelectedForUse")) + { + $options.SetCustomOption("SelectedForUse", $SelectedForUse, $false) + } + + if ($PSBoundParameters.ContainsKey("HasMetadata")) + { + $options.SetCustomOption("HasMetadata", $HasMetadata, $false) + } + + if ($PSBoundParameters.ContainsKey("NoRedundancy")) + { + $options.SetCustomOption("NoRedundancy", $true, $false) + } + + if ($subsystem.Model -like "*Windows Storage*") + { + $results = $CimSession.EnumerateInstances($StorageNamespace, + "MSFT_PhysicalDisk", + $options); + } + else + { + $results = $CimSession.EnumerateAssociatedInstances($StorageNamespace, + $VirtualDisk, + "MSFT_VirtualDiskToPhysicalDisk", + "MSFT_PhysicalDisk", + "VirtualDisk", + "PhysicalDisk", + $options); + } + } + + break; + } + { @( ` + "ByStorageScaleUnit", ` + "ByStorageChassis", ` + "ByStorageRack", ` + "ByStorageSite" ` + ) -contains $_ ` + } + { + if ($PSBoundParameters.ContainsKey("StorageScaleUnit")) + { + $inputObject = $StorageScaleUnit + } + elseif ($PSBoundParameters.ContainsKey("StorageChassis")) + { + $inputObject = $StorageChassis + } + elseif ($PSBoundParameters.ContainsKey("StorageRack")) + { + $inputObject = $StorageRack + } + elseif ($PSBoundParameters.ContainsKey("StorageSite")) + { + $inputObject = $StorageSite + } + + # If the subsystem model is "Windows Storage", + # perform associations using enumeration + + $subsystem = $inputObject | get-storagesubsystem -CimSession $CimSession + + if ($subsystem.Model -like "*Windows Storage*") + { + $options.SetCustomOption("InputClassName", $inputObject.ClassName, $false) + $options.SetCustomOption("InputObjectId", $inputObject.ObjectId, $false) + + $results = $CimSession.EnumerateInstances($StorageNamespace, + "MSFT_PhysicalDisk", + $options); + } + else + { + $options.SetCustomOption("ResultObject", "MSFT_PhysicalDisk", $false) + + $results = $CimSession.EnumerateAssociatedInstances($StorageNamespace, + $inputObject, + "MSFT_StorageFaultDomainToStorageFaultDomain", + "MSFT_PhysicalDisk", + "SourceStorageFaultDomain", + "TargetStorageFaultDomain", + $options); + } + + break; + } + } + + $instances = @() + + if ($psCmdlet.ParameterSetName -eq "ByInputObject") + { + $instances += $instance + } + else + { + $enumerator = $results.GetEnumerator() + + while ($enumerator.MoveNext()) + { + $instance = $enumerator.Current + + ## Filter by optional input parameters + + if (($PSBoundParameters.ContainsKey("ObjectId")) -and + ($instance.ObjectId -notlike $ObjectId)) + { + continue + } + + if (($PSBoundParameters.ContainsKey("UniqueId")) -and + ($instance.UniqueId -notlike $UniqueId)) + { + continue + } + + if (($PSBoundParameters.ContainsKey("DeviceNumber")) -and + ($instance.DeviceId -ne $DeviceNumber)) + { + continue + } + + if (($PSBoundParameters.ContainsKey("FriendlyName")) -and + ($instance.FriendlyName -notlike $FriendlyName)) + { + continue + } + + if (($PSBoundParameters.ContainsKey("SerialNumber")) -and + ($instance.SerialNumber -notlike $SerialNumber)) + { + continue + } + + if ($PSBoundParameters.ContainsKey("Usage")) + { + $matchFound = $true + + switch -regex ($Usage) + { + { @( ` + "Unknown", ` + "Retired", ` + "Journal" ` + ) -contains $_ ` + } + { + if ( $instance.Usage -ne $Usage ) + { + $matchFound = $false + break + } + } + + { @( ` + "AutoSelect" ` + ) -contains $_ ` + } + { + if ( $instance.Usage -ne "Auto-Select" ) + { + $matchFound = $false + break + } + } + + { @( ` + "ManualSelect" ` + ) -contains $_ ` + } + { + if ( $instance.Usage -ne "Manual-Select" ) + { + $matchFound = $false + break + } + } + + { @( ` + "HotSpare" ` + ) -contains $_ ` + } + { + if ( $instance.Usage -ne "Hot Spare" ) + { + $matchFound = $false + break + } + } + } + + if ( $matchFound -eq $false ) + { + continue + } + } + + if (($PSBoundParameters.ContainsKey("Description")) -and + ($instance.Description -notlike $Description)) + { + continue + } + + if (($PSBoundParameters.ContainsKey("Manufacturer")) -and + ($instance.Manufacturer -ne $Manufacturer)) + { + continue + } + + if (($PSBoundParameters.ContainsKey("Model")) -and + ($instance.Model -ne $Model)) + { + continue + } + + if (($PSBoundParameters.ContainsKey("CanPool")) -and + ($instance.CanPool -ne $CanPool)) + { + continue + } + + if (($PSBoundParameters.ContainsKey("HealthStatus")) -and + ($instance.HealthStatus -ne $HealthStatus)) + { + continue + } + + $instances += $instance + } + } + + $instances + } +} + + +function Get-PhysicalExtent +{ + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_VirtualDisk")] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $VirtualDisk, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageTier")] + [Parameter( + ParameterSetName = 'ByStorageTier', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageTier, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $PhysicalDisk, + + #### -------------------- Powershell parameters ------------------------------#### + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession + ) + + Process + { + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + ## Gather the instance objects + + switch ($psCmdlet.ParameterSetName) + { + "ByVirtualDisk" { $inputObject = $VirtualDisk; break; } + "ByStorageTier" { $inputObject = $StorageTier; break; } + "ByPhysicalDisk" { $inputObject = $PhysicalDisk; break; } + } + + $instances = @() + + try + { + $output = Invoke-CimMethod -CimSession $CimSession -InputObject $inputObject -MethodName "GetPhysicalExtent" -ErrorAction Stop + $enumerator = $output.PhysicalExtents.GetEnumerator() + + while ($enumerator.MoveNext()) + { + $instance = $enumerator.Current + $instance.PSObject.TypeNames.Insert(0, "Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalExtent") + + $instances += $instance + } + } + catch + { + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + + $psCmdlet.WriteError($errorObject) + } + + $instances + } +} + + +function Get-PhysicalExtentAssociation +{ + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalExtent")] + [Parameter( + ParameterSetName = 'ByInputObject', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $InputObject, + + #### -------------------- Powershell parameters ------------------------------#### + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession + ) + + Process + { + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + $virtualDisk = Get-VirtualDisk -CimSession $CimSession -UniqueId $InputObject.VirtualDiskUniqueId -ErrorAction Stop + + if ($InputObject.StorageTierUniqueId -ne $null) + { + $storageTier = Get-StorageTier -CimSession $CimSession -UniqueId $InputObject.StorageTierUniqueId -ErrorAction Stop + } + + $physicalDisk = Get-PhysicalDisk -CimSession $CimSession -UniqueId $InputObject.PhysicalDiskUniqueId -ErrorAction Stop + + $associations = [pscustomobject]@{ + VirtualDisk = $virtualDisk; + StorageTier = $storageTier; + PhysicalDisk = $physicalDisk; + } + + $associations + } +} + + +function Enable-PhysicalDiskIdentification +{ + [CmdletBinding( DefaultParameterSetName = "ByName", ConfirmImpact="Low" )] + [Alias("Enable-PhysicalDiskIndication")] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'ByUniqueId', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("Id")] + $UniqueId, + + [System.String] + [Parameter( + ParameterSetName = 'ByName', + ValueFromPipeline = $true, + Mandatory = $true, + Position = 0)] + [ValidateNotNullOrEmpty()] + $FriendlyName, + + [Microsoft.Management.Infrastructure.CimInstance[]] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] + [Parameter( + ParameterSetName = 'ByInputObject', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $InputObject, + + #### ------------------------- Common method parameters ----------------------#### + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + # Provided for compatibility with CDXML cmdlets, not actually used. + [Int32] + $ThrottleLimit, + + [Switch] + $AsJob + ) + + Begin + { + $SourceCaller = "Microsoft.PowerShell" + } + + Process + { + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + if (-not $AsJob) + { + Write-Progress -Activity "Enable-PhysicalDiskIdentification" -PercentComplete 0 -CurrentOperation "Gathering objects" -Status "0/2" + } + + ## Gather the instance objects + + switch ($psCmdlet.ParameterSetName) + { + "ByInputObject" { $Instances = $InputObject; break; } + "ByUniqueId" { $Instances = Get-PhysicalDisk -UniqueId $UniqueId -CimSession $CimSession -ErrorAction Stop; break; } + "ByName" { $Instances = Get-PhysicalDisk -FriendlyName $FriendlyName -CimSession $CimSession -ErrorAction Stop; break; } + } + + # Would use a closure here, but jobs are run in their own session state. + $methodblock = { + param($session, $asjob, $instances) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession + } + + $arguments = @{ "EnableIndication" = $true } + $errorObject = $null + + if (-not $asjob) + { + Write-Progress -Activity "Enable-PhysicalDiskIdentification" -PercentComplete 30 -CurrentOperation "Executing method" -Status "1/2" + } + + ForEach ( $instance in $instances ) + { + try + { + $progressPreference = "silentlyContinue" + + $output = Invoke-CimMethod -CimSession $session -InputObject $instance -MethodName Maintenance -Arguments $arguments -ErrorAction Stop + + $progressPreference = "Continue" + } + catch + { + $progressPreference = "Continue" + + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + + $psCmdlet.WriteError($errorObject) + } + } + + if (-not $asjob) + { + Write-Progress -Activity "Enable-PhysicalDiskIdentification" -Completed -Status "2/2" + } + } + + if ($asjob) + { + $p = $true + + Start-Job -Name EnablePhysicalDiskIdentification -ScriptBlock $methodblock -ArgumentList @($CimSession, $p, $Instances) + } + else + { + &$methodblock $CimSession $p $Instances + } + } +} + + +function Disable-PhysicalDiskIdentification +{ + [CmdletBinding( DefaultParameterSetName = "ByName", ConfirmImpact="Low" )] + [Alias("Disable-PhysicalDiskIndication")] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'ByUniqueId', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("Id")] + $UniqueId, + + [System.String] + [Parameter( + ParameterSetName = 'ByName', + ValueFromPipeline = $true, + Mandatory = $true, + Position = 0)] + [ValidateNotNullOrEmpty()] + $FriendlyName, + + [Microsoft.Management.Infrastructure.CimInstance[]] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] + [Parameter( + ParameterSetName = 'ByInputObject', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $InputObject, + + #### ------------------------- Common method parameters ----------------------#### + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + # Provided for compatibility with CDXML cmdlets, not actually used. + [Int32] + $ThrottleLimit, + + [Switch] + $AsJob + ) + + Begin + { + $SourceCaller = "Microsoft.PowerShell" + } + + Process + { + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + if (-not $AsJob) + { + Write-Progress -Activity "Disable-PhysicalDiskIdentification" -PercentComplete 0 -CurrentOperation "Gathering objects" -Status "0/2" + } + + ## Gather the instance objects + + switch ($psCmdlet.ParameterSetName) + { + "ByInputObject" { $Instances = $InputObject; break; } + "ByUniqueId" { $Instances = Get-PhysicalDisk -UniqueId $UniqueId -CimSession $CimSession -ErrorAction Stop; break; } + "ByName" { $Instances = Get-PhysicalDisk -FriendlyName $FriendlyName -CimSession $CimSession -ErrorAction Stop; break; } + } + + # Would use a closure here, but jobs are run in their own session state. + $methodblock = { + param($session, $asjob, $instances) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession + } + + $arguments = @{ "EnableIndication" = $false } + $errorObject = $null + + if (-not $asjob) + { + Write-Progress -Activity "Disable-PhysicalDiskIdentification" -PercentComplete 30 -CurrentOperation "Executing method" -Status "1/2" + } + + ForEach ( $instance in $instances ) + { + try + { + $progressPreference = "silentlyContinue" + + $output = Invoke-CimMethod -CimSession $session -InputObject $instance -MethodName Maintenance -Arguments $arguments -ErrorAction Stop + + $progressPreference = "Continue" + } + catch + { + $progressPreference = "Continue" + + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + + $psCmdlet.WriteError($errorObject) + } + } + + if (-not $asjob) + { + Write-Progress -Activity "Disable-PhysicalDiskIdentification" -Completed -Status "2/2" + } + } + + if ($asjob) + { + $p = $true + + Start-Job -Name DisablePhysicalDiskIdentification -ScriptBlock $methodblock -ArgumentList @($CimSession, $p, $Instances) + } + else + { + &$methodblock $CimSession $p $Instances + } + } +} + + +function Reset-PhysicalDisk +{ + [CmdletBinding( DefaultParameterSetName = "ByName", ConfirmImpact="Medium" )] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'ByUniqueId', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("Id")] + $UniqueId, + + [System.String] + [Parameter( + ParameterSetName = 'ByName', + ValueFromPipeline = $true, + Mandatory = $true, + Position = 0)] + [ValidateNotNullOrEmpty()] + $FriendlyName, + + [Microsoft.Management.Infrastructure.CimInstance[]] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] + [Parameter( + ParameterSetName = 'ByInputObject', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $InputObject, + + #### ------------------------- Common method parameters ----------------------#### + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + # Provided for compatibility with CDXML cmdlets, not actually used. + [Int32] + $ThrottleLimit, + + [Switch] + $AsJob + ) + + Begin + { + $SourceCaller = "Microsoft.PowerShell" + } + + Process + { + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + if (-not $AsJob) + { + Write-Progress -Activity "Reset-PhysicalDisk" -PercentComplete 0 -CurrentOperation "Gathering objects" -Status "0/2" + } + + ## Gather the instance objects + + switch ($psCmdlet.ParameterSetName) + { + "ByInputObject" { $Instances = $InputObject; break; } + "ByUniqueId" { $Instances = Get-PhysicalDisk -UniqueId $UniqueId -CimSession $CimSession -ErrorAction Stop; break; } + "ByName" { $Instances = Get-PhysicalDisk -FriendlyName $FriendlyName -CimSession $CimSession -ErrorAction Stop; break; } + } + + # Would use a closure here, but jobs are run in their own session state. + $methodblock = { + param($session, $asjob, $instances) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession + } + + $errorObject = $null + + if (-not $asjob) + { + Write-Progress -Activity "Reset-PhysicalDisk" -PercentComplete 30 -CurrentOperation "Executing method" -Status "1/2" + } + + ForEach ( $instance in $instances ) + { + try + { + $progressPreference = "silentlyContinue" + + $output = Invoke-CimMethod -CimSession $session -InputObject $instance -MethodName Reset -ErrorAction Stop + + $progressPreference = "Continue" + } + catch + { + $progressPreference = "Continue" + + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + + $psCmdlet.WriteError($errorObject) + } + } + + if (-not $asjob) + { + Write-Progress -Activity "Reset-PhysicalDisk" -Completed -Status "2/2" + } + } + + if ($asjob) + { + $p = $true + + Start-Job -Name ResetPhysicalDisk -ScriptBlock $methodblock -ArgumentList @($CimSession, $p, $Instances) + } + else + { + &$methodblock $CimSession $p $Instances + } + } +} + + +function Get-StorageFirmwareInformation +{ + [CmdletBinding( DefaultParameterSetName = "ByPhysicalDiskFriendlyName", ConfirmImpact="None" )] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'ByPhysicalDiskUniqueId', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("Id")] + [Alias("PhysicalDiskUniqueId")] + $UniqueId, + + [System.String] + [Parameter( + ParameterSetName = 'ByPhysicalDiskFriendlyName', + ValueFromPipeline = $true, + Mandatory = $true, + Position = 0)] + [ValidateNotNullOrEmpty()] + [Alias("PhysicalDiskFriendlyName")] + $FriendlyName, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("PhysicalDisk")] + $InputObject, + + [System.String] + [Parameter( + ParameterSetName = 'ByStorageEnclosureUniqueId', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageEnclosureUniqueId, + + [System.String] + [Parameter( + ParameterSetName = 'ByStorageEnclosureFriendlyName', + Mandatory = $true, + Position = 0)] + [ValidateNotNullOrEmpty()] + $StorageEnclosureFriendlyName, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageEnclosure")] + [Parameter( + ParameterSetName = 'ByStorageEnclosure', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageEnclosure, + + #### ------------------------- Common method parameters ----------------------#### + + #### -------------------- Powershell parameters ------------------------------#### + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + # Provided for compatibility with CDXML cmdlets, not actually used. + [Int32] + $ThrottleLimit, + + [Switch] + $AsJob + ) + + Begin + { + $SourceCaller = "Microsoft.PowerShell" + } + + Process + { + $info = $resources.info + $p = $null + + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + ## Gather the instance object + + switch ($psCmdlet.ParameterSetName) + { + "ByPhysicalDisk" { $PhysicalDiskInstance = $InputObject; break; } + "ByPhysicalDiskUniqueId" { $PhysicalDiskInstance = Get-PhysicalDisk -UniqueId $UniqueId -CimSession $CimSession -ErrorAction Stop; break; } + "ByPhysicalDiskFriendlyName" { $PhysicalDiskInstance = Get-PhysicalDisk -FriendlyName $FriendlyName -CimSession $CimSession -ErrorAction Stop; break; } + + "ByStorageEnclosure" { $StorageEnclosureInstance = $StorageEnclosure; break; } + "ByStorageEnclosureUniqueId" { $StorageEnclosureInstance = Get-StorageEnclosure -UniqueId $StorageEnclosureUniqueId -CimSession $CimSession -ErrorAction Stop; break; } + "ByStorageEnclosureFriendlyName" { $StorageEnclosureInstance = Get-StorageEnclosure -FriendlyName $StorageEnclosureFriendlyName -CimSession $CimSession -ErrorAction Stop; break; } + } + + if (-not $AsJob) + { + Write-Progress -Activity "Get-StorageFirmwareInformation" -PercentComplete 0 -CurrentOperation "Validating parameters" -Status "0/2" + } + + # Would use a closure here, but jobs are run in their own session state. + $methodblock = { + param($session, $asjob, $inputobject) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession + } + + $errorObject = $null + + if (-not $asjob) + { + Write-Progress -Activity "Get-StorageFirmwareInformation" -PercentComplete 30 -CurrentOperation "Getting storage firmware information" -Status "1/2" + } + + try + { + $progressPreference = "silentlyContinue" + + $output = Invoke-CimMethod -CimSession $session -InputObject $inputobject -MethodName GetFirmwareInformation -ErrorAction Stop + + $progressPreference = "Continue" + + $firmwareInformation = [pscustomobject]@{ + Object = $inputobject; + SupportsUpdate = $output.SupportsUpdate; + NumberOfSlots = $output.NumberOfSlots; + ActiveSlotNumber = $output.ActiveSlotNumber; + SlotNumber = $output.SlotNumber; + IsSlotWritable = $output.IsSlotWritable; + FirmwareVersionInSlot = $output.FirmwareVersionInSlot; + } + + $psCmdlet.WriteObject($firmwareInformation); + } + catch + { + $progressPreference = "Continue" + + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + + $psCmdlet.WriteError($errorObject) + } + + if (-not $asjob) + { + Write-Progress -Activity "Get-StorageFirmwareInformation" -Completed -Status "2/2" + } + } + + if ($asjob) + { + $p = $true + + if ($PhysicalDiskInstance) + { + Start-Job -Name GetStorageFirmwareInformation -ScriptBlock $methodblock -ArgumentList @($CimSession, $p, $PhysicalDiskInstance) + } + elseif ($StorageEnclosureInstance) + { + Start-Job -Name GetStorageFirmwareInformation -ScriptBlock $methodblock -ArgumentList @($CimSession, $p, $StorageEnclosureInstance) + } + } + else + { + if ($PhysicalDiskInstance) + { + &$methodblock $CimSession $p $PhysicalDiskInstance + } + elseif ($StorageEnclosureInstance) + { + &$methodblock $CimSession $p $StorageEnclosureInstance + } + } + } +} + + +function Update-StorageFirmware +{ + [CmdletBinding( DefaultParameterSetName = "ByPhysicalDiskFriendlyName", ConfirmImpact="Medium" )] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'ByPhysicalDiskUniqueId', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("Id")] + [Alias("PhysicalDiskUniqueId")] + $UniqueId, + + [System.String] + [Parameter( + ParameterSetName = 'ByPhysicalDiskFriendlyName', + ValueFromPipeline = $true, + Mandatory = $true, + Position = 0)] + [ValidateNotNullOrEmpty()] + [Alias("PhysicalDiskFriendlyName")] + $FriendlyName, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("PhysicalDisk")] + $InputObject, + + [System.String] + [Parameter( + ParameterSetName = 'ByStorageEnclosureUniqueId', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageEnclosureUniqueId, + + [System.String] + [Parameter( + ParameterSetName = 'ByStorageEnclosureFriendlyName', + Mandatory = $true, + Position = 0)] + [ValidateNotNullOrEmpty()] + $StorageEnclosureFriendlyName, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageEnclosure")] + [Parameter( + ParameterSetName = 'ByStorageEnclosure', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageEnclosure, + + #### ------------------------- Common method parameters ----------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'ByPhysicalDiskUniqueId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByPhysicalDiskFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageEnclosureUniqueId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageEnclosureFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageEnclosure', + Mandatory = $false)] + $ImagePath, + + [System.UInt16] + [Parameter( + ParameterSetName = 'ByPhysicalDiskUniqueId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByPhysicalDiskFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageEnclosureUniqueId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageEnclosureFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageEnclosure', + Mandatory = $false)] + $SlotNumber, + + #### -------------------- Powershell parameters ------------------------------#### + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + # Provided for compatibility with CDXML cmdlets, not actually used. + [Int32] + $ThrottleLimit, + + [Switch] + $AsJob + ) + + Begin + { + $SourceCaller = "Microsoft.PowerShell" + } + + Process + { + $info = $resources.info + $p = $null + + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + ## Gather the instance object + + switch ($psCmdlet.ParameterSetName) + { + "ByPhysicalDisk" { $PhysicalDiskInstance = $InputObject; break; } + "ByPhysicalDiskUniqueId" { $PhysicalDiskInstance = Get-PhysicalDisk -UniqueId $UniqueId -CimSession $CimSession -ErrorAction Stop; break; } + "ByPhysicalDiskFriendlyName" { $PhysicalDiskInstance = Get-PhysicalDisk -FriendlyName $FriendlyName -CimSession $CimSession -ErrorAction Stop; break; } + + "ByStorageEnclosure" { $StorageEnclosureInstance = $StorageEnclosure; break; } + "ByStorageEnclosureUniqueId" { $StorageEnclosureInstance = Get-StorageEnclosure -UniqueId $StorageEnclosureUniqueId -CimSession $CimSession -ErrorAction Stop; break; } + "ByStorageEnclosureFriendlyName" { $StorageEnclosureInstance = Get-StorageEnclosure -FriendlyName $StorageEnclosureFriendlyName -CimSession $CimSession -ErrorAction Stop; break; } + } + + if (-not $AsJob) + { + Write-Progress -Activity "Update-StorageFirmware" -PercentComplete 0 -CurrentOperation "Validating parameters" -Status "0/2" + } + + ## Populate arguments list + + $arguments = @{} + + if ($PSBoundParameters.ContainsKey("ImagePath")) + { + $arguments.Add("ImagePath", $ImagePath) + } + + if ($PSBoundParameters.ContainsKey("SlotNumber")) + { + $arguments.Add("SlotNumber", $SlotNumber) + } + + # Would use a closure here, but jobs are run in their own session state. + $methodblock = { + param($session, $asjob, $inputobject, $arguments) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession + } + + $errorObject = $null + + if (-not $asjob) + { + Write-Progress -Activity "Update-StorageFirmware" -PercentComplete 30 -CurrentOperation "Updating storage firmware" -Status "1/2" + } + + try + { + $progressPreference = "silentlyContinue" + + $output = Invoke-CimMethod -CimSession $session -InputObject $inputobject -MethodName UpdateFirmware -Arguments $arguments -ErrorAction Stop + + $progressPreference = "Continue" + } + catch + { + $progressPreference = "Continue" + + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + + $psCmdlet.WriteError($errorObject) + } + + if (-not $asjob) + { + Write-Progress -Activity "Update-StorageFirmware" -Completed -Status "2/2" + } + } + + if ($asjob) + { + $p = $true + + if ($PhysicalDiskInstance) + { + Start-Job -Name UpdateStorageFirmware -ScriptBlock $methodblock -ArgumentList @($CimSession, $p, $PhysicalDiskInstance, $arguments) + } + elseif ($StorageEnclosureInstance) + { + Start-Job -Name UpdateStorageFirmware -ScriptBlock $methodblock -ArgumentList @($CimSession, $p, $StorageEnclosureInstance, $arguments) + } + } + else + { + if ($PhysicalDiskInstance) + { + &$methodblock $CimSession $p $PhysicalDiskInstance $arguments + } + elseif ($StorageEnclosureInstance) + { + &$methodblock $CimSession $p $StorageEnclosureInstance $arguments + } + } + } +} + + +function Get-PhysicalDiskStorageNodeView +{ + [CmdletBinding()] + Param + ( + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageNode")] + [Parameter( + ValueFromPipeline = $true)] + $StorageNode, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] + [Parameter( + ValueFromPipeline = $true)] + $PhysicalDisk, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession + ) + + Process + { + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + ## Gather the association objects + $options = New-Object Microsoft.Management.Infrastructure.Options.CimOperationOptions + + if ($PSBoundParameters.ContainsKey("StorageNode")) + { + $options.SetCustomOption("InputClassName", "MSFT_StorageNode", $false) + $options.SetCustomOption("InputObjectId", $StorageNode.ObjectId, $false) + } + elseif ($PSBoundParameters.ContainsKey("PhysicalDisk")) + { + $options.SetCustomOption("InputClassName", "MSFT_PhysicalDisk", $false) + $options.SetCustomOption("InputObjectId", $PhysicalDisk.ObjectId, $false) + } + + $results = $CimSession.EnumerateInstances($StorageNamespace, + "MSFT_StorageNodeToPhysicalDisk", + $options + ) + + $enumerator = $results.GetEnumerator() + $instances = @() + + while ($enumerator.MoveNext()) + { + $instance = $enumerator.Current + + if ($PSBoundParameters.ContainsKey("StorageNode")) + { + if ($instance.StorageNodeObjectId -ne $StorageNode.ObjectId) + { + continue + } + } + elseif ($PSBoundParameters.ContainsKey("PhysicalDisk")) + { + if ($instance.PhysicalDiskObjectId -ne $PhysicalDisk.ObjectId) + { + continue + } + } + + $instances += $instance + } + + $instances + } +} + + +function Get-DiskStorageNodeView +{ + [CmdletBinding()] + Param + ( + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageNode")] + [Parameter( + ValueFromPipeline = $true)] + $StorageNode, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Disk")] + [Parameter( + ValueFromPipeline = $true)] + $Disk, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession + ) + + Process + { + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + ## Gather the association objects + $options = New-Object Microsoft.Management.Infrastructure.Options.CimOperationOptions + + if ($PSBoundParameters.ContainsKey("StorageNode")) + { + $options.SetCustomOption("InputClassName", "MSFT_StorageNode", $false) + $options.SetCustomOption("InputObjectId", $StorageNode.ObjectId, $false) + } + elseif ($PSBoundParameters.ContainsKey("Disk")) + { + $options.SetCustomOption("InputClassName", "MSFT_Disk", $false) + $options.SetCustomOption("InputObjectId", $Disk.ObjectId, $false) + } + + $results = $CimSession.EnumerateInstances($StorageNamespace, + "MSFT_StorageNodeToDisk", + $options + ) + + $enumerator = $results.GetEnumerator() + $instances = @() + + while ($enumerator.MoveNext()) + { + $instance = $enumerator.Current + + if ($PSBoundParameters.ContainsKey("StorageNode")) + { + if ($instance.StorageNodeObjectId -ne $StorageNode.ObjectId) + { + continue + } + } + elseif ($PSBoundParameters.ContainsKey("Disk")) + { + if ($instance.DiskObjectId -ne $Disk.ObjectId) + { + continue + } + } + + $instances += $instance + } + + $instances + } +} + + +function Get-StorageEnclosureStorageNodeView +{ + [CmdletBinding()] + Param + ( + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageNode")] + [Parameter( + ValueFromPipeline = $true)] + $StorageNode, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageEnclosure")] + [Parameter( + ValueFromPipeline = $true)] + $StorageEnclosure, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession + ) + + Process + { + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + ## Gather the association objects + $options = New-Object Microsoft.Management.Infrastructure.Options.CimOperationOptions + + if ($PSBoundParameters.ContainsKey("StorageNode")) + { + $options.SetCustomOption("InputClassName", "MSFT_StorageNode", $false) + $options.SetCustomOption("InputObjectId", $StorageNode.ObjectId, $false) + } + elseif ($PSBoundParameters.ContainsKey("StorageEnclosure")) + { + $options.SetCustomOption("InputClassName", "MSFT_StorageEnclosure", $false) + $options.SetCustomOption("InputObjectId", $StorageEnclosure.ObjectId, $false) + } + + $results = $CimSession.EnumerateInstances($StorageNamespace, + "MSFT_StorageNodeToStorageEnclosure", + $options + ) + + $enumerator = $results.GetEnumerator() + $instances = @() + + while ($enumerator.MoveNext()) + { + $instance = $enumerator.Current + + if ($PSBoundParameters.ContainsKey("StorageNode")) + { + if ($instance.StorageNodeObjectId -ne $StorageNode.ObjectId) + { + continue + } + } + elseif ($PSBoundParameters.ContainsKey("StorageEnclosure")) + { + if ($instance.StorageEnclosureObjectId -ne $StorageEnclosure.ObjectId) + { + continue + } + } + + $instances += $instance + } + + $instances + } +} + + +function Get-StorageHealthAction +{ + [CmdletBinding()] + Param + ( + [string[]] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "ByUniqueId")] + $UniqueId, + + [CimInstance] + [Parameter( + Mandatory = $false, + ValueFromPipeline = $true, + ParameterSetName = "InputObject")] + $InputObject, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + # Provided for compatibility with CDXML cmdlets, not actually used. + [Int32] + $ThrottleLimit, + + [Switch] + $AsJob + ) + + Begin{} + + Process + { + $info = $resources.info + $p = $null + $methodName = "GetActions" + + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + if ($UniqueId) + { + # Would use a closure here, but jobs are run in their own session state. + $block = { + param($session, $asjob, $ns, $id) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession + } + + Get-CimInstance -CimSession $session -Query "Select * From MSFT_HealthAction Where UniqueId='$id'" -Namespace $ns + + } + + if ($asjob) + { + $p = $true + Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $StorageNamespace, $UniqueId) + } + else + { + if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) + { + &$block $CimSession $p $StorageNamespace $UniqueId + } + } + } + elseif ($InputObject.CimClass.CimClassName -eq "MSFT_HealthAction") + { + # Would use a closure here, but jobs are run in their own session state. + $block = { + param($session, $asjob, $io) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession + } + + $io | Get-CimInstance -CimSession $session + + } + + if ($asjob) + { + $p = $true + Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $InputObject) + } + else + { + if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) + { + &$block $CimSession $p $InputObject + } + } + } + elseif (-not $InputObject -or ( $InputObject.CimClass.CimClassName -eq "MSFT_StorageHealth" )) + { + $className = "MSFT_HealthAction" + $block = { + param($session, $ns, $asjob, $cn) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession + } + + Get-CimInstance -CimSession $session -Namespace $ns -ClassName $cn + } + + if ($asjob) + { + $p = $true + Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $StorageNamespace, $p, $className) + } + else + { + if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) + { + &$block $CimSession $StorageNamespace $p $className + } + } + } + else + { + # Would use a closure here, but jobs are run in their own session state. + $block = { + param($session, $ns, $asjob, $mn, $io) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession + } + + $r = Invoke-CimMethod -CimSession $session -InputObject $io -MethodName $mn -Confirm:$false + + for($i = 0; $i -lt $r.Count - 1; $i++) + { + $r[$i].ItemValue + } + } + + if ($asjob) + { + $p = $true + Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $StorageNamespace, $p, $methodName, $InputObject) + } + else + { + if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) + { + &$block $CimSession $StorageNamespace $p $methodName $InputObject + } + } + } + } +} + + +function Get-StorageFaultDomain +{ + [CmdletBinding( DefaultParameterSetName = "EnumerateFaultDomains" )] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubsystem")] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageSubsystem, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageFaultDomain, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_VirtualDisk")] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $VirtualDisk, + + #### ------------------------- Common parameters -----------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'EnumerateFaultDomains', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + Mandatory = $false)] + $FriendlyName, + + [System.String] + [Parameter( + ParameterSetName = 'EnumerateFaultDomains', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + Mandatory = $false)] + $SerialNumber, + + [StorageFaultDomainType] + [Parameter( + ParameterSetName = 'EnumerateFaultDomains', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + Mandatory = $false)] + $Type, + + [System.String] + [Parameter( + ParameterSetName = 'EnumerateFaultDomains', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $PhysicalLocation, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession + ) + + Begin + { + [flagsattribute()] + Enum StorageFaultDomainType + { + PhysicalDisk = 1 + StorageEnclosure = 2 + StorageScaleUnit = 3 + StorageChassis = 4 + StorageRack = 5 + StorageSite = 6 + } + + $className = "MSFT_StorageFaultDomain" + + switch ($Type) + { + PhysicalDisk { $className = "MSFT_PhysicalDisk" } + StorageEnclosure { $className = "MSFT_StorageEnclosure" } + StorageScaleUnit { $className = "MSFT_StorageScaleUnit" } + StorageChassis { $className = "MSFT_StorageChassis" } + StorageRack { $className = "MSFT_StorageRack" } + StorageSite { $className = "MSFT_StorageSite" } + } + } + + Process + { + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + ## Gather the instance objects. + + $options = New-Object Microsoft.Management.Infrastructure.Options.CimOperationOptions + + if ($PSBoundParameters.ContainsKey("Type")) + { + $options.SetCustomOption("ResultObject", $className, $false) + } + + switch ($psCmdlet.ParameterSetName) + { + "ByStorageSubsystem" + { + if (($className -eq "MSFT_PhysicalDisk") -and + ($StorageSubsystem.Model -like "*Windows Storage*")) + { + $options.SetCustomOption("InputClassName", "MSFT_StorageSubsystem", $false) + $options.SetCustomOption("InputObjectId", $StorageSubsystem.ObjectId, $false) + + $results = $CimSession.EnumerateInstances($StorageNamespace, + "MSFT_PhysicalDisk", + $options) + } + else + { + $results = $CimSession.EnumerateAssociatedInstances($StorageNamespace, + $StorageSubsystem, + "MSFT_StorageSubsystemToStorageFaultDomain", + $className, + "StorageSubSystem", + "StorageFaultDomain", + $options) + } + + break; + } + + "ByStorageFaultDomain" + { + $subsystem = $StorageFaultDomain | get-storagesubsystem -CimSession $CimSession + + if (($className -eq "MSFT_PhysicalDisk") -and + ($subsystem.Model -like "*Windows Storage*")) + { + $options.SetCustomOption("InputClassName", $StorageFaultDomain.ClassName, $false) + $options.SetCustomOption("InputObjectId", $StorageFaultDomain.ObjectId, $false) + + $results = $CimSession.EnumerateInstances($StorageNamespace, + "MSFT_PhysicalDisk", + $options) + } + else + { + $results = $CimSession.EnumerateAssociatedInstances($StorageNamespace, + $StorageFaultDomain, + "MSFT_StorageFaultDomainToStorageFaultDomain", + $className, + "SourceStorageFaultDomain", + "TargetStorageFaultDomain", + $options) + } + + break; + } + + "ByVirtualDisk" + { + $results = $CimSession.EnumerateAssociatedInstances($StorageNamespace, + $VirtualDisk, + "MSFT_VirtualDiskToStorageFaultDomain", + "MSFT_StorageFaultDomain", + "VirtualDisk", + "StorageFaultDomain") + } + + "EnumerateFaultDomains" + { + $results = $CimSession.EnumerateInstances($StorageNamespace, + $className) + break; + } + } + + $enumerator = $results.GetEnumerator() + $instances = @() + + while ($enumerator.MoveNext()) + { + $instance = $enumerator.Current + + if (($PSBoundParameters.ContainsKey("FriendlyName")) -and + ($instance.FriendlyName -notlike $FriendlyName)) + { + continue + } + + if (($PSBoundParameters.ContainsKey("SerialNumber")) -and + ($instance.SerialNumber -notlike $SerialNumber)) + { + continue + } + + ## Filter by physical location if required and ensure + ## the formatting selected is for MSFT_StorageFaultDomain + + if (($PSBoundParameters.ContainsKey("PhysicalLocation")) -and + ($instance.PhysicalLocation -notlike $PhysicalLocation)) + { + continue + } + + $typename = $instance.PSObject.TypeNames.GetEnumerator() + $index = 0; + + while ($typename.MoveNext()) + { + if ($typename.Current.Equals("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageObject", + [System.StringComparison]::OrdinalIgnoreCase) -eq $true) + { + break + } + + $index++ + } + + $instance.PSObject.TypeNames.Insert($index + 1, "Microsoft.Management.Infrastructure.CimInstance#MSFT_StorageFaultDomain") + $instances += $instance + } + + $instances + } +} + + +function Get-StorageScaleUnit +{ + [CmdletBinding( DefaultParameterSetName = "EnumerateFaultDomains" )] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubsystem")] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageSubsystem, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageFaultDomain, + + #### ------------------------- Common parameters -----------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'EnumerateFaultDomains', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + Mandatory = $false)] + $FriendlyName, + + [System.String] + [Parameter( + ParameterSetName = 'EnumerateFaultDomains', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + Mandatory = $false)] + $SerialNumber, + + [System.String] + [Parameter( + ParameterSetName = 'EnumerateFaultDomains', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $PhysicalLocation, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession + ) + + Begin + { + } + + Process + { + $arguments = @{} + + $arguments.Add("Type", 'StorageScaleUnit') + + if ($PSBoundParameters.ContainsKey("FriendlyName")) + { + $arguments.Add("FriendlyName", $FriendlyName) + } + + if ($PSBoundParameters.ContainsKey("SerialNumber")) + { + $arguments.Add("SerialNumber", $SerialNumber) + } + + if ($PSBoundParameters.ContainsKey("PhysicalLocation")) + { + $arguments.Add("PhysicalLocation", $PhysicalLocation) + } + + if ($PSBoundParameters.ContainsKey("StorageSubsystem")) + { + $arguments.Add("StorageSubsystem", $StorageSubsystem) + } + + if ($PSBoundParameters.ContainsKey("StorageFaultDomain")) + { + $arguments.Add("StorageFaultDomain", $StorageFaultDomain) + } + + if ($PSBoundParameters.ContainsKey("CimSession")) + { + $arguments.Add("CimSession", $CimSession) + } + + Get-StorageFaultDomain @arguments + } +} + + +function Get-StorageChassis +{ + [CmdletBinding( DefaultParameterSetName = "EnumerateFaultDomains" )] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubsystem")] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageSubsystem, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageFaultDomain, + + #### ------------------------- Common parameters -----------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'EnumerateFaultDomains', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + Mandatory = $false)] + $FriendlyName, + + [System.String] + [Parameter( + ParameterSetName = 'EnumerateFaultDomains', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + Mandatory = $false)] + $SerialNumber, + + [System.String] + [Parameter( + ParameterSetName = 'EnumerateFaultDomains', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $PhysicalLocation, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession + ) + + Begin + { + } + + Process + { + $arguments = @{} + + $arguments.Add("Type", 'StorageChassis') + + if ($PSBoundParameters.ContainsKey("FriendlyName")) + { + $arguments.Add("FriendlyName", $FriendlyName) + } + + if ($PSBoundParameters.ContainsKey("SerialNumber")) + { + $arguments.Add("SerialNumber", $SerialNumber) + } + + if ($PSBoundParameters.ContainsKey("PhysicalLocation")) + { + $arguments.Add("PhysicalLocation", $PhysicalLocation) + } + + if ($PSBoundParameters.ContainsKey("StorageSubsystem")) + { + $arguments.Add("StorageSubsystem", $StorageSubsystem) + } + + if ($PSBoundParameters.ContainsKey("StorageFaultDomain")) + { + $arguments.Add("StorageFaultDomain", $StorageFaultDomain) + } + + if ($PSBoundParameters.ContainsKey("CimSession")) + { + $arguments.Add("CimSession", $CimSession) + } + + Get-StorageFaultDomain @arguments + } +} + + +function Get-StorageRack +{ + [CmdletBinding( DefaultParameterSetName = "EnumerateFaultDomains" )] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubsystem")] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageSubsystem, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageFaultDomain, + + #### ------------------------- Common parameters -----------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'EnumerateFaultDomains', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + Mandatory = $false)] + $FriendlyName, + + [System.String] + [Parameter( + ParameterSetName = 'EnumerateFaultDomains', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + Mandatory = $false)] + $SerialNumber, + + [System.String] + [Parameter( + ParameterSetName = 'EnumerateFaultDomains', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $PhysicalLocation, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession + ) + + Begin + { + } + + Process + { + $arguments = @{} + + $arguments.Add("Type", 'StorageRack') + + if ($PSBoundParameters.ContainsKey("FriendlyName")) + { + $arguments.Add("FriendlyName", $FriendlyName) + } + + if ($PSBoundParameters.ContainsKey("SerialNumber")) + { + $arguments.Add("SerialNumber", $SerialNumber) + } + + if ($PSBoundParameters.ContainsKey("PhysicalLocation")) + { + $arguments.Add("PhysicalLocation", $PhysicalLocation) + } + + if ($PSBoundParameters.ContainsKey("StorageSubsystem")) + { + $arguments.Add("StorageSubsystem", $StorageSubsystem) + } + + if ($PSBoundParameters.ContainsKey("StorageFaultDomain")) + { + $arguments.Add("StorageFaultDomain", $StorageFaultDomain) + } + + if ($PSBoundParameters.ContainsKey("CimSession")) + { + $arguments.Add("CimSession", $CimSession) + } + + Get-StorageFaultDomain @arguments + } +} + + +function Get-StorageSite +{ + [CmdletBinding( DefaultParameterSetName = "EnumerateFaultDomains" )] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubsystem")] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageSubsystem, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageFaultDomain, + + #### ------------------------- Common parameters -----------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'EnumerateFaultDomains', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + Mandatory = $false)] + $FriendlyName, + + [System.String] + [Parameter( + ParameterSetName = 'EnumerateFaultDomains', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + Mandatory = $false)] + $SerialNumber, + + [System.String] + [Parameter( + ParameterSetName = 'EnumerateFaultDomains', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubsystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageFaultDomain', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $PhysicalLocation, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession + ) + + Begin + { + } + + Process + { + $arguments = @{} + + $arguments.Add("Type", 'StorageSite') + + if ($PSBoundParameters.ContainsKey("FriendlyName")) + { + $arguments.Add("FriendlyName", $FriendlyName) + } + + if ($PSBoundParameters.ContainsKey("SerialNumber")) + { + $arguments.Add("SerialNumber", $SerialNumber) + } + + if ($PSBoundParameters.ContainsKey("PhysicalLocation")) + { + $arguments.Add("PhysicalLocation", $PhysicalLocation) + } + + if ($PSBoundParameters.ContainsKey("StorageSubsystem")) + { + $arguments.Add("StorageSubsystem", $StorageSubsystem) + } + + if ($PSBoundParameters.ContainsKey("StorageFaultDomain")) + { + $arguments.Add("StorageFaultDomain", $StorageFaultDomain) + } + + if ($PSBoundParameters.ContainsKey("CimSession")) + { + $arguments.Add("CimSession", $CimSession) + } + + Get-StorageFaultDomain @arguments + } +} + + +function ValidateFaultDomainsExist +{ + Param + ( + [String[]] + $StorageFaultDomainFriendlyNames, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubsystem")] + $StorageSubsystem, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession + ) + + [Microsoft.Management.Infrastructure.CimInstance[]] $faultdomains = @() + + $subsystemFDs = Get-CimAssociatedInstance -InputObject $StorageSubsystem ` + -Association MSFT_StorageSubsystemToStorageFaultDomain ` + -ResultClassName MSFT_StorageFaultDomain ` + -CimSession $CimSession ` + -ErrorAction Stop + + for ($i = 0; $i -lt $StorageFaultDomainFriendlyNames.Count; $i++) + { + $found = $false + + foreach ($fd in $subsystemFDs) + { + if ($fd.FriendlyName -eq $StorageFaultDomainFriendlyNames[$i]) + { + $faultdomains += $fd + $found = $true + break + } + } + + if ($found -eq $false) + { + $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` + -ErrorMessage "Could not find storage fault domain with the friendly name '$($StorageFaultDomainFriendlyNames[$i])' in the storage subsystem" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + + $faultdomains = @() + break + } + } + + return $faultdomains +} + + +function Add-StorageFaultDomain +{ + [CmdletBinding()] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_VirtualDisk")] + [Parameter( + ParameterSetName = "ByVirtualDisk", + ValueFromPipeline = $true, + Mandatory = $true, + Position = 0)] + [ValidateNotNullOrEmpty()] + $VirtualDisk, + + [String] + [Parameter( + ParameterSetName = "ByVirtualDiskFriendlyName", + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $VirtualDiskFriendlyName, + + [String] + [Parameter( + ParameterSetName = "ByVirtualDiskName", + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $VirtualDiskName, + + [String] + [Parameter( + ParameterSetName = "ByVirtualDiskUniqueId", + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $VirtualDiskUniqueId, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageTier")] + [Parameter( + ParameterSetName = "ByStorageTier", + ValueFromPipeline = $true, + Mandatory = $true, + Position = 0)] + [ValidateNotNullOrEmpty()] + $StorageTier, + + [String] + [Parameter( + ParameterSetName = "ByStorageTierFriendlyName", + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageTierFriendlyName, + + [String] + [Parameter( + ParameterSetName = "ByStorageTierUniqueId", + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageTierUniqueId, + + #### -------------------- Common method parameters ---------------------------#### + + [Microsoft.Management.Infrastructure.CimInstance[]] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDiskFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDiskName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDiskUniqueId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageTier', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageTierFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageTierUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $StorageFaultDomains, + + [String[]] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDiskFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDiskName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDiskUniqueId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageTier', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageTierFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageTierUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $StorageFaultDomainFriendlyNames, + + #### -------------------- Powershell parameters ------------------------------#### + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + # Provided for compatibility with CDXML cmdlets, not actually used. + [Int32] + $ThrottleLimit, + + [Switch] + $AsJob + ) + + Begin + { + $SourceCaller = "Microsoft.PowerShell" + } + + Process + { + $info = $resources.info + $p = $null + + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + ## Gather the instance object + + switch ($psCmdlet.ParameterSetName) + { + "ByVirtualDisk" { $VirtualDiskInstance = $VirtualDisk; break; } + "ByVirtualDiskFriendlyName" { $VirtualDiskInstance = Get-VirtualDisk -FriendlyName $VirtualDiskFriendlyName -CimSession $CimSession -ErrorAction Stop; break; } + "ByVirtualDiskName" { $VirtualDiskInstance = Get-VirtualDisk -Name $VirtualDiskName -CimSession $CimSession -ErrorAction Stop; break; } + "ByVirtualDiskUniqueId" { $VirtualDiskInstance = Get-VirtualDisk -UniqueId $VirtualDiskUniqueId -CimSession $CimSession -ErrorAction Stop; break; } + + "ByStorageTier" { $StorageTierInstance = $StorageTier; break; } + "ByStorageTierFriendlyName" { $StorageTierInstance = Get-StorageTier -FriendlyName $StorageTierFriendlyName -CimSession $CimSession -ErrorAction Stop; break; } + "ByStorageTierUniqueId" { $StorageTierInstance = Get-StorageTier -UniqueId $StorageTierUniqueId -CimSession $CimSession -ErrorAction Stop; break; } + } + + if (-not $AsJob) + { + Write-Progress -Activity "Add-StorageFaultDomain" -PercentComplete 0 -CurrentOperation "Validating parameters" -Status "0/2" + } + + if ($VirtualDiskInstance) + { + $subsystem = $VirtualDiskInstance | get-storagesubsystem -CimSession $CimSession + } + elseif ($StorageTierInstance) + { + $subsystem = $StorageTierInstance | get-storagesubsystem -CimSession $CimSession + } + + ## Populate arguments list + + $arguments = @{} + + if ($PSBoundParameters.ContainsKey("StorageFaultDomains") -and + $PSBoundParameters.ContainsKey("StorageFaultDomainFriendlyNames")) + { + $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` + -ErrorMessage "Use either 'StorageFaultDomains' or 'StorageFaultDomainFriendlyNames' parameter" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + + if ($PSBoundParameters.ContainsKey("StorageFaultDomains")) + { + $arguments.Add("StorageFaultDomains", $StorageFaultDomains) + } + elseif ($PSBoundParameters.ContainsKey("StorageFaultDomainFriendlyNames")) + { + [Microsoft.Management.Infrastructure.CimInstance[]] $faultdomains = @() + + $faultdomains = ValidateFaultDomainsExist -StorageFaultDomainFriendlyNames $StorageFaultDomainFriendlyNames ` + -StorageSubsystem $subsystem ` + -CimSession $CimSession + + if ($faultdomains.Count -eq 0) + { + return + } + + $arguments.Add("StorageFaultDomains", $faultdomains) + } + + # Would use a closure here, but jobs are run in their own session state. + $addfdblock = { + param($session, $asjob, $inputobject, $arguments) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession + } + + $errorObject = $null + $output = $null + + try + { + if (-not $asjob) + { + Write-Progress -Activity "Add-StorageFaultDomain" -PercentComplete 10 -CurrentOperation "Adding storage fault domains" -Status "1/2" + } + + $progressPreference = "silentlyContinue" + + $output = Invoke-CimMethod -CimSession $session -InputObject $inputobject -MethodName AddStorageFaultDomain -Arguments $arguments -ErrorAction Stop + + $progressPreference = "Continue" + } + catch + { + $progressPreference = "Continue" + + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + } + finally + { + if (-not $asjob) + { + Write-Progress -Activity "Add-StorageFaultDomain" -Completed -Status "2/2" + } + } + + if ($errorObject) + { + $psCmdlet.WriteError($errorObject) + } + else + { + $null + } + } + + if ($asjob) + { + $p = $true + + if ($VirtualDiskInstance) + { + Start-Job -Name AddStorageFaultDomain -ScriptBlock $addfdblock -ArgumentList @($CimSession, $p, $VirtualDiskInstance, $arguments) + } + elseif ($StorageTierInstance) + { + Start-Job -Name AddStorageFaultDomain -ScriptBlock $addfdblock -ArgumentList @($CimSession, $p, $StorageTierInstance, $arguments) + } + } + else + { + if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) + { + if ($VirtualDiskInstance) + { + &$addfdblock $CimSession $p $VirtualDiskInstance $arguments + } + elseif ($StorageTierInstance) + { + &$addfdblock $CimSession $p $StorageTierInstance $arguments + } + } + } + } +} + + +function Remove-StorageFaultDomain +{ + [CmdletBinding()] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_VirtualDisk")] + [Parameter( + ParameterSetName = "ByVirtualDisk", + ValueFromPipeline = $true, + Mandatory = $true, + Position = 0)] + [ValidateNotNullOrEmpty()] + $VirtualDisk, + + [String] + [Parameter( + ParameterSetName = "ByVirtualDiskFriendlyName", + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $VirtualDiskFriendlyName, + + [String] + [Parameter( + ParameterSetName = "ByVirtualDiskName", + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $VirtualDiskName, + + [String] + [Parameter( + ParameterSetName = "ByVirtualDiskUniqueId", + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $VirtualDiskUniqueId, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageTier")] + [Parameter( + ParameterSetName = "ByStorageTier", + ValueFromPipeline = $true, + Mandatory = $true, + Position = 0)] + [ValidateNotNullOrEmpty()] + $StorageTier, + + [String] + [Parameter( + ParameterSetName = "ByStorageTierFriendlyName", + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageTierFriendlyName, + + [String] + [Parameter( + ParameterSetName = "ByStorageTierUniqueId", + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageTierUniqueId, + + #### -------------------- Common method parameters ---------------------------#### + + [Microsoft.Management.Infrastructure.CimInstance[]] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDiskFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDiskName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDiskUniqueId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageTier', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageTierFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageTierUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $StorageFaultDomains, + + [String[]] + [Parameter( + ParameterSetName = 'ByVirtualDisk', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDiskFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDiskName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByVirtualDiskUniqueId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageTier', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageTierFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageTierUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $StorageFaultDomainFriendlyNames, + + #### -------------------- Powershell parameters ------------------------------#### + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + # Provided for compatibility with CDXML cmdlets, not actually used. + [Int32] + $ThrottleLimit, + + [Switch] + $AsJob + ) + + Begin + { + $SourceCaller = "Microsoft.PowerShell" + } + + Process + { + $info = $resources.info + $p = $null + + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + ## Gather the instance object + + switch ($psCmdlet.ParameterSetName) + { + "ByVirtualDisk" { $VirtualDiskInstance = $VirtualDisk; break; } + "ByVirtualDiskFriendlyName" { $VirtualDiskInstance = Get-VirtualDisk -FriendlyName $VirtualDiskFriendlyName -CimSession $CimSession -ErrorAction Stop; break; } + "ByVirtualDiskName" { $VirtualDiskInstance = Get-VirtualDisk -Name $VirtualDiskName -CimSession $CimSession -ErrorAction Stop; break; } + "ByVirtualDiskUniqueId" { $VirtualDiskInstance = Get-VirtualDisk -UniqueId $VirtualDiskUniqueId -CimSession $CimSession -ErrorAction Stop; break; } + + "ByStorageTier" { $StorageTierInstance = $StorageTier; break; } + "ByStorageTierFriendlyName" { $StorageTierInstance = Get-StorageTier -FriendlyName $StorageTierFriendlyName -CimSession $CimSession -ErrorAction Stop; break; } + "ByStorageTierUniqueId" { $StorageTierInstance = Get-StorageTier -UniqueId $StorageTierUniqueId -CimSession $CimSession -ErrorAction Stop; break; } + } + + if (-not $AsJob) + { + Write-Progress -Activity "Remove-StorageFaultDomain" -PercentComplete 0 -CurrentOperation "Validating parameters" -Status "0/2" + } + + if ($VirtualDiskInstance) + { + $subsystem = $VirtualDiskInstance | get-storagesubsystem -CimSession $CimSession + } + elseif ($StorageTierInstance) + { + $subsystem = $StorageTierInstance | get-storagesubsystem -CimSession $CimSession + } + + ## Populate arguments list + + $arguments = @{} + + if ($PSBoundParameters.ContainsKey("StorageFaultDomains") -and + $PSBoundParameters.ContainsKey("StorageFaultDomainFriendlyNames")) + { + $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` + -ErrorMessage "Use either 'StorageFaultDomains' or 'StorageFaultDomainFriendlyNames' parameter" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + + if ($PSBoundParameters.ContainsKey("StorageFaultDomains")) + { + $arguments.Add("StorageFaultDomains", $StorageFaultDomains) + } + elseif ($PSBoundParameters.ContainsKey("StorageFaultDomainFriendlyNames")) + { + [Microsoft.Management.Infrastructure.CimInstance[]] $faultdomains = @() + + $faultdomains = ValidateFaultDomainsExist -StorageFaultDomainFriendlyNames $StorageFaultDomainFriendlyNames ` + -StorageSubsystem $subsystem ` + -CimSession $CimSession + + if ($faultdomains.Count -eq 0) + { + return + } + + $arguments.Add("StorageFaultDomains", $faultdomains) + } + + # Would use a closure here, but jobs are run in their own session state. + $removefdblock = { + param($session, $asjob, $inputobject, $arguments) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession + } + + $errorObject = $null + $output = $null + + try + { + if (-not $asjob) + { + Write-Progress -Activity "Remove-StorageFaultDomain" -PercentComplete 10 -CurrentOperation "Removing storage fault domains" -Status "1/2" + } + + $progressPreference = "silentlyContinue" + + $output = Invoke-CimMethod -CimSession $session -InputObject $inputobject -MethodName RemoveStorageFaultDomain -Arguments $arguments -ErrorAction Stop + + $progressPreference = "Continue" + } + catch + { + $progressPreference = "Continue" + + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + } + finally + { + if (-not $asjob) + { + Write-Progress -Activity "Remove-StorageFaultDomain" -Completed -Status "2/2" + } + } + + if ($errorObject) + { + $psCmdlet.WriteError($errorObject) + } + else + { + $null + } + } + + if ($asjob) + { + $p = $true + + if ($VirtualDiskInstance) + { + Start-Job -Name RemoveStorageFaultDomain -ScriptBlock $removefdblock -ArgumentList @($CimSession, $p, $VirtualDiskInstance, $arguments) + } + elseif ($StorageTierInstance) + { + Start-Job -Name RemoveStorageFaultDomain -ScriptBlock $removefdblock -ArgumentList @($CimSession, $p, $StorageTierInstance, $arguments) + } + } + else + { + if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) + { + if ($VirtualDiskInstance) + { + &$removefdblock $CimSession $p $VirtualDiskInstance $arguments + } + elseif ($StorageTierInstance) + { + &$removefdblock $CimSession $p $StorageTierInstance $arguments + } + } + } + } +} + + +function New-Volume +{ + [CmdletBinding( DefaultParameterSetName = "ByStoragePool" )] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StoragePool")] + [Parameter( + ParameterSetName = "ByStoragePool", + ValueFromPipeline = $true, + Mandatory = $false, + Position = 0)] + [ValidateNotNullOrEmpty()] + $StoragePool, + + [String] + [Parameter( + ParameterSetName = "ByStoragePoolFriendlyName", + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StoragePoolFriendlyName, + + [String] + [Parameter( + ParameterSetName = "ByStoragePoolName", + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StoragePoolName, + + [String] + [Parameter( + ParameterSetName = "ByStoragePoolUniqueId", + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StoragePoolUniqueId, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Disk")] + [Parameter( + ParameterSetName = "ByDisk", + ValueFromPipeline = $true, + Mandatory = $true, + Position = 0)] + [ValidateNotNullOrEmpty()] + $Disk, + + [UInt32] + [Parameter( + ParameterSetName = "ByDiskNumber", + Mandatory = $true, + Position = 0)] + [ValidateNotNullOrEmpty()] + $DiskNumber, + + [String] + [Parameter( + ParameterSetName = "ByDiskPath", + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $DiskPath, + + [String] + [Parameter( + ParameterSetName = "ByDiskUniqueId", + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $DiskUniqueId, + + #### -------------------- Common method parameters ---------------------------#### + + [String] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $true)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $true)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $true)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $true)] + [Parameter( + ParameterSetName = 'ByDisk', + Mandatory = $true)] + [Parameter( + ParameterSetName = 'ByDiskNumber', + Mandatory = $true)] + [Parameter( + ParameterSetName = 'ByDiskPath', + Mandatory = $true)] + [Parameter( + ParameterSetName = 'ByDiskUniqueId', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $FriendlyName, + + [FileSystemType] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDisk', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDiskNumber', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDiskPath', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDiskUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $FileSystem, + + [String] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDisk', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDiskNumber', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDiskPath', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDiskUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $AccessPath, + + [Char] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDisk', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDiskNumber', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDiskPath', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDiskUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $DriveLetter, + + [UInt32] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDisk', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDiskNumber', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDiskPath', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByDiskUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $AllocationUnitSize, + + #### -------------------- Storage pool parameters ----------------------------#### + + [UInt64] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $Size, + + [String] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $ResiliencySettingName, + + [ProvisioningType] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $ProvisioningType, + + [MediaType] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $MediaType, + + [UInt16] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + [Alias("FaultDomainRedundancy")] + $PhysicalDiskRedundancy, + + [UInt16] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $NumberOfDataCopies, + + [UInt16] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $NumberOfColumns, + + [UInt16] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $NumberOfGroups, + + [Microsoft.Management.Infrastructure.CimInstance[]] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $StorageFaultDomainsToUse, + + [String[]] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $StorageFaultDomainsToUseFriendlyNames, + + [Microsoft.Management.Infrastructure.CimInstance[]] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageTier")] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $StorageTiers, + + [String[]] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $StorageTierFriendlyNames, + + [UInt64[]] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $StorageTierSizes, + + [UInt64] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $WriteCacheSize, + + [UInt64] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $ReadCacheSize, + + [Switch] + [Parameter( + ParameterSetName = 'ByStoragePool', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStoragePoolUniqueId', + Mandatory = $false)] + $UseMaximumSize = $false, + + #### -------------------- Disk parameters ------------------------------------#### + + + #### -------------------- Powershell parameters ------------------------------#### + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + # Provided for compatibility with CDXML cmdlets, not actually used. + [Int32] + $ThrottleLimit, + + [Switch] + $AsJob + ) + + Begin + { + $SourceCaller = "Microsoft.PowerShell" + + [flagsattribute()] + Enum FileSystemType + { + NTFS = 14 + ReFS = 15 + CSVFS_NTFS = 32768 + CSVFS_ReFS = 32769 + } + + [flagsattribute()] + Enum ProvisioningType + { + Unknown = 0 + Thin = 1 + Fixed = 2 + } + + [flagsattribute()] + Enum MediaType + { + HDD = 3 + SSD = 4 + SCM = 5 + } + } + + Process + { + $info = $resources.info + $p = $null + + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + ## Gather the instance object + + switch ($psCmdlet.ParameterSetName) + { + "ByStoragePool" + { + if ($StoragePool -ne $null) + { + $PoolInstance = $StoragePool + } + else + { + # Also accept the existence of a single non-primordial pool as unambiguous + $PoolInstance = Get-StoragePool |? IsPrimordial -eq $false + if ($PoolInstance -eq $null -or $PoolInstance.Count -gt 1) + { + $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` + -ErrorMessage "Storage pool must be specified by one of the 'StoragePool' parameters" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + } + + break + } + "ByStoragePoolFriendlyName" { $PoolInstance = Get-StoragePool -FriendlyName $StoragePoolFriendlyName -CimSession $CimSession -ErrorAction Stop; break; } + "ByStoragePoolName" { $PoolInstance = Get-StoragePool -Name $StoragePoolName -CimSession $CimSession -ErrorAction Stop; break; } + "ByStoragePoolUniqueId" { $PoolInstance = Get-StoragePool -UniqueId $StoragePoolUniqueId -CimSession $CimSession -ErrorAction Stop; break; } + + "ByDisk" { $DiskInstance = $Disk; break; } + "ByDiskNumber" { $DiskInstance = Get-Disk -Number $DiskNumber -CimSession $CimSession -ErrorAction Stop; break; } + "ByDiskPath" { $DiskInstance = Get-Disk -Path $DiskPath -CimSession $CimSession -ErrorAction Stop; break; } + "ByDiskUniqueId" { $DiskInstance = Get-Disk -UniqueId $DiskUniqueId -CimSession $CimSession -ErrorAction Stop; break; } + } + + if (-not $AsJob) + { + if ($PoolInstance) + { + Write-Progress -Activity "New-Volume" -PercentComplete 0 -CurrentOperation "Validating parameters" -Status "0/3" + } + elseif ($DiskInstance) + { + Write-Progress -Activity "New-Volume" -PercentComplete 0 -CurrentOperation "Validating parameters" -Status "0/2" + } + } + + ## Populate arguments list + + $arguments = @{} + + if ($PSBoundParameters.ContainsKey("FriendlyName")) + { + $arguments.Add("FriendlyName", $FriendlyName) + } + + if ($PSBoundParameters.ContainsKey("FileSystem")) + { + $arguments.Add("FileSystem", [System.UInt16]$FileSystem) + } + + if ($PSBoundParameters.ContainsKey("AccessPath") -and + $PSBoundParameters.ContainsKey("DriveLetter")) + { + $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` + -ErrorMessage "Use either 'AccessPath' or 'DriveLetter' parameter" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + + if ($PSBoundParameters.ContainsKey("AccessPath")) + { + $arguments.Add("AccessPath", $AccessPath) + } + elseif ($PSBoundParameters.ContainsKey("DriveLetter")) + { + $arguments.Add("AccessPath", $DriveLetter + ":") + } + + if ($PSBoundParameters.ContainsKey("AllocationUnitSize")) + { + $arguments.Add("AllocationUnitSize", $AllocationUnitSize) + } + + if ($PoolInstance) + { + if ($PSBoundParameters.ContainsKey("Size")) + { + $arguments.Add("Size", $Size) + } + + if ($PSBoundParameters.ContainsKey("ResiliencySettingName")) + { + $arguments.Add("ResiliencySettingName", $ResiliencySettingName) + } + + if ($PSBoundParameters.ContainsKey("ProvisioningType")) + { + $arguments.Add("ProvisioningType", [System.UInt16]$ProvisioningType) + } + + if ($PSBoundParameters.ContainsKey("MediaType")) + { + $arguments.Add("MediaType", [System.UInt16]$MediaType) + } + + if ($PSBoundParameters.ContainsKey("PhysicalDiskRedundancy")) + { + $arguments.Add("PhysicalDiskRedundancy", $PhysicalDiskRedundancy) + } + + if ($PSBoundParameters.ContainsKey("NumberOfDataCopies")) + { + $arguments.Add("NumberOfDataCopies", $NumberOfDataCopies) + } + + if ($PSBoundParameters.ContainsKey("NumberOfColumns")) + { + $arguments.Add("NumberOfColumns", $NumberOfColumns) + } + + if ($PSBoundParameters.ContainsKey("NumberOfGroups")) + { + $arguments.Add("NumberOfGroups", $NumberOfGroups) + } + + if ($PSBoundParameters.ContainsKey("StorageFaultDomainsToUse") -and + $PSBoundParameters.ContainsKey("StorageFaultDomainsToUseFriendlyNames")) + { + $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` + -ErrorMessage "Use either 'StorageFaultDomainsToUse' or 'StorageFaultDomainsToUseFriendlyNames' parameter" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + + if ($PSBoundParameters.ContainsKey("StorageFaultDomainsToUse")) + { + $arguments.Add("StorageFaultDomainsToUse", $StorageFaultDomainsToUse) + } + elseif ($PSBoundParameters.ContainsKey("StorageFaultDomainsToUseFriendlyNames")) + { + [Microsoft.Management.Infrastructure.CimInstance[]] $faultdomains = @() + + $subsystem = $PoolInstance | get-storagesubsystem -CimSession $CimSession + + $faultdomains = ValidateFaultDomainsExist -StorageFaultDomainFriendlyNames $StorageFaultDomainsToUseFriendlyNames ` + -StorageSubsystem $subsystem ` + -CimSession $CimSession + + if ($faultdomains.Count -eq 0) + { + return + } + + $arguments.Add("StorageFaultDomainsToUse", $faultdomains) + } + + if ($PSBoundParameters.ContainsKey("StorageTiers") -and + $PSBoundParameters.ContainsKey("StorageTierFriendlyNames")) + { + $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` + -ErrorMessage "Use either 'StorageTiers' or 'StorageTierFriendlyNames' parameter" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + + if ($PSBoundParameters.ContainsKey("StorageTiers")) + { + $arguments.Add("StorageTiers", $StorageTiers) + } + elseif ($PSBoundParameters.ContainsKey("StorageTierFriendlyNames")) + { + [Microsoft.Management.Infrastructure.CimInstance[]] $tiers = @() + + $poolTiers = Get-CimAssociatedInstance -InputObject $PoolInstance ` + -Association MSFT_StoragePoolToStorageTier ` + -ResultClassName MSFT_StorageTier ` + -CimSession $CimSession ` + -ErrorAction Stop + + for ($i = 0; $i -lt $StorageTierFriendlyNames.Count; $i++) + { + $found = $false + + foreach ($tier in $poolTiers) + { + if ($tier.FriendlyName -eq $StorageTierFriendlyNames[$i]) + { + $tiers += $tier + $found = $true + break + } + } + + if ($found -eq $false) + { + $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` + -ErrorMessage "Could not find storage tier with the friendly name '$($StorageTierFriendlyNames[$i])' in the storage pool" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + } + + $arguments.Add("StorageTiers", $tiers) + } + + if ($PSBoundParameters.ContainsKey("StorageTierSizes")) + { + $arguments.Add("StorageTierSizes", $StorageTierSizes) + } + + if ($PSBoundParameters.ContainsKey("WriteCacheSize")) + { + $arguments.Add("WriteCacheSize", $WriteCacheSize) + } + + if ($PSBoundParameters.ContainsKey("ReadCacheSize")) + { + $arguments.Add("ReadCacheSize", $ReadCacheSize) + } + + if ($PSBoundParameters.ContainsKey("UseMaximumSize")) + { + $arguments.Add("UseMaximumSize", $UseMaximumSize.ToBool()) + } + } + + # Would use a closure here, but jobs are run in their own session state. + $poolblock = { + param($session, $asjob, $pool, $arguments) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession + } + + $errorObject = $null + $output = $null + $retry = 0 + $time = 1 + $virtualdisk = $null + $volume = $null + + $subsystem = $pool | get-storagesubsystem -CimSession $session + + # If the subsystem model is "Windows Storage", + # perform the individual steps + if ($subsystem.Model -like "*Windows Storage*") + { + $volCreateParams = @{} + + if ($arguments.ContainsKey("FriendlyName")) + { + $volCreateParams.Add("FriendlyName", $arguments["FriendlyName"]) + } + + if ($arguments.ContainsKey("FileSystem")) + { + $volCreateParams.Add("FileSystem", $arguments["FileSystem"]) + $arguments.Remove("FileSystem") + } + elseif ($subsystem.Model -eq "Clustered Windows Storage" -and + $subsystem.StorageConnectionType -eq "Local Storage" -and + $subsystem.SupportedFileSystems -contains [FilesystemType]::CSVFS_ReFS) + { + # If the subsystem is clustered local (storage spaces direct) and supports it, + # default to CSVFS + ReFS. + $volCreateParams.Add("FileSystem", [System.Uint16][FilesystemType]::CSVFS_ReFS) + } + + if ($arguments.ContainsKey("AccessPath")) + { + $volCreateParams.Add("AccessPath", $arguments["AccessPath"]) + $arguments.Remove("AccessPath") + } + + if ($arguments.ContainsKey("AllocationUnitSize")) + { + $volCreateParams.Add("AllocationUnitSize", $arguments["AllocationUnitSize"]) + $arguments.Remove("AllocationUnitSize") + } + + try + { + if (-not $asjob) + { + Write-Progress -Activity "New-Volume" -PercentComplete 10 -CurrentOperation "Creating virtual disk" -Status "1/3" + } + + $progressPreference = "silentlyContinue" + + $output = Invoke-CimMethod -CimSession $session -InputObject $pool -MethodName CreateVirtualDisk -Arguments $arguments -ErrorAction Stop + + $progressPreference = "Continue" + + $virtualdisk = $output.CreatedVirtualDisk + + do + { + $disk = $output.CreatedVirtualDisk | get-disk -CimSession $session + + if ($disk -or ($retry -ge 3)) + { + break + } + + Start-Sleep -Seconds $time + + $retry++ + $time = $time * 2 + } + while ($disk -eq $null) + + if ($disk -eq $null) + { + $errorObject = CreateErrorRecord -ErrorId "ObjectNotFound" ` + -ErrorMessage "The disk associated with the virtual disk created could not be found." ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + + if (-not $asjob) + { + Write-Progress -Activity "New-Volume" -PercentComplete 70 -CurrentOperation "Creating volume" -Status "2/3" + } + + $progressPreference = "silentlyContinue" + + $output = Invoke-CimMethod -CimSession $session -InputObject $disk -MethodName CreateVolume -Arguments $volCreateParams -ErrorAction Stop + + $progressPreference = "Continue" + + $volume = $output.CreatedVolume + } + catch + { + $progressPreference = "Continue" + + if (-not $asjob) + { + Write-Progress -Activity "New-Volume" -PercentComplete 90 -CurrentOperation "Error encountered. Checking if cleanup is required." -Status "2/3" + } + + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + + # If virtual disk was created and volume was formatted, but + # adding to cluster failed or the cluster resource did not + # come online after successful addition, do not revert. + + if (($virtualdisk) -and + ($_.FullyQualifiedErrorId -notmatch "46008") -and + ($_.FullyQualifiedErrorId -notmatch "46011")) + { + $progressPreference = "silentlyContinue" + + $virtualdisk | Remove-VirtualDisk -CimSession $session -Confirm:$false + + $progressPreference = "Continue" + } + } + finally + { + if (-not $asjob) + { + Write-Progress -Activity "New-Volume" -Completed -Status "3/3" + } + } + } + # Else fallback to the API on the storage pool + else + { + try + { + if (-not $asjob) + { + Write-Progress -Activity "New-Volume" -PercentComplete 10 -CurrentOperation "Creating volume" -Status "1/2" + } + + $progressPreference = "silentlyContinue" + + $output = Invoke-CimMethod -CimSession $session -InputObject $pool -MethodName CreateVolume -Arguments $arguments -ErrorAction Stop + + $progressPreference = "Continue" + + $volume = $output.CreatedVolume + } + catch + { + $progressPreference = "Continue" + + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + } + finally + { + if (-not $asjob) + { + Write-Progress -Activity "New-Volume" -Completed -Status "2/2" + } + } + } + + if ($errorObject) + { + $psCmdlet.WriteError($errorObject) + } + else + { + $volume + } + } + + # Would use a closure here, but jobs are run in their own session state. + $diskblock = { + param($session, $asjob, $disk, $arguments) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession + } + + $errorObject = $null + $output = $null + $volume = $null + + try + { + if (-not $asjob) + { + Write-Progress -Activity "New-Volume" -PercentComplete 10 -CurrentOperation "Creating volume" -Status "1/2" + } + + $progressPreference = "silentlyContinue" + + $output = Invoke-CimMethod -CimSession $session -InputObject $disk -MethodName CreateVolume -Arguments $arguments -ErrorAction Stop + + $progressPreference = "Continue" + + $volume = $output.CreatedVolume + } + catch + { + $progressPreference = "Continue" + + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + } + finally + { + if (-not $asjob) + { + Write-Progress -Activity "New-Volume" -Completed -Status "3/3" + } + } + + if ($errorObject) + { + $psCmdlet.WriteError($errorObject) + } + else + { + $volume + } + } + + if ($asjob) + { + $p = $true + + if ($PoolInstance) + { + Start-Job -Name CreateVolume -ScriptBlock $poolblock -ArgumentList @($CimSession, $p, $PoolInstance, $arguments) + } + elseif ($DiskInstance) + { + Start-Job -Name CreateVolume -ScriptBlock $diskblock -ArgumentList @($CimSession, $p, $DiskInstance, $arguments) + } + } + else + { + if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) + { + if ($PoolInstance) + { + &$poolblock $CimSession $p $PoolInstance $arguments + } + elseif ($DiskInstance) + { + &$diskblock $CimSession $p $DiskInstance $arguments + } + } + } + } +} + + +function Get-StorageExtendedStatus +{ + [CmdletBinding()] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageJob")] + [Parameter( + ParameterSetName = 'ByStorageJob', + Mandatory = $true, + ValueFromPipeline = $true)] + [ValidateNotNullOrEmpty()] + $StorageJob, + + #### -------------------- Powershell parameters ------------------------------#### + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession + ) + + Process + { + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + ## Gather the instance objects + + switch ($psCmdlet.ParameterSetName) + { + "ByStorageJob" { $inputObject = $StorageJob; break; } + } + + $extendedStatus = $null + + try + { + $output = Invoke-CimMethod -MethodName "GetExtendedStatus" -InputObject $inputObject -CimSession $CimSession -ErrorAction Stop + $extendedStatus = $output.ExtendedStatus + } + catch + { + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + + $psCmdlet.WriteError($errorObject) + } + + $extendedStatus + } +} + +function Get-StorageAdvancedProperty +{ + [CmdletBinding()] + Param + ( + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + Mandatory = $true, + ValueFromPipeline = $true)] + $PhysicalDisk + ) + + Process + { + if ( $PhysicalDisk ) { + + $isDeviceCacheEnabled = $null + $isPowerProtected = $null + + $deviceCacheOutput = Invoke-CimMethod -MethodName IsDeviceCacheEnabled -InputObject $PhysicalDisk -ErrorAction SilentlyContinue + $powerProtectedOutput = Invoke-CimMethod -MethodName IsPowerProtected -InputObject $PhysicalDisk -ErrorAction SilentlyContinue + + # DeviceCache error handling + if ( $deviceCacheOutput -and $deviceCacheOutput.ReturnValue -ne 0 ) { + + Write-Warning "Retrieving IsDeviceCacheEnabled failed with ErrorCode $( $deviceCacheOutput.ReturnValue )." + } + else { + $isDeviceCacheEnabled = $deviceCacheOutput.IsDeviceCacheEnabled + } + + # PowerProtected error handling + if ( $powerProtectedOutput -and $powerProtectedOutput.ReturnValue -ne 0 ) { + + Write-Warning "Retrieving IsPowerProtected failed with ErrorCode $( $powerProtectedOutput.ReturnValue )." + } + else { + $isPowerProtected = $powerProtectedOutput.IsPowerProtected + } + + $customDrive = [pscustomobject]@{ + PhysicalDisk = $PhysicalDisk; + IsPowerProtected = $isPowerProtected; + IsDeviceCacheEnabled = $isDeviceCacheEnabled; + } + + $customDrive.PSObject.TypeNames.Insert( 0, "Microsoft.Windows.StorageManagement.PhysicalDiskAdvancedProperties" ) + + $customDrive + } + } +} + +function Get-StorageHealthReport +{ + [CmdletBinding()] + Param + ( + [CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageObject")] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "InputObject")] + $InputObject, + + [Int32] + $Count = 1, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + # Provided for compatibility with CDXML cmdlets, not actually used. + [Int32] + $ThrottleLimit, + + [Switch] + $AsJob + ) + + Begin{ + Write-Warning "This cmdlet is deprecated and may not be available in the future. Use Get-ClusterPerformanceHistory instead." + } + + Process + { + $info = $resources.info + $p = $null + $methodName = "GetReport" + + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + if ($InputObject.CimClass.CimClassName -ne "MSFT_StoragesubSystem" -and + $InputObject.CimClass.CimClassName -ne "MSFT_StorageNode" -and + $InputObject.CimClass.CimClassName -ne "MSFT_Volume" -and + $InputObject.CimClass.CimClassName -ne "MSFT_FileShare") + { + $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` + -ErrorMessage "The input object must be a StorageSubSystem, StorageNode, Volume or FileShare" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + + if($InputObject.CimSystemProperties.ClassName.Equals("MSFT_FileShare")) + { + $InputObject = $InputObject | Get-Volume -CimSession $CimSession -ErrorAction Stop + } + + $storageSubSystem = $InputObject | Get-StorageSubSystem -CimSession $CimSession -ErrorAction Stop + + $StorageHealth = Get-CimAssociatedInstance -ResultClassName MSFT_StorageHealth -InputObject $storageSubSystem -CimSession $CimSession -ErrorAction Stop + + # Would use a closure here, but jobs are run in their own session state. + $block = { + param($session, $ns, $asjob, $mn, $sh, $io, $co) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession + } + + Invoke-CimMethod -CimSession $session -InputObject $sh -MethodName $mn -Arguments @{TargetObject=$io;Count=[uint32]$co} -Confirm:$false + } + + if ($asjob) + { + $p = $true + Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $StorageNamespace, $p, $methodName, $StorageHealth, $InputObject, $Count) + } + else + { + if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) + { + &$block $CimSession $StorageNamespace $p $methodName $StorageHealth $InputObject $Count + } + } + } +} + +function Get-StorageHealthSetting +{ + [CmdletBinding()] + Param + ( + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubSystem")] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "InputObject")] + $InputObject, + + [String] + $Name, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + # Provided for compatibility with CDXML cmdlets, not actually used. + [Int32] + $ThrottleLimit, + + [Switch] + $AsJob + ) + + Begin{} + + Process + { + $info = $resources.info + $p = $null + + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + $StorageHealth = $InputObject | Get-StorageHealth -CimSession $CimSession -ErrorAction Stop + + # Would use a closure here, but jobs are run in their own session state. + $block = { + param($session, $asjob, $sh, $na) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + # We need to load the module or it fails with CMDLET Not Found + import-module Storage\StorageHealth.cdxml + $session = $session | New-CimSession + } + + $sh | Get-StorageHealthSettingInternal -Name $na -CimSession $session + } + + if ($asjob) + { + $p = $true + Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $StorageHealth, $Name) + } + else + { + if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) + { + &$block $CimSession $p $StorageHealth $Name + } + } + } +} + +function Set-StorageHealthSetting +{ + [CmdletBinding()] + Param + ( + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubSystem")] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "InputObject")] + $InputObject, + + [String] + [Parameter( + Mandatory = $true)] + $Name, + + [String] + [Parameter( + Mandatory = $true)] + $Value, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + # Provided for compatibility with CDXML cmdlets, not actually used. + [Int32] + $ThrottleLimit, + + [Switch] + $AsJob + ) + + Begin{} + + Process + { + $info = $resources.info + $p = $null + + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + $StorageHealth = $InputObject | Get-StorageHealth -CimSession $CimSession -ErrorAction Stop + + # Would use a closure here, but jobs are run in their own session state. + $block = { + param($session, $asjob, $sh, $na, $va) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + # We need to load the module or it fails with CMDLET Not Found + import-module Storage\StorageHealth.cdxml + $session = $session | New-CimSession + } + + $sh | Set-StorageHealthSettingInternal -Name $na -Value $va -CimSession $session + } + + if ($asjob) + { + $p = $true + Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $StorageHealth, $Name, $Value) + } + else + { + if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) + { + &$block $CimSession $p $StorageHealth $Name $Value + } + } + } +} + +function Remove-StorageHealthSetting +{ + [CmdletBinding()] + Param + ( + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubSystem")] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "InputObject")] + $InputObject, + + [String] + [Parameter( + Mandatory = $true)] + $Name, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + # Provided for compatibility with CDXML cmdlets, not actually used. + [Int32] + $ThrottleLimit, + + [Switch] + $AsJob + ) + + Begin{} + + Process + { + $info = $resources.info + $p = $null + + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + $StorageHealth = $InputObject | Get-StorageHealth -CimSession $CimSession -ErrorAction Stop + + # Would use a closure here, but jobs are run in their own session state. + $block = { + param($session, $asjob, $sh, $na) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + import-module Storage\StorageHealth.cdxml + $session = $session | New-CimSession + } + + $sh | Remove-StorageHealthSettingInternal -Name $na -CimSession $session + } + + if ($asjob) + { + $p = $true + Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $StorageHealth, $Name) + } + else + { + if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) + { + &$block $CimSession $p $StorageHealth $Name + } + } + } +} + +function Debug-StorageSubSystem +{ + [CmdletBinding( DefaultParameterSetName="ByFriendlyName" )] + Param + ( + [string[]] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "ByFriendlyName", + Position = 0)] + $StorageSubSystemFriendlyName, + + [string[]] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "ByUniqueId")] + $StorageSubSystemUniqueId, + + [string[]] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "ByName")] + $StorageSubSystemName, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubSystem")] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "InputObject")] + $InputObject, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + # Provided for compatibility with CDXML cmdlets, not actually used. + [Int32] + $ThrottleLimit, + + [Switch] + $AsJob + ) + + Begin{ + Write-Warning "This cmdlet is deprecated and may not be available in the future. Use Get-HealthFault instead." + } + + Process + { + $info = $resources.info + $p = $null + + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + switch ($PsCmdlet.ParameterSetName) + { + "ByName" { $InputObject = Get-StorageSubSystem -Name $StorageSubSystemName -CimSession $CimSession; break; } + "ByUniqueId" { $InputObject = Get-StorageSubSystem -UniqueId $StorageSubSystemUniqueId -CimSession $CimSession; break; } + "ByFriendlyName" { $InputObject = Get-StorageSubSystem -FriendlyName $StorageSubSystemFriendlyName -CimSession $CimSession; break; } + } + + # Would use a closure here, but jobs are run in their own session state. + $block = { + param($session, $asjob, $io) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession + } + + $result = @() + $output = Invoke-CimMethod -MethodName Diagnose -InputObject $io -CimSession $session + foreach($i in $output){$result += $i.ItemValue} + $result | Sort-Object -Property PerceivedSeverity + } + + if ($asjob) + { + $p = $true + Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $InputObject) + } + else + { + if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) + { + &$block $CimSession $p $InputObject + } + } + } +} + +function Debug-FileShare +{ + [CmdletBinding( DefaultParameterSetName="ByName" )] + Param + ( + [string[]] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "ByName", + Position = 0 )] + $Name, + + [string[]] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "ByUniqueId")] + $UniqueId, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_FileShare")] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "InputObject")] + $InputObject, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + # Provided for compatibility with CDXML cmdlets, not actually used. + [Int32] + $ThrottleLimit, + + [Switch] + $AsJob + ) + + Begin{ + Write-Warning "This cmdlet is deprecated and may not be available in the future. Use Get-HealthFault instead." + } + + Process + { + $info = $resources.info + $p = $null + + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + switch ($PsCmdlet.ParameterSetName) + { + "ByName" { $InputObject = Get-FileShare -Name $Name -CimSession $CimSession -ErrorAction stop; break; } + "ByUniqueId" { $InputObject = Get-FileShare -UniqueId $UniqueId -CimSession $CimSession -ErrorAction stop; break; } + } + + # Would use a closure here, but jobs are run in their own session state. + $block = { + param($session, $asjob, $io) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession + } + + $result = @() + $output = Invoke-CimMethod -MethodName Diagnose -InputObject $io -CimSession $session + foreach($i in $output){$result += $i.ItemValue} + $result | Sort-Object -Property PerceivedSeverity + } + + if ($asjob) + { + $p = $true + Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $InputObject) + } + else + { + if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) + { + &$block $CimSession $p $InputObject + } + } + } +} + +function Debug-Volume +{ + [CmdletBinding( DefaultParameterSetName="ByDriveLetter" )] + Param + ( + [char[]] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "ByDriveLetter", + Position = 0)] + $DriveLetter, + + [string[]] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "ById")] + $ObjectId, + + [string[]] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "ByPaths")] + $Path, + + [string[]] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "ByLabel")] + [Alias("FriendlyName")] + $FileSystemLabel, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Volume")] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "InputObject")] + $InputObject, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + # Provided for compatibility with CDXML cmdlets, not actually used. + [Int32] + $ThrottleLimit, + + [Switch] + $AsJob + ) + + Begin{ + Write-Warning "This cmdlet is deprecated and may not be available in the future. Use Get-HealthFault instead." + } + + Process + { + $info = $resources.info + $p = $null + + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + switch ($PsCmdlet.ParameterSetName) + { + "ByDriveLetter" { $io = Get-Volume -CimSession $CimSession -DriveLetter $DriveLetter -ErrorAction stop; break;} + "ById" { $io = Get-Volume -CimSession $CimSession -ObjectId $ObjectId -ErrorAction stop; break; } + "ByPaths" { $io = Get-Volume -CimSession $CimSession -Path $Path -ErrorAction stop; break;} + "ByLabel" { $io = Get-Volume -CimSession $CimSession -FileSystemLabel $FileSystemLabel -ErrorAction stop; break;} + } + + # Would use a closure here, but jobs are run in their own session state. + $block = { + param($session, $asjob, $io) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession + } + + $result = @() + $output = Invoke-CimMethod -MethodName Diagnose -InputObject $io -CimSession $session + foreach($i in $output){$result += $i.ItemValue} + $result | Sort-Object -Property PerceivedSeverity + } + + if ($asjob) + { + $p = $true + Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $InputObject) + } + else + { + if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) + { + &$block $CimSession $p $InputObject + } + } + } +} + +function Enable-StorageMaintenanceMode +{ + [CmdletBinding()] + Param + ( + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "InputObject")] + $InputObject, + + [Switch] + $IgnoreDetachedVirtualDisks, + + [System.Nullable[Bool]] + $ValidateVirtualDisksHealthy, + + [String] + $Model, + + [String] + $Manufacturer, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + [System.Nullable[Bool]] + $ValidateMaintenanceMode, + + [Switch] + $AsJob + ) + + Begin + { + [flagsattribute()] + Enum ValidationFlags + { + None = 0 + VirtualDisksHealthy = 1 + } + } + + Process + { + $info = $resources.info + $p = $null + + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + if ($InputObject.CimClass.CimClassName -ne "MSFT_PhysicalDisk" -and + $InputObject.CimClass.CimClassName -ne "MSFT_StorageEnclosure" -and + $InputObject.CimClass.CimClassName -ne "MSFT_StorageScaleUnit") + { + $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` + -ErrorMessage "The input object must be a PhysicalDisk, StorageEnclosure or StorageScaleUnit" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + + $arguments = @{} + + $arguments.Add("EnableMaintenanceMode", $true) + $arguments.Add("IgnoreDetachedVirtualDisks", $IgnoreDetachedVirtualDisks.IsPresent) + if ($InputObject.CimClass.CimClassName -ne "MSFT_PhysicalDisk") + { + if ($PSBoundParameters.ContainsKey("Model")) + { + $arguments.Add("Model", $Model) + } + + if ($PSBoundParameters.ContainsKey("Manufacturer")) + { + $arguments.Add("Manufacturer", $Manufacturer) + } + } + + $includeValidationFlags = $false + if ($ValidateVirtualDisksHealthy -ne $null) + { + $includeValidationFlags = $true + if($ValidateVirtualDisksHealthy) + { + $validationFlags += [ValidationFlags]::VirtualDisksHealthy + } + else + { + $validationFlags += [ValidationFlags]::None + } + } + + if ($includeValidationFlags) + { + $arguments.Add("ValidationFlags", $validationFlags) + } + + if ($ValidateMaintenanceMode -ne $null) + { + $arguments.Add("ValidateMaintenanceMode", $ValidateMaintenanceMode) + } + + $storageSubSystem = $InputObject | Get-StorageSubSystem -CimSession $CimSession + + if ($storageSubSystem.Model -eq "Clustered Windows Storage") + { + $storageHealth = Get-CimAssociatedInstance -ResultClassName MSFT_StorageHealth -InputObject $storageSubSystem -CimSession $CimSession + + $arguments.Add("TargetObject", $InputObject) + } + else + { + if ($arguments["ValidationFlags"] -ne $null) + { + $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` + -ErrorMessage "The parameter 'ValidateVirtualDisksHealthy' is not supported in this subsystem. Invoke again without this parameter." ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + } + + # Would use a closure here, but jobs are run in their own session state. + $block = { + param($session, $asjob, $io, $arg, $ss, $sh) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession + } + + if ($ss.Model -eq "Clustered Windows Storage") + { + Invoke-CimMethod -MethodName "Maintenance" -Arguments $arg -InputObject $sh -CimSession $session | Out-Null + } + else + { + Invoke-CimMethod -MethodName "Maintenance" -Arguments $arg -InputObject $io -CimSession $session | Out-Null + } + } + + if ($asjob) + { + $p = $true + Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $InputObject, $arguments, $storageSubSystem, $storageHealth) + } + else + { + if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) + { + &$block $CimSession $p $InputObject $arguments $storageSubSystem $storageHealth + } + } + } +} + +function Disable-StorageMaintenanceMode +{ + [CmdletBinding()] + Param + ( + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageFaultDomain")] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "InputObject")] + $InputObject, + + [string] + $Model, + + [string] + $Manufacturer, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + [Switch] + $AsJob + ) + + Begin{} + + Process + { + $info = $resources.info + $p = $null + + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + if ($InputObject.CimClass.CimClassName -ne "MSFT_PhysicalDisk" -and + $InputObject.CimClass.CimClassName -ne "MSFT_StorageEnclosure" -and + $InputObject.CimClass.CimClassName -ne "MSFT_StorageScaleUnit") + { + $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` + -ErrorMessage "The input object must be a PhysicalDisk, StorageEnclosure or StorageScaleUnit" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + + $arguments = @{} + + $arguments.Add("EnableMaintenanceMode", $false) + + if($InputObject.CimClass.CimClassName -ne "MSFT_PhysicalDisk") + { + if ($PSBoundParameters.ContainsKey("Model")) + { + $arguments.Add("Model", $Model) + } + + if ($PSBoundParameters.ContainsKey("Manufacturer")) + { + $arguments.Add("Manufacturer", $Manufacturer) + } + } + + $storageSubSystem = $InputObject | Get-StorageSubSystem -CimSession $CimSession + + if ($storageSubSystem.Model -eq "Clustered Windows Storage") + { + $arguments.Add("TargetObject", $InputObject) + + $storageHealth = Get-CimAssociatedInstance -ResultClassName MSFT_StorageHealth -InputObject $storageSubSystem -CimSession $CimSession + } + + # Would use a closure here, but jobs are run in their own session state. + $block = { + param($session, $asjob, $io, $arg, $ss, $sh) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession + } + + if ($ss.Model -eq "Clustered Windows Storage") + { + Invoke-CimMethod -MethodName "Maintenance" -Arguments $arg -InputObject $sh -CimSession $session | Out-Null + } + else + { + Invoke-CimMethod -MethodName "Maintenance" -Arguments $arg -InputObject $io -CimSession $session | Out-Null + } + } + + if ($asjob) + { + $p = $true + Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $p, $InputObject, $arguments, $storageSubSystem, $storageHealth) + } + else + { + if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) + { + &$block $CimSession $p $InputObject $arguments $storageSubSystem $storageHealth + } + } + } +} + + +function Get-StorageDiagnosticInfo +{ + [CmdletBinding()] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageSubSystem")] + [Parameter( + ParameterSetName = "ByStorageSubSystem", + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $InputObject, + + [String] + [Parameter( + ParameterSetName = "ByStorageSubSystemFriendlyName", + Mandatory = $true, + Position = 0)] + [ValidateNotNullOrEmpty()] + $StorageSubSystemFriendlyName, + + [String] + [Parameter( + ParameterSetName = "ByStorageSubSystemName", + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $StorageSubSystemName, + + [String] + [Parameter( + ParameterSetName = "ByStorageSubSystemUniqueId", + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("StorageSubSystemId")] + $StorageSubSystemUniqueId, + + #### -------------------- Method parameters ----------------------------------#### + + [String] + [Parameter( + ParameterSetName = 'ByStorageSubSystem', + Mandatory = $true)] + [Parameter( + ParameterSetName = 'ByStorageSubSystemFriendlyName', + Mandatory = $true)] + [Parameter( + ParameterSetName = 'ByStorageSubSystemName', + Mandatory = $true)] + [Parameter( + ParameterSetName = 'ByStorageSubSystemUniqueId', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("Path")] + $DestinationPath, + + [UInt32] + [Parameter( + ParameterSetName = 'ByStorageSubSystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubSystemFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubSystemName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubSystemUniqueId', + Mandatory = $false)] + $TimeSpan, + + [String] + [Parameter( + ParameterSetName = 'ByStorageSubSystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubSystemFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubSystemName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubSystemUniqueId', + Mandatory = $false)] + $ActivityId, + + [System.Management.Automation.SwitchParameter] + [Parameter( + ParameterSetName = 'ByStorageSubSystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubSystemFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubSystemName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubSystemUniqueId', + Mandatory = $false)] + $ExcludeOperationalLog = $false, + + [System.Management.Automation.SwitchParameter] + [Parameter( + ParameterSetName = 'ByStorageSubSystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubSystemFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubSystemName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubSystemUniqueId', + Mandatory = $false)] + $ExcludeDiagnosticLog = $false, + + [System.Management.Automation.SwitchParameter] + [Parameter( + ParameterSetName = 'ByStorageSubSystem', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubSystemFriendlyName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubSystemName', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByStorageSubSystemUniqueId', + Mandatory = $false)] + $IncludeLiveDump = $false, + + #### -------------------- Powershell parameters ------------------------------#### + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + # Provided for compatibility with CDXML cmdlets, not actually used. + [Int32] + $ThrottleLimit, + + [Switch] + $AsJob + ) + + Process + { + $info = $resources.info + $p = $null + + if (-not $CimSession) + { + $CimSession = New-CimSession + } + + if (-not $AsJob) + { + Write-Progress -Activity "Get-StorageDiagnosticInfo" -Id 0 -PercentComplete 0 -CurrentOperation "Validating parameters" -Status "0/2" + } + + ## Gather the instance object + + switch ($psCmdlet.ParameterSetName) + { + "ByStorageSubSystem" { $SubsystemInstance = $InputObject; break; } + "ByStorageSubSystemFriendlyName" { $SubsystemInstance = Get-StorageSubsystem -FriendlyName $StorageSubSystemFriendlyName -CimSession $CimSession -ErrorAction Stop; break; } + "ByStorageSubSystemName" { $SubsystemInstance = Get-StorageSubsystem -Name $StorageSubSystemName -CimSession $CimSession -ErrorAction Stop; break; } + "ByStorageSubSystemUniqueId" { $SubsystemInstance = Get-StorageSubsystem -UniqueId $StorageSubSystemUniqueId -CimSession $CimSession -ErrorAction Stop; break; } + } + + # Would use a closure here, but jobs are run in their own session state. + $methodblock = { + param($session, $asjob, $uniqueId, $arguments) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + # We need to load the module or it fails with CMDLET Not Found + import-module Storage\StorageSubSystem.cdxml + + $session = $session | New-CimSession + } + + $parameters = @{} + + $parameters.Add("CimSession", $session ) + $parameters.Add("StorageSubSystemUniqueId", $uniqueId ) + $parameters.Add("DestinationPath", $arguments["DestinationPath"] ) + + if ($arguments.ContainsKey("TimeSpan")) + { + $parameters.Add("TimeSpan", $arguments["TimeSpan"]) + } + + if ($arguments.ContainsKey("ActivityId")) + { + $parameters.Add("ActivityId", $arguments["ActivityId"]) + } + + if ($arguments.ContainsKey("ExcludeOperationalLog")) + { + $parameters.Add("ExcludeOperationalLog", $arguments["ExcludeOperationalLog"]) + } + + if ($arguments.ContainsKey("ExcludeDiagnosticLog")) + { + $parameters.Add("ExcludeDiagnosticLog", $arguments["ExcludeDiagnosticLog"]) + } + + if ($arguments.ContainsKey("IncludeLiveDump")) + { + $parameters.Add("IncludeLiveDump", $arguments["IncludeLiveDump"]) + } + + if (-not $asjob) + { + Write-Progress -Activity "Get-StorageDiagnosticInfo" -Id 0 -PercentComplete 10 -CurrentOperation "Gathering storage diagnostic logs" -Status "1/2" + } + + Get-StorageDiagnosticInfoInternal @parameters + + if (-not $asjob) + { + Write-Progress -Activity "Get-StorageDiagnosticInfo" -Completed -Status "2/2" + } + } + + if ($asjob) + { + $p = $true + + Start-Job -Name GetDiagnosticInfo ` + -ScriptBlock $methodblock ` + -ArgumentList @($CimSession, $p, $SubsystemInstance.UniqueId, $PSBoundParameters) + } + else + { + &$methodblock $CimSession $p $SubsystemInstance.UniqueId $PSBoundParameters + } + } +} + +function Remove-StorageHealthIntent +{ + [CmdletBinding( + SupportsShouldProcess=$true, + ConfirmImpact="High" + )] + Param + ( + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_StorageObject")] + [Parameter( + Mandatory = $true, + ValueFromPipeline = $true, + ParameterSetName = "InputObject")] + $InputObject, + + [Microsoft.Management.Infrastructure.CimSession] + $CimSession, + + [Switch] + $AsJob + ) + + Process + { + $info = $resources.info + + if (-not $CimSession) + { + $CimSession = New-CimSession -Verbose:$false + } + + $arguments = @{} + + $storageSubSystem = $InputObject | Get-StorageSubSystem -CimSession $CimSession + + if ($storageSubSystem.Model -eq "Clustered Windows Storage") + { + $storageHealth = Get-CimAssociatedInstance -ResultClassName MSFT_StorageHealth -InputObject $storageSubSystem -CimSession $CimSession + + $arguments.Add("TargetObject", $InputObject) + } + else + { + $errorObject = CreateErrorRecord -ErrorId "InvalidSubsystem" ` + -ErrorMessage "This method is not supported for this subsystem." ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + + # Would use a closure here, but jobs are run in their own session state. + $block = { + param($session, $asjob, $io, $arg, $sh) + + # Start-Job serializes/deserializes the CimSession, + # which means it shows up here as having type Deserialized.CimSession. + # Must recreate or cast the object in order to pass it to Get-CimInstance. + if ($asjob) + { + $session = $session | New-CimSession -Verbose:$false + } + + Invoke-CimMethod -MethodName "RemoveIntent" -Arguments $arg -InputObject $sh -CimSession $session | Out-Null + } + + if ($asjob) + { + Start-Job -ScriptBlock $block -ArgumentList @($CimSession, $true, $InputObject, $arguments, $storageHealth) + } + else + { + if ($pscmdlet.ShouldProcess($info, $resources.warning, $info)) + { + &$block $CimSession $false $InputObject $arguments $storageHealth + } + } + } +} + +New-Alias Get-PhysicalDiskSNV Get-PhysicalDiskStorageNodeView +New-Alias Get-DiskSNV Get-DiskStorageNodeView +New-Alias Get-StorageEnclosureSNV Get-StorageEnclosureStorageNodeView + +Export-ModuleMember -Alias * -Function * \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/Storage/StorageSetting.cdxml b/newton-cn/bin/v1.0/Modules/Storage/StorageSetting.cdxml new file mode 100644 index 0000000..f116db9 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/StorageSetting.cdxml @@ -0,0 +1,82 @@ + + + 1.0.0.0 + StorageSetting + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/StorageSubSystem.cdxml b/newton-cn/bin/v1.0/Modules/Storage/StorageSubSystem.cdxml new file mode 100644 index 0000000..5a8bb11 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/StorageSubSystem.cdxml @@ -0,0 +1,928 @@ + + + 1.0.0.0 + StorageSubSystem + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/StorageTier.cdxml b/newton-cn/bin/v1.0/Modules/Storage/StorageTier.cdxml new file mode 100644 index 0000000..018e31a --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/StorageTier.cdxml @@ -0,0 +1,206 @@ + + + 1.0.0.0 + StorageTier + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/TargetPort.cdxml b/newton-cn/bin/v1.0/Modules/Storage/TargetPort.cdxml new file mode 100644 index 0000000..e210e7a --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/TargetPort.cdxml @@ -0,0 +1,167 @@ + + + 1.0.0.0 + TargetPort + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/TargetPortal.cdxml b/newton-cn/bin/v1.0/Modules/Storage/TargetPortal.cdxml new file mode 100644 index 0000000..48d949e --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/TargetPortal.cdxml @@ -0,0 +1,65 @@ + + + 1.0.0.0 + TargetPortal + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/Storage/VirtualDisk.cdxml b/newton-cn/bin/v1.0/Modules/Storage/VirtualDisk.cdxml new file mode 100644 index 0000000..91815d7 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/VirtualDisk.cdxml @@ -0,0 +1,765 @@ + + + 1.0.0.0 + VirtualDisk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Storage/Volume.cdxml b/newton-cn/bin/v1.0/Modules/Storage/Volume.cdxml new file mode 100644 index 0000000..0c49972 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Storage/Volume.cdxml @@ -0,0 +1,856 @@ + + + 1.0.0.0 + Volume + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + FAT + FAT32 + exFAT + NTFS + ReFS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/StorageBusCache/StorageBusCache.format.ps1xml b/newton-cn/bin/v1.0/Modules/StorageBusCache/StorageBusCache.format.ps1xml new file mode 100644 index 0000000..75d7910 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/StorageBusCache/StorageBusCache.format.ps1xml @@ -0,0 +1,79 @@ + + + + + + DiskTableView + + StorageBusDisk + + + + + + + + + + + + + + + + + + + + + Guid + + + Number + + + IsCache + + + BusType + + + + + + + + DiskListView + + StorageBusDisk + + + + + + + Guid + + + Number + + + IsCache + + + BusType + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/StorageBusCache/StorageBusCache.psd1 b/newton-cn/bin/v1.0/Modules/StorageBusCache/StorageBusCache.psd1 new file mode 100644 index 0000000..5795d24 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/StorageBusCache/StorageBusCache.psd1 @@ -0,0 +1,31 @@ +@{ + GUID = 'c85588a4-1180-4635-ba9e-a04581bf10c8' + Author="Microsoft Corporation" + CompanyName="Microsoft Corporation" + Copyright="© Microsoft Corporation. All rights reserved." + ModuleVersion = '1.0.0.0' + PowerShellVersion = '3.0' + FormatsToProcess = 'StorageBusCache.format.ps1xml' + TypesToProcess = 'StorageBusCache.types.ps1xml' + NestedModules = @( + 'StorageBusCache.psm1' + ) + + CmdletsToExport = @() + FunctionsToExport = @( + 'Clear-StorageBusDisk', + 'Disable-StorageBusCache', + 'Disable-StorageBusDisk', + 'Enable-StorageBusCache', + 'Enable-StorageBusDisk', + 'Get-StorageBusDisk', + 'Get-StorageBusBinding', + 'New-StorageBusCacheStore', + 'New-StorageBusBinding', + 'Remove-StorageBusBinding', + 'Resume-StorageBusDisk', + 'Set-StorageBusProfile', + 'Suspend-StorageBusDisk') +} + + diff --git a/newton-cn/bin/v1.0/Modules/StorageBusCache/StorageBusCache.psm1 b/newton-cn/bin/v1.0/Modules/StorageBusCache/StorageBusCache.psm1 new file mode 100644 index 0000000..5aebee0 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/StorageBusCache/StorageBusCache.psm1 @@ -0,0 +1,2452 @@ +$DiskControls = @" +using System; +using System.Collections; +using System.Runtime.InteropServices; +using System.ComponentModel; + +namespace Microsoft.SFS.StorageBusCache +{ + public enum StorageBusType + { + Unknown = 0, + Scsi = 1, + Atapi = 2, + Ata = 3, + IEEE1394 = 4, + Ssa = 5, + Fibre = 6, + Usb = 7, + RAID = 8, + iScsi = 9, + Sas = 10, + Sata = 11, + Sd = 12, + Mmc = 13, + Virtual = 14, + FileBackedVirtual = 15, + Spaces = 16, + Nvme = 17, + SCM = 18, + Ufs = 19, + Max = 20 + } + + namespace ClusBFlt + { + public enum DeviceType + { + Disk = 0, + Enclosure = 1, + SSU = 2 + } + + [Flags] + public enum CacheStoreBindingAttribute + { + Default = 0x00000000, + Enabled = 0x00000001, + Disable_Read_Cache = 0x00000002, + Disable_Read_Ahead_Cache = 0x00000004, + Disable_Write_Cache = 0x00000008 + } + + public enum PathType + { + Read_Write = 0, + Read_Only = 1, + Engaged = 2, + Maintenance = 3 + } + + [Flags] + public enum PathInfoAttribute + { + Default = 0x00000000, + Virtual = 0x00000001, + Orphan = 0x00000002, + Hybrid = 0x00000004, + Solid = 0x00000008, + Incomplete = 0x00000010, + Fairness_Layer = 0x00000020, + Missing_Layer = 0x00000040, + Hidden = 0x00000080, + Resilient = 0x00000100, + Paused = 0x00000200, + Block_RW = 0x00000400, + Attention = 0x00000800, + Has_Cache_Partition = 0x00001000, + Fairness_Enabled = 0x00002000, + Partition = 0x00004000, + Block_Write = 0x00008000, + All = 0x0000FFFF + } + + [Flags] + public enum DiskAttribute + { + Default = 0x00, + Enabled = 0x01, + Disabled = 0x02, + Maintenance = 0x04, + No_Virtual_Enclosure = 0x08, + Block_ReadWrite = 0x10, + Block_Write = 0x20, + All = 0xFF + } + + [Flags] + public enum SystemFlags + { + Default_System = 0x0000, + Azure_System = 0x0001, + Dont_Set_FastFail = 0x0010, + Allow_Other_Partitions = 0x0020, + Claim_Sbl_Cache_HDD_Guid_Disk = 0x0040, + Claim_Sbl_Cache_SSD_Guid_Part = 0x0080, + Dont_Claim_SSD = 0x0100, + Create_Bus_PDO = 0x0200, + Disable_Cache_On_Error = 0x0400 + } + } + + public class StorageBusDisk + { + public string Guid { get; set; } + public uint Number { get; set; } + public bool IsClaimed { get; set; } + public bool IsCache { get; set; } + public StorageBusType BusType { get; set; } + } + + public class StorageBusBinding + { + public string Guid { get; set; } + public uint Number { get; set; } + public bool IsCache { get; set; } + } + + public static class DeviceMgmt + { + #region PInvoke structs + + [StructLayout(LayoutKind.Sequential)] + public struct CBFLT_IS_SUPPORTED_DISK_IN + { + public IntPtr Handle; + public UInt32 BusTypesOverride; + } + + [StructLayout(LayoutKind.Sequential)] + public struct CBFLT_SET_PROFILE_IN + { + public UInt32 SystemFlags; + } + + [StructLayout(LayoutKind.Sequential)] + public struct STORAGE_DEVICE_NUMBER + { + public UInt32 DeviceType; + public UInt32 DeviceNumber; + public UInt32 PartitionNumber; + } + + [StructLayout(LayoutKind.Sequential)] + public struct STORAGE_DEVICE_NUMBER_EX + { + public UInt32 Version; + public UInt32 Size; + public UInt32 Flags; + public UInt32 DeviceType; + public UInt32 DeviceNumber; + public Guid DeviceGuid; + public UInt32 PartitionNumber; + } + + public enum PARTITION_STYLE : int + { + PARTITION_STYLE_MBR = 0, + PARTITION_STYLE_GPT = 1, + PARTITION_STYLE_RAW = 2 + } + + [StructLayout(LayoutKind.Sequential)] + public struct DRIVE_LAYOUT_INFORMATION_MBR + { + public UInt32 DiskSignature; + } + + [StructLayout(LayoutKind.Sequential)] + public struct DRIVE_LAYOUT_INFORMATION_GPT + { + public Guid DiskId; + public UInt64 StartingUsableOffset; + public UInt64 UsableLength; + public UInt32 MaxPartitionCount; + } + + [StructLayout(LayoutKind.Explicit)] + public struct PARTITION_INFORMATION_MBR + { + [FieldOffset(0)] + public Byte PartitionType; + [FieldOffset(1)] + public Boolean BootIndicator; + [FieldOffset(2)] + public Boolean RecognizedPartition; + [FieldOffset(4)] + public UInt32 HiddenSectors; + } + + [StructLayout(LayoutKind.Explicit, CharSet=CharSet.Unicode)] + public struct PARTITION_INFORMATION_GPT + { + [FieldOffset(0)] + public Guid PartitionType; + [FieldOffset(16)] + public Guid PartitionId; + [FieldOffset(32)] + public UInt64 Attributes; + [FieldOffset(40)] + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 36)] + public string PartitionName; + } + + [StructLayout(LayoutKind.Explicit)] + public struct PARTITION_INFORMATION_EX + { + [FieldOffset(0)] + public PARTITION_STYLE PartitionStyle; + [FieldOffset(8)] + public UInt64 StartingOffset; + [FieldOffset(16)] + public UInt64 PartitionLength; + [FieldOffset(24)] + public UInt32 PartitionNumber; + [FieldOffset(28)] + public Boolean RewritePartition; + [FieldOffset(32)] + public PARTITION_INFORMATION_MBR Mbr; + [FieldOffset(32)] + public PARTITION_INFORMATION_GPT Gpt; + } + + [StructLayout(LayoutKind.Explicit)] + public struct DRIVE_LAYOUT_INFORMATION_EX + { + [FieldOffset(0)] + public PARTITION_STYLE PartitionStyle; + [FieldOffset(4)] + public UInt32 PartitionCount; + [FieldOffset(8)] + public DRIVE_LAYOUT_INFORMATION_MBR Mbr; + [FieldOffset(8)] + public DRIVE_LAYOUT_INFORMATION_GPT Gpt; + [FieldOffset(48)] + public PARTITION_INFORMATION_EX[] PartitionEntry; + } + + #endregion + + #region PInvoke Definitions + + //File Handle + [DllImport("kernel32.dll", SetLastError = true)] + static extern IntPtr CreateFile(string lpFileName, uint dwDesiredAccess, uint dwShareMode, IntPtr lpSecurityAttributes, uint dwCreationDisposition, uint dwFlagsAndAttributes, IntPtr hTemplateFile); + + [DllImport("kernel32.dll")] + static extern int CloseHandle(IntPtr hObject); + + [DllImport("kernel32.dll", SetLastError = true)] + static extern bool DeviceIoControl(IntPtr hDevice, uint dwIoControlCode, IntPtr lpInBuffer, uint nInBufferSize, IntPtr lpOutBuffer, + uint nOutBufferSize, ref uint lpBytesReturned, IntPtr lpOverlapped); + + #endregion + + #region constants + + // IoControlCode values for disk devices + const uint FILE_ANY_ACCESS = 0; + const uint FILE_READ_ACCESS = 0x0001; + const uint FILE_WRITE_ACCESS = 0x0002; + const uint FILE_BOTH_ACCESS = FILE_READ_ACCESS | FILE_WRITE_ACCESS; + + const uint METHOD_BUFFERED = 0; + const uint METHOD_IN_DIRECT = 1; + const uint METHOD_OUT_DIRECT = 2; + const uint METHOD_NEITHER = 3; + + // createFile access + const uint GENERIC_READ = (0x80000000); + const uint GENERIC_WRITE = (0x40000000); + const uint FILE_SHARE_READ = 0x00000001; + const uint FILE_SHARE_WRITE = 0x00000002; + const uint OPEN_EXISTING = 3; + + // file attribute values + const uint FILE_ATTRIBUTE_NORMAL = 0x00000080; + + //errors + const uint ERROR_CLASS_MISMATCH = 0xE0000203; + const uint ERROR_NO_MORE_ITEMS = 259; + const uint ERROR_INSUFFICIENT_BUFFER = 122; + const uint ERROR_MORE_DATA = 234; + + //random consts + const uint SpDeviceInterfaceDetailSize = 5; + + //device classes + const int DIGCF_DEFAULT = 0x00000001; + const int DIGCF_PRESENT = 0x00000002; + const int DIGCF_ALLCLASSES = 0x00000004; + const int DIGCF_PROFILE = 0x00000008; + const int DIGCF_DEVICEINTERFACE = 0x00000010; + + //disk and hidden disk interface GUIDs + public static Guid GUID_DEVINTERFACE_HIDDEN_DISK = new Guid(0x7fccc86c, 0x228a, 0x40ad, 0x8a, 0x58, 0xf5, 0x90, 0xaf, 0x7b, 0xfd, 0xce); + public static Guid GUID_DEVINTERFACE_DISK = new Guid(0x53f56307, 0xb6bf, 0x11d0, 0x94, 0xf2, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b); + public static Guid GUID_DEVINTERFACE_STORAGEPORT = new Guid(0x2ACCFE60, 0xC130, 0x11D2, 0xb0, 0x82, 0x00, 0xa0, 0xc9, 0x1e, 0xfb, 0x8b); //{2ACCFE60-C130-11D2-B082-00A0C91EFB8B} + + // SBL cache partition type GUIDs + public static Guid PARTITION_SBL_CACHE_SSD_GUID = new Guid(0xeeff8352, 0xdd2a, 0x44db, 0xae, 0x83, 0xbe, 0xe1, 0xcf, 0x74, 0x81, 0xdc); + public static Guid PARTITION_SBL_CACHE_SSD_RESERVED_GUID = new Guid(0xdcc0c7c1, 0x55ad, 0x4f17, 0x9d, 0x43, 0x4b, 0xc7, 0x76, 0xe0, 0x11, 0x7e); + public static Guid PARTITION_SBL_CACHE_HDD_GUID = new Guid(0x03aaa829, 0xebfc, 0x4e7e, 0xaa, 0xc9, 0xc4, 0xd7, 0x6c, 0x63, 0xb2, 0x4b); + + //ioctl code + public const uint IOCTL_PARTMGR_BASE = 0x00000070; + public const uint IOCTL_CBFLT_BASE = 0x791; + public const uint IOCTL_STORAGE_BASE = 0x0000002d; + public const uint FILE_DEVICE_DISK = 0x00000007; + public const uint IOCTL_DISK_BASE = FILE_DEVICE_DISK; + + private static uint IOCTL_DISK_REAUCTION_DISK = CTL_CODE(IOCTL_PARTMGR_BASE, 7, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); + private static uint IOCTL_CBFLT_IS_SUPPORTED_DISK = CTL_CODE(IOCTL_CBFLT_BASE, 0x09, METHOD_BUFFERED, FILE_READ_ACCESS); + private static uint IOCTL_CBFLT_SET_PROFILE = CTL_CODE(IOCTL_CBFLT_BASE, 0x1b, METHOD_BUFFERED, FILE_WRITE_ACCESS); + private static uint IOCTL_STORAGE_GET_DEVICE_NUMBER_EX = CTL_CODE(IOCTL_STORAGE_BASE, 0x0421, METHOD_BUFFERED, FILE_ANY_ACCESS); + private static uint IOCTL_STORAGE_GET_DEVICE_NUMBER = CTL_CODE(IOCTL_STORAGE_BASE, 0x0420, METHOD_BUFFERED, FILE_ANY_ACCESS); + private static uint IOCTL_DISK_GET_DRIVE_LAYOUT_EX = CTL_CODE(IOCTL_DISK_BASE, 0x0014, METHOD_BUFFERED, FILE_ANY_ACCESS); + private static uint IOCTL_DISK_SET_DRIVE_LAYOUT_EX = CTL_CODE(IOCTL_DISK_BASE, 0x0015, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS); + + // clusbflt + const string CLUSBFLT_PR_MANAGER = "\\\\?\\GLOBALROOT\\Device\\CLUSBFLT\\PrMgr$"; + const string CLUSBFLT_BLOCK_TARGETFILE = "\\\\?\\GLOBALROOT\\Device\\CLUSBFLT\\BlockTarget$"; + + public static UInt32 Standalone_Profile_Default = 0x000101F0; + public static UInt32 Standalone_Profile_Claim_Flash = 0x000000F0; + + public static UInt32 Standalone_Cache_Binding_Attributes = 0x00000007; + + #endregion + + #region Ioctl code + + static private uint CTL_CODE(uint DeviceType, uint Function, uint Method, uint Access) + { + return ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method); + } + + static private IntPtr OpenDevice(string devicePath) + { + IntPtr hDevice = IntPtr.Zero; + + hDevice = CreateFile(devicePath, + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_WRITE | FILE_SHARE_READ, + IntPtr.Zero, + OPEN_EXISTING, + 0, + IntPtr.Zero); + + if ((int)hDevice == -1) + { + throw new Win32Exception("CreateFile failed, status " + Marshal.GetLastWin32Error().ToString()); + } + if (hDevice == IntPtr.Zero) + { + throw new Win32Exception("Device handle to '" + devicePath + "'is NULL"); + } + return (hDevice); + } + + static private void CloseDevice(IntPtr hDevice) + { + if ((int)CloseHandle(hDevice) == -1) + { + throw new Win32Exception("CloseHandle() failed, status " + Marshal.GetLastWin32Error().ToString()); + } + return; + } + + static public bool ReauctionDevice(string devicePath) + { + bool boolResult = false; + IntPtr hDevice = IntPtr.Zero; + + try + { + hDevice = OpenDevice(devicePath); + uint bytesReturned = 0; + + boolResult = DeviceIoControl(hDevice, + IOCTL_DISK_REAUCTION_DISK, + IntPtr.Zero, + 0, + IntPtr.Zero, + 0, + ref bytesReturned, + IntPtr.Zero); + if (!boolResult) + { + throw new Win32Exception("Device '" + devicePath + "' failed IOCTL_DISK_REAUCTION_DISK, status " + Marshal.GetLastWin32Error().ToString()); + } + } + catch + { + throw; + } + finally + { + if (hDevice != IntPtr.Zero) + CloseDevice(hDevice); + } + + return boolResult; + } + + static public StorageBusDisk GetStorageBusDisk(string devicePath) + { + bool boolResult = false; + IntPtr hDevice = IntPtr.Zero; + IntPtr outputPtr = IntPtr.Zero; + + StorageBusDisk disk = new StorageBusDisk(); + disk.Guid = Guid.Empty.ToString(); + disk.Number = 0; + + try + { + try + { + hDevice = OpenDevice(devicePath); + } + catch + { + return disk; + } + + uint bytesReturned = 0; + + int outputSize = Marshal.SizeOf(typeof(STORAGE_DEVICE_NUMBER_EX)); + outputPtr = Marshal.AllocHGlobal(outputSize); + + boolResult = DeviceIoControl(hDevice, + IOCTL_STORAGE_GET_DEVICE_NUMBER_EX, + IntPtr.Zero, + 0, + outputPtr, + (UInt32)outputSize, + ref bytesReturned, + IntPtr.Zero); + if (!boolResult) + { + throw new Win32Exception("Device '" + devicePath + "' failed IOCTL_STORAGE_GET_DEVICE_NUMBER_EX, status " + Marshal.GetLastWin32Error().ToString()); + } + + STORAGE_DEVICE_NUMBER_EX output = (STORAGE_DEVICE_NUMBER_EX) Marshal.PtrToStructure(outputPtr, typeof(STORAGE_DEVICE_NUMBER_EX)); + disk.Guid = "{" + output.DeviceGuid + "}"; + disk.Number = output.DeviceNumber; + } + catch + { + throw; + } + finally + { + if (outputPtr != IntPtr.Zero) + Marshal.FreeHGlobal(outputPtr); + + if (hDevice != IntPtr.Zero) + CloseDevice(hDevice); + } + + return disk; + } + + static public Guid GetDeviceGuid(string devicePath) + { + bool boolResult = false; + IntPtr hDevice = IntPtr.Zero; + IntPtr outputPtr = IntPtr.Zero; + Guid deviceGuid = new Guid(); + + try + { + try + { + hDevice = OpenDevice(devicePath); + } + catch + { + return deviceGuid; + } + + uint bytesReturned = 0; + + int outputSize = Marshal.SizeOf(typeof(STORAGE_DEVICE_NUMBER_EX)); + outputPtr = Marshal.AllocHGlobal(outputSize); + + boolResult = DeviceIoControl(hDevice, + IOCTL_STORAGE_GET_DEVICE_NUMBER_EX, + IntPtr.Zero, + 0, + outputPtr, + (UInt32)outputSize, + ref bytesReturned, + IntPtr.Zero); + if (!boolResult) + { + throw new Win32Exception("Device '" + devicePath + "' failed IOCTL_STORAGE_GET_DEVICE_NUMBER_EX, status " + Marshal.GetLastWin32Error().ToString()); + } + + STORAGE_DEVICE_NUMBER_EX output = (STORAGE_DEVICE_NUMBER_EX) Marshal.PtrToStructure(outputPtr, typeof(STORAGE_DEVICE_NUMBER_EX)); + deviceGuid = output.DeviceGuid; + } + catch + { + throw; + } + finally + { + if (outputPtr != IntPtr.Zero) + Marshal.FreeHGlobal(outputPtr); + + if (hDevice != IntPtr.Zero) + CloseDevice(hDevice); + } + + return deviceGuid; + } + + static public bool IsClusBFltCandidate(string devicePath, UInt32 busTypes) + { + bool boolResult = false; + IntPtr hPrMgrDevice = IntPtr.Zero; + IntPtr hDevice = IntPtr.Zero; + IntPtr inputPtr = IntPtr.Zero; + IntPtr outputPtr = IntPtr.Zero; + + try + { + hPrMgrDevice = OpenDevice(CLUSBFLT_PR_MANAGER); + hDevice = OpenDevice(devicePath); + + UInt32 bytesReturned = 0; + + CBFLT_IS_SUPPORTED_DISK_IN input = new CBFLT_IS_SUPPORTED_DISK_IN(); + input.Handle = hDevice; + input.BusTypesOverride = busTypes; + int inputSize = Marshal.SizeOf(typeof(CBFLT_IS_SUPPORTED_DISK_IN)); + inputPtr = Marshal.AllocHGlobal(inputSize); + Marshal.StructureToPtr(input, inputPtr, false); + + int outputSize = Marshal.SizeOf(typeof(uint)); + outputPtr = Marshal.AllocHGlobal(outputSize); + + boolResult = DeviceIoControl(hPrMgrDevice, + IOCTL_CBFLT_IS_SUPPORTED_DISK, + inputPtr, + (UInt32)inputSize, + outputPtr, + (UInt32)outputSize, + ref bytesReturned, + IntPtr.Zero); + + if (!boolResult) + { + throw new Win32Exception("Device '" + devicePath + "' failed IOCTL_CBFLT_IS_SUPPORTED_DISK, status " + Marshal.GetLastWin32Error().ToString()); + } + + uint supportStatus = (uint)Marshal.PtrToStructure(outputPtr, typeof(uint)); + boolResult = (supportStatus == 0); + } + catch + { + throw; + } + finally + { + if (inputPtr != IntPtr.Zero) + Marshal.FreeHGlobal(inputPtr); + + if (outputPtr != IntPtr.Zero) + Marshal.FreeHGlobal(outputPtr); + + if (hDevice != IntPtr.Zero) + CloseDevice(hDevice); + + if (hPrMgrDevice != IntPtr.Zero) + CloseDevice(hPrMgrDevice); + } + + return boolResult; + } + + static public bool SetClusBFltSystemFlags(UInt32 systemFlags) + { + bool boolResult = false; + IntPtr hTargetMgrFile = IntPtr.Zero; + IntPtr inputPtr = IntPtr.Zero; + + try + { + hTargetMgrFile = OpenDevice(CLUSBFLT_BLOCK_TARGETFILE); + + UInt32 bytesReturned = 0; + CBFLT_SET_PROFILE_IN input = new CBFLT_SET_PROFILE_IN(); + input.SystemFlags = systemFlags; + int inputSize = Marshal.SizeOf(typeof(CBFLT_SET_PROFILE_IN)); + inputPtr = Marshal.AllocHGlobal(inputSize); + Marshal.StructureToPtr(input, inputPtr, false); + + boolResult = DeviceIoControl(hTargetMgrFile, + IOCTL_CBFLT_SET_PROFILE, + inputPtr, + (UInt32)inputSize, + IntPtr.Zero, + 0, + ref bytesReturned, + IntPtr.Zero); + + if (!boolResult) + { + throw new Win32Exception("ClusBFlt driver failed IOCTL_CBFLT_SET_PROFILE, status " + Marshal.GetLastWin32Error().ToString()); + } + } + catch + { + throw; + } + finally + { + if (inputPtr != IntPtr.Zero) + Marshal.FreeHGlobal(inputPtr); + + if (hTargetMgrFile != IntPtr.Zero) + CloseDevice(hTargetMgrFile); + } + + return boolResult; + } + + private static IntPtr ComputeFieldOffset(IntPtr buffer, Type parentStructure, string fieldName) + { + long offset = (long)Marshal.OffsetOf(parentStructure, fieldName); + return (IntPtr)((long)buffer + offset); + } + + private static IntPtr ComputeFieldOffsetAtIndex(IntPtr buffer, Type parentStructure, string fieldName, UInt32 index) + { + Type fieldType = parentStructure.GetField(fieldName).FieldType.GetElementType(); + long elementSize = Marshal.SizeOf(fieldType); + long offset = (long)Marshal.OffsetOf(parentStructure, fieldName) + elementSize * index; + return (IntPtr)((long)buffer + offset); + } + + private static PARTITION_INFORMATION_EX Unmarshal_PARTITION_INFORMATION_EX(IntPtr buffer, UInt32 size) + { + if (size < (UInt32)Marshal.SizeOf(typeof(PARTITION_INFORMATION_EX))) + throw new ArgumentException("Insufficient buffer size to unmarshal PARTITION_INFORMATION_EX.", "buffer"); + PARTITION_INFORMATION_EX info = (PARTITION_INFORMATION_EX)Marshal.PtrToStructure( + buffer, typeof(PARTITION_INFORMATION_EX)); + if (info.PartitionStyle == PARTITION_STYLE.PARTITION_STYLE_MBR) + info.Mbr = (PARTITION_INFORMATION_MBR)Marshal.PtrToStructure( + ComputeFieldOffset(buffer, typeof(PARTITION_INFORMATION_EX), "Mbr"), + typeof(PARTITION_INFORMATION_MBR)); + if (info.PartitionStyle == PARTITION_STYLE.PARTITION_STYLE_GPT) + info.Gpt = (PARTITION_INFORMATION_GPT)Marshal.PtrToStructure( + ComputeFieldOffset(buffer, typeof(PARTITION_INFORMATION_EX), "Gpt"), + typeof(PARTITION_INFORMATION_GPT)); + return info; + } + + private static DRIVE_LAYOUT_INFORMATION_EX Unmarshal_DRIVE_LAYOUT_INFORMATION_EX(IntPtr buffer, UInt32 size) + { + DRIVE_LAYOUT_INFORMATION_EX info = new DRIVE_LAYOUT_INFORMATION_EX(); + info.PartitionStyle = (PARTITION_STYLE)Marshal.ReadInt32(buffer); + info.PartitionCount = (UInt32)Marshal.ReadInt32(ComputeFieldOffset(buffer, + typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionCount")); + if (size < ((UInt32)Marshal.OffsetOf(typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionEntry") + + info.PartitionCount * (UInt32)Marshal.SizeOf(typeof(PARTITION_INFORMATION_EX)))) + throw new ArgumentException("Insufficient buffer size to unmarshal DRIVE_LAYOUT_INFORMATION_EX.", "buffer"); + if (info.PartitionStyle == PARTITION_STYLE.PARTITION_STYLE_MBR) + info.Mbr = (DRIVE_LAYOUT_INFORMATION_MBR)Marshal.PtrToStructure( + ComputeFieldOffset(buffer, typeof(DRIVE_LAYOUT_INFORMATION_EX), "Mbr"), + typeof(DRIVE_LAYOUT_INFORMATION_MBR)); + if (info.PartitionStyle == PARTITION_STYLE.PARTITION_STYLE_GPT) + info.Gpt = (DRIVE_LAYOUT_INFORMATION_GPT)Marshal.PtrToStructure( + ComputeFieldOffset(buffer, typeof(DRIVE_LAYOUT_INFORMATION_EX), "Gpt"), + typeof(DRIVE_LAYOUT_INFORMATION_GPT)); + info.PartitionEntry = new PARTITION_INFORMATION_EX[info.PartitionCount]; + size -= (UInt32)Marshal.OffsetOf(typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionEntry"); + for (UInt32 partNumber = 0; partNumber < info.PartitionCount; partNumber++) + { + info.PartitionEntry[partNumber] = Unmarshal_PARTITION_INFORMATION_EX(ComputeFieldOffsetAtIndex(buffer, + typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionEntry", partNumber), size); + size -= (UInt32)Marshal.SizeOf(typeof(PARTITION_INFORMATION_EX)); + } + return info; + } + + private static void Marshal_DRIVE_LAYOUT_INFORMATION_EX(DRIVE_LAYOUT_INFORMATION_EX layout, IntPtr buffer, UInt32 size) + { + if (size < ((UInt32)Marshal.OffsetOf(typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionEntry") + + layout.PartitionCount * (UInt32)Marshal.SizeOf(typeof(PARTITION_INFORMATION_EX)))) + throw new ArgumentException("Insufficient buffer size to marshal layout.", "buffer"); + Marshal.WriteInt32(buffer, (int)layout.PartitionStyle); + Marshal.WriteInt32(ComputeFieldOffset(buffer, typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionCount"), + (int)layout.PartitionCount); + if (layout.PartitionStyle == PARTITION_STYLE.PARTITION_STYLE_GPT) + Marshal.StructureToPtr(layout.Gpt, ComputeFieldOffset(buffer, typeof(PARTITION_INFORMATION_EX), + "Gpt"), false); + else if (layout.PartitionStyle == PARTITION_STYLE.PARTITION_STYLE_MBR) + Marshal.StructureToPtr(layout.Mbr, ComputeFieldOffset(buffer, typeof(PARTITION_INFORMATION_EX), + "Mbr"), false); + size -= (UInt32)Marshal.OffsetOf(typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionEntry"); + for (UInt32 partNumber = 0; partNumber < layout.PartitionCount; partNumber++) + { + PARTITION_INFORMATION_EX newPart = layout.PartitionEntry[partNumber]; + newPart.RewritePartition = true; + Marshal_PARTITION_INFORMATION_EX(newPart, ComputeFieldOffsetAtIndex(buffer, + typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionEntry", partNumber), size); + size -= (UInt32)Marshal.SizeOf(typeof(PARTITION_INFORMATION_EX)); + } + } + + private static void Marshal_PARTITION_INFORMATION_EX(PARTITION_INFORMATION_EX info, IntPtr buffer, UInt32 size) + { + if (size < (UInt32)Marshal.SizeOf(typeof(PARTITION_INFORMATION_EX))) + throw new ArgumentException("Insufficient buffer to marshal info.", "buffer"); + Marshal.StructureToPtr(info, buffer, false); + if (info.PartitionStyle == PARTITION_STYLE.PARTITION_STYLE_GPT) + Marshal.StructureToPtr(info.Gpt, ComputeFieldOffset(buffer, + typeof(PARTITION_INFORMATION_EX), "Gpt"), false); + if (info.PartitionStyle == PARTITION_STYLE.PARTITION_STYLE_MBR) + Marshal.StructureToPtr(info.Mbr, ComputeFieldOffset(buffer, + typeof(PARTITION_INFORMATION_EX), "Mbr"), false); + } + + static public DRIVE_LAYOUT_INFORMATION_EX GetDriveLayout(string devicePath) + { + bool boolResult = false; + IntPtr hDevice = IntPtr.Zero; + uint status = 0; + + DRIVE_LAYOUT_INFORMATION_EX layout = new DRIVE_LAYOUT_INFORMATION_EX(); + uint bufferSize = 0; + IntPtr buffer = IntPtr.Zero; + + try + { + hDevice = OpenDevice(devicePath); + bool done = false; + uint bytesReturned = 0; + uint partitionCount = 0; + + while (!done) + { + bufferSize = (UInt32)Marshal.OffsetOf(typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionEntry") + + partitionCount * (uint)Marshal.SizeOf(typeof(PARTITION_INFORMATION_EX)); + buffer = Marshal.AllocHGlobal((int) bufferSize); + + boolResult = DeviceIoControl(hDevice, + IOCTL_DISK_GET_DRIVE_LAYOUT_EX, + IntPtr.Zero, + 0, + buffer, + (UInt32)bufferSize, + ref bytesReturned, + IntPtr.Zero); + if (!boolResult) + { + status = (uint)Marshal.GetLastWin32Error(); + Console.WriteLine("IOCTL_DISK_GET_DRIVE_LAYOUT_EX failed, status = " + status + " bytes returned = " + bytesReturned); + if (status == ERROR_MORE_DATA || status == ERROR_INSUFFICIENT_BUFFER) + { + partitionCount = (UInt32)Marshal.ReadInt32(ComputeFieldOffset(buffer, typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionCount")); + } + else + { + throw new Win32Exception("Device '" + devicePath + "' failed IOCTL_DISK_GET_DRIVE_LAYOUT_EX, status " + status.ToString()); + } + } + else + { + Console.WriteLine("IOCTL_DISK_GET_DRIVE_LAYOUT_EX passed"); + layout = Unmarshal_DRIVE_LAYOUT_INFORMATION_EX(buffer, bufferSize); + done = true; + } + + Marshal.FreeHGlobal(buffer); + buffer = IntPtr.Zero; + } + } + catch + { + throw; + } + finally + { + if (buffer != IntPtr.Zero) + Marshal.FreeHGlobal(buffer); + + if (hDevice != IntPtr.Zero) + CloseDevice(hDevice); + } + + return layout; + } + + static public void SetDriveLayout(string devicePath, DRIVE_LAYOUT_INFORMATION_EX layout) + { + bool boolResult = false; + IntPtr hDevice = IntPtr.Zero; + IntPtr buffer = IntPtr.Zero; + + try + { + hDevice = OpenDevice(devicePath); + uint bytesReturned = 0; + + uint bufferSize = (uint)Marshal.OffsetOf(typeof(DRIVE_LAYOUT_INFORMATION_EX), "PartitionEntry") + + (uint)Marshal.SizeOf(typeof(PARTITION_INFORMATION_EX)) * (uint)layout.PartitionEntry.Length; + buffer = Marshal.AllocHGlobal((int) bufferSize); + + Marshal_DRIVE_LAYOUT_INFORMATION_EX(layout, buffer, bufferSize); + + boolResult = DeviceIoControl(hDevice, + IOCTL_DISK_SET_DRIVE_LAYOUT_EX, + buffer, + (UInt32)bufferSize, + IntPtr.Zero, + 0, + ref bytesReturned, + IntPtr.Zero); + if (!boolResult) + { + throw new Win32Exception("Device '" + devicePath + "' failed IOCTL_DISK_SET_DRIVE_LAYOUT_EX, status " + Marshal.GetLastWin32Error().ToString()); + } + } + catch + { + throw; + } + finally + { + if (buffer != IntPtr.Zero) + Marshal.FreeHGlobal(buffer); + + if (hDevice != IntPtr.Zero) + CloseDevice(hDevice); + } + } + + static public void CleanupSblCachePartitions(string devicePath) + { + // First, get drive layout + DRIVE_LAYOUT_INFORMATION_EX layout = GetDriveLayout(devicePath); + + // Update layout by skipping SBL cache partitions + uint partitionCount = layout.PartitionCount; + uint partitionIndex = 0; + + for (uint idx = 0; idx < layout.PartitionCount; ++idx) + { + if ((layout.PartitionEntry[idx].Gpt.PartitionType == PARTITION_SBL_CACHE_SSD_GUID) || + (layout.PartitionEntry[idx].Gpt.PartitionType == PARTITION_SBL_CACHE_HDD_GUID) || + (layout.PartitionEntry[idx].Gpt.PartitionType == PARTITION_SBL_CACHE_SSD_RESERVED_GUID)) + { + --partitionCount; + } + else if (partitionIndex != idx) + { + layout.PartitionEntry[partitionIndex] = layout.PartitionEntry[idx]; + ++partitionIndex; + } + } + + // If layout has changed, set the new layout + if (partitionCount < layout.PartitionCount) + { + layout.PartitionCount = partitionCount; + SetDriveLayout(devicePath, layout); + } + } + + #endregion + } +} +"@ + +Add-Type -TypeDefinition $DiskControls -Language CSharp + +[Microsoft.SFS.StorageBusCache.StorageBusType[]]$Global:SupportedBusTypes = @([Microsoft.SFS.StorageBusCache.StorageBusType]::Sas, ` + [Microsoft.SFS.StorageBusCache.StorageBusType]::Sata, ` + [Microsoft.SFS.StorageBusCache.StorageBusType]::Nvme, ` + [Microsoft.SFS.StorageBusCache.StorageBusType]::SCM) + +$Global:SupportedBusTypeFlags = 0 +foreach ($busType in $Global:SupportedBusTypes) +{ + $Global:SupportedBusTypeFlags = $Global:SupportedBusTypeFlags -bor (1 -shl $busType) +} + +function CreateErrorRecord +{ + Param + ( + [String] + $ErrorId, + + [String] + $ErrorMessage, + + [System.Management.Automation.ErrorCategory] + $ErrorCategory, + + [Exception] + $Exception, + + [Object] + $TargetObject + ) + + if($Exception -eq $null) + { + $Exception = New-Object System.Management.Automation.RuntimeException $ErrorMessage + } + + $errorRecord = New-Object System.Management.Automation.ErrorRecord @($Exception, $ErrorId, $ErrorCategory, $TargetObject) + return $errorRecord +} + +function IsS2DEnabled +{ + $clusRegKeyPath = "HKLM:\Cluster" + if (Test-Path $clusRegKeyPath) + { + $clusRegKey = Get-ItemProperty $clusRegKeyPath -Name S2DEnabled -ErrorAction SilentlyContinue + if ($clusRegKey.S2DEnabled -eq 1) + { + return $true + } + } + return $false +} + +function GetAllDisks() +{ + Param () + + $deviceTable = @{} + # Get disk drives visible to PnP, skipping storage spaces virtual disks, if any + $pnpDrives = Get-PnpDevice -Class DiskDrive | ? FriendlyName -ne "Microsoft Storage Space Device" + $systemDisks = Get-Disk | ? { $_.IsSystem -eq $true -or $_.IsBoot -eq $true } + $systemDisks = $systemDisks | Get-PhysicalDisk + + foreach ($drive in $pnpDrives) + { + # Obtain device guid + $devicePathPrefix = "\\?\" + $($drive.DeviceID -replace "\\",'#') + + $devicePath = $devicePathPrefix + "#{" + [Microsoft.SFS.StorageBusCache.DeviceMgmt]::GUID_DEVINTERFACE_DISK + "}" + $disk = [Microsoft.SFS.StorageBusCache.DeviceMgmt]::GetStorageBusDisk($devicePath) + if ($disk.Guid -eq [GUID]::Empty.ToString()) + { + $hiddenDevicePath = $devicePathPrefix + "#{" + [Microsoft.SFS.StorageBusCache.DeviceMgmt]::GUID_DEVINTERFACE_HIDDEN_DISK + "}" + $disk = [Microsoft.SFS.StorageBusCache.DeviceMgmt]::GetStorageBusDisk($hiddenDevicePath) + if ($disk.Guid -eq [GUID]::Empty.ToString()) + { + continue + } + } + + # Check if this is boot or system drive + $sysDisk = $systemDisks | ? ObjectId -match $disk.Guid | Select-Object -First 1 + if ($sysDisk) + { + # Skipping + continue + } + + # Add to device table + if ($disk.Guid -notin $deviceTable.Keys) + { + $deviceTable.Add($disk.Guid, $disk) + } + } + + return $deviceTable +} + + +function Set-StorageBusProfile +{ + [CmdletBinding(ConfirmImpact="High")] + Param + ( + [System.Boolean] + [Parameter( + Mandatory = $false)] + $ClaimFlash = $false + ) + + if (IsS2DEnabled) + { + $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` + -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` + -Exception $null ` + -TargetObject $null + $psCmdlet.WriteError($errorObject) + return + } + + # Disable before setting profile + Disable-StorageBusCache -Force $true + + # Wait for reauction after disable + Start-Sleep -Seconds 10 + + # Set Profile + try + { + $systemFlags = 0; + if ($ClaimFlash) + { + $systemFlags = [Microsoft.SFS.StorageBusCache.DeviceMgmt]::Standalone_Profile_Claim_Flash + } + else + { + $systemFlags = [Microsoft.SFS.StorageBusCache.DeviceMgmt]::Standalone_Profile_Default + } + + # Set profile in memory via clusbflt control + [Microsoft.SFS.StorageBusCache.DeviceMgmt]::SetClusBFltSystemFlags($systemFlags) | Out-Null + + # Set the bus types registry key in clusbflt registry + $clusbfltRegKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Services\clusbflt\Parameters" + $systemFlagsKeyName = "SystemFlags" + if (Test-Path $clusbfltRegKeyPath) + { + New-ItemProperty -Path $clusbfltRegKeyPath -Name $systemFlagsKeyName -Value $systemFlags -PropertyType DWord -Force | Out-Null + } + else + { + $errorObject = CreateErrorRecord -ErrorId "NotFound" ` + -ErrorMessage "ClusBFlt registry key not found" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + } + catch + { + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + $psCmdlet.WriteError($errorObject) + return + } + + # Enable after Setting profile + Enable-StorageBusCache +} + +function Enable-StorageBusCache +{ + [CmdletBinding(ConfirmImpact="None")] + Param () + + if (IsS2DEnabled) + { + $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` + -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` + -Exception $null ` + -TargetObject $null + $psCmdlet.WriteError($errorObject) + return + } + + # Set the bus types registry key in clusbflt registry + $clusbfltRegKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Services\clusbflt\Parameters" + $busTypeKeyName = "SupportedBusTypes" + if (Test-Path $clusbfltRegKeyPath) + { + New-ItemProperty -Path $clusbfltRegKeyPath -Name $busTypeKeyName -Value $Global:SupportedBusTypeFlags -Force | Out-Null + } + else + { + $errorObject = CreateErrorRecord -ErrorId "NotFound" ` + -ErrorMessage "ClusBFlt registry key not found" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + + # Enumerate all eligible disks + $devices = Get-StorageBusDisk + + # Claim disks + try + { + foreach ($device in $devices) + { + $devicePath = "\\?\Disk" + $device.Guid + + # Check if disk is clusbflt candidate + if (-not [Microsoft.SFS.StorageBusCache.DeviceMgmt]::IsClusBFltCandidate($devicePath, $Global:SupportedBusTypeFlags)) + { + continue + } + + # Reauction the disk + [Microsoft.SFS.StorageBusCache.DeviceMgmt]::ReauctionDevice($devicePath) | Out-Null + } + } + catch + { + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + $psCmdlet.WriteError($errorObject) + return + } +} + +function Disable-StorageBusCache +{ + [CmdletBinding(ConfirmImpact="High")] + Param + ( + [System.Boolean] + [Parameter( + Mandatory = $false)] + $Force = $false + ) + + if (IsS2DEnabled) + { + $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` + -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` + -Exception $null ` + -TargetObject $null + $psCmdlet.WriteError($errorObject) + return + } + + $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods + + # We should not release any devices until all bindings are removed, unless -Force is specified + if (-not $Force) + { + # Enumerate all eligible disks + $devices = Get-StorageBusDisk + + # Ensure there are no active bindings + foreach ($device in $devices) + { + $boundDevices = Get-StorageBusBinding -Guid $device.Guid + if ($boundDevices) + { + $errorObject = CreateErrorRecord -ErrorId "InvalidOperation" ` + -ErrorMessage "Found existing cache bindings" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` + -Exception $null ` + -TargetObject $null + $psCmdlet.WriteError($errorObject) + return + } + } + } + + # Enumerate all eligible disks + $devices = Get-StorageBusDisk + + # Clear the bus types registry key in clusbflt registry + $clusbfltRegKeyPath = "HKLM:\SYSTEM\CurrentControlSet\Services\clusbflt\Parameters" + $busTypeKeyName = "SupportedBusTypes" + if (Test-Path $clusbfltRegKeyPath) + { + New-ItemProperty -Path $clusbfltRegKeyPath -Name $busTypeKeyName -Value 0 -Force | Out-Null + } + else + { + $errorObject = CreateErrorRecord -ErrorId "NotFound" ` + -ErrorMessage "ClusBFlt registry key not found" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + + # Now release all devices. + try + { + foreach ($device in $devices) + { + $devicePath = "\\?\Disk" + $device.Guid + # Check if disk is clusbflt candidate + if (-not [Microsoft.SFS.StorageBusCache.DeviceMgmt]::IsClusBFltCandidate($devicePath, $Global:SupportedBusTypeFlags)) + { + continue + } + + # Reauction the disk + [Microsoft.SFS.StorageBusCache.DeviceMgmt]::ReauctionDevice($devicePath) | Out-Null + } + } + catch + { + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + $psCmdlet.WriteError($errorObject) + return + } +} + +function Get-StorageBusDisk +{ + [CmdletBinding( DefaultParameterSetName = "ByGuid")] + Param + ( + #### -------------------- Parameter sets ------------------------------------- #### + + [System.String] + [Parameter( + ParameterSetName = 'ByGuid', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + [Alias("Id")] + $Guid, + + [System.UInt16] + [Parameter( + ParameterSetName = 'ByNumber', + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $Number, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + ValueFromPipeline = $true, + Mandatory = $false)] + [ValidateNotNullOrEmpty()] + $PhysicalDisk + ) + + $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods + $paths = $(gwmi -namespace "root\wmi" ClusBfltDeviceInformation).PathInfo + + # Get all disks on this system + $devices = GetAllDisks + $physicalDisks = Get-PhysicalDisk + + # If device is claimed, update its properties based on path properties + foreach ($deviceGuid in $devices.Keys) + { + $phyDisk = $physicalDisks | ? ObjectId -Match $deviceGuid + if ($phyDisk) + { + # Set properties based on physical disk information + $devices[$deviceGuid].BusType = $phyDisk.BusType + $devices[$deviceGuid].Number = $phyDisk.DeviceId + } + + $path = $paths | ? DeviceGuid -Match $deviceGuid | Select-Object -First 1 + if (-not $path) + { + # Device is not claimed, but check if there is a claimed cache partition + if ($phyDisk) + { + # If the partition is claimed, the device guid on the path + # will be the cache partition guid + $cachePartTypeGuid = [Microsoft.SFS.StorageBusCache.DeviceMgmt]::PARTITION_SBL_CACHE_SSD_GUID.Guid + $partGuid = (Get-Disk -Number $phyDisk.DeviceId | Get-Partition | ? GptType -match $cachePartTypeGuid).Guid + if ($partGuid) + { + $path = $paths | ? DeviceGuid -Match $partGuid | Select-Object -First 1 + } + } + } + + if ($path) + { + if (-not $phyDisk) + { + # Set properties based on SBL path information since + # device is claimed but not exposed above SBL + $devices[$deviceGuid].BusType = $path.BusType + $devices[$deviceGuid].Number = $path.DeviceNumber + } + + # The following properties are SBL specific + if (($path.Attributes -band [Microsoft.SFS.StorageBusCache.ClusBflt.PathInfoAttribute]::Partition) -eq 0) + { + # Path does not correspond to cache partition from an unclaimed device + $devices[$deviceGuid].IsClaimed = $true + } + + if (($path.Attributes -band [Microsoft.SFS.StorageBusCache.ClusBflt.PathInfoAttribute]::Solid) -ne 0) + { + $devices[$deviceGuid].IsCache = $true + } + else + { + $devices[$deviceGuid].IsCache = $false + } + } + } + + [Microsoft.SFS.StorageBusCache.StorageBusDisk[]]$disks = @() + + # Enumerate the paths based on input + switch ($psCmdlet.ParameterSetName) + { + "ByGuid" + { + $disks = $devices.Values | ? Guid -match $Guid + break; + } + "ByNumber" + { + $disks = $devices.Values | ? Number -eq $Number + break; + } + "ByPhysicalDisk" + { + $diskGuid = $PhysicalDisk.ObjectId -Replace '.*:' -Replace '"' + $disks = $devices.Values | ? Guid -match $diskGuid + break; + } + } + + return $disks +} + +function Get-StorageBusBinding +{ + [CmdletBinding(ConfirmImpact="None")] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'ByGuid', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("Id")] + $Guid, + + [System.UInt16] + [Parameter( + ParameterSetName = 'ByNumber', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $Number, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $PhysicalDisk + + ) + + switch ($psCmdlet.ParameterSetName) + { + "ByGuid" { $devices = Get-StorageBusDisk -Guid $Guid; break; } + "ByNumber" { $devices = Get-StorageBusDisk -Number $Number; break; } + "ByPhysicalDisk" { $devices = Get-StorageBusDisk -Number $PhysicalDisk.DeviceId; break; } + } + + $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods + $paths = $(gwmi -namespace "root\wmi" ClusBfltDeviceInformation).PathInfo + $cs = gwmi -namespace "root\wmi" ClusBfltCacheStoresInformation + + [Microsoft.SFS.StorageBusCache.StorageBusBinding[]]$boundDevices = @() + + try + { + foreach ($device in $devices) + { + if ($device.IsCache) + { + $pathid = $pm.GetPathIdByDeviceGuid($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Read_Write, 0, 0, 0) + + if ($pathid.PathId -eq 0) + { + # This could be unclaimed cache device with claimed cache partition + $pathid.PathId = ($paths | ? DeviceNumber -eq $device.Number).Id + } + + if ($pathid.PathId -ne 0) + { + $cache = $cs.CacheStoreInfo | ? PathId -eq $pathid.PathId + + if ($cache) + { + $bindingRecords = $pm.QuerySsdBindingRecords($pathid.PathId, $cache.Id) + + foreach ($bindingRecord in $bindingRecords.BindingRecords.BindingRecords) + { + if (($bindingRecord.Flags -band [Microsoft.SFS.StorageBusCache.ClusBflt.CacheStoreBindingAttribute]::Enabled) -ne 0) + { + $boundDevice = Get-StorageBusDisk -Guid $bindingRecord.DeviceGuid + + [Microsoft.SFS.StorageBusCache.StorageBusBinding]$storageBusBinding = [Microsoft.SFS.StorageBusCache.StorageBusBinding]::new() + $storageBusBinding.Guid = $boundDevice.Guid + $storageBusBinding.Number = $boundDevice.Number + $storageBusBinding.IsCache = $boundDevice.IsCache + + $boundDevices += $storageBusBinding + } + } + } + } + } + else + { + $egPath = $pm.GetPathIdByDeviceGuid($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Engaged, 0, 0, 0) + if ($egPath.PathId -ne 0) + { + $hddBinding = $pm.QueryHddBinding($egPath.PathId) + $cache = $cs.CacheStoreInfo | ? Id -eq $hddBinding.BindingInfo.CacheStoreId + $cachePath = $paths | ? Id -eq $cache.PathId + $boundDevice = Get-StorageBusDisk -Guid $cachePath.DeviceGuid + if (-not $boundDevice) + { + # This could be unclaimed cache device with claimed cache partition + $boundDevice = Get-StorageBusDisk -Number $cachePath.DeviceNumber + } + + [Microsoft.SFS.StorageBusCache.StorageBusBinding]$storageBusBinding = [Microsoft.SFS.StorageBusCache.StorageBusBinding]::new() + $storageBusBinding.Guid = $boundDevice.Guid + $storageBusBinding.Number = $boundDevice.Number + $storageBusBinding.IsCache = $boundDevice.IsCache + + $boundDevices += $storageBusBinding + } + } + } + } + catch + { + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + $psCmdlet.WriteError($errorObject) + return + } + + $boundDevices +} + +function Enable-StorageBusDisk +{ + [CmdletBinding(ConfirmImpact="None")] + param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'ByGuid', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("Id")] + $Guid, + + [System.UInt16] + [Parameter( + ParameterSetName = 'ByNumber', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $Number, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $PhysicalDisk + ) + + if (IsS2DEnabled) + { + $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` + -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` + -Exception $null ` + -TargetObject $null + $psCmdlet.WriteError($errorObject) + return + } + + switch ($psCmdlet.ParameterSetName) + { + "ByGuid" { $devices = Get-StorageBusDisk -Guid $Guid; break; } + "ByNumber" { $devices = Get-StorageBusDisk -Number $Number; break; } + "ByPhysicalDisk" { $devices = Get-StorageBusDisk -Number $PhysicalDisk.DeviceId; break; } + } + + # Filter out claimed devices + $devices = $devices | ? IsClaimed -eq $false + + $dm = gwmi -namespace "root\wmi" ClusBfltDeviceMethods + + foreach ($device in $devices) + { + try + { + # Have clusbflt claim the drive + $dm.SetDeviceAttributes($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::Default, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) + + # Reauction the disk + $devicePath = "\\?\Disk" + $device.Guid + [Microsoft.SFS.StorageBusCache.DeviceMgmt]::ReauctionDevice($devicePath) | Out-Null + } + catch + { + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + $psCmdlet.WriteError($errorObject) + return + } + } +} + +function Disable-StorageBusDisk +{ + [CmdletBinding(ConfirmImpact="High")] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'ByGuid', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("Id")] + $Guid, + + [System.UInt16] + [Parameter( + ParameterSetName = 'ByNumber', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $Number, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $PhysicalDisk + ) + + if (IsS2DEnabled) + { + $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` + -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` + -Exception $null ` + -TargetObject $null + $psCmdlet.WriteError($errorObject) + return + } + + switch ($psCmdlet.ParameterSetName) + { + "ByGuid" { $devices = Get-StorageBusDisk -Guid $Guid; break; } + "ByNumber" { $devices = Get-StorageBusDisk -Number $Number; break; } + "ByPhysicalDisk" { $devices = Get-StorageBusDisk -Number $PhysicalDisk.DeviceId; break; } + } + + # Filter out unclaimed devices + $devices = $devices | ? IsClaimed -eq $true + + $dm = gwmi -namespace "root\wmi" ClusBfltDeviceMethods + $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods + + foreach ($device in $devices) + { + if ($device.IsCache) + { + # First unbind all bound capacity devices + $boundDevices = Get-StorageBusBinding -Guid $device.Guid + if ($boundDevices) + { + $errorObject = CreateErrorRecord -ErrorId "InvalidOperation" ` + -ErrorMessage "Cache device is currently bound" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` + -Exception $null ` + -TargetObject $null + $psCmdlet.WriteError($errorObject) + return + } + } + else + { + # Remove bindings from cache and capacity dev + Remove-StorageBusBinding -Guid $device.Guid + } + + try + { + # Have clusbflt unclaim the drive + $dm.SetDeviceAttributes($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::Disabled, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) + + # Reauction the disk + $devicePath = "\\?\Disk" + $device.Guid + [Microsoft.SFS.StorageBusCache.DeviceMgmt]::ReauctionDevice($devicePath) | Out-Null + } + catch + { + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + $psCmdlet.WriteError($errorObject) + return + } + } +} + +function Resume-StorageBusDisk +{ + [CmdletBinding(ConfirmImpact="Low")] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'ByGuid', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("Id")] + $Guid, + + [System.UInt16] + [Parameter( + ParameterSetName = 'ByNumber', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $Number, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $PhysicalDisk + ) + + if (IsS2DEnabled) + { + $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` + -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` + -Exception $null ` + -TargetObject $null + $psCmdlet.WriteError($errorObject) + return + } + + switch ($psCmdlet.ParameterSetName) + { + "ByGuid" { $devices = Get-StorageBusDisk -Guid $Guid; break; } + "ByNumber" { $devices = Get-StorageBusDisk -Number $Number; break; } + "ByPhysicalDisk" { $devices = Get-StorageBusDisk -Number $PhysicalDisk.DeviceId; break; } + } + + $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods + $paths = $(gwmi -namespace "root\wmi" ClusBfltDeviceInformation).PathInfo + + foreach ($device in $devices) + { + if ($device.IsCache) + { + # First resume all bound capacity devices + $boundDevices = Get-StorageBusBinding -Guid $device.Guid + foreach ($boundDevice in $boundDevices) + { + Resume-StorageBusDisk -Guid $boundDevice.Guid + } + } + else + { + try + { + $egPath = $pm.GetPathIdByDeviceGuid($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Engaged, 0, 0, 0) + if ($egPath.PathId -ne 0) + { + # Obtain the capacity device binding info + $binding = $pm.QueryHddBinding($egPath.PathId).BindingInfo + + # Obtain the cache store + $cs = gwmi -namespace "root\wmi" ClusBfltCacheStoresInformation + $cache = $cs.CacheStoreInfo | ? Id -Match $binding.CacheStoreId + + # Obtain binding record that matches binding Id + $bindingRecord = $pm.QuerySsdBindingRecords($cache.PathId, $cache.Id).BindingRecords.BindingRecords | ? BindingId -Match $binding.BindingId + + if ($bindingRecord -ne $null) + { + # Set cache binding attribute back to default + $pm.SetSsdBindingAttributes($cache.PathId, [Microsoft.SFS.StorageBusCache.ClusBflt.CacheStoreBindingAttribute]::Default, [Microsoft.SFS.StorageBusCache.ClusBflt.CacheStoreBindingAttribute]::Disable_Write_Cache, $cache.Id, $binding.BindingId) + } + } + } + catch + { + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + $psCmdlet.WriteError($errorObject) + return + } + } + } +} + +function Suspend-StorageBusDisk +{ + [CmdletBinding(ConfirmImpact="High")] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'ByGuid', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("Id")] + $Guid, + + [System.UInt16] + [Parameter( + ParameterSetName = 'ByNumber', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $Number, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $PhysicalDisk + ) + + if (IsS2DEnabled) + { + $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` + -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` + -Exception $null ` + -TargetObject $null + $psCmdlet.WriteError($errorObject) + return + } + + switch ($psCmdlet.ParameterSetName) + { + "ByGuid" { $devices = Get-StorageBusDisk -Guid $Guid; break; } + "ByNumber" { $devices = Get-StorageBusDisk -Number $Number; break; } + "ByPhysicalDisk" { $devices = Get-StorageBusDisk -Number $PhysicalDisk.DeviceId; break; } + } + + $dm = gwmi -namespace "root\wmi" ClusBfltDeviceMethods + $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods + + foreach ($device in $devices) + { + if ($device.IsCache) + { + # First suspend all bound capacity devices + $boundDevices = Get-StorageBusBinding -Guid $device.Guid + foreach ($boundDevice in $boundDevices) + { + Suspend-StorageBusDisk -Guid $boundDevice.Guid + } + } + else + { + try + { + $egPath = $pm.GetPathIdByDeviceGuid($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Engaged, 0, 0, 0) + if ($egPath.PathId -ne 0) + { + # Obtain the capacity device binding info + $binding = $pm.QueryHddBinding($egPath.PathId).BindingInfo + + # Obtain the cache store + $cs = gwmi -namespace "root\wmi" ClusBfltCacheStoresInformation + $cache = $cs.CacheStoreInfo | ? Id -Match $binding.CacheStoreId + + # Obtain binding record that matches binding Id + $bindingRecord = $pm.QuerySsdBindingRecords($cache.PathId, $cache.Id).BindingRecords.BindingRecords | ? BindingId -Match $binding.BindingId + + if ($bindingRecord -ne $null -and ($bindingRecord.Flags -band [Microsoft.SFS.StorageBusCache.ClusBflt.CacheStoreBindingAttribute]::Enabled) -ne 0) + { + # Disable Write cache + $pm.SetSsdBindingAttributes($cache.PathId, [Microsoft.SFS.StorageBusCache.ClusBflt.CacheStoreBindingAttribute]::Disable_Write_Cache, [Microsoft.SFS.StorageBusCache.ClusBflt.CacheStoreBindingAttribute]::Disable_Write_Cache, $cache.Id, $binding.BindingId) + + # Wait for dirty page count to go down to 0 for this cache binding + while ($true) + { + if ($bindingRecord.cDirtyPages -eq 0 -and $bindingRecord.cDirtySlots -eq 0) + { + break + } + Start-Sleep -Seconds 10 + $bindingRecord = $pm.QuerySsdBindingRecords($cache.PathId, $cache.Id).BindingRecords.BindingRecords | ? BindingId -Match $binding.BindingId + } + } + } + } + catch + { + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + $psCmdlet.WriteError($errorObject) + return + } + } + } +} + +function New-StorageBusCacheStore +{ + [CmdletBinding(ConfirmImpact="Low")] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'ByGuid', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("Id")] + $Guid, + + [System.String] + [Parameter( + ParameterSetName = 'ByNumber', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $Number, + + #### -------------------- Common parameters -------------------------------------#### + + [System.UInt32] + [Parameter( + ParameterSetName = 'ByGuid', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByNumber', + Mandatory = $false)] + $PageSize = 8KB, + + [System.UInt64] + [Parameter( + ParameterSetName = 'ByGuid', + Mandatory = $false)] + [Parameter( + ParameterSetName = 'ByNumber', + Mandatory = $false)] + $ReserveCapacity = 0 + ) + + if (IsS2DEnabled) + { + $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` + -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` + -Exception $null ` + -TargetObject $null + $psCmdlet.WriteError($errorObject) + return + } + + switch ($psCmdlet.ParameterSetName) + { + "ByGuid" { $cacheDevice = Get-StorageBusDisk -Guid $Guid; break; } + "ByNumber" { $cacheDevice = Get-StorageBusDisk -Number $Number; break; } + } + + # Filter out unclaimed devices + $cacheDevice = $cacheDevice | ? IsClaimed -eq $true + + $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods + $dm = gwmi -namespace "root\wmi" ClusBfltDeviceMethods + + # Ensure exactly one cache device is obtained + if (-not $cacheDevice) + { + $errorObject = CreateErrorRecord -ErrorId "NotFound" ` + -ErrorMessage "Specified cache device not found" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + if ($cacheDevice.Count -ne 1) + { + $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` + -ErrorMessage "More than one matching cache device found" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + if (-not $cacheDevice.IsCache) + { + $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` + -ErrorMessage "Not a cache device" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + + $deviceAttributes = $dm.GetDeviceAttributes($cacheDevice.Guid) + + try + { + # Create cache store + $dm.SetDeviceAttributes($cacheDevice.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::Maintenance, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) + + $mmPath = $pm.GetPathIdByDeviceGuid($cacheDevice.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Maintenance, 0, 0, 0) + if ($mmPath) + { + $pm.CreateSsdCacheStore($mmPath.PathId, 0, $ReserveCapacity, $PageSize) + } + else + { + $errorObject = CreateErrorRecord -ErrorId "NotFound" ` + -ErrorMessage "Device path not found after setting Maintenance mode" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` + -Exception $null ` + -TargetObject $null + $psCmdlet.WriteError($errorObject) + return + } + } + catch + { + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + $psCmdlet.WriteError($errorObject) + return + } + finally + { + $dm.SetDeviceAttributes($cacheDevice.Guid, $deviceAttributes.Attributes, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) + } +} + +function New-StorageBusBinding +{ + [CmdletBinding(ConfirmImpact="Low")] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'ByGuid', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("CacheId")] + $CacheGuid, + + [System.String] + [Parameter( + ParameterSetName = 'ByGuid', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("CapacityId")] + $CapacityGuid, + + [System.String] + [Parameter( + ParameterSetName = 'ByNumber', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $CacheNumber, + + [System.String] + [Parameter( + ParameterSetName = 'ByNumber', + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $CapacityNumber + ) + + if (IsS2DEnabled) + { + $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` + -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` + -Exception $null ` + -TargetObject $null + $psCmdlet.WriteError($errorObject) + return + } + + switch ($psCmdlet.ParameterSetName) + { + "ByGuid" { $cacheDevice = Get-StorageBusDisk -Guid $CacheGuid; $capacityDevice = Get-StorageBusDisk -Guid $CapacityGuid; break; } + "ByNumber" { $cacheDevice = Get-StorageBusDisk -Number $CacheNumber; $capacityDevice = Get-StorageBusDisk -Number $CapacityNumber; break; } + } + + # Filter out unclaimed devices + $capacityDevice = $capacityDevice | ? IsClaimed -eq $true + + # Ensure exactly one cache device is obtained + if (-not $cacheDevice) + { + $errorObject = CreateErrorRecord -ErrorId "NotFound" ` + -ErrorMessage "Specified cache device not found" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + if ($cacheDevice.Count -ne 1) + { + $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` + -ErrorMessage "More than one matching cache device found" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + if (-not $cacheDevice.IsCache) + { + $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` + -ErrorMessage "Not a cache device" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + + # Ensure exactly one capacity device is obtained + if (-not $capacityDevice) + { + $errorObject = CreateErrorRecord -ErrorId "NotFound" ` + -ErrorMessage "Specified capacity device not found" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + if ($capacityDevice.Count -ne 1) + { + $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` + -ErrorMessage "More than one matching capacity device found" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + if ($capacityDevice.IsCache) + { + $errorObject = CreateErrorRecord -ErrorId "InvalidArgument" ` + -ErrorMessage "Not a capacity device" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidArgument) ` + -Exception $null ` + -TargetObject $null + + $psCmdlet.WriteError($errorObject) + return + } + + $dm = gwmi -namespace "root\wmi" ClusBfltDeviceMethods + $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods + $cs = gwmi -namespace "root\wmi" ClusBfltCacheStoresInformation + $paths = $(gwmi -namespace "root\wmi" ClusBfltDeviceInformation).PathInfo + + $deviceAttributes = $dm.GetDeviceAttributes($capacityDevice.Guid) + + try + { + # Obtain the cache store + $cache = $cs.CacheStoreInfo | ? DeviceGuid -Match $cacheDevice.Guid + + if ($cache -eq $null) + { + # This could be unclaimed cache device with claimed cache partition + $cachePath = $paths | ? DeviceNumber -eq $cacheDevice.Number + if ($cachePath) + { + $cache = $cs.CacheStoreInfo | ? DeviceGuid -Match $cachePath.DeviceGuid + } + } + + if ($cache -eq $null) + { + # No cache store found so create cache store + New-StorageBusCacheStore -Guid $cacheDevice.Guid -PageSize 8KB -ReserveCapacity 32GB + + # Obtain the cache store + $cs = gwmi -namespace "root\wmi" ClusBfltCacheStoresInformation + $cache = $cs.CacheStoreInfo | ? DeviceGuid -Match $cacheDevice.Guid + + if (-not $cache) + { + $errorObject = CreateErrorRecord -ErrorId "NotFound" ` + -ErrorMessage "No cache store found on cache device " + $cacheDevice.Guid ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` + -Exception $null ` + -TargetObject $null + $psCmdlet.WriteError($errorObject) + return + } + } + + # Check if the capacity device is already bound + $egPath = $pm.GetPathIdByDeviceGuid($capacityDevice.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Engaged, 0, 0, 0) + if ($egPath.PathId -eq 0) + { + # Bind Capacity device to cache store + $dm.SetDeviceAttributes($capacityDevice.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::Maintenance, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) + $mmPath = $pm.GetPathIdByDeviceGuid($capacityDevice.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Maintenance, 0, 0, 0) + + if ($mmPath.PathId -ne 0) + { + $pm.PrepareHddForCache($mmPath.PathId, 0) + $pm.BindHddToCacheStore($mmPath.PathId, [Microsoft.SFS.StorageBusCache.DeviceMgmt]::Standalone_Cache_Binding_Attributes, $cache.Id) + } + else + { + $errorObject = CreateErrorRecord -ErrorId "NotFound" ` + -ErrorMessage "Device path not found after setting Maintenance mode" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` + -Exception $null ` + -TargetObject $null + $psCmdlet.WriteError($errorObject) + return + } + } + else + { + $errorObject = CreateErrorRecord -ErrorId "InvalidOperation" ` + -ErrorMessage "Capacity device is already bound" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` + -Exception $null ` + -TargetObject $null + $psCmdlet.WriteError($errorObject) + return + } + } + catch + { + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + $psCmdlet.WriteError($errorObject) + return + } + finally + { + $dm.SetDeviceAttributes($capacityDevice.Guid, $deviceAttributes.Attributes, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) + } +} + +function Remove-StorageBusBinding +{ + [CmdletBinding(ConfirmImpact="High")] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'ByGuid', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("Id")] + $Guid, + + [System.UInt16] + [Parameter( + ParameterSetName = 'ByNumber', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $Number, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $PhysicalDisk + ) + + if (IsS2DEnabled) + { + $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` + -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` + -Exception $null ` + -TargetObject $null + $psCmdlet.WriteError($errorObject) + return + } + + switch ($psCmdlet.ParameterSetName) + { + "ByGuid" { $devices = Get-StorageBusDisk -Guid $Guid; break; } + "ByNumber" { $devices = Get-StorageBusDisk -Number $Number; break; } + "ByPhysicalDisk" { $devices = Get-StorageBusDisk -Number $PhysicalDisk.DeviceId; break; } + } + + # Filter out unclaimed devices + $devices = $devices | ? IsClaimed -eq $true + + $dm = gwmi -namespace "root\wmi" ClusBfltDeviceMethods + $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods + + foreach ($device in $devices) + { + if ($device.IsCache) + { + # First unbind all bound capacity devices + $boundDevices = Get-StorageBusBinding -Guid $device.Guid + foreach ($boundDevice in $boundDevices) + { + Remove-StorageBusBinding -Guid $boundDevice.Guid + } + } + else + { + try + { + $deviceAttributes = $dm.GetDeviceAttributes($device.Guid) + + $egPath = $pm.GetPathIdByDeviceGuid($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Engaged, 0, 0, 0) + if ($egPath.PathId -ne 0) + { + # Disable write cache and drain IOs + Suspend-StorageBusDisk -Guid $device.Guid + + # Unbind HDD + $dm.SetDeviceAttributes($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::Maintenance, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) + $mmPath = $pm.GetPathIdByDeviceGuid($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Maintenance, 0, 0, 0) + if ($mmPath.PathId -ne 0) + { + $pm.UnBindHdd($mmPath.PathId, 0) + } + else + { + $errorObject = CreateErrorRecord -ErrorId "NotFound" ` + -ErrorMessage "Device path not found after setting Maintenance mode" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` + -Exception $null ` + -TargetObject $null + $psCmdlet.WriteError($errorObject) + return + } + } + } + catch + { + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + $psCmdlet.WriteError($errorObject) + return + } + finally + { + $dm.SetDeviceAttributes($device.Guid, $deviceAttributes.Attributes, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) + } + } + } +} + +function Clear-StorageBusDisk +{ + [CmdletBinding(ConfirmImpact="High")] + Param + ( + #### -------------------- Parameter sets -------------------------------------#### + + [System.String] + [Parameter( + ParameterSetName = 'ByGuid', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [Alias("Id")] + $Guid, + + [System.UInt16] + [Parameter( + ParameterSetName = 'ByNumber', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $Number, + + [Microsoft.Management.Infrastructure.CimInstance] + [PSTypeName("Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_PhysicalDisk")] + [Parameter( + ParameterSetName = 'ByPhysicalDisk', + ValueFromPipeline = $true, + Mandatory = $true)] + [ValidateNotNullOrEmpty()] + $PhysicalDisk + ) + + if (IsS2DEnabled) + { + $errorObject = CreateErrorRecord -ErrorId "Cluster S2D is enabled" ` + -ErrorMessage "StorageBusCache Cmdlets cannot be run on a cluster S2D setup" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::InvalidOperation) ` + -Exception $null ` + -TargetObject $null + $psCmdlet.WriteError($errorObject) + return + } + + switch ($psCmdlet.ParameterSetName) + { + "ByGuid" { $devices = Get-StorageBusDisk -Guid $Guid; break; } + "ByNumber" { $devices = Get-StorageBusDisk -Number $Number; break; } + "ByPhysicalDisk" { $devices = Get-StorageBusDisk -Number $PhysicalDisk.DeviceId; break; } + } + + # Filter out unclaimed devices + $devices = $devices | ? IsClaimed -eq $true + + $dm = gwmi -namespace "root\wmi" ClusBfltDeviceMethods + $pm = gwmi -namespace "root\wmi" ClusBfltPathMethods + + foreach ($device in $devices) + { + $deviceAttributes = $dm.GetDeviceAttributes($device.Guid) + + try + { + $dm.SetDeviceAttributes($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::Maintenance, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) + $mmPath = $pm.GetPathIdByDeviceGuid($device.Guid, [Microsoft.SFS.StorageBusCache.ClusBflt.PathType]::Maintenance, 0, 0, 0) + + if ($mmPath.PathId -ne 0) + { + # Remove all cache partitions on the disk + $devicePath = "\\?\Disk" + $device.Guid + [Microsoft.SFS.StorageBusCache.DeviceMgmt]::CleanupSblCachePartitions($devicePath) | Out-Null + } + else + { + $errorObject = CreateErrorRecord -ErrorId "NotFound" ` + -ErrorMessage "Device path not found after setting Maintenance mode" ` + -ErrorCategory ([System.Management.Automation.ErrorCategory]::ObjectNotFound) ` + -Exception $null ` + -TargetObject $null + $psCmdlet.WriteError($errorObject) + return + } + } + catch + { + $errorObject = CreateErrorRecord -ErrorId $_.FullyQualifiedErrorId ` + -ErrorMessage $null ` + -ErrorCategory $_.CategoryInfo.Category ` + -Exception $_.Exception ` + -TargetObject $_.TargetObject + $psCmdlet.WriteError($errorObject) + return + } + finally + { + $dm.SetDeviceAttributes($device.Guid, $deviceAttributes.Attributes, [Microsoft.SFS.StorageBusCache.ClusBflt.DiskAttribute]::All) + } + } +} diff --git a/newton-cn/bin/v1.0/Modules/StorageBusCache/StorageBusCache.types.ps1xml b/newton-cn/bin/v1.0/Modules/StorageBusCache/StorageBusCache.types.ps1xml new file mode 100644 index 0000000..1e2fd8e --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/StorageBusCache/StorageBusCache.types.ps1xml @@ -0,0 +1,19 @@ + + + + + StorageBusDisk + + + DiskNumber + Number + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/TLS/tls.psd1 b/newton-cn/bin/v1.0/Modules/TLS/tls.psd1 new file mode 100644 index 0000000..cbd26a5 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/TLS/tls.psd1 @@ -0,0 +1,25 @@ +@{ +GUID="{1E28C697-2370-42F2-ACE1-5AC8777F8053}" +Author="Microsoft Corporation" +CompanyName="Microsoft Corporation" +Copyright="© Microsoft Corporation. All rights reserved." +ModuleVersion="2.0.0.0" +PowerShellVersion="5.1" +CLRVersion="4.0" +ModuleToProcess="Microsoft.WindowsAuthenticationProtocols.Commands" +HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=287167" +CmdletsToExport= + "New-TlsSessionTicketKey", + "Enable-TlsSessionTicketKey", + "Disable-TlsSessionTicketKey", + "Export-TlsSessionTicketKey", + "Get-TlsCipherSuite", + "Enable-TlsCipherSuite", + "Disable-TlsCipherSuite", + "Get-TlsEccCurve", + "Enable-TlsEccCurve", + "Disable-TlsEccCurve" +CompatiblePSEditions= + "Core", + "Desktop" +} diff --git a/newton-cn/bin/v1.0/Modules/TroubleshootingPack/TroubleshootingPack.format.ps1xml b/newton-cn/bin/v1.0/Modules/TroubleshootingPack/TroubleshootingPack.format.ps1xml new file mode 100644 index 0000000..9ff58bb --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/TroubleshootingPack/TroubleshootingPack.format.ps1xml @@ -0,0 +1,383 @@ + + + + DiagPack + + Microsoft.Windows.Diagnosis.DiagPack + + + + + + 25 + left + + + + 40 + left + + + + 40 + left + + + + 15 + left + + + + + + + Id + + + Name + + + Publisher + + + Version + + + + + + + + DiagRootCause + + Microsoft.Windows.Diagnosis.DiagRootCause + + + + + + 120 + left + + + + + + + Name + + + + + + + + DiagRootCause + + Microsoft.Windows.Diagnosis.DiagRootCause + + + + + + 120 + left + + + + + + + Name + + + + + + + + DiagResolution + + Microsoft.Windows.Diagnosis.DiagResolution + + + + + + 75 + left + + + + 10 + left + + + + 15 + left + + + + 20 + left + + + + + + + Name + + + Manual + + + RequiresElevation + + + RequiresInteraction + + + + + + + + DiagInteraction + + Microsoft.Windows.Diagnosis.DiagInteraction + + + + + + 85 + left + + + + 15 + left + + + + 20 + left + + + + + + + Name + + + ($_.Dynamic -eq $false) + + + AnswerType + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/TroubleshootingPack/TroubleshootingPack.psd1 b/newton-cn/bin/v1.0/Modules/TroubleshootingPack/TroubleshootingPack.psd1 new file mode 100644 index 0000000..0e0b5e4 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/TroubleshootingPack/TroubleshootingPack.psd1 @@ -0,0 +1,14 @@ +@{ + GUID="{d6fdb0d8-2b0f-406b-afc6-68f60569ebdf}" + Author="Microsoft Corporation" + CompanyName="Microsoft Corporation" + Copyright="© Microsoft Corporation. All rights reserved." + ModuleVersion="1.0.0.0" + PowerShellVersion = '5.1' + CLRVersion="4.0" + FormatsToProcess="TroubleshootingPack.Format.ps1xml" + NestedModules="Microsoft.Windows.Diagnosis.TroubleshootingPack" + HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=285571" + CmdletsToExport = "Get-TroubleshootingPack","Invoke-TroubleshootingPack" + CompatiblePSEditions = @("Desktop", "Core") +} diff --git a/newton-cn/bin/v1.0/Modules/TrustedPlatformModule/TrustedPlatformModule.psd1 b/newton-cn/bin/v1.0/Modules/TrustedPlatformModule/TrustedPlatformModule.psd1 new file mode 100644 index 0000000..7427bf4 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/TrustedPlatformModule/TrustedPlatformModule.psd1 @@ -0,0 +1,26 @@ +@{ +GUID="{17fc1f02-cff3-45fb-ac4f-126594c70b1e}" +Author="Microsoft Corporation" +CompanyName="Microsoft Corporation" +Copyright="© Microsoft Corporation. All rights reserved." +ModuleVersion="2.0.0.0" +ModuleToProcess="Microsoft.Tpm.Commands" +PowerShellVersion = '5.1' +CLRVersion="4.0" +AliasesToExport = @() +FunctionsToExport = @() +CmdletsToExport= + "Get-Tpm", + "Initialize-Tpm", + "Clear-Tpm", + "Unblock-Tpm", + "Enable-TpmAutoProvisioning", + "Disable-TpmAutoProvisioning", + "Import-TpmOwnerAuth", + "Set-TpmOwnerAuth", + "ConvertTo-TpmOwnerAuth", + "Get-TpmEndorsementKeyInfo", + "Get-TpmSupportedFeature" +HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=390838" +CompatiblePSEditions = @('Desktop','Core') +} diff --git a/newton-cn/bin/v1.0/Modules/UEV/Microsoft.Uev.Commands.dll b/newton-cn/bin/v1.0/Modules/UEV/Microsoft.Uev.Commands.dll new file mode 100644 index 0000000..1f5a569 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/UEV/Microsoft.Uev.Commands.dll differ diff --git a/newton-cn/bin/v1.0/Modules/UEV/UEV.Types.ps1xml b/newton-cn/bin/v1.0/Modules/UEV/UEV.Types.ps1xml new file mode 100644 index 0000000..120e8c8 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/UEV/UEV.Types.ps1xml @@ -0,0 +1,30 @@ + + + + Microsoft.Uev.Commands.Template + + + PsStandardMembers + + + DefaultDisplayProperty + TemplateName + + + DefaultDisplayPropertySet + + TemplateId + TemplateName + TemplateDescription + TemplateVersion + TemplateType + Enabled + EnableStateLocation + TemplateProfile + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/UEV/UEV.psd1 b/newton-cn/bin/v1.0/Modules/UEV/UEV.psd1 new file mode 100644 index 0000000..9c19fa1 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/UEV/UEV.psd1 differ diff --git a/newton-cn/bin/v1.0/Modules/VpnClient/PS_EapConfiguration_v1.0.0.cdxml b/newton-cn/bin/v1.0/Modules/VpnClient/PS_EapConfiguration_v1.0.0.cdxml new file mode 100644 index 0000000..2c7cfb0 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/VpnClient/PS_EapConfiguration_v1.0.0.cdxml @@ -0,0 +1,165 @@ + + + + 1.0.0 + EapConfiguration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Pap + Chap + MSChap + MSChapv2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionIPsecConfiguration_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionIPsecConfiguration_v1.0.cdxml new file mode 100644 index 0000000..2d998a2 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionIPsecConfiguration_v1.0.cdxml @@ -0,0 +1,192 @@ + + + + 1.0 + VpnConnectionIPsecConfiguration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionProxy_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionProxy_v1.0.cdxml new file mode 100644 index 0000000..746a58e --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionProxy_v1.0.cdxml @@ -0,0 +1,72 @@ + + + + 1.0 + VpnConnectionProxy + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionRoute_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionRoute_v1.0.cdxml new file mode 100644 index 0000000..8bcc14c --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionRoute_v1.0.cdxml @@ -0,0 +1,112 @@ + + + + 1.0 + VpnConnectionRoute + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionTriggerApplication_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionTriggerApplication_v1.0.cdxml new file mode 100644 index 0000000..aa8a630 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionTriggerApplication_v1.0.cdxml @@ -0,0 +1,99 @@ + + + + 1.0 + VpnConnectionTriggerApplication + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionTriggerDnsConfiguration_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionTriggerDnsConfiguration_v1.0.cdxml new file mode 100644 index 0000000..28ef9a7 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionTriggerDnsConfiguration_v1.0.cdxml @@ -0,0 +1,162 @@ + + + + 1.0 + VpnConnectionTriggerDnsConfiguration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionTriggerTrustedNetwork_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionTriggerTrustedNetwork_v1.0.cdxml new file mode 100644 index 0000000..8ade665 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionTriggerTrustedNetwork_v1.0.cdxml @@ -0,0 +1,144 @@ + + + + 1.0 + VpnConnectionTriggerTrustedNetwork + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionTrigger_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionTrigger_v1.0.cdxml new file mode 100644 index 0000000..5b03745 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnectionTrigger_v1.0.cdxml @@ -0,0 +1,33 @@ + + + + 1.0 + VpnConnectionTrigger + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnection_v1.0.0.cdxml b/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnection_v1.0.0.cdxml new file mode 100644 index 0000000..517b729 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnConnection_v1.0.0.cdxml @@ -0,0 +1,590 @@ + + + + 1.0.0 + VpnConnection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Pptp + L2tp + Sstp + Ikev2 + Automatic + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Pap + Chap + MSChapv2 + Eap + MachineCertificate + + + + + + + + + + NoEncryption + Optional + Required + Maximum + Custom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Pptp + L2tp + Sstp + Ikev2 + Automatic + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Pap + Chap + MSChapv2 + Eap + MachineCertificate + + + + + + + + + + + + + + + + + + + + + + + + NoEncryption + Optional + Required + Maximum + Custom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + enable + disable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnServerAddress_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnServerAddress_v1.0.cdxml new file mode 100644 index 0000000..6599b99 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/VpnClient/PS_VpnServerAddress_v1.0.cdxml @@ -0,0 +1,40 @@ + + + + 1.0 + VpnServerAddress + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/VpnClient/VpnClient.psd1 b/newton-cn/bin/v1.0/Modules/VpnClient/VpnClient.psd1 new file mode 100644 index 0000000..0e11689 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/VpnClient/VpnClient.psd1 @@ -0,0 +1,20 @@ +@{ + GUID = '3389cc73-daa3-4d25-bd50-b1730925d2df' + Author = 'Microsoft Corporation' + CompanyName = 'Microsoft Corporation' + Copyright = '© Microsoft Corporation. All rights reserved.' + ModuleVersion = '2.0.0.0' + PowerShellVersion = '5.1' + + FormatsToProcess = 'VpnClientPsProvider.Format.ps1xml' + TypesToProcess = 'VpnClientPSProvider.Types.ps1xml' + + HelpInfoUri="http://go.microsoft.com/fwlink/?linkid=390842" + + NestedModules = @("PS_VpnConnection_v1.0.0.cdxml", "PS_EapConfiguration_v1.0.0.cdxml", "PS_VpnConnectionProxy_v1.0.cdxml", "PS_VpnServerAddress_v1.0.cdxml", "PS_VpnConnectionRoute_v1.0.cdxml", "PS_VpnConnectionIPsecConfiguration_v1.0.cdxml", "PS_VpnConnectionTrigger_v1.0.cdxml", "PS_VpnConnectionTriggerApplication_v1.0.cdxml","PS_VpnConnectionTriggerDnsConfiguration_v1.0.cdxml","PS_VpnConnectionTriggerTrustedNetwork_v1.0.cdxml") + + AliasesToExport = @() + CmdletsToExport = @() + FunctionsToExport = @("Add-VpnConnection", "Set-VpnConnection", "Remove-VpnConnection", "Get-VpnConnection", "New-EapConfiguration", "Set-VpnConnectionProxy", "New-VpnServerAddress", "Add-VpnConnectionRoute", "Remove-VpnConnectionRoute", "Set-VpnConnectionIPsecConfiguration", "Add-VpnConnectionTriggerApplication","Remove-VpnConnectionTriggerApplication","Add-VpnConnectionTriggerDnsConfiguration","Remove-VpnConnectionTriggerDnsConfiguration","Set-VpnConnectionTriggerDnsConfiguration", "Get-VpnConnectionTrigger", "Add-VpnConnectionTriggerTrustedNetwork", "Remove-VpnConnectionTriggerTrustedNetwork", "Set-VpnConnectionTriggerTrustedNetwork") + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/VpnClient/VpnClientPSProvider.Format.ps1xml b/newton-cn/bin/v1.0/Modules/VpnClient/VpnClientPSProvider.Format.ps1xml new file mode 100644 index 0000000..9d60f7b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/VpnClient/VpnClientPSProvider.Format.ps1xml @@ -0,0 +1,838 @@ + + + + + + VpnCommonConfig_Table + + Microsoft.Management.Infrastructure.CimInstance#VpnCommonConfig + + + + + 15 + + + 20 + + + 15 + + + 20 + + + 20 + + + + + + + Name + + + ServerAddress + + + ProfileType + + + ConnectionStatus + + + IsAutoTriggerEnabled + + + + + + + + VpnCommonConfig_Wide + + Microsoft.Management.Infrastructure.CimInstance#VpnCommonConfig + + + + + + Name + + + + + + + VpnConnection_List + + Microsoft.Management.Infrastructure.CimInstance#VpnConnection + + + + + + + Name + + + ServerAddress + + + AllUserConnection + + + Guid + + + TunnelType + + + AuthenticationMethod + + + EncryptionLevel + + + L2tpIPsecAuth + + + UseWinlogonCredential + + + EapConfigXmlStream + + + ConnectionStatus + + + RememberCredential + + + SplitTunneling + + + DnsSuffix + + + IdleDisconnectSeconds + + + + + + + + ThirdPartyVpnConnection_List + + Microsoft.Management.Infrastructure.CimInstance#ThirdPartyVpnConnection + + + + + + + Name + + + ServerAddress + + + Guid + + + ConnectionStatus + + + RememberCredential + + + SplitTunneling + + + DnsSuffix + + + IdleDisconnectSeconds + + + PlugInApplicationID + + + CustomConfiguration + + + + + + + + EapConfiguration_List + + Microsoft.Management.Infrastructure.CimInstance#EapConfiguration + + + + + + + EapConfigXmlStream + + + + + + + + EapConfiguration_Table + + Microsoft.Management.Infrastructure.CimInstance#EapConfiguration + + + + + 80 + + + + + + + EapConfigXmlStream + + + + + + + + EapConfiguration_Wide + + Microsoft.Management.Infrastructure.CimInstance#EapConfiguration + + + + + + EapConfigXmlStream + + + + + + + VpnServerAddress_List + + Microsoft.Management.Infrastructure.CimInstance#VpnServerAddress + + + + + + + ServerAddress + + + FriendlyName + + + + + + + + VpnServerAddress_Table + + Microsoft.Management.Infrastructure.CimInstance#VpnServerAddress + + + + + 20 + + + 20 + + + + + + + ServerAddress + + + FriendlyName + + + + + + + + VpnServerAddress_Wide + + Microsoft.Management.Infrastructure.CimInstance#VpnServerAddress + + + + + + FriendlyName + + + + + + + VpnConnectionIPsecConfiguration_List + + Microsoft.Management.Infrastructure.CimInstance#VpnConnectionIPsecConfiguration + + + + + + + AuthenticationTransformConstants + + + CipherTransformConstants + + + DHGroup + + + IntegrityCheckMethod + + + PfsGroup + + + EncryptionMethod + + + + + + + + VpnConnectionIPsecConfiguration_Table + + Microsoft.Management.Infrastructure.CimInstance#VpnConnectionIPsecConfiguration + + + + + 20 + + + 20 + + + 20 + + + 20 + + + 20 + + + 20 + + + + + + + AuthenticationTransformConstants + + + CipherTransformConstants + + + DHGroup + + + IntegrityCheckMethod + + + PfsGroup + + + EncryptionMethod + + + + + + + + VpnConnectionTriggerApplication_List + + Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTriggerApplication + + + + + + + ConnectionName + + + ApplicationID + + + + + + + + VpnConnectionTriggerApplication_Table + + Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTriggerApplication + + + + + 20 + + + 20 + + + + + + + ConnectionName + + + ApplicationID + + + + + + + + VpnConnectionTriggerApplication_List + + Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTriggerApplication + + + + + + + ConnectionName + + + ApplicationID + + + + + + + + VpnConnectionTriggerTrustedNetwork_List + + Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTriggerTrustedNetwork + + + + + + + ConnectionName + + + DnsSuffix + + + + + + + + VpnConnectionTriggerTrustedNetwork_Table + + Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTriggerTrustedNetwork + + + + + 20 + + + 40 + + + + + + + ConnectionName + + + DnsSuffix + + + + + + + + VpnConnectionTriggerTrustedNetwork_Wide + + Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTriggerTrustedNetwork + + + + + + + ConnectionName + + + + + + + + VpnConnectionTriggerDnsConfiguration_Table + + Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTriggerDnsConfiguration + + + + + 20 + + + 20 + + + 40 + + + 40 + + + + + + + ConnectionName + + + DnsSuffix + + + DnsIPAddress + + + DnsSuffixSearchList + + + + + + + + MSFT_NetRoute_ListView + + Microsoft.Management.Infrastructure.CimInstance#MSFT_NetRoute + + + + + + + DestinationPrefix + + + InterfaceIndex + + + InterfaceAlias + + + AddressFamily + + + NextHop + + + Publish + + + RouteMetric + + + + Store + + + + + + + + VpnConnectionTrigger_Custom + + Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTrigger + + + + + + + + + + $outputStr = ""; + $outputStr += "ConnectionName : " + $_.ConnectionName + "`r`n"; + + $appidlist = $null + foreach($appid in $_.ApplicationID) + { + if($appidlist -ne $null) + { + $appidlist += ", " ; + } + $appidlist += $appid; + } + + if($appidlist -ne $null) + { + $outputStr += "ApplicationID : {" + $appidlist + "} `r`n"; + } + + $trustednetworklist = $null + foreach($trustednetwork in $_.TrustedNetwork) + { + if($trustednetworklist -ne $null) + { + $trustednetworklist += ", " ; + } + $trustednetworklist += $trustednetwork; + } + if($trustednetworklist -ne $null) + { + $outputStr += "TrustedNetwork : {" + $trustednetworklist + "} `r`n"; + } + + $dnssuffixsearchlist = $null + foreach($dnssearchsuffix in $_.DnsSuffixSearchList) + { + if($dnssuffixsearchlist -ne $null) + { + $dnssuffixsearchlist += ", "; + } + $dnssuffixsearchlist += $dnssearchsuffix; + } + if($dnssuffixsearchlist -ne $null) + { + $outputStr += "Dns Suffix Search List : " + $dnssuffixsearchlist + "`r`n"; + } + + if($_.dnsConfig -ne $null) + { + $dnsSuffixColWidth = 50; + $dnsServerColWidth = 50; + $spaceBtwCols = 10; + + $outputStr += "`r`n"; + $name = "Dns Suffix"; + $outputStr += $name; + $temp = $dnsSuffixColWidth + $spaceBtwCols - $name.Length; + while($temp -gt 0) + { + $outputStr += " "; + $temp = $temp - 1; + } + $outputStr += "Dns Servers `r`n"; + + $temp = 0; + while($temp -lt $dnsSuffixColWidth) + { + $outputStr += "_ "; + $temp = $temp + 2; + } + + $temp = 0; + while($temp -lt $spaceBtwCols) + { + $outputStr += " "; + $temp = $temp + 1; + } + + $temp = 0; + while($temp -lt $dnsServerColWidth) + { + $outputStr += "_ "; + $temp = $temp + 2; + } + $outputStr += "`r`n"; + + $dnsConfig = $null; + foreach($a in $_.dnsConfig) + { + $suffix = $a.DnsSuffix; + if($suffix.Length -gt 50) + { + $suffix = $suffix.Substring(0, $dnsSuffixColWidth - 3); + $suffix += "..."; + } + $dnsConfig += $suffix; + + $temp = $dnsSuffixColWidth + $spaceBtwCols - $suffix.Length; + while($temp -gt 0) + { + $dnsConfig += " "; + $temp = $temp - 1; + } + + $ipaddrlist = $null; + foreach($ipaddr in $a.DnsIPAddress) + { + if($ipaddrlist -ne $null) + { + $ipaddrlist += ", " ; + } + $ipaddrlist += $ipaddr; + } + + if($ipaddrlist -ne $null) + { + if($ipaddrlist.Length -gt $dnsServerColWidth) + { + $ipaddrlist = $ipaddrlist.Substring(0, $dnsServerColWidth - 3); + $ipaddrlist += "..."; + } + $dnsConfig += "{" + $ipaddrlist + "}"; + } + $dnsConfig += "`r`n"; + $outputStr += $dnsConfig; + $dnsConfig = $null; + } + } + $outputStr; + + + + + + + + + + + VpnConnectionProxy_List + + Microsoft.Management.Infrastructure.CimInstance#VpnConnectionProxy + + + + + + + AutoDetect + + + AutoConfigurationScript + + + ProxyServer + + + BypassProxyForLocal + + + ExceptionPrefix + + + + + + + + VpnConnectionProxy_Table + + Microsoft.Management.Infrastructure.CimInstance#VpnConnectionProxy + + + + + 20 + + + 40 + + + 40 + + + 20 + + + 40 + + + + + + + AutoDetect + + + AutoConfigurationScript + + + ProxyServer + + + BypassProxyForLocal + + + ExceptionPrefix + + + + + + + + VpnConnectionProxy_Wide + + Microsoft.Management.Infrastructure.CimInstance#VpnConnectionProxy + + + + + + ProxyServer + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/VpnClient/VpnClientPSProvider.Types.ps1xml b/newton-cn/bin/v1.0/Modules/VpnClient/VpnClientPSProvider.Types.ps1xml new file mode 100644 index 0000000..bc9f758 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/VpnClient/VpnClientPSProvider.Types.ps1xml @@ -0,0 +1,272 @@ + + + + + Microsoft.Management.Infrastructure.CimInstance#VpnConnection + + + EapConfigXmlStream + + [OutputType([System.Xml.XmlDocument])] + param() + [System.Xml.XmlDocument]($this.PSBase.CimInstanceProperties['EapConfigXmlStream'].value) + + + param([System.Xml.XmlDocument]$value) + $this.PSBase.CimInstanceProperties['EapConfigXmlStream'].value = $value + + + + VpnConfigurationXml + + [OutputType([System.Xml.XmlDocument])] + param() + [System.Xml.XmlDocument]($this.PSBase.CimInstanceProperties['VpnConfigurationXml'].value) + + + param([System.Xml.XmlDocument]$value) + $this.PSBase.CimInstanceProperties['VpnConfigurationXml'].value = $value + + + + IPSecCustomPolicy + + [OutputType([System.String[]])] + param() + $output = @() + foreach ($range in $this.PSBase.CimInstanceProperties['IPSecCustomPolicy'].value) + { + $output += $range + } + if ($output.Count -gt 0) + {,(@($output))} + else + {$null} + + + + MachineCertificateIssuerFilter + + [OutputType([System.Security.Cryptography.X509Certificates.X509Certificate2])] + param() + [System.Security.Cryptography.X509Certificates.X509Certificate2]($this.PSBase.CimInstanceProperties['MachineCertificateIssuerFilter'].Value) + + + param([System.Security.Cryptography.X509Certificates.X509Certificate2]$value) + $this.PSBase.CimInstanceProperties['MachineCertificateIssuerFilter'].Value = $value.RawData + + + + MachineCertificateEKUFilter + + [OutputType([System.String[]])] + param() + $output = @() + foreach ($range in $this.PSBase.CimInstanceProperties['MachineCertificateEKUFilter'].value) + { + $output += $range + } + if ($output.Count -gt 0) + {,(@($output))} + else + {$null} + + + + + + Microsoft.Management.Infrastructure.CimInstance#ThirdPartyVpnConnection + + + CustomConfiguration + + [OutputType([System.Xml.XmlDocument])] + param() + [System.Xml.XmlDocument]($this.PSBase.CimInstanceProperties['CustomConfiguration'].value) + + + param([System.Xml.XmlDocument]$value) + $this.PSBase.CimInstanceProperties['CustomConfiguration'].value = $value + + + + VpnConfigurationXml + + [OutputType([System.Xml.XmlDocument])] + param() + [System.Xml.XmlDocument]($this.PSBase.CimInstanceProperties['VpnConfigurationXml'].value) + + + param([System.Xml.XmlDocument]$value) + $this.PSBase.CimInstanceProperties['VpnConfigurationXml'].value = $value + + + + + + Microsoft.Management.Infrastructure.CimInstance#EapConfiguration + + + EapConfigXmlStream + + [OutputType([System.Xml.XmlDocument])] + param() + [System.Xml.XmlDocument]($this.PSBase.CimInstanceProperties['EapConfigXmlStream'].value) + + + param([System.Xml.XmlDocument]$value) + $this.PSBase.CimInstanceProperties['EapConfigXmlStream'].value = $value + + + + + + Microsoft.Management.Infrastructure.CimInstance#VpnConnectionIPsecConfiguration + + + AuthenticationTransformConstants + + [OutputType([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.AuthenticationTransformConstants])] + param() + [Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.AuthenticationTransformConstants]($this.PSBase.CimInstanceProperties['AuthenticationTransformConstants'].Value) + + + param([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.AuthenticationTransformConstants]$value) + $this.PSBase.CimInstanceProperties['AuthenticationTransformConstants'].Value = [System.Uint32]$value + + + + CipherTransformConstants + + [OutputType([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.CipherTransformConstants])] + param() + [Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.CipherTransformConstants]($this.PSBase.CimInstanceProperties['CipherTransformConstants'].Value) + + + param([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.CipherTransformConstants]$value) + $this.PSBase.CimInstanceProperties['CipherTransformConstants'].Value = [System.Uint32]$value + + + + DHGroup + + [OutputType([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.DHGroup])] + param() + [Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.DHGroup]($this.PSBase.CimInstanceProperties['DHGroup'].Value) + + + param([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.DHGroup]$value) + $this.PSBase.CimInstanceProperties['DHGroup'].Value = [System.Uint32]$value + + + + EncryptionMethod + + [OutputType([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.EncryptionMethod])] + param() + [Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.EncryptionMethod]($this.PSBase.CimInstanceProperties['EncryptionMethod'].Value) + + + param([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.EncryptionMethod]$value) + $this.PSBase.CimInstanceProperties['EncryptionMethod'].Value = [System.Uint32]$value + + + + IntegrityCheckMethod + + [OutputType([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.IntegrityCheckMethod])] + param() + [Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.IntegrityCheckMethod]($this.PSBase.CimInstanceProperties['IntegrityCheckMethod'].Value) + + + param([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.IntegrityCheckMethod]$value) + $this.PSBase.CimInstanceProperties['IntegrityCheckMethod'].Value = [System.Uint32]$value + + + + PfsGroup + + [OutputType([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.PfsGroup])] + param() + [Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.PfsGroup]($this.PSBase.CimInstanceProperties['PfsGroup'].Value) + + + param([Microsoft.Powershell.Cmdletization.GeneratedTypes.VpnConnectionIPsecConfiguration.PfsGroup]$value) + $this.PSBase.CimInstanceProperties['PfsGroup'].Value = [System.Uint32]$value + + + + + + Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTriggerApplication + + + ApplicationID + + [OutputType([System.String])] + param() + $output = @() + foreach($range in $this.PSBase.CimInstanceProperties['ApplicationID'].Value) + { + $output += $range + } + if ($output.Count -gt 0) + {,(@($output))} + else + {$null} + + + + + + Microsoft.Management.Infrastructure.CimInstance#VpnConnectionTriggerDnsConfiguration + + + DnsIPAddress + + [OutputType([System.String])] + param() + $output = @() + foreach($range in $this.PSBase.CimInstanceProperties['DnsIPAddress'].Value) + { + $output += $range + } + if ($output.Count -gt 0) + {,(@($output))} + else + {$null} + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/RemoteAccess/Client/MSFT_NetRoute + + + AddressFamily + + [Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.AddressFamily]($this.PSBase.CimInstanceProperties['AddressFamily'].Value) + + + param($newValue) + $this.PSBase.CimInstanceProperties['AddressFamily'].Value = [System.UInt16][Microsoft.PowerShell.Cmdletization.GeneratedTypes.NetRoute.AddressFamily]$newValue + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Wdac/MSFT_OdbcDriverTask_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/Wdac/MSFT_OdbcDriverTask_v1.0.cdxml new file mode 100644 index 0000000..bec5302 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Wdac/MSFT_OdbcDriverTask_v1.0.cdxml @@ -0,0 +1,292 @@ + + + + + + + + + + + 1.0 + OdbcDriver + + + + + + + + + + + + + + + + + + + + + + + + + 32-bit + 64-bit + All + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 32-bit + 64-bit + All + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Wdac/MSFT_OdbcDsnTask_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/Wdac/MSFT_OdbcDsnTask_v1.0.cdxml new file mode 100644 index 0000000..5adcd4a --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Wdac/MSFT_OdbcDsnTask_v1.0.cdxml @@ -0,0 +1,484 @@ + + + + + + + + + + + 1.0 + OdbcDsn + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 32-bit + 64-bit + + + + + + + + + + User + System + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 32-bit + 64-bit + All + + + + + + + + + + User + System + All + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 32-bit + 64-bit + All + + + + + + + + + + User + System + All + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 32-bit + 64-bit + All + + + + + + + + + + User + System + All + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Wdac/MSFT_OdbcPerfCounterTask_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/Wdac/MSFT_OdbcPerfCounterTask_v1.0.cdxml new file mode 100644 index 0000000..b2b24c3 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Wdac/MSFT_OdbcPerfCounterTask_v1.0.cdxml @@ -0,0 +1,322 @@ + + + + + + + + + + + 1.0 + OdbcPerfCounter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 32-bit + 64-bit + All + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 32-bit + 64-bit + All + + + + + + + + + + + + + + + + + + + + + + + + + + + 32-bit + 64-bit + All + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Wdac/MSFT_WdacBidTraceTask_v1.0.cdxml b/newton-cn/bin/v1.0/Modules/Wdac/MSFT_WdacBidTraceTask_v1.0.cdxml new file mode 100644 index 0000000..72e32c6 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Wdac/MSFT_WdacBidTraceTask_v1.0.cdxml @@ -0,0 +1,589 @@ + + + + + + + + + + + 1.0 + WdacBidTrace + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 32-bit + 64-bit + All + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 32-bit + 64-bit + All + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 32-bit + 64-bit + All + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 32-bit + 64-bit + All + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 32-bit + 64-bit + All + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 32-bit + 64-bit + All + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 32-bit + 64-bit + All + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 32-bit + 64-bit + All + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 32-bit + 64-bit + All + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Wdac/Wdac.format.ps1xml b/newton-cn/bin/v1.0/Modules/Wdac/Wdac.format.ps1xml new file mode 100644 index 0000000..45b7f51 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Wdac/Wdac.format.ps1xml @@ -0,0 +1,686 @@ + + + + + + + + + + + + + + Formatting For MSFT_OdbcKeyValuePair (List View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcKeyValuePair + + + + + + + ParentKey + + + Key + + + Value + + + + + + + + + Formatting For MSFT_OdbcKeyValuePair (Table View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcKeyValuePair + + + + + 30 + + + + 30 + + + + 90 + + + + + + + + ParentKey + + + + Key + + + Value + + + + + + + + + + Formatting For MSFT_OdbcDriver (List View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcDriver + + + + + + + Name + + + Platform + + + Attribute + + + + + + + + + Formatting For MSFT_OdbcDriver (Table View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcDriver + + + + + 40 + + + + + 15 + + + + 65 + + + + + + + + Name + + + Platform + + + Attribute + + + + + + + + + Formatting For MSFT_OdbcDriver (Custom View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcDriver + + + + + + FmtAttribute + + + + + + 4 + + + + + [String]::Format( "{0,-20}= {1}", $_.Name, $_.Value ) + + + + + + + + + + + + + + + + + + + + [String]::Format( "{0,-11}: {1}", "Name", $_.Name ) + + + + + + + [String]::Format( "{0,-11}: {1}", "Platform", $_.Platform ) + + + + + + + [String]::Format( "{0,-11}:", "Attribute" ) + + + + + + + Attribute + + FmtAttribute + + + + + + + + + + + Formatting For MSFT_OdbcDsn (List View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcDsn + + + + + + + Name + + + DsnType + + + Platform + + + DriverName + + + Attribute + + + + + + + + + Formatting For MSFT_OdbcDsn (Table View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcDsn + + + + + 20 + + + + 15 + + + + 15 + + + 40 + + + 65 + + + + + + + + Name + + + DsnType + + + Platform + + + DriverName + + + Attribute + + + + + + + + + Formatting For MSFT_OdbcDsn (Custom View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcDsn + + + + + + FmtAttribute + + + + + + 4 + + + + + [String]::Format( "{0,-20}= {1}", $_.Name, $_.Value ) + + + + + + + + + + + + + + + + + + + + [String]::Format( "{0,-11}: {1}", "Name", $_.Name ) + + + + + + + [String]::Format( "{0,-11}: {1}", "DsnType", $_.DsnType ) + + + + + + + [String]::Format( "{0,-11}: {1}", "Platform", $_.Platform ) + + + + + + + [String]::Format( "{0,-11}: {1}", "DriverName", $_.DriverName ) + + + + + + + [String]::Format( "{0,-11}:", "Attribute" ) + + + + + + + Attribute + + FmtAttribute + + + + + + + + + + + Formatting For MSFT_OdbcPerfCounter (List View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcPerfCounter + + + + + + + Platform + + + IsEnabled + + + + + + + + + Formatting For MSFT_OdbcPerfCounter (Table View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcPerfCounter + + + + + + 15 + + + 20 + + + + + + + + Platform + + + IsEnabled + + + + + + + + + Formatting For MSFT_OdbcPerfCounter (Wide View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcPerfCounter + + + + + + + Platform + + + + + + + + + + Formatting For MSFT_WdacBidTrace (List View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_WdacBidTrace + + + + + + + TargetScope + + + TargetProcessId + + + Platform + + + IsEnabled + + + + + + + + + Formatting For MSFT_WdacBidTrace (Table View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_WdacBidTrace + + + + + 50 + + + 18 + + + + 15 + + + 20 + + + + + + + + TargetScope + + + TargetProcessId + + + Platform + + + IsEnabled + + + + + + + + + Formatting For MSFT_WdacBidTrace (Wide View) + + Microsoft.Management.Infrastructure.CimInstance#MSFT_WdacBidTrace + + + + + + + TargetScope + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Wdac/Wdac.psd1 b/newton-cn/bin/v1.0/Modules/Wdac/Wdac.psd1 new file mode 100644 index 0000000..ecebc74 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Wdac/Wdac.psd1 @@ -0,0 +1,31 @@ +@{ + GUID = '78a7a38c-a446-43fe-b643-9abacf843112' + Author = 'Microsoft Corporation' + CompanyName = 'Microsoft Corporation' + Copyright = '(C) Microsoft Corporation. All rights reserved.' + NestedModules = @('MSFT_OdbcDriverTask_v1.0.cdxml', + 'MSFT_OdbcDsnTask_v1.0.cdxml', + 'MSFT_OdbcPerfCounterTask_v1.0.cdxml', + 'MSFT_WdacBidTraceTask_v1.0.cdxml') + FormatsToProcess = @('Wdac.format.ps1xml') + TypesToProcess = @('Wdac.types.ps1xml') + ModuleVersion = '1.0.0.0' + AliasesToExport = @() + + FunctionsToExport = @('Get-OdbcDriver', + 'Set-OdbcDriver', + 'Get-OdbcDsn', + 'Add-OdbcDsn', + 'Set-OdbcDsn', + 'Remove-OdbcDsn', + 'Get-OdbcPerfCounter', + 'Enable-OdbcPerfCounter', + 'Disable-OdbcPerfCounter', + 'Get-WdacBidTrace', + 'Enable-WdacBidTrace', + 'Disable-WdacBidTrace') + + PowerShellVersion = '5.1' + HelpInfoUri = 'http://go.microsoft.com/fwlink/?linkid=390844' + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/Wdac/Wdac.types.ps1xml b/newton-cn/bin/v1.0/Modules/Wdac/Wdac.types.ps1xml new file mode 100644 index 0000000..fcc0d4b --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Wdac/Wdac.types.ps1xml @@ -0,0 +1,239 @@ + + + + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcDriver + + + Attribute + + $h = @{}; + foreach ($keyValue in $this.KeyValuePair) + { + $h.Add( $keyValue.Key, $keyValue.Value ) + } + $h + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_OdbcDsn + + + Attribute + + $h = @{}; + foreach ($keyValue in $this.KeyValuePair) + { + $h.Add( $keyValue.Key, $keyValue.Value ) + } + $h + + + + + PropertyValue + + $PropArray = @(); + foreach ($keyValue in $this.KeyValuePair) + { + $PropArray = $PropArray + ($keyValue.Key + "=" + $keyValue.Value) + } + $PropArray + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#MSFT_WdacBidTrace + + + + TargetScope + + switch ($this.Mode) + { + 1 {$this.PathOrFolder} + 2 {$this.PathOrFolder + "\*"} + 3 {"*"} + default {"Unknown Mode"} + } + + + + + TargetProcessId + + if ($this.ProcessId -eq [System.UInt32]::maxvalue) + { + "*" + } + else + { + [System.String] $this.ProcessId + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/Whea/Microsoft.Windows.Whea.WheaMemoryPolicy.dll b/newton-cn/bin/v1.0/Modules/Whea/Microsoft.Windows.Whea.WheaMemoryPolicy.dll new file mode 100644 index 0000000..c6adc43 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/Whea/Microsoft.Windows.Whea.WheaMemoryPolicy.dll differ diff --git a/newton-cn/bin/v1.0/Modules/Whea/Whea.psd1 b/newton-cn/bin/v1.0/Modules/Whea/Whea.psd1 new file mode 100644 index 0000000..187bfd1 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/Whea/Whea.psd1 @@ -0,0 +1,47 @@ +# +# Module manifest for module 'WheaPolicyManagement' +# +# Generated by: Microsoft Corporation +# +# Generated on: 2/14/2011 +# + +@{ + +# These modules will be processed when the module manifest is loaded. +NestedModules = 'Microsoft.Windows.Whea.WheaMemoryPolicy' + +# This GUID is used to uniquely identify this module. +GUID = 'b7bf4d74-f837-430e-810f-234f26021253' + +# The author of this module. +Author = 'Microsoft Corporation' + +# The company or vendor for this module. +CompanyName = 'Microsoft Corporation' + +# The copyright statement for this module. +Copyright = '© Microsoft Corporation. All rights reserved.' + +# A description of this module (not be used because module manifest is not being localized). +# Description = 'Whea WMI Module for Memory Policy' + +# The version of this module. +ModuleVersion = '2.0.0.0' + +# The minimum version of PowerShell needed to use this module. +PowerShellVersion = '5.1' + +# The CLR version required to use this module. +CLRVersion = '4.0' + +# Request fwlink from UA +HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=390848" + +# Cmdlets to Export +CmdletsToExport="Get-WheaMemoryPolicy", "Set-WheaMemoryPolicy" + +# PowerShell editions this module is compatible with +CompatiblePSEditions = @('Core', 'Desktop') +} + diff --git a/newton-cn/bin/v1.0/Modules/WindowsDeveloperLicense/WindowsDeveloperLicense.psd1 b/newton-cn/bin/v1.0/Modules/WindowsDeveloperLicense/WindowsDeveloperLicense.psd1 new file mode 100644 index 0000000..e6cc6bf --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/WindowsDeveloperLicense/WindowsDeveloperLicense.psd1 @@ -0,0 +1,15 @@ +@{ + GUID = "{8AB5FE0D-DB4A-49F2-93A3-040CF12840CC}" + Author = "Microsoft Corporation" + CLRVersion = "4.0" + CompanyName = "Microsoft Corporation" + Copyright = "© Microsoft Corporation. All rights reserved." + AliasesToExport = @() + FunctionsToExport = @() + CmdletsToExport = "Get-WindowsDeveloperLicense", "Unregister-WindowsDeveloperLicense", "Show-WindowsDeveloperLicenseRegistration" + HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=285578" + PowerShellVersion = '5.1' + ModuleVersion = "1.0.0.0" + ModuleToProcess = "Microsoft.Windows.DeveloperLicense.Commands" + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/WindowsErrorReporting/Microsoft.WindowsErrorReporting.PowerShell.dll b/newton-cn/bin/v1.0/Modules/WindowsErrorReporting/Microsoft.WindowsErrorReporting.PowerShell.dll new file mode 100644 index 0000000..5a3f7a6 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/WindowsErrorReporting/Microsoft.WindowsErrorReporting.PowerShell.dll differ diff --git a/newton-cn/bin/v1.0/Modules/WindowsErrorReporting/WindowsErrorReporting.psd1 b/newton-cn/bin/v1.0/Modules/WindowsErrorReporting/WindowsErrorReporting.psd1 new file mode 100644 index 0000000..4b9d145 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/WindowsErrorReporting/WindowsErrorReporting.psd1 @@ -0,0 +1,21 @@ +@{ + GUID = "{4BC4DED7-249B-41AC-973F-83AF4D25D82B}" + Author = "Microsoft Corporation" + CompanyName = "Microsoft Corporation" + Copyright = "© Microsoft Corporation. All rights reserved." + HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=390850" + ModuleVersion = "1.0" + PowerShellVersion = '5.1' + ClrVersion = "4.0" + RootModule = "WindowsErrorReporting.psm1" + NestedModules = "Microsoft.WindowsErrorReporting.PowerShell.dll" + TypesToProcess = @() + FormatsToProcess = @() + CmdletsToExport = @( + 'Enable-WindowsErrorReporting', + 'Disable-WindowsErrorReporting', + 'Get-WindowsErrorReporting' + ) + AliasesToExport = @() + CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/WindowsErrorReporting/WindowsErrorReporting.psm1 b/newton-cn/bin/v1.0/Modules/WindowsErrorReporting/WindowsErrorReporting.psm1 new file mode 100644 index 0000000..c5fc3b7 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/WindowsErrorReporting/WindowsErrorReporting.psm1 @@ -0,0 +1,11 @@ +# +# Script Module file for Wer module. +# +# Copyright (c) Microsoft Corporation +# + +# +# Cmdlet aliases +# + +Export-ModuleMember -Alias * -Function * -Cmdlet * diff --git a/newton-cn/bin/v1.0/Modules/WindowsSearch/Microsoft.WindowsSearch.Commands.dll b/newton-cn/bin/v1.0/Modules/WindowsSearch/Microsoft.WindowsSearch.Commands.dll new file mode 100644 index 0000000..b33ae15 Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/WindowsSearch/Microsoft.WindowsSearch.Commands.dll differ diff --git a/newton-cn/bin/v1.0/Modules/WindowsSearch/WindowsSearch.Format.ps1xml b/newton-cn/bin/v1.0/Modules/WindowsSearch/WindowsSearch.Format.ps1xml new file mode 100644 index 0000000..67bf6b4 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/WindowsSearch/WindowsSearch.Format.ps1xml @@ -0,0 +1,25 @@ + + + + + PrintSetting + + Microsoft.WindowsSearch.Commands.PrintSetting + + + + + + + Setting + + + Value + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/WindowsSearch/WindowsSearch.psd1 b/newton-cn/bin/v1.0/Modules/WindowsSearch/WindowsSearch.psd1 new file mode 100644 index 0000000..c36c193 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/WindowsSearch/WindowsSearch.psd1 @@ -0,0 +1,13 @@ +@{ +GUID="{562C6233-EAEE-4876-B36C-D6B1F256D4E6}" +Author="Microsoft Corporation" +CompanyName="Microsoft Corporation" +Copyright="© Microsoft Corporation. All rights reserved." +ModuleVersion="1.0.0.0" +PowerShellVersion="5.1" +CLRVersion="4.0" +NestedModules="Microsoft.WindowsSearch.Commands" +HelpInfoUri= "https://go.microsoft.com/fwlink/?LinkId=280243" +CmdletsToExport="Get-WindowsSearchSetting","Set-WindowsSearchSetting" +CompatiblePSEditions=@("Core","Desktop") +} diff --git a/newton-cn/bin/v1.0/Modules/WindowsSearch/ko/Microsoft.WindowsSearch.Commands.Resources.dll b/newton-cn/bin/v1.0/Modules/WindowsSearch/ko/Microsoft.WindowsSearch.Commands.Resources.dll new file mode 100644 index 0000000..b72756d Binary files /dev/null and b/newton-cn/bin/v1.0/Modules/WindowsSearch/ko/Microsoft.WindowsSearch.Commands.Resources.dll differ diff --git a/newton-cn/bin/v1.0/Modules/WindowsUpdate/WindowsUpdate.psd1 b/newton-cn/bin/v1.0/Modules/WindowsUpdate/WindowsUpdate.psd1 new file mode 100644 index 0000000..0b79319 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/WindowsUpdate/WindowsUpdate.psd1 @@ -0,0 +1,40 @@ +# +# Module manifest for module 'WindowsUpdate' +# + +@{ + +# Version number of this module. +ModuleVersion = '1.0.0.0' + +# ID used to uniquely identify this module +GUID = 'db6155f2-9e89-45cf-876a-f15141294f5b' + +# Author of this module +Author = 'Microsoft Corporation' + +# Company or vendor of this module +CompanyName = 'Microsoft Corporation' + +# Copyright statement for this module +Copyright = '(c) Microsoft Corporation. All rights reserved.' + +# Minimum version of the Windows PowerShell engine required by this module +PowerShellVersion = '5.1' + +# List of all modules packaged with this module +ModuleList = @('.\WindowsUpdateLog.psm1') + +# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess +NestedModules = @('.\WindowsUpdateLog.psm1') + +# Functions to export from this module +FunctionsToExport = @('Get-WindowsUpdateLog') +AliasesToExport = @() +CmdletsToExport = @() + +# HelpInfo URI of this module +HelpInfoURI = 'https://go.microsoft.com/fwlink/?LinkId=614995' + +CompatiblePSEditions = @('Desktop', 'Core') +} diff --git a/newton-cn/bin/v1.0/Modules/WindowsUpdate/WindowsUpdateLog.psm1 b/newton-cn/bin/v1.0/Modules/WindowsUpdate/WindowsUpdateLog.psm1 new file mode 100644 index 0000000..c1bfadc --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/WindowsUpdate/WindowsUpdateLog.psm1 @@ -0,0 +1,515 @@ +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# Version: 1.0.0.0 +# Revision 2015.05.26 +# + +# -------------------------------------------------------------------------------------------------------------------------- +# CONSTANTS +# -------------------------------------------------------------------------------------------------------------------------- +$TIMESTAMP_FORMAT = "yyyy/MM/dd HH:mm:ss.fffffff" + +$WORKDIR = "$env:TEMP\WindowsUpdateLog" +$SYM_CACHE = "$WORKDIR\SymCache" +$SYSTEM32 = "$env:windir\System32" +$DEBUG_LOG_PATH = "$WORKDIR\debug.log" + +$BINLIST = @( + "wuaueng.dll", + "wuapi.dll", + "wuuhext.dll", + "wuuhmobile.dll", + "wuautoappupdate.dll", + "storewuauth.dll", + "wuauclt.exe") + +# TraceRpt.exe fails with "data area passed in too small" error which is really just insufficient buffer error. It happens +# when the total size of ETLs we're passing in is too huge. We're going to batch it every 10 ETLs to workaround the issue. +$MAX_ETL_PER_BATCH = 10 + +# Column headers in CSV produced by tracerpt.exe +$CSV_HEADER= "EventName, Type, Event ID, Version, Channel, Level, Opcode, Task, Keyword, PID, TID, ProcessorNumber, InstanceID, ParentInstanceID, ActivityID, RelatedActivityID, ClockTime, KernelTime, UserTime, UserData, Function, LogMessage, Ignore1, Ignore2, IgnoreGuid1, SourceLine, IgnoreTime, Ignore3, Category, LogLevel, TimeStamp, IgnoreGuid2" + +# -------------------------------------------------------------------------------------------------------------------------- +# FUNCTIONS +# -------------------------------------------------------------------------------------------------------------------------- + +# +# Given a path to single ETL file or a directory containing multiple ETL files, return a list containing the fullpaths of the ETLs. +# +function GetListOfETLs +{ + Param( + [string[]] $Paths = $(throw "'Paths' parameter is required.") + ) + + Write-Verbose "Gathering ETL files ..." + + $etlList = New-Object System.Collections.Generic.List[System.String] + + foreach ($path in $Paths) + { + # If user passes in a directory as $ETLPath, grabs all the ETLs in that folder. + if (Test-Path $path -PathType Container) + { + $etls = Get-ChildItem $path -Filter WindowsUpdate*.etl + + if ($etls.Length -eq 0) + { + throw "File not found: No Windows Update ETL file under $path" + } + + foreach ($etl in $etls) + { + $etlList.Add($etl.FullName.Trim()) + } + } + else + { + if (!(Test-Path $path)) + { + throw "File not found: $path" + } + + $etlList.Add($path.Trim()) + } + } + + if ($etlList.Count -gt 1) + { + Write-Verbose "Sorting ETLs numerically ..." + + # Pad the last decimal before .etl in WindowsUpdate.20150609.225042.704.1.etl so ETLs can be sorted numerically. + $etlList = $etlList | Sort-Object { [regex]::Replace($_, '\d+(?=.etl)', { $args[0].Value.PadLeft(10) }) } + } + + Write-Verbose "Found $($etlList.Count) ETLs." + + return $etlList +} + +# +# Given a list of ETLs, decode them into XML or CSV file using TraceRpt.exe +# +function DecodeETL +{ + Param( + [System.Collections.Generic.List[System.String]] $ETLList = $(throw "'ETLList' parameter is required."), + [string] $OutPath = $(throw "'OutPath' parameter is required."), + [ValidateSet('XML', 'CSV')] $Type = $(throw "'Type' parameter is required.") + ) + + Write-Verbose "Decoding $($ETLList.Count) ETLs to $OutPath using $Type processing ..." + + if (Test-Path $OutPath) + { + Remove-Item $OutPath -Force -ErrorAction Stop + } + + # + # Build tracerpt arguments. + # + $args = New-Object System.Collections.Generic.List[System.String] + + # ETL files + $args.AddRange($ETLList) + + # output format + $args.Add("-of") + $args.Add($Type) + + # output file + $args.Add("-o") + $args.Add($OutPath) + + # binary list + $binaries = "" + + foreach ($bin in $BINLIST) + { + $binaries = "$binaries$SYSTEM32\$bin;" + } + + $args.Add("-i") + $args.Add("$binaries") + + # no prompt + $args.Add("-y") + + # Switch directory to SymCache so that tracerpt.exe writes the TMF and MOF files there. + if (!(Test-Path $SYM_CACHE)) + { + New-Item -ItemType Directory -Path $SYM_CACHE -ErrorAction Stop + } + + $popd = Get-Location + Set-Location $SYM_CACHE + + # + # Decode ETLs to XML + # + $start = Get-Date + + & "tracerpt.exe" $args | Out-Default + + Write-Verbose "Done. Elapsed: $((Get-Date).Subtract($start).TotalMilliseconds) ms." + + Set-Location $popd + + if ($LastExitCode -ne 0) + { + throw "Failed to decode ETLs. TraceRpt.exe returned error= $LastExitCode" + } + + if (!(Test-Path $OutPath)) + { + throw "Failed to decode ETLs. TraceRpt.exe failed to produce $OutPath" + } +} + +# +# Given an XML file produced by tracerpt.exe, convert it to user friendly text log. +# +function ConvertXmlToLog +{ + Param( + [string] $XmlPath = $(throw "'XmlPath' parameter is required."), + [string] $LogPath = $(throw "'LogPath' parameter is required.") + ) + + Write-Verbose "Converting $XmlPath to $LogPath ..." + + if (Test-Path $LogPath) + { + Remove-Item $LogPath -Force -ErrorAction Stop + } + + [xml] $xml = Get-Content $XmlPath + + $writer = New-Object System.IO.StreamWriter $LogPath + $start = Get-Date + + try + { + $nodeNum = 0 + + $xml.Events.Event | ForEach-Object { + + $row = $_ + + try + { + $systemNode = $_.System + $providerNode = $systemNode.Provider + $providerName = $systemNode.Provider.Name + + if ($providerNode -ne $null -And $providerName -eq "WUTraceLogging") + { + $eventDataNode = $_.EventData + $executionNode = $systemNode.Execution + [DateTime] $datetime = $systemNode.TimeCreated.SystemTime + + $keywordNode = $_.RenderingInfo + + + # Log columns: + # Time ProcessID ThreadID Component Message + $writer.WriteLine("$($datetime.ToString($TIMESTAMP_FORMAT)) $($executionNode.ProcessID.ToString().PadRight(5)) $($executionNode.ThreadID.ToString().PadRight(5)) $($keywordNode.Task.ToString().PadRight(15)) $($eventDataNode.Data.'#text')") + } + } + catch + { + # Log exception, eat it, and process the rest of the log. + Write-Warning "Unable to process node $nodeNum." + + "Failed to process line:$nodeNum of $XmlPath`n$row`n$_`n---" | Out-File $DEBUG_LOG_PATH -Encoding ascii -Append + } + + $nodeNum++ + } # foreach + } + finally + { + $writer.Close() + } + + Write-Verbose "Done. Elapsed: $((Get-Date).Subtract($start).TotalMilliseconds) ms." +} + +# +# Given a CSV file produced by tracerpt.exe, convert it to user friendly text log. +# +function ConvertCsvToLog +{ + Param( + $CsvPath = $(throw "'CsvPath' parameter is required."), + $LogPath = $(throw "'LogPath' parameter is required.") + ) + + Write-Verbose "Converting $CsvPath to $LogPath ..." + + if (Test-Path $LogPath) + { + Remove-Item $LogPath -Force -ErrorAction Stop + } + + $csvText = Get-Content $CsvPath + $csvText[0] = $CSV_HEADER + + $csv = ConvertFrom-Csv $csvText + + $writer = New-Object System.IO.StreamWriter $LogPath + $start = Get-Date + + try + { + $lineNum = 0 + + $csv | ForEach-Object { + + $row = $_ + + try + { + if ($_.EventName -ne "EventTrace" -And !($_.EventName.StartsWith("{"))) + { + [DateTime] $datetime = [DateTime]::FromFileTimeUTC($_.ClockTime).ToLocalTime() + + # convert hex string to decimals + $processId = $_.PID -as [int] + $threadId = $_.TID -as [int] + + # Log columns: + # Time ProcessID ThreadID Component Message + $writer.WriteLine("$($datetime.ToString($TIMESTAMP_FORMAT)) $($processId.ToString().PadRight(5)) $($threadId.ToString().PadRight(5)) $($_.EventName.PadRight(15)) $($_.UserData)") + } + } + catch + { + # Log exception, eat it, and process the rest of the log. + Write-Warning "Unable to process line $lineNum." + + "Unable to process line:$lineNum of $CsvPath`n$row`n$_`n---" | Out-File $DEBUG_LOG_PATH -Encoding ascii -Append + } + + $lineNum++ + } # foreach + } + finally + { + $writer.Close() + } + + Write-Verbose "Done. Elapsed: $((Get-Date).Subtract($start).TotalMilliseconds) ms." +} + +function FlushWindowsUpdateETLs +{ + Write-Verbose "Flushing Windows Update ETLs ..." + + Stop-Service usosvc -ErrorAction Stop + Stop-Service wuauserv -ErrorAction Stop + + Write-Verbose "Done." +} + +# +# Given an ETL path, convert the ETL file(s) into text log. +# +function ConvertETLsToLog +{ + Param( + [string[]] $ETLPaths = $(throw "'etlPaths' parameter is required."), + [string] $LogPath = $(throw "'LogPath' parameter is required."), + [ValidateSet('XML', 'CSV')] $Type = $(throw "'type' parameter is required.") + ) + + if ($ETLPaths.Count -gt 1) + { + "`nMerging and converting $($ETLPaths.Count) ETLs into $LogPath ..." | Out-Default + } + elseif ($ETLPaths.Count -eq 1) + { + "`nConverting $($ETLPaths[0]) into $LogPath ..." | Out-Default + } + else + { + throw "No Windows Update ETL file found." + } + + $start = Get-Date + + [System.Collections.Generic.List[System.String]] $etlList = GetListOfETLs -path $ETLPaths + # Create Working Directory + New-Item -Path $WORKDIR -ItemType Directory -ErrorAction SilentlyContinue | Out-Null + + $tempFilePath = "$WORKDIR\wuetl.$Type.tmp" + $tempLogPath = "$WORKDIR\wuetl.log.tmp" + + Remove-Item "$tempFilePath.*" -Force -ErrorAction SilentlyContinue | Out-Null + Remove-Item "$tempLogPath.*" -Force -ErrorAction SilentlyContinue | Out-Null + Remove-Item $DEBUG_LOG_PATH -Force -ErrorAction SilentlyContinue | Out-Null + + $processed = 0; + $tempFileCount = 0 + + # Pad tempFileCount so files can be sorted numerically. + $NumFormat = "{0:00000}" + + while ($processed -lt $etlList.Count) + { + $remaining = $etlList.Count - $processed + + $numberedTempFile = "$tempFilePath.$NumFormat" -f $tempFileCount + $numberedLogFile = "$tempLogPath.$NumFormat" -f $tempFileCount + + if ($remaining -ge $MAX_ETL_PER_BATCH) + { + DecodeETL -ETLList $etlList.GetRange($processed, $MAX_ETL_PER_BATCH) -OutPath $numberedTempFile -Type $Type + $processed += $MAX_ETL_PER_BATCH + } + else + { + DecodeETL -ETLList $etlList.GetRange($processed, $remaining) -OutPath $numberedTempFile -Type $Type + $processed += $remaining + } + + if ($Type -eq 'XML') + { + ConvertXmlToLog -XmlPath $numberedTempFile -LogPath $numberedLogFile + } + else + { + ConvertCsvToLog -CsvPath $numberedTempFile -LogPath $numberedLogFile + } + + $tempFileCount++ + } + + if ($tempFileCount -gt 1) + { + Write-Verbose "Merging all temporary logs into one ..." + Get-Content "$tempLogPath.*" | Out-File $LogPath -Encoding ascii + } + else + { + $src = "$tempLogPath.$NumFormat" -f 0 + Copy-Item -Path $src -Destination $LogPath -ErrorAction Stop + } + + # Not removing $tempFilePath.* so users can use XML/CSVs to do more fancy stuff should they wish. + Remove-Item "$tempLogPath.*" -ErrorAction SilentlyContinue | Out-Null + + Write-Verbose "Total elapsed: $((Get-Date).Subtract($start).TotalMilliseconds) ms." + + "`nWindowsUpdate.log written to $LogPath`n" | Out-Default +} + +#.ExternalHelp WindowsUpdateLog.psm1-help.xml +function Get-WindowsUpdateLog +{ + [CmdLetBinding( + SupportsShouldProcess = $true, + ConfirmImpact = 'High')] + Param( + [parameter( + ValueFromPipeline = $true, + ValueFromPipelineByPropertyName = $true, + Position = 0)] + [Alias('PsPath')] + [string[]] $ETLPath = @("$env:windir\logs\WindowsUpdate"), + + [parameter( + Position = 1)] + [string] $LogPath = "$([System.Environment]::GetFolderPath("Desktop"))\WindowsUpdate.log", + + [ValidateSet('CSV', 'XML')] + [string] $ProcessingType = 'CSV', + + [switch] $ForceFlush + ) + + begin + { + $etls = New-Object System.Collections.ArrayList + } + + process + { + # + # Handles pipeline input. For e.g. get-childitem C:\temp | get-windowsupdatelog + # + if ($_ -ne $null) + { + if ($_.PsPath -eq $null -or !(Test-Path $_.PsPath)) + { + throw "ETL file cannot be found or is invalid: $_" + } + + $etls.Add($_.FullName) | Out-Null + } + # + # Handles regular input. For e.g. get-windowsupdate.log C:\temp\WindowsUpdate1.etl, C:\temp\WindowsUpdate2.etl + # + else + { + foreach ($p in $ETLPath) + { + if (!(Test-Path $p)) + { + throw "File not found: $p" + } + $etls.Add($p) | Out-Null + } + } + } + + end + { + if ($ForceFlush) + { + if ($PSCmdlet.ShouldProcess("$env:COMPUTERNAME", "Stopping Update Orchestrator and Windows Update services")) + { + FlushWindowsUpdateETLs + } + else + { + return + } + } + + # The rest of the function doesn't support -WhatIf, so just bail out if -WhatIf is specified + if ($WhatIfPreference) + { + return + } + + # + # Make sure we have permission to write log file to requested path. + # + $logDir = Split-Path -Parent $LogPath + + if (!(Test-Path $logDir)) + { + New-Item -Path $logDir -ErrorAction Stop + } + + try + { + "Checking write access" | Out-File -FilePath $LogPath -Encoding ascii + } + catch [System.UnauthorizedAccessException] + { + throw "No permission to write to $LogPath" + } + + # + # Do work now. + # + + ConvertETLsToLog -ETLPaths $etls -LogPath $LogPath -Type $ProcessingType + } +} + +Export-ModuleMember -Function Get-WindowsUpdateLog diff --git a/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/MSFT_WUOperations.cdxml b/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/MSFT_WUOperations.cdxml new file mode 100644 index 0000000..fba0a7f --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/MSFT_WUOperations.cdxml @@ -0,0 +1,44 @@ + + + + + 1.0.0.1 + WUOperationsSession + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/MSFT_WUOperations.psm1 b/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/MSFT_WUOperations.psm1 new file mode 100644 index 0000000..9518a31 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/MSFT_WUOperations.psm1 @@ -0,0 +1,32 @@ +# This function's purpose is to take the output of the MI provider, an array of fixed size, and convert it to an array list of non-fixed size. +# The reason for this is so that a caller of this module is able to easily select which updates they wish to download & install +function Start-WUScan +{ + param + ( + [parameter(Mandatory = $false)] + $SearchCriteria + ) + + If($SearchCriteria -eq $null) + { + $scanres = Invoke-CimMethod -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperations -MethodName ScanForUpdates + } + else + { + $scanres = Invoke-CimMethod -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperations -MethodName ScanForUpdates -Arguments @{SearchCriteria=$SearchCriteria} + } + + if($scanres.ReturnValue -eq 0) + { + $arrlist = New-Object System.Collections.ArrayList + $arrlist.AddRange($scanres.Updates) | out-null + + # Comma is added to prevent powershell from converting return to an array + return ,$arrlist + } + else + { + Write-Error "Scan hit error: $scanres.ReturnValue" + } +} \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/MSFT_WUSettings.cdxml b/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/MSFT_WUSettings.cdxml new file mode 100644 index 0000000..2f26a8d --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/MSFT_WUSettings.cdxml @@ -0,0 +1,89 @@ + + + + + 1.0.0.1 + WUSettings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/MSFT_WUUpdate.cdxml b/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/MSFT_WUUpdate.cdxml new file mode 100644 index 0000000..2fcfe90 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/MSFT_WUUpdate.cdxml @@ -0,0 +1,54 @@ + + + + + 1.0.0.1 + WUUpdate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/MSFT_WUUpdate.format.ps1xml b/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/MSFT_WUUpdate.format.ps1xml new file mode 100644 index 0000000..21550a3 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/MSFT_WUUpdate.format.ps1xml @@ -0,0 +1,106 @@ + + + + + + MSFT_WUUpdate_ListView + + Microsoft.Management.Infrastructure.CimInstance#root\microsoft\windows\windowsupdate\MSFT_WUUpdate + Microsoft.Management.Infrastructure.CimInstance#MSFT_WUUpdate + + + + + + + + Title + + + + Description + + + + KBArticleID + + + + MsrcSeverity + + + + RevisionNumber + + + + UpdateID + + + + + + + + MSFT_WUUpdate_TableView + + Microsoft.Management.Infrastructure.CimInstance#root\microsoft\windows\windowsupdate\MSFT_WUUpdate + Microsoft.Management.Infrastructure.CimInstance#MSFT_WUUpdate + + + + + + 25 + + + + 50 + + + + 15 + + + + 15 + + + + 10 + + + + 39 + + + + + + + Title + + + Description + + + KBArticleID + + + MsrcSeverity + + + RevisionNumber + + + UpdateID + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/MSFT_WUUpdate.types.ps1xml b/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/MSFT_WUUpdate.types.ps1xml new file mode 100644 index 0000000..849d824 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/MSFT_WUUpdate.types.ps1xml @@ -0,0 +1,68 @@ + + + + Microsoft.Management.Infrastructure.CimInstance#root/Microsoft/Windows/WindowsUpdate/MSFT_WUUpdate + + + UpdateID + + $this.PSBase.CimInstanceProperties['UpdateID'].Value + + + param($newValue) + $this.PSBase.CimInstanceProperties['UpdateID'].Value = [String][Microsoft.PowerShell.Cmdletization.GeneratedTypes.MSFT_WUUpdate.UpdateID] $newValue + + + + RevisionNumber + + $this.PSBase.CimInstanceProperties['RevisionNumber'].Value + + + param($newValue) + $this.PSBase.CimInstanceProperties['RevisionNumber'].Value = [UInt32][Microsoft.PowerShell.Cmdletization.GeneratedTypes.MSFT_WUUpdate.RevisionNumber] $newValue + + + + Title + + $this.PSBase.CimInstanceProperties['Title'].Value + + + param($newValue) + $this.PSBase.CimInstanceProperties['Title'].Value = [String][Microsoft.PowerShell.Cmdletization.GeneratedTypes.MSFT_WUUpdate.Title] $newValue + + + + Description + + $this.PSBase.CimInstanceProperties['Description'].Value + + + param($newValue) + $this.PSBase.CimInstanceProperties['Description'].Value = [System.String][Microsoft.PowerShell.Cmdletization.GeneratedTypes.MSFT_WUUpdate.Description] $newValue + + + + MsrcSeverity + + $this.PSBase.CimInstanceProperties['MsrcSeverity'].Value + + + param($newValue) + $this.PSBase.CimInstanceProperties['MsrcSeverity'].Value = [System.String][Microsoft.PowerShell.Cmdletization.GeneratedTypes.MSFT_WUUpdate.MsrcSeverity] $newValue + + + + KBArticleID + + $this.PSBase.CimInstanceProperties['KBArticleID'].Value + + + param($newValue) + $this.PSBase.CimInstanceProperties['KBArticleID'].Value = [System.String][Microsoft.PowerShell.Cmdletization.GeneratedTypes.MSFT_WUUpdate.KBArticleID] $newValue + + + + + diff --git a/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/WindowsUpdateProvider.psd1 b/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/WindowsUpdateProvider.psd1 new file mode 100644 index 0000000..cb3eb79 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/WindowsUpdateProvider/WindowsUpdateProvider.psd1 @@ -0,0 +1,47 @@ +<#++ + +Copyright (c) 2011 Microsoft Corporation + +Module Name: + + WindowsUpdateProvider.psd1 + +Abstract: + + This module is the container module definition for the MSFT_WU* CIM + object CmdLets. + +--#> + +@{ + GUID = 'faed25e4-6939-439d-8c13-4778ac5ac8a7' + Author = "Microsoft Corporation" + CompanyName = "Microsoft Corporation" + Copyright = "(c) Microsoft Corporation. All rights reserved." + HelpInfoUri = "https://go.microsoft.com/fwlink/?linkid=390794" + ModuleVersion = "1.0.0.2" + PowerShellVersion = '5.1' + NestedModules = @( + 'MSFT_WUOperations.psm1', + 'MSFT_WUUpdate.cdxml', + 'MSFT_WUSettings.cdxml', + 'MSFT_WUOperations.cdxml' + ) + + TypesToProcess = @('MSFT_WUUpdate.types.ps1xml') + + FormatsToProcess = @('MSFT_WUUpdate.Format.ps1xml') + + FunctionsToExport = @( + # MSFT_WUSettings.cdxml + 'Get-WUAVersion', + 'Get-WULastInstallationDate', + 'Get-WULastScanSuccessDate', + 'Get-WUIsPendingReboot', + # MSFT_WUOperations.cdxml + 'Install-WUUpdates' + # MSFT_WUOperations.psm1 + 'Start-WUScan' + ) + CompatiblePSEditions = @('Desktop','Core') +} diff --git a/newton-cn/bin/v1.0/Modules/iSCSI/iSCSI.psd1 b/newton-cn/bin/v1.0/Modules/iSCSI/iSCSI.psd1 new file mode 100644 index 0000000..7f509f7 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/iSCSI/iSCSI.psd1 @@ -0,0 +1,27 @@ +@{ + GUID = '53E1C251-4283-4B07-AB02-FC492C7AB8C5' + Author="Microsoft Corporation" + CompanyName="Microsoft Corporation" + Copyright="© Microsoft Corporation. All rights reserved." + ModuleVersion = '1.0.0.0' + PowerShellVersion = '3.0' + FormatsToProcess = @() + TypesToProcess = @() + NestedModules = @("iSCSIConnection.cdxml", "iSCSISession.cdxml", "iSCSITarget.cdxml", "iSCSITargetPortal.cdxml") + AliasesToExport = @() + FunctionsToExport = @( + 'Get-IscsiTargetPortal', + 'New-IscsiTargetPortal', + 'Remove-IscsiTargetPortal', + 'Update-IscsiTargetPortal', + 'Get-IscsiTarget', + 'Connect-IscsiTarget', + 'Disconnect-IscsiTarget', + 'Update-IscsiTarget', + 'Get-IscsiSession', + 'Register-IscsiSession', + 'Unregister-IscsiSession', + 'Get-IscsiConnection', + 'Set-IscsiChapSecret') + HelpInfoUri="https://go.microsoft.com/fwlink/?linkid=390778" +} diff --git a/newton-cn/bin/v1.0/Modules/iSCSI/iSCSIConnection.cdxml b/newton-cn/bin/v1.0/Modules/iSCSI/iSCSIConnection.cdxml new file mode 100644 index 0000000..6a5989e --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/iSCSI/iSCSIConnection.cdxml @@ -0,0 +1,93 @@ + + + + 1.0 + IscsiConnection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/iSCSI/iSCSISession.cdxml b/newton-cn/bin/v1.0/Modules/iSCSI/iSCSISession.cdxml new file mode 100644 index 0000000..098a173 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/iSCSI/iSCSISession.cdxml @@ -0,0 +1,188 @@ + + + + 1.0 + IscsiSession + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Modules/iSCSI/iSCSITarget.cdxml b/newton-cn/bin/v1.0/Modules/iSCSI/iSCSITarget.cdxml new file mode 100644 index 0000000..4a0faa7 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/iSCSI/iSCSITarget.cdxml @@ -0,0 +1,326 @@ + + + + 1.0 + IscsiTarget + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Modules/iSCSI/iSCSITargetPortal.cdxml b/newton-cn/bin/v1.0/Modules/iSCSI/iSCSITargetPortal.cdxml new file mode 100644 index 0000000..359b7b8 --- /dev/null +++ b/newton-cn/bin/v1.0/Modules/iSCSI/iSCSITargetPortal.cdxml @@ -0,0 +1,270 @@ + + + + 1.0 + IscsiTargetPortal + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/PSEvents.dll b/newton-cn/bin/v1.0/PSEvents.dll new file mode 100644 index 0000000..51be1ce Binary files /dev/null and b/newton-cn/bin/v1.0/PSEvents.dll differ diff --git a/newton-cn/bin/v1.0/PowerShellCore.format.ps1xml b/newton-cn/bin/v1.0/PowerShellCore.format.ps1xml new file mode 100644 index 0000000..ab726c2 Binary files /dev/null and b/newton-cn/bin/v1.0/PowerShellCore.format.ps1xml differ diff --git a/newton-cn/bin/v1.0/PowerShellTrace.format.ps1xml b/newton-cn/bin/v1.0/PowerShellTrace.format.ps1xml new file mode 100644 index 0000000..ccf99cd --- /dev/null +++ b/newton-cn/bin/v1.0/PowerShellTrace.format.ps1xml @@ -0,0 +1,91 @@ + + + + + + + System.Management.Automation.PSTraceSource + + System.Management.Automation.PSTraceSource + + + + + 8 + + + 20 + + + 20 + + + + + + + + Options + + + Name + + + Listeners + + + Description + + + + + + + + System.Management.Automation.PSTraceSource + + System.Management.Automation.PSTraceSource + + + + + + + Name + + + Description + + + Options + + + Listeners + + + Attributes + + + Switch + + + + + + + + diff --git a/newton-cn/bin/v1.0/Registry.format.ps1xml b/newton-cn/bin/v1.0/Registry.format.ps1xml new file mode 100644 index 0000000..c6320f7 Binary files /dev/null and b/newton-cn/bin/v1.0/Registry.format.ps1xml differ diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/ITPro.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/ITPro.xsd new file mode 100644 index 0000000..4e28d17 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/ITPro.xsd @@ -0,0 +1,17 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/Maml.rld b/newton-cn/bin/v1.0/Schemas/PSMaml/Maml.rld new file mode 100644 index 0000000..fbd331a Binary files /dev/null and b/newton-cn/bin/v1.0/Schemas/PSMaml/Maml.rld differ diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/Maml.tbr b/newton-cn/bin/v1.0/Schemas/PSMaml/Maml.tbr new file mode 100644 index 0000000..5591962 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/Maml.tbr @@ -0,0 +1,1427 @@ + + + +0X00020004 + + + + + + + + 0X00004FC1 + 0X00000005 + 0X0000000C + 0X0000001A + 0X0000009D + + 0X00004FC1 + + + + + + + + + + + + + + + 0X00005162 + 0X00000005 + 0X00000025 + 0X0000001A + 0X00000103 + + 0X00005162 + + + + + + + + + + + + 0X80000001 + + 0X80000001 + + + 0X00004E22 + + 0X00004E22 + + + 0X0000E101 + + 0X0000E101 + + + 0X0000E102 + + 0X0000E102 + + + 0X000080F6 + + 0X000080F6 + + + 0X0000E103 + + 0X0000E103 + + + 0X0000E104 + + 0X0000E104 + + + 0X000080F4 + + 0X000080F4 + + + 0X00004E20 + + 0X00004E20 + + + + 0XFFFEFFA4 + + + 0X0000A800 + + 0X0000A800 + + + 0X0000A817 + + 0X0000A817 + + + + + 0X0000E107 + + 0X0000E107 + + + 0X0000E110 + + 0X0000E110 + + + 0X0000E141 + + 0X0000E141 + + + + + 0X80000002 + + 0X80000002 + + + 0X0000E12B + + 0X0000E12B + + + 0X0000E12C + + 0X0000E12C + + + 0X0000E123 + + 0X0000E123 + + + 0X0000E122 + + 0X0000E122 + + + 0X0000E125 + + 0X0000E125 + + + 0X00004E8B + + 0X00004E8B + + + 0X0000E120 + + 0X0000E120 + + + 0X00004E84 + + 0X00004E84 + + + 0X00004E8A + + 0X00004E8A + + + 0X00004E89 + + 0X00004E89 + + + 0X00004E8C + + 0X00004E8C + + + 0X00004E87 + + 0X00004E87 + + + 0X00004E86 + + 0X00004E86 + + + + + 0X80000003 + + 0X80000003 + + + 0X00004EEC + + 0X00004EEC + + + 0X00004EEE + + 0X00004EEE + + + 0X00004EEF + + 0X00004EEF + + + 0X00004EEA + + 0X00004EEA + + + 0X00004EEB + + 0X00004EEB + + + 0X000050F4 + + 0X000050F4 + + + 0X00004EF0 + + 0X00004EF0 + + + 0X00004EF3 + + 0X00004EF3 + + + 0X00004EF1 + + 0X00004EF1 + + + 0X00004EF5 + + 0X00004EF5 + + + 0X0000E800 + + 0X0000E800 + + + 0X0000E801 + + 0X0000E801 + + + 0X00007541 + + 0X00007541 + + + 0X000080EB + + 0X000080EB + + + 0X00007531 + + 0X00007531 + + + + + 0X80000004 + + 0X80000004 + + + 0X00004F50 + + 0X00004F50 + + + 0X00004F5A + + 0X00004F5A + + + 0X00004F59 + + 0X00004F59 + + + 0X00004F56 + + 0X00004F56 + + + 0X00004F58 + + 0X00004F58 + + + 0X000059D6 + + 0X000059D6 + + + 0X000059D7 + + 0X000059D7 + + + 0X00004F52 + + 0X00004F52 + + + + + 0X80000005 + + 0X80000005 + + + 0X00005152 + + 0X00005152 + + + 0X00005154 + + 0X00005154 + + + 0X0000514F + + 0X0000514F + + + 0X00005151 + + 0X00005151 + + + 0X00005170 + + 0X00005170 + + + 0X00005177 + + 0X00005177 + + + 0X00005178 + + 0X00005178 + + + 0X00005078 + + 0X00005078 + + + 0X00005079 + + 0X00005079 + + + 0X0000507A + + 0X0000507A + + + 0X00005141 + + 0X00005141 + + + 0X00005160 + + 0X00005160 + + + 0X00008051 + + 0X00008051 + + + + + 0X80000006 + + 0X80000006 + + + 0X000050E3 + + 0X000050E3 + + + 0X000050DE + + 0X000050DE + + + 0X000050F3 + + 0X000050F3 + + + 0X000050DD + + 0X000050DD + + + 0X000050DC + + 0X000050DC + + + 0X000050EC + + 0X000050EC + + + 0X000050E4 + + 0X000050E4 + + + 0X000050EE + + 0X000050EE + + + 0X000050EF + + 0X000050EF + + + 0X000050F2 + + 0X000050F2 + + + + + 0X80000007 + + 0X80000007 + + + 0X0000515B + + 0X0000515B + + + 0X0000515A + + 0X0000515A + + + 0X0000E132 + + 0X0000E132 + + + 0X0000E133 + + 0X0000E133 + + + 0X0000E134 + + 0X0000E134 + + + 0X0000E131 + + 0X0000E131 + + + + + 0X80000008 + + 0X80000008 + + + 0X00007556 + + 0X00007556 + + + 0X00007559 + + 0X00007559 + + + 0X00007557 + + 0X00007557 + + + 0X0000755D + + 0X0000755D + + + 0X0000755A + + 0X0000755A + + + 0X0000E140 + + 0X0000E140 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/Maml.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/Maml.xsd new file mode 100644 index 0000000..46aac98 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/Maml.xsd @@ -0,0 +1,18 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/Maml.xsx b/newton-cn/bin/v1.0/Schemas/PSMaml/Maml.xsx new file mode 100644 index 0000000..ecd16a3 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/Maml.xsx @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/Maml_HTML.xsl b/newton-cn/bin/v1.0/Schemas/PSMaml/Maml_HTML.xsl new file mode 100644 index 0000000..a0fa6cb Binary files /dev/null and b/newton-cn/bin/v1.0/Schemas/PSMaml/Maml_HTML.xsl differ diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/Maml_HTML_Style.xsl b/newton-cn/bin/v1.0/Schemas/PSMaml/Maml_HTML_Style.xsl new file mode 100644 index 0000000..ac401bc --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/Maml_HTML_Style.xsl @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + + + + + 100% + + + + + border-collapse: collapse; + border-width: 1px; + border-color: black; + + + + + border-left-style: solid; + border-right-style: solid; + border-top-style: hidden; + border-bottom-style: hidden; + + + border-left-style: none; + border-right-style: none; + border-top-style: hidden; + border-bottom-style: hidden; + + + border-left-style: hidden; + border-right-style: hidden; + border-top-style: solid; + border-bottom-style: hidden; + + + border-left-style: hidden; + border-right-style: hidden; + border-top-style: hidden; + border-bottom-style: solid; + + + border-left-style: hidden; + border-right-style: hidden; + border-top-style: hidden; + border-bottom-style: hidden; + + + border-left-style: solid; + border-right-style: solid; + border-top-style: solid; + border-bottom-style: solid; + + + + + + + + + + + + + + + 1* + + + + + + width: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + align + + + char + + + charoff + + + + + + + + + + + + + + bottom + + + top + + + + + + + + + border-width: 1px; + border-color: black; + + + colsep + + + + rowsep + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + border-right-style: none; + + + border-right-style: solid; + + + + + + + + + + border-bottom-style: none; + + + border-bottom-style: solid; + + + + + + + + + + + + + + left + + + + + + + + + + + + + + + + + + + + + + + % + + + 50% + + + + + + + +
\ No newline at end of file diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/ManagedDeveloper.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/ManagedDeveloper.xsd new file mode 100644 index 0000000..7ae7937 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/ManagedDeveloper.xsd @@ -0,0 +1,359 @@ + + + + + + This schema describes MAML, the Microsoft Assistance Markup Language. + MAML is intended for software documentation. In particular, it is + intended to accomodate the needs of Microsoft documentation. + + + The schema is broken into three main areas: end user, developer and + IT Pro. These areas adequaltely categorize Microsoft + documentation. + + + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/4. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately + incremented in uri of the updated version of the MAML schema. + + + + + This portion of the schema was created by chains in July 2004. + + + This portion of the schema defines the page types for managed page types. + + + + + + + + + + This is the root element of a managed class document. + + + n/a + + + + + + + + + + + + + + + + + + + + + + + + + + This is the root element of a managed method document. + + + n/a + + + + + + + + + + + + + + + + + + + + + + + This is the root element of a managed event document. + + + n/a + + + + + + + + + + + + + + + + + + + + + This is the root element of a managed property document. + + + n/a + + + + + + + + + + + + + + + + + + + + + + + + This is the root element of a managed structure document. + + + n/a + + + + + + + + + + + + + + + + + + + + + + + + This is the root element of a managed namespace document. + + + n/a + + + + + + + + + + + + + + + + + + + + This is the root element of a managed enumeration document. + + + n/a + + + + + + + + + + + + + + + + + + + + This is the root element of a managed interface document. + + + n/a + + + + + + + + + + + + + + + + + + + + + + + + + This is the root element of a managed delegate document. + + + n/a + + + + + + + + + + + + + + + + + + + + + This is the root element of a managed operator document. + + + n/a + + + + + + + + + + + + + + + + + + + + + + + This is the root element of a managed field document. + + + n/a + + + + + + + + + + + + + + + + + + + + This is the root element of a managed overload document. + + + n/a + + + + + + + + + + + + + + + + + This is the root element of a managed constructor document. + + + n/a + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/ManagedDeveloperStructure.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/ManagedDeveloperStructure.xsd new file mode 100644 index 0000000..d156cf8 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/ManagedDeveloperStructure.xsd @@ -0,0 +1,85 @@ + + + + + + This schema describes MAML, the Microsoft Assistance Markup Language. + MAML is intended for software documentation. In particular, it is + intended to accomodate the needs of Microsoft documentation. + + + The schema is broken into three main areas: end user, developer and + IT Pro. These areas adequaltely categorize Microsoft + documentation. + + + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/4. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately + incremented in uri of the updated version of the MAML schema. + + + + + This portion of the schema was created by chains in July 2004. + + + This portion of the schema provides the definitions for developer-specific structural elements that make up developer document page types. + + + + + + + + + + + + This element contains a detailed discussion of the current item. + + + n/a + + + + + + + This element holds a discussion of security issues. + + + n/a + + + + + + + This element holds a discussion of a code example. + + + n/a + + + + + + + + + + + + This element is a collection of codeExample elements. + + + n/a + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/ProviderHelp.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/ProviderHelp.xsd new file mode 100644 index 0000000..19e042c --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/ProviderHelp.xsd @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/base.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/base.xsd new file mode 100644 index 0000000..aef59aa --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/base.xsd @@ -0,0 +1,137 @@ + + + + + This schema defines attributes and simpleTypes that can be referenced from any other part of MAML. + + + + + + + Describes the type of media file format. + + + + + + + + + + + + + + + + + + + + + Describes the type of alert. + + + + + + + + + + + + + + + + + Describes the development language for a specific part of a document. + + + + + + + + + + + + + + + + + + + + + + + + Describes the attached content with a unique ID/GUID/URI to reference for purposes such as sharing and hyperlinking. + + + + + + Provides a set of attributes for identifying and marking content for sharing and conditional filtering. + + + + + Describes one or more conditions for a particular part of a document. Use conditions to filter the parts of a document that appear in the final output. Each condition can be based on user state or computer state. For example, a step in a procedure does not appear if the user is not logged on as an administrator; a link appears only if a particular peripheral device is installed. Specify conditions in URI notation. + + + + + Specifies the content fragment that replaces the parent element at presentation time. An empty reference cannot be defined for a content fragment. Actual content is always used as a placeholder, the required content fragment replaces the placeholder at presentation time. + + + + + Specifies one or more subsequent elements to replace when the parent element consists of multiple root elements. The first element always uses the value of the replaceWith attribute; subsequent elements use the value of the conditionalDelete attribute. + + + + + + + + + + + + Includes the common attributes, allows character data and the notLocalizable element. + + + + + + + + + + + This type includes the common attributes and allows integer data. + + + + + + + + + + Intended for creating empty elements without attributes. There is no schema type for empty. + + + + + + Identifies a span of text that should not be localized. + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/baseConditional.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/baseConditional.xsd new file mode 100644 index 0000000..6d1e900 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/baseConditional.xsd @@ -0,0 +1,121 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + + + + + + + + Specifies a programming language. + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Specifies the identifier for a platform (such as an operating system version). + + false + + + + + + + + + + + Describes a collection of platform elements. + + n/a + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/block.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/block.xsd new file mode 100644 index 0000000..d6e2e6c --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/block.xsd @@ -0,0 +1,23 @@ + + + + + This schema definition defines block inline types for the CS Schema. This schema is part of the base layer. + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/blockCommon.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/blockCommon.xsd new file mode 100644 index 0000000..a395df8 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/blockCommon.xsd @@ -0,0 +1,90 @@ + + + + + Defines block inline types for the Content Studio Schema. This schema is part of the base layer. + + + + + + + Describes a span of introductory text within a para element. + + + + + Specifies a class for the leadInPhrase element. + + + + + + + + + + + + + Describes a paragraph, the most basic documentation unit. In addition to text, it can contain child elements to indicate various inline text types, or to add functionality such as a task or a shortcut. + + + + + + + + + + + + + + + + + + + + + + Specifies the title of a document, or part of a document. + + + + + Specifies a secondary title for a document, or part of a document. + + + + + Describes a quotation. The quote element can contain text and child elements, which can be used to indicate various inline text types. + + + + + Replaced at build time by the shared content to which it refers using the parameters provided by the user. The parameters can consist of text, and XML markup. In most cases the parameter values will not be localizable content. + + + + + Specifies a link to another entry within a document. + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/blockSoftware.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/blockSoftware.xsd new file mode 100644 index 0000000..73c281d --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/blockSoftware.xsd @@ -0,0 +1,23 @@ + + + + + This schema definition defines block inline types for the CS Schema. This schema is part of the base layer. + + + + + + + + Identifies a span of text that relates to a user interface, or console output text. + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/command.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/command.xsd new file mode 100644 index 0000000..cb5aef8 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/command.xsd @@ -0,0 +1,377 @@ + + + + + + This schema describes the command page type of MAML. + + + + + + + + + + + + The commandHelp element describes the content model for the command help content type. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The commandDetails element ... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The commandSyntax element ... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The commandParameters element ... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The inputTypes element ... + + + + + + + + + + + + + + + + + + + + + + + The returnTypes element ... + + + + + + + + + + + + + + + + + + + + + + + The commandExceptions element ... + + + + + + + + + + + + + + + The commandErrors element ... + + + + + + + + + + + + + + + + + + + + + The commandExamples element ... + + + + + + + + + + + + + + + + + + + + + The configuration element ... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/conditionSet.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/conditionSet.xsd new file mode 100644 index 0000000..0c4f8e4 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/conditionSet.xsd @@ -0,0 +1,92 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + + + + + + + + + Describes the axis of a condition. In conditional markup, the axis refers to a category of conditions, such as installed hardware or user privilege. + + false + + + + + + + + + + + Describes the value of a condition. + + false + + + + + + + + + + + + Describes a condition to evaluate, that is part of a conditionSet element. + + n/a + + + + + + + + + + + + Describes the attached content with a unique ID/GUID/URI to reference for purposes such as sharing and hyperlinking. + + + + + + Describes a set of conditions to evaluate. Each condition relates to a particular predefined condition, and can evaluate to true or false. + + false + + + + + + + + + + + Describes a collection of condition sets. + + false + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developer.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developer.xsd new file mode 100644 index 0000000..6f4dd53 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developer.xsd @@ -0,0 +1,261 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + + + + + + + Contains a detailed discussion of the current item. + + n/a + + + + + + Contains instructions for building a code example. + + n/a + + + + + + Contains a discussion of error handling and other related issues. + + n/a + + + + + + Contains a discussion of security issues. + + n/a + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Describes a block of example code text. + + + + + + + + + Specifies the programming language used in a code example or some other programmatic structure. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Specifies a reference to a block of code. + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerCommand.rld b/newton-cn/bin/v1.0/Schemas/PSMaml/developerCommand.rld new file mode 100644 index 0000000..6618568 Binary files /dev/null and b/newton-cn/bin/v1.0/Schemas/PSMaml/developerCommand.rld differ diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerCommand.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developerCommand.xsd new file mode 100644 index 0000000..cd1ceae --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developerCommand.xsd @@ -0,0 +1,347 @@ + + + + + + This schema describes the command page type of MAML. + + + + + + + + + The command element describes the content model for the command help content type. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerDscResource.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developerDscResource.xsd new file mode 100644 index 0000000..f884e4d --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developerDscResource.xsd @@ -0,0 +1,45 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + + + + + + Root element of DscResource type. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerManaged.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManaged.xsd new file mode 100644 index 0000000..f011ffc --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManaged.xsd @@ -0,0 +1,229 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + This portion of the schema was created by chains in Dec 2004. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedClass.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedClass.xsd new file mode 100644 index 0000000..edb7ad3 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedClass.xsd @@ -0,0 +1,67 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + This portion of the schema was created by chains in Dec 2004. + + + + + + + + + + + + + + + + + + + + + + + + + + + Root element of managedClass page type. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedConstructor.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedConstructor.xsd new file mode 100644 index 0000000..5a06d97 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedConstructor.xsd @@ -0,0 +1,38 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + This portion of the schema was created by chains in Dec 2004. + + + + + + + + + + + + + + + + + + + + + + + + Root element of managedConstructor page type. + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedDelegate.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedDelegate.xsd new file mode 100644 index 0000000..1b24239 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedDelegate.xsd @@ -0,0 +1,37 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + This portion of the schema was created by chains in Dec 2004. + + + + + + + + + + + + + + + + + + + + + + + Root element of managedDelegate page type. + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedEnumeration.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedEnumeration.xsd new file mode 100644 index 0000000..bb1da97 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedEnumeration.xsd @@ -0,0 +1,33 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + This portion of the schema was created by chains in Dec 2004. + + + + + + + + + + + + + + + + + + + Root element of managedEnumeration page type. + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedEvent.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedEvent.xsd new file mode 100644 index 0000000..581b63a --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedEvent.xsd @@ -0,0 +1,52 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + This portion of the schema was created by chains in Dec 2004. + + + + + + + + + + + + + + + + + + + + + + + Root element of managedEvent page type. + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedField.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedField.xsd new file mode 100644 index 0000000..c620a8c --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedField.xsd @@ -0,0 +1,45 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + This portion of the schema was created by chains in Dec 2004. + + + + + + + + + + + + + + + + + + + + + + Root element of managedField page type. + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedInterface.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedInterface.xsd new file mode 100644 index 0000000..a285890 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedInterface.xsd @@ -0,0 +1,45 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + This portion of the schema was created by chains in Dec 2004. + + + + + + + + + + + + + + + + + + + + + + + + Root element of managedInterface page type. + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedMethod.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedMethod.xsd new file mode 100644 index 0000000..d90ca0b --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedMethod.xsd @@ -0,0 +1,38 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + This portion of the schema was created by chains in Dec 2004. + + + + + + + + + + + + + + + + + + + + + + + + Root element of managedMethod page type. + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedNamespace.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedNamespace.xsd new file mode 100644 index 0000000..530f607 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedNamespace.xsd @@ -0,0 +1,55 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + This portion of the schema was created by chains in Dec 2004. + + + + + + + + Root element of managedNamespace page type. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedOperator.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedOperator.xsd new file mode 100644 index 0000000..39af975 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedOperator.xsd @@ -0,0 +1,22 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + This portion of the schema was created by chains in Dec 2004. + + + + + + + + Root element of managedOperator page type. + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedOverload.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedOverload.xsd new file mode 100644 index 0000000..2fe1521 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedOverload.xsd @@ -0,0 +1,39 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + This portion of the schema was created by chains in Dec 2004. + + + + + + + + Root element of managedOverload page type. + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedProperty.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedProperty.xsd new file mode 100644 index 0000000..875051e --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedProperty.xsd @@ -0,0 +1,46 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + This portion of the schema was created by chains in Dec 2004. + + + + + + + + + + + + + + + + + + + + + + + Root element of managedProperty page type. + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedStructure.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedStructure.xsd new file mode 100644 index 0000000..7320d74 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developerManagedStructure.xsd @@ -0,0 +1,45 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + This portion of the schema was created by chains in Dec 2004. + + + + + + + + + + + + + + + + + + + + + + + + + + Root element of managedStructure page type. + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerReference.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developerReference.xsd new file mode 100644 index 0000000..c237e93 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developerReference.xsd @@ -0,0 +1,305 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + + + + + + + + Identifies the name of an assembly. + + false + + + + + + Identifies the version of an assembly. + + false + + + + + + Identifies the culture of an assembly. + + false + + + + + + Identifies the public key for an assembly. + + false + + + + + + Identifies the hash for an assembly. + + false + + + + + + + + + + + + + + + Describes a collection of information for an assembly. + + n/a + + + + + + + Reserved for internal use. + + n/a + + + + + + Specifies the return value of a function or property. + + n/a + + + + + + Contains a discussion of the thread safety characteristics of the current item. + + n/a + + + + + + Contains information that is only relevant to implementers of the current item. + + n/a + + + + + + Contains information that is only relevant to callers of the current item. + + n/a + + + + + + Contains information that is only relevant to inheritors of the current item. + + n/a + + + + + + + + + + + + Refers to another code entity that performs a function similar to that of the current code entity. Unlike the current entity, the target of the reference is CLS-compliant. + + n/a + + + + + + Refers to another code entity that performs the same function as the current code entity. It is typically used for mapping from an operator to the equivalent function (such as from op_Equality to Equals) or from an obsolete item to its replacement. + + n/a + + + + + + Contains a description of a generic or template parameter. + + n/a + + + + + + + + + + + Contains a collection of genericParameter elements. + + n/a + + + + + + Contains a description of a functional parameter. + + n/a + + + + + + + + + + + Describes a collection of parameter elements. + + n/a + + + + + + Contains a description of one type of exception. + + n/a + + + + + + + + + + + Contains a collection of exception elements. + + n/a + + + + + + Contains a discussion of a particular permission required to use the current code element. + + n/a + + + + + + + + + + + Contains a collection of permission elements. + + n/a + + + + + + + + + + + + Contains a collection of platforms along with a discussion of the behavior of the current code entity on those platforms. + + n/a + + + + + + + + + + + Contains a collection of platformNote elements. + + n/a + + + + + + + + + + + + + + + + + + + + + + + + + + + + Contains the documentation for a single code entity. A code entity is a type, member, or overload-set. The code entity is identified by a single codeEntityReference element, that is a child of this element. + + n/a + + + + + + + + + + + Contains a simple collection of codeEntity elements. + + n/a + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerStructure.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developerStructure.xsd new file mode 100644 index 0000000..d562f7d --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developerStructure.xsd @@ -0,0 +1,93 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + + + + + + + + Contains a detailed discussion of the current item. + + n/a + + + + + + Contains instructions for building a code example. + + n/a + + + + + + Contains a discussion of error handling and other related issues. + + n/a + + + + + + Contains a discussion of security issues. + + n/a + + + + + + + + + + + + + + + + + + + + + + + Contains a discussion of a code example. + + n/a + + + + + + + + + + + Contains a collection of codeExample elements. + + n/a + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/developerXaml.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/developerXaml.xsd new file mode 100644 index 0000000..edbb10b --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/developerXaml.xsd @@ -0,0 +1,145 @@ + + + + + This schema describes MAML (Microsoft Assistance Markup Language). MAML is intended for software documentation. In particular, MAML is intended to accommodate the needs of Microsoft documentation. + The schema is broken into three main areas: end user, developer and IT Pro. These areas represent the main categories of Microsoft documentation. + The namespace uri for this version of MAML is: http://schemas.microsoft.com/maml/2004/10. + Each backwards-incompatible revision to MAML will require that the date fields be appropriately incremented in uri of the updated version of the MAML schema. + + + This portion of the schema was created by chains in Dec 2004. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/endUser.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/endUser.xsd new file mode 100644 index 0000000..03b9bf1 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/endUser.xsd @@ -0,0 +1,42 @@ + + + + + Describes the end user content types of MAML. These content types represent schema structures that are used to create documentation for end-users. End user structures are pervasive in Windows XP and Office XP documentation. + + + + + + + + + + + + Describes the content model for the conceptual content type. Conceptual topics provide a high-level overview of particular technology areas. + + + + + Describes the content model for the tutorial content type. Tutorial topics are used to provide instructions for performing tasks that are broader in scope than simply one procedure. Typically, a tutorial will encompass two or more shorter procedures. + + + + + Describes the content model for the procedural content type. Procedural topics describe some process or set of processes that explain how to accomplish a specific task, such as installing a printer. + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/faq.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/faq.xsd new file mode 100644 index 0000000..92cd580 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/faq.xsd @@ -0,0 +1,89 @@ + + + + + This schema definition defines the FAQ content model for the Content Studio schema. This schema is part of the base layer. + + + + + + Describes the content model for the FAQ content type. The FAQ content type is used to create frequently asked question (FAQ) documents. A document that uses the FAQ content type can consist of one or more sets of questions and answers. + + + + + Describes a titled division within a frequently asked question (FAQ) document. Each faqDiv element can contain one or more faqEntry elements. + + + + + + + + + + + + + + + + Describes a question-answer pair within a frequently asked question (FAQ) document. + + + + + + + + + + + + + + + Describes the question text for a frequently asked question (FAQ) entry. + + + + + Describes an answer to a frequently asked question (FAQ) entry. + + + + + + + + + + Specifies the name of the document author. + + + + + + + + + + + + + + + + Specifies the type of content for the document. + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/glossary.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/glossary.xsd new file mode 100644 index 0000000..f356205 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/glossary.xsd @@ -0,0 +1,54 @@ + + + + + This schema definition defines the glossary content type for the Content Studio Schema. This schema is part of the base layer. + + + + + + Describes the content model for the glossary content type. Glossary topics contain a set of terms and associated definitions. + + + + + + + + + + + + + Specifies the type of content for the document. + + + + + + + + Describes a titled section within a glossary. Each glossaryDiv element can contain one or more glossaryEntry elements. + + + + + + + + + + Specifies the class of the element. + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/hierarchy.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/hierarchy.xsd new file mode 100644 index 0000000..e5b0355 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/hierarchy.xsd @@ -0,0 +1,206 @@ + + + + + This schema definition defines common hierarchy types for the Content Studio Schema. This schema is part of the base layer. + + + + + + Describes the content model for the reusableContent content type. A typical reusableContent topic consists of a collection of content that can be shared among multiple documents. Each entry has a unique ID, which facilitates linking. An entry can contain a wide variety of content, ranging from a string to an entire section of a document. + + + + + + Provides a general container for any MAML content. This content must be in the MAML namespace and conform to the rules specified in the schema. Strict validation is performed on MAML parts. + + + + + + + + + + + Contains a block of data that defines a Help behavior. The helpBehavior element allows authors to extend standard help behaviors with custom code in the form of .NET assemblies. + + + + + + Specifies a qualified name identifying the assembly to be called. + + + + + Specifies the name of the assembly. + + + + + + + Identifies the name of the helpBehavior object to invoke the method on. + + + + + Specifies the name of the class to invoke. + + + + + + + Specifies the name of the assembly method to call, if any. + + + + + Name of the assembly method to call. + + + + + + + Defines a list of parameters to pass to the target behavior. + + + + + Allows the inclusion of XML fragments from any other namespace. + + + + + + + + + Describes the attached content with a unique ID/GUID/URI to reference for purposes such as sharing and hyperlinking. + + + + + Specifies the class of helpBehavior. + + + + + + + + Specifies the type of content for the document. + + + + + + + + + + + + + + + + + + + + + + Describes a section within a document. The section element supports recursion (in other words, an instance of a section element can have one or more section elements as children). The section element defines the hierarchy of sections within a topic through nesting. Each section corresponds to a heading level in the final, rendered document. For example, the top section is equivalent to the first heading level and a child section of that element would be the second level. + + + + + + + + + + + + + + + + + + + + + + + Contains a collection of section elements. The sections element encloses the major body of the document. + + + + + Describes a span of authored content. + + n/a + + + + + + + + + + + + + + + + + + + + + + + + + + Describes a collection of links, typically used for the "Related Topics" section of a document. The purpose of this element is to provide links to topics that may be of further interest to the user. + + n/a + + + + + + Describes copyright information for a document. + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/inline.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/inline.xsd new file mode 100644 index 0000000..c8835db --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/inline.xsd @@ -0,0 +1,182 @@ + + + + + This schema aggregates inline elements from other inline schemas. + + + + + + + + + + + + + + + Describes a link from one glossary entry to another related glossary entry. + + + + + + + + + + + + + + + Describes a simple inline-only content model. It provides both text and elements with similarly simple content models. + + + + + + + + + + + + + + + Deprecated; do not use. + + true + + + + + + + + + + + + Deprecated; do not use. + + n/a + + + + + + Contains summary text that provides further information about a link. + + + + Abstracts href attribute and linkText and summary elements. + + + + + + + + + Defines one or more name/value pairs that contain parameter data to pass to the target. + + + + + Specifies the name of the parameter. + + + + + Specifies the value of the parameter. + + + + + + + Describes a collection of objectParameter elements. + + + + + + + + + + + + + + + + + + + Provides a hosting environment for the appropriate multimedia player. + + + + + Specifies caption text for the object. + + + + + Specifies the URI path to the object. + + + + + Specifies the URI path to a preview object, such as a thumbnail image. + + + + + + Specifies whether target verification should be used. + + + + + + Contains descriptive text for a link. + + + + + + + + + + + + + The navigationLink element is the navigational link in MAML, intended to produce a jump-type link in the help pane. Glossary links are navigation links. + + + + + + + + + + + Specifies the URI for a navigation link. + + + + + + + Denotes the first instance of a new term within a document. Use the newTerm element to introduce terms that the user may be unfamiliar with. + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/inlineCommon.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/inlineCommon.xsd new file mode 100644 index 0000000..28fbe77 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/inlineCommon.xsd @@ -0,0 +1,212 @@ + + + + + This schema defines common inline elements. + + + + + + + + Identifies an acronym within a body of text. + + + + + Identifies an abbreviation within a body of text. + + + + + Identifies a quotation within a body of text. + + + + + Identifies a date within a body of text. + + + + + Identifies a phrase of a language different than the primary language of a document. + + + + + Contains a span of text, but does not specify any semantics by itself. Use the phrase element to insert replaceable content into a document when no other element is suitable. + + + + + Specifies a span of conditional text, within a body of text. + + + + + + + + + + + + + + + Identifies a subscript in a mathematical expression. A subscript is a character or symbol that displays slightly below and to the side of another character. + + true + + + + + + Identifies a superscript in a mathematical expression. A superscript is a character or symbol that displays slightly above and to the side of another character. + + true + + + + + + + Describes a corporate trademark. + + + + + Specifies the year of a particular copyright. + + + + + Specifies the person or company that holds a particular copyright. + + + + + Describes the copyright information for a document. + + + + + + + + + + Specifies the type of trademark used. + + + + + + + + + + + + + + + + Identifies the name of a corporation within a body of text. + + + + + Identifies the name of a country within a body of text. + + + + + + Describes an alert that appears inline within a body of text. + + + + + + + Specifies the type of an alert. + + + + + + + + + Describes an XML entity that appears inline within a body of text. + + + + + Specifies the type of entity. + + + + + + + Describes a range of values, such as numbers or characters. + + + + + + Identifies a span of text to be associated with a footnote reference. + + + + + Identifies a line break (carriage return) within a body of text, without breaking the paragraph. + + + + + Identifies a word that has special meaning in reference documentation (e.g., in C# const is a language keyword). + + + + + This element identifies strings that represent a mathematical elements. The intent is to allow rendering to format a math element in a font that supports displaying the text appropriately (example would be allowing for a font to render the Pi symbol appropriately). + + + + + + This type describes the set of inline elements that are likely to be needed for block elements' content models. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/inlineSoftware.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/inlineSoftware.xsd new file mode 100644 index 0000000..430dee4 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/inlineSoftware.xsd @@ -0,0 +1,195 @@ + + + + + This schema definition defines the common reference types within the Content Studio schema. + + + + + + + Identifies the name of an application, such as Microsoft Windows or Notepad, within a body of text. + + + + + Identifies the name of a database within a body of text. + + + + + Identifies an Internet address, such as a Web URL or an e-mail address, within a body of text. + + + + + + + Indicates the type of URI to use. + + + + + + + + + + + + + + + + Specifies a path to a local resource. + + + + + + + + + Indicates the type of URI to use. + + + + + + + + + + + + + + + + + + + Identifies an operating system environment variable within a body of text. + + + + + Identifies a string of error text within a body of text. + + + + + Identifies the name of a computer hardware component or peripheral device, within a body of text. + + + + + Identifies a literal value within a body of text. + + + + + Identifies a string of markup, such as XML or TeX, within a body of text. + + + + + Identifies the name of an executable or other software application. + + + + + + + + + + Identifies a span of text representing part of a command or function that the user replaces. + + + + + Identifies a symbol within a body of text that represents a grammatical construct, or is a link to something else. Similar to the literal element. + + + + + Identifies a string of code, within a body of text. + + + + + Identifies textual content associated with a user interface or console output, within a body of text. + + + + + Identifies a string that represents a command prompt or user interface input field, within a body of text. + + + + + Identifies text representing a user interface element, within a body of text. + + + + + Identifies a registry entry, within a body of text. + + + + + + Specifies the name of the registry entry. + + + + + Specifies the key value of the registry entry. + + + + + Specifies the value of the registry entry. + + + + + + Specifies the type of registry entry. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/inlineUi.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/inlineUi.xsd new file mode 100644 index 0000000..ad383b1 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/inlineUi.xsd @@ -0,0 +1,166 @@ + + + + + This schema definition defines the inline UI elements for the Content Studio Schema. This schema is part of the base layer. + + + + + + + Identifies one or more selections from a menu. + + + + + + + + + + + + + + + + Identifies a computer keyboard key combination for an action that is also available through the menu. + + + + + + + + + + + Specifies which mouse button to click, as part of a UI automation sequence. + + + + + + + + + + + + + + + + + + + + + + + + Describes the identifying text on a user interface element, within a body of text. + + + + + Identifies descriptive text for an icon or graphic that appears in a user interface element, within a body of text. + + + + + Identifies the name of a menu, within a body of text. + + + + + + + + + + + Identifies the name of a menu item, within a body of text. + + + + + Identifies the name of a key on the computer keyboard, within a body of text. + + + + + Identifies the symbolic name of a key on the computer keyboard, within a body of text. + + + + + Describes a computer keyboard key combination for an action that is also available through a menu. When the userAction element is a child of an executionMethod element, it indicates a point in a task where the user is required to perform a specific action. + + + + + + + + + + + Identifies a text string representing data that the user enters, within a body of text. + + + + + + + + + + + + This type is used for describing user actions. + + + + Identifies a user action, using either the keyboard or the mouse. + + + + + + + + + + + + + + + + + This group is used for referencing all base UI elements. + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/shellExecute.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/shellExecute.xsd new file mode 100644 index 0000000..ad5b6b6 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/shellExecute.xsd @@ -0,0 +1,54 @@ + + + + + This schema defines a way to specify a command line that will be executed as a shell execute. This schema is part of the base layer. + + + + + + + + + + + + + + + + + + + + + + + Contains a string with the command to execute. This typically consists of the name of a program or other executable, followed by and commands or parameters. For example: "notepad myFile.txt". + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/structure.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/structure.xsd new file mode 100644 index 0000000..1a1d4fc --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/structure.xsd @@ -0,0 +1,132 @@ + + + + + This schema definition defines common structure types for the Content Studio Schema. This schema is part of the base layer. + + + + + + + + + + + Describes an example within a topic. Examples are typically one or more lines of code. + + + + + Contains transitional text to insert between divisions within a document. + + + + + Contains a summary, introduction, or short description of the current item. This text typically appears in a topic and may also be used as the description of the topic that appears in a jump table when the topic is being linked to. + + n/a + + + + + + + Describes the common structure elements. It is intended for use in page types and structure elements. + + + + + + + Used for cases where both structure and block elements are needed; however, a limited set of elements is desired. + + + + + + + + Specifies whether the element should appear in an expanded or collapsed state at display time of the element. + + + + + + + + + + + + Identifies a span of text to render as a sidebar or similar alternate presentation. + + + + + Identifies a span of text to render as a pull quote or similar alternate presentation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Contains a reference to a code entity. + + false + + + + + + + + + + + + + Describes the schema for any block of text that can occur in an ACW panel. + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/structureGlossary.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/structureGlossary.xsd new file mode 100644 index 0000000..af8ba4b --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/structureGlossary.xsd @@ -0,0 +1,93 @@ + + + + + This schema definition defines question and answer types for the Content Studio Schema. This schema is part of the base layer. + + + + Describes a term, and set of associated definitions in a glossary. + + + + + + + + Contains one or more links to related glossary entries. + + + + + + + + + + + + Specifies the applicable platform for the term. + + + + + Specifies the applicable product for the term. + + + + + + + Contains one or more term elements for a glossary entry. + + + + + + + + + + Describes a word or phrase in a glossary entry. + + + + + + Specifies equivalent text in a different encoding for sorting purposes. Use the rubyText element to sort terms presented in languages that cannot be sorted alphabetically. + + + + + + Specifies an arbitrary class for the term. + + + + + Specifies the part of speech used by the term. + + + + + Specifies a specific geographical usage for the term. + + + + + Specifies the applicable language for the term. + + + + + Describes the attached content with a unique ID/GUID/URI to reference for purposes such as sharing and hyperlinking. + + + + + + + Explains the meaning of a term for a glossary entry. + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/structureList.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/structureList.xsd new file mode 100644 index 0000000..92deaee --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/structureList.xsd @@ -0,0 +1,99 @@ + + + + + This schema definition defines common structure types for the Content Studio Schema. This schema is part of the base layer. + + + + + + + Describes a span of content to present in a list format. + + + + + + + + Specifies the type of list to create. + + + + + + + + + + + + + + + + Describes an item within a list element. The content of the listItem element is treated as a unit. + + + + + + + Indicates whether the list item, if selectable, is selected in a default rendering. + + + + + + + + + + + + + + + Specifies content of elevated importance or otherwise that needs to be called out. The alert element is a single-level alert structure. + + + + + + + + + Contains a collection of alert elements. An alertSet element can have one or more alert elements as children. Use the alertSet element for more than one alert item of the same type. For example, if a topic had three items for the notes section, an alertSet could be used to combine them. + + + + + + + + + Specifies the type of alert. + + + + + + + + + + Describes the common lists that can be used to describe list data. + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/structureProcedure.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/structureProcedure.xsd new file mode 100644 index 0000000..1f4d1fb --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/structureProcedure.xsd @@ -0,0 +1,49 @@ + + + + + This schema definition defines common structure types for the Content Studio Schema. This schema is part of the common layer. + + + + + + Contains a single step in a task. A step can consist of text, one or more UI actions, or a branch point. + + n/a + + + + + + + + + + + + + Describes a list of sequenced steps required to complete a task. + + n/a + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/structureTable.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/structureTable.xsd new file mode 100644 index 0000000..06657a2 --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/structureTable.xsd @@ -0,0 +1,132 @@ + + + + + This schema definition defines common hierarchy types for the Content Studio Schema. This schema is part of the base layer. + + + + + + + Describes a table structure. The table element is the parent of all elements within a table structure. The MAML table model conforms to the Computer-Aided Acquisition and Logistic Support group (CALS) table model (a standard formatting type designed by the Department of Defense). + + + + + + + + + + + + + + + + + Describes an entry within a table. + + + + + + + + + Describes a table entry, which is equivalent to a cell within a table row. + + + + + Describes a table entry, which is equivalent to a cell within a table row. Use the headerEntry element for text or other content related to a tableHeader. + + + + + Describes a table entry, which is equivalent to a cell within a table row. Use the footerEntry element for text or other content related to a tableFooter. + + + + + Describes a row within a standard table structure. Each row can contain one or more entries. + + + + + + + + + + + + Describes a table header, typically the first row in a table. + + + + + Describes a table footer, typically the last row in a table. + + + + + + This type is intended for use as the children of table elements. + + + + + + + + + This type describes the attributes for table Entry. + The attributes used are not from docbook, but are modeled off of XHTML v1.1. + + + + Specifies the number of additional rows that the current entry (cell) should span. Similar in concept to the HTML rowspan attribute. This value should be a positive integer. + + + + + Specifies the number of additional columns that the current entry (cell) should span. Similar in concept to the HTML colspan attribute. This value should be a positive integer. + + + + + + + + + + + + + + + + Describes an entry in a definitionList. Each entry consists of a term/definition pair, and an optional URI. + + + + + + + + Defines a two column table with no header or footer. The first column contains the definition term, the second column contains the definition. + + n/a + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/structureTaskExecution.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/structureTaskExecution.xsd new file mode 100644 index 0000000..399449f --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/structureTaskExecution.xsd @@ -0,0 +1,178 @@ + + + + + Holds Windows UI Automation information. Gets referred to by ActionRef and ElementRef tags. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/task.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/task.xsd new file mode 100644 index 0000000..73da9ca --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/task.xsd @@ -0,0 +1,464 @@ + + + + + This schema file defines the schema for an automated procedural file. + + + + + + + + Refers to a UI element that is stored in a different schema. + + + + + + Refers to a uiAction element inside the taskExecutionBlock element. + + + + + Not yet implemented. + + + + + Not yet implemented. + + + + + Instructs ACW to show the action only in the specified playback mode (do it or show me). + + + + + Instructs ACW to act on the user's current selection (for example, a list item). Use actOnSelection in cases where a user is required to make a selection from a set of options that are not known at authoring time. + + + + + Instructs ACW to select the sole option in cases where only one option is available. Use caution when applying this attribute, as it may not be appropriate in some situations. + + + + + Set to true to indicate that this step commits a change (for example, this is a "Click OK" step). Set to false to indicate that this step doesn't actually perform any action (e.g. clicks a button that opens a dialog, or sets a checkbox but doesn't commit it). Helps the ACW runtime understand, when it ends, if it needs to try to show undo steps, or if no actions have actually happened. + + + + + + + + The root element for the automated task content type. Use the automated task content type to create topics that host Active Content Wizard (ACW) tasks. ACW tasks can either guide users through a task incrementally, or perform the task automatically. + + + + + + + Specifies the type of content for the document. + + + + + Specifies whether a welcome message should be displayed upon launching an Active Content Wizard (ACW) task. The welcome message contains a short description of the task, and prompts the user to select a playback mode (do it or show me). The default value is true. + + + + + Specifies whether a summary should be displayed upon completing an Active Content Wizard (ACW) task. The default value is true. + + + + + Not yet implemented. Specifies the version of the Active Content Wizard (ACW) script code for the current task. Used for troubleshooting. + + + + + Setting this to False means that the runtime should not show any generated undo steps when the task ends. Setting this to True means that the runtime should show undo steps when the task ends. + + + + + + + + + Describes a list of steps the user needs to perform in order to complete the task. + + + + + Provides information about the author of the document. + + + + + + Specifies the name of the author. + + + + + Specifies a URI that can be used to link to further information or resources related to the author. + + + + + Contains descriptive text about the author. + + + + + Specifies a URI that can be used to link to a graphic image of the author. + + + + + + + + Describes a set of steps that can be executed as an automated task (ACW), or displayed as a help topic. + + + + + + Introduction text for the task. + + + + + A procedure is a list of steps to take that should complete the task. + + + + + + + + + Allows creator of the content file to provide information about themselves + + + + + Contains computer-generated automation markup. Do not manually edit the contents of this element. + + + + + + + + + + + + + + + This step consists of nothing but text. In show-me, it's a step by itself. In Do-it, it's either ignored, or we stop to show, depending on attribute value + + + + + The step consists of one or more clicks on UI elements. + + + + + If the "condition" attribute in the step tag returns true then print the text inside here and stop the procedure + + + + + Present the user with a list of radio-button options, and invite him to choose one. + + + + + Instead of executing the next step in this task, execute the one with the same ID as the ID specified here + + + + + A step that launches a shell execute command line + + + + + Can mingle subTasks with a step. To call a subTask in another file, use the replaceWith attribute + + + + + A way of grouping steps together, for purposes of applying a state condition or runtime condition to several steps + + + + + + + + Describes a step that consists solely of text. If the task is being run in Show Me mode, it functions as a step in the procedure. In Do It mode, it is either ignored, or automation pauses to display the text, depending on the value set in the showDuringDoIt attribute. + + + + + + + + + + + + + + + + Describes one or more actions to perform on UI elements. + + + + + + + + + + + + Indicates whether a procedure should stop at the current point, based on the condition attribute. If the value in the condition attribute evaluates to true, the procedure stops, and any remaining text is displayed. + + + + + + + + + + + + + Displays a list of choices for the user. The script specifies steps to run for each choice. + + + + + + Provides information about user choices. Contains introductory text for a userChoiceStep element. + + + + + Each radio button option is in an Option tag. The option's text is in the Para tag, and if the user chooses this option, goto the associated target. + + + + + Contains text that prompts the user to choose from options defined in the userChoiceStep element. + + + + + + Indicates which user option should be the default. + + + + + + + + Skips forward or backward in the current sequence, to the step with the specified ID. + + + + + Specifies the IDREF for a step within a sequence. This value must match the id of another step in the document. + + + + + + + + Runs a Windows shell command. This element is the programmatic equivalent of clicking Start, clicking Run, and then entering a command. + + + + + + + + + + + + Adds a subTask to a step. Use the reusableContentEntry attribute to include a subTask element that has been defined in a different file. + + + + + Groups steps together so that standard MAML conditions, and the ifPresent attribute, can be applied to several steps at once. + + + + + + + Describes actions to perform only if a particular UI element, such as an error message dialog, is present. Otherwise the actions are skipped. Set the ifPresent attribute to true in cases where a UI element does not appear consistently, or may appear unexpectedly. + + + + + + + + + + + + Describes actions to perform only if a particular UI element, such as an error message dialog, is present. Otherwise the actions are skipped. Set the ifPresent attribute to true in cases where a UI element does not appear consistently, or may appear unexpectedly. The default value is false. + + + + + + + + Specifies a single option in a list of single-choice options. Use a para element to specify the text for the option. Alternatively, specifies a branch condition, which can either be explicitly chosen by the user, or by a state condition check. + + + + + + + + + + + + This is to represent a branch condition (either explicitly chosen by the user or by a state condition check.) + + + + + Specifies the label text to display for an option. + + + + + Contains the steps to run if the user chooses the associated option. + + + + + + + + Encodes some sequence of UI actions. + + + + + Each action has an ID that refers to the action's complete structure, stored elsewhere. + + + + + Full text description of the entire step. May encompass more than one click action. + + + + + Text description of how to undo this step. To be displayed when task finishes. + + + + + + + + + + + + + + + + + + + + + + + Unique identifier for the step. (Note: This attribute is not of type ID because the 'address' attribute already uses ID, and XSD forbids two attributes of type ID on a single element). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Contains steps to run if an actionRef fails to execute. + + + + + + + + Refers to a uiAction element inside the taskExecutionBlock. + + + + + Specifies the reason for failure using an enumeration value of type failureReasonEnumType. + + + + + + diff --git a/newton-cn/bin/v1.0/Schemas/PSMaml/troubleshooting.xsd b/newton-cn/bin/v1.0/Schemas/PSMaml/troubleshooting.xsd new file mode 100644 index 0000000..4232f2f --- /dev/null +++ b/newton-cn/bin/v1.0/Schemas/PSMaml/troubleshooting.xsd @@ -0,0 +1,78 @@ + + + + + This schema definition defines the troubleshooting base type within the Content Studio schema. + + + + + + + + Describes the content model for the troubleshooting content type, which is used to create topics that guide users through solving problems. + + + + + + + + + + + + + + + + Specifies the type of content for the document. + + + + + + + Describes a problem sequence in a troubleshooting list. + + + + + + + + + + + + + + + Describes a symptom in a problem sequence. + + + + + Describes the cause of a symptom in a problem sequence. + + + + + Describes the solution for a problem in a problem sequence. + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/WSMan.Format.ps1xml b/newton-cn/bin/v1.0/WSMan.Format.ps1xml new file mode 100644 index 0000000..8e34497 Binary files /dev/null and b/newton-cn/bin/v1.0/WSMan.Format.ps1xml differ diff --git a/newton-cn/bin/v1.0/en-US/powershell.exe.mui b/newton-cn/bin/v1.0/en-US/powershell.exe.mui new file mode 100644 index 0000000..23508ec Binary files /dev/null and b/newton-cn/bin/v1.0/en-US/powershell.exe.mui differ diff --git a/newton-cn/bin/v1.0/getevent.types.ps1xml b/newton-cn/bin/v1.0/getevent.types.ps1xml new file mode 100644 index 0000000..5a5731b Binary files /dev/null and b/newton-cn/bin/v1.0/getevent.types.ps1xml differ diff --git a/newton-cn/bin/v1.0/ko-KR/PSEvents.dll.mui b/newton-cn/bin/v1.0/ko-KR/PSEvents.dll.mui new file mode 100644 index 0000000..71b8d42 Binary files /dev/null and b/newton-cn/bin/v1.0/ko-KR/PSEvents.dll.mui differ diff --git a/newton-cn/bin/v1.0/ko-KR/default.help.txt b/newton-cn/bin/v1.0/ko-KR/default.help.txt new file mode 100644 index 0000000..7fc3b06 --- /dev/null +++ b/newton-cn/bin/v1.0/ko-KR/default.help.txt @@ -0,0 +1,112 @@ + +항목 + Windows PowerShell 도움말 시스템 + +간단한 설명 + Windows PowerShell cmdlet 및 개념에 대한 도움말을 표시합니다. + +자세한 설명 + Windows PowerShell 도움말은 Windows PowerShell cmdlet, + 함수, 스크립트 및 모듈에 대해 설명하고 Windows PowerShell 언어의 요소를 비롯한 + 개념에 대해 설명합니다. + + Windows PowerShell에는 도움말 파일을 포함하고 있지 않지만 온라인에서 + 도움말 항목을 확인하거나, Update-Help cmdlet을 사용하여 도움말 파일을 + 컴퓨터에 다운로드한 다음 Get-Help cmdlet을 사용하여 도움말 항목을 + 명령줄에 표시할 수 있습니다. + + 또한 업데이트된 도움말 파일이 발표되면 Update-Help cmdlet을 사용하여 다운로드하여 + 로컬 도움말 콘텐츠를 최신 버전으로 유지할 수 있습니다. + + 도움말 파일이 없으면 Get-Help를 통해 cmdlet, 함수, 스크립트에 대한 + 자동 생성된 도움말이 표시됩니다. + + + 온라인 도움말 + Windows PowerShell에 대한 도움말은 TechNet 라이브러리(http://go.microsoft.com/fwlink/?LinkID=108518)에서 + 확인할 수 있습니다. + + cmdlet 또는 함수에 대한 온라인 도움말을 열려면 다음과 같이 입력하십시오. + + Get-Help -Online + + UPDATE-HELP + 도움말 파일을 컴퓨터에 다운로드하고 설치하려면 + + 1. "관리자 권한으로 실행" 옵션을 사용하여 Windows PowerShell을 시작합니다. + 2. 다음과 같이 입력합니다. + + Update-Help + + 도움말 파일을 설치한 후에는 Get-Help cmdlet을 사용하여 + 도움말 항목을 표시할 수 있습니다. 또한 Update-Help cmdlet을 사용하여 + 업데이트된 도움말 파일을 다운로드하여 로컬 도움말 파일을 항상 + 최신 버전으로 유지할 수 있습니다. + + Update-Help cmdlet에 대한 자세한 내용을 보려면 다음과 같이 입력하십시오. + + Get-Help Update-Help -Online + + 또는 다음 링크로 이동하십시오. http://go.microsoft.com/fwlink/?LinkID=210614(영문) + + + GET-HELP + Get-Help cmdlet은 사용자 컴퓨터에 있는 도움말 파일의 콘텐츠로 된 + 도움말을 명령줄에 표시합니다. 도움말 파일이 없으면 Get-Help가 cmdlet 및 함수에 대한 + 기본 도움말을 표시합니다. 또한 Get-Help를 사용하여 + cmdlet 및 함수에 대한 온라인 도움말을 표시할 수 있습니다. + + cmdlet에 대한 도움말을 보려면 다음과 같이 입력하십시오. + + Get-Help + + 온라인 도움말을 보려면 다음과 같이 입력하십시오. + + Get-Help -Online + + 개념 항목의 제목은 'About_'으로 시작합니다. + 개념 또는 언어 요소에 대한 도움말을 보려면 다음과 같이 입력하십시오. + + Get-Help About_ + + 모든 도움말 파일에서 단어 또는 구문을 검색하려면 다음과 같이 입력하십시오. + + Get-Help + + Get-Help cmdlet에 대한 자세한 내용을 보려면 다음과 같이 입력하십시오. + + Get-Help Get-Help -Online + + 또는 다음 링크로 이동하십시오. http://go.microsoft.com/fwlink/?LinkID=113316 + + + 예제: + Save-Help : 인터넷에서 도움말 파일을 다운로드하고 + 파일 공유에 저장합니다. + Update-Help : 인터넷 또는 파일 공유에서 도움말 파일을 + 다운로드하고 설치합니다. + Get-Help Get-Process : Get-Process cmdlet에 대한 도움말을 표시합니다. + Get-Help Get-Process -Online + : Get-Process cmdlet에 대한 온라인 도움말을 엽니다. + Help Get-Process : Get-Process에 대한 도움말을 한 번에 한 페이지씩 표시합니다. + Get-Process -? : Get-Process cmdlet에 대한 도움말을 표시합니다. + Get-Help About_Modules : Windows PowerShell 모듈에 대한 도움말을 표시합니다. + Get-Help 원격 : '원격'이라는 단어에 대한 도움말 항목을 검색합니다. + + 참고 항목: + about_Updatable_Help + Get-Help + Save-Help + Update-Help + + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/ko-KR/powershell.exe.mui b/newton-cn/bin/v1.0/ko-KR/powershell.exe.mui new file mode 100644 index 0000000..b9ca15a Binary files /dev/null and b/newton-cn/bin/v1.0/ko-KR/powershell.exe.mui differ diff --git a/newton-cn/bin/v1.0/ko-KR/pspluginwkr.dll.mui b/newton-cn/bin/v1.0/ko-KR/pspluginwkr.dll.mui new file mode 100644 index 0000000..4806e39 Binary files /dev/null and b/newton-cn/bin/v1.0/ko-KR/pspluginwkr.dll.mui differ diff --git a/newton-cn/bin/v1.0/ko-KR/pwrshmsg.dll.mui b/newton-cn/bin/v1.0/ko-KR/pwrshmsg.dll.mui new file mode 100644 index 0000000..cff4667 Binary files /dev/null and b/newton-cn/bin/v1.0/ko-KR/pwrshmsg.dll.mui differ diff --git a/newton-cn/bin/v1.0/ko/powershell_ise.resources.dll b/newton-cn/bin/v1.0/ko/powershell_ise.resources.dll new file mode 100644 index 0000000..319a519 Binary files /dev/null and b/newton-cn/bin/v1.0/ko/powershell_ise.resources.dll differ diff --git a/newton-cn/bin/v1.0/powershell.exe b/newton-cn/bin/v1.0/powershell.exe new file mode 100644 index 0000000..7977829 Binary files /dev/null and b/newton-cn/bin/v1.0/powershell.exe differ diff --git a/newton-cn/bin/v1.0/powershell.exe.config b/newton-cn/bin/v1.0/powershell.exe.config new file mode 100644 index 0000000..2db0c0f --- /dev/null +++ b/newton-cn/bin/v1.0/powershell.exe.config @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/powershell_ise.exe b/newton-cn/bin/v1.0/powershell_ise.exe new file mode 100644 index 0000000..525c570 Binary files /dev/null and b/newton-cn/bin/v1.0/powershell_ise.exe differ diff --git a/newton-cn/bin/v1.0/powershell_ise.exe.config b/newton-cn/bin/v1.0/powershell_ise.exe.config new file mode 100644 index 0000000..69fed3b --- /dev/null +++ b/newton-cn/bin/v1.0/powershell_ise.exe.config @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/newton-cn/bin/v1.0/pspluginwkr.dll b/newton-cn/bin/v1.0/pspluginwkr.dll new file mode 100644 index 0000000..954b903 Binary files /dev/null and b/newton-cn/bin/v1.0/pspluginwkr.dll differ diff --git a/newton-cn/bin/v1.0/pwrshmsg.dll b/newton-cn/bin/v1.0/pwrshmsg.dll new file mode 100644 index 0000000..581e87b Binary files /dev/null and b/newton-cn/bin/v1.0/pwrshmsg.dll differ diff --git a/newton-cn/bin/v1.0/pwrshsip.dll b/newton-cn/bin/v1.0/pwrshsip.dll new file mode 100644 index 0000000..e9948fb Binary files /dev/null and b/newton-cn/bin/v1.0/pwrshsip.dll differ diff --git a/newton-cn/bin/v1.0/types.ps1xml b/newton-cn/bin/v1.0/types.ps1xml new file mode 100644 index 0000000..7be0db2 --- /dev/null +++ b/newton-cn/bin/v1.0/types.ps1xml @@ -0,0 +1,6689 @@ + + + + + + System.Array + + + Count + Length + + + + + System.Xml.XmlNode + + + ToString + + Microsoft.PowerShell.ToStringCodeMethods + XmlNode + + + + + + System.Xml.XmlNodeList + + + ToString + + Microsoft.PowerShell.ToStringCodeMethods + XmlNodeList + + + + + + System.Management.Automation.PSDriveInfo + + + Used + + ## Ensure that this is a FileSystem drive + if($this.Provider.ImplementingType -eq + [Microsoft.PowerShell.Commands.FileSystemProvider]) + { + $driveRoot = ([System.IO.DirectoryInfo] $this.Root).Name.Replace('\','') + $drive = Get-WmiObject Win32_LogicalDisk -Filter "DeviceId='$driveRoot'" + $drive.Size - $drive.FreeSpace + } + + + + Free + + ## Ensure that this is a FileSystem drive + if($this.Provider.ImplementingType -eq + [Microsoft.PowerShell.Commands.FileSystemProvider]) + { + $driveRoot = ([System.IO.DirectoryInfo] $this.Root).Root.Name.Replace('\','') + $drive = Get-WmiObject Win32_LogicalDisk -Filter "DeviceId='$driveRoot'" + $drive.FreeSpace + } + + + + + + System.DirectoryServices.PropertyValueCollection + + + ToString + + Microsoft.PowerShell.ToStringCodeMethods + PropertyValueCollection + + + + + + System.Drawing.Printing.PrintDocument + + + Name + $this.PrinterSettings.PrinterName + + + Color + $this.PrinterSettings.SupportsColor + + + Duplex + $this.PrinterSettings.Duplex + + + + + System.Management.Automation.ApplicationInfo + + + FileVersionInfo + [System.Diagnostics.FileVersionInfo]::getversioninfo( $this.Path ) + + + + + System.DateTime + + + DateTime + + if ((& { Set-StrictMode -Version 1; $this.DisplayHint }) -ieq "Date") + { + "{0}" -f $this.ToLongDateString() + } + elseif ((& { Set-StrictMode -Version 1; $this.DisplayHint }) -ieq "Time") + { + "{0}" -f $this.ToLongTimeString() + } + else + { + "{0} {1}" -f $this.ToLongDateString(), $this.ToLongTimeString() + } + + + + + + System.Net.IPAddress + + + IPAddressToString + + $this.Tostring() + + + + PSStandardMembers + + + SerializationDepth + 1 + + + DefaultDisplayProperty + IPAddressToString + + + + + + + Deserialized.System.Net.IPAddress + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Diagnostics.ProcessModule + + + Size + $this.ModuleMemorySize / 1024 + + + Company + $this.FileVersionInfo.CompanyName + + + FileVersion + $this.FileVersionInfo.FileVersion + + + ProductVersion + $this.FileVersionInfo.ProductVersion + + + Description + $this.FileVersionInfo.FileDescription + + + Product + $this.FileVersionInfo.ProductName + + + + + System.Collections.DictionaryEntry + + + Name + Key + + + + + System.Management.Automation.PSModuleInfo + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Name + Path + Description + Guid + Version + ModuleBase + ModuleType + PrivateData + AccessMode + ExportedAliases + ExportedCmdlets + ExportedFunctions + ExportedVariables + NestedModules + + + + + + + + System.ServiceProcess.ServiceController + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Status + Name + DisplayName + + + + + + Name + ServiceName + + + RequiredServices + ServicesDependedOn + + + ToString + + + + + + Deserialized.System.ServiceProcess.ServiceController + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Status + Name + DisplayName + + + + + + + + + System.Management.Automation.CmdletInfo + + + DLL + $this.ImplementingType.Assembly.Location + + + + + System.Management.Automation.AliasInfo + + + ResolvedCommandName + $this.ResolvedCommand.Name + + + DisplayName + + if ($this.Name.IndexOf('-') -lt 0) + { + if ($this.ResolvedCommand -ne $null) + { + $this.Name + " -> " + $this.ResolvedCommand.Name + } + else + { + $this.Name + " -> " + $this.Definition + } + } + else + { + $this.Name + } + + + + + + System.DirectoryServices.DirectoryEntry + + + PSStandardMembers + + + DefaultDisplayPropertySet + + distinguishedName + Path + + + + + + ConvertLargeIntegerToInt64 + + Microsoft.PowerShell.AdapterCodeMethods + ConvertLargeIntegerToInt64 + + + + ConvertDNWithBinaryToString + + Microsoft.PowerShell.AdapterCodeMethods + ConvertDnWithBinaryToString + + + + + + System.IO.DirectoryInfo + + + Mode + + Microsoft.PowerShell.Commands.FileSystemProvider + Mode + + + + BaseName + + $this.Name + + + + PSStandardMembers + + + DefaultDisplayProperty + Name + + + + + + + System.IO.FileInfo + + + Mode + + Microsoft.PowerShell.Commands.FileSystemProvider + Mode + + + + VersionInfo + + [System.Diagnostics.FileVersionInfo]::GetVersionInfo($this.FullName) + + + + BaseName + + if ($this.Extension.Length -gt 0){$this.Name.Remove($this.Name.Length - $this.Extension.Length)}else{$this.Name} + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + LastWriteTime + Length + Name + + + + + + + + System.Diagnostics.FileVersionInfo + + + FileVersionRaw + + New-Object System.Version -ArgumentList @( + $this.FileMajorPart + $this.FileMinorPart + $this.FileBuildPart + $this.FilePrivatePart) + + + + ProductVersionRaw + + New-Object System.Version -ArgumentList @( + $this.ProductMajorPart + $this.ProductMinorPart + $this.ProductBuildPart + $this.ProductPrivatePart) + + + + + + System.Diagnostics.EventLogEntry + + + EventID + + $this.get_EventID() -band 0xFFFF + + + + + + System.Management.ManagementBaseObject + + + PSComputerName + __SERVER + + + + + System.Management.ManagementObject#root\cimv2\Win32_PingStatus + + + IPV4Address + + $iphost = [System.Net.Dns]::GetHostEntry($this.address) + $iphost.AddressList | ?{ $_.AddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetwork } | select -first 1 + + + + IPV6Address + + $iphost = [System.Net.Dns]::GetHostEntry($this.address) + $iphost.AddressList | ?{ $_.AddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetworkV6 } | select -first 1 + + + + + + System.Management.ManagementObject#root\cimv2\Win32_Process + + + ProcessName + Name + + + Handles + Handlecount + + + VM + VirtualSize + + + WS + WorkingSetSize + + + Path + $this.ExecutablePath + + + + + System.Diagnostics.Process + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Id + Handles + CPU + SI + Name + + + + + + PSConfiguration + + Name + Id + PriorityClass + FileVersion + + + + PSResources + + Name + Id + Handlecount + WorkingSet + NonPagedMemorySize + PagedMemorySize + PrivateMemorySize + VirtualMemorySize + Threads.Count + TotalProcessorTime + + + + Name + ProcessName + + + SI + SessionId + + + Handles + Handlecount + + + VM + VirtualMemorySize64 + + + WS + WorkingSet64 + + + PM + PagedMemorySize64 + + + NPM + NonpagedSystemMemorySize64 + + + Path + $this.Mainmodule.FileName + + + Company + $this.Mainmodule.FileVersionInfo.CompanyName + + + CPU + $this.TotalProcessorTime.TotalSeconds + + + FileVersion + $this.Mainmodule.FileVersionInfo.FileVersion + + + ProductVersion + $this.Mainmodule.FileVersionInfo.ProductVersion + + + Description + $this.Mainmodule.FileVersionInfo.FileDescription + + + Product + $this.Mainmodule.FileVersionInfo.ProductName + + + __NounName + Process + + + + + Deserialized.System.Diagnostics.Process + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Id + Handles + CPU + Name + + + + + + PSConfiguration + + Name + Id + PriorityClass + FileVersion + + + + PSResources + + Name + Id + Handlecount + WorkingSet + NonPagedMemorySize + PagedMemorySize + PrivateMemorySize + VirtualMemorySize + Threads.Count + TotalProcessorTime + + + + + + System.Management.ManagementObject#root\cli\Msft_CliAlias + + + PSStandardMembers + + + DefaultDisplayPropertySet + + FriendlyName + PWhere + Target + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_BaseBoard + + + PSStatus + + Status + Name + PoweredOn + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Manufacturer + Model + Name + SerialNumber + SKU + Product + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_BIOS + + + PSStandardMembers + + + DefaultDisplayPropertySet + + SMBIOSBIOSVersion + Manufacturer + Name + SerialNumber + Version + + + + + + PSStatus + + Status + Name + Caption + SMBIOSPresent + + + + + + System.Management.ManagementObject#root\cimv2\Win32_BootConfiguration + + + PSStatus + + Name + SettingID + ConfigurationPath + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + BootDirectory + Name + SettingID + Caption + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_CDROMDrive + + + PSStatus + + Availability + Drive + ErrorCleared + MediaLoaded + NeedsCleaning + Status + StatusInfo + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + Drive + Manufacturer + VolumeName + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_ComputerSystem + + + PSStatus + + AdminPasswordStatus + BootupState + ChassisBootupState + KeyboardPasswordStatus + PowerOnPasswordStatus + PowerSupplyState + PowerState + FrontPanelResetStatus + ThermalState + Status + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Domain + Manufacturer + Model + Name + PrimaryOwnerName + TotalPhysicalMemory + + + + + + POWER + + Name + PowerManagementCapabilities + PowerManagementSupported + PowerOnPasswordStatus + PowerState + PowerSupplyState + + + + + + System.Management.ManagementObject#root\cimv2\WIN32_PROCESSOR + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + DeviceID + Manufacturer + MaxClockSpeed + Name + SocketDesignation + + + + + + PSStatus + + Availability + CpuStatus + CurrentVoltage + DeviceID + ErrorCleared + ErrorDescription + LastErrorCode + LoadPercentage + Status + StatusInfo + + + + PSConfiguration + + AddressWidth + DataWidth + DeviceID + ExtClock + L2CacheSize + L2CacheSpeed + MaxClockSpeed + PowerManagementSupported + ProcessorType + Revision + SocketDesignation + Version + VoltageCaps + + + + + + System.Management.ManagementObject#root\cimv2\Win32_ComputerSystemProduct + + + PSStatus + + Name + Version + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + IdentifyingNumber + Name + Vendor + Version + Caption + + + + + + + + System.Management.ManagementObject#root\cimv2\CIM_DataFile + + + PSStatus + + Status + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Compressed + Encrypted + Size + Hidden + Name + Readable + System + Version + Writeable + + + + + + + + System.Management.ManagementObject#root\cimv2\WIN32_DCOMApplication + + + PSStandardMembers + + + DefaultDisplayPropertySet + + AppID + InstallDate + Name + + + + + + PSStatus + + Name + Status + + + + + + System.Management.ManagementObject#root\cimv2\WIN32_DESKTOP + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Name + ScreenSaverActive + ScreenSaverSecure + ScreenSaverTimeout + SettingID + + + + + + PSStatus + + Name + ScreenSaverActive + + + + + + System.Management.ManagementObject#root\cimv2\WIN32_DESKTOPMONITOR + + + PSConfiguration + + DeviceID + Name + PixelsPerXLogicalInch + PixelsPerYLogicalInch + ScreenHeight + ScreenWidth + + + + PSStatus + + DeviceID + IsLocked + LastErrorCode + Name + Status + StatusInfo + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DeviceID + DisplayType + MonitorManufacturer + Name + ScreenHeight + ScreenWidth + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_DeviceMemoryAddress + + + PSStatus + + Status + Name + MemoryType + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + MemoryType + Name + Status + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_DiskDrive + + + PSStatus + + ConfigManagerErrorCode + LastErrorCode + NeedsCleaning + Status + DeviceID + StatusInfo + Partitions + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Partitions + DeviceID + Model + Size + Caption + + + + + + PSConfiguration + + BytesPerSector + ConfigManagerUserConfig + DefaultBlockSize + DeviceID + Index + InstallDate + InterfaceType + MaxBlockSize + MaxMediaSize + MinBlockSize + NumberOfMediaSupported + Partitions + SectorsPerTrack + Size + TotalCylinders + TotalHeads + TotalSectors + TotalTracks + TracksPerCylinder + + + + + + System.Management.ManagementObject#root\cimv2\Win32_DiskQuota + + + PSStatus + + __PATH + Status + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DiskSpaceUsed + Limit + QuotaVolume + User + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_DMAChannel + + + PSStatus + + Status + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + AddressSize + DMAChannel + MaxTransferSize + Name + Port + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_Environment + + + PSStatus + + Status + Name + SystemVariable + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + VariableValue + Name + UserName + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_Directory + + + PSStatus + + Status + Compressed + Encrypted + Name + Readable + Writeable + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Hidden + Archive + EightDotThreeFileName + FileSize + Name + Compressed + Encrypted + Readable + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_Group + + + PSStatus + + Status + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + Domain + Name + SID + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_IDEController + + + PSStatus + + Status + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Manufacturer + Name + ProtocolSupported + Status + StatusInfo + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_IRQResource + + + PSStatus + + Status + Caption + Availability + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Hardware + IRQNumber + Name + Shareable + TriggerLevel + TriggerType + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_ScheduledJob + + + PSStatus + + Status + JobId + JobStatus + ElapsedTime + StartTime + Owner + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + JobId + Name + Owner + Priority + Command + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_LoadOrderGroup + + + PSStatus + + Status + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + GroupOrder + Name + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_LogicalDisk + + + PSStatus + + Status + Availability + DeviceID + StatusInfo + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DeviceID + DriveType + ProviderName + FreeSpace + Size + VolumeName + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_LogonSession + + + PSStatus + + __PATH + Status + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + AuthenticationPackage + LogonId + LogonType + Name + StartTime + Status + + + + + + + + System.Management.ManagementObject#root\cimv2\WIN32_CACHEMEMORY + + + PSStandardMembers + + + DefaultDisplayPropertySet + + BlockSize + CacheSpeed + CacheType + DeviceID + InstalledSize + Level + MaxCacheSize + NumberOfBlocks + Status + + + + + + ERROR + + DeviceID + ErrorCorrectType + + + + PSStatus + + Availability + DeviceID + Status + StatusInfo + + + + PSConfiguration + + BlockSize + CacheSpeed + CacheType + DeviceID + InstalledSize + Level + MaxCacheSize + NumberOfBlocks + Status + WritePolicy + + + + + + System.Management.ManagementObject#root\cimv2\Win32_LogicalMemoryConfiguration + + + PSStatus + + AvailableVirtualMemory + Name + TotalVirtualMemory + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Name + TotalVirtualMemory + TotalPhysicalMemory + TotalPageFileSpace + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_PhysicalMemoryArray + + + PSStatus + + Status + Name + Replaceable + Location + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Model + Name + MaxCapacity + MemoryDevices + + + + + + + + System.Management.ManagementObject#root\cimv2\WIN32_NetworkClient + + + PSStatus + + Name + Status + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + InstallDate + Manufacturer + Name + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_NetworkLoginProfile + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + Privileges + Profile + UserId + UserType + Workstations + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_NetworkProtocol + + + FULLXXX + + ConnectionlessService + Description + GuaranteesDelivery + GuaranteesSequencing + InstallDate + MaximumAddressSize + MaximumMessageSize + MessageOriented + MinimumAddressSize + Name + PseudoStreamOriented + Status + SupportsBroadcasting + SupportsConnectData + SupportsDisconnectData + SupportsEncryption + SupportsExpeditedData + SupportsFragmentation + SupportsGracefulClosing + SupportsGuaranteedBandwidth + SupportsMulticasting + SupportsQualityofService + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + GuaranteesDelivery + GuaranteesSequencing + ConnectionlessService + Status + Name + + + + + + PSStatus + + Name + Status + SupportsBroadcasting + SupportsConnectData + SupportsDisconnectData + SupportsEncryption + SupportsExpeditedData + SupportsFragmentation + SupportsGracefulClosing + SupportsGuaranteedBandwidth + SupportsMulticasting + SupportsQualityofService + + + + + + System.Management.ManagementObject#root\cimv2\Win32_NetworkConnection + + + PSStatus + + Status + ConnectionState + Persistent + LocalName + RemoteName + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + LocalName + RemoteName + ConnectionState + Status + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_NetworkAdapter + + + PSStatus + + Availability + Name + Status + StatusInfo + DeviceID + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + ServiceName + MACAddress + AdapterType + DeviceID + Name + NetworkAddresses + Speed + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_NetworkAdapterConfiguration + + + PSStatus + + DHCPLeaseExpires + Index + Description + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DHCPEnabled + IPAddress + DefaultIPGateway + DNSDomain + ServiceName + Description + Index + + + + + + DHCP + + Description + DHCPEnabled + DHCPLeaseExpires + DHCPLeaseObtained + DHCPServer + Index + + + + DNS + + Description + DNSDomain + DNSDomainSuffixSearchOrder + DNSEnabledForWINSResolution + DNSHostName + DNSServerSearchOrder + DomainDNSRegistrationEnabled + FullDNSRegistrationEnabled + Index + + + + IP + + Description + Index + IPAddress + IPConnectionMetric + IPEnabled + IPFilterSecurityEnabled + + + + WINS + + Description + Index + WINSEnableLMHostsLookup + WINSHostLookupFile + WINSPrimaryServer + WINSScopeID + WINSSecondaryServer + + + + + + System.Management.ManagementObject#root\cimv2\Win32_NTDomain + + + PSStatus + + Status + DomainName + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + ClientSiteName + DcSiteName + Description + DnsForestName + DomainControllerAddress + DomainControllerName + DomainName + Roles + Status + + + + + + GUID + + DomainName + DomainGuid + + + + + + System.Management.ManagementObject#root\cimv2\Win32_NTLogEvent + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Category + CategoryString + EventCode + EventIdentifier + TypeEvent + InsertionStrings + LogFile + Message + RecordNumber + SourceName + TimeGenerated + TimeWritten + Type + UserName + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_NTEventlogFile + + + PSStatus + + Status + LogfileName + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + FileSize + LogfileName + Name + NumberOfRecords + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_OnBoardDevice + + + PSStatus + + Status + Description + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DeviceType + SerialNumber + Enabled + Description + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_OperatingSystem + + + PSStatus + + Status + Name + + + + FREE + + FreePhysicalMemory + FreeSpaceInPagingFiles + FreeVirtualMemory + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + SystemDirectory + Organization + BuildNumber + RegisteredUser + SerialNumber + Version + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_PageFileUsage + + + PSStatus + + Status + Name + CurrentUsage + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + Name + PeakUsage + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_PageFileSetting + + + PSStandardMembers + + + DefaultDisplayPropertySet + + MaximumSize + Name + Caption + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_DiskPartition + + + PSStatus + + Index + Status + StatusInfo + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + NumberOfBlocks + BootPartition + Name + PrimaryPartition + Size + Index + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_PortResource + + + PSStatus + + NetConnectionStatus + Status + Name + StartingAddress + EndingAddress + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + Name + Alias + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_PortConnector + + + PSStatus + + Status + Name + ExternalReferenceDesignator + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Tag + ConnectorType + SerialNumber + ExternalReferenceDesignator + PortType + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_Printer + + + PSStatus + + Status + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Location + Name + PrinterState + PrinterStatus + ShareName + SystemName + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_PrinterConfiguration + + + PSStatus + + DriverVersion + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + PrintQuality + DriverVersion + Name + PaperSize + Caption + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_PrintJob + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Document + JobId + JobStatus + Owner + Priority + Size + Name + + + + + + PSStatus + + Document + JobId + JobStatus + Name + PagesPrinted + Status + JobIdCopy + Name + + + + + + System.Management.ManagementObject#root\cimv2\Win32_ProcessXXX + + + PSStatus + + Status + Name + ProcessId + + + + MEMORY + + Handle + MaximumWorkingSetSize + MinimumWorkingSetSize + Name + PageFaults + PageFileUsage + PeakPageFileUsage + PeakVirtualSize + PeakWorkingSetSize + PrivatePageCount + QuotaNonPagedPoolUsage + QuotaPagedPoolUsage + QuotaPeakNonPagedPoolUsage + QuotaPeakPagedPoolUsage + VirtualSize + WorkingSetSize + + + + IO + + Name + ProcessId + ReadOperationCount + ReadTransferCount + WriteOperationCount + WriteTransferCount + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + ThreadCount + HandleCount + Name + Priority + ProcessId + WorkingSetSize + + + + + + STATISTICS + + HandleCount + Name + KernelModeTime + MaximumWorkingSetSize + MinimumWorkingSetSize + OtherOperationCount + OtherTransferCount + PageFaults + PageFileUsage + PeakPageFileUsage + PeakVirtualSize + PeakWorkingSetSize + PrivatePageCount + ProcessId + QuotaNonPagedPoolUsage + QuotaPagedPoolUsage + QuotaPeakNonPagedPoolUsage + QuotaPeakPagedPoolUsage + ReadOperationCount + ReadTransferCount + ThreadCount + UserModeTime + VirtualSize + WorkingSetSize + WriteOperationCount + WriteTransferCount + + + + + + System.Management.ManagementObject#root\cimv2\Win32_Product + + + PSStatus + + Name + Version + InstallState + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + IdentifyingNumber + Name + Vendor + Version + Caption + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_QuickFixEngineering + + + InstalledOn + + if ([environment]::osversion.version.build -ge 7000) + { + # WMI team fixed the formatting issue related to InstalledOn + # property in Windows7 (to return string)..so returning the WMI's + # version directly + [DateTime]::Parse($this.psBase.properties["InstalledOn"].Value) + } + else + { + $orig = $this.psBase.properties["InstalledOn"].Value + $date = [datetime]::FromFileTimeUTC($("0x" + $orig)) + if ($date -lt "1/1/1980") + { + if ($orig -match "([0-9]{4})([01][0-9])([012][0-9])") + { + new-object datetime @([int]$matches[1], [int]$matches[2], [int]$matches[3]) + } + } + else + { + $date + } + } + + + + PSStatus + + __PATH + Status + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Description + FixComments + HotFixID + InstallDate + InstalledBy + InstalledOn + Name + ServicePackInEffect + Status + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_QuotaSetting + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + DefaultLimit + SettingID + State + VolumePath + DefaultWarningLimit + + + + + + PSStatus + + State + VolumePath + Caption + + + + + + System.Management.ManagementObject#root\cimv2\Win32_OSRecoveryConfiguration + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DebugFilePath + Name + SettingID + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_Registry + + + PSStatus + + Status + CurrentSize + MaximumSize + ProposedSize + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + CurrentSize + MaximumSize + Name + Caption + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_SCSIController + + + PSStatus + + Status + Name + StatusInfo + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DriverName + Manufacturer + Name + ProtocolSupported + Status + StatusInfo + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_PerfRawData_PerfNet_Server + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + LogonPerSec + LogonTotal + Name + ServerSessions + WorkItemShortages + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_Service + + + PSStandardMembers + + + DefaultDisplayPropertySet + + ExitCode + Name + ProcessId + StartMode + State + Status + + + + + + PSStatus + + Name + Status + ExitCode + + + + PSConfiguration + + DesktopInteract + ErrorControl + Name + PathName + ServiceType + StartMode + + + + + + System.Management.ManagementObject#root\cimv2\Win32_Share + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Name + Path + Description + + + + + + PSStatus + + Status + Type + Name + + + + + + System.Management.ManagementObject#root\cimv2\Win32_SoftwareElement + + + PSStatus + + Status + SoftwareElementState + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + Name + Path + SerialNumber + SoftwareElementID + Version + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_SoftwareFeature + + + PSStatus + + Status + Name + InstallState + LastUse + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + IdentifyingNumber + ProductName + Vendor + Version + + + + + + + + System.Management.ManagementObject#root\cimv2\WIN32_SoundDevice + + + PSStatus + + ConfigManagerUserConfig + Name + Status + StatusInfo + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Manufacturer + Name + Status + StatusInfo + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_StartupCommand + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Command + User + Caption + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_SystemAccount + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + Domain + Name + SID + + + + + + PSStatus + + Status + SIDType + Name + Domain + + + + + + System.Management.ManagementObject#root\cimv2\Win32_SystemDriver + + + PSStatus + + Status + Name + State + ExitCode + Started + ServiceSpecificExitCode + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DisplayName + Name + State + Status + Started + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_SystemEnclosure + + + PSStatus + + Tag + Status + Name + SecurityStatus + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Manufacturer + Model + LockPresent + SerialNumber + SMBIOSAssetTag + SecurityStatus + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_SystemSlot + + + PSStatus + + Status + SlotDesignation + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + SlotDesignation + Tag + SupportsHotPlug + Status + Shared + PMESignal + MaxDataWidth + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_TapeDrive + + + PSStatus + + Status + Availability + DeviceID + NeedsCleaning + StatusInfo + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DeviceID + Id + Manufacturer + Name + Caption + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_TemperatureProbe + + + PSStatus + + Status + CurrentReading + DeviceID + Name + StatusInfo + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + CurrentReading + Name + Description + MinReadable + MaxReadable + Status + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_TimeZone + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Bias + SettingID + Caption + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_UninterruptiblePowerSupply + + + PSStatus + + Status + DeviceID + EstimatedChargeRemaining + EstimatedRunTime + Name + StatusInfo + TimeOnBackup + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DeviceID + EstimatedRunTime + Name + TimeOnBackup + UPSPort + Caption + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_UserAccount + + + PSStatus + + Status + Caption + PasswordExpires + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + AccountType + Caption + Domain + SID + FullName + Name + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_VoltageProbe + + + PSStatus + + Status + DeviceID + Name + NominalReading + StatusInfo + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Status + Description + CurrentReading + MaxReadable + MinReadable + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_VolumeQuotaSetting + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Element + Setting + + + + + + + + System.Management.ManagementObject#root\cimv2\Win32_WMISetting + + + PSStandardMembers + + + DefaultDisplayPropertySet + + BuildVersion + Caption + DatabaseDirectory + EnableEvents + LoggingLevel + SettingID + + + + + + + + System.Management.ManagementObject + + + ConvertToDateTime + + + + ConvertFromDateTime + + + + + + System.Security.AccessControl.ObjectSecurity + + + Path + + Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase + GetPath + + + + Owner + + Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase + GetOwner + + + + Group + + Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase + GetGroup + + + + Access + + Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase + GetAccess + + + + Sddl + + Microsoft.PowerShell.Commands.SecurityDescriptorCommandsBase + GetSddl + + + + AccessToString + + $toString = ""; + $first = $true; + if ( ! $this.Access ) { return "" } + foreach($ace in $this.Access) + { + if($first) + { + $first = $false; + } + else + { + $tostring += "`n"; + } + $toString += $ace.IdentityReference.ToString(); + $toString += " "; + $toString += $ace.AccessControlType.ToString(); + $toString += " "; + if($ace -is [System.Security.AccessControl.FileSystemAccessRule]) + { + $toString += $ace.FileSystemRights.ToString(); + } + elseif($ace -is [System.Security.AccessControl.RegistryAccessRule]) + { + $toString += $ace.RegistryRights.ToString(); + } + } + return $toString; + + + + AuditToString + + $toString = ""; + $first = $true; + if ( ! (& { Set-StrictMode -Version 1; $this.audit }) ) { return "" } + foreach($ace in (& { Set-StrictMode -Version 1; $this.audit })) + { + if($first) + { + $first = $false; + } + else + { + $tostring += "`n"; + } + $toString += $ace.IdentityReference.ToString(); + $toString += " "; + $toString += $ace.AuditFlags.ToString(); + $toString += " "; + if($ace -is [System.Security.AccessControl.FileSystemAuditRule]) + { + $toString += $ace.FileSystemRights.ToString(); + } + elseif($ace -is [System.Security.AccessControl.RegistryAuditRule]) + { + $toString += $ace.RegistryRights.ToString(); + } + } + return $toString; + + + + + + Microsoft.PowerShell.Commands.HistoryInfo + + + PSStandardMembers + + + DefaultKeyPropertySet + + Id + + + + + + + + System.Management.ManagementClass + + + Name + __Class + + + + + System.Management.Automation.Runspaces.PSSession + + + State + $this.Runspace.RunspaceStateInfo.State + + + IdleTimeout + $this.Runspace.ConnectionInfo.IdleTimeout + + + OutputBufferingMode + $this.Runspace.ConnectionInfo.OutputBufferingMode + + + DisconnectedOn + $this.Runspace.DisconnectedOn + + + ExpiresOn + $this.Runspace.ExpiresOn + + + + + System.Guid + + + Guid + $this.ToString() + + + + + System.Management.Automation.Signature + + + PSStandardMembers + + + SerializationDepth + 2 + + + + + + + System.Management.Automation.Job + + + PSStandardMembers + + + SerializationDepth + 2 + + + SerializationMethod + SpecificProperties + + + PropertySerializationSet + + HasMoreData + StatusMessage + Location + Command + JobStateInfo + InstanceId + Id + Name + State + ChildJobs + PSJobTypeName + PSBeginTime + PSEndTime + + + + + + State + $this.JobStateInfo.State.ToString() + + + + + System.Management.Automation.JobStateInfo + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Management.Automation.JobStateInfo + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + Microsoft.PowerShell.DeserializingTypeConverter + + Microsoft.PowerShell.DeserializingTypeConverter + + + + System.Net.Mail.MailAddress + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Net.Mail.MailAddress + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Globalization.CultureInfo + + + PSStandardMembers + + + SerializationDepth + 1 + + + SerializationMethod + SpecificProperties + + + PropertySerializationSet + + LCID + Name + DisplayName + IetfLanguageTag + ThreeLetterISOLanguageName + ThreeLetterWindowsLanguageName + TwoLetterISOLanguageName + + + + + + + + Deserialized.System.Globalization.CultureInfo + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Management.Automation.PSCredential + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Management.Automation.PSCredential + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Management.Automation.PSPrimitiveDictionary + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Management.Automation.PSPrimitiveDictionary + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Management.Automation.SwitchParameter + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Management.Automation.SwitchParameter + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Management.Automation.PSListModifier + + + PSStandardMembers + + + SerializationDepth + 2 + + + + + + + Deserialized.System.Management.Automation.PSListModifier + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Security.Cryptography.X509Certificates.X509Certificate2 + + + PSStandardMembers + + + SerializationDepth + 1 + + + SerializationMethod + SpecificProperties + + + PropertySerializationSet + + RawData + + + + + + + + Deserialized.System.Security.Cryptography.X509Certificates.X509Certificate2 + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Security.Cryptography.X509Certificates.X500DistinguishedName + + + PSStandardMembers + + + SerializationDepth + 1 + + + SerializationMethod + SpecificProperties + + + PropertySerializationSet + + RawData + + + + + + + + Deserialized.System.Security.Cryptography.X509Certificates.X500DistinguishedName + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Security.AccessControl.RegistrySecurity + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Security.AccessControl.RegistrySecurity + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Security.AccessControl.FileSystemSecurity + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Security.AccessControl.FileSystemSecurity + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + HelpInfo + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + System.Management.Automation.PSTypeName + + + PSStandardMembers + + + SerializationMethod + String + + + StringSerializationSource + Name + + + + + + + System.Management.Automation.ParameterMetadata + + + PSStandardMembers + + + SerializationMethod + SpecificProperties + + + PropertySerializationSet + + Name + ParameterType + Aliases + IsDynamic + SwitchParameter + + + + + + + + System.Management.Automation.CommandInfo + + + Namespace + ModuleName + + + HelpUri + + $oldProgressPreference = $ProgressPreference + $ProgressPreference = 'SilentlyContinue' + try + { + if ($psversiontable.psversion.Major -lt 3) + { + # ok to cast CommandTypes enum to HelpCategory because string/indentifier for + # cmdlet,function,filter,alias,externalscript is identical. + # it is ok to fail for other enum values (i.e. for Application) + $commandName = $this.Name + if ($this.ModuleName) + { + $commandName = "{0}\{1}" -f $this.ModuleName,$commandName + } + + $helpObject = get-help -Name $commandName -Category ([string]($this.CommandType)) -ErrorAction SilentlyContinue + + # return first non-null uri (and try not to hit any strict mode things) + if ($helpObject -eq $null) { return $null } + if ($helpObject.psobject.properties['relatedLinks'] -eq $null) { return $null } + if ($helpObject.relatedLinks.psobject.properties['navigationLink'] -eq $null) { return $null } + $helpUri = [string]$( $helpObject.relatedLinks.navigationLink | %{ if ($_.psobject.properties['uri'] -ne $null) { $_.uri } } | ?{ $_ } | select -first 1 ) + return $helpUri + } + else + { + [Microsoft.PowerShell.Commands.GetHelpCodeMethods]::GetHelpUri($this) + } + } + catch {} + finally + { + $ProgressPreference = $oldProgressPreference + } + + + + + + System.Management.Automation.ParameterSetMetadata + + + Flags + + Microsoft.PowerShell.DeserializingTypeConverter + GetParameterSetMetadataFlags + + + + PSStandardMembers + + + SerializationMethod + SpecificProperties + + + PropertySerializationSet + + Position + Flags + HelpMessage + + + + + + + + Deserialized.System.Management.Automation.ParameterSetMetadata + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + Deserialized.System.Management.Automation.ExtendedTypeDefinition + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Management.Automation.ExtendedTypeDefinition + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Management.Automation.FormatViewDefinition + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Management.Automation.FormatViewDefinition + + + InstanceId + + Microsoft.PowerShell.DeserializingTypeConverter + GetFormatViewDefinitionInstanceId + + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Management.Automation.PSControl + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Management.Automation.PSControl + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Management.Automation.DisplayEntry + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Management.Automation.DisplayEntry + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Management.Automation.TableControlColumnHeader + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Management.Automation.TableControlColumnHeader + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Management.Automation.TableControlRow + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Management.Automation.TableControlRow + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Management.Automation.TableControlColumn + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Management.Automation.TableControlColumn + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Management.Automation.ListControlEntry + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Management.Automation.ListControlEntry + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Management.Automation.ListControlEntryItem + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Management.Automation.ListControlEntryItem + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Management.Automation.WideControlEntryItem + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Management.Automation.WideControlEntryItem + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + System.Web.Services.Protocols.SoapException + + + PSMessageDetails + $this.Detail."#text" + + + + + System.Management.Automation.ErrorRecord + + + PSMessageDetails + & { Set-StrictMode -Version 1; $this.Exception.InnerException.PSMessageDetails } + + + + + Deserialized.System.Enum + + + Value + $this.ToString() + + + + + Microsoft.PowerShell.Commands.Internal.Format.FormatInfoData + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.Microsoft.PowerShell.Commands.Internal.Format.FormatInfoData + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + System.Management.ManagementEventArgs + + + PSStandardMembers + + + SerializationDepth + 2 + + + + + + + Deserialized.System.Management.ManagementEventArgs + + + PSStandardMembers + + + SerializationDepth + 2 + + + + + + + System.Management.Automation.CallStackFrame + + + Command + + if ($this.InvocationInfo -eq $null) { return $this.FunctionName } + $commandInfo = $this.InvocationInfo.MyCommand + if ($commandInfo -eq $null) { return $this.InvocationInfo.InvocationName } + if ($commandInfo.Name -ne "") { return $commandInfo.Name } + return $this.FunctionName + + + + Location + + $this.GetScriptLocation() + + + + Arguments + + $argumentsBuilder = new-object System.Text.StringBuilder + + $null = $( + $argumentsBuilder.Append("{") + foreach ($entry in $this.InvocationInfo.BoundParameters.GetEnumerator()) + { + if ($argumentsBuilder.Length -gt 1) + { + $argumentsBuilder.Append(", "); + } + + $argumentsBuilder.Append($entry.Key).Append("=") + + if ($entry.Value) + { + $argumentsBuilder.Append([string]$entry.Value) + } + } + + foreach ($arg in $this.InvocationInfo.UnboundArguments.GetEnumerator()) + { + if ($argumentsBuilder.Length -gt 1) + { + $argumentsBuilder.Append(", ") + } + if ($arg) + { + $argumentsBuilder.Append([string]$arg) + } + else + { + $argumentsBuilder.Append('$null') + } + } + + $argumentsBuilder.Append('}'); + ) + + return $argumentsBuilder.ToString(); + + + + + + Microsoft.PowerShell.Commands.PSSessionConfigurationCommands#PSSessionConfiguration + + + Permission + + trap { continue; } + $private:sd = $null + $private:sd = new-object System.Security.AccessControl.CommonSecurityDescriptor $false,$false,$this.SecurityDescriptorSddl + if ($private:sd) + { + # reset trap + trap { } + $private:dacls = ""; + $private:first = $true + $private:sd.DiscretionaryAcl | % { + trap { } + if ($private:first) + { + $private:first = $false; + } + else + { + $private:dacls += ", " + } + $private:dacls += $_.SecurityIdentifier.Translate([System.Security.Principal.NTAccount]).ToString() + " " + $_.AceType + } # end of foreach + + return $private:dacls + } + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_PingStatus + + + IPV4Address + + $iphost = [System.Net.Dns]::GetHostEntry($this.address) + $iphost.AddressList | ?{ $_.AddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetwork } | select -first 1 + + + + IPV6Address + + $iphost = [System.Net.Dns]::GetHostEntry($this.address) + $iphost.AddressList | ?{ $_.AddressFamily -eq [System.Net.Sockets.AddressFamily]::InterNetworkV6 } | select -first 1 + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Process + + + ProcessName + Name + + + Handles + Handlecount + + + VM + VirtualSize + + + WS + WorkingSetSize + + + Path + $this.ExecutablePath + + + PSStandardMembers + + + DefaultDisplayPropertySet + + ProcessId + Name + HandleCount + WorkingSetSize + VirtualSize + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Msft_CliAlias + + + PSStandardMembers + + + DefaultDisplayPropertySet + + FriendlyName + PWhere + Target + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_BaseBoard + + + PSStatus + + Status + Name + PoweredOn + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Manufacturer + Model + Name + SerialNumber + SKU + Product + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_BIOS + + + PSStandardMembers + + + DefaultDisplayPropertySet + + SMBIOSBIOSVersion + Manufacturer + Name + SerialNumber + Version + + + + + + PSStatus + + Status + Name + Caption + SMBIOSPresent + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_BootConfiguration + + + PSStatus + + Name + SettingID + ConfigurationPath + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + BootDirectory + Name + SettingID + Caption + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_CDROMDrive + + + PSStatus + + Availability + Drive + ErrorCleared + MediaLoaded + NeedsCleaning + Status + StatusInfo + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + Drive + Manufacturer + VolumeName + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_ComputerSystem + + + PSStatus + + AdminPasswordStatus + BootupState + ChassisBootupState + KeyboardPasswordStatus + PowerOnPasswordStatus + PowerSupplyState + PowerState + FrontPanelResetStatus + ThermalState + Status + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Domain + Manufacturer + Model + Name + PrimaryOwnerName + TotalPhysicalMemory + + + + + + POWER + + Name + PowerManagementCapabilities + PowerManagementSupported + PowerOnPasswordStatus + PowerState + PowerSupplyState + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/WIN32_PROCESSOR + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + DeviceID + Manufacturer + MaxClockSpeed + Name + SocketDesignation + + + + + + PSStatus + + Availability + CpuStatus + CurrentVoltage + DeviceID + ErrorCleared + ErrorDescription + LastErrorCode + LoadPercentage + Status + StatusInfo + + + + PSConfiguration + + AddressWidth + DataWidth + DeviceID + ExtClock + L2CacheSize + L2CacheSpeed + MaxClockSpeed + PowerManagementSupported + ProcessorType + Revision + SocketDesignation + Version + VoltageCaps + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_ComputerSystemProduct + + + PSStatus + + Name + Version + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + IdentifyingNumber + Name + Vendor + Version + Caption + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/CIM_DataFile + + + PSStatus + + Status + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Compressed + Encrypted + Size + Hidden + Name + Readable + System + Version + Writeable + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/WIN32_DCOMApplication + + + PSStandardMembers + + + DefaultDisplayPropertySet + + AppID + InstallDate + Name + + + + + + PSStatus + + Name + Status + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/WIN32_DESKTOP + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Name + ScreenSaverActive + ScreenSaverSecure + ScreenSaverTimeout + SettingID + + + + + + PSStatus + + Name + ScreenSaverActive + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/WIN32_DESKTOPMONITOR + + + PSConfiguration + + DeviceID + Name + PixelsPerXLogicalInch + PixelsPerYLogicalInch + ScreenHeight + ScreenWidth + + + + PSStatus + + DeviceID + IsLocked + LastErrorCode + Name + Status + StatusInfo + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DeviceID + DisplayType + MonitorManufacturer + Name + ScreenHeight + ScreenWidth + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_DeviceMemoryAddress + + + PSStatus + + Status + Name + MemoryType + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + MemoryType + Name + Status + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_DiskDrive + + + PSStatus + + ConfigManagerErrorCode + LastErrorCode + NeedsCleaning + Status + DeviceID + StatusInfo + Partitions + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Partitions + DeviceID + Model + Size + Caption + + + + + + PSConfiguration + + BytesPerSector + ConfigManagerUserConfig + DefaultBlockSize + DeviceID + Index + InstallDate + InterfaceType + MaxBlockSize + MaxMediaSize + MinBlockSize + NumberOfMediaSupported + Partitions + SectorsPerTrack + Size + TotalCylinders + TotalHeads + TotalSectors + TotalTracks + TracksPerCylinder + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_DiskQuota + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DiskSpaceUsed + Limit + QuotaVolume + User + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_DMAChannel + + + PSStatus + + Status + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + AddressSize + DMAChannel + MaxTransferSize + Name + Port + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Environment + + + PSStatus + + Status + Name + SystemVariable + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + VariableValue + Name + UserName + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Directory + + + PSStatus + + Status + Compressed + Encrypted + Name + Readable + Writeable + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Hidden + Archive + EightDotThreeFileName + FileSize + Name + Compressed + Encrypted + Readable + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Group + + + PSStatus + + Status + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + Domain + Name + SID + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_IDEController + + + PSStatus + + Status + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Manufacturer + Name + ProtocolSupported + Status + StatusInfo + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_IRQResource + + + PSStatus + + Status + Caption + Availability + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Hardware + IRQNumber + Name + Shareable + TriggerLevel + TriggerType + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_ScheduledJob + + + PSStatus + + Status + JobId + JobStatus + ElapsedTime + StartTime + Owner + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + JobId + Name + Owner + Priority + Command + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_LoadOrderGroup + + + PSStatus + + Status + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + GroupOrder + Name + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_LogicalDisk + + + PSStatus + + Status + Availability + DeviceID + StatusInfo + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DeviceID + DriveType + ProviderName + FreeSpace + Size + VolumeName + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_LogonSession + + + PSStandardMembers + + + DefaultDisplayPropertySet + + AuthenticationPackage + LogonId + LogonType + Name + StartTime + Status + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/WIN32_CACHEMEMORY + + + PSStandardMembers + + + DefaultDisplayPropertySet + + BlockSize + CacheSpeed + CacheType + DeviceID + InstalledSize + Level + MaxCacheSize + NumberOfBlocks + Status + + + + + + ERROR + + DeviceID + ErrorCorrectType + + + + PSStatus + + Availability + DeviceID + Status + StatusInfo + + + + PSConfiguration + + BlockSize + CacheSpeed + CacheType + DeviceID + InstalledSize + Level + MaxCacheSize + NumberOfBlocks + Status + WritePolicy + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_LogicalMemoryConfiguration + + + PSStatus + + AvailableVirtualMemory + Name + TotalVirtualMemory + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Name + TotalVirtualMemory + TotalPhysicalMemory + TotalPageFileSpace + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_PhysicalMemoryArray + + + PSStatus + + Status + Name + Replaceable + Location + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Model + Name + MaxCapacity + MemoryDevices + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/WIN32_NetworkClient + + + PSStatus + + Name + Status + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + InstallDate + Manufacturer + Name + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_NetworkLoginProfile + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + Privileges + Profile + UserId + UserType + Workstations + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_NetworkProtocol + + + FULLXXX + + ConnectionlessService + Description + GuaranteesDelivery + GuaranteesSequencing + InstallDate + MaximumAddressSize + MaximumMessageSize + MessageOriented + MinimumAddressSize + Name + PseudoStreamOriented + Status + SupportsBroadcasting + SupportsConnectData + SupportsDisconnectData + SupportsEncryption + SupportsExpeditedData + SupportsFragmentation + SupportsGracefulClosing + SupportsGuaranteedBandwidth + SupportsMulticasting + SupportsQualityofService + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + GuaranteesDelivery + GuaranteesSequencing + ConnectionlessService + Status + Name + + + + + + PSStatus + + Name + Status + SupportsBroadcasting + SupportsConnectData + SupportsDisconnectData + SupportsEncryption + SupportsExpeditedData + SupportsFragmentation + SupportsGracefulClosing + SupportsGuaranteedBandwidth + SupportsMulticasting + SupportsQualityofService + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_NetworkConnection + + + PSStatus + + Status + ConnectionState + Persistent + LocalName + RemoteName + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + LocalName + RemoteName + ConnectionState + Status + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_NetworkAdapter + + + PSStatus + + Availability + Name + Status + StatusInfo + DeviceID + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + ServiceName + MACAddress + AdapterType + DeviceID + Name + NetworkAddresses + Speed + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_NetworkAdapterConfiguration + + + PSStatus + + DHCPLeaseExpires + Index + Description + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DHCPEnabled + IPAddress + DefaultIPGateway + DNSDomain + ServiceName + Description + Index + + + + + + DHCP + + Description + DHCPEnabled + DHCPLeaseExpires + DHCPLeaseObtained + DHCPServer + Index + + + + DNS + + Description + DNSDomain + DNSDomainSuffixSearchOrder + DNSEnabledForWINSResolution + DNSHostName + DNSServerSearchOrder + DomainDNSRegistrationEnabled + FullDNSRegistrationEnabled + Index + + + + IP + + Description + Index + IPAddress + IPConnectionMetric + IPEnabled + IPFilterSecurityEnabled + + + + WINS + + Description + Index + WINSEnableLMHostsLookup + WINSHostLookupFile + WINSPrimaryServer + WINSScopeID + WINSSecondaryServer + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_NTDomain + + + PSStatus + + Status + DomainName + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + ClientSiteName + DcSiteName + Description + DnsForestName + DomainControllerAddress + DomainControllerName + DomainName + Roles + Status + + + + + + GUID + + DomainName + DomainGuid + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_NTLogEvent + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Category + CategoryString + EventCode + EventIdentifier + TypeEvent + InsertionStrings + LogFile + Message + RecordNumber + SourceName + TimeGenerated + TimeWritten + Type + UserName + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_NTEventlogFile + + + PSStatus + + Status + LogfileName + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + FileSize + LogfileName + Name + NumberOfRecords + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_OnBoardDevice + + + PSStatus + + Status + Description + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DeviceType + SerialNumber + Enabled + Description + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_OperatingSystem + + + PSStatus + + Status + Name + + + + FREE + + FreePhysicalMemory + FreeSpaceInPagingFiles + FreeVirtualMemory + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + SystemDirectory + Organization + BuildNumber + RegisteredUser + SerialNumber + Version + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_PageFileUsage + + + PSStatus + + Status + Name + CurrentUsage + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + Name + PeakUsage + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_PageFileSetting + + + PSStandardMembers + + + DefaultDisplayPropertySet + + MaximumSize + Name + Caption + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_DiskPartition + + + PSStatus + + Index + Status + StatusInfo + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + NumberOfBlocks + BootPartition + Name + PrimaryPartition + Size + Index + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_PortResource + + + PSStatus + + NetConnectionStatus + Status + Name + StartingAddress + EndingAddress + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + Name + Alias + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_PortConnector + + + PSStatus + + Status + Name + ExternalReferenceDesignator + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Tag + ConnectorType + SerialNumber + ExternalReferenceDesignator + PortType + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Printer + + + PSStatus + + Status + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Location + Name + PrinterState + PrinterStatus + ShareName + SystemName + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_PrinterConfiguration + + + PSStatus + + DriverVersion + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + PrintQuality + DriverVersion + Name + PaperSize + Caption + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_PrintJob + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Document + JobId + JobStatus + Owner + Priority + Size + Name + + + + + + PSStatus + + Document + JobId + JobStatus + Name + PagesPrinted + Status + JobIdCopy + Name + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_ProcessXXX + + + PSStatus + + Status + Name + ProcessId + + + + MEMORY + + Handle + MaximumWorkingSetSize + MinimumWorkingSetSize + Name + PageFaults + PageFileUsage + PeakPageFileUsage + PeakVirtualSize + PeakWorkingSetSize + PrivatePageCount + QuotaNonPagedPoolUsage + QuotaPagedPoolUsage + QuotaPeakNonPagedPoolUsage + QuotaPeakPagedPoolUsage + VirtualSize + WorkingSetSize + + + + IO + + Name + ProcessId + ReadOperationCount + ReadTransferCount + WriteOperationCount + WriteTransferCount + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + ThreadCount + HandleCount + Name + Priority + ProcessId + WorkingSetSize + + + + + + STATISTICS + + HandleCount + Name + KernelModeTime + MaximumWorkingSetSize + MinimumWorkingSetSize + OtherOperationCount + OtherTransferCount + PageFaults + PageFileUsage + PeakPageFileUsage + PeakVirtualSize + PeakWorkingSetSize + PrivatePageCount + ProcessId + QuotaNonPagedPoolUsage + QuotaPagedPoolUsage + QuotaPeakNonPagedPoolUsage + QuotaPeakPagedPoolUsage + ReadOperationCount + ReadTransferCount + ThreadCount + UserModeTime + VirtualSize + WorkingSetSize + WriteOperationCount + WriteTransferCount + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Product + + + PSStatus + + Name + Version + InstallState + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + IdentifyingNumber + Name + Vendor + Version + Caption + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_QuickFixEngineering + + + InstalledOn + + if ([environment]::osversion.version.build -ge 7000) + { + # WMI team fixed the formatting issue related to InstalledOn + # property in Windows7 (to return string)..so returning the WMI's + # version directly + [DateTime]::Parse($this.psBase.CimInstanceProperties["InstalledOn"].Value) + } + else + { + $orig = $this.psBase.CimInstanceProperties["InstalledOn"].Value + $date = [datetime]::FromFileTimeUTC($("0x" + $orig)) + if ($date -lt "1/1/1980") + { + if ($orig -match "([0-9]{4})([01][0-9])([012][0-9])") + { + new-object datetime @([int]$matches[1], [int]$matches[2], [int]$matches[3]) + } + } + else + { + $date + } + } + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Description + FixComments + HotFixID + InstallDate + InstalledBy + InstalledOn + Name + ServicePackInEffect + Status + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_QuotaSetting + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + DefaultLimit + SettingID + State + VolumePath + DefaultWarningLimit + + + + + + PSStatus + + State + VolumePath + Caption + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_OSRecoveryConfiguration + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DebugFilePath + Name + SettingID + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Registry + + + PSStatus + + Status + CurrentSize + MaximumSize + ProposedSize + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + CurrentSize + MaximumSize + Name + Caption + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_SCSIController + + + PSStatus + + Status + Name + StatusInfo + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DriverName + Manufacturer + Name + ProtocolSupported + Status + StatusInfo + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_PerfRawData_PerfNet_Server + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + LogonPerSec + LogonTotal + Name + ServerSessions + WorkItemShortages + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Service + + + PSStandardMembers + + + DefaultDisplayPropertySet + + ExitCode + Name + ProcessId + StartMode + State + Status + + + + + + PSStatus + + Name + Status + ExitCode + + + + PSConfiguration + + DesktopInteract + ErrorControl + Name + PathName + ServiceType + StartMode + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_Share + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Name + Path + Description + + + + + + PSStatus + + Status + Type + Name + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_SoftwareElement + + + PSStatus + + Status + SoftwareElementState + Name + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + Name + Path + SerialNumber + SoftwareElementID + Version + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_SoftwareFeature + + + PSStatus + + Status + Name + InstallState + LastUse + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + IdentifyingNumber + ProductName + Vendor + Version + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/WIN32_SoundDevice + + + PSStatus + + ConfigManagerUserConfig + Name + Status + StatusInfo + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Manufacturer + Name + Status + StatusInfo + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_StartupCommand + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Command + User + Caption + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_SystemAccount + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Caption + Domain + Name + SID + + + + + + PSStatus + + Status + SIDType + Name + Domain + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_SystemDriver + + + PSStatus + + Status + Name + State + ExitCode + Started + ServiceSpecificExitCode + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DisplayName + Name + State + Status + Started + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_SystemEnclosure + + + PSStatus + + Tag + Status + Name + SecurityStatus + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Manufacturer + Model + LockPresent + SerialNumber + SMBIOSAssetTag + SecurityStatus + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_SystemSlot + + + PSStatus + + Status + SlotDesignation + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + SlotDesignation + Tag + SupportsHotPlug + Status + Shared + PMESignal + MaxDataWidth + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_TapeDrive + + + PSStatus + + Status + Availability + DeviceID + NeedsCleaning + StatusInfo + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DeviceID + Id + Manufacturer + Name + Caption + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_TemperatureProbe + + + PSStatus + + Status + CurrentReading + DeviceID + Name + StatusInfo + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + CurrentReading + Name + Description + MinReadable + MaxReadable + Status + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_TimeZone + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Bias + SettingID + Caption + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_UninterruptiblePowerSupply + + + PSStatus + + Status + DeviceID + EstimatedChargeRemaining + EstimatedRunTime + Name + StatusInfo + TimeOnBackup + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + DeviceID + EstimatedRunTime + Name + TimeOnBackup + UPSPort + Caption + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_UserAccount + + + PSStatus + + Status + Caption + PasswordExpires + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + AccountType + Caption + Domain + SID + FullName + Name + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_VoltageProbe + + + PSStatus + + Status + DeviceID + Name + NominalReading + StatusInfo + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Status + Description + CurrentReading + MaxReadable + MinReadable + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_VolumeQuotaSetting + + + PSStandardMembers + + + DefaultDisplayPropertySet + + Element + Setting + + + + + + + + Microsoft.Management.Infrastructure.CimInstance#root/cimv2/Win32_WMISetting + + + PSStandardMembers + + + DefaultDisplayPropertySet + + BuildVersion + Caption + DatabaseDirectory + EnableEvents + LoggingLevel + SettingID + + + + + + + + + Microsoft.Management.Infrastructure.CimClass + + + CimClassName + + [OutputType([string])] + param() + $this.PSBase.CimSystemProperties.ClassName + + + + + + + Microsoft.Management.Infrastructure.CimCmdlets.CimIndicationEventInstanceEventArgs + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + + System.Management.Automation.Breakpoint + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Management.Automation.Breakpoint + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + + System.Management.Automation.BreakpointUpdatedEventArgs + + + PSStandardMembers + + + SerializationDepth + 2 + + + + + + + Deserialized.System.Management.Automation.BreakpointUpdatedEventArgs + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + + System.Management.Automation.DebuggerCommand + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Management.Automation.DebuggerCommand + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + + System.Management.Automation.DebuggerCommandResults + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Management.Automation.DebuggerCommandResults + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + \ No newline at end of file diff --git a/newton-cn/bin/v1.0/typesv3.ps1xml b/newton-cn/bin/v1.0/typesv3.ps1xml new file mode 100644 index 0000000..fcb138b --- /dev/null +++ b/newton-cn/bin/v1.0/typesv3.ps1xml @@ -0,0 +1,343 @@ + + + + System.Security.Cryptography.X509Certificates.X509Certificate2 + + + EnhancedKeyUsageList + + ,(new-object Microsoft.Powershell.Commands.EnhancedKeyUsageProperty -argumentlist $this).EnhancedKeyUsageList; + + + + DnsNameList + + ,(new-object Microsoft.Powershell.Commands.DnsNameProperty -argumentlist $this).DnsNameList; + + + + SendAsTrustedIssuer + + [Microsoft.Powershell.Commands.SendAsTrustedIssuerProperty]::ReadSendAsTrustedIssuerProperty($this) + + + $sendAsTrustedIssuer = $args[0] + [Microsoft.Powershell.Commands.SendAsTrustedIssuerProperty]::WriteSendAsTrustedIssuerProperty($this,$this.PsPath,$sendAsTrustedIssuer) + + + + + + System.Management.Automation.Remoting.PSSenderInfo + + + ConnectedUser + + $this.UserInfo.Identity.Name + + + + RunAsUser + + if($this.UserInfo.WindowsIdentity -ne $null) + { + $this.UserInfo.WindowsIdentity.Name + } + + + + + + System.Management.Automation.CompletionResult + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Management.Automation.CompletionResult + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Management.Automation.CommandCompletion + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Management.Automation.CommandCompletion + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + Microsoft.PowerShell.Commands.ModuleSpecification + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.Microsoft.PowerShell.Commands.ModuleSpecification + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Management.Automation.JobStateEventArgs + + + PSStandardMembers + + + SerializationDepth + 2 + + + + + + + Deserialized.System.Management.Automation.JobStateEventArgs + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Exception + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + System.Management.Automation.Remoting.PSSessionOption + + + PSStandardMembers + + + SerializationDepth + 1 + + + + + + + Deserialized.System.Management.Automation.Remoting.PSSessionOption + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.Management.Automation.DebuggerStopEventArgs + + + SerializedInvocationInfo + + Microsoft.PowerShell.DeserializingTypeConverter + GetInvocationInfo + + + + PSStandardMembers + + + SerializationDepth + 2 + + + SerializationMethod + SpecificProperties + + + PropertySerializationSet + + Breakpoints + ResumeAction + SerializedInvocationInfo + + + + + + + + Deserialized.System.Management.Automation.DebuggerStopEventArgs + + + PSStandardMembers + + + TargetTypeForDeserialization + Microsoft.PowerShell.DeserializingTypeConverter + + + + + + + System.IO.DirectoryInfo + + + Mode + + Microsoft.PowerShell.Commands.FileSystemProvider + Mode + + + + BaseName + + $this.Name + + + + Target + + Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods + GetTarget + + + + LinkType + + Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods + GetLinkType + + + + PSStandardMembers + + + DefaultDisplayProperty + Name + + + + + + + System.IO.FileInfo + + + Mode + + Microsoft.PowerShell.Commands.FileSystemProvider + Mode + + + + VersionInfo + + [System.Diagnostics.FileVersionInfo]::GetVersionInfo($this.FullName) + + + + BaseName + + if ($this.Extension.Length -gt 0){$this.Name.Remove($this.Name.Length - $this.Extension.Length)}else{$this.Name} + + + + Target + + Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods + GetTarget + + + + LinkType + + Microsoft.PowerShell.Commands.InternalSymbolicLinkLinkCodeMethods + GetLinkType + + + + PSStandardMembers + + + DefaultDisplayPropertySet + + LastWriteTime + Length + Name + + + + + + + \ No newline at end of file