PowerShell module for FleetDM API integration
Creates a new policy in FleetDM
New-FleetPolicy [-Name] <String> [-Query] <String> [[-Description] <String>] [[-Resolution] <String>]
[[-Platform] <String>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
Creates a new policy in FleetDM. Policies are compliance rules that are regularly checked on hosts.
New-FleetPolicy -Name "Firewall Enabled" -Query "SELECT 1 FROM windows_firewall WHERE enabled = 1;"
Creates a basic policy to check if Windows Firewall is enabled
$params = @{
Name = "FileVault Enabled"
Query = "SELECT 1 FROM filevault_status WHERE status = 'on';"
Description = "Ensures FileVault disk encryption is enabled"
Resolution = "Enable FileVault in System Preferences > Security & Privacy"
Platform = "darwin"
}
New-FleetPolicy @params
Creates a comprehensive macOS policy with all details
Import-Csv policies.csv | ForEach-Object {
New-FleetPolicy -Name $_.Name -Query $_.Query -Description $_.Description
}
Bulk creates policies from a CSV file
The name of the policy
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The SQL query that defines the policy check. Should return 1 row for compliant hosts.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
A description of what the policy checks
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Steps to resolve the issue when the policy fails
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The platform this policy applies to (windows, linux, darwin, chrome, or all)
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: All
Accept pipeline input: False
Accept wildcard characters: False
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.