Skip to content
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

Add Microsoft.Windows.Assertion Module #90

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# top-most EditorConfig file
root=true

# Apply Windows-style newlines with a newline ending on every file, using UTF-8, and removing extra whitespace before newlines
[*]
end_of_line = crlf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true

# Overrides for Markdown Files - Use tab for indents (accessibility)
[*.md]
indent_style = tab

[{allow.txt,excludes.txt,patterns.txt}]
end_of_line = lf
4 changes: 4 additions & 0 deletions pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ extends:
displayName: "Publish Pipeline Microsoft.DotNet.Dsc"
targetPath: $(Build.SourcesDirectory)\resources\Microsoft.DotNet.Dsc\
artifactName: Microsoft.DotNet.Dsc
- output: pipelineArtifact
displayName: "Publish Pipeline Microsoft.Windows.Assertion"
targetPath: $(Build.SourcesDirectory)\resources\Microsoft.Windows.Assertion\
artifactName: Microsoft.Windows.Assertion"

steps:
- checkout: self
Expand Down
71 changes: 71 additions & 0 deletions resources/Help/Microsoft.Windows.Assertion/PnPDevice.md
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 exampe: `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 = @{
FrienlyName = 'Follow-You-Printing'
DeviceClass = 'PrintQueue'
Status = 'OK'
}
Invoke-DscResource -Name PnPDevice -Method Test -Property $params -ModuleName Microsoft.Windows.Assertion
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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',
'HyperVisorPresent',
'OsInstallDate',
'OsVersion',
'CsManufacturer',
'CsModel',
'CsDomain',
'PowerShellVersion',
'PnPDevice'
)
PrivateData = @{
PSData = @{
# Tags applied to this module. These help with module discovery in online galleries.
Trenly marked this conversation as resolved.
Show resolved Hide resolved
Tags = @(
'PSDscResource_OsEditionId',
'PSDscResource_SystemArchitecture',
'PSDscResource_ProcessorArchitecture',
'PSDscResource_HyperVisorPresent',
'PSDscResource_OsInstallDate',
'PSDscResource_OsVersion',
'PSDscResource_CsManufacturer',
'PSDscResource_CsModel',
'PSDscResource_CsDomain',
'PSDscResource_PowerShellVersion',
'PSDscResource_PnPDevice'
)

# Prerelease string of this module
Prerelease = 'alpha'
}
}
}
Loading