-
Notifications
You must be signed in to change notification settings - Fork 48
Add Microsoft.Windows.Assertion Module #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
7c5d5cd
Add Microsoft.Windows.Assertion
Trenly e5ced65
Add tests
Trenly dce219b
Add documentation for PnPDevice
Trenly e2e5257
Update tags
Trenly a53c35f
Comment Cleanup and lint
Trenly 7786752
Fix ScriptAnalyser issues
Trenly 138dae7
Merge branch 'microsoft:main' into Specifications
Trenly 58e56fc
Add License and Project URIs
Trenly f8593ca
Merge remote-tracking branch 'upstream/main' into Specifications
Trenly 6b132c6
Get rid of SIDs
Trenly 69549a5
Fix spelling, Fix tests, Use Ensure when needed
Trenly c302add
Merge branch 'main' into Specifications
Trenly f30a48c
Return Correct Types for DSC Functions
Trenly 7803eb3
Add throws to all setter methods; Add related tests
Trenly 29bf69e
Spelling
Trenly a2bd31f
I always forget to remove my test files . . .
Trenly 15a4f84
Be more explicit about the error message expected from the setters
Trenly 2b95b72
Merge remote-tracking branch 'upstream/main' into Specifications
Trenly ba8b398
Fix bracket error
Trenly 993a4c7
Merge remote-tracking branch 'upstream/main' into Specifications
Trenly 906f503
Try using latest version of Pester
Trenly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,7 @@ uilt | |
| Windo | ||
| ELSPROBLEMS | ||
| requ | ||
| PDevice | ||
| whatif | ||
| pscustomobject | ||
| VGpu | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,4 +19,6 @@ ssh | |
| usr | ||
| versioning | ||
| VGpu | ||
| pnp | ||
| RTX | ||
| ADDLOCAL | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| --- | ||
| external help file: Microsoft.Windows.Assertion.psm1-Help.xml | ||
| Module Name: Microsoft.Windows.Assertion | ||
| ms.date: 11/2/2024 | ||
| online version: | ||
| schema: 2.0.0 | ||
| title: PnPDevice | ||
| --- | ||
|
|
||
| # PnPDevice | ||
|
|
||
| ## SYNOPSIS | ||
|
|
||
| Ensures at least one PnP Device is connected which matches the required parameters | ||
|
|
||
| ## DESCRIPTION | ||
|
|
||
| The `PnPDevice` DSC Resource allows you to check for specific PnP Devices on the system as a pre-requisite for invoking other DSC Resources. This resource does not have the capability to modify PnP Device information. | ||
|
|
||
| ## PARAMETERS | ||
|
|
||
| **Parameter**|**Attribute**|**DataType**|**Description**|**Allowed Values** | ||
| :-----|:-----|:-----|:-----|:----- | ||
| `FriendlyName`|Optional|String[]|The name of the PnP Device to be found|-- | ||
| `DeviceClass`|Optional|String[]|The PnP Class of the PnP Device to be found.| For example: `Display` or `Keyboard` or `PrintQueue` | ||
| `Status`|Optional|String[]|The current status of the PnP Device to be found|`OK`, `ERROR`, `DEGRADED`, `UNKNOWN` | ||
|
|
||
| ## EXAMPLES | ||
|
|
||
| ### Example 1 | ||
|
|
||
| ```powershell | ||
| # Check that a device with a specific name is connected | ||
| $params = @{ | ||
| FriendlyName = 'NVIDIA RTX A1000 Laptop GPU' | ||
| } | ||
| Invoke-DscResource -Name PnPDevice -Method Test -Property $params -ModuleName Microsoft.Windows.Assertion | ||
| ``` | ||
|
|
||
| ### EXAMPLE 2 | ||
|
|
||
| ```powershell | ||
| # Check that any PnP Device is in the error state | ||
| $params = @{ | ||
| Status = 'ERROR' | ||
| } | ||
| Invoke-DscResource -Name PnPDevice -Method Test -Property $params -ModuleName Microsoft.Windows.Assertion | ||
| ``` | ||
|
|
||
| ### EXAMPLE 3 | ||
|
|
||
| ```powershell | ||
| # Check that any Keyboard or Mouse is in the error state | ||
| $params = @{ | ||
| DeviceClass = @('Keyboard'; 'Mouse') | ||
| Status = 'ERROR' | ||
| } | ||
| Invoke-DscResource -Name PnPDevice -Method Test -Property $params -ModuleName Microsoft.Windows.Assertion | ||
| ``` | ||
|
|
||
| ### EXAMPLE 4 | ||
|
|
||
| ```powershell | ||
| # Check that a specific device is operational | ||
| $params = @{ | ||
| FriendlyName = 'Follow-You-Printing' | ||
| DeviceClass = 'PrintQueue' | ||
| Status = 'OK' | ||
| } | ||
| Invoke-DscResource -Name PnPDevice -Method Test -Property $params -ModuleName Microsoft.Windows.Assertion | ||
| ``` |
52 changes: 52 additions & 0 deletions
52
resources/Microsoft.Windows.Assertion/Microsoft.Windows.Assertion.psd1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. | ||
| @{ | ||
| RootModule = 'Microsoft.Windows.Assertion.psm1' | ||
| ModuleVersion = '0.1.0' | ||
| GUID = 'e3510ba2-cc19-4fb2-872a-a40833c30e58' | ||
| Author = 'Microsoft Corporation' | ||
| CompanyName = 'Microsoft Corporation' | ||
| Copyright = '(c) Microsoft Corp. All rights reserved.' | ||
| Description = 'DSC Module for ensuring the system meets certain specifications' | ||
| PowerShellVersion = '7.2' | ||
| DscResourcesToExport = @( | ||
| 'OsEditionId', | ||
| 'SystemArchitecture', | ||
| 'ProcessorArchitecture', | ||
| 'HyperVisor', | ||
| 'OsInstallDate', | ||
| 'OsVersion', | ||
| 'CsManufacturer', | ||
| 'CsModel', | ||
| 'CsDomain', | ||
| 'PowerShellVersion', | ||
| 'PnPDevice' | ||
| ) | ||
| PrivateData = @{ | ||
| PSData = @{ | ||
| # A URL to the license for this module. | ||
| LicenseUri = 'https://github.com/microsoft/winget-dsc#MIT-1-ov-file' | ||
|
|
||
| # A URL to the main website for this project. | ||
| ProjectUri = 'https://github.com/microsoft/winget-dsc' | ||
|
|
||
| # Tags applied to this module. These help with module discovery in online galleries. | ||
| Tags = @( | ||
| 'PSDscResource_OsEditionId', | ||
| 'PSDscResource_SystemArchitecture', | ||
| 'PSDscResource_ProcessorArchitecture', | ||
| 'PSDscResource_HyperVisor', | ||
| 'PSDscResource_OsInstallDate', | ||
| 'PSDscResource_OsVersion', | ||
| 'PSDscResource_CsManufacturer', | ||
| 'PSDscResource_CsModel', | ||
| 'PSDscResource_CsDomain', | ||
| 'PSDscResource_PowerShellVersion', | ||
| 'PSDscResource_PnPDevice' | ||
| ) | ||
|
|
||
| # Prerelease string of this module | ||
| Prerelease = 'alpha' | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.