Examples
EXAMPLE 1
# Output object for a single test number from audit results
Export-M365SecurityAuditTable -AuditResults $object -OutputTestNumber 6.1.2
Export-M365SecurityAuditTable -AuditResults $object -OutputTestNumber 6.1.2
# Output object for a single test number from audit results
EXAMPLE 2
# Export all results from audit results to the specified path
Export-M365SecurityAuditTable -ExportAllTests -AuditResults $object -ExportPath "C:\temp"
Export-M365SecurityAuditTable -ExportAllTests -AuditResults $object -ExportPath "C:\temp"
# Export all results from audit results to the specified path
EXAMPLE 3
# Output object for a single test number from CSV
Export-M365SecurityAuditTable -CsvPath "C:\temp\auditresultstoday1.csv" -OutputTestNumber 6.1.2
Export-M365SecurityAuditTable -CsvPath "C:\temp\auditresultstoday1.csv" -OutputTestNumber 6.1.2
# Output object for a single test number from CSV
EXAMPLE 4
# Export all results from CSV to the specified path
Export-M365SecurityAuditTable -ExportAllTests -CsvPath "C:\temp\auditresultstoday1.csv" -ExportPath "C:\temp"
Export-M365SecurityAuditTable -ExportAllTests -CsvPath "C:\temp\auditresultstoday1.csv" -ExportPath "C:\temp"
# Export all results from CSV to the specified path
EXAMPLE 5
# Export all results from audit results to the specified path along with the original tests
Export-M365SecurityAuditTable -ExportAllTests -AuditResults $object -ExportPath "C:\temp" -ExportOriginalTests
Export-M365SecurityAuditTable -ExportAllTests -AuditResults $object -ExportPath "C:\temp" -ExportOriginalTests
# Export all results from audit results to the specified path along with the original tests
EXAMPLE 6
# Export all results from CSV to the specified path along with the original tests
Export-M365SecurityAuditTable -ExportAllTests -CsvPath "C:\temp\auditresultstoday1.csv" -ExportPath "C:\temp" -ExportOriginalTests
Export-M365SecurityAuditTable -ExportAllTests -CsvPath "C:\temp\auditresultstoday1.csv" -ExportPath "C:\temp" -ExportOriginalTests
# Export all results from CSV to the specified path along with the original tests
Links
Syntax
Get-AdminRoleUserLicense [-SkipGraphConnection] [<CommonParameters>]
Parameters
Inputs
- None. You cannot pipe objects to Get-AdminRoleUserLicense.
Syntax
Get-MFAStatus [[-UserId] <String>] [<CommonParameters>]
Parameters
Outputs
- System.Object Returns a sorted list of custom objects containing the following properties: - UserPrincipalName - DisplayName - MFAState - MFADefaultMethod - MFAPhoneNumber - PrimarySMTP - Aliases
Syntax
Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-DoNotConfirmConnections] [-WhatIf] [-Confirm] [<CommonParameters>]Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-WhatIf] [-Confirm] [<CommonParameters>]Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] -ELevel <String> -ProfileLevel <String> [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-DoNotConfirmConnections] [-WhatIf] [-Confirm] [<CommonParameters>]Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] -ELevel <String> -ProfileLevel <String> [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-WhatIf] [-Confirm] [<CommonParameters>]Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] -IncludeIG1 [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-DoNotConfirmConnections] [-WhatIf] [-Confirm] [<CommonParameters>]Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] -IncludeIG1 [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-WhatIf] [-Confirm] [<CommonParameters>]Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] -IncludeIG2 [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-DoNotConfirmConnections] [-WhatIf] [-Confirm] [<CommonParameters>]Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] -IncludeIG2 [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-WhatIf] [-Confirm] [<CommonParameters>]Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] -IncludeIG3 [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-DoNotConfirmConnections] [-WhatIf] [-Confirm] [<CommonParameters>]Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] -IncludeIG3 [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-WhatIf] [-Confirm] [<CommonParameters>]Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] -IncludeRecommendation <String[]> [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-DoNotConfirmConnections] [-WhatIf] [-Confirm] [<CommonParameters>]Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] -IncludeRecommendation <String[]> [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-WhatIf] [-Confirm] [<CommonParameters>]Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] -SkipRecommendation <String[]> [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-DoNotConfirmConnections] [-WhatIf] [-Confirm] [<CommonParameters>]Invoke-M365SecurityAudit [-TenantAdminUrl <String>] [-M365DomainForPWPolicyTest <String>] -SkipRecommendation <String[]> [-DoNotConnect] [-DoNotDisconnect] [-NoModuleCheck] [-WhatIf] [-Confirm] [<CommonParameters>]
Parameters
Name | Alias | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
TenantAdminUrl | The URL of the tenant admin. If not specified, none of the SharePoint Online tests will run. | false | false | ||
M365DomainForPWPolicyTest | The domain name of the Microsoft 365 environment to test. This parameter is not mandatory and by default it will pass/fail all found domains as a group if a specific domain is not specified. | false | false | ||
ELevel | Specifies the E-Level (E3 or E5) for the audit. This parameter is optional and can be combined with the ProfileLevel parameter. | true | false | ||
ProfileLevel | Specifies the profile level (L1 or L2) for the audit. This parameter is optional and can be combined with the ELevel parameter. | true | false | ||
IncludeIG1 | If specified, includes tests where IG1 is true. | true | false | False | |
IncludeIG2 | If specified, includes tests where IG2 is true. | true | false | False | |
IncludeIG3 | If specified, includes tests where IG3 is true. | true | false | False | |
IncludeRecommendation | Specifies specific recommendations to include in the audit. Accepts an array of recommendation numbers. | true | false | ||
SkipRecommendation | Specifies specific recommendations to exclude from the audit. Accepts an array of recommendation numbers. | true | false | ||
DoNotConnect | If specified, the cmdlet will not establish a connection to Microsoft 365 services. | false | false | False | |
DoNotDisconnect | If specified, the cmdlet will not disconnect from Microsoft 365 services after execution. | false | false | False | |
NoModuleCheck | If specified, the cmdlet will not check for the presence of required modules. | false | false | False | |
WhatIf | wi | false | false | ||
Confirm | cf | false | false |
Name | Alias | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
TenantAdminUrl | The URL of the tenant admin. If not specified, none of the SharePoint Online tests will run. | false | false | ||
M365DomainForPWPolicyTest | The domain name of the Microsoft 365 environment to test. This parameter is not mandatory and by default it will pass/fail all found domains as a group if a specific domain is not specified. | false | false | ||
ELevel | Specifies the E-Level (E3 or E5) for the audit. This parameter is optional and can be combined with the ProfileLevel parameter. | true | false | ||
ProfileLevel | Specifies the profile level (L1 or L2) for the audit. This parameter is optional and can be combined with the ELevel parameter. | true | false | ||
IncludeIG1 | If specified, includes tests where IG1 is true. | true | false | False | |
IncludeIG2 | If specified, includes tests where IG2 is true. | true | false | False | |
IncludeIG3 | If specified, includes tests where IG3 is true. | true | false | False | |
IncludeRecommendation | Specifies specific recommendations to include in the audit. Accepts an array of recommendation numbers. | true | false | ||
SkipRecommendation | Specifies specific recommendations to exclude from the audit. Accepts an array of recommendation numbers. | true | false | ||
DoNotConnect | If specified, the cmdlet will not establish a connection to Microsoft 365 services. | false | false | False | |
DoNotDisconnect | If specified, the cmdlet will not disconnect from Microsoft 365 services after execution. | false | false | False | |
NoModuleCheck | If specified, the cmdlet will not check for the presence of required modules. | false | false | False | |
DoNotConfirmConnections | If specified, the cmdlet will not prompt for confirmation before proceeding with established connections and will disconnect from all of them. | false | false | False | |
WhatIf | wi | false | false | ||
Confirm | cf | false | false |
Inputs
- None. You cannot pipe objects to Invoke-M365SecurityAudit.
Synopsis
Synchronizes data between an Excel file and either a CSV file or an output object from Invoke-M365SecurityAudit, and optionally updates the Excel worksheet.
Synchronizes and updates data in an Excel worksheet with new information from a CSV file, including audit dates.
Syntax
Sync-CISExcelAndCsvData -ExcelPath <String> -WorksheetName <String> -CsvPath <String> [-SkipUpdate] [<CommonParameters>] Sync-CISExcelAndCsvData -ExcelPath <String> -WorksheetName <String> -AuditResults <CISAuditResult[]> [-SkipUpdate] [<CommonParameters>]
Sync-CISExcelAndCsvData [[-ExcelPath] <String>] [[-CsvPath] <String>] [[-SheetName] <String>] [<CommonParameters>]
Parameters
Name | Alias | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
ExcelPath | The path to the Excel file that contains the original data. This parameter is mandatory. | true | false | ||
WorksheetName | The name of the worksheet within the Excel file that contains the data to be synchronized. This parameter is mandatory. | true | false | ||
CsvPath | The path to the CSV file containing data to be merged with the Excel data. This parameter is mandatory when using the CsvInput parameter set. | true | false | ||
AuditResults | An array of CISAuditResult objects from Invoke-M365SecurityAudit to be merged with the Excel data. This parameter is mandatory when using the ObjectInput parameter set. It can also accept pipeline input. | true | true (ByValue) | ||
SkipUpdate | If specified, the function will return the merged data object without updating the Excel worksheet. This is useful for previewing the merged data. | false | false | False |
Name | Alias | Description | Required? | Pipeline Input | Default Value |
---|---|---|---|---|---|
ExcelPath | Specifies the path to the Excel file to be updated. This parameter is mandatory. | false | false | ||
CsvPath | Specifies the path to the CSV file containing new data. This parameter is mandatory. | false | false | ||
SheetName | Specifies the name of the worksheet in the Excel file where data will be merged and updated. This parameter is mandatory. | false | false |
Inputs
- System.String, CISAuditResult[] You can pipe CISAuditResult objects to Sync-CISExcelAndCsvData.
- System.String The function accepts strings for file paths and worksheet names.
Outputs
- Object[] If the SkipUpdate switch is used, the function returns an array of custom objects representing the merged data.
- None The function directly updates the Excel file and does not output any objects.
Note
- Ensure that the 'ImportExcel' module is installed and up to date. - It is recommended to backup the Excel file before running this script to prevent accidental data loss. - This function is part of the CIS Excel and CSV Data Management Toolkit.
- Ensure that the 'ImportExcel' module is installed and up to date to handle Excel file manipulations. - It is recommended to back up the Excel file before running this function to avoid accidental data loss. - The CSV file should have columns that match expected headers like 'Connection', 'Details', 'FailureReason', and 'Status' for correct data mapping.
Examples
EXAMPLE 1
Sync-CISExcelAndCsvData -ExcelPath "path\to\excel.xlsx" -CsvPath "path\to\data.csv" -SheetName "AuditData"Sync-CISExcelAndCsvData -ExcelPath "path\to\excel.xlsx" -WorksheetName "DataSheet" -CsvPath "path\to\data.csv"
Merges data from 'data.csv' into 'excel.xlsx' on the 'DataSheet' worksheet and updates the worksheet with the merged data.
EXAMPLE 2
$mergedData = Sync-CISExcelAndCsvData -ExcelPath "path\to\excel.xlsx" -WorksheetName "DataSheet" -CsvPath "path\to\data.csv" -SkipUpdate
Retrieves the merged data object for preview without updating the Excel worksheet.
EXAMPLE 3
$auditResults = Invoke-M365SecurityAudit -TenantAdminUrl "https://tenant-admin.url" -DomainName "example.com"
PS> Sync-CISExcelAndCsvData -ExcelPath "path\to\excel.xlsx" -WorksheetName "DataSheet" -AuditResults $auditResults
Merges data from the audit results into 'excel.xlsx' on the 'DataSheet' worksheet and updates the worksheet with the merged data.
EXAMPLE 4
$auditResults = Invoke-M365SecurityAudit -TenantAdminUrl "https://tenant-admin.url" -DomainName "example.com"
PS> $mergedData = Sync-CISExcelAndCsvData -ExcelPath "path\to\excel.xlsx" -WorksheetName "DataSheet" -AuditResults $auditResults -SkipUpdate
Retrieves the merged data object for preview without updating the Excel worksheet.
EXAMPLE 5
Invoke-M365SecurityAudit -TenantAdminUrl "https://tenant-admin.url" -DomainName "example.com" | Sync-CISExcelAndCsvData -ExcelPath "path\to\excel.xlsx" -WorksheetName "DataSheet"
Pipes the audit results into Sync-CISExcelAndCsvData to merge data into 'excel.xlsx' on the 'DataSheet' worksheet and updates the worksheet with the merged data.
Updates the 'AuditData' worksheet in 'excel.xlsx' with data from 'data.csv', adding new information and the date of the update.