File tree Expand file tree Collapse file tree 4 files changed +64
-2
lines changed Expand file tree Collapse file tree 4 files changed +64
-2
lines changed Original file line number Diff line number Diff line change 64
64
continue-on-error : true
65
65
run : |
66
66
[xml]$coverage = Get-Content .\coverage.xml
67
- [int]$covered = $coverage.report.counter | Where-Object type -eq 'INSTRUCTION ' | select -ExpandProperty 'covered'
68
- [int]$missed = $coverage.report.counter | Where-Object type -eq 'INSTRUCTION ' | select -ExpandProperty 'missed'
67
+ [int]$covered = $coverage.report.counter | Where-Object type -eq 'METHOD ' | select -ExpandProperty 'covered'
68
+ [int]$missed = $coverage.report.counter | Where-Object type -eq 'METHOD ' | select -ExpandProperty 'missed'
69
69
[int]$sum = $covered + $missed
70
70
$coveredPercent = [Math]::Floor(($covered * 100 / $sum) * 100) / 100
71
71
$readme = Get-Content ./README.md
Original file line number Diff line number Diff line change 84
84
' Get-MdeConfigurationScore'
85
85
' Get-MdeExposureScore'
86
86
' Get-MdeExposureScoreByMachineGroups'
87
+ ' Get-MdeLibraryFiles'
87
88
' Get-MdeLiveResponseResult'
88
89
' Get-MdeMachine'
89
90
' Get-MdeMachineAction'
Original file line number Diff line number Diff line change
1
+ <#
2
+ . SYNOPSIS
3
+ List live response library files.
4
+
5
+ . DESCRIPTION
6
+ List live response library files.
7
+
8
+ . NOTES
9
+ Author: Jan-Henrik Damaschke
10
+
11
+ . LINK
12
+ https://learn.microsoft.com/en-us/microsoft-365/security/defender-endpoint/list-library-files?view=o365-worldwide
13
+
14
+ . EXAMPLE
15
+ Get-MdeLibraryFiles
16
+
17
+ . ROLE
18
+ @(@{permission = 'Library.Manage'; permissionType = 'Application'}, @{permission = 'Library.Manage'; permissionType = 'Delegated'})
19
+ #>
20
+
21
+ function Get-MdeLibraryFiles {
22
+ [CmdletBinding ()]
23
+ param ()
24
+ Begin {
25
+ if (-not (Test-MdePermissions - functionName $PSCmdlet.CommandRuntime )) {
26
+ $requiredRoles = (Get-Help $PSCmdlet.CommandRuntime - Full).role | Invoke-Expression
27
+ Throw " Missing required permission(s). Please check if one of these is in current token roles: $ ( $requiredRoles.permission ) "
28
+ }
29
+ }
30
+ Process {
31
+ return Invoke-AzureRequest - Uri " https://api.securitycenter.microsoft.com/api/libraryfiles"
32
+ }
33
+ End {}
34
+ }
Original file line number Diff line number Diff line change
1
+ BeforeAll {
2
+ Remove-Module PSMDE - Force - ErrorAction SilentlyContinue
3
+ Import-Module (Split-Path $PSCommandPath ).replace(' tests' , ' src' ).Replace(' public' , ' PSMDE.psd1' )
4
+ }
5
+
6
+ Describe " Get-MdeLibraryFiles" {
7
+
8
+ It ' Should have the PSMDE module loaded' {
9
+ $module = Get-Module PSMDE
10
+ $module | Should -Not - BeNullOrEmpty
11
+ }
12
+
13
+ It ' Should have access to internal functions' {
14
+ InModuleScope PSMDE {
15
+ $cmd = Get-Command Invoke-RetryRequest
16
+ $cmd | Should -Not - BeNullOrEmpty
17
+ }
18
+ }
19
+
20
+ It ' Should correctly create the request uri' {
21
+ InModuleScope PSMDE {
22
+ Mock Invoke-AzureRequest { return $uri }
23
+ Mock Test-MdePermissions { return $true }
24
+ Get-MdeLibraryFiles | Should - Be " https://api.securitycenter.microsoft.com/api/libraryfiles"
25
+ }
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments